mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 01:05:48 +02:00
@@ -23,6 +23,11 @@ by using :code:`kitten desktop-ui color-scheme`.
|
||||
''')
|
||||
opt('accent_color', 'cyan', long_text='The RGB accent color for your system, can be specified as a color name or in hex a decimal format.')
|
||||
opt('contrast', 'normal', choices=('normal', 'high'), long_text='The preferred contrast level.')
|
||||
opt('file_chooser_size', '', long_text='''
|
||||
The size in lines and columns of the file chooser popup window. By default it is full screen. For example:
|
||||
:code:`file_chooser_size 25 80` will cause the popup to be of size 25 lines and 80 columns. Note that if you
|
||||
use this option, depending on the compositor you are running, the popup window may not be properly modal.
|
||||
''')
|
||||
opt('+file_chooser_kitty_conf', '',
|
||||
long_text='Path to config file to use for kitty when drawing the file chooser window. Can be specified multiple times. By default, the'
|
||||
' normal kitty.conf is used. Relative paths are resolved with respect to the kitty config directory.'
|
||||
|
||||
@@ -756,11 +756,31 @@ func (self *Portal) run_file_chooser(cfd ChooseFilesData) (response uint32, resu
|
||||
cmd := func() *exec.Cmd {
|
||||
self.lock.Lock()
|
||||
defer self.lock.Unlock()
|
||||
edge, lines, columns := `center`, ``, ``
|
||||
if self.opts.File_chooser_size != "" {
|
||||
l, c, _ := strings.Cut(self.opts.File_chooser_size, " ")
|
||||
if li, err := strconv.Atoi(strings.TrimSpace(l)); err == nil {
|
||||
if ci, err := strconv.Atoi(strings.TrimSpace(c)); err == nil {
|
||||
if li < 10 || ci < 40 {
|
||||
log.Printf("file chooser size %s too small, ignoring", self.opts.File_chooser_size)
|
||||
} else {
|
||||
edge, lines, columns = `center-sized`, l, c
|
||||
}
|
||||
} else {
|
||||
log.Printf("file chooser size %s invalid with error: %s\n", self.opts.File_chooser_size, err)
|
||||
}
|
||||
} else {
|
||||
log.Printf("file chooser size %s invalid with error: %s\n", self.opts.File_chooser_size, err)
|
||||
}
|
||||
}
|
||||
args := []string{
|
||||
"+kitten", "panel", "--layer=overlay", "--edge=center", "--focus-policy=exclusive",
|
||||
"+kitten", "panel", "--layer=overlay", "--edge=" + edge, "--focus-policy=exclusive",
|
||||
"-o", "background_opacity=0.85", "--wait-for-single-instance-window-close",
|
||||
"--grab-keyboard", "--single-instance", "--instance-group", "cfp-" + strconv.Itoa(os.Getpid()),
|
||||
}
|
||||
if edge == "center-sized" {
|
||||
args = append(args, "--lines="+lines, "--columns="+columns)
|
||||
}
|
||||
for _, x := range self.opts.File_chooser_kitty_conf {
|
||||
args = append(args, `-c`, x)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user