mirror of
https://github.com/niri-wm/niri.git
synced 2026-06-23 02:05:33 +07:00
Add an option to skip the hotkey overlay at startup
This commit is contained in:
@@ -34,6 +34,8 @@ pub struct Config {
|
|||||||
]
|
]
|
||||||
pub screenshot_path: Option<String>,
|
pub screenshot_path: Option<String>,
|
||||||
#[knuffel(child, default)]
|
#[knuffel(child, default)]
|
||||||
|
pub hotkey_overlay: HotkeyOverlay,
|
||||||
|
#[knuffel(child, default)]
|
||||||
pub binds: Binds,
|
pub binds: Binds,
|
||||||
#[knuffel(child, default)]
|
#[knuffel(child, default)]
|
||||||
pub debug: DebugConfig,
|
pub debug: DebugConfig,
|
||||||
@@ -336,6 +338,12 @@ pub struct Struts {
|
|||||||
pub bottom: u16,
|
pub bottom: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(knuffel::Decode, Debug, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
|
pub struct HotkeyOverlay {
|
||||||
|
#[knuffel(child)]
|
||||||
|
pub skip_at_startup: bool,
|
||||||
|
}
|
||||||
|
|
||||||
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
|
#[derive(knuffel::Decode, Debug, Default, PartialEq)]
|
||||||
pub struct Binds(#[knuffel(children)] pub Vec<Bind>);
|
pub struct Binds(#[knuffel(children)] pub Vec<Bind>);
|
||||||
|
|
||||||
@@ -766,6 +774,10 @@ mod tests {
|
|||||||
|
|
||||||
screenshot-path "~/Screenshots/screenshot.png"
|
screenshot-path "~/Screenshots/screenshot.png"
|
||||||
|
|
||||||
|
hotkey-overlay {
|
||||||
|
skip-at-startup
|
||||||
|
}
|
||||||
|
|
||||||
binds {
|
binds {
|
||||||
Mod+T { spawn "alacritty"; }
|
Mod+T { spawn "alacritty"; }
|
||||||
Mod+Q { close-window; }
|
Mod+Q { close-window; }
|
||||||
@@ -881,6 +893,9 @@ mod tests {
|
|||||||
xcursor_size: 16,
|
xcursor_size: 16,
|
||||||
},
|
},
|
||||||
screenshot_path: Some(String::from("~/Screenshots/screenshot.png")),
|
screenshot_path: Some(String::from("~/Screenshots/screenshot.png")),
|
||||||
|
hotkey_overlay: HotkeyOverlay {
|
||||||
|
skip_at_startup: true,
|
||||||
|
},
|
||||||
binds: Binds(vec![
|
binds: Binds(vec![
|
||||||
Bind {
|
Bind {
|
||||||
key: Key {
|
key: Key {
|
||||||
|
|||||||
@@ -179,6 +179,12 @@ screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
|
|||||||
// You can also set this to null to disable saving screenshots to disk.
|
// You can also set this to null to disable saving screenshots to disk.
|
||||||
// screenshot-path null
|
// screenshot-path null
|
||||||
|
|
||||||
|
// Settings for the "Important Hotkeys" overlay.
|
||||||
|
hotkey-overlay {
|
||||||
|
// Uncomment this line if you don't want to see the hotkey help at niri startup.
|
||||||
|
// skip-at-startup
|
||||||
|
}
|
||||||
|
|
||||||
binds {
|
binds {
|
||||||
// Keys consist of modifiers separated by + signs, followed by an XKB key name
|
// Keys consist of modifiers separated by + signs, followed by an XKB key name
|
||||||
// in the end. To find an XKB name for a particular key, you may use a program
|
// in the end. To find an XKB name for a particular key, you may use a program
|
||||||
|
|||||||
@@ -45,8 +45,7 @@ pub type HotkeyOverlayRenderElement<R> = RelocateRenderElement<MemoryRenderBuffe
|
|||||||
impl HotkeyOverlay {
|
impl HotkeyOverlay {
|
||||||
pub fn new(config: Rc<RefCell<Config>>, comp_mod: CompositorMod) -> Self {
|
pub fn new(config: Rc<RefCell<Config>>, comp_mod: CompositorMod) -> Self {
|
||||||
Self {
|
Self {
|
||||||
// Start the compositor with the overlay open.
|
is_open: false,
|
||||||
is_open: true,
|
|
||||||
config,
|
config,
|
||||||
comp_mod,
|
comp_mod,
|
||||||
buffers: RefCell::new(HashMap::new()),
|
buffers: RefCell::new(HashMap::new()),
|
||||||
|
|||||||
+6
-1
@@ -868,7 +868,12 @@ impl Niri {
|
|||||||
|
|
||||||
let screenshot_ui = ScreenshotUi::new();
|
let screenshot_ui = ScreenshotUi::new();
|
||||||
let config_error_notification = ConfigErrorNotification::new();
|
let config_error_notification = ConfigErrorNotification::new();
|
||||||
let hotkey_overlay = HotkeyOverlay::new(config.clone(), backend.mod_key());
|
|
||||||
|
let mut hotkey_overlay = HotkeyOverlay::new(config.clone(), backend.mod_key());
|
||||||
|
if !config_.hotkey_overlay.skip_at_startup {
|
||||||
|
hotkey_overlay.show();
|
||||||
|
}
|
||||||
|
|
||||||
let exit_confirm_dialog = match ExitConfirmDialog::new() {
|
let exit_confirm_dialog = match ExitConfirmDialog::new() {
|
||||||
Ok(x) => Some(x),
|
Ok(x) => Some(x),
|
||||||
Err(err) => {
|
Err(err) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user