fix: skip loading shortcuts for kiosk mode

This commit is contained in:
Ashley Wulber 2026-09-22 14:41:11 -04:00 • committed by Jeremy Soller
parent d36480c1b5
commit 0fbd4574ef
2 changed files with 40 additions and 32 deletions

View file

@ -172,7 +172,7 @@ pub enum ColorFilter {
} }
impl Config { impl Config {
pub fn load(loop_handle: &LoopHandle<'_, State>) -> Config { pub fn load(loop_handle: &LoopHandle<'_, State>, kiosk_mode: bool) -> Config {
let config = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap(); let config = cosmic_config::Config::new("com.system76.CosmicComp", 1).unwrap();
let source = cosmic_config::calloop::ConfigWatchSource::new(&config).unwrap(); let source = cosmic_config::calloop::ConfigWatchSource::new(&config).unwrap();
loop_handle loop_handle
@ -248,18 +248,24 @@ impl Config {
// Source key bindings from com.system76.CosmicSettings.Shortcuts // Source key bindings from com.system76.CosmicSettings.Shortcuts
let settings_context = shortcuts::context().expect("Failed to load shortcuts config"); let settings_context = shortcuts::context().expect("Failed to load shortcuts config");
let system_actions = shortcuts::system_actions(&settings_context); let mut system_actions = Default::default();
let shortcuts = shortcuts::shortcuts(&settings_context); let mut shortcuts = Default::default();
// Kiosk mode disables shortcuts
if !kiosk_mode {
system_actions = shortcuts::system_actions(&settings_context);
shortcuts = shortcuts::shortcuts(&settings_context);
// Listen for updates to the keybindings config. // Listen for updates to the keybindings config.
match cosmic_config::calloop::ConfigWatchSource::new(&settings_context) { match cosmic_config::calloop::ConfigWatchSource::new(&settings_context) {
Ok(source) => { Ok(source) => {
if let Err(err) = loop_handle.insert_source(source, |(config, keys), (), state| { if let Err(err) =
loop_handle.insert_source(source, |(config, keys), (), state| {
for key in keys { for key in keys {
match key.as_str() { match key.as_str() {
// Reload the keyboard shortcuts config. // Reload the keyboard shortcuts config.
"custom" | "defaults" => { "custom" | "defaults" => {
state.common.config.shortcuts = shortcuts::shortcuts(&config); state.common.config.shortcuts =
shortcuts::shortcuts(&config);
} }
"system_actions" => { "system_actions" => {
@ -270,7 +276,8 @@ impl Config {
_ => (), _ => (),
} }
} }
}) { })
{
warn!( warn!(
?err, ?err,
"Failed to watch com.system76.CosmicSettings.Shortcuts config" "Failed to watch com.system76.CosmicSettings.Shortcuts config"
@ -282,6 +289,7 @@ impl Config {
"failed to create config watch source for com.system76.CosmicSettings.Shortcuts" "failed to create config watch source for com.system76.CosmicSettings.Shortcuts"
), ),
}; };
}
let window_rules_context = let window_rules_context =
window_rules::context().expect("Failed to load window rules config"); window_rules::context().expect("Failed to load window rules config");

View file

@ -667,7 +667,7 @@ impl State {
.unwrap(); .unwrap();
let clock = Clock::new(); let clock = Clock::new();
let config = Config::load(&handle); let config = Config::load(&handle, kiosk_command.is_some());
let compositor_state = CompositorState::new::<Self>(dh); let compositor_state = CompositorState::new::<Self>(dh);
let corner_radius_state = CornerRadiusState::new::<Self>(dh); let corner_radius_state = CornerRadiusState::new::<Self>(dh);
let data_device_state = DataDeviceState::new::<Self>(dh); let data_device_state = DataDeviceState::new::<Self>(dh);