From acc0712fcb6e5d1fdd758bbd640c1727aa4a86c3 Mon Sep 17 00:00:00 2001 From: Grey Jones Date: Sat, 11 Jul 2026 11:57:35 +0100 Subject: [PATCH] fix laptop setup - adds auto-mounting of external drives with udiskie - disables suspend, replaces it with hibernation - disables alt+arrow keys switching between tty sessions - other misc changes to rice + configs --- assets/dotfiles/niri.kdl | 15 +++-- assets/dotfiles/noctalia-state/settings.toml | 68 +++++++++++--------- global-configs/floorp.nix | 10 +++ global-configs/vscode.nix | 2 +- hosts/kitagawa/default.nix | 34 +++++++++- hosts/kitagawa/home.nix | 15 +++++ 6 files changed, 107 insertions(+), 37 deletions(-) diff --git a/assets/dotfiles/niri.kdl b/assets/dotfiles/niri.kdl index 730dbe2..496d571 100644 --- a/assets/dotfiles/niri.kdl +++ b/assets/dotfiles/niri.kdl @@ -70,16 +70,19 @@ binds { Mod+B { spawn "floorp"; } Mod+C { spawn "gnome-calculator"; } Mod+D { spawn "noctalia" "msg" "panel-toggle" "launcher"; } - Mod+E { spawn "nautilus"; } + Mod+E { spawn "nautilus" "-w"; } Mod+Return { spawn "kitty"; } + Mod+O { spawn "obsidian"; } Mod+Z { spawn "kitty" "nh" "os" "switch" "./nixos"; } Mod+Space { toggle-overview; } Mod+Q { close-window; } - Mod+F { fullscreen-window; } + Mod+F { maximize-window-to-edges; } + Mod+Shift+F { fullscreen-window; } Mod+Shift+E { quit; } + Mod+L { spawn "noctalia" "msg" "session" "lock"; } Mod+Shift+D { spawn "noctalia" "msg" "desktop-widgets-edit"; } Mod+Shift+B { spawn "noctalia" "msg" "settings-open" "bar"; } Mod+Shift+S { spawn "noctalia" "msg" "settings-open"; } @@ -113,6 +116,7 @@ binds { XF86WLAN { spawn-sh "rfkill toggle 0 || rfkill toggle 1"; } XF86NotificationCenter { spawn "noctalia" "msg" "panel-toggle" "control-center" "notifications"; } XF86Display { toggle-overview; } + Print { screenshot; } } spawn-at-startup "noctalia" window-rule { @@ -124,10 +128,13 @@ window-rule { match app-id="^floorp$" match app-id="^code$" match app-id="^obsidian$" - default-column-width { proportion 1.000000; } + open-maximized-to-edges true } window-rule { match app-id="^kitty$" - default-column-width { proportion 0.660000; } + default-column-width { proportion 0.7; } } gestures { hot-corners { off; }; } +switch-events { + lid-close { spawn "bash" "-c" "noctalia msg session lock && systemctl hibernate"; } +} \ No newline at end of file diff --git a/assets/dotfiles/noctalia-state/settings.toml b/assets/dotfiles/noctalia-state/settings.toml index de447ed..7a0d88d 100644 --- a/assets/dotfiles/noctalia-state/settings.toml +++ b/assets/dotfiles/noctalia-state/settings.toml @@ -3,14 +3,14 @@ blur_intensity = 0.099999997764825821 tint_intensity = 0.14999999664723873 [bar.default] -background_opacity = 0.74999998323619366 +background_opacity = 0.79999998211860657 center = [ "workspaces" ] end = [ "tray", "notifications", "bluetooth", "network", "volume", "battery", "control-center" ] margin_edge = 8 margin_ends = 80 margin_opposite_edge = 8 start = [ "clock", "media" ] -thickness = 32 +thickness = 36 widget_spacing = 16 [battery] @@ -37,10 +37,10 @@ widget_order = [ visible = true [desktop_widgets.widget.desktop-widget-0000000000000001] - box_height = 160.0 - box_width = 160.0 - cx = 176.0 - cy = 160.0 + box_height = 144.0 + box_width = 144.0 + cx = 1376.0 + cy = 344.0 output = "eDP-1" rotation = 0.0 type = "clock" @@ -48,7 +48,7 @@ widget_order = [ [desktop_widgets.widget.desktop-widget-0000000000000001.settings] background = true background_color = "surface" - background_opacity = 0.75 + background_opacity = 0.59999999999999998 background_padding = 10 background_radius = 12 center_text = false @@ -60,16 +60,16 @@ widget_order = [ shadow = true [desktop_widgets.widget.desktop-widget-0000000000000002] - box_height = 176.0 + box_height = 160.0 box_width = 208.0 cx = 1096.0 - cy = 168.0 + cy = 160.0 output = "eDP-1" rotation = 0.0 type = "sysmon" [desktop_widgets.widget.desktop-widget-0000000000000002.settings] - background_opacity = 0.75 + background_opacity = 0.59999999999999998 display = "graph" shadow = false show_label = true @@ -77,16 +77,16 @@ widget_order = [ stat2 = "cpu_temp" [desktop_widgets.widget.desktop-widget-0000000000000005] - box_height = 176.0 + box_height = 160.0 box_width = 208.0 cx = 1344.0 - cy = 168.0 + cy = 160.0 output = "eDP-1" rotation = 0.0 type = "sysmon" [desktop_widgets.widget.desktop-widget-0000000000000005.settings] - background_opacity = 0.75 + background_opacity = 0.59999999999999998 display = "graph" network_speed_compact = false shadow = false @@ -97,13 +97,13 @@ widget_order = [ box_height = 160.0 box_width = 384.0 cx = 288.0 - cy = 704.0 + cy = 736.0 output = "eDP-1" rotation = 0.0 type = "media_player" [desktop_widgets.widget.desktop-widget-0000000000000006.settings] - background_opacity = 0.75 + background_opacity = 0.59999999999999998 hide_when_no_media = true shadow = false @@ -111,7 +111,7 @@ widget_order = [ box_height = 96.0 box_width = 384.0 cx = 288.0 - cy = 576.0 + cy = 608.0 output = "eDP-1" rotation = 0.0 type = "audio_visualizer" @@ -127,33 +127,34 @@ widget_order = [ [desktop_widgets.widget.desktop-widget-0000000000000008] box_height = 96.0 box_width = 144.0 - cx = 360.0 - cy = 128.0 + cx = 1192.0 + cy = 320.0 output = "eDP-1" rotation = 0.0 type = "weather" [desktop_widgets.widget.desktop-widget-0000000000000008.settings] - background_opacity = 0.75 + background_opacity = 0.59999999999999998 [idle] -behavior_order = [ "lock", "screen-off", "lock-and-suspend" ] +behavior_order = [ "lock", "screen-off", "Hibernate" ] pre_action_fade_seconds = 30 + [idle.behavior.Hibernate] + action = "command" + command = "systemctl hibernate" + enabled = true + timeout = 600.0 + [idle.behavior.lock] action = "lock" enabled = true - timeout = 600.0 - - [idle.behavior.lock-and-suspend] - action = "lock_and_suspend" - enabled = false - timeout = 900.0 + timeout = 300.0 [idle.behavior.screen-off] action = "screen_off" enabled = true - timeout = 660.0 + timeout = 450.0 [location] auto_locate = true @@ -231,9 +232,12 @@ polkit_agent = true variant = "default" [[shell.session.actions]] - action = "lock_and_suspend" + action = "command" + command = "noctalia msg session lock && systemctl hibernate" countdown_seconds = 0.0 - enabled = false + enabled = true + glyph = "hibernate" + label = "Hibernate" shortcut = "3" variant = "default" @@ -302,9 +306,15 @@ title_scroll = "always" [widget.network] show_label = false +[widget.notifications] +hide_when_no_unread = true + [widget.session] enabled = false +[widget.tray] +hidden = [ "Udiskie" ] + [widget.volume] mute_color = "on_surface" show_label = false diff --git a/global-configs/floorp.nix b/global-configs/floorp.nix index e99aa47..2d4b652 100644 --- a/global-configs/floorp.nix +++ b/global-configs/floorp.nix @@ -181,6 +181,16 @@ in { icon = "https://wiki.nixos.org/favicon.ico"; definedAliases = ["@nw"]; }; + arch-wiki = { + name = "ArchWiki"; + urls = [ + { + template = "https://wiki.archlinux.org/index.php?search={searchTerms}"; + } + ]; + icon = "https://wiki.archlinux.org/favicon.ico"; + definedAliases = ["@aw"]; + }; }; }; }; diff --git a/global-configs/vscode.nix b/global-configs/vscode.nix index feddd73..a64df59 100644 --- a/global-configs/vscode.nix +++ b/global-configs/vscode.nix @@ -34,7 +34,7 @@ "patternStore.savedPatterns" = [ { label = "convert JSON pairs to Nix format"; - find = "\"(\\w+)\": ([\\w, \\{\\}]+?),?$"; + find = "\"(\\w+)\": (.+?),?$"; replace = "$1 = $2;"; flags = { "isRegex" = true; diff --git a/hosts/kitagawa/default.nix b/hosts/kitagawa/default.nix index ebfa043..a5ee8f4 100644 --- a/hosts/kitagawa/default.nix +++ b/hosts/kitagawa/default.nix @@ -22,12 +22,40 @@ in { stylix.image = ../../assets/wallpapers/kitagawa.jpg; stylix.polarity = "dark"; - - + systemd.sleep.settings.Sleep = { + AllowSuspend = "no"; + AllowHibernation = "yes"; }; + services.logind.settings.Login.HandleLidSwitch = "ignore"; + + systemd.services.disable-lid-wakeup = { + wantedBy = [ "multi-user.target" ]; + description = "Prevent the lid switch from waking laptop from hibernation"; + serviceConfig = { + Type = "simple"; + User = "root"; + ExecStart = "${pkgs.busybox}/bin/sh -c \"echo LID > /proc/acpi/wakeup\""; + }; + }; + + systemd.services.disable-tty-switch = { + wantedBy = [ "multi-user.target" ]; + description = "Prevent alt+arrow keys from switching tty"; + serviceConfig = { + Type = "simple"; + User = "root"; + ExecStart = "${pkgs.busybox}/bin/sh -c \"${pkgs.kbd}/bin/dumpkeys -k|grep -v Incr_Console|grep -v Decr_Console|${pkgs.kbd}/bin/loadkeys\""; + }; + }; + + services.udisks2.enable = true; + services.fprintd.enable = true; - security.pam.services.grey.fprintAuth = true; + security.pam.services.login.fprintAuth = true; + security.pam.services.sudo.fprintAuth = true; + security.pam.services.swaylock.fprintAuth = true; + security.pam.services.lightdm.fprintAuth = true; programs.nautilus-open-any-terminal = { enable = true; diff --git a/hosts/kitagawa/home.nix b/hosts/kitagawa/home.nix index d92cd36..25c1487 100644 --- a/hosts/kitagawa/home.nix +++ b/hosts/kitagawa/home.nix @@ -30,6 +30,9 @@ in { ente-auth signal-desktop hyperfine + nautilus + code-nautilus + xarchiver ]; stylix.targets.floorp.profileNames = [ "default" ]; @@ -53,6 +56,18 @@ in { ]; }; + services.udiskie = { + enable = true; + settings = { + # workaround for + # https://github.com/nix-community/home-manager/issues/632 + program_options = { + # replace with your favorite file manager + file_manager = "${pkgs.nautilus}/bin/nautilus"; + }; + }; + }; + xdg = { enable = true; mimeApps.defaultApplications = {