From 826a869c967e63f109ea4353fb764938e20547f7 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 25 Nov 2024 11:33:38 +0530 Subject: [PATCH] Cleanup previous PR --- docs/changelog.rst | 2 ++ kittens/panel/main.py | 18 +++++++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index ceb662413..08bdb34a5 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -101,6 +101,8 @@ Detailed list of changes - Fix dashed and dotted underlines not being drawn at the same y position as straight underlines at all font sizes (:iss:`8074`) +- panel kitten: Allow creating floating and on-top panels with arbitrary placement and size on Wayland (:pull:`8068`) + 0.37.0 [2024-10-30] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/kittens/panel/main.py b/kittens/panel/main.py index 7ff512c64..421c831e1 100644 --- a/kittens/panel/main.py +++ b/kittens/panel/main.py @@ -10,16 +10,16 @@ from kitty.constants import appname, is_macos, is_wayland from kitty.fast_data_types import ( GLFW_EDGE_BOTTOM, GLFW_EDGE_LEFT, + GLFW_EDGE_NONE, GLFW_EDGE_RIGHT, GLFW_EDGE_TOP, - GLFW_EDGE_NONE, + GLFW_FOCUS_EXCLUSIVE, + GLFW_FOCUS_NOT_ALLOWED, + GLFW_FOCUS_ON_DEMAND, GLFW_LAYER_SHELL_BACKGROUND, + GLFW_LAYER_SHELL_OVERLAY, GLFW_LAYER_SHELL_PANEL, GLFW_LAYER_SHELL_TOP, - GLFW_LAYER_SHELL_OVERLAY, - GLFW_FOCUS_NOT_ALLOWED, - GLFW_FOCUS_EXCLUSIVE, - GLFW_FOCUS_ON_DEMAND, glfw_primary_monitor_size, make_x11_window_a_dock_window, ) @@ -228,8 +228,12 @@ def layer_shell_config(opts: PanelCLIOptions) -> LayerShellConfig: '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, 'none': GLFW_EDGE_NONE}.get(opts.edge, GLFW_EDGE_TOP) - 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); + edge = { + 'top': GLFW_EDGE_TOP, 'bottom': GLFW_EDGE_BOTTOM, 'left': GLFW_EDGE_LEFT, 'right': GLFW_EDGE_RIGHT, 'none': GLFW_EDGE_NONE + }.get(opts.edge, GLFW_EDGE_TOP) + 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) return LayerShellConfig(type=ltype, edge=edge, x_size_in_cells=max(1, opts.columns),