mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-21 07:55:10 +02:00
Panel kitten: Add option to hide panel on focus loss
This commit is contained in:
@@ -152,6 +152,8 @@ def layer_shell_config(opts: PanelCLIOptions) -> LayerShellConfig:
|
||||
focus_policy = {
|
||||
'not-allowed': GLFW_FOCUS_NOT_ALLOWED, 'exclusive': GLFW_FOCUS_EXCLUSIVE, 'on-demand': GLFW_FOCUS_ON_DEMAND
|
||||
}.get(opts.focus_policy, GLFW_FOCUS_NOT_ALLOWED)
|
||||
if opts.hide_on_focus_loss:
|
||||
focus_policy = GLFW_FOCUS_ON_DEMAND
|
||||
x, y = dual_distance(opts.columns, min_cell_value_if_no_pixels=1), dual_distance(opts.lines, min_cell_value_if_no_pixels=1)
|
||||
return LayerShellConfig(type=ltype,
|
||||
edge=edge,
|
||||
@@ -164,6 +166,7 @@ def layer_shell_config(opts: PanelCLIOptions) -> LayerShellConfig:
|
||||
focus_policy=focus_policy,
|
||||
requested_exclusive_zone=opts.exclusive_zone,
|
||||
override_exclusive_zone=opts.override_exclusive_zone,
|
||||
hide_on_focus_loss=opts.hide_on_focus_loss,
|
||||
output_name=opts.output_name or '')
|
||||
|
||||
|
||||
|
||||
@@ -71,6 +71,9 @@ func main(cmd *cli.Command, opts *Options, args []string) (rc int, err error) {
|
||||
if conf.Start_as_hidden {
|
||||
argv = append(argv, `--start-as-hidden`)
|
||||
}
|
||||
if conf.Hide_on_focus_loss {
|
||||
argv = append(argv, `--hide-on-focus-loss`)
|
||||
}
|
||||
if opts.Detach {
|
||||
argv = append(argv, `--detach`)
|
||||
}
|
||||
|
||||
@@ -40,6 +40,11 @@ option of the same name, it is present here as it has a different
|
||||
default value for the quick access terminal.
|
||||
''')
|
||||
|
||||
opt('hide_on_focus_loss', 'no', option_type='to_bool', long_text='''
|
||||
Hide the window when it loses keyboard focus automatically. Using this option
|
||||
will force :opt:`focus_policy` to :code:`on-demand`.
|
||||
''')
|
||||
|
||||
opt('margin_left', '0', option_type='int',
|
||||
long_text='Set the left margin for the window, in pixels. Has no effect for windows on the right edge of the screen.')
|
||||
|
||||
@@ -67,8 +72,14 @@ opt('app_id', f'{appname}-quick-access',
|
||||
opt('start_as_hidden', 'no', option_type='to_bool',
|
||||
long_text='Whether to start the quick access terminal hidden. Useful if you are starting it as part of system startup.')
|
||||
|
||||
opt('focus_policy', 'exclusive', choices=('exclusive', 'on-demand'),
|
||||
long_text='How to manage window focus.')
|
||||
opt('focus_policy', 'exclusive', choices=('exclusive', 'on-demand'), long_text='''
|
||||
How to manage window focus. A value of :code:`exclusive` means prevent other windows from getting focus.
|
||||
However, whether this works is entirely dependent on the compositor/desktop environment.
|
||||
It does not have any effect on macOS and KDE, for example. Note that on sway using :code:`on-demand` means
|
||||
the compositor will not focus the window when it appears until you click on it, which is why the default is set
|
||||
to :code:`exclusive`.
|
||||
''')
|
||||
|
||||
|
||||
|
||||
def options_spec() -> str:
|
||||
|
||||
Reference in New Issue
Block a user