aboutsummaryrefslogtreecommitdiff
path: root/src/backend/mod.rs
diff options
context:
space:
mode:
authorpeelz <peelz.dev@gmail.com>2025-02-05 09:34:25 -0500
committerIvan Molodetskikh <yalterz@gmail.com>2025-03-22 00:03:33 -0700
commitc3609efb7aaa4f118eacdfed7003285f124f6b8a (patch)
tree154241c0942aebcd6d9278896f6b10597bd37595 /src/backend/mod.rs
parentfd1f43673cf4d1e84d9da67e294c040934034eda (diff)
downloadniri-c3609efb7aaa4f118eacdfed7003285f124f6b8a.tar.gz
niri-c3609efb7aaa4f118eacdfed7003285f124f6b8a.tar.bz2
niri-c3609efb7aaa4f118eacdfed7003285f124f6b8a.zip
Add mod-key and mod-key-nested settings
Diffstat (limited to 'src/backend/mod.rs')
-rw-r--r--src/backend/mod.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/backend/mod.rs b/src/backend/mod.rs
index e23947c5..2aa97bc0 100644
--- a/src/backend/mod.rs
+++ b/src/backend/mod.rs
@@ -2,12 +2,12 @@ use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::time::Duration;
+use niri_config::{Config, ModKey};
use smithay::backend::allocator::dmabuf::Dmabuf;
use smithay::backend::renderer::gles::GlesRenderer;
use smithay::output::Output;
use smithay::reexports::wayland_server::protocol::wl_surface::WlSurface;
-use crate::input::CompositorMod;
use crate::niri::Niri;
use crate::utils::id::IdCounter;
@@ -94,11 +94,16 @@ impl Backend {
}
}
- pub fn mod_key(&self) -> CompositorMod {
+ pub fn mod_key(&self, config: &Config) -> ModKey {
match self {
- Backend::Tty(_) => CompositorMod::Super,
- Backend::Winit(_) => CompositorMod::Alt,
- Backend::Headless(_) => CompositorMod::Super,
+ Backend::Winit(_) => config.input.mod_key_nested.unwrap_or({
+ if let Some(ModKey::Alt) = config.input.mod_key {
+ ModKey::Super
+ } else {
+ ModKey::Alt
+ }
+ }),
+ Backend::Tty(_) | Backend::Headless(_) => config.input.mod_key.unwrap_or(ModKey::Super),
}
}