Port Hyprland setup to niri
Browse files at this commitd068d19b4f091e727f72f085bdeacac3d6dcd770Parent: 3ed98cc- feat
- port Hyprland setup to niri
9 changed files +1118 -0
- .config/mpv/mpv.conf +7 -0
- .config/niri/config.kdl +784 -0
- .config/scripts/niri/show_desktop.sh +69 -0
- .config/scripts/niri/toggle_monitors.sh +46 -0
- .config/scripts/niri/wallpaper_picker.sh +79 -0
- .config/scripts/niri/wallpaper_restore.sh +37 -0
- .config/scripts/niri/wallust_niri_colors.sh +49 -0
- .config/scripts/niri/workspace_app.sh +42 -0
- .config/wallust/wallust.toml +5 -0
.config/mpv/mpv.confmodified+7 -0
| @@ -1,3 +1,10 @@ | |||
| 1 | asc=no | 1 | asc=no |
| 2 | ao=alsa | 2 | ao=alsa |
| 3 | audio-device=alsa/pipewire | 3 | audio-device=alsa/pipewire |
| 4 | + | ||
| 5 | +# Let the compositor own the window size. Without this mpv keeps the window at | ||
| 6 | +# the video's aspect ratio, deriving height from whatever width it is given — | ||
| 7 | +# under niri that makes the window taller than its tile and pushes the OSC | ||
| 8 | +# controls off screen. Hyprland forced the size instead, which is why this only | ||
| 9 | +# appeared after the switch. Video is letterboxed inside the tile now. | ||
| 10 | +keepaspect-window=no | ||
.config/niri/config.kdladded+784 -0
| @@ -0,0 +1,784 @@ | |||
| 1 | +// This config is in the KDL format: https://kdl.dev | ||
| 2 | +// "/-" comments out the following node. | ||
| 3 | +// Check the wiki for a full description of the configuration: | ||
| 4 | +// https://niri-wm.github.io/niri/Configuration:-Introduction | ||
| 5 | + | ||
| 6 | +// Input device configuration. | ||
| 7 | +// Find the full list of options on the wiki: | ||
| 8 | +// https://niri-wm.github.io/niri/Configuration:-Input | ||
| 9 | +input { | ||
| 10 | + keyboard { | ||
| 11 | + xkb { | ||
| 12 | + // You can set rules, model, layout, variant and options. | ||
| 13 | + // For more information, see xkeyboard-config(7). | ||
| 14 | + | ||
| 15 | + // For example: | ||
| 16 | + // layout "us,ru" | ||
| 17 | + // options "grp:win_space_toggle,compose:ralt,ctrl:nocaps" | ||
| 18 | + | ||
| 19 | + // If this section is empty, niri will fetch xkb settings | ||
| 20 | + // from org.freedesktop.locale1. You can control these using | ||
| 21 | + // localectl set-x11-keymap. | ||
| 22 | + layout "tr"; | ||
| 23 | + } | ||
| 24 | + | ||
| 25 | + // Enable numlock on startup, omitting this setting disables it. | ||
| 26 | + numlock | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + // Next sections include libinput settings. | ||
| 30 | + // Omitting settings disables them, or leaves them at their default values. | ||
| 31 | + // All commented-out settings here are examples, not defaults. | ||
| 32 | + touchpad { | ||
| 33 | + // off | ||
| 34 | + tap | ||
| 35 | + // dwt | ||
| 36 | + // dwtp | ||
| 37 | + // drag false | ||
| 38 | + // drag-lock | ||
| 39 | + natural-scroll | ||
| 40 | + // accel-speed 0.2 | ||
| 41 | + // accel-profile "flat" | ||
| 42 | + // scroll-method "two-finger" | ||
| 43 | + // disabled-on-external-mouse | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + mouse { | ||
| 47 | + // off | ||
| 48 | + // natural-scroll | ||
| 49 | + // accel-speed 0.2 | ||
| 50 | + // Hyprland: input:accel_profile = flat (raw input, no acceleration curve) | ||
| 51 | + accel-profile "flat" | ||
| 52 | + // scroll-method "no-scroll" | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + trackpoint { | ||
| 56 | + // off | ||
| 57 | + // natural-scroll | ||
| 58 | + // accel-speed 0.2 | ||
| 59 | + // accel-profile "flat" | ||
| 60 | + // scroll-method "on-button-down" | ||
| 61 | + // scroll-button 273 | ||
| 62 | + // scroll-button-lock | ||
| 63 | + // middle-emulation | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + // Uncomment this to make the mouse warp to the center of newly focused windows. | ||
| 67 | + // warp-mouse-to-focus | ||
| 68 | + | ||
| 69 | + // Focus windows and outputs automatically when moving the mouse into them. | ||
| 70 | + // Setting max-scroll-amount="0%" makes it work only on windows already fully on screen. | ||
| 71 | + // focus-follows-mouse max-scroll-amount="0%" | ||
| 72 | +} | ||
| 73 | + | ||
| 74 | +// You can configure outputs by their name, which you can find | ||
| 75 | +// by running `niri msg outputs` while inside a niri instance. | ||
| 76 | +// The built-in laptop monitor is usually called "eDP-1". | ||
| 77 | +// Find more information on the wiki: | ||
| 78 | +// https://niri-wm.github.io/niri/Configuration:-Outputs | ||
| 79 | +// Remember to uncomment the node by removing "/-"! | ||
| 80 | +/-output "eDP-1" { | ||
| 81 | + // Uncomment this line to disable this output. | ||
| 82 | + // off | ||
| 83 | + | ||
| 84 | + // Resolution and, optionally, refresh rate of the output. | ||
| 85 | + // The format is "<width>x<height>" or "<width>x<height>@<refresh rate>". | ||
| 86 | + // If the refresh rate is omitted, niri will pick the highest refresh rate | ||
| 87 | + // for the resolution. | ||
| 88 | + // If the mode is omitted altogether or is invalid, niri will pick one automatically. | ||
| 89 | + // Run `niri msg outputs` while inside a niri instance to list all outputs and their modes. | ||
| 90 | + mode "1920x1080@120.030" | ||
| 91 | + | ||
| 92 | + // You can use integer or fractional scale, for example use 1.5 for 150% scale. | ||
| 93 | + scale 2 | ||
| 94 | + | ||
| 95 | + // Transform allows to rotate the output counter-clockwise, valid values are: | ||
| 96 | + // normal, 90, 180, 270, flipped, flipped-90, flipped-180 and flipped-270. | ||
| 97 | + transform "normal" | ||
| 98 | + | ||
| 99 | + // Position of the output in the global coordinate space. | ||
| 100 | + // This affects directional monitor actions like "focus-monitor-left", and cursor movement. | ||
| 101 | + // The cursor can only move between directly adjacent outputs. | ||
| 102 | + // Output scale and rotation has to be taken into account for positioning: | ||
| 103 | + // outputs are sized in logical, or scaled, pixels. | ||
| 104 | + // For example, a 3840×2160 output with scale 2.0 will have a logical size of 1920×1080, | ||
| 105 | + // so to put another output directly adjacent to it on the right, set its x to 1920. | ||
| 106 | + // If the position is unset or results in an overlap, the output is instead placed | ||
| 107 | + // automatically. | ||
| 108 | + position x=1280 y=0 | ||
| 109 | +} | ||
| 110 | + | ||
| 111 | +// Left / primary monitor (Xiaomi Mi Monitor). Hyprland had `bitdepth 10` here; | ||
| 112 | +// niri 26.04 has no bit-depth / hdr output key, so that is dropped. | ||
| 113 | +output "DP-1" { | ||
| 114 | + mode "2560x1440@180" | ||
| 115 | + scale 1 | ||
| 116 | + transform "normal" | ||
| 117 | + position x=0 y=0 | ||
| 118 | + focus-at-startup | ||
| 119 | +} | ||
| 120 | + | ||
| 121 | +// Right monitor. Exact mode string matters: it is 75.003, not 75. | ||
| 122 | +output "HDMI-A-1" { | ||
| 123 | + mode "1920x1080@75.003" | ||
| 124 | + scale 1 | ||
| 125 | + transform "normal" | ||
| 126 | + position x=2560 y=0 | ||
| 127 | +} | ||
| 128 | + | ||
| 129 | +// Settings that influence how windows are positioned and sized. | ||
| 130 | +// Find more information on the wiki: | ||
| 131 | +// https://niri-wm.github.io/niri/Configuration:-Layout | ||
| 132 | +layout { | ||
| 133 | + // Set gaps around windows in logical pixels. | ||
| 134 | + // Hyprland general:gaps_in = 3. The extra 7 to reach gaps_out = 10 is in struts. | ||
| 135 | + gaps 3 | ||
| 136 | + | ||
| 137 | + // When to center a column when changing focus, options are: | ||
| 138 | + // - "never", default behavior, focusing an off-screen column will keep at the left | ||
| 139 | + // or right edge of the screen. | ||
| 140 | + // - "always", the focused column will always be centered. | ||
| 141 | + // - "on-overflow", focusing a column will center it if it doesn't fit | ||
| 142 | + // together with the previously focused column. | ||
| 143 | + center-focused-column "never" | ||
| 144 | + | ||
| 145 | + // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between. | ||
| 146 | + preset-column-widths { | ||
| 147 | + // Proportion sets the width as a fraction of the output width, taking gaps into account. | ||
| 148 | + // For example, you can perfectly fit four windows sized "proportion 0.25" on an output. | ||
| 149 | + // The default preset widths are 1/3, 1/2 and 2/3 of the output. | ||
| 150 | + proportion 0.33333 | ||
| 151 | + proportion 0.5 | ||
| 152 | + proportion 0.66667 | ||
| 153 | + | ||
| 154 | + // Fixed sets the width in logical pixels exactly. | ||
| 155 | + // fixed 1920 | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + // You can also customize the heights that "switch-preset-window-height" (Mod+Ctrl+Shift+R) toggles between. | ||
| 159 | + // preset-window-heights { } | ||
| 160 | + | ||
| 161 | + // You can change the default width of the new windows. | ||
| 162 | + // Windows open taking the whole working area, closest thing to how dwindle | ||
| 163 | + // handed a new window all the free space. Gaps, struts and border still apply. | ||
| 164 | + default-column-width { proportion 1.0; } | ||
| 165 | + // If you leave the brackets empty, the windows themselves will decide their initial width. | ||
| 166 | + // default-column-width {} | ||
| 167 | + | ||
| 168 | + // By default focus ring and border are rendered as a solid background rectangle | ||
| 169 | + // behind windows. That is, they will show up through semitransparent windows. | ||
| 170 | + // This is because windows using client-side decorations can have an arbitrary shape. | ||
| 171 | + // | ||
| 172 | + // If you don't like that, you should uncomment `prefer-no-csd` below. | ||
| 173 | + // Niri will draw focus ring and border *around* windows that agree to omit their | ||
| 174 | + // client-side decorations. | ||
| 175 | + // | ||
| 176 | + // Alternatively, you can override it with a window rule called | ||
| 177 | + // `draw-border-with-background`. | ||
| 178 | + | ||
| 179 | + // You can change how the focus ring looks. | ||
| 180 | + focus-ring { | ||
| 181 | + // Off: Hyprland had only one border concept, and it is mapped to | ||
| 182 | + // the border block below. | ||
| 183 | + off | ||
| 184 | + | ||
| 185 | + // How many logical pixels the ring extends out from the windows. | ||
| 186 | + width 4 | ||
| 187 | + | ||
| 188 | + // Colors can be set in a variety of ways: | ||
| 189 | + // - CSS named colors: "red" | ||
| 190 | + // - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa" | ||
| 191 | + // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others. | ||
| 192 | + | ||
| 193 | + // Color of the ring on the active monitor. | ||
| 194 | + active-color "#7fc8ff" | ||
| 195 | + | ||
| 196 | + // Color of the ring on inactive monitors. | ||
| 197 | + // | ||
| 198 | + // The focus ring only draws around the active window, so the only place | ||
| 199 | + // where you can see its inactive-color is on other monitors. | ||
| 200 | + inactive-color "#505050" | ||
| 201 | + | ||
| 202 | + // You can also use gradients. They take precedence over solid colors. | ||
| 203 | + // Gradients are rendered the same as CSS linear-gradient(angle, from, to). | ||
| 204 | + // The angle is the same as in linear-gradient, and is optional, | ||
| 205 | + // defaulting to 180 (top-to-bottom gradient). | ||
| 206 | + // You can use any CSS linear-gradient tool on the web to set these up. | ||
| 207 | + // Changing the color space is also supported, check the wiki for more info. | ||
| 208 | + // | ||
| 209 | + // active-gradient from="#80c8ff" to="#c7ff7f" angle=45 | ||
| 210 | + | ||
| 211 | + // You can also color the gradient relative to the entire view | ||
| 212 | + // of the workspace, rather than relative to just the window itself. | ||
| 213 | + // To do that, set relative-to="workspace-view". | ||
| 214 | + // | ||
| 215 | + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" | ||
| 216 | + } | ||
| 217 | + | ||
| 218 | + // You can also add a border. It's similar to the focus ring, but always visible. | ||
| 219 | + border { | ||
| 220 | + // The settings are the same as for the focus ring. | ||
| 221 | + // If you enable the border, you probably want to disable the focus ring. | ||
| 222 | + | ||
| 223 | + // Hyprland general:border_size = 2 | ||
| 224 | + width 2 | ||
| 225 | + | ||
| 226 | + // Hyprland col.active_border was a 4-stop gradient | ||
| 227 | + // (FFAA93FF, 0053DFEE, 5500FFAA, FFAFFAAA). niri gradients take two | ||
| 228 | + // stops, so this keeps the first and last. | ||
| 229 | + // The line below is REWRITTEN IN PLACE by | ||
| 230 | + // ~/.config/scripts/niri/wallust_niri_colors.sh, which runs as a wallust | ||
| 231 | + // hook whenever the wallpaper changes. niri has no `include`, so the | ||
| 232 | + // colors cannot live in a separate generated file. Keep the marker | ||
| 233 | + // comment directly above it, and keep the whole thing on one line. | ||
| 234 | + // WALLUST-GRADIENT | ||
| 235 | + active-gradient from="#7B6753" to="#BC7857" angle=90 in="oklch longer hue" | ||
| 236 | + | ||
| 237 | + // Hyprland col.inactive_border = rgba(595959aa) | ||
| 238 | + inactive-color "#595959aa" | ||
| 239 | + | ||
| 240 | + // Color of the border around windows that request your attention. | ||
| 241 | + urgent-color "#9b0000" | ||
| 242 | + | ||
| 243 | + // Gradients can use a few different interpolation color spaces. | ||
| 244 | + // For example, this is a pastel rainbow gradient via in="oklch longer hue". | ||
| 245 | + // | ||
| 246 | + // active-gradient from="#e5989b" to="#ffb4a2" angle=45 relative-to="workspace-view" in="oklch longer hue" | ||
| 247 | + | ||
| 248 | + // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view" | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + // You can enable drop shadows for windows. | ||
| 252 | + shadow { | ||
| 253 | + // Uncomment the next line to enable shadows. | ||
| 254 | + // on | ||
| 255 | + | ||
| 256 | + // By default, the shadow draws only around its window, and not behind it. | ||
| 257 | + // Uncomment this setting to make the shadow draw behind its window. | ||
| 258 | + // | ||
| 259 | + // Note that niri has no way of knowing about the CSD window corner | ||
| 260 | + // radius. It has to assume that windows have square corners, leading to | ||
| 261 | + // shadow artifacts inside the CSD rounded corners. This setting fixes | ||
| 262 | + // those artifacts. | ||
| 263 | + // | ||
| 264 | + // However, instead you may want to set prefer-no-csd and/or | ||
| 265 | + // geometry-corner-radius. Then, niri will know the corner radius and | ||
| 266 | + // draw the shadow correctly, without having to draw it behind the | ||
| 267 | + // window. These will also remove client-side shadows if the window | ||
| 268 | + // draws any. | ||
| 269 | + // | ||
| 270 | + // draw-behind-window true | ||
| 271 | + | ||
| 272 | + // You can change how shadows look. The values below are in logical | ||
| 273 | + // pixels and match the CSS box-shadow properties. | ||
| 274 | + | ||
| 275 | + // Softness controls the shadow blur radius. | ||
| 276 | + softness 30 | ||
| 277 | + | ||
| 278 | + // Spread expands the shadow. | ||
| 279 | + spread 5 | ||
| 280 | + | ||
| 281 | + // Offset moves the shadow relative to the window. | ||
| 282 | + offset x=0 y=5 | ||
| 283 | + | ||
| 284 | + // You can also change the shadow color and opacity. | ||
| 285 | + color "#0007" | ||
| 286 | + } | ||
| 287 | + | ||
| 288 | + // Struts shrink the area occupied by windows, similarly to layer-shell panels. | ||
| 289 | + // You can think of them as a kind of outer gaps. They are set in logical pixels. | ||
| 290 | + // Left and right struts will cause the next window to the side to always be visible. | ||
| 291 | + // Top and bottom struts will simply add outer gaps in addition to the area occupied by | ||
| 292 | + // layer-shell panels and regular gaps. | ||
| 293 | + struts { | ||
| 294 | + // gaps_out(10) - gaps_in(3) = 7 extra space at the screen edges. | ||
| 295 | + left 7 | ||
| 296 | + right 7 | ||
| 297 | + top 7 | ||
| 298 | + bottom 7 | ||
| 299 | + } | ||
| 300 | +} | ||
| 301 | + | ||
| 302 | +// Add lines like this to spawn processes at startup. | ||
| 303 | +// Note that running niri as a session supports xdg-desktop-autostart, | ||
| 304 | +// which may be more convenient to use. | ||
| 305 | +// See the binds section below for more spawn examples. | ||
| 306 | + | ||
| 307 | +// Ported from Hyprland exec-once. The sleeps preserve the original start order | ||
| 308 | +// (tray applets after waybar has claimed the tray). | ||
| 309 | +environment { | ||
| 310 | + QT_QPA_PLATFORMTHEME "gtk3" | ||
| 311 | + XCURSOR_SIZE "24" | ||
| 312 | +} | ||
| 313 | + | ||
| 314 | +// polkit agent, nm-applet and blueman-applet are NOT listed here: niri runs | ||
| 315 | +// xdg-desktop-autostart.target, and /etc/xdg/autostart already starts them. | ||
| 316 | +// Hyprland ignored that target, which is why they needed exec-once there. | ||
| 317 | +// awww replaces hyprpaper (which needs Hyprland's IPC socket). The daemon has | ||
| 318 | +// no config file, so this also restores the last wallpaper picked. | ||
| 319 | +spawn-at-startup "bash" "/home/tahinli/.config/scripts/niri/wallpaper_restore.sh" | ||
| 320 | +spawn-at-startup "bash" "/home/tahinli/.config/scripts/shared/song_detail_writer.sh" | ||
| 321 | +spawn-at-startup "sh" "-c" "sleep 1 && waybar" | ||
| 322 | +spawn-at-startup "sh" "-c" "sleep 2 && kdeconnect-indicator" | ||
| 323 | +spawn-at-startup "sh" "-c" "sleep 3 && /opt/Mullvad\\ VPN/mullvad-vpn" | ||
| 324 | +spawn-at-startup "sh" "-c" "sleep 3 && swaync-client -dn" | ||
| 325 | +spawn-at-startup "sh" "-c" "sleep 3 && wl-paste --type text --watch cliphist store" | ||
| 326 | +spawn-at-startup "sh" "-c" "sleep 3 && wl-paste --type image --watch cliphist store" | ||
| 327 | +spawn-at-startup "sh" "-c" "sleep 4 && rfkill unblock bluetooth && bluetoothctl power on" | ||
| 328 | + | ||
| 329 | +// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup: | ||
| 330 | +// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell" | ||
| 331 | + | ||
| 332 | +hotkey-overlay { | ||
| 333 | + // Uncomment this line to disable the "Important Hotkeys" pop-up at startup. | ||
| 334 | + // skip-at-startup | ||
| 335 | +} | ||
| 336 | + | ||
| 337 | +// Uncomment this line to ask the clients to omit their client-side decorations if possible. | ||
| 338 | +// If the client will specifically ask for CSD, the request will be honored. | ||
| 339 | +// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners. | ||
| 340 | +// This option will also fix border/focus ring drawing behind some semitransparent windows. | ||
| 341 | +// After enabling or disabling this, you need to restart the apps for this to take effect. | ||
| 342 | +// prefer-no-csd | ||
| 343 | + | ||
| 344 | +// You can change the path where screenshots are saved. | ||
| 345 | +// A ~ at the front will be expanded to the home directory. | ||
| 346 | +// The path is formatted with strftime(3) to give you the screenshot date and time. | ||
| 347 | +screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png" | ||
| 348 | + | ||
| 349 | +// You can also set this to null to disable saving screenshots to disk. | ||
| 350 | +// screenshot-path null | ||
| 351 | + | ||
| 352 | +// Animation settings. | ||
| 353 | +// The wiki explains how to configure individual animations: | ||
| 354 | +// https://niri-wm.github.io/niri/Configuration:-Animations | ||
| 355 | +animations { | ||
| 356 | + // Kept on deliberately: Hyprland had animations off, niri's are kept. | ||
| 357 | + // off | ||
| 358 | + | ||
| 359 | + // Slow down all animations by this factor. Values below 1 speed them up instead. | ||
| 360 | + // slowdown 3.0 | ||
| 361 | +} | ||
| 362 | + | ||
| 363 | +// Window rules let you adjust behavior for individual windows. | ||
| 364 | +// Find more information on the wiki: | ||
| 365 | +// https://niri-wm.github.io/niri/Configuration:-Window-Rules | ||
| 366 | + | ||
| 367 | +window-rule { | ||
| 368 | + // This regular expression is intentionally made as specific as possible, | ||
| 369 | + // since this is the default config, and we want no false positives. | ||
| 370 | + // You can get away with just app-id="wezterm" if you want. | ||
| 371 | + match app-id=r#"^org\.wezfurlong\.wezterm$"# | ||
| 372 | + | ||
| 373 | + // The stock config sets an empty `default-column-width {}` here as a | ||
| 374 | + // workaround for a WezTerm initial-configure bug. That means "let the | ||
| 375 | + // window pick its own width", which overrode the global | ||
| 376 | + // `default-column-width { proportion 1.0; }` and is why WezTerm alone | ||
| 377 | + // did not open full width. Removed; re-add it if WezTerm ever opens | ||
| 378 | + // at a wrong size on the first frame. | ||
| 379 | + | ||
| 380 | + // Hyprland: windowrule = match:class .*wezterm.*, opacity 0.8 | ||
| 381 | + opacity 0.8 | ||
| 382 | + | ||
| 383 | + // Without this, niri paints the border gradient as the window background, | ||
| 384 | + // which shines through the 0.8 opacity and makes the whole terminal a | ||
| 385 | + // rainbow. wezterm draws its own background, so it does not need niri's. | ||
| 386 | + draw-border-with-background false | ||
| 387 | +} | ||
| 388 | + | ||
| 389 | +// Open the Firefox picture-in-picture player as floating by default. | ||
| 390 | +window-rule { | ||
| 391 | + // This app-id regular expression will work for both: | ||
| 392 | + // - host Firefox (app-id is "firefox") | ||
| 393 | + // - Flatpak Firefox (app-id is "org.mozilla.firefox") | ||
| 394 | + match app-id=r#"firefox$"# title="^Picture-in-Picture$" | ||
| 395 | + open-floating true | ||
| 396 | +} | ||
| 397 | + | ||
| 398 | +// Example: block out two password managers from screen capture. | ||
| 399 | +// (This example rule is commented out with a "/-" in front.) | ||
| 400 | +/-window-rule { | ||
| 401 | + match app-id=r#"^org\.keepassxc\.KeePassXC$"# | ||
| 402 | + match app-id=r#"^org\.gnome\.World\.Secrets$"# | ||
| 403 | + | ||
| 404 | + block-out-from "screen-capture" | ||
| 405 | + | ||
| 406 | + // Use this instead if you want them visible on third-party screenshot tools. | ||
| 407 | + // block-out-from "screencast" | ||
| 408 | +} | ||
| 409 | + | ||
| 410 | +// Example: enable rounded corners for all windows. | ||
| 411 | +// (This example rule is commented out with a "/-" in front.) | ||
| 412 | +/-window-rule { | ||
| 413 | + geometry-corner-radius 12 | ||
| 414 | + clip-to-geometry true | ||
| 415 | +} | ||
| 416 | + | ||
| 417 | +// Named workspaces, the equivalent of the Hyprland 100/200-206 app workspaces. | ||
| 418 | +// They are deliberately not pinned to an output (no open-on-output), so they | ||
| 419 | +// follow you to whichever monitor is focused. Declaration order is the order | ||
| 420 | +// they appear in, after the numbered ones. | ||
| 421 | +workspace "code" | ||
| 422 | +workspace "github" | ||
| 423 | +workspace "whatsapp" | ||
| 424 | +workspace "discord" | ||
| 425 | +workspace "deezer" | ||
| 426 | +workspace "youtube" | ||
| 427 | +workspace "mail" | ||
| 428 | +workspace "signal" | ||
| 429 | + | ||
| 430 | +binds { | ||
| 431 | + // Keys consist of modifiers separated by + signs, followed by an XKB key name | ||
| 432 | + // in the end. To find an XKB name for a particular key, you may use a program | ||
| 433 | + // like wev. | ||
| 434 | + // | ||
| 435 | + // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt | ||
| 436 | + // when running as a winit window. | ||
| 437 | + // | ||
| 438 | + // Most actions that you can bind here can also be invoked programmatically with | ||
| 439 | + // `niri msg action do-something`. | ||
| 440 | + | ||
| 441 | + // Mod-Shift-/, which is usually the same as Mod-?, | ||
| 442 | + // shows a list of important hotkeys. | ||
| 443 | + Mod+Shift+Slash { show-hotkey-overlay; } | ||
| 444 | + | ||
| 445 | + // Suggested binds for running programs: terminal, app launcher, screen locker. | ||
| 446 | + // Mod+T hotkey-overlay-title="Open a Terminal: alacritty" { spawn "alacritty"; } | ||
| 447 | + // Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; } | ||
| 448 | + // hyprlock speaks ext-session-lock-v1 and has no Hyprland IPC dependency | ||
| 449 | + // (no HYPRLAND_INSTANCE_SIGNATURE in the binary), so it works here. | ||
| 450 | + // swaylock 1.8.5 is installed as a fallback if it misbehaves. | ||
| 451 | + Super+L hotkey-overlay-title="Lock the Screen: hyprlock" { spawn "hyprlock"; } | ||
| 452 | + Alt+T hotkey-overlay-title="Run a terminal: wezterm" { spawn-sh "wezterm start --always-new-process"; } | ||
| 453 | + Alt+Q hotkey-overlay-title="File manager: nautilus" { spawn-sh "nautilus --new-window"; } | ||
| 454 | + | ||
| 455 | + // rofi: F-key and number-row variants, same as the Hyprland binds. | ||
| 456 | + Alt+F1 hotkey-overlay-title="active_menu" { spawn-sh "rofi -show"; } | ||
| 457 | + Alt+1 hotkey-overlay-title="active_menu" { spawn-sh "rofi -show"; } | ||
| 458 | + Alt+F2 hotkey-overlay-title="menu" { spawn-sh "rofi -show drun -show-icons"; } | ||
| 459 | + Alt+2 hotkey-overlay-title="menu" { spawn-sh "rofi -show drun -show-icons"; } | ||
| 460 | + Shift+Alt+F2 hotkey-overlay-title="menu_unsafe" { spawn-sh "mullvad-exclude rofi -show drun -show-icons"; } | ||
| 461 | + Shift+Alt+2 hotkey-overlay-title="menu_unsafe" { spawn-sh "mullvad-exclude rofi -show drun -show-icons"; } | ||
| 462 | + Alt+F3 hotkey-overlay-title="clipboard" { spawn-sh "cliphist list | rofi -dmenu -show-icons -i | cliphist decode | wl-copy"; } | ||
| 463 | + Alt+3 hotkey-overlay-title="clipboard" { spawn-sh "cliphist list | rofi -dmenu -show-icons -i | cliphist decode | wl-copy"; } | ||
| 464 | + | ||
| 465 | + Alt+F hotkey-overlay-title="browser" { spawn-sh "flatpak run io.github.ungoogled_software.ungoogled_chromium --enable-features=MiddleClickAutoscroll"; } | ||
| 466 | + Shift+Alt+F hotkey-overlay-title="browser_unsafe" { spawn-sh "mullvad-exclude flatpak run org.chromium.Chromium --incognito --enable-features=MiddleClickAutoscroll,AllowLegacyMV2Extensions --disable-features=ExtensionManifestV2Unsupported,ExtensionManifestV2Disabled,ExtensionsManifestV3Only"; } | ||
| 467 | + | ||
| 468 | + // --- app workspaces (Hyprland on-created-empty emulation) --- | ||
| 469 | + // The helper focuses the workspace and launches the app only when the | ||
| 470 | + // workspace is empty. See ~/.config/scripts/niri/workspace_app.sh. | ||
| 471 | + Alt+C hotkey-overlay-title="Workspace: code" { spawn "/home/tahinli/.config/scripts/niri/workspace_app.sh" "code" "zed"; } | ||
| 472 | + Alt+G hotkey-overlay-title="Workspace: github" { spawn-sh "~/.config/scripts/niri/workspace_app.sh github flatpak run io.github.ungoogled_software.ungoogled_chromium --no-first-run --app=https://github.com/ --class=chrome-github.com__-Default --name=chrome-github.com__-Default --user-data-dir=/home/tahinli/.var/app/io.github.ungoogled_software.ungoogled_chromium/data/web-app-hub/profiles/FCF18Wmt"; } | ||
| 473 | + Alt+W hotkey-overlay-title="Workspace: whatsapp" { spawn-sh "~/.config/scripts/niri/workspace_app.sh whatsapp mullvad-exclude flatpak run io.github.ungoogled_software.ungoogled_chromium --no-first-run --app=https://web.whatsapp.com/ --class=chrome-web.whatsapp.com__-Default --name=chrome-web.whatsapp.com__-Default --user-data-dir=/home/tahinli/.var/app/io.github.ungoogled_software.ungoogled_chromium/data/web-app-hub/profiles/aW2IMaZ8"; } | ||
| 474 | + Alt+D hotkey-overlay-title="Workspace: discord" { spawn-sh "~/.config/scripts/niri/workspace_app.sh discord flatpak run dev.vencord.Vesktop"; } | ||
| 475 | + Alt+S hotkey-overlay-title="Workspace: deezer" { spawn-sh "~/.config/scripts/niri/workspace_app.sh deezer mullvad-exclude flatpak run io.github.ungoogled_software.ungoogled_chromium --no-first-run --app=https://deezer.com/ --class=chrome-deezer.com__-Default --name=chrome-deezer.com__-Default --user-data-dir=/home/tahinli/.var/app/io.github.ungoogled_software.ungoogled_chromium/data/web-app-hub/profiles/VjW8vTQ3"; } | ||
| 476 | + Alt+Y hotkey-overlay-title="Workspace: youtube" { spawn-sh "~/.config/scripts/niri/workspace_app.sh youtube mullvad-exclude flatpak run io.freetubeapp.FreeTube"; } | ||
| 477 | + Alt+P hotkey-overlay-title="Workspace: mail" { spawn-sh "~/.config/scripts/niri/workspace_app.sh mail flatpak run io.github.ungoogled_software.ungoogled_chromium --no-first-run --app=https://mail.proton.me/ --class=chrome-mail.proton.me__-Default --name=chrome-mail.proton.me__-Default --user-data-dir=/home/tahinli/.var/app/io.github.ungoogled_software.ungoogled_chromium/data/web-app-hub/profiles/eIpzVtL8"; } | ||
| 478 | + Alt+N hotkey-overlay-title="Workspace: signal" { spawn-sh "~/.config/scripts/niri/workspace_app.sh signal flatpak run org.signal.Signal"; } | ||
| 479 | + | ||
| 480 | + Mod+Shift+C { move-column-to-workspace "code"; } | ||
| 481 | + Mod+Shift+G { move-column-to-workspace "github"; } | ||
| 482 | + Mod+Shift+W { move-column-to-workspace "whatsapp"; } | ||
| 483 | + Mod+Shift+D { move-column-to-workspace "discord"; } | ||
| 484 | + Mod+Shift+S { move-column-to-workspace "deezer"; } | ||
| 485 | + Mod+Shift+Y { move-column-to-workspace "youtube"; } | ||
| 486 | + Mod+Shift+P { move-column-to-workspace "mail"; } | ||
| 487 | + Mod+Shift+N { move-column-to-workspace "signal"; } | ||
| 488 | + | ||
| 489 | + Mod+D hotkey-overlay-title="Show desktop" { spawn-sh "~/.config/scripts/niri/show_desktop.sh"; } | ||
| 490 | + Mod+H hotkey-overlay-title="Toggle waybar" { spawn-sh "pkill -SIGUSR1 waybar"; } | ||
| 491 | + Mod+Escape hotkey-overlay-title="Power menu" { spawn-sh "bash ~/.config/scripts/system/power_menu.sh"; } | ||
| 492 | + | ||
| 493 | + // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc. | ||
| 494 | + // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`. | ||
| 495 | + // For example, this is a standard bind to toggle the screen reader (orca). | ||
| 496 | + Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; } | ||
| 497 | + | ||
| 498 | + // Example volume keys mappings for PipeWire & WirePlumber. | ||
| 499 | + // The allow-when-locked=true property makes them work even when the session is locked. | ||
| 500 | + // Using spawn-sh allows to pass multiple arguments together with the command. | ||
| 501 | + // "-l 1.0" limits the volume to 100%. | ||
| 502 | + XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; } | ||
| 503 | + XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; } | ||
| 504 | + XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; } | ||
| 505 | + XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; } | ||
| 506 | + | ||
| 507 | + // Example media keys mapping using playerctl. | ||
| 508 | + // This will work with any MPRIS-enabled media player. | ||
| 509 | + XF86AudioPlay allow-when-locked=true { spawn-sh "playerctl play-pause"; } | ||
| 510 | + XF86AudioStop allow-when-locked=true { spawn-sh "playerctl stop"; } | ||
| 511 | + XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; } | ||
| 512 | + XF86AudioNext allow-when-locked=true { spawn-sh "playerctl next"; } | ||
| 513 | + | ||
| 514 | + // Example brightness key mappings for brightnessctl. | ||
| 515 | + // You can use regular spawn with multiple arguments too (to avoid going through "sh"), | ||
| 516 | + // but you need to manually put each argument in separate "" quotes. | ||
| 517 | + XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; } | ||
| 518 | + XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; } | ||
| 519 | + | ||
| 520 | + // Open/close the Overview: a zoomed-out view of workspaces and windows. | ||
| 521 | + // You can also move the mouse into the top-left hot corner, | ||
| 522 | + // or do a four-finger swipe up on a touchpad. | ||
| 523 | + Mod+O repeat=false { toggle-overview; } | ||
| 524 | + | ||
| 525 | + Alt+4 repeat=false { close-window; } | ||
| 526 | + Alt+F4 repeat=false { close-window; } | ||
| 527 | + | ||
| 528 | + Mod+Left { focus-column-left; } | ||
| 529 | + Mod+Down { focus-window-down; } | ||
| 530 | + Mod+Up { focus-window-up; } | ||
| 531 | + Mod+Right { focus-column-right; } | ||
| 532 | + // The vim-style nav binds are gone: Mod+H is the waybar toggle and Mod+L | ||
| 533 | + // is the screen locker, matching the Hyprland binds. Arrows still navigate. | ||
| 534 | + Mod+J { focus-window-down; } | ||
| 535 | + Mod+K { focus-window-up; } | ||
| 536 | + | ||
| 537 | + Mod+Ctrl+Left { move-column-left; } | ||
| 538 | + Mod+Ctrl+Down { move-window-down; } | ||
| 539 | + Mod+Ctrl+Up { move-window-up; } | ||
| 540 | + Mod+Ctrl+Right { move-column-right; } | ||
| 541 | + Mod+Ctrl+H { move-column-left; } | ||
| 542 | + Mod+Ctrl+J { move-window-down; } | ||
| 543 | + Mod+Ctrl+K { move-window-up; } | ||
| 544 | + Mod+Ctrl+L { move-column-right; } | ||
| 545 | + | ||
| 546 | + // Alternative commands that move across workspaces when reaching | ||
| 547 | + // the first or last window in a column. | ||
| 548 | + // Mod+J { focus-window-or-workspace-down; } | ||
| 549 | + // Mod+K { focus-window-or-workspace-up; } | ||
| 550 | + // Mod+Ctrl+J { move-window-down-or-to-workspace-down; } | ||
| 551 | + // Mod+Ctrl+K { move-window-up-or-to-workspace-up; } | ||
| 552 | + | ||
| 553 | + Mod+Home { focus-column-first; } | ||
| 554 | + Mod+End { focus-column-last; } | ||
| 555 | + Mod+Ctrl+Home { move-column-to-first; } | ||
| 556 | + Mod+Ctrl+End { move-column-to-last; } | ||
| 557 | + | ||
| 558 | + // Monitors are addressed by name, not direction, exactly like the Hyprland | ||
| 559 | + // $monitor_left / $monitor_right binds. The directional focus-monitor-* | ||
| 560 | + // and move-column-to-monitor-* binds are dropped as redundant. | ||
| 561 | + Mod+Q { focus-monitor "DP-1"; } | ||
| 562 | + Mod+E { focus-monitor "HDMI-A-1"; } | ||
| 563 | + Mod+Shift+Q { move-column-to-monitor "DP-1"; } | ||
| 564 | + Mod+Shift+E { move-column-to-monitor "HDMI-A-1"; } | ||
| 565 | + | ||
| 566 | + // Alternatively, there are commands to move just a single window: | ||
| 567 | + // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; } | ||
| 568 | + // ... | ||
| 569 | + | ||
| 570 | + // And you can also move a whole workspace to another monitor: | ||
| 571 | + // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; } | ||
| 572 | + // ... | ||
| 573 | + | ||
| 574 | + Mod+Page_Down { focus-workspace-down; } | ||
| 575 | + Mod+Page_Up { focus-workspace-up; } | ||
| 576 | + Mod+U { focus-workspace-down; } | ||
| 577 | + Mod+I { focus-workspace-up; } | ||
| 578 | + Mod+Ctrl+Page_Down { move-column-to-workspace-down; } | ||
| 579 | + Mod+Ctrl+Page_Up { move-column-to-workspace-up; } | ||
| 580 | + Mod+Ctrl+U { move-column-to-workspace-down; } | ||
| 581 | + Mod+Ctrl+I { move-column-to-workspace-up; } | ||
| 582 | + | ||
| 583 | + // Alternatively, there are commands to move just a single window: | ||
| 584 | + // Mod+Ctrl+Page_Down { move-window-to-workspace-down; } | ||
| 585 | + // ... | ||
| 586 | + | ||
| 587 | + Mod+Shift+Page_Down { move-workspace-down; } | ||
| 588 | + Mod+Shift+Page_Up { move-workspace-up; } | ||
| 589 | + Mod+Shift+U { move-workspace-down; } | ||
| 590 | + Mod+Shift+I { move-workspace-up; } | ||
| 591 | + | ||
| 592 | + // You can bind mouse wheel scroll ticks using the following syntax. | ||
| 593 | + // These binds will change direction based on the natural-scroll setting. | ||
| 594 | + // | ||
| 595 | + // To avoid scrolling through workspaces really fast, you can use | ||
| 596 | + // the cooldown-ms property. The bind will be rate-limited to this value. | ||
| 597 | + // You can set a cooldown on any bind, but it's most useful for the wheel. | ||
| 598 | + Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; } | ||
| 599 | + Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; } | ||
| 600 | + Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; } | ||
| 601 | + Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; } | ||
| 602 | + | ||
| 603 | + Mod+WheelScrollRight { focus-column-right; } | ||
| 604 | + Mod+WheelScrollLeft { focus-column-left; } | ||
| 605 | + Mod+Ctrl+WheelScrollRight { move-column-right; } | ||
| 606 | + Mod+Ctrl+WheelScrollLeft { move-column-left; } | ||
| 607 | + | ||
| 608 | + // Usually scrolling up and down with Shift in applications results in | ||
| 609 | + // horizontal scrolling; these binds replicate that. | ||
| 610 | + Mod+Shift+WheelScrollDown { focus-column-right; } | ||
| 611 | + Mod+Shift+WheelScrollUp { focus-column-left; } | ||
| 612 | + Mod+Ctrl+Shift+WheelScrollDown { move-column-right; } | ||
| 613 | + Mod+Ctrl+Shift+WheelScrollUp { move-column-left; } | ||
| 614 | + | ||
| 615 | + // Similarly, you can bind touchpad scroll "ticks". | ||
| 616 | + // Touchpad scrolling is continuous, so for these binds it is split into | ||
| 617 | + // discrete intervals. | ||
| 618 | + // These binds are also affected by touchpad's natural-scroll, so these | ||
| 619 | + // example binds are "inverted", since we have natural-scroll enabled for | ||
| 620 | + // touchpads by default. | ||
| 621 | + // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; } | ||
| 622 | + // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; } | ||
| 623 | + | ||
| 624 | + // You can refer to workspaces by index. However, keep in mind that | ||
| 625 | + // niri is a dynamic workspace system, so these commands are kind of | ||
| 626 | + // "best effort". Trying to refer to a workspace index bigger than | ||
| 627 | + // the current workspace count will instead refer to the bottommost | ||
| 628 | + // (empty) workspace. | ||
| 629 | + // | ||
| 630 | + // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on | ||
| 631 | + // will all refer to the 3rd workspace. | ||
| 632 | + Mod+1 { focus-workspace 1; } | ||
| 633 | + Mod+2 { focus-workspace 2; } | ||
| 634 | + Mod+3 { focus-workspace 3; } | ||
| 635 | + Mod+4 { focus-workspace 4; } | ||
| 636 | + Mod+5 { focus-workspace 5; } | ||
| 637 | + Mod+6 { focus-workspace 6; } | ||
| 638 | + Mod+7 { focus-workspace 7; } | ||
| 639 | + Mod+8 { focus-workspace 8; } | ||
| 640 | + Mod+9 { focus-workspace 9; } | ||
| 641 | + Mod+0 { focus-workspace 10; } | ||
| 642 | + | ||
| 643 | + // Hyprland used SUPER+SHIFT+N to send a window to workspace N; the stock | ||
| 644 | + // niri Mod+Ctrl+N binds below do the same thing and are kept as well. | ||
| 645 | + Mod+Shift+1 { move-column-to-workspace 1; } | ||
| 646 | + Mod+Shift+2 { move-column-to-workspace 2; } | ||
| 647 | + Mod+Shift+3 { move-column-to-workspace 3; } | ||
| 648 | + Mod+Shift+4 { move-column-to-workspace 4; } | ||
| 649 | + Mod+Shift+5 { move-column-to-workspace 5; } | ||
| 650 | + Mod+Shift+6 { move-column-to-workspace 6; } | ||
| 651 | + Mod+Shift+7 { move-column-to-workspace 7; } | ||
| 652 | + Mod+Shift+8 { move-column-to-workspace 8; } | ||
| 653 | + Mod+Shift+9 { move-column-to-workspace 9; } | ||
| 654 | + Mod+Shift+0 { move-column-to-workspace 10; } | ||
| 655 | + | ||
| 656 | + Mod+Ctrl+1 { move-column-to-workspace 1; } | ||
| 657 | + Mod+Ctrl+2 { move-column-to-workspace 2; } | ||
| 658 | + Mod+Ctrl+3 { move-column-to-workspace 3; } | ||
| 659 | + Mod+Ctrl+4 { move-column-to-workspace 4; } | ||
| 660 | + Mod+Ctrl+5 { move-column-to-workspace 5; } | ||
| 661 | + Mod+Ctrl+6 { move-column-to-workspace 6; } | ||
| 662 | + Mod+Ctrl+7 { move-column-to-workspace 7; } | ||
| 663 | + Mod+Ctrl+8 { move-column-to-workspace 8; } | ||
| 664 | + Mod+Ctrl+9 { move-column-to-workspace 9; } | ||
| 665 | + | ||
| 666 | + // Alternatively, there are commands to move just a single window: | ||
| 667 | + // Mod+Ctrl+1 { move-window-to-workspace 1; } | ||
| 668 | + | ||
| 669 | + // Switches focus between the current and the previous workspace. | ||
| 670 | + // Mod+Tab { focus-workspace-previous; } | ||
| 671 | + | ||
| 672 | + // The following binds move the focused window in and out of a column. | ||
| 673 | + // If the window is alone, they will consume it into the nearby column to the side. | ||
| 674 | + // If the window is already in a column, they will expel it out. | ||
| 675 | + Mod+BracketLeft { consume-or-expel-window-left; } | ||
| 676 | + Mod+BracketRight { consume-or-expel-window-right; } | ||
| 677 | + | ||
| 678 | + // Consume one window from the right to the bottom of the focused column. | ||
| 679 | + Mod+Comma { consume-window-into-column; } | ||
| 680 | + // Expel the bottom window from the focused column to the right. | ||
| 681 | + Mod+Period { expel-window-from-column; } | ||
| 682 | + | ||
| 683 | + // Cycle through widths set in preset-column-widths. | ||
| 684 | + Mod+R { switch-preset-column-width; } | ||
| 685 | + // Cycling through the presets in reverse order is also possible. | ||
| 686 | + Mod+Shift+R { switch-preset-column-width-back; } | ||
| 687 | + | ||
| 688 | + Mod+Ctrl+Shift+R { switch-preset-window-height; } | ||
| 689 | + Mod+Ctrl+R { reset-window-height; } | ||
| 690 | + | ||
| 691 | + // Hyprland togglefloating lived on Super+F, so maximize moves to Mod+M below. | ||
| 692 | + Mod+F { toggle-window-floating; } | ||
| 693 | + Mod+Shift+F { fullscreen-window; } | ||
| 694 | + | ||
| 695 | + // While maximize-column leaves gaps and borders around the window, | ||
| 696 | + // maximize-window-to-edges doesn't: the window expands to the edges of the screen. | ||
| 697 | + // This bind corresponds to normal window maximizing, | ||
| 698 | + // e.g. by double-clicking on the titlebar. | ||
| 699 | + // Hyprland kept the monitor menu on Super+M, so maximize sits on Mod+Ctrl+M. | ||
| 700 | + Mod+M { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh"; } | ||
| 701 | + Mod+Shift+M { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh on"; } | ||
| 702 | + Mod+Ctrl+M { maximize-column; } | ||
| 703 | + | ||
| 704 | + // Expand the focused column to space not taken up by other fully visible columns. | ||
| 705 | + // Makes the column "fill the rest of the space". | ||
| 706 | + Mod+Ctrl+F { expand-column-to-available-width; } | ||
| 707 | + | ||
| 708 | + Mod+C { center-column; } | ||
| 709 | + | ||
| 710 | + // Center all fully visible columns on screen. | ||
| 711 | + Mod+Ctrl+C { center-visible-columns; } | ||
| 712 | + | ||
| 713 | + // Finer width adjustments. | ||
| 714 | + // This command can also: | ||
| 715 | + // * set width in pixels: "1000" | ||
| 716 | + // * adjust width in pixels: "-5" or "+5" | ||
| 717 | + // * set width as a percentage of screen width: "25%" | ||
| 718 | + // * adjust width as a percentage of screen width: "-10%" or "+10%" | ||
| 719 | + // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0, | ||
| 720 | + // set-column-width "100" will make the column occupy 200 physical screen pixels. | ||
| 721 | + Mod+Minus { set-column-width "-10%"; } | ||
| 722 | + Mod+Equal { set-column-width "+10%"; } | ||
| 723 | + | ||
| 724 | + // Finer height adjustments when in column with other windows. | ||
| 725 | + Mod+Shift+Minus { set-window-height "-10%"; } | ||
| 726 | + Mod+Shift+Equal { set-window-height "+10%"; } | ||
| 727 | + | ||
| 728 | + // Hyprland resizeactive 30 0 / 0 30, in logical pixels. | ||
| 729 | + Mod+Shift+Right { set-column-width "+30"; } | ||
| 730 | + Mod+Shift+Left { set-column-width "-30"; } | ||
| 731 | + Mod+Shift+Up { set-window-height "-30"; } | ||
| 732 | + Mod+Shift+Down { set-window-height "+30"; } | ||
| 733 | + | ||
| 734 | + // Move the focused window between the floating and the tiling layout. | ||
| 735 | + // Mod+V is dropped: Mod+F already toggles floating. | ||
| 736 | + Mod+Shift+V { switch-focus-between-floating-and-tiling; } | ||
| 737 | + | ||
| 738 | + // Hyprland cyclenext / workspace previous_per_monitor. | ||
| 739 | + Mod+Tab { focus-window-previous; } | ||
| 740 | + Alt+Tab { focus-workspace-previous; } | ||
| 741 | + | ||
| 742 | + // Toggle tabbed column display mode. | ||
| 743 | + // Windows in this column will appear as vertical tabs, | ||
| 744 | + // rather than stacked on top of each other. | ||
| 745 | + // Hyprland had the wallpaper picker on Super+W; tabbed display moves aside. | ||
| 746 | + Mod+W hotkey-overlay-title="Wallpaper picker" { spawn-sh "~/.config/scripts/niri/wallpaper_picker.sh"; } | ||
| 747 | + Mod+Ctrl+W { toggle-column-tabbed-display; } | ||
| 748 | + | ||
| 749 | + // Actions to switch layouts. | ||
| 750 | + // Note: if you uncomment these, make sure you do NOT have | ||
| 751 | + // a matching layout switch hotkey configured in xkb options above. | ||
| 752 | + // Having both at once on the same hotkey will break the switching, | ||
| 753 | + // since it will switch twice upon pressing the hotkey (once by xkb, once by niri). | ||
| 754 | + // Mod+Space { switch-layout "next"; } | ||
| 755 | + // Mod+Shift+Space { switch-layout "prev"; } | ||
| 756 | + | ||
| 757 | + // grim/slurp instead of niri's built-in screenshot actions: the Hyprland | ||
| 758 | + // bind captured ALL outputs into one image, while screenshot-screen only | ||
| 759 | + // captures the focused one. | ||
| 760 | + Print { spawn-sh "grim -t png - | tee \"$HOME/Pictures/Screenshots/$(date '+%y%m%d_%H-%M-%S').png\" | wl-copy -t image/png"; } | ||
| 761 | + Shift+Print { spawn-sh "grim -t png -g \"$(slurp)\" - | wl-copy -t image/png"; } | ||
| 762 | + Ctrl+Print { screenshot-screen; } | ||
| 763 | + Alt+Print { screenshot-window; } | ||
| 764 | + | ||
| 765 | + // Applications such as remote-desktop clients and software KVM switches may | ||
| 766 | + // request that niri stops processing the keyboard shortcuts defined here | ||
| 767 | + // so they may, for example, forward the key presses as-is to a remote machine. | ||
| 768 | + // It's a good idea to bind an escape hatch to toggle the inhibitor, | ||
| 769 | + // so a buggy application can't hold your session hostage. | ||
| 770 | + // | ||
| 771 | + // The allow-inhibiting=false property can be applied to other binds as well, | ||
| 772 | + // which ensures niri always processes them, even when an inhibitor is active. | ||
| 773 | + // Mod+Escape is the power menu (see above), so the shortcut inhibitor | ||
| 774 | + // escape hatch lives on Mod+Shift+Escape instead. | ||
| 775 | + Mod+Shift+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; } | ||
| 776 | + | ||
| 777 | + // Exit is only Super+Alt+F4, same as Hyprland. The stock Mod+Shift+E and | ||
| 778 | + // Ctrl+Alt+Delete quit binds are removed on purpose. | ||
| 779 | + Mod+Alt+F4 { quit; } | ||
| 780 | + | ||
| 781 | + // Powers off the monitors. To turn them back on, do any input like | ||
| 782 | + // moving the mouse or pressing any other key. | ||
| 783 | + // No power-off-monitors bind: the monitor menu on Mod+M covers it. | ||
| 784 | +} | ||
.config/scripts/niri/show_desktop.shadded+69 -0
| @@ -0,0 +1,69 @@ | |||
| 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 | +set -euo pipefail | ||
| 12 | + | ||
| 13 | +STATE_FILE="/tmp/niri_show_desktop" | ||
| 14 | + | ||
| 15 | +ws_json=$(niri msg -j workspaces) | ||
| 16 | + | ||
| 17 | +# Reference used to focus a workspace again later: prefer the name, else index. | ||
| 18 | +ref_of() { # $1 = jq object | ||
| 19 | + jq -r 'if .name != null then .name else (.idx | tostring) end' <<<"$1" | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +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 | + while IFS=$'\t' read -r out ref; do | ||
| 26 | + [ -n "$out" ] || continue | ||
| 27 | + niri msg action focus-monitor "$out" >/dev/null | ||
| 28 | + niri msg action focus-workspace "$ref" >/dev/null | ||
| 29 | + done < <(grep -v '^FOCUSED' "$STATE_FILE") | ||
| 30 | + | ||
| 31 | + focused_out=$(grep '^FOCUSED' "$STATE_FILE" | cut -f2) | ||
| 32 | + [ -n "$focused_out" ] && niri msg action focus-monitor "$focused_out" >/dev/null | ||
| 33 | + | ||
| 34 | + rm -f "$STATE_FILE" | ||
| 35 | +else | ||
| 36 | + win_json=$(niri msg -j windows) | ||
| 37 | + focused_out=$(jq -r '.[] | select(.is_focused == true) | .output' <<<"$ws_json") | ||
| 38 | + | ||
| 39 | + : > "$STATE_FILE" | ||
| 40 | + printf 'FOCUSED\t%s\n' "$focused_out" >> "$STATE_FILE" | ||
| 41 | + | ||
| 42 | + # Record the active workspace of every output. | ||
| 43 | + while read -r out; do | ||
| 44 | + active=$(jq -c --arg o "$out" '.[] | select(.output == $o and .is_active == true)' <<<"$ws_json") | ||
| 45 | + printf '%s\t%s\n' "$out" "$(ref_of "$active")" >> "$STATE_FILE" | ||
| 46 | + done < <(jq -r '[.[].output] | unique | .[]' <<<"$ws_json") | ||
| 47 | + | ||
| 48 | + # Send every output to an empty workspace of its own. | ||
| 49 | + 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 | + empty_idx=$(jq -r --arg o "$out" --argjson w "$win_json" ' | ||
| 53 | + [ .[] | ||
| 54 | + | select(.output == $o and .name == null) | ||
| 55 | + | . as $ws | ||
| 56 | + | select(([$w[] | select(.workspace_id == $ws.id)] | length) == 0) | ||
| 57 | + ] | last | .idx // empty' <<<"$ws_json") | ||
| 58 | + | ||
| 59 | + # Fall back to the highest index on that output, which niri keeps empty. | ||
| 60 | + if [ -z "$empty_idx" ]; then | ||
| 61 | + empty_idx=$(jq -r --arg o "$out" '[.[] | select(.output == $o) | .idx] | max' <<<"$ws_json") | ||
| 62 | + fi | ||
| 63 | + | ||
| 64 | + niri msg action focus-monitor "$out" >/dev/null | ||
| 65 | + niri msg action focus-workspace "$empty_idx" >/dev/null | ||
| 66 | + done < <(jq -r '[.[].output] | unique | .[]' <<<"$ws_json") | ||
| 67 | + | ||
| 68 | + niri msg action focus-monitor "$focused_out" >/dev/null | ||
| 69 | +fi | ||
.config/scripts/niri/toggle_monitors.shadded+46 -0
| @@ -0,0 +1,46 @@ | |||
| 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 | +set -euo pipefail | ||
| 12 | + | ||
| 13 | +DP1="DP-1" | ||
| 14 | +HDMI="HDMI-A-1" | ||
| 15 | + | ||
| 16 | +all_on() { | ||
| 17 | + niri msg action power-on-monitors | ||
| 18 | + niri msg output "$DP1" on | ||
| 19 | + niri msg output "$HDMI" on | ||
| 20 | +} | ||
| 21 | + | ||
| 22 | +case "${1:-menu}" in | ||
| 23 | +menu) | ||
| 24 | + choice=$(printf '%s\n' \ | ||
| 25 | + "🖥️ All Monitors Off (blank, any key wakes)" \ | ||
| 26 | + "🖥️ DP-1 Off (disable)" \ | ||
| 27 | + "🖥️ HDMI-A-1 Off (disable)" \ | ||
| 28 | + "💡 All Monitors On" \ | ||
| 29 | + "💡 DP-1 On" \ | ||
| 30 | + "💡 HDMI-A-1 On" \ | ||
| 31 | + "❌ Cancel" | rofi -dmenu -p "Monitors" -i) | ||
| 32 | + | ||
| 33 | + case "$choice" in | ||
| 34 | + "🖥️ All Monitors Off"*) niri msg action power-off-monitors ;; | ||
| 35 | + "🖥️ DP-1 Off"*) niri msg output "$DP1" off ;; | ||
| 36 | + "🖥️ HDMI-A-1 Off"*) niri msg output "$HDMI" off ;; | ||
| 37 | + "💡 All Monitors On"*) all_on ;; | ||
| 38 | + "💡 DP-1 On"*) niri msg output "$DP1" on ;; | ||
| 39 | + "💡 HDMI-A-1 On"*) niri msg output "$HDMI" on ;; | ||
| 40 | + *) ;; | ||
| 41 | + esac | ||
| 42 | + ;; | ||
| 43 | +on) | ||
| 44 | + all_on | ||
| 45 | + ;; | ||
| 46 | +esac | ||
.config/scripts/niri/wallpaper_picker.shadded+79 -0
| @@ -0,0 +1,79 @@ | |||
| 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 | + | ||
| 12 | +WALLPAPER_DIR="$HOME/Pictures/Wallpapers" | ||
| 13 | +THUMB_DIR="$HOME/.cache/wallpaper_thumbs" | ||
| 14 | +STATE_FILE="$HOME/.cache/current_wallpaper" | ||
| 15 | + | ||
| 16 | +# Generate thumbnail cache (only for new/changed images) | ||
| 17 | +mkdir -p "$THUMB_DIR" | ||
| 18 | + | ||
| 19 | +# Remove orphan thumbnails for deleted wallpapers | ||
| 20 | +for thumb in "$THUMB_DIR"/*.png; do | ||
| 21 | + [ -f "$thumb" ] || continue | ||
| 22 | + name=$(basename "$thumb" .png) | ||
| 23 | + if ! find "$WALLPAPER_DIR" -maxdepth 1 -name "$name" -print -quit | grep -q .; then | ||
| 24 | + rm -f "$thumb" | ||
| 25 | + fi | ||
| 26 | +done | ||
| 27 | + | ||
| 28 | +# Generate thumbnails for new/changed wallpapers | ||
| 29 | +find "$WALLPAPER_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | while read -r img; do | ||
| 30 | + name=$(basename "$img") | ||
| 31 | + thumb="$THUMB_DIR/$name.png" | ||
| 32 | + if [ ! -f "$thumb" ] || [ "$img" -nt "$thumb" ]; then | ||
| 33 | + magick "$img" -thumbnail 128x80 "$thumb" & | ||
| 34 | + fi | ||
| 35 | +done | ||
| 36 | +wait | ||
| 37 | + | ||
| 38 | +# List image files with cached thumbnails in a grid rofi | ||
| 39 | +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 | + name=$(basename "$img") | ||
| 41 | + echo -en "${name}\0icon\x1f${THUMB_DIR}/${name}.png\n" | ||
| 42 | +done | rofi -dmenu -p "Wallpaper" -i -show-icons \ | ||
| 43 | + -theme-str 'listview { columns: 4; lines: 3; flow: horizontal; }' \ | ||
| 44 | + -theme-str 'element { orientation: vertical; }' \ | ||
| 45 | + -theme-str 'element-icon { size: 100px; }' \ | ||
| 46 | + -theme-str 'element-text { horizontal-align: 0.5; }') | ||
| 47 | + | ||
| 48 | +if [ -z "$SELECTED" ]; then | ||
| 49 | + exit 0 | ||
| 50 | +fi | ||
| 51 | + | ||
| 52 | +WALLPAPER="$WALLPAPER_DIR/$SELECTED" | ||
| 53 | + | ||
| 54 | +if [ ! -f "$WALLPAPER" ]; then | ||
| 55 | + notify-send "Wallpaper Picker" "File not found: $WALLPAPER" | ||
| 56 | + exit 1 | ||
| 57 | +fi | ||
| 58 | + | ||
| 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 | +if ! awww query >/dev/null 2>&1; then | ||
| 62 | + awww-daemon >/dev/null 2>&1 & | ||
| 63 | + disown | ||
| 64 | + for _ in $(seq 20); do | ||
| 65 | + awww query >/dev/null 2>&1 && break | ||
| 66 | + sleep 0.1 | ||
| 67 | + done | ||
| 68 | +fi | ||
| 69 | + | ||
| 70 | +awww img --transition-type simple "$WALLPAPER" & | ||
| 71 | +wallust run -qs "$WALLPAPER" & | ||
| 72 | +wait | ||
| 73 | + | ||
| 74 | +# Remember the choice so the daemon can be restored on the next login. | ||
| 75 | +echo "$WALLPAPER" > "$STATE_FILE" | ||
| 76 | + | ||
| 77 | +killall waybar 2>/dev/null | ||
| 78 | +waybar &disown | ||
| 79 | +notify-send "Wallpaper Picker" "Applied: $SELECTED" | ||
.config/scripts/niri/wallpaper_restore.shadded+37 -0
| @@ -0,0 +1,37 @@ | |||
| 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 | + | ||
| 6 | +STATE_FILE="$HOME/.cache/current_wallpaper" | ||
| 7 | +FALLBACK_DIR="$HOME/Pictures/Wallpapers" | ||
| 8 | + | ||
| 9 | +if ! awww query >/dev/null 2>&1; then | ||
| 10 | + awww-daemon >/dev/null 2>&1 & | ||
| 11 | + disown | ||
| 12 | + for _ in $(seq 50); do | ||
| 13 | + awww query >/dev/null 2>&1 && break | ||
| 14 | + sleep 0.1 | ||
| 15 | + done | ||
| 16 | +fi | ||
| 17 | + | ||
| 18 | +WALLPAPER="" | ||
| 19 | + | ||
| 20 | +if [ -s "$STATE_FILE" ]; then | ||
| 21 | + WALLPAPER=$(cat "$STATE_FILE") | ||
| 22 | +fi | ||
| 23 | + | ||
| 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 | +if [ ! -f "$WALLPAPER" ]; then | ||
| 27 | + WALLPAPER=$(grep -oP '^\s*path\s*=\s*\K.*' "$HOME/.config/hypr/hyprpaper.conf" 2>/dev/null | head -1) | ||
| 28 | +fi | ||
| 29 | + | ||
| 30 | +if [ ! -f "$WALLPAPER" ]; then | ||
| 31 | + WALLPAPER=$(find "$FALLBACK_DIR" -maxdepth 1 -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' -o -iname '*.webp' \) | sort | head -1) | ||
| 32 | +fi | ||
| 33 | + | ||
| 34 | +if [ -f "$WALLPAPER" ]; then | ||
| 35 | + awww img --transition-type none "$WALLPAPER" | ||
| 36 | + echo "$WALLPAPER" > "$STATE_FILE" | ||
| 37 | +fi | ||
.config/scripts/niri/wallust_niri_colors.shadded+49 -0
| @@ -0,0 +1,49 @@ | |||
| 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 | +set -euo pipefail | ||
| 16 | + | ||
| 17 | +CONFIG="$HOME/.config/niri/config.kdl" | ||
| 18 | +SEQUENCES="$HOME/.cache/wallust/sequences" | ||
| 19 | +MARKER="// WALLUST-GRADIENT" | ||
| 20 | + | ||
| 21 | +[ -f "$CONFIG" ] || exit 0 | ||
| 22 | +[ -f "$SEQUENCES" ] || exit 0 | ||
| 23 | + | ||
| 24 | +# wallust writes the palette as terminal OSC sequences: ]4;<n>;#RRGGBB | ||
| 25 | +color_at() { | ||
| 26 | + grep -oP "\]4;$1;#\K[0-9A-Fa-f]{6}" "$SEQUENCES" | head -1 | ||
| 27 | +} | ||
| 28 | + | ||
| 29 | +FROM=$(color_at 4) | ||
| 30 | +TO=$(color_at 6) | ||
| 31 | + | ||
| 32 | +if [ -z "$FROM" ] || [ -z "$TO" ]; then | ||
| 33 | + exit 0 | ||
| 34 | +fi | ||
| 35 | + | ||
| 36 | +grep -qF "$MARKER" "$CONFIG" || exit 0 | ||
| 37 | + | ||
| 38 | +# Replace the line after the marker, preserving its indentation. | ||
| 39 | +awk -v marker="$MARKER" -v from="#$FROM" -v to="#$TO" ' | ||
| 40 | + hit { | ||
| 41 | + match($0, /^[ \t]*/) | ||
| 42 | + indent = substr($0, 1, RLENGTH) | ||
| 43 | + printf "%sactive-gradient from=\"%s\" to=\"%s\" angle=90 in=\"oklch longer hue\"\n", indent, from, to | ||
| 44 | + hit = 0 | ||
| 45 | + next | ||
| 46 | + } | ||
| 47 | + { print } | ||
| 48 | + index($0, marker) { hit = 1 } | ||
| 49 | +' "$CONFIG" > "$CONFIG.wallust-tmp" && mv "$CONFIG.wallust-tmp" "$CONFIG" | ||
.config/scripts/niri/workspace_app.shadded+42 -0
| @@ -0,0 +1,42 @@ | |||
| 1 | +#!/usr/bin/env bash | ||
| 2 | +# Emulates Hyprland's `workspace = N, on-created-empty: <cmd>` for niri. | ||
| 3 | +# | ||
| 4 | +# usage: workspace_app.sh <workspace-name> <command> [args...] | ||
| 5 | +# | ||
| 6 | +# Focuses the named workspace, then launches the command only if that | ||
| 7 | +# workspace currently holds no windows. niri has no on-created-empty, and | ||
| 8 | +# named workspaces declared in the config are persistent (never "created"), | ||
| 9 | +# so the emptiness check is what makes this lazy instead of duplicating apps. | ||
| 10 | +set -euo pipefail | ||
| 11 | + | ||
| 12 | +ws="$1" | ||
| 13 | +shift | ||
| 14 | + | ||
| 15 | +ws_json=$(niri msg -j workspaces) | ||
| 16 | + | ||
| 17 | +id=$(jq -r --arg w "$ws" '.[] | select(.name == $w) | .id' <<<"$ws_json") | ||
| 18 | + | ||
| 19 | +if [ -z "$id" ]; then | ||
| 20 | + notify-send "workspace_app" "No workspace named '$ws' — is it declared in config.kdl?" | ||
| 21 | + exit 1 | ||
| 22 | +fi | ||
| 23 | + | ||
| 24 | +# Named workspaces live on whichever output they were created on, and | ||
| 25 | +# focus-workspace jumps focus to THAT output instead of bringing the workspace | ||
| 26 | +# to you. So move it here FIRST, with --reference so the move needs no focus | ||
| 27 | +# change: focusing it on the other monitor and dragging it away afterwards | ||
| 28 | +# leaves that monitor stranded on some unrelated workspace. | ||
| 29 | +here=$(jq -r '.[] | select(.is_focused == true) | .output' <<<"$ws_json") | ||
| 30 | +there=$(jq -r --arg w "$ws" '.[] | select(.name == $w) | .output' <<<"$ws_json") | ||
| 31 | + | ||
| 32 | +if [ -n "$here" ] && [ "$here" != "$there" ]; then | ||
| 33 | + niri msg action move-workspace-to-monitor --reference "$ws" "$here" | ||
| 34 | +fi | ||
| 35 | + | ||
| 36 | +niri msg action focus-workspace "$ws" | ||
| 37 | + | ||
| 38 | +count=$(niri msg -j windows | jq --argjson id "$id" '[.[] | select(.workspace_id == $id)] | length') | ||
| 39 | + | ||
| 40 | +if [ "$count" -eq 0 ]; then | ||
| 41 | + setsid "$@" >/dev/null 2>&1 & | ||
| 42 | +fi | ||
.config/wallust/wallust.tomlmodified+5 -0
| @@ -52,8 +52,13 @@ palette = "saliencedarkbalanced" | |||
| 52 | gtk4 = { template = 'gtk4.css', target = '~/.config/gtk-4.0/gtk.css' } | 52 | gtk4 = { template = 'gtk4.css', target = '~/.config/gtk-4.0/gtk.css' } |
| 53 | gtk4dark = { template = 'gtk4.css', target = '~/.config/gtk-4.0/gtk-dark.css' } | 53 | gtk4dark = { template = 'gtk4.css', target = '~/.config/gtk-4.0/gtk-dark.css' } |
| 54 | gtk3 = { template = 'gtk3.css', target = '~/.config/gtk-3.0/gtk.css' } | 54 | gtk3 = { template = 'gtk3.css', target = '~/.config/gtk-3.0/gtk.css' } |
| 55 | +gtk2 = { template = 'gtk2.gtkrc', target = '~/.gtkrc-2.0.mine' } | ||
| 56 | +kdeglobals = { template = 'kdeglobals', target = '~/.config/kdeglobals' } | ||
| 55 | qt5ct = { template = 'qt5ct-wallust.conf', target = '~/.config/qt5ct/colors/wallust.conf' } | 57 | qt5ct = { template = 'qt5ct-wallust.conf', target = '~/.config/qt5ct/colors/wallust.conf' } |
| 56 | qt6ct = { template = 'qt6ct-wallust.conf', target = '~/.config/qt6ct/colors/wallust.conf' } | 58 | qt6ct = { template = 'qt6ct-wallust.conf', target = '~/.config/qt6ct/colors/wallust.conf' } |
| 57 | [hooks] | 59 | [hooks] |
| 58 | # Resolve mix() and compute surface colors for GTK and QT | 60 | # Resolve mix() and compute surface colors for GTK and QT |
| 59 | theme_colors = """~/.config/scripts/shared/theme_colors.sh""" | 61 | theme_colors = """~/.config/scripts/shared/theme_colors.sh""" |
| 62 | +# niri has no `include`, so its border gradient is rewritten inside config.kdl. | ||
| 63 | +# No-op when the niri config is absent; harmless while running Hyprland. | ||
| 64 | +niri_colors = """~/.config/scripts/niri/wallust_niri_colors.sh""" | ||