Strip comments from hypr/niri configs and scripts
Browse files at this commit78691e8a466f47bb1a34533a52471c6d0ad5556cParent: fe65316- style
- strip comments from hypr/niri configs and scripts
16 changed files +15 -359
- .config/hypr/hyprland.conf +8 -51
- .config/hypr/hyprlock.conf +0 -7
- .config/niri/config.kdl +0 -121
- .config/scripts/hyprland/show_desktop.sh +0 -2
- .config/scripts/hyprland/toggle_monitors.sh +0 -2
- .config/scripts/hyprland/wallpaper_picker.sh +0 -7
- .config/scripts/niri/monitors.sh +2 -8
- .config/scripts/niri/show_desktop.sh +1 -18
- .config/scripts/niri/toggle_monitors.sh +3 -12
- .config/scripts/niri/wallpaper_picker.sh +0 -18
- .config/scripts/niri/wallpaper_restore.sh +0 -5
- .config/scripts/niri/wallust_niri_colors.sh +0 -22
- .config/scripts/niri/workspace_app.sh +0 -28
- .config/scripts/niri/workspace_nav.sh +1 -31
- .config/scripts/niri/workspace_startup.sh +0 -11
- .config/scripts/system/power_menu.sh +0 -16
.config/hypr/hyprland.confmodified+8 -51
| @@ -1,48 +1,28 @@ | ||
| 1 | 1 | monitor=,preferred,auto,auto |
| 2 | -# monitor = eDP-1, 2880x1800@90, 0x1080, 2 | |
| 3 | -# monitor = DP-1, 2560x1440@180, 0x0, 1, bitdepth, 10, cm, srgb, sdrbrightness, 1.65, sdrsaturation, 1.0 | |
| 4 | 2 | monitor = DP-1, 2560x1440@180, 0x0, 1, bitdepth, 10 |
| 5 | 3 | monitor = HDMI-A-1, 1920x1080@75, 2560x0, 1, bitdepth, 10 |
| 6 | -# monitor = eDP-1, disable | |
| 7 | -# monitor = HDMI-A-1, disable | |
| 8 | -# monitor = DP-1, disable | |
| 9 | -# bindl = , switch:on:Lid Switch, exec, hyprctl keyword monitor "eDP-1, disable" | |
| 10 | -# bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, enable" | |
| 11 | -# bindl = , switch:on:Lid Switch, exec, hyprctl keyword input:touchdevice:enabled false | |
| 12 | -# bindl = , switch:off:Lid Switch, exec, hyprctl keyword input:touchdevice:enabled false | |
| 13 | -# bindl = , switch:off:Lid Switch, exec, hyprctl reload && hyprctl keyword input:touchdevice:enabled false | |
| 14 | -# bindl = , switch:off:Lid Switch, exec, hyprctl keyword monitor "eDP-1, 2880x1800@90, 0x1080, 2" monitor = HDMI-A-1, disable | |
| 15 | 4 | |
| 16 | 5 | exec-once = hyprpm reload -n |
| 17 | 6 | exec-once = sleep 1 && /usr/libexec/polkit-mate-authentication-agent-1 |
| 18 | 7 | exec-once = bash ~/.config/scripts/shared/song_detail_writer.sh |
| 19 | 8 | exec-once = sleep 1 && waybar |
| 20 | -# exec-once = sleep 1 && eww daemon | |
| 21 | -# exec-once = sleep 1 && eww open main | |
| 22 | 9 | exec-once = sleep 2 && nm-applet |
| 23 | 10 | exec-once = sleep 2 && blueman-applet |
| 24 | 11 | exec-once = sleep 2 && kdeconnect-indicator |
| 25 | 12 | exec-once = sleep 2 && hyprpaper |
| 26 | 13 | exec-once = sleep 3 && /opt/Mullvad\ VPN/mullvad-vpn |
| 27 | -# exec-once = sleep 3 && hyprctl keyword input:touchdevice:enabled false | |
| 28 | 14 | exec-once = sleep 3 && swaync-client -dn |
| 29 | -exec-once = sleep 3 && wl-paste --type text --watch cliphist store # Stores only text data | |
| 30 | -exec-once = sleep 3 && wl-paste --type image --watch cliphist store # Stores only image data | |
| 15 | +exec-once = sleep 3 && wl-paste --type text --watch cliphist store | |
| 16 | +exec-once = sleep 3 && wl-paste --type image --watch cliphist store | |
| 31 | 17 | exec-once = sleep 4 && rfkill unblock bluetooth && bluetoothctl power on |
| 32 | 18 | exec-once = sudo /usr/local/bin/asus-receiver-rebind |
| 33 | 19 | |
| 34 | -# exec = gsettings set org.gnome.desktop.interface gtk-theme "Adwaita-dark" # for GTK3 apps | |
| 35 | -# exec = gsettings set org.gnome.desktop.interface color-scheme "prefer-dark" # for GTK4 apps | |
| 36 | -# exec = gsettings set org.gnome.desktop.interface icon-theme 'papirus-dark' | |
| 37 | - | |
| 38 | 20 | env = QT_QPA_PLATFORMTHEME,gtk3 |
| 39 | 21 | env = XCURSOR_SIZE,24 |
| 40 | 22 | env = HYPRCURSOR_SIZE,24 |
| 41 | 23 | env = PATH, $HOME/.cargo/bin/:$HOME/.local/bin/:$PATH |
| 42 | 24 | env = XDG_CURRENT_SESSION, Hyprland |
| 43 | 25 | |
| 44 | -# render:explicit_sync = true # legacy command it's deprecated in 0.50 and now it's always enable | |
| 45 | - | |
| 46 | 26 | $terminal = wezterm start --always-new-process |
| 47 | 27 | $fileManager = nautilus --new-window |
| 48 | 28 | $active_menu = rofi -show |
| @@ -61,11 +41,6 @@ $my_trigger = Alt | ||
| 61 | 41 | $monitor_left = DP-1 |
| 62 | 42 | $monitor_right = HDMI-A-1 |
| 63 | 43 | |
| 64 | -# bind = $my_trigger, 0, exec, bluetoothctl disconnect 00:00:00:00:00:00 && bluetoothctl connect 00:00:00:00:00:00 | |
| 65 | -# bind = $my_trigger, 1, exec, playerctl previous | |
| 66 | -# bind = $my_trigger, 2, exec, playerctl play-pause | |
| 67 | -# bind = $my_trigger, 3, exec, playerctl next | |
| 68 | - | |
| 69 | 44 | bind = $my_trigger, T, exec, $terminal |
| 70 | 45 | bind = $my_trigger, Q, exec, $fileManager |
| 71 | 46 | bind = Alt, F1, exec, $active_menu |
| @@ -118,14 +93,12 @@ bind = $mainMod SHIFT, Y, movetoworkspace, 204 | ||
| 118 | 93 | bind = $mainMod SHIFT, P, movetoworkspace, 205 |
| 119 | 94 | bind = $mainMod SHIFT, N, movetoworkspace, 206 |
| 120 | 95 | |
| 121 | -# bind = $mainMod, D, workspace, 999 | |
| 122 | 96 | bind = $mainMod, D, exec, ~/.config/scripts/hyprland/show_desktop.sh |
| 123 | 97 | |
| 124 | 98 | bind = Alt, F4, killactive, |
| 125 | 99 | bind = Alt, 4, killactive, |
| 126 | 100 | bind = $mainMod $my_trigger, F4, exit, |
| 127 | 101 | bind = $mainMod, H, exec, pkill -SIGUSR1 waybar |
| 128 | -# bind = $mainMod, H, exec, ~/.config/scripts/system/toggle_eww.sh | |
| 129 | 102 | binds { |
| 130 | 103 | allow_workspace_cycles = true |
| 131 | 104 | } |
| @@ -133,8 +106,8 @@ bindr = $mainMod, Tab, bringactivetotop | ||
| 133 | 106 | bind = $mainMod, Tab, cyclenext |
| 134 | 107 | bind = Alt, Tab, workspace, previous_per_monitor |
| 135 | 108 | bind = $mainMod SHIFT, Tab, split:swapactiveworkspaces, $monitor_left $monitor_right |
| 136 | -bind = $mainMod, P, pseudo, # dwindle | |
| 137 | -bind = $mainMod, J, layoutmsg, togglesplit # dwindle | |
| 109 | +bind = $mainMod, P, pseudo, | |
| 110 | +bind = $mainMod, J, layoutmsg, togglesplit | |
| 138 | 111 | bind = $mainMod, F, togglefloating, |
| 139 | 112 | bind = $mainMod, Q, focusmonitor, $monitor_left |
| 140 | 113 | bind = $mainMod, E, focusmonitor, $monitor_right |
| @@ -202,11 +175,9 @@ bindl = , XF86AudioPrev, exec, playerctl previous | ||
| 202 | 175 | windowrule = match:class .*, suppress_event maximize |
| 203 | 176 | windowrule = match:class ^$, match:title ^$, match:xwayland 1, match:float 1, match:fullscreen 0, match:pin 0, no_focus on |
| 204 | 177 | windowrule = match:class kitty, opacity 0.8 |
| 205 | -# windowrule = match:class dev.zed.Zed, opacity 0.6 | |
| 206 | 178 | windowrule = match:class .*wezterm.*, opacity 0.8 |
| 207 | 179 | windowrule = match:class .*dev.heppen.webapps.*, tile on |
| 208 | 180 | |
| 209 | -# Gaming: enable tearing for fullscreen games | |
| 210 | 181 | windowrule = match:fullscreen 1, immediate on |
| 211 | 182 | windowrule = match:class dev.zed.Zed, immediate off |
| 212 | 183 | |
| @@ -259,7 +230,7 @@ animations { | ||
| 259 | 230 | } |
| 260 | 231 | |
| 261 | 232 | dwindle { |
| 262 | - preserve_split = true # You probably want this | |
| 233 | + preserve_split = true | |
| 263 | 234 | } |
| 264 | 235 | |
| 265 | 236 | master { |
| @@ -267,29 +238,17 @@ master { | ||
| 267 | 238 | } |
| 268 | 239 | |
| 269 | 240 | misc { |
| 270 | - force_default_wallpaper = 0 # Set to 0 or 1 to disable the anime mascot wallpapers | |
| 271 | - disable_hyprland_logo = true # If true disables the random hyprland logo / anime girl background. :( | |
| 241 | + force_default_wallpaper = 0 | |
| 242 | + disable_hyprland_logo = true | |
| 272 | 243 | vrr = 0 |
| 273 | 244 | mouse_move_focuses_monitor = false |
| 274 | 245 | } |
| 275 | 246 | |
| 276 | 247 | debug { |
| 277 | - # Logging was enabled 2026-04-24 for the hard-freeze hunt. That turned out to be a | |
| 278 | - # Hyprland bug, fixed upstream — closed 2026-07-29, so back to the default (logs off). | |
| 279 | - # hyprland.log was growing ~1.2MB/hr into /run/user/1000 (tmpfs = RAM). | |
| 280 | - # Flip to false again if you ever need to capture compositor state. | |
| 281 | 248 | disable_logs = true |
| 282 | 249 | enable_stdout_logs = false |
| 283 | 250 | } |
| 284 | 251 | |
| 285 | -# =================================== | |
| 286 | -# Power Management | |
| 287 | -# =================================== | |
| 288 | -# Super + Escape: Open power menu | |
| 289 | -# Super + Shift + Q: Quick suspend | |
| 290 | -# Super + Shift + R: Quick reboot | |
| 291 | -# Super + Shift + S: Quick shutdown | |
| 292 | - | |
| 293 | 252 | input { |
| 294 | 253 | kb_layout = tr |
| 295 | 254 | kb_variant = |
| @@ -301,15 +260,13 @@ input { | ||
| 301 | 260 | mouse_refocus = false |
| 302 | 261 | accel_profile = flat |
| 303 | 262 | |
| 304 | - sensitivity = 0 # -1.0 - 1.0, 0 means no modification. | |
| 263 | + sensitivity = 0 | |
| 305 | 264 | |
| 306 | 265 | touchpad { |
| 307 | 266 | natural_scroll = true |
| 308 | 267 | } |
| 309 | 268 | } |
| 310 | 269 | |
| 311 | -# Example per-device config | |
| 312 | -# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more | |
| 313 | 270 | device { |
| 314 | 271 | name = epic-mouse-v1 |
| 315 | 272 | sensitivity = 0 |
.config/hypr/hyprlock.confmodified+0 -7
| @@ -1,12 +1,8 @@ | ||
| 1 | -# Hyprlock Configuration | |
| 2 | -# Lock screen with date/time display, password authentication, and music info | |
| 3 | 1 | |
| 4 | -# Background image | |
| 5 | 2 | background { |
| 6 | 3 | path = ~/Pictures/Wallpapers/ryunosuke-kikuno-VXp-9HwN1eg-unsplash.jpg |
| 7 | 4 | } |
| 8 | 5 | |
| 9 | -# Date label - displays current date in center | |
| 10 | 6 | label { |
| 11 | 7 | monitor = |
| 12 | 8 | text = cmd[update:1000] echo -e "$(LC_TIME=en_GB.UTF-8 date +"%A, %B %d")" |
| @@ -18,7 +14,6 @@ label { | ||
| 18 | 14 | valign = center |
| 19 | 15 | } |
| 20 | 16 | |
| 21 | -# Time label - displays current time in large format at center | |
| 22 | 17 | label { |
| 23 | 18 | monitor = |
| 24 | 19 | text = cmd[update:1000] echo "<span>$(date +"%H:%M:%S")</span>" |
| @@ -30,7 +25,6 @@ label { | ||
| 30 | 25 | valign = center |
| 31 | 26 | } |
| 32 | 27 | |
| 33 | -# Password input field with authentication status feedback | |
| 34 | 28 | input-field { |
| 35 | 29 | monitor = |
| 36 | 30 | size = 280, 55 |
| @@ -53,7 +47,6 @@ input-field { | ||
| 53 | 47 | fail_text = <i>Authentication Failed</i> |
| 54 | 48 | } |
| 55 | 49 | |
| 56 | -# Music info label - reads single-source file maintained by song_detail_writer.sh | |
| 57 | 50 | label { |
| 58 | 51 | monitor = |
| 59 | 52 | text = cmd[update:1000] cat /tmp/song_detail_last 2>/dev/null |
.config/niri/config.kdlmodified+0 -121
| @@ -1,15 +1,5 @@ | ||
| 1 | -// niri config — ported from ~/.config/hypr/hyprland.conf, both kept working. | |
| 2 | -// Docs: https://niri-wm.github.io/niri/ • check edits with `niri validate` | |
| 3 | -// | |
| 4 | -// MONITORS: DP-1 = left/primary (2560x1440@180), HDMI-A-1 = right (1920x1080@75). | |
| 5 | -// KDL has no variables, so those names are literal. They appear ONLY in the | |
| 6 | -// `output` blocks and the four monitor binds below. Scripts read them from | |
| 7 | -// ~/.config/scripts/niri/monitors.sh instead. | |
| 8 | -// | |
| 9 | -// Mod = Super. Alt is the app-launcher trigger, matching Hyprland's $my_trigger. | |
| 10 | 1 | |
| 11 | 2 | hotkey-overlay { |
| 12 | - // Do not pop the keybind cheat sheet on login. Mod+Shift+Slash still shows it. | |
| 13 | 3 | skip-at-startup |
| 14 | 4 | } |
| 15 | 5 | |
| @@ -26,7 +16,6 @@ input { | ||
| 26 | 16 | natural-scroll |
| 27 | 17 | } |
| 28 | 18 | |
| 29 | - // Hyprland: accel_profile = flat (raw input, no acceleration curve). | |
| 30 | 19 | mouse { |
| 31 | 20 | accel-profile "flat" |
| 32 | 21 | } |
| @@ -34,24 +23,16 @@ input { | ||
| 34 | 23 | trackpoint { |
| 35 | 24 | } |
| 36 | 25 | |
| 37 | - // focus-follows-mouse stays off, matching Hyprland's follow_mouse = 0. | |
| 38 | - // No niri equivalent for mouse_move_focuses_monitor = false: moving the | |
| 39 | - // cursor to the other output does make it the focused one. | |
| 40 | 26 | } |
| 41 | 27 | |
| 42 | -// Ask every client to skip its own decorations, so niri's border is the only | |
| 43 | -// frame. Kills the CSD titlebar that showed the page/document title (Hyprland | |
| 44 | -// never had one because it sends server-side decorations by default). | |
| 45 | 28 | prefer-no-csd |
| 46 | 29 | |
| 47 | 30 | gestures { |
| 48 | - // No overview/workspace switch when the pointer hits a screen corner. | |
| 49 | 31 | hot-corners { |
| 50 | 32 | off |
| 51 | 33 | } |
| 52 | 34 | } |
| 53 | 35 | |
| 54 | -// Hyprland had `bitdepth 10`; niri 26.04 has no bit-depth or hdr output key. | |
| 55 | 36 | output "DP-1" { |
| 56 | 37 | mode "2560x1440@180" |
| 57 | 38 | scale 1 |
| @@ -60,7 +41,6 @@ output "DP-1" { | ||
| 60 | 41 | focus-at-startup |
| 61 | 42 | } |
| 62 | 43 | |
| 63 | -// Mode string must be exact: 75.003, not 75. | |
| 64 | 44 | output "HDMI-A-1" { |
| 65 | 45 | mode "1920x1080@75.003" |
| 66 | 46 | scale 1 |
| @@ -69,7 +49,6 @@ output "HDMI-A-1" { | ||
| 69 | 49 | } |
| 70 | 50 | |
| 71 | 51 | layout { |
| 72 | - // Hyprland gaps_in = 3; the remaining 7 to reach gaps_out = 10 is in struts. | |
| 73 | 52 | gaps 3 |
| 74 | 53 | struts { |
| 75 | 54 | left 7 |
| @@ -80,21 +59,8 @@ layout { | ||
| 80 | 59 | |
| 81 | 60 | center-focused-column "never" |
| 82 | 61 | |
| 83 | - // Puts a plain workspace at index 1 on every output, above the declared | |
| 84 | - // named block — so the workspace waybar labels on HDMI-A-1 is 1, not 9. | |
| 85 | - // | |
| 86 | - // This is NOT a replacement for workspace_startup.sh, which was tested: | |
| 87 | - // alone it still logs in with the first NAMED workspace active, because it | |
| 88 | - // only creates the workspace, it never focuses it. The two go together — | |
| 89 | - // this one supplies index 1, the script focuses it. | |
| 90 | - // | |
| 91 | - // Cost, accepted knowingly: every Mod+<N> shifts by one, since | |
| 92 | - // workspace_nav.sh indexes plain workspaces and this adds one at the top. | |
| 93 | 62 | empty-workspace-above-first |
| 94 | 63 | |
| 95 | - // New windows take the whole working area — the closest thing to dwindle | |
| 96 | - // handing a new window all the free space. 1.0 is in the preset cycle too, | |
| 97 | - // otherwise one Mod+R drops a window to 1/3 with no way back to full. | |
| 98 | 64 | default-column-width { proportion 1.0; } |
| 99 | 65 | preset-column-widths { |
| 100 | 66 | proportion 0.33333 |
| @@ -103,19 +69,13 @@ layout { | ||
| 103 | 69 | proportion 1.0 |
| 104 | 70 | } |
| 105 | 71 | |
| 106 | - // Hyprland had one border concept, mapped to `border` below. | |
| 107 | 72 | focus-ring { |
| 108 | 73 | off |
| 109 | 74 | } |
| 110 | 75 | |
| 111 | 76 | border { |
| 112 | - // Hyprland general:border_size = 2 | |
| 113 | 77 | width 2 |
| 114 | 78 | |
| 115 | - // The line after the marker is REWRITTEN IN PLACE by | |
| 116 | - // ~/.config/scripts/niri/wallust_niri_colors.sh on every wallpaper | |
| 117 | - // change. niri has no `include`, so generated colors cannot live in a | |
| 118 | - // separate file. Keep the marker directly above it, all on one line. | |
| 119 | 79 | // WALLUST-GRADIENT |
| 120 | 80 | active-gradient from="#4D0830" to="#7E420A" angle=90 in="oklch" |
| 121 | 81 | |
| @@ -123,9 +83,6 @@ layout { | ||
| 123 | 83 | urgent-color "#9b0000" |
| 124 | 84 | } |
| 125 | 85 | |
| 126 | - // Shadows and rounding are left off (Hyprland had rounding = 0, blur off). | |
| 127 | - // Rounded corners come from the window rule below instead, only so the | |
| 128 | - // border traces the curve GTK4 apps draw themselves. | |
| 129 | 86 | } |
| 130 | 87 | |
| 131 | 88 | environment { |
| @@ -133,15 +90,8 @@ environment { | ||
| 133 | 90 | XCURSOR_SIZE "24" |
| 134 | 91 | } |
| 135 | 92 | |
| 136 | -// Startup. The polkit agent, nm-applet and blueman-applet are deliberately | |
| 137 | -// absent: niri runs xdg-desktop-autostart.target and /etc/xdg/autostart already | |
| 138 | -// starts them. Hyprland ignored that target, which is why it needed exec-once. | |
| 139 | -// The sleeps preserve Hyprland's ordering (tray applets after waybar). | |
| 140 | 93 | spawn-at-startup "sh" "-c" "bash ~/.config/scripts/niri/wallpaper_restore.sh" |
| 141 | 94 | spawn-at-startup "sh" "-c" "bash ~/.config/scripts/shared/song_detail_writer.sh" |
| 142 | -// waybar needs its own config here: the shared one uses hyprland/workspaces | |
| 143 | -// and hyprland/window, which do nothing under niri. config-niri swaps those | |
| 144 | -// for niri/workspaces and niri/window. | |
| 145 | 95 | spawn-at-startup "sh" "-c" "sleep 1 && waybar -c ~/.config/waybar/config-niri" |
| 146 | 96 | spawn-at-startup "sh" "-c" "sleep 2 && kdeconnect-indicator" |
| 147 | 97 | spawn-at-startup "sh" "-c" "sleep 3 && /opt/Mullvad\\ VPN/mullvad-vpn" |
| @@ -150,29 +100,19 @@ spawn-at-startup "sh" "-c" "sleep 3 && wl-paste --type text --watch cliphist sto | ||
| 150 | 100 | spawn-at-startup "sh" "-c" "sleep 3 && wl-paste --type image --watch cliphist store" |
| 151 | 101 | spawn-at-startup "sh" "-c" "sleep 4 && rfkill unblock bluetooth && bluetoothctl power on" |
| 152 | 102 | |
| 153 | -// The declared app workspaces below all get created on the first output niri | |
| 154 | -// connects (HDMI-A-1), so that monitor logs in showing "code". This puts every | |
| 155 | -// output back on a plain workspace. Early on purpose: it must finish before the | |
| 156 | -// sleep-3/sleep-4 apps map their windows, or one lands on the wrong monitor. | |
| 157 | 103 | spawn-at-startup "sh" "-c" "sleep 1 && bash ~/.config/scripts/niri/workspace_startup.sh" |
| 158 | 104 | |
| 159 | 105 | screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" |
| 160 | 106 | |
| 161 | -// Animations stay at niri's defaults (on), unlike Hyprland where they were off. | |
| 162 | 107 | animations { |
| 163 | 108 | } |
| 164 | 109 | |
| 165 | -// Every window: draw the border AROUND the window, not behind it. niri uses the | |
| 166 | -// border as the window background by default, which is invisible behind an | |
| 167 | -// opaque window — the border simply never showed up. The corner radius makes it | |
| 168 | -// follow the rounding GTK4/libadwaita apps apply to themselves. | |
| 169 | 110 | window-rule { |
| 170 | 111 | draw-border-with-background false |
| 171 | 112 | geometry-corner-radius 12 |
| 172 | 113 | clip-to-geometry true |
| 173 | 114 | } |
| 174 | 115 | |
| 175 | -// Hyprland: windowrule = match:class .*wezterm.*, opacity 0.8 | |
| 176 | 116 | window-rule { |
| 177 | 117 | match app-id=r#"^org\.wezfurlong\.wezterm$"# |
| 178 | 118 | opacity 0.8 |
| @@ -184,20 +124,6 @@ window-rule { | ||
| 184 | 124 | open-floating true |
| 185 | 125 | } |
| 186 | 126 | |
| 187 | -// The app workspaces. A declared `workspace "name"` node is immortal — which is | |
| 188 | -// exactly the point: nothing has to create, name or clean them up, so there is | |
| 189 | -// no reaper daemon and no marker files. They were briefly named at runtime | |
| 190 | -// instead, and the reaper that un-named them died mid-session (niri dropped its | |
| 191 | -// IPC event stream for "reading events too slowly") leaving empty named | |
| 192 | -// workspaces behind — the failure this replaces. | |
| 193 | -// | |
| 194 | -// The empties are only visible in the overview: workspace_nav.sh filters on | |
| 195 | -// `.name == null`, so number and directional navigation skip them, and waybar | |
| 196 | -// runs niri/workspaces with current-only. | |
| 197 | -// | |
| 198 | -// No open-on-output on purpose — KDL has no variables and monitor names are kept | |
| 199 | -// to the `output` blocks and the monitor binds. They start on the first output | |
| 200 | -// and workspace_app.sh pulls an empty one to the monitor in use on launch. | |
| 201 | 127 | workspace "code" |
| 202 | 128 | workspace "github" |
| 203 | 129 | workspace "whatsapp" |
| @@ -208,8 +134,6 @@ workspace "mail" | ||
| 208 | 134 | workspace "signal" |
| 209 | 135 | |
| 210 | 136 | binds { |
| 211 | - // ─── launchers (Alt trigger, Hyprland $my_trigger) ─────────────────────── | |
| 212 | - // F-key and number-row variants both bound, as in Hyprland. | |
| 213 | 137 | Alt+T hotkey-overlay-title="Terminal: wezterm" { spawn-sh "wezterm start --always-new-process"; } |
| 214 | 138 | Alt+Q hotkey-overlay-title="Files: nautilus" { spawn-sh "nautilus --new-window"; } |
| 215 | 139 | |
| @@ -225,13 +149,6 @@ binds { | ||
| 225 | 149 | Alt+F hotkey-overlay-title="Browser" { spawn-sh "flatpak run io.github.ungoogled_software.ungoogled_chromium --enable-features=MiddleClickAutoscroll"; } |
| 226 | 150 | Shift+Alt+F hotkey-overlay-title="Browser (incognito, outside VPN)" { spawn-sh "mullvad-exclude flatpak run org.chromium.Chromium --incognito --enable-features=MiddleClickAutoscroll,AllowLegacyMV2Extensions --disable-features=ExtensionManifestV2Unsupported,ExtensionManifestV2Disabled,ExtensionsManifestV3Only"; } |
| 227 | 151 | |
| 228 | - // ─── app workspaces ───────────────────────────────────────────────────── | |
| 229 | - // workspace_app.sh emulates Hyprland's on-created-empty, which niri lacks. | |
| 230 | - // The workspaces are declared above, so "is the app running" is just "does | |
| 231 | - // its workspace hold a window". Empty -> the workspace moves to the monitor | |
| 232 | - // you are on and the app launches there; holding windows -> the key only | |
| 233 | - // moves focus to it, leaving it on its own monitor. webapp.sh builds the | |
| 234 | - // Chromium web-app command from a URL + profile id. | |
| 235 | 152 | Alt+C hotkey-overlay-title="Workspace: code" { spawn-sh "~/.config/scripts/niri/workspace_app.sh code zed"; } |
| 236 | 153 | Alt+G hotkey-overlay-title="Workspace: github" { spawn-sh "~/.config/scripts/niri/workspace_app.sh github ~/.config/scripts/shared/webapp.sh https://github.com/ FCF18Wmt"; } |
| 237 | 154 | Alt+W hotkey-overlay-title="Workspace: whatsapp" { spawn-sh "~/.config/scripts/niri/workspace_app.sh whatsapp ~/.config/scripts/shared/webapp.sh --mullvad https://web.whatsapp.com/ aW2IMaZ8"; } |
| @@ -250,28 +167,21 @@ binds { | ||
| 250 | 167 | Mod+Shift+P { spawn-sh "~/.config/scripts/niri/workspace_app.sh --move mail"; } |
| 251 | 168 | Mod+Shift+N { spawn-sh "~/.config/scripts/niri/workspace_app.sh --move signal"; } |
| 252 | 169 | |
| 253 | - // ─── session / system ─────────────────────────────────────────────────── | |
| 254 | - // hyprlock works here: ext-session-lock-v1, no Hyprland IPC dependency. | |
| 255 | 170 | Super+L hotkey-overlay-title="Lock: hyprlock" { spawn "hyprlock"; } |
| 256 | 171 | Mod+Escape hotkey-overlay-title="Power menu" { spawn-sh "bash ~/.config/scripts/system/power_menu.sh"; } |
| 257 | 172 | Mod+D hotkey-overlay-title="Show desktop" { spawn-sh "~/.config/scripts/niri/show_desktop.sh"; } |
| 258 | 173 | Mod+H hotkey-overlay-title="Toggle waybar" { spawn-sh "pkill -SIGUSR1 waybar"; } |
| 259 | 174 | Mod+W hotkey-overlay-title="Wallpaper picker" { spawn-sh "~/.config/scripts/niri/wallpaper_picker.sh"; } |
| 260 | 175 | |
| 261 | - // Exit is Super+Alt+F4 only, as in Hyprland. The stock Mod+Shift+E and | |
| 262 | - // Ctrl+Alt+Delete quit binds are removed on purpose. | |
| 263 | 176 | Alt+4 repeat=false { close-window; } |
| 264 | 177 | Alt+F4 repeat=false { close-window; } |
| 265 | 178 | Mod+Alt+F4 { quit; } |
| 266 | 179 | |
| 267 | - // Mod+Escape is the power menu, so the shortcut-inhibitor escape hatch | |
| 268 | - // lives on Mod+Shift+Escape. | |
| 269 | 180 | Mod+Shift+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } |
| 270 | 181 | Mod+Shift+Slash { show-hotkey-overlay; } |
| 271 | 182 | Mod+O repeat=false { toggle-overview; } |
| 272 | 183 | Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; } |
| 273 | 184 | |
| 274 | - // ─── media / brightness ───────────────────────────────────────────────── | |
| 275 | 185 | XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; } |
| 276 | 186 | XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; } |
| 277 | 187 | XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } |
| @@ -283,35 +193,19 @@ binds { | ||
| 283 | 193 | XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; } |
| 284 | 194 | XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; } |
| 285 | 195 | |
| 286 | - // ─── screenshots ──────────────────────────────────────────────────────── | |
| 287 | - // grim, not niri's built-ins: the Hyprland bind captured ALL outputs into | |
| 288 | - // one image, while screenshot-screen only grabs the focused output. | |
| 289 | 196 | Print { spawn-sh "grim -t png - | tee \"$HOME/Pictures/Screenshots/$(date '+%y%m%d_%H-%M-%S').png\" | wl-copy -t image/png"; } |
| 290 | 197 | Shift+Print { spawn-sh "grim -t png -g \"$(slurp)\" - | wl-copy -t image/png"; } |
| 291 | 198 | Ctrl+Print { screenshot-screen; } |
| 292 | 199 | Alt+Print { screenshot-window; } |
| 293 | 200 | |
| 294 | - // ─── monitors (the only place output names appear outside `output`) ────── | |
| 295 | - // Addressed by name, like Hyprland's $monitor_left / $monitor_right. The | |
| 296 | - // stock directional focus-monitor-* binds are dropped as redundant. | |
| 297 | 201 | Mod+Q { focus-monitor "DP-1"; } |
| 298 | 202 | Mod+E { focus-monitor "HDMI-A-1"; } |
| 299 | 203 | Mod+Shift+Q { move-column-to-monitor "DP-1"; } |
| 300 | 204 | Mod+Shift+E { move-column-to-monitor "HDMI-A-1"; } |
| 301 | 205 | |
| 302 | - // toggle_monitors.sh keeps Hyprland's Super+M menu / Super+Shift+M all-on, | |
| 303 | - // so maximize sits on Mod+Ctrl+M. | |
| 304 | 206 | Mod+M hotkey-overlay-title="Monitor menu" { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh"; } |
| 305 | 207 | Mod+Shift+M hotkey-overlay-title="All monitors on" { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh on"; } |
| 306 | 208 | |
| 307 | - // ─── focus ────────────────────────────────────────────────────────────── | |
| 308 | - // Mod+H is the waybar toggle and Mod+L is the locker, so the stock vim-nav | |
| 309 | - // binds for those two are gone; arrows still navigate. | |
| 310 | - // | |
| 311 | - // Left/Right move between columns. Up/Down are vertical in niri's sense: | |
| 312 | - // the next window in the column when the column has one, otherwise the | |
| 313 | - // workspace above/below (workspaces stack vertically). Mod+J/K stay | |
| 314 | - // strictly in-column. | |
| 315 | 209 | Mod+Left { focus-column-left; } |
| 316 | 210 | Mod+Right { focus-column-right; } |
| 317 | 211 | Mod+Up { spawn-sh "~/.config/scripts/niri/workspace_nav.sh up"; } |
| @@ -323,7 +217,6 @@ binds { | ||
| 323 | 217 | Mod+Tab { focus-window-previous; } |
| 324 | 218 | Alt+Tab { focus-workspace-previous; } |
| 325 | 219 | |
| 326 | - // ─── move windows ─────────────────────────────────────────────────────── | |
| 327 | 220 | Mod+Ctrl+Left { move-column-left; } |
| 328 | 221 | Mod+Ctrl+Right { move-column-right; } |
| 329 | 222 | Mod+Ctrl+Up { spawn-sh "~/.config/scripts/niri/workspace_nav.sh move-up"; } |
| @@ -335,16 +228,6 @@ binds { | ||
| 335 | 228 | Mod+Ctrl+Home { move-column-to-first; } |
| 336 | 229 | Mod+Ctrl+End { move-column-to-last; } |
| 337 | 230 | |
| 338 | - // ─── workspaces ───────────────────────────────────────────────────────── | |
| 339 | - // niri workspaces are per-monitor already, which is what hyprsplit gave | |
| 340 | - // Hyprland. Mod+Shift+N is Hyprland's send-to-workspace; the stock | |
| 341 | - // Mod+Ctrl+N binds do the same and are kept as well. | |
| 342 | - // | |
| 343 | - // All of these go through workspace_nav.sh rather than niri's own | |
| 344 | - // focus-workspace: niri numbers are indices into each output's live | |
| 345 | - // workspace list, and the named app workspaces live in that same list, so | |
| 346 | - // Mod+3 could land on "discord". The script indexes the PLAIN workspaces | |
| 347 | - // only. N past the end clamps to the last one. | |
| 348 | 231 | Mod+1 { spawn-sh "~/.config/scripts/niri/workspace_nav.sh focus 1"; } |
| 349 | 232 | Mod+2 { spawn-sh "~/.config/scripts/niri/workspace_nav.sh focus 2"; } |
| 350 | 233 | Mod+3 { spawn-sh "~/.config/scripts/niri/workspace_nav.sh focus 3"; } |
| @@ -390,7 +273,6 @@ binds { | ||
| 390 | 273 | Mod+Shift+U { move-workspace-down; } |
| 391 | 274 | Mod+Shift+I { move-workspace-up; } |
| 392 | 275 | |
| 393 | - // ─── scroll wheel ─────────────────────────────────────────────────────── | |
| 394 | 276 | Mod+WheelScrollDown cooldown-ms=150 { spawn-sh "~/.config/scripts/niri/workspace_nav.sh next"; } |
| 395 | 277 | Mod+WheelScrollUp cooldown-ms=150 { spawn-sh "~/.config/scripts/niri/workspace_nav.sh prev"; } |
| 396 | 278 | Mod+Ctrl+WheelScrollDown cooldown-ms=150 { spawn-sh "~/.config/scripts/niri/workspace_nav.sh move-next"; } |
| @@ -404,9 +286,6 @@ binds { | ||
| 404 | 286 | Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } |
| 405 | 287 | Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } |
| 406 | 288 | |
| 407 | - // ─── size / layout ────────────────────────────────────────────────────── | |
| 408 | - // Mod+F is floating (Hyprland togglefloating), so maximize is Mod+Ctrl+M. | |
| 409 | - // Mod+Shift+arrows are Hyprland's resizeactive 30 / -30, in logical pixels. | |
| 410 | 289 | Mod+F { toggle-window-floating; } |
| 411 | 290 | Mod+Shift+F { fullscreen-window; } |
| 412 | 291 | Mod+Ctrl+M { maximize-column; } |
.config/scripts/hyprland/show_desktop.shmodified+0 -2
| @@ -24,8 +24,6 @@ WS_FOCUSED=$WS_FOCUSED | ||
| 24 | 24 | WS_OTHER=$WS_OTHER |
| 25 | 25 | EOF |
| 26 | 26 | |
| 27 | - # one empty dummy workspace per monitor; no swapactiveworkspaces — | |
| 28 | - # swaps rebind workspaces to the wrong monitor and confuse waybar | |
| 29 | 27 | if [ -n "$MON2" ]; then |
| 30 | 28 | hyprctl --batch "dispatch focusmonitor $MON2; dispatch workspace 998; dispatch focusmonitor $MON1; dispatch workspace 999" |
| 31 | 29 | else |
.config/scripts/hyprland/toggle_monitors.shmodified+0 -2
| @@ -1,7 +1,5 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | |
| 3 | -# Toggle monitors off via rofi, re-enable with keybinding | |
| 4 | - | |
| 5 | 3 | DP1_CONFIG="DP-1, 2560x1440@180, 0x0, 1, bitdepth, 10" |
| 6 | 4 | HDMI_CONFIG="HDMI-A-1, 1920x1080@75, 2560x0, 1, bitdepth, 10" |
| 7 | 5 |
.config/scripts/hyprland/wallpaper_picker.shmodified+0 -7
| @@ -1,14 +1,11 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | -# Rofi wallpaper picker — updates hyprpaper, wallust, and waybar | |
| 3 | 2 | |
| 4 | 3 | WALLPAPER_DIR="$HOME/Pictures/Wallpapers" |
| 5 | 4 | HYPRPAPER_CONF="$HOME/.config/hypr/hyprpaper.conf" |
| 6 | 5 | THUMB_DIR="$HOME/.cache/wallpaper_thumbs" |
| 7 | 6 | |
| 8 | -# Generate thumbnail cache (only for new/changed images) | |
| 9 | 7 | mkdir -p "$THUMB_DIR" |
| 10 | 8 | |
| 11 | -# Remove orphan thumbnails for deleted wallpapers | |
| 12 | 9 | for thumb in "$THUMB_DIR"/*.png; do |
| 13 | 10 | [ -f "$thumb" ] || continue |
| 14 | 11 | name=$(basename "$thumb" .png) |
| @@ -17,7 +14,6 @@ for thumb in "$THUMB_DIR"/*.png; do | ||
| 17 | 14 | fi |
| 18 | 15 | done |
| 19 | 16 | |
| 20 | -# Generate thumbnails for new/changed wallpapers | |
| 21 | 17 | find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | while read -r img; do |
| 22 | 18 | name=$(basename "$img") |
| 23 | 19 | thumb="$THUMB_DIR/$name.png" |
| @@ -27,7 +23,6 @@ find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' - | ||
| 27 | 23 | done |
| 28 | 24 | wait |
| 29 | 25 | |
| 30 | -# List image files with cached thumbnails in a grid rofi | |
| 31 | 26 | SELECTED=$(find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | sort | while read -r img; do |
| 32 | 27 | name=$(basename "$img") |
| 33 | 28 | echo -en "${name}\0icon\x1f${THUMB_DIR}/${name}.png\n" |
| @@ -48,7 +43,6 @@ if [ ! -f "$WALLPAPER" ]; then | ||
| 48 | 43 | exit 1 |
| 49 | 44 | fi |
| 50 | 45 | |
| 51 | -# Update hyprpaper config and kill both processes | |
| 52 | 46 | cat > "$HYPRPAPER_CONF" << EOF |
| 53 | 47 | splash = false |
| 54 | 48 | |
| @@ -61,7 +55,6 @@ EOF | ||
| 61 | 55 | |
| 62 | 56 | pkill hyprpaper |
| 63 | 57 | |
| 64 | -# Run hyprpaper and wallust in parallel | |
| 65 | 58 | hyprpaper &disown |
| 66 | 59 | wallust run -qs "$WALLPAPER" & |
| 67 | 60 | wait |
.config/scripts/niri/monitors.shmodified+2 -8
| @@ -1,9 +1,3 @@ | ||
| 1 | -# Monitor names, sourced by the niri scripts. Not executable on purpose. | |
| 2 | -# | |
| 3 | -# Swapping a monitor means editing this file plus the `output` blocks and the | |
| 4 | -# four focus-monitor / move-column-to-monitor binds in config.kdl. KDL has no | |
| 5 | -# variables, so those cannot be parameterised — config.kdl names the outputs | |
| 6 | -# in exactly one place each, and this file covers everything scripted. | |
| 7 | 1 | |
| 8 | -LEFT_MONITOR="DP-1" # Xiaomi Mi Monitor, 2560x1440@180, primary, at x=0 | |
| 9 | -RIGHT_MONITOR="HDMI-A-1" # 1920x1080@75, to the right at x=2560 | |
| 2 | +LEFT_MONITOR="DP-1" | |
| 3 | +RIGHT_MONITOR="HDMI-A-1" |
.config/scripts/niri/show_desktop.shmodified+1 -18
| @@ -1,27 +1,15 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | -# Show-desktop toggle for niri. Port of ~/.config/scripts/hyprland/show_desktop.sh | |
| 3 | -# | |
| 4 | -# Same idea as the Hyprland version: remember what each output is showing, send | |
| 5 | -# every output to an empty workspace, and restore on the second press. niri | |
| 6 | -# always keeps one empty workspace at the end of each output's list, so there is | |
| 7 | -# no need for the dedicated 998/999 dummy workspaces Hyprland needed. | |
| 8 | -# | |
| 9 | -# Workspaces are referenced by name when they have one and by index otherwise, | |
| 10 | -# because niri workspace indices shift as workspaces come and go. | |
| 11 | 2 | set -euo pipefail |
| 12 | 3 | |
| 13 | 4 | STATE_FILE="/tmp/niri_show_desktop" |
| 14 | 5 | |
| 15 | 6 | ws_json=$(niri msg -j workspaces) |
| 16 | 7 | |
| 17 | -# Reference used to focus a workspace again later: prefer the name, else index. | |
| 18 | -ref_of() { # $1 = jq object | |
| 8 | +ref_of() { | |
| 19 | 9 | jq -r 'if .name != null then .name else (.idx | tostring) end' <<<"$1" |
| 20 | 10 | } |
| 21 | 11 | |
| 22 | 12 | if [ -f "$STATE_FILE" ]; then |
| 23 | - # Restore. Focus each output, put back what it was showing, then return | |
| 24 | - # focus to the output that had it before. | |
| 25 | 13 | while IFS=$'\t' read -r out ref; do |
| 26 | 14 | [ -n "$out" ] || continue |
| 27 | 15 | niri msg action focus-monitor "$out" >/dev/null |
| @@ -39,16 +27,12 @@ else | ||
| 39 | 27 | : > "$STATE_FILE" |
| 40 | 28 | printf 'FOCUSED\t%s\n' "$focused_out" >> "$STATE_FILE" |
| 41 | 29 | |
| 42 | - # Record the active workspace of every output. | |
| 43 | 30 | while read -r out; do |
| 44 | 31 | active=$(jq -c --arg o "$out" '.[] | select(.output == $o and .is_active == true)' <<<"$ws_json") |
| 45 | 32 | printf '%s\t%s\n' "$out" "$(ref_of "$active")" >> "$STATE_FILE" |
| 46 | 33 | done < <(jq -r '[.[].output] | unique | .[]' <<<"$ws_json") |
| 47 | 34 | |
| 48 | - # Send every output to an empty workspace of its own. | |
| 49 | 35 | while read -r out; do |
| 50 | - # Unnamed only: the named workspaces are the app ones (code, discord, | |
| 51 | - # ...), and landing on an empty "github" is not "show desktop". | |
| 52 | 36 | empty_idx=$(jq -r --arg o "$out" --argjson w "$win_json" ' |
| 53 | 37 | [ .[] |
| 54 | 38 | | select(.output == $o and .name == null) |
| @@ -56,7 +40,6 @@ else | ||
| 56 | 40 | | select(([$w[] | select(.workspace_id == $ws.id)] | length) == 0) |
| 57 | 41 | ] | last | .idx // empty' <<<"$ws_json") |
| 58 | 42 | |
| 59 | - # Fall back to the highest index on that output, which niri keeps empty. | |
| 60 | 43 | if [ -z "$empty_idx" ]; then |
| 61 | 44 | empty_idx=$(jq -r --arg o "$out" '[.[] | select(.output == $o) | .idx] | max' <<<"$ws_json") |
| 62 | 45 | fi |
.config/scripts/niri/toggle_monitors.shmodified+3 -12
| @@ -1,13 +1,4 @@ | ||
| 1 | 1 | #!/usr/bin/env bash |
| 2 | -# Rofi monitor chooser for niri. Port of ~/.config/scripts/hyprland/toggle_monitors.sh | |
| 3 | -# | |
| 4 | -# usage: toggle_monitors.sh [menu|on] | |
| 5 | -# | |
| 6 | -# niri difference worth knowing: there is no per-output DPMS. `power-off-monitors` | |
| 7 | -# blanks EVERY output and any input wakes them back up, while `niri msg output X off` | |
| 8 | -# genuinely disables one output — windows on it move away, and only `... on` (or the | |
| 9 | -# `on` argument here, bound to Super+Shift+M) brings it back. So the single-monitor | |
| 10 | -# entries below disable rather than blank. | |
| 11 | 2 | set -euo pipefail |
| 12 | 3 | |
| 13 | 4 | . "$(dirname "$(realpath "$0")")/monitors.sh" |
| @@ -21,9 +12,9 @@ all_on() { | ||
| 21 | 12 | case "${1:-menu}" in |
| 22 | 13 | menu) |
| 23 | 14 | choice=$(printf '%s\n' \ |
| 24 | - "🖥️ All Monitors Off (blank, any key wakes)" \ | |
| 25 | - "🖥️ $LEFT_MONITOR Off (disable)" \ | |
| 26 | - "🖥️ $RIGHT_MONITOR Off (disable)" \ | |
| 15 | + "🖥️ All Monitors Off" \ | |
| 16 | + "🖥️ $LEFT_MONITOR Off" \ | |
| 17 | + "🖥️ $RIGHT_MONITOR Off" \ | |
| 27 | 18 | "💡 All Monitors On" \ |
| 28 | 19 | "💡 $LEFT_MONITOR On" \ |
| 29 | 20 | "💡 $RIGHT_MONITOR On" \ |
.config/scripts/niri/wallpaper_picker.shmodified+0 -18
| @@ -1,22 +1,11 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | -# Rofi wallpaper picker for niri — updates awww, wallust, and waybar. | |
| 3 | -# | |
| 4 | -# This is the niri twin of ~/.config/scripts/hyprland/wallpaper_picker.sh. | |
| 5 | -# Everything above the "Apply" section is identical; only the backend differs: | |
| 6 | -# hyprpaper talks over Hyprland's IPC socket (path built from | |
| 7 | -# $HYPRLAND_INSTANCE_SIGNATURE) and cannot run here, so awww replaces it. | |
| 8 | -# | |
| 9 | -# Unlike hyprpaper there is no config file to rewrite and no process to kill: | |
| 10 | -# awww-daemon stays up and `awww img` swaps the image at runtime. | |
| 11 | 2 | |
| 12 | 3 | WALLPAPER_DIR="$HOME/Pictures/Wallpapers" |
| 13 | 4 | THUMB_DIR="$HOME/.cache/wallpaper_thumbs" |
| 14 | 5 | STATE_FILE="$HOME/.cache/current_wallpaper" |
| 15 | 6 | |
| 16 | -# Generate thumbnail cache (only for new/changed images) | |
| 17 | 7 | mkdir -p "$THUMB_DIR" |
| 18 | 8 | |
| 19 | -# Remove orphan thumbnails for deleted wallpapers | |
| 20 | 9 | for thumb in "$THUMB_DIR"/*.png; do |
| 21 | 10 | [ -f "$thumb" ] || continue |
| 22 | 11 | name=$(basename "$thumb" .png) |
| @@ -25,7 +14,6 @@ for thumb in "$THUMB_DIR"/*.png; do | ||
| 25 | 14 | fi |
| 26 | 15 | done |
| 27 | 16 | |
| 28 | -# Generate thumbnails for new/changed wallpapers | |
| 29 | 17 | find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | while read -r img; do |
| 30 | 18 | name=$(basename "$img") |
| 31 | 19 | thumb="$THUMB_DIR/$name.png" |
| @@ -35,7 +23,6 @@ find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' - | ||
| 35 | 23 | done |
| 36 | 24 | wait |
| 37 | 25 | |
| 38 | -# List image files with cached thumbnails in a grid rofi | |
| 39 | 26 | SELECTED=$(find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | sort | while read -r img; do |
| 40 | 27 | name=$(basename "$img") |
| 41 | 28 | echo -en "${name}\0icon\x1f${THUMB_DIR}/${name}.png\n" |
| @@ -56,8 +43,6 @@ if [ ! -f "$WALLPAPER" ]; then | ||
| 56 | 43 | exit 1 |
| 57 | 44 | fi |
| 58 | 45 | |
| 59 | -# Apply: awww holds the wallpaper, wallust regenerates the palette. | |
| 60 | -# Start the daemon if it is not already up (also covers a crashed daemon). | |
| 61 | 46 | if ! awww query >/dev/null 2>&1; then |
| 62 | 47 | awww-daemon >/dev/null 2>&1 & |
| 63 | 48 | disown |
| @@ -71,11 +56,8 @@ awww img --transition-type simple "$WALLPAPER" & | ||
| 71 | 56 | wallust run -qs "$WALLPAPER" & |
| 72 | 57 | wait |
| 73 | 58 | |
| 74 | -# Remember the choice so the daemon can be restored on the next login. | |
| 75 | 59 | echo "$WALLPAPER" > "$STATE_FILE" |
| 76 | 60 | |
| 77 | -# -c: the shared waybar config uses the hyprland/* modules, which are inert | |
| 78 | -# under niri. Must match the config niri starts waybar with. | |
| 79 | 61 | killall waybar 2>/dev/null |
| 80 | 62 | waybar -c "$HOME/.config/waybar/config-niri" &disown |
| 81 | 63 | notify-send "Wallpaper Picker" "Applied: $SELECTED" |
.config/scripts/niri/wallpaper_restore.shmodified+0 -5
| @@ -1,7 +1,4 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | -# Start awww-daemon and restore the last wallpaper picked by wallpaper_picker.sh. | |
| 3 | -# Run once at niri startup. hyprpaper read its wallpaper from hyprpaper.conf; | |
| 4 | -# awww keeps no config file, so the choice is remembered in a state file. | |
| 5 | 2 | |
| 6 | 3 | STATE_FILE="$HOME/.cache/current_wallpaper" |
| 7 | 4 | FALLBACK_DIR="$HOME/Pictures/Wallpapers" |
| @@ -21,8 +18,6 @@ if [ -s "$STATE_FILE" ]; then | ||
| 21 | 18 | WALLPAPER=$(cat "$STATE_FILE") |
| 22 | 19 | fi |
| 23 | 20 | |
| 24 | -# First run on niri: fall back to whatever hyprpaper was last set to, so the | |
| 25 | -# desktop does not come up blank before the first pick. | |
| 26 | 21 | if [ ! -f "$WALLPAPER" ]; then |
| 27 | 22 | WALLPAPER=$(grep -oP '^\s*path\s*=\s*\K.*' "$HOME/.config/hypr/hyprpaper.conf" 2>/dev/null | head -1) |
| 28 | 23 | fi |
.config/scripts/niri/wallust_niri_colors.shmodified+0 -22
| @@ -1,36 +1,15 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | -# Rewrite niri's border gradient from the current wallust palette. | |
| 3 | -# | |
| 4 | -# Runs as a wallust hook (see [hooks] in ~/.config/wallust/wallust.toml), so it | |
| 5 | -# fires on every `wallust run`, i.e. on every wallpaper change. | |
| 6 | -# | |
| 7 | -# niri has no `include` directive, so the colors cannot be generated into a | |
| 8 | -# separate file and pulled in — the line has to be edited inside config.kdl | |
| 9 | -# itself. The line immediately following the "// WALLUST-GRADIENT" marker is | |
| 10 | -# replaced wholesale. niri watches its config and reloads on write, so the | |
| 11 | -# border updates live. | |
| 12 | -# | |
| 13 | -# Safe to run under Hyprland too: it only edits a file. niri picks up the new | |
| 14 | -# colors whenever it next runs. | |
| 15 | 2 | set -euo pipefail |
| 16 | 3 | |
| 17 | 4 | CONFIG="$HOME/.config/niri/config.kdl" |
| 18 | -# Written by the 'niri' entry in wallust.toml [templates] from | |
| 19 | -# ~/.config/wallust/templates/niri-colors.sh. Do NOT read | |
| 20 | -# ~/.cache/wallust/sequences instead: the picker runs `wallust run -qs`, and -s | |
| 21 | -# skips writing that file, so it silently goes stale and the border never | |
| 22 | -# changes. | |
| 23 | 5 | COLORS="$HOME/.cache/wallust/niri-colors.sh" |
| 24 | 6 | MARKER="// WALLUST-GRADIENT" |
| 25 | 7 | |
| 26 | 8 | [ -f "$CONFIG" ] || exit 0 |
| 27 | 9 | [ -f "$COLORS" ] || exit 0 |
| 28 | 10 | |
| 29 | -# shellcheck source=/dev/null | |
| 30 | 11 | . "$COLORS" |
| 31 | 12 | |
| 32 | -# wallust's {{colorN}} placeholders already carry the leading '#'; strip it so | |
| 33 | -# exactly one is added back below regardless of format. | |
| 34 | 13 | FROM="${NIRI_BORDER_FROM#\#}" |
| 35 | 14 | TO="${NIRI_BORDER_TO#\#}" |
| 36 | 15 | |
| @@ -40,7 +19,6 @@ fi | ||
| 40 | 19 | |
| 41 | 20 | grep -qF "$MARKER" "$CONFIG" || exit 0 |
| 42 | 21 | |
| 43 | -# Replace the line after the marker, preserving its indentation. | |
| 44 | 22 | awk -v marker="$MARKER" -v from="#$FROM" -v to="#$TO" ' |
| 45 | 23 | hit { |
| 46 | 24 | match($0, /^[ \t]*/) |
.config/scripts/niri/workspace_app.shmodified+0 -28
| @@ -1,21 +1,4 @@ | ||
| 1 | 1 | #!/usr/bin/env bash |
| 2 | -# Focus an app workspace, launching the app the first time. | |
| 3 | -# | |
| 4 | -# usage: workspace_app.sh <workspace-name> <command> [args...] | |
| 5 | -# workspace_app.sh --move <workspace-name> | |
| 6 | -# | |
| 7 | -# Behaviour: | |
| 8 | -# * workspace holds windows (app is running) -> just focus it. It stays on the | |
| 9 | -# monitor it was launched on; the key moves FOCUS there rather than dragging | |
| 10 | -# the workspace to the monitor you happen to be on. | |
| 11 | -# * workspace is empty (app not running) -> pull it to the focused monitor, | |
| 12 | -# focus it, and launch the app there. | |
| 13 | -# | |
| 14 | -# The workspaces are DECLARED in config.kdl, so they always exist and niri never | |
| 15 | -# reaps them. That is what removed the naming step, the grace marker files and | |
| 16 | -# workspace_reaper.sh: with a permanent workspace, "is the app running" is just | |
| 17 | -# "does its workspace hold a window", which is one stateless query per keypress | |
| 18 | -# instead of a daemon following the IPC event stream. | |
| 19 | 2 | set -euo pipefail |
| 20 | 3 | |
| 21 | 4 | mode="focus" |
| @@ -29,10 +12,6 @@ shift || true | ||
| 29 | 12 | |
| 30 | 13 | ws_json=$(niri msg -j workspaces) |
| 31 | 14 | |
| 32 | -# Resolved before the --move branch so both modes fail loudly rather than letting | |
| 33 | -# niri exit non-zero into a keybind, where nothing would be shown at all. | |
| 34 | -# Two ids means two workspaces carry the name — a leftover runtime name next to | |
| 35 | -# the declared one — which every jq below would then choke on. | |
| 36 | 15 | mapfile -t ids < <(jq -r --arg w "$ws" '.[] | select(.name == $w) | .id' <<<"$ws_json") |
| 37 | 16 | if [ "${#ids[@]}" -eq 0 ]; then |
| 38 | 17 | notify-send "workspace_app" "No workspace named '$ws' — is it declared in config.kdl?" |
| @@ -52,13 +31,8 @@ fi | ||
| 52 | 31 | count=$(niri msg -j windows | jq --argjson id "$id" '[.[] | select(.workspace_id == $id)] | length') |
| 53 | 32 | |
| 54 | 33 | if [ "$count" -eq 0 ]; then |
| 55 | - # Empty, so the app is not running: bring the workspace to the monitor in use | |
| 56 | - # before focusing, so the app opens where you are. move-workspace-to-monitor | |
| 57 | - # takes --reference; the positional argument is the OUTPUT. | |
| 58 | 34 | focused=$(jq -r '.[] | select(.is_focused == true) | .output' <<<"$ws_json") |
| 59 | 35 | home=$(jq -r --arg w "$ws" '.[] | select(.name == $w) | .output' <<<"$ws_json") |
| 60 | - # || true: a failed move must not take the focus and the launch down with it | |
| 61 | - # under `set -e`. Worst case the app opens on the workspace's own monitor. | |
| 62 | 36 | if [ -n "$focused" ] && [ "$focused" != "$home" ]; then |
| 63 | 37 | niri msg action move-workspace-to-monitor --reference "$ws" "$focused" >/dev/null || true |
| 64 | 38 | fi |
| @@ -66,8 +40,6 @@ fi | ||
| 66 | 40 | |
| 67 | 41 | niri msg action focus-workspace "$ws" >/dev/null |
| 68 | 42 | |
| 69 | -# Launch only when the workspace holds nothing, so a second press is "go there" | |
| 70 | -# rather than a duplicate app. | |
| 71 | 43 | if [ "$count" -eq 0 ] && [ "$#" -gt 0 ]; then |
| 72 | 44 | setsid "$@" >/dev/null 2>&1 & |
| 73 | 45 | fi |
.config/scripts/niri/workspace_nav.shmodified+1 -31
| @@ -1,33 +1,8 @@ | ||
| 1 | 1 | #!/usr/bin/env bash |
| 2 | -# Navigate only the PLAIN (unnamed) workspaces, skipping the named app ones. | |
| 3 | -# | |
| 4 | -# usage: workspace_nav.sh focus <N> focus the Nth plain workspace | |
| 5 | -# workspace_nav.sh move <N> move focused column to it | |
| 6 | -# workspace_nav.sh next|prev focus the next/previous plain one | |
| 7 | -# workspace_nav.sh move-next|move-prev | |
| 8 | -# workspace_nav.sh up|down focus within the column, else the | |
| 9 | -# workspace above/below | |
| 10 | -# workspace_nav.sh move-up|move-down same, moving the window | |
| 11 | -# | |
| 12 | -# Why this exists: niri workspace numbers are indices into each output's live | |
| 13 | -# workspace list, and the named app workspaces (code, github, ...) live in that | |
| 14 | -# same list — so Mod+3 could land on "discord". The app workspaces are reachable | |
| 15 | -# by their own Alt+<letter> binds, and should be invisible to number and | |
| 16 | -# directional navigation. | |
| 17 | -# | |
| 18 | -# Everything is scoped to the focused output, matching niri's own per-output | |
| 19 | -# indices. N beyond the number of plain workspaces clamps to the last one; niri | |
| 20 | -# always keeps one empty unnamed workspace at the end of each output, so there | |
| 21 | -# is always at least one target. | |
| 22 | 2 | set -euo pipefail |
| 23 | 3 | |
| 24 | 4 | action="${1:?usage: workspace_nav.sh focus|move|next|prev|move-next|move-prev|up|down|move-up|move-down [N]}" |
| 25 | 5 | |
| 26 | -# Vertical motion: niri stacks workspaces vertically, so "down" means the next | |
| 27 | -# window in the column when there is one, and otherwise the workspace below. | |
| 28 | -# Whether the in-column action did anything is decided by comparing the focused | |
| 29 | -# window's row before and after — cheaper and more robust than reimplementing | |
| 30 | -# niri's column arithmetic. | |
| 31 | 6 | if [ "$action" = "up" ] || [ "$action" = "down" ] || [ "$action" = "move-up" ] || [ "$action" = "move-down" ]; then |
| 32 | 7 | row_of_focused() { |
| 33 | 8 | niri msg -j windows | jq -r '.[] | select(.is_focused == true) | .layout.pos_in_scrolling_layout | "\(.[0]),\(.[1])"' |
| @@ -45,11 +20,9 @@ if [ "$action" = "up" ] || [ "$action" = "down" ] || [ "$action" = "move-up" ] | | ||
| 45 | 20 | after=$(row_of_focused) |
| 46 | 21 | |
| 47 | 22 | if [ -n "$before" ] && [ "$before" != "$after" ]; then |
| 48 | - exit 0 # the in-column move worked | |
| 23 | + exit 0 | |
| 49 | 24 | fi |
| 50 | 25 | |
| 51 | - # Nowhere to go inside the column: fall through to the workspace above/below, | |
| 52 | - # which is the plain-workspace navigation below. | |
| 53 | 26 | case "$action" in |
| 54 | 27 | up) action="prev" ;; |
| 55 | 28 | down) action="next" ;; |
| @@ -61,14 +34,12 @@ fi | ||
| 61 | 34 | ws_json=$(niri msg -j workspaces) |
| 62 | 35 | output=$(jq -r '.[] | select(.is_focused == true) | .output' <<<"$ws_json") |
| 63 | 36 | |
| 64 | -# Indices of the plain workspaces on this output, in list order. | |
| 65 | 37 | mapfile -t plain < <(jq -r --arg o "$output" ' |
| 66 | 38 | [ .[] | select(.output == $o and .name == null) ] | sort_by(.idx) | .[] | .idx |
| 67 | 39 | ' <<<"$ws_json") |
| 68 | 40 | |
| 69 | 41 | [ "${#plain[@]}" -gt 0 ] || exit 0 |
| 70 | 42 | |
| 71 | -# Where the currently focused workspace sits among them (-1 if it is a named one). | |
| 72 | 43 | current_idx=$(jq -r --arg o "$output" '.[] | select(.output == $o and .is_active == true) | .idx' <<<"$ws_json") |
| 73 | 44 | pos=-1 |
| 74 | 45 | for i in "${!plain[@]}"; do |
| @@ -89,7 +60,6 @@ focus | move) | ||
| 89 | 60 | target="${plain[$i]}" |
| 90 | 61 | ;; |
| 91 | 62 | next | move-next) |
| 92 | - # From a named workspace, "next" means the first plain one. | |
| 93 | 63 | if [ "$pos" -lt 0 ]; then |
| 94 | 64 | target="${plain[0]}" |
| 95 | 65 | else |
.config/scripts/niri/workspace_startup.shmodified+0 -11
| @@ -1,15 +1,4 @@ | ||
| 1 | 1 | #!/usr/bin/env bash |
| 2 | -# Put every output on a plain (unnamed) workspace at login. | |
| 3 | -# | |
| 4 | -# The app workspaces are declared in config.kdl, so niri creates them all on one | |
| 5 | -# output at startup and that output comes up showing "code" — the first declared | |
| 6 | -# one — instead of an empty workspace. Nothing else moves them until their | |
| 7 | -# Alt+<letter> bind runs, so the fix is a one-shot nudge: focus the first plain | |
| 8 | -# workspace on each output, then hand focus back to the output that had it | |
| 9 | -# (the one with `focus-at-startup`). | |
| 10 | -# | |
| 11 | -# focus-workspace takes an index into the FOCUSED output's list, hence the | |
| 12 | -# focus-monitor before each one — same reason workspace_nav.sh scopes by output. | |
| 13 | 2 | set -euo pipefail |
| 14 | 3 | |
| 15 | 4 | ws=$(niri msg -j workspaces) |
.config/scripts/system/power_menu.shmodified+0 -16
| @@ -1,9 +1,5 @@ | ||
| 1 | 1 | #!/bin/bash |
| 2 | 2 | |
| 3 | -# Power Management Menu | |
| 4 | -# Provides quick access to suspend, shutdown, reboot, and logout options | |
| 5 | - | |
| 6 | -# Create menu options | |
| 7 | 3 | menu=$(echo -e "🔴 Shutdown\n🔄 Reboot\n😴 Suspend\n🚪 Logout\n❌ Cancel" | rofi -dmenu -p "Power" -i) |
| 8 | 4 | |
| 9 | 5 | case "$menu" in |
| @@ -17,18 +13,6 @@ case "$menu" in | ||
| 17 | 13 | systemctl suspend |
| 18 | 14 | ;; |
| 19 | 15 | "🚪 Logout") |
| 20 | - # Shared by both compositors, so the exit command is picked at runtime. | |
| 21 | - # hyprctl is a no-op under niri, which is what silently broke logout. | |
| 22 | - # | |
| 23 | - # Hyprland is checked FIRST on purpose: niri pushes NIRI_SOCKET into the | |
| 24 | - # systemd --user manager environment and never unsets it on exit, so a | |
| 25 | - # niri -> Hyprland switch that kept the same user manager alive would | |
| 26 | - # leave a stale NIRI_SOCKET behind, and `niri msg` does not fall back to | |
| 27 | - # socket discovery — it just errors out. That would mirror this very bug | |
| 28 | - # onto Hyprland. The leak only goes that direction, so ordering fixes it. | |
| 29 | - # | |
| 30 | - # -s skips niri's "Press Enter to confirm" prompt, which has nowhere to | |
| 31 | - # be answered when the quit comes from a rofi menu. | |
| 32 | 16 | if [ -n "${HYPRLAND_INSTANCE_SIGNATURE:-}" ]; then |
| 33 | 17 | hyprctl dispatch exit |
| 34 | 18 | elif [ -n "${NIRI_SOCKET:-}" ]; then |