From 886339ff967d36869f0537bf9693fa02a06f9453 Mon Sep 17 00:00:00 2001 From: Julian Orth Date: Tue, 23 Apr 2024 22:10:51 +0200 Subject: [PATCH] clients: grant layer-shell to unprivileged clients --- docs/config.md | 6 +-- docs/features.md | 77 +++++++++++++++-------------- src/acceptor.rs | 4 +- toml-config/src/default-config.toml | 4 +- toml-spec/spec/spec.generated.json | 2 +- toml-spec/spec/spec.generated.md | 4 +- toml-spec/spec/spec.yaml | 4 +- 7 files changed, 51 insertions(+), 50 deletions(-) diff --git a/docs/config.md b/docs/config.md index c2f21096..e318da5e 100644 --- a/docs/config.md +++ b/docs/config.md @@ -32,7 +32,7 @@ keymap = """ """ # An action that will be executed when the GPU has been initialized. -on-graphics-initialized = { type = "exec", exec = { prog = "mako", privileged = true } } +on-graphics-initialized = { type = "exec", exec = "mako" } # Shortcuts that are processed by the compositor. # The left hand side should be a key, possibly prefixed with modifiers. @@ -79,7 +79,7 @@ alt-shift-f = "toggle-floating" # For example, the exec action spawns an application and has the exec field # that describes how to spawn the application. Super_L = { type = "exec", exec = "alacritty" } -alt-p = { type = "exec", exec = { prog = "bemenu-run", privileged = true } } +alt-p = { type = "exec", exec = "bemenu-run" } # The quit action terminates the compositor. alt-q = "quit" @@ -266,7 +266,7 @@ If you want to run an action at startup, you can use the top-level `on-graphics- field: ```toml -on-graphics-initialized = { type = "exec", exec = { prog = "mako", privileged = true } } +on-graphics-initialized = { type = "exec", exec = "mako" } ``` ### Setting Environment Variables diff --git a/docs/features.md b/docs/features.md index 797b6832..c280eafb 100644 --- a/docs/features.md +++ b/docs/features.md @@ -122,48 +122,49 @@ Jay's shortcut system allows you to execute an action when a key is pressed and Jay supports the following wayland protocols: -| Global | Version | Privileged | -|-----------------------------------------|:-----------------|------------| -| ext_foreign_toplevel_list_v1 | 1 | Yes | -| ext_idle_notifier_v1 | 1 | Yes | -| ext_session_lock_manager_v1 | 1 | Yes | -| org_kde_kwin_server_decoration_manager | 1 | | -| wl_compositor | 6[^no_touch] | | -| wl_data_device_manager | 3 | | -| wl_drm | 2 | | -| wl_output | 4 | | -| wl_seat | 9 | | -| wl_shm | 2 | | -| wl_subcompositor | 1 | | -| wp_alpha_modifier_v1 | 1 | | -| wp_content_type_manager_v1 | 1 | | -| wp_cursor_shape_manager_v1 | 1 | | -| wp_fractional_scale_manager_v1 | 1 | | -| wp_linux_drm_syncobj_manager_v1 | 1 | | -| wp_presentation | 1 | | -| wp_single_pixel_buffer_manager_v1 | 1 | | -| wp_tearing_control_manager_v1 | 1[^no_tearing] | | -| wp_viewporter | 1 | | -| xdg_activation_v1 | 1 | | -| xdg_toplevel_drag_manager_v1 | 1 | | -| xdg_wm_base | 6 | | -| zwlr_data_control_manager_v1 | 2 | Yes | -| zwlr_layer_shell_v1 | 4[^no_exclusive] | Yes | -| zwlr_screencopy_manager_v1 | 3 | Yes | -| zwp_idle_inhibit_manager_v1 | 1 | | -| zwp_input_method_manager_v2 | 1 | Yes | -| zwp_linux_dmabuf_v1 | 5 | | -| zwp_pointer_constraints_v1 | 1 | | -| zwp_primary_selection_device_manager_v1 | 1 | | -| zwp_relative_pointer_manager_v1 | 1 | | -| zwp_text_input_manager_v3 | 1 | | -| zwp_virtual_keyboard_manager_v1 | 1 | Yes | -| zxdg_decoration_manager_v1 | 1 | | -| zxdg_output_manager_v1 | 3 | | +| Global | Version | Privileged | +|-----------------------------------------|:-----------------|---------------| +| ext_foreign_toplevel_list_v1 | 1 | Yes | +| ext_idle_notifier_v1 | 1 | Yes | +| ext_session_lock_manager_v1 | 1 | Yes | +| org_kde_kwin_server_decoration_manager | 1 | | +| wl_compositor | 6[^no_touch] | | +| wl_data_device_manager | 3 | | +| wl_drm | 2 | | +| wl_output | 4 | | +| wl_seat | 9 | | +| wl_shm | 2 | | +| wl_subcompositor | 1 | | +| wp_alpha_modifier_v1 | 1 | | +| wp_content_type_manager_v1 | 1 | | +| wp_cursor_shape_manager_v1 | 1 | | +| wp_fractional_scale_manager_v1 | 1 | | +| wp_linux_drm_syncobj_manager_v1 | 1 | | +| wp_presentation | 1 | | +| wp_single_pixel_buffer_manager_v1 | 1 | | +| wp_tearing_control_manager_v1 | 1[^no_tearing] | | +| wp_viewporter | 1 | | +| xdg_activation_v1 | 1 | | +| xdg_toplevel_drag_manager_v1 | 1 | | +| xdg_wm_base | 6 | | +| zwlr_data_control_manager_v1 | 2 | Yes | +| zwlr_layer_shell_v1 | 4[^no_exclusive] | No[^lsaccess] | +| zwlr_screencopy_manager_v1 | 3 | Yes | +| zwp_idle_inhibit_manager_v1 | 1 | | +| zwp_input_method_manager_v2 | 1 | Yes | +| zwp_linux_dmabuf_v1 | 5 | | +| zwp_pointer_constraints_v1 | 1 | | +| zwp_primary_selection_device_manager_v1 | 1 | | +| zwp_relative_pointer_manager_v1 | 1 | | +| zwp_text_input_manager_v3 | 1 | | +| zwp_virtual_keyboard_manager_v1 | 1 | Yes | +| zxdg_decoration_manager_v1 | 1 | | +| zxdg_output_manager_v1 | 3 | | [^no_touch]: Touch input is not supported. [^no_tearing]: Tearing screen updates are not supported. [^no_exclusive]: Exclusive zones are not supported. +[^lsaccess]: Sandboxes can restrict access to this protocol. ## Missing Features diff --git a/src/acceptor.rs b/src/acceptor.rs index e85871e6..b359d773 100644 --- a/src/acceptor.rs +++ b/src/acceptor.rs @@ -1,7 +1,7 @@ use { crate::{ async_engine::SpawnedFuture, - client::ClientCaps, + client::{ClientCaps, CAP_LAYER_SHELL}, state::State, utils::{errorfmt::ErrorFmt, oserror::OsError, xrd::xrd}, }, @@ -154,7 +154,7 @@ impl Acceptor { state.eng.spawn(accept( acc.socket.insecure.clone(), state.clone(), - ClientCaps::none(), + CAP_LAYER_SHELL, )), ]; state.acceptor.set(Some(acc.clone())); diff --git a/toml-config/src/default-config.toml b/toml-config/src/default-config.toml index 496264d5..1b65db26 100644 --- a/toml-config/src/default-config.toml +++ b/toml-config/src/default-config.toml @@ -7,7 +7,7 @@ keymap = """ }; """ -on-graphics-initialized = { type = "exec", exec = { prog = "mako", privileged = true } } +on-graphics-initialized = { type = "exec", exec = "mako" } [shortcuts] alt-h = "focus-left" @@ -31,7 +31,7 @@ alt-f = "focus-parent" alt-shift-c = "close" alt-shift-f = "toggle-floating" Super_L = { type = "exec", exec = "alacritty" } -alt-p = { type = "exec", exec = { prog = "bemenu-run", privileged = true } } +alt-p = { type = "exec", exec = "bemenu-run" } alt-q = "quit" alt-shift-r = "reload-config-toml" diff --git a/toml-spec/spec/spec.generated.json b/toml-spec/spec/spec.generated.json index 2f194626..ebf1ba64 100644 --- a/toml-spec/spec/spec.generated.json +++ b/toml-spec/spec/spec.generated.json @@ -447,7 +447,7 @@ "required": [] }, "Config": { - "description": "This is the top-level table.\n\n- Example:\n\n ```toml\n keymap = \"\"\"\n xkb_keymap {\n xkb_keycodes { include \"evdev+aliases(qwerty)\" };\n xkb_types { include \"complete\" };\n xkb_compat { include \"complete\" };\n xkb_symbols { include \"pc+us+inet(evdev)\" };\n };\n \"\"\"\n\n on-graphics-initialized = { type = \"exec\", exec = { prog = \"mako\", privileged = true } }\n\n [shortcuts]\n alt-h = \"focus-left\"\n alt-j = \"focus-down\"\n alt-k = \"focus-up\"\n alt-l = \"focus-right\"\n\n alt-shift-h = \"move-left\"\n alt-shift-j = \"move-down\"\n alt-shift-k = \"move-up\"\n alt-shift-l = \"move-right\"\n\n alt-d = \"split-horizontal\"\n alt-v = \"split-vertical\"\n\n alt-t = \"toggle-split\"\n alt-m = \"toggle-mono\"\n alt-u = \"toggle-fullscreen\"\n\n alt-f = \"focus-parent\"\n alt-shift-c = \"close\"\n alt-shift-f = \"toggle-floating\"\n Super_L = { type = \"exec\", exec = \"alacritty\" }\n alt-p = { type = \"exec\", exec = { prog = \"bemenu-run\", privileged = true } }\n alt-q = \"quit\"\n alt-shift-r = \"reload-config-toml\"\n\n ctrl-alt-F1 = { type = \"switch-to-vt\", num = 1 }\n ctrl-alt-F2 = { type = \"switch-to-vt\", num = 2 }\n # ...\n\n alt-F1 = { type = \"show-workspace\", name = \"1\" }\n alt-F2 = { type = \"show-workspace\", name = \"2\" }\n # ...\n\n alt-shift-F1 = { type = \"move-to-workspace\", name = \"1\" }\n alt-shift-F2 = { type = \"move-to-workspace\", name = \"2\" }\n # ...\n ```\n", + "description": "This is the top-level table.\n\n- Example:\n\n ```toml\n keymap = \"\"\"\n xkb_keymap {\n xkb_keycodes { include \"evdev+aliases(qwerty)\" };\n xkb_types { include \"complete\" };\n xkb_compat { include \"complete\" };\n xkb_symbols { include \"pc+us+inet(evdev)\" };\n };\n \"\"\"\n\n on-graphics-initialized = { type = \"exec\", exec = \"mako\" }\n\n [shortcuts]\n alt-h = \"focus-left\"\n alt-j = \"focus-down\"\n alt-k = \"focus-up\"\n alt-l = \"focus-right\"\n\n alt-shift-h = \"move-left\"\n alt-shift-j = \"move-down\"\n alt-shift-k = \"move-up\"\n alt-shift-l = \"move-right\"\n\n alt-d = \"split-horizontal\"\n alt-v = \"split-vertical\"\n\n alt-t = \"toggle-split\"\n alt-m = \"toggle-mono\"\n alt-u = \"toggle-fullscreen\"\n\n alt-f = \"focus-parent\"\n alt-shift-c = \"close\"\n alt-shift-f = \"toggle-floating\"\n Super_L = { type = \"exec\", exec = \"alacritty\" }\n alt-p = { type = \"exec\", exec = \"bemenu-run\" }\n alt-q = \"quit\"\n alt-shift-r = \"reload-config-toml\"\n\n ctrl-alt-F1 = { type = \"switch-to-vt\", num = 1 }\n ctrl-alt-F2 = { type = \"switch-to-vt\", num = 2 }\n # ...\n\n alt-F1 = { type = \"show-workspace\", name = \"1\" }\n alt-F2 = { type = \"show-workspace\", name = \"2\" }\n # ...\n\n alt-shift-F1 = { type = \"move-to-workspace\", name = \"1\" }\n alt-shift-F2 = { type = \"move-to-workspace\", name = \"2\" }\n # ...\n ```\n", "type": "object", "properties": { "keymap": { diff --git a/toml-spec/spec/spec.generated.md b/toml-spec/spec/spec.generated.md index 0184926d..c2e7e11e 100644 --- a/toml-spec/spec/spec.generated.md +++ b/toml-spec/spec/spec.generated.md @@ -679,7 +679,7 @@ This is the top-level table. }; """ - on-graphics-initialized = { type = "exec", exec = { prog = "mako", privileged = true } } + on-graphics-initialized = { type = "exec", exec = "mako" } [shortcuts] alt-h = "focus-left" @@ -703,7 +703,7 @@ This is the top-level table. alt-shift-c = "close" alt-shift-f = "toggle-floating" Super_L = { type = "exec", exec = "alacritty" } - alt-p = { type = "exec", exec = { prog = "bemenu-run", privileged = true } } + alt-p = { type = "exec", exec = "bemenu-run" } alt-q = "quit" alt-shift-r = "reload-config-toml" diff --git a/toml-spec/spec/spec.yaml b/toml-spec/spec/spec.yaml index 6efbfb9b..4454b080 100644 --- a/toml-spec/spec/spec.yaml +++ b/toml-spec/spec/spec.yaml @@ -1642,7 +1642,7 @@ Config: }; """ - on-graphics-initialized = { type = "exec", exec = { prog = "mako", privileged = true } } + on-graphics-initialized = { type = "exec", exec = "mako" } [shortcuts] alt-h = "focus-left" @@ -1666,7 +1666,7 @@ Config: alt-shift-c = "close" alt-shift-f = "toggle-floating" Super_L = { type = "exec", exec = "alacritty" } - alt-p = { type = "exec", exec = { prog = "bemenu-run", privileged = true } } + alt-p = { type = "exec", exec = "bemenu-run" } alt-q = "quit" alt-shift-r = "reload-config-toml"