From 84ffa1f41c6794ddf6f466ed5f28a20fedd8fa21 Mon Sep 17 00:00:00 2001 From: Samuel Onoja Date: Fri, 25 Sep 2026 02:20:08 +0100 Subject: [PATCH] fix: gate shortcut inhibition by session policy --- README.md | 10 ++++++++++ compositor/src/state.rs | 5 +++++ 2 files changed, 15 insertions(+) diff --git a/README.md b/README.md index f0c78cc..c77c715 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,16 @@ FERESE_ENABLE_INPUT_METHOD=1 cargo run -p ferese `Ctrl+Alt+Escape` always releases an active client shortcut inhibitor. +Keyboard-shortcut inhibition is hidden unless a trusted VM or remote-desktop +session explicitly enables it: + +```bash +FERESE_ENABLE_SHORTCUT_INHIBIT=1 cargo run -p ferese +``` + +The emergency `Ctrl+Alt+Escape` binding remains available while inhibition is +active. + Screen capture is hidden by default. A session that has already made an explicit capture-policy decision can expose screencopy-v1 to its clients with: diff --git a/compositor/src/state.rs b/compositor/src/state.rs index a1abbee..0dee133 100644 --- a/compositor/src/state.rs +++ b/compositor/src/state.rs @@ -302,6 +302,11 @@ impl Ferese { InputMethodManagerState::new::(&display_handle, move |_| input_method_enabled); let keyboard_shortcuts_inhibit_state = KeyboardShortcutsInhibitState::new::(&display_handle); + let shortcut_inhibit_enabled = + std::env::var_os("FERESE_ENABLE_SHORTCUT_INHIBIT").is_some_and(|value| value == "1"); + if !shortcut_inhibit_enabled { + display_handle.disable_global::(keyboard_shortcuts_inhibit_state.global()); + } let shm_state = ShmState::new::(&display_handle, Vec::new()); let single_pixel_buffer_state = SinglePixelBufferState::new::(&display_handle); let text_input_manager_state = TextInputManagerState::new::(&display_handle);