diff --git a/glfw/glfw3.h b/glfw/glfw3.h index 446032b6e..f68c34cb8 100644 --- a/glfw/glfw3.h +++ b/glfw/glfw3.h @@ -1300,7 +1300,7 @@ typedef struct GLFWkeyevent bool fake_event_on_focus_change; } GLFWkeyevent; -typedef enum { GLFW_LAYER_SHELL_NONE, GLFW_LAYER_SHELL_BACKGROUND, GLFW_LAYER_SHELL_PANEL } GLFWLayerShellType; +typedef enum { GLFW_LAYER_SHELL_NONE, GLFW_LAYER_SHELL_BACKGROUND, GLFW_LAYER_SHELL_PANEL, GLFW_LAYER_SHELL_TOP, GLFW_LAYER_SHELL_OVERLAY } GLFWLayerShellType; typedef enum { GLFW_EDGE_TOP, GLFW_EDGE_BOTTOM, GLFW_EDGE_LEFT, GLFW_EDGE_RIGHT } GLFWEdge; diff --git a/glfw/wl_window.c b/glfw/wl_window.c index c791a42f6..7910f3295 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -974,6 +974,8 @@ layer_set_properties(_GLFWwindow *window) { int panel_width = 0, panel_height = 0; switch (window->wl.layer_shell.config.type) { case GLFW_LAYER_SHELL_BACKGROUND: break; case GLFW_LAYER_SHELL_NONE: break; + case GLFW_LAYER_SHELL_TOP: + case GLFW_LAYER_SHELL_OVERLAY: case GLFW_LAYER_SHELL_PANEL: switch (window->wl.layer_shell.config.edge) { case GLFW_EDGE_TOP: @@ -1057,8 +1059,13 @@ create_layer_shell_surface(_GLFWwindow *window) { } window->decorated = false; // shell windows must not have decorations struct wl_output *wl_output = find_output_by_name(window->wl.layer_shell.config.output_name); - enum zwlr_layer_shell_v1_layer which_layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; - if (window->wl.layer_shell.config.type == GLFW_LAYER_SHELL_PANEL) which_layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; + enum zwlr_layer_shell_v1_layer which_layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND; // Default to background + switch (window->wl.layer_shell.config.type) { + case GLFW_LAYER_SHELL_BACKGROUND: break; case GLFW_LAYER_SHELL_NONE: break; + case GLFW_LAYER_SHELL_PANEL: which_layer = ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM; break; + case GLFW_LAYER_SHELL_TOP: which_layer = ZWLR_LAYER_SHELL_V1_LAYER_TOP; break; + case GLFW_LAYER_SHELL_OVERLAY: which_layer = ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY; break; + } #define ls window->wl.layer_shell.zwlr_layer_surface_v1 ls = zwlr_layer_shell_v1_get_layer_surface( _glfw.wl.zwlr_layer_shell_v1, window->wl.surface, wl_output, which_layer, "kitty"); diff --git a/kittens/panel/main.py b/kittens/panel/main.py index ee64126cb..f2a0b62af 100644 --- a/kittens/panel/main.py +++ b/kittens/panel/main.py @@ -14,6 +14,8 @@ from kitty.fast_data_types import ( GLFW_EDGE_TOP, GLFW_LAYER_SHELL_BACKGROUND, GLFW_LAYER_SHELL_PANEL, + GLFW_LAYER_SHELL_TOP, + GLFW_LAYER_SHELL_OVERLAY, glfw_primary_monitor_size, make_x11_window_a_dock_window, ) @@ -39,6 +41,14 @@ a background in your sway config it will cover the background drawn using this kitten. +--layer +choices=background, bottom, top, overlay +default=bottom +On a compositor that supports the wlr layer shell protocol, specifies the layer +on which the panel should be drawn. This parameter is ignored and set to +:code:`background` if --edge is set to :code:`background`. + + --config -c type=list Path to config file to use for kitty when drawing the panel. @@ -150,7 +160,11 @@ def initial_window_size_func(opts: WindowSizeData, cached_values: Dict[str, Any] def layer_shell_config(opts: PanelCLIOptions) -> LayerShellConfig: - ltype = GLFW_LAYER_SHELL_BACKGROUND if opts.edge == 'background' else GLFW_LAYER_SHELL_PANEL + ltype = {'background': GLFW_LAYER_SHELL_BACKGROUND, + 'bottom': GLFW_LAYER_SHELL_PANEL, + 'top': GLFW_LAYER_SHELL_TOP, + 'overlay': GLFW_LAYER_SHELL_OVERLAY}.get(opts.layer, GLFW_LAYER_SHELL_PANEL) + ltype = GLFW_LAYER_SHELL_BACKGROUND if opts.edge == 'background' else ltype edge = {'top': GLFW_EDGE_TOP, 'bottom': GLFW_EDGE_BOTTOM, 'left': GLFW_EDGE_LEFT, 'right': GLFW_EDGE_RIGHT}.get(opts.edge, GLFW_EDGE_TOP) return LayerShellConfig(type=ltype, edge=edge, size_in_cells=max(1, opts.lines), output_name=opts.output_name or '') diff --git a/kitty/fast_data_types.pyi b/kitty/fast_data_types.pyi index acb4cb126..d41313f34 100644 --- a/kitty/fast_data_types.pyi +++ b/kitty/fast_data_types.pyi @@ -14,6 +14,8 @@ from kitty.typing import EdgeLiteral, NotRequired, ReadableBuffer, WriteableBuff # Constants {{{ GLFW_LAYER_SHELL_NONE: int GLFW_LAYER_SHELL_PANEL: int +GLFW_LAYER_SHELL_TOP: int +GLFW_LAYER_SHELL_OVERLAY: int GLFW_LAYER_SHELL_BACKGROUND: int GLFW_EDGE_TOP: int GLFW_EDGE_BOTTOM: int diff --git a/kitty/glfw-wrapper.h b/kitty/glfw-wrapper.h index dfc38b6a8..67f6ef698 100644 --- a/kitty/glfw-wrapper.h +++ b/kitty/glfw-wrapper.h @@ -1038,7 +1038,7 @@ typedef struct GLFWkeyevent bool fake_event_on_focus_change; } GLFWkeyevent; -typedef enum { GLFW_LAYER_SHELL_NONE, GLFW_LAYER_SHELL_BACKGROUND, GLFW_LAYER_SHELL_PANEL } GLFWLayerShellType; +typedef enum { GLFW_LAYER_SHELL_NONE, GLFW_LAYER_SHELL_BACKGROUND, GLFW_LAYER_SHELL_PANEL, GLFW_LAYER_SHELL_TOP, GLFW_LAYER_SHELL_OVERLAY } GLFWLayerShellType; typedef enum { GLFW_EDGE_TOP, GLFW_EDGE_BOTTOM, GLFW_EDGE_LEFT, GLFW_EDGE_RIGHT } GLFWEdge; diff --git a/kitty/glfw.c b/kitty/glfw.c index 01911e630..2a5edc591 100644 --- a/kitty/glfw.c +++ b/kitty/glfw.c @@ -2351,7 +2351,7 @@ init_glfw(PyObject *m) { ADDC(GLFW_REPEAT); ADDC(true); ADDC(false); ADDC(GLFW_PRIMARY_SELECTION); ADDC(GLFW_CLIPBOARD); - ADDC(GLFW_LAYER_SHELL_NONE); ADDC(GLFW_LAYER_SHELL_PANEL); ADDC(GLFW_LAYER_SHELL_BACKGROUND); + ADDC(GLFW_LAYER_SHELL_NONE); ADDC(GLFW_LAYER_SHELL_PANEL); ADDC(GLFW_LAYER_SHELL_BACKGROUND); ADDC(GLFW_LAYER_SHELL_TOP); ADDC(GLFW_LAYER_SHELL_OVERLAY); ADDC(GLFW_FOCUS_NOT_ALLOWED); ADDC(GLFW_FOCUS_EXCLUSIVE); ADDC(GLFW_FOCUS_ON_DEMAND); ADDC(GLFW_EDGE_TOP); ADDC(GLFW_EDGE_BOTTOM); ADDC(GLFW_EDGE_LEFT); ADDC(GLFW_EDGE_RIGHT); ADDC(GLFW_COLOR_SCHEME_NO_PREFERENCE); ADDC(GLFW_COLOR_SCHEME_DARK); ADDC(GLFW_COLOR_SCHEME_LIGHT);