forge
Explore
Log in

Don't you dare go Hollow

Trim the config and pull hardcoded values into scripts

Browse files at this commit

3fdedf22beb8e67280f09802d73fe1e8e4467d19Ahmet Kaan GümüşParent: b5dcf5c
  • refactor
    • trim the config and pull hardcoded values into scripts
Show full message
refactor(niri): trim the config and pull hardcoded values into scripts

config.kdl goes 804 -> 374 lines by dropping niri's stock tutorial comments
and inert blocks (shadow with `on` commented out, focus-ring colors under an
`off` block, an empty hotkey-overlay, the /- disabled eDP-1 output and two /-
window rules). Sections are grouped and only decisions specific to this setup
are commented. Verified behaviour-preserving: same 108 binds, and a diff of
comment-stripped lines shows only overlay-title wording, alignment, and the
substitutions below.

De-hardcoding, as far as KDL allows — it has no variables, so output names
cannot be parameterised:
- scripts/shared/webapp.sh builds the Chromium web-app command from a URL and
  profile id, deriving the window class as chrome-<host>__-Default the way
  Chromium does. Replaces four near-identical 400-character bind lines.
  Dry-run compared against the originals: byte-identical, mullvad-exclude
  included where it was.
- scripts/niri/monitors.sh defines LEFT_MONITOR / RIGHT_MONITOR, sourced by
  toggle_monitors.sh, whose rofi entries are now generated from them.
- no more /home/tahinli in the config: absolute `spawn` paths became
  `spawn-sh` with ~, which the shell expands.

Output names now appear only in the two `output` blocks and the four monitor
binds, with a summary at the top of the file.
.config/niri/config.kdlmodified+172 -602
@@ -1,115 +1,40 @@
1-// This config is in the KDL format: https://kdl.dev1+// niri config — ported from ~/.config/hypr/hyprland.conf, both kept working.
2-// "/-" comments out the following node.2+// Docs: https://niri-wm.github.io/niri/ • check edits with `niri validate`
3-// Check the wiki for a full description of the configuration:3+//
4-// https://niri-wm.github.io/niri/Configuration:-Introduction4+// MONITORS: DP-1 = left/primary (2560x1440@180), HDMI-A-1 = right (1920x1080@75).
5-5+// KDL has no variables, so those names are literal. They appear ONLY in the
6-// Input device configuration.6+// `output` blocks and the four monitor binds below. Scripts read them from
7-// Find the full list of options on the wiki:7+// ~/.config/scripts/niri/monitors.sh instead.
8-// https://niri-wm.github.io/niri/Configuration:-Input8+//
9+// Mod = Super. Alt is the app-launcher trigger, matching Hyprland's $my_trigger.
10+
9 input {11 input {
10 keyboard {12 keyboard {
11 xkb {13 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";14 layout "tr";
23 }15 }
24-
25- // Enable numlock on startup, omitting this setting disables it.
26 numlock16 numlock
27 }17 }
28 18
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 {19 touchpad {
33- // off
34 tap20 tap
35- // dwt
36- // dwtp
37- // drag false
38- // drag-lock
39 natural-scroll21 natural-scroll
40- // accel-speed 0.2
41- // accel-profile "flat"
42- // scroll-method "two-finger"
43- // disabled-on-external-mouse
44 }22 }
45 23
24+ // Hyprland: accel_profile = flat (raw input, no acceleration curve).
46 mouse {25 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"26 accel-profile "flat"
52- // scroll-method "no-scroll"
53 }27 }
54 28
55 trackpoint {29 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 }30 }
73 31
74-// You can configure outputs by their name, which you can find32+ // focus-follows-mouse stays off, matching Hyprland's follow_mouse = 0.
75-// by running `niri msg outputs` while inside a niri instance.33+ // No niri equivalent for mouse_move_focuses_monitor = false: moving the
76-// The built-in laptop monitor is usually called "eDP-1".34+ // cursor to the other output does make it the focused one.
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 }35 }
110 36
111-// Left / primary monitor (Xiaomi Mi Monitor). Hyprland had `bitdepth 10` here;37+// Hyprland had `bitdepth 10`; niri 26.04 has no bit-depth or hdr output key.
112-// niri 26.04 has no bit-depth / hdr output key, so that is dropped.
113 output "DP-1" {38 output "DP-1" {
114 mode "2560x1440@180"39 mode "2560x1440@180"
115 scale 140 scale 1
@@ -118,7 +43,7 @@ output "DP-1" {
118 focus-at-startup43 focus-at-startup
119 }44 }
120 45
121-// Right monitor. Exact mode string matters: it is 75.003, not 75.46+// Mode string must be exact: 75.003, not 75.
122 output "HDMI-A-1" {47 output "HDMI-A-1" {
123 mode "1920x1080@75.003"48 mode "1920x1080@75.003"
124 scale 149 scale 1
@@ -126,203 +51,65 @@ output "HDMI-A-1" {
126 position x=2560 y=051 position x=2560 y=0
127 }52 }
128 53
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 {54 layout {
133- // Set gaps around windows in logical pixels.55+ // Hyprland gaps_in = 3; the remaining 7 to reach gaps_out = 10 is in struts.
134- // Hyprland general:gaps_in = 3. The extra 7 to reach gaps_out = 10 is in struts.
135 gaps 356 gaps 3
57+ struts {
58+ left 7
59+ right 7
60+ top 7
61+ bottom 7
62+ }
136 63
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"64 center-focused-column "never"
144 65
145- // You can customize the widths that "switch-preset-column-width" (Mod+R) toggles between.66+ // New windows take the whole working area — the closest thing to dwindle
67+ // handing a new window all the free space. 1.0 is in the preset cycle too,
68+ // otherwise one Mod+R drops a window to 1/3 with no way back to full.
69+ default-column-width { proportion 1.0; }
146 preset-column-widths {70 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.3333371 proportion 0.33333
151 proportion 0.572 proportion 0.5
152 proportion 0.6666773 proportion 0.66667
153-
154- // Full width is in the cycle because new windows open at
155- // `default-column-width { proportion 1.0; }`. Without it, one Mod+R
156- // drops a window to 1/3 with no way to cycle back to full.
157 proportion 1.074 proportion 1.0
158-
159- // Fixed sets the width in logical pixels exactly.
160- // fixed 1920
161 }75 }
162 76
163- // You can also customize the heights that "switch-preset-window-height" (Mod+Ctrl+Shift+R) toggles between.77+ // Hyprland had one border concept, mapped to `border` below.
164- // preset-window-heights { }
165-
166- // You can change the default width of the new windows.
167- // Windows open taking the whole working area, closest thing to how dwindle
168- // handed a new window all the free space. Gaps, struts and border still apply.
169- default-column-width { proportion 1.0; }
170- // If you leave the brackets empty, the windows themselves will decide their initial width.
171- // default-column-width {}
172-
173- // By default focus ring and border are rendered as a solid background rectangle
174- // behind windows. That is, they will show up through semitransparent windows.
175- // This is because windows using client-side decorations can have an arbitrary shape.
176- //
177- // If you don't like that, you should uncomment `prefer-no-csd` below.
178- // Niri will draw focus ring and border *around* windows that agree to omit their
179- // client-side decorations.
180- //
181- // Alternatively, you can override it with a window rule called
182- // `draw-border-with-background`.
183-
184- // You can change how the focus ring looks.
185 focus-ring {78 focus-ring {
186- // Off: Hyprland had only one border concept, and it is mapped to
187- // the border block below.
188 off79 off
189-
190- // How many logical pixels the ring extends out from the windows.
191- width 4
192-
193- // Colors can be set in a variety of ways:
194- // - CSS named colors: "red"
195- // - RGB hex: "#rgb", "#rgba", "#rrggbb", "#rrggbbaa"
196- // - CSS-like notation: "rgb(255, 127, 0)", rgba(), hsl() and a few others.
197-
198- // Color of the ring on the active monitor.
199- active-color "#7fc8ff"
200-
201- // Color of the ring on inactive monitors.
202- //
203- // The focus ring only draws around the active window, so the only place
204- // where you can see its inactive-color is on other monitors.
205- inactive-color "#505050"
206-
207- // You can also use gradients. They take precedence over solid colors.
208- // Gradients are rendered the same as CSS linear-gradient(angle, from, to).
209- // The angle is the same as in linear-gradient, and is optional,
210- // defaulting to 180 (top-to-bottom gradient).
211- // You can use any CSS linear-gradient tool on the web to set these up.
212- // Changing the color space is also supported, check the wiki for more info.
213- //
214- // active-gradient from="#80c8ff" to="#c7ff7f" angle=45
215-
216- // You can also color the gradient relative to the entire view
217- // of the workspace, rather than relative to just the window itself.
218- // To do that, set relative-to="workspace-view".
219- //
220- // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
221 }80 }
222 81
223- // You can also add a border. It's similar to the focus ring, but always visible.
224 border {82 border {
225- // The settings are the same as for the focus ring.
226- // If you enable the border, you probably want to disable the focus ring.
227-
228 // Hyprland general:border_size = 283 // Hyprland general:border_size = 2
229 width 284 width 2
230 85
231- // Hyprland col.active_border was a 4-stop gradient86+ // The line after the marker is REWRITTEN IN PLACE by
232- // (FFAA93FF, 0053DFEE, 5500FFAA, FFAFFAAA). niri gradients take two87+ // ~/.config/scripts/niri/wallust_niri_colors.sh on every wallpaper
233- // stops, so this keeps the first and last.88+ // change. niri has no `include`, so generated colors cannot live in a
234- // The line below is REWRITTEN IN PLACE by89+ // separate file. Keep the marker directly above it, all on one line.
235- // ~/.config/scripts/niri/wallust_niri_colors.sh, which runs as a wallust
236- // hook whenever the wallpaper changes. niri has no `include`, so the
237- // colors cannot live in a separate generated file. Keep the marker
238- // comment directly above it, and keep the whole thing on one line.
239 // WALLUST-GRADIENT90 // WALLUST-GRADIENT
240 active-gradient from="#7B6753" to="#BC7857" angle=90 in="oklch"91 active-gradient from="#7B6753" to="#BC7857" angle=90 in="oklch"
241 92
242- // Hyprland col.inactive_border = rgba(595959aa)
243 inactive-color "#595959aa"93 inactive-color "#595959aa"
244-
245- // Color of the border around windows that request your attention.
246 urgent-color "#9b0000"94 urgent-color "#9b0000"
247-
248- // Gradients can use a few different interpolation color spaces.
249- // For example, this is a pastel rainbow gradient via in="oklch longer hue".
250- //
251- // active-gradient from="#e5989b" to="#ffb4a2" angle=45 relative-to="workspace-view" in="oklch longer hue"
252-
253- // inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
254 }95 }
255 96
256- // You can enable drop shadows for windows.97+ // Shadows and rounding are left off (Hyprland had rounding = 0, blur off).
257- shadow {98+ // Rounded corners come from the window rule below instead, only so the
258- // Uncomment the next line to enable shadows.99+ // border traces the curve GTK4 apps draw themselves.
259- // on
260-
261- // By default, the shadow draws only around its window, and not behind it.
262- // Uncomment this setting to make the shadow draw behind its window.
263- //
264- // Note that niri has no way of knowing about the CSD window corner
265- // radius. It has to assume that windows have square corners, leading to
266- // shadow artifacts inside the CSD rounded corners. This setting fixes
267- // those artifacts.
268- //
269- // However, instead you may want to set prefer-no-csd and/or
270- // geometry-corner-radius. Then, niri will know the corner radius and
271- // draw the shadow correctly, without having to draw it behind the
272- // window. These will also remove client-side shadows if the window
273- // draws any.
274- //
275- // draw-behind-window true
276-
277- // You can change how shadows look. The values below are in logical
278- // pixels and match the CSS box-shadow properties.
279-
280- // Softness controls the shadow blur radius.
281- softness 30
282-
283- // Spread expands the shadow.
284- spread 5
285-
286- // Offset moves the shadow relative to the window.
287- offset x=0 y=5
288-
289- // You can also change the shadow color and opacity.
290- color "#0007"
291 }100 }
292 101
293- // Struts shrink the area occupied by windows, similarly to layer-shell panels.
294- // You can think of them as a kind of outer gaps. They are set in logical pixels.
295- // Left and right struts will cause the next window to the side to always be visible.
296- // Top and bottom struts will simply add outer gaps in addition to the area occupied by
297- // layer-shell panels and regular gaps.
298- struts {
299- // gaps_out(10) - gaps_in(3) = 7 extra space at the screen edges.
300- left 7
301- right 7
302- top 7
303- bottom 7
304- }
305-}
306-
307-// Add lines like this to spawn processes at startup.
308-// Note that running niri as a session supports xdg-desktop-autostart,
309-// which may be more convenient to use.
310-// See the binds section below for more spawn examples.
311-
312-// Ported from Hyprland exec-once. The sleeps preserve the original start order
313-// (tray applets after waybar has claimed the tray).
314 environment {102 environment {
315 QT_QPA_PLATFORMTHEME "gtk3"103 QT_QPA_PLATFORMTHEME "gtk3"
316 XCURSOR_SIZE "24"104 XCURSOR_SIZE "24"
317 }105 }
318 106
319-// polkit agent, nm-applet and blueman-applet are NOT listed here: niri runs107+// Startup. The polkit agent, nm-applet and blueman-applet are deliberately
320-// xdg-desktop-autostart.target, and /etc/xdg/autostart already starts them.108+// absent: niri runs xdg-desktop-autostart.target and /etc/xdg/autostart already
321-// Hyprland ignored that target, which is why they needed exec-once there.109+// starts them. Hyprland ignored that target, which is why it needed exec-once.
322-// awww replaces hyprpaper (which needs Hyprland's IPC socket). The daemon has110+// The sleeps preserve Hyprland's ordering (tray applets after waybar).
323-// no config file, so this also restores the last wallpaper picked.111+spawn-at-startup "sh" "-c" "bash ~/.config/scripts/niri/wallpaper_restore.sh"
324-spawn-at-startup "bash" "/home/tahinli/.config/scripts/niri/wallpaper_restore.sh"112+spawn-at-startup "sh" "-c" "bash ~/.config/scripts/shared/song_detail_writer.sh"
325-spawn-at-startup "bash" "/home/tahinli/.config/scripts/shared/song_detail_writer.sh"
326 spawn-at-startup "sh" "-c" "sleep 1 && waybar"113 spawn-at-startup "sh" "-c" "sleep 1 && waybar"
327 spawn-at-startup "sh" "-c" "sleep 2 && kdeconnect-indicator"114 spawn-at-startup "sh" "-c" "sleep 2 && kdeconnect-indicator"
328 spawn-at-startup "sh" "-c" "sleep 3 && /opt/Mullvad\\ VPN/mullvad-vpn"115 spawn-at-startup "sh" "-c" "sleep 3 && /opt/Mullvad\\ VPN/mullvad-vpn"
@@ -331,113 +118,36 @@ spawn-at-startup "sh" "-c" "sleep 3 && wl-paste --type text --watch cliphist sto
331 spawn-at-startup "sh" "-c" "sleep 3 && wl-paste --type image --watch cliphist store"118 spawn-at-startup "sh" "-c" "sleep 3 && wl-paste --type image --watch cliphist store"
332 spawn-at-startup "sh" "-c" "sleep 4 && rfkill unblock bluetooth && bluetoothctl power on"119 spawn-at-startup "sh" "-c" "sleep 4 && rfkill unblock bluetooth && bluetoothctl power on"
333 120
334-// To run a shell command (with variables, pipes, etc.), use spawn-sh-at-startup:
335-// spawn-sh-at-startup "qs -c ~/source/qs/MyAwesomeShell"
336-
337-hotkey-overlay {
338- // Uncomment this line to disable the "Important Hotkeys" pop-up at startup.
339- // skip-at-startup
340-}
341-
342-// Uncomment this line to ask the clients to omit their client-side decorations if possible.
343-// If the client will specifically ask for CSD, the request will be honored.
344-// Additionally, clients will be informed that they are tiled, removing some client-side rounded corners.
345-// This option will also fix border/focus ring drawing behind some semitransparent windows.
346-// After enabling or disabling this, you need to restart the apps for this to take effect.
347-// prefer-no-csd
348-
349-// You can change the path where screenshots are saved.
350-// A ~ at the front will be expanded to the home directory.
351-// The path is formatted with strftime(3) to give you the screenshot date and time.
352 screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"121 screenshot-path "~/Pictures/Screenshots/Screenshot from %Y-%m-%d %H-%M-%S.png"
353 122
354-// You can also set this to null to disable saving screenshots to disk.123+// Animations stay at niri's defaults (on), unlike Hyprland where they were off.
355-// screenshot-path null
356-
357-// Animation settings.
358-// The wiki explains how to configure individual animations:
359-// https://niri-wm.github.io/niri/Configuration:-Animations
360 animations {124 animations {
361- // Kept on deliberately: Hyprland had animations off, niri's are kept.
362- // off
363-
364- // Slow down all animations by this factor. Values below 1 speed them up instead.
365- // slowdown 3.0
366 }125 }
367 126
368-// Window rules let you adjust behavior for individual windows.127+// Every window: draw the border AROUND the window, not behind it. niri uses the
369-// Find more information on the wiki:128+// border as the window background by default, which is invisible behind an
370-// https://niri-wm.github.io/niri/Configuration:-Window-Rules129+// opaque window — the border simply never showed up. The corner radius makes it
371-130+// follow the rounding GTK4/libadwaita apps apply to themselves.
372-// Draw the border AROUND windows instead of behind them. By default niri uses
373-// the border as the window background, which is invisible behind an opaque
374-// window — so the Hyprland-style border simply never showed up. This is the
375-// same setting that stopped the gradient bleeding through wezterm's opacity.
376 window-rule {131 window-rule {
377 draw-border-with-background false132 draw-border-with-background false
378-
379- // GTK4/libadwaita apps (nautilus, ...) round their own corners at ~12px,
380- // while niri draws the border square — the two did not line up. Telling
381- // niri the radius makes the border follow the curve, and clip-to-geometry
382- // trims the window to it so nothing pokes out past the border.
383 geometry-corner-radius 12133 geometry-corner-radius 12
384 clip-to-geometry true134 clip-to-geometry true
385 }135 }
386 136
137+// Hyprland: windowrule = match:class .*wezterm.*, opacity 0.8
387 window-rule {138 window-rule {
388- // This regular expression is intentionally made as specific as possible,
389- // since this is the default config, and we want no false positives.
390- // You can get away with just app-id="wezterm" if you want.
391 match app-id=r#"^org\.wezfurlong\.wezterm$"#139 match app-id=r#"^org\.wezfurlong\.wezterm$"#
392-
393- // The stock config sets an empty `default-column-width {}` here as a
394- // workaround for a WezTerm initial-configure bug. That means "let the
395- // window pick its own width", which overrode the global
396- // `default-column-width { proportion 1.0; }` and is why WezTerm alone
397- // did not open full width. Removed; re-add it if WezTerm ever opens
398- // at a wrong size on the first frame.
399-
400- // Hyprland: windowrule = match:class .*wezterm.*, opacity 0.8
401 opacity 0.8140 opacity 0.8
402-
403- // Without this, niri paints the border gradient as the window background,
404- // which shines through the 0.8 opacity and makes the whole terminal a
405- // rainbow. wezterm draws its own background, so it does not need niri's.
406 draw-border-with-background false141 draw-border-with-background false
407 }142 }
408 143
409-// Open the Firefox picture-in-picture player as floating by default.
410 window-rule {144 window-rule {
411- // This app-id regular expression will work for both:
412- // - host Firefox (app-id is "firefox")
413- // - Flatpak Firefox (app-id is "org.mozilla.firefox")
414 match app-id=r#"firefox$"# title="^Picture-in-Picture$"145 match app-id=r#"firefox$"# title="^Picture-in-Picture$"
415 open-floating true146 open-floating true
416 }147 }
417 148
418-// Example: block out two password managers from screen capture.149+// App workspaces, replacing Hyprland's 100/200-206. Not pinned to an output
419-// (This example rule is commented out with a "/-" in front.)150+// (no open-on-output), so they follow the monitor you are on.
420-/-window-rule {
421- match app-id=r#"^org\.keepassxc\.KeePassXC$"#
422- match app-id=r#"^org\.gnome\.World\.Secrets$"#
423-
424- block-out-from "screen-capture"
425-
426- // Use this instead if you want them visible on third-party screenshot tools.
427- // block-out-from "screencast"
428-}
429-
430-// Example: enable rounded corners for all windows.
431-// (This example rule is commented out with a "/-" in front.)
432-/-window-rule {
433- geometry-corner-radius 12
434- clip-to-geometry true
435-}
436-
437-// Named workspaces, the equivalent of the Hyprland 100/200-206 app workspaces.
438-// They are deliberately not pinned to an output (no open-on-output), so they
439-// follow you to whichever monitor is focused. Declaration order is the order
440-// they appear in, after the numbered ones.
441 workspace "code"151 workspace "code"
442 workspace "github"152 workspace "github"
443 workspace "whatsapp"153 workspace "whatsapp"
@@ -448,53 +158,35 @@ workspace "mail"
448 workspace "signal"158 workspace "signal"
449 159
450 binds {160 binds {
451- // Keys consist of modifiers separated by + signs, followed by an XKB key name161+ // ─── launchers (Alt trigger, Hyprland $my_trigger) ───────────────────────
452- // in the end. To find an XKB name for a particular key, you may use a program162+ // F-key and number-row variants both bound, as in Hyprland.
453- // like wev.163+ Alt+T hotkey-overlay-title="Terminal: wezterm" { spawn-sh "wezterm start --always-new-process"; }
454- //164+ Alt+Q hotkey-overlay-title="Files: nautilus" { spawn-sh "nautilus --new-window"; }
455- // "Mod" is a special modifier equal to Super when running on a TTY, and to Alt165+
456- // when running as a winit window.166+ Alt+F1 hotkey-overlay-title="rofi: window switcher" { spawn-sh "rofi -show"; }
457- //167+ Alt+1 hotkey-overlay-title="rofi: window switcher" { spawn-sh "rofi -show"; }
458- // Most actions that you can bind here can also be invoked programmatically with168+ Alt+F2 hotkey-overlay-title="rofi: run" { spawn-sh "rofi -show drun -show-icons"; }
459- // `niri msg action do-something`.169+ Alt+2 hotkey-overlay-title="rofi: run" { spawn-sh "rofi -show drun -show-icons"; }
460-170+ Shift+Alt+F2 hotkey-overlay-title="rofi: run (outside VPN)" { spawn-sh "mullvad-exclude rofi -show drun -show-icons"; }
461- // Mod-Shift-/, which is usually the same as Mod-?,171+ Shift+Alt+2 hotkey-overlay-title="rofi: run (outside VPN)" { spawn-sh "mullvad-exclude rofi -show drun -show-icons"; }
462- // shows a list of important hotkeys.172+ Alt+F3 hotkey-overlay-title="Clipboard history" { spawn-sh "cliphist list | rofi -dmenu -show-icons -i | cliphist decode | wl-copy"; }
463- Mod+Shift+Slash { show-hotkey-overlay; }173+ Alt+3 hotkey-overlay-title="Clipboard history" { spawn-sh "cliphist list | rofi -dmenu -show-icons -i | cliphist decode | wl-copy"; }
464-174+
465- // Suggested binds for running programs: terminal, app launcher, screen locker.175+ Alt+F hotkey-overlay-title="Browser" { spawn-sh "flatpak run io.github.ungoogled_software.ungoogled_chromium --enable-features=MiddleClickAutoscroll"; }
466- // Mod+T hotkey-overlay-title="Open a Terminal: alacritty" { spawn "alacritty"; }176+ 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"; }
467- // Mod+D hotkey-overlay-title="Run an Application: fuzzel" { spawn "fuzzel"; }177+
468- // hyprlock speaks ext-session-lock-v1 and has no Hyprland IPC dependency178+ // ─── app workspaces ─────────────────────────────────────────────────────
469- // (no HYPRLAND_INSTANCE_SIGNATURE in the binary), so it works here.179+ // workspace_app.sh emulates Hyprland's on-created-empty, which niri lacks:
470- // swaylock 1.8.5 is installed as a fallback if it misbehaves.180+ // it pulls the workspace to the focused monitor, then launches the app only
471- Super+L hotkey-overlay-title="Lock the Screen: hyprlock" { spawn "hyprlock"; }181+ // if that workspace is empty. webapp.sh builds the Chromium web-app command
472- Alt+T hotkey-overlay-title="Run a terminal: wezterm" { spawn-sh "wezterm start --always-new-process"; }182+ // from a URL + profile id.
473- Alt+Q hotkey-overlay-title="File manager: nautilus" { spawn-sh "nautilus --new-window"; }183+ Alt+C hotkey-overlay-title="Workspace: code" { spawn-sh "~/.config/scripts/niri/workspace_app.sh code zed"; }
474-184+ 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"; }
475- // rofi: F-key and number-row variants, same as the Hyprland binds.185+ 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"; }
476- Alt+F1 hotkey-overlay-title="active_menu" { spawn-sh "rofi -show"; }
477- Alt+1 hotkey-overlay-title="active_menu" { spawn-sh "rofi -show"; }
478- Alt+F2 hotkey-overlay-title="menu" { spawn-sh "rofi -show drun -show-icons"; }
479- Alt+2 hotkey-overlay-title="menu" { spawn-sh "rofi -show drun -show-icons"; }
480- Shift+Alt+F2 hotkey-overlay-title="menu_unsafe" { spawn-sh "mullvad-exclude rofi -show drun -show-icons"; }
481- Shift+Alt+2 hotkey-overlay-title="menu_unsafe" { spawn-sh "mullvad-exclude rofi -show drun -show-icons"; }
482- Alt+F3 hotkey-overlay-title="clipboard" { spawn-sh "cliphist list | rofi -dmenu -show-icons -i | cliphist decode | wl-copy"; }
483- Alt+3 hotkey-overlay-title="clipboard" { spawn-sh "cliphist list | rofi -dmenu -show-icons -i | cliphist decode | wl-copy"; }
484-
485- Alt+F hotkey-overlay-title="browser" { spawn-sh "flatpak run io.github.ungoogled_software.ungoogled_chromium --enable-features=MiddleClickAutoscroll"; }
486- 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"; }
487-
488- // --- app workspaces (Hyprland on-created-empty emulation) ---
489- // The helper focuses the workspace and launches the app only when the
490- // workspace is empty. See ~/.config/scripts/niri/workspace_app.sh.
491- Alt+C hotkey-overlay-title="Workspace: code" { spawn "/home/tahinli/.config/scripts/niri/workspace_app.sh" "code" "zed"; }
492- 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"; }
493- 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"; }
494 Alt+D hotkey-overlay-title="Workspace: discord" { spawn-sh "~/.config/scripts/niri/workspace_app.sh discord flatpak run dev.vencord.Vesktop"; }186 Alt+D hotkey-overlay-title="Workspace: discord" { spawn-sh "~/.config/scripts/niri/workspace_app.sh discord flatpak run dev.vencord.Vesktop"; }
495- 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"; }187+ Alt+S hotkey-overlay-title="Workspace: deezer" { spawn-sh "~/.config/scripts/niri/workspace_app.sh deezer ~/.config/scripts/shared/webapp.sh --mullvad https://deezer.com/ VjW8vTQ3"; }
496 Alt+Y hotkey-overlay-title="Workspace: youtube" { spawn-sh "~/.config/scripts/niri/workspace_app.sh youtube mullvad-exclude flatpak run io.freetubeapp.FreeTube"; }188 Alt+Y hotkey-overlay-title="Workspace: youtube" { spawn-sh "~/.config/scripts/niri/workspace_app.sh youtube mullvad-exclude flatpak run io.freetubeapp.FreeTube"; }
497- 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"; }189+ Alt+P hotkey-overlay-title="Workspace: mail" { spawn-sh "~/.config/scripts/niri/workspace_app.sh mail ~/.config/scripts/shared/webapp.sh https://mail.proton.me/ eIpzVtL8"; }
498 Alt+N hotkey-overlay-title="Workspace: signal" { spawn-sh "~/.config/scripts/niri/workspace_app.sh signal flatpak run org.signal.Signal"; }190 Alt+N hotkey-overlay-title="Workspace: signal" { spawn-sh "~/.config/scripts/niri/workspace_app.sh signal flatpak run org.signal.Signal"; }
499 191
500 Mod+Shift+C { move-column-to-workspace "code"; }192 Mod+Shift+C { move-column-to-workspace "code"; }
@@ -506,149 +198,90 @@ binds {
506 Mod+Shift+P { move-column-to-workspace "mail"; }198 Mod+Shift+P { move-column-to-workspace "mail"; }
507 Mod+Shift+N { move-column-to-workspace "signal"; }199 Mod+Shift+N { move-column-to-workspace "signal"; }
508 200
201+ // ─── session / system ───────────────────────────────────────────────────
202+ // hyprlock works here: ext-session-lock-v1, no Hyprland IPC dependency.
203+ Super+L hotkey-overlay-title="Lock: hyprlock" { spawn "hyprlock"; }
204+ Mod+Escape hotkey-overlay-title="Power menu" { spawn-sh "bash ~/.config/scripts/system/power_menu.sh"; }
509 Mod+D hotkey-overlay-title="Show desktop" { spawn-sh "~/.config/scripts/niri/show_desktop.sh"; }205 Mod+D hotkey-overlay-title="Show desktop" { spawn-sh "~/.config/scripts/niri/show_desktop.sh"; }
510 Mod+H hotkey-overlay-title="Toggle waybar" { spawn-sh "pkill -SIGUSR1 waybar"; }206 Mod+H hotkey-overlay-title="Toggle waybar" { spawn-sh "pkill -SIGUSR1 waybar"; }
511- Mod+Escape hotkey-overlay-title="Power menu" { spawn-sh "bash ~/.config/scripts/system/power_menu.sh"; }207+ Mod+W hotkey-overlay-title="Wallpaper picker" { spawn-sh "~/.config/scripts/niri/wallpaper_picker.sh"; }
512 208
513- // Use spawn-sh to run a shell command. Do this if you need pipes, multiple commands, etc.209+ // Exit is Super+Alt+F4 only, as in Hyprland. The stock Mod+Shift+E and
514- // Note: the entire command goes as a single argument. It's passed verbatim to `sh -c`.210+ // Ctrl+Alt+Delete quit binds are removed on purpose.
515- // For example, this is a standard bind to toggle the screen reader (orca).211+ Alt+4 repeat=false { close-window; }
212+ Alt+F4 repeat=false { close-window; }
213+ Mod+Alt+F4 { quit; }
214+
215+ // Mod+Escape is the power menu, so the shortcut-inhibitor escape hatch
216+ // lives on Mod+Shift+Escape.
217+ Mod+Shift+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
218+ Mod+Shift+Slash { show-hotkey-overlay; }
219+ Mod+O repeat=false { toggle-overview; }
516 Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; }220 Super+Alt+S allow-when-locked=true hotkey-overlay-title=null { spawn-sh "pkill orca || exec orca"; }
517 221
518- // Example volume keys mappings for PipeWire & WirePlumber.222+ // ─── media / brightness ─────────────────────────────────────────────────
519- // The allow-when-locked=true property makes them work even when the session is locked.
520- // Using spawn-sh allows to pass multiple arguments together with the command.
521- // "-l 1.0" limits the volume to 100%.
522 XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; }223 XF86AudioRaiseVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1+ -l 1.0"; }
523 XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; }224 XF86AudioLowerVolume allow-when-locked=true { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.1-"; }
524 XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; }225 XF86AudioMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; }
525 XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; }226 XF86AudioMicMute allow-when-locked=true { spawn-sh "wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; }
526-
527- // Example media keys mapping using playerctl.
528- // This will work with any MPRIS-enabled media player.
529 XF86AudioPlay allow-when-locked=true { spawn-sh "playerctl play-pause"; }227 XF86AudioPlay allow-when-locked=true { spawn-sh "playerctl play-pause"; }
530 XF86AudioStop allow-when-locked=true { spawn-sh "playerctl stop"; }228 XF86AudioStop allow-when-locked=true { spawn-sh "playerctl stop"; }
531 XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; }229 XF86AudioPrev allow-when-locked=true { spawn-sh "playerctl previous"; }
532 XF86AudioNext allow-when-locked=true { spawn-sh "playerctl next"; }230 XF86AudioNext allow-when-locked=true { spawn-sh "playerctl next"; }
533-
534- // Example brightness key mappings for brightnessctl.
535- // You can use regular spawn with multiple arguments too (to avoid going through "sh"),
536- // but you need to manually put each argument in separate "" quotes.
537 XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; }231 XF86MonBrightnessUp allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "+10%"; }
538 XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; }232 XF86MonBrightnessDown allow-when-locked=true { spawn "brightnessctl" "--class=backlight" "set" "10%-"; }
539 233
540- // Open/close the Overview: a zoomed-out view of workspaces and windows.234+ // ─── screenshots ────────────────────────────────────────────────────────
541- // You can also move the mouse into the top-left hot corner,235+ // grim, not niri's built-ins: the Hyprland bind captured ALL outputs into
542- // or do a four-finger swipe up on a touchpad.236+ // one image, while screenshot-screen only grabs the focused output.
543- Mod+O repeat=false { toggle-overview; }237+ Print { spawn-sh "grim -t png - | tee \"$HOME/Pictures/Screenshots/$(date '+%y%m%d_%H-%M-%S').png\" | wl-copy -t image/png"; }
238+ Shift+Print { spawn-sh "grim -t png -g \"$(slurp)\" - | wl-copy -t image/png"; }
239+ Ctrl+Print { screenshot-screen; }
240+ Alt+Print { screenshot-window; }
544 241
545- Alt+4 repeat=false { close-window; }242+ // ─── monitors (the only place output names appear outside `output`) ──────
546- Alt+F4 repeat=false { close-window; }243+ // Addressed by name, like Hyprland's $monitor_left / $monitor_right. The
244+ // stock directional focus-monitor-* binds are dropped as redundant.
245+ Mod+Q { focus-monitor "DP-1"; }
246+ Mod+E { focus-monitor "HDMI-A-1"; }
247+ Mod+Shift+Q { move-column-to-monitor "DP-1"; }
248+ Mod+Shift+E { move-column-to-monitor "HDMI-A-1"; }
249+
250+ // toggle_monitors.sh keeps Hyprland's Super+M menu / Super+Shift+M all-on,
251+ // so maximize sits on Mod+Ctrl+M.
252+ Mod+M hotkey-overlay-title="Monitor menu" { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh"; }
253+ Mod+Shift+M hotkey-overlay-title="All monitors on" { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh on"; }
547 254
255+ // ─── focus ──────────────────────────────────────────────────────────────
256+ // Mod+H is the waybar toggle and Mod+L is the locker, so the stock vim-nav
257+ // binds for those two are gone; arrows still navigate.
548 Mod+Left { focus-column-left; }258 Mod+Left { focus-column-left; }
549- Mod+Down { focus-window-down; }
550- Mod+Up { focus-window-up; }
551 Mod+Right { focus-column-right; }259 Mod+Right { focus-column-right; }
552- // The vim-style nav binds are gone: Mod+H is the waybar toggle and Mod+L260+ Mod+Up { focus-window-up; }
553- // is the screen locker, matching the Hyprland binds. Arrows still navigate.261+ Mod+Down { focus-window-down; }
554 Mod+J { focus-window-down; }262 Mod+J { focus-window-down; }
555 Mod+K { focus-window-up; }263 Mod+K { focus-window-up; }
264+ Mod+Home { focus-column-first; }
265+ Mod+End { focus-column-last; }
266+ Mod+Tab { focus-window-previous; }
267+ Alt+Tab { focus-workspace-previous; }
556 268
269+ // ─── move windows ───────────────────────────────────────────────────────
557 Mod+Ctrl+Left { move-column-left; }270 Mod+Ctrl+Left { move-column-left; }
558- Mod+Ctrl+Down { move-window-down; }
559- Mod+Ctrl+Up { move-window-up; }
560 Mod+Ctrl+Right { move-column-right; }271 Mod+Ctrl+Right { move-column-right; }
272+ Mod+Ctrl+Up { move-window-up; }
273+ Mod+Ctrl+Down { move-window-down; }
561 Mod+Ctrl+H { move-column-left; }274 Mod+Ctrl+H { move-column-left; }
275+ Mod+Ctrl+L { move-column-right; }
562 Mod+Ctrl+J { move-window-down; }276 Mod+Ctrl+J { move-window-down; }
563 Mod+Ctrl+K { move-window-up; }277 Mod+Ctrl+K { move-window-up; }
564- Mod+Ctrl+L { move-column-right; }
565-
566- // Alternative commands that move across workspaces when reaching
567- // the first or last window in a column.
568- // Mod+J { focus-window-or-workspace-down; }
569- // Mod+K { focus-window-or-workspace-up; }
570- // Mod+Ctrl+J { move-window-down-or-to-workspace-down; }
571- // Mod+Ctrl+K { move-window-up-or-to-workspace-up; }
572-
573- Mod+Home { focus-column-first; }
574- Mod+End { focus-column-last; }
575 Mod+Ctrl+Home { move-column-to-first; }278 Mod+Ctrl+Home { move-column-to-first; }
576 Mod+Ctrl+End { move-column-to-last; }279 Mod+Ctrl+End { move-column-to-last; }
577 280
578- // Monitors are addressed by name, not direction, exactly like the Hyprland281+ // ─── workspaces ─────────────────────────────────────────────────────────
579- // $monitor_left / $monitor_right binds. The directional focus-monitor-*282+ // niri workspaces are per-monitor already, which is what hyprsplit gave
580- // and move-column-to-monitor-* binds are dropped as redundant.283+ // Hyprland. Mod+Shift+N is Hyprland's send-to-workspace; the stock
581- Mod+Q { focus-monitor "DP-1"; }284+ // Mod+Ctrl+N binds do the same and are kept as well.
582- Mod+E { focus-monitor "HDMI-A-1"; }
583- Mod+Shift+Q { move-column-to-monitor "DP-1"; }
584- Mod+Shift+E { move-column-to-monitor "HDMI-A-1"; }
585-
586- // Alternatively, there are commands to move just a single window:
587- // Mod+Shift+Ctrl+Left { move-window-to-monitor-left; }
588- // ...
589-
590- // And you can also move a whole workspace to another monitor:
591- // Mod+Shift+Ctrl+Left { move-workspace-to-monitor-left; }
592- // ...
593-
594- Mod+Page_Down { focus-workspace-down; }
595- Mod+Page_Up { focus-workspace-up; }
596- Mod+U { focus-workspace-down; }
597- Mod+I { focus-workspace-up; }
598- Mod+Ctrl+Page_Down { move-column-to-workspace-down; }
599- Mod+Ctrl+Page_Up { move-column-to-workspace-up; }
600- Mod+Ctrl+U { move-column-to-workspace-down; }
601- Mod+Ctrl+I { move-column-to-workspace-up; }
602-
603- // Alternatively, there are commands to move just a single window:
604- // Mod+Ctrl+Page_Down { move-window-to-workspace-down; }
605- // ...
606-
607- Mod+Shift+Page_Down { move-workspace-down; }
608- Mod+Shift+Page_Up { move-workspace-up; }
609- Mod+Shift+U { move-workspace-down; }
610- Mod+Shift+I { move-workspace-up; }
611-
612- // You can bind mouse wheel scroll ticks using the following syntax.
613- // These binds will change direction based on the natural-scroll setting.
614- //
615- // To avoid scrolling through workspaces really fast, you can use
616- // the cooldown-ms property. The bind will be rate-limited to this value.
617- // You can set a cooldown on any bind, but it's most useful for the wheel.
618- Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
619- Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
620- Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
621- Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
622-
623- Mod+WheelScrollRight { focus-column-right; }
624- Mod+WheelScrollLeft { focus-column-left; }
625- Mod+Ctrl+WheelScrollRight { move-column-right; }
626- Mod+Ctrl+WheelScrollLeft { move-column-left; }
627-
628- // Usually scrolling up and down with Shift in applications results in
629- // horizontal scrolling; these binds replicate that.
630- Mod+Shift+WheelScrollDown { focus-column-right; }
631- Mod+Shift+WheelScrollUp { focus-column-left; }
632- Mod+Ctrl+Shift+WheelScrollDown { move-column-right; }
633- Mod+Ctrl+Shift+WheelScrollUp { move-column-left; }
634-
635- // Similarly, you can bind touchpad scroll "ticks".
636- // Touchpad scrolling is continuous, so for these binds it is split into
637- // discrete intervals.
638- // These binds are also affected by touchpad's natural-scroll, so these
639- // example binds are "inverted", since we have natural-scroll enabled for
640- // touchpads by default.
641- // Mod+TouchpadScrollDown { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02+"; }
642- // Mod+TouchpadScrollUp { spawn-sh "wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.02-"; }
643-
644- // You can refer to workspaces by index. However, keep in mind that
645- // niri is a dynamic workspace system, so these commands are kind of
646- // "best effort". Trying to refer to a workspace index bigger than
647- // the current workspace count will instead refer to the bottommost
648- // (empty) workspace.
649- //
650- // For example, with 2 workspaces + 1 empty, indices 3, 4, 5 and so on
651- // will all refer to the 3rd workspace.
652 Mod+1 { focus-workspace 1; }285 Mod+1 { focus-workspace 1; }
653 Mod+2 { focus-workspace 2; }286 Mod+2 { focus-workspace 2; }
654 Mod+3 { focus-workspace 3; }287 Mod+3 { focus-workspace 3; }
@@ -660,8 +293,6 @@ binds {
660 Mod+9 { focus-workspace 9; }293 Mod+9 { focus-workspace 9; }
661 Mod+0 { focus-workspace 10; }294 Mod+0 { focus-workspace 10; }
662 295
663- // Hyprland used SUPER+SHIFT+N to send a window to workspace N; the stock
664- // niri Mod+Ctrl+N binds below do the same thing and are kept as well.
665 Mod+Shift+1 { move-column-to-workspace 1; }296 Mod+Shift+1 { move-column-to-workspace 1; }
666 Mod+Shift+2 { move-column-to-workspace 2; }297 Mod+Shift+2 { move-column-to-workspace 2; }
667 Mod+Shift+3 { move-column-to-workspace 3; }298 Mod+Shift+3 { move-column-to-workspace 3; }
@@ -683,122 +314,61 @@ binds {
683 Mod+Ctrl+8 { move-column-to-workspace 8; }314 Mod+Ctrl+8 { move-column-to-workspace 8; }
684 Mod+Ctrl+9 { move-column-to-workspace 9; }315 Mod+Ctrl+9 { move-column-to-workspace 9; }
685 316
686- // Alternatively, there are commands to move just a single window:317+ Mod+Page_Down { focus-workspace-down; }
687- // Mod+Ctrl+1 { move-window-to-workspace 1; }318+ Mod+Page_Up { focus-workspace-up; }
688-319+ Mod+U { focus-workspace-down; }
689- // Switches focus between the current and the previous workspace.320+ Mod+I { focus-workspace-up; }
690- // Mod+Tab { focus-workspace-previous; }321+ Mod+Ctrl+Page_Down { move-column-to-workspace-down; }
691-322+ Mod+Ctrl+Page_Up { move-column-to-workspace-up; }
692- // The following binds move the focused window in and out of a column.323+ Mod+Ctrl+U { move-column-to-workspace-down; }
693- // If the window is alone, they will consume it into the nearby column to the side.324+ Mod+Ctrl+I { move-column-to-workspace-up; }
694- // If the window is already in a column, they will expel it out.325+ Mod+Shift+Page_Down { move-workspace-down; }
695- Mod+BracketLeft { consume-or-expel-window-left; }326+ Mod+Shift+Page_Up { move-workspace-up; }
696- Mod+BracketRight { consume-or-expel-window-right; }327+ Mod+Shift+U { move-workspace-down; }
697-328+ Mod+Shift+I { move-workspace-up; }
698- // Consume one window from the right to the bottom of the focused column.
699- Mod+Comma { consume-window-into-column; }
700- // Expel the bottom window from the focused column to the right.
701- Mod+Period { expel-window-from-column; }
702-
703- // Cycle through widths set in preset-column-widths.
704- Mod+R { switch-preset-column-width; }
705- // Cycling through the presets in reverse order is also possible.
706- Mod+Shift+R { switch-preset-column-width-back; }
707 329
708- Mod+Ctrl+Shift+R { switch-preset-window-height; }330+ // ─── scroll wheel ───────────────────────────────────────────────────────
709- Mod+Ctrl+R { reset-window-height; }331+ Mod+WheelScrollDown cooldown-ms=150 { focus-workspace-down; }
332+ Mod+WheelScrollUp cooldown-ms=150 { focus-workspace-up; }
333+ Mod+Ctrl+WheelScrollDown cooldown-ms=150 { move-column-to-workspace-down; }
334+ Mod+Ctrl+WheelScrollUp cooldown-ms=150 { move-column-to-workspace-up; }
335+ Mod+WheelScrollRight { focus-column-right; }
336+ Mod+WheelScrollLeft { focus-column-left; }
337+ Mod+Ctrl+WheelScrollRight { move-column-right; }
338+ Mod+Ctrl+WheelScrollLeft { move-column-left; }
339+ Mod+Shift+WheelScrollDown { focus-column-right; }
340+ Mod+Shift+WheelScrollUp { focus-column-left; }
341+ Mod+Ctrl+Shift+WheelScrollDown { move-column-right; }
342+ Mod+Ctrl+Shift+WheelScrollUp { move-column-left; }
710 343
711- // Hyprland togglefloating lived on Super+F, so maximize moves to Mod+M below.344+ // ─── size / layout ──────────────────────────────────────────────────────
345+ // Mod+F is floating (Hyprland togglefloating), so maximize is Mod+Ctrl+M.
346+ // Mod+Shift+arrows are Hyprland's resizeactive 30 / -30, in logical pixels.
712 Mod+F { toggle-window-floating; }347 Mod+F { toggle-window-floating; }
713 Mod+Shift+F { fullscreen-window; }348 Mod+Shift+F { fullscreen-window; }
714-
715- // While maximize-column leaves gaps and borders around the window,
716- // maximize-window-to-edges doesn't: the window expands to the edges of the screen.
717- // This bind corresponds to normal window maximizing,
718- // e.g. by double-clicking on the titlebar.
719- // Hyprland kept the monitor menu on Super+M, so maximize sits on Mod+Ctrl+M.
720- Mod+M { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh"; }
721- Mod+Shift+M { spawn-sh "~/.config/scripts/niri/toggle_monitors.sh on"; }
722 Mod+Ctrl+M { maximize-column; }349 Mod+Ctrl+M { maximize-column; }
723-
724- // Expand the focused column to space not taken up by other fully visible columns.
725- // Makes the column "fill the rest of the space".
726 Mod+Ctrl+F { expand-column-to-available-width; }350 Mod+Ctrl+F { expand-column-to-available-width; }
351+ Mod+Shift+V { switch-focus-between-floating-and-tiling; }
727 352
728- Mod+C { center-column; }
729-
730- // Center all fully visible columns on screen.
731- Mod+Ctrl+C { center-visible-columns; }
732-
733- // Finer width adjustments.
734- // This command can also:
735- // * set width in pixels: "1000"
736- // * adjust width in pixels: "-5" or "+5"
737- // * set width as a percentage of screen width: "25%"
738- // * adjust width as a percentage of screen width: "-10%" or "+10%"
739- // Pixel sizes use logical, or scaled, pixels. I.e. on an output with scale 2.0,
740- // set-column-width "100" will make the column occupy 200 physical screen pixels.
741- Mod+Minus { set-column-width "-10%"; }
742- Mod+Equal { set-column-width "+10%"; }
743-
744- // Finer height adjustments when in column with other windows.
745- Mod+Shift+Minus { set-window-height "-10%"; }
746- Mod+Shift+Equal { set-window-height "+10%"; }
747-
748- // Hyprland resizeactive 30 0 / 0 30, in logical pixels.
749 Mod+Shift+Right { set-column-width "+30"; }353 Mod+Shift+Right { set-column-width "+30"; }
750 Mod+Shift+Left { set-column-width "-30"; }354 Mod+Shift+Left { set-column-width "-30"; }
751 Mod+Shift+Up { set-window-height "-30"; }355 Mod+Shift+Up { set-window-height "-30"; }
752 Mod+Shift+Down { set-window-height "+30"; }356 Mod+Shift+Down { set-window-height "+30"; }
357+ Mod+Minus { set-column-width "-10%"; }
358+ Mod+Equal { set-column-width "+10%"; }
359+ Mod+Shift+Minus { set-window-height "-10%"; }
360+ Mod+Shift+Equal { set-window-height "+10%"; }
753 361
754- // Move the focused window between the floating and the tiling layout.362+ Mod+R { switch-preset-column-width; }
755- // Mod+V is dropped: Mod+F already toggles floating.363+ Mod+Shift+R { switch-preset-column-width-back; }
756- Mod+Shift+V { switch-focus-between-floating-and-tiling; }364+ Mod+Ctrl+R { reset-window-height; }
757-365+ Mod+Ctrl+Shift+R { switch-preset-window-height; }
758- // Hyprland cyclenext / workspace previous_per_monitor.
759- Mod+Tab { focus-window-previous; }
760- Alt+Tab { focus-workspace-previous; }
761 366
762- // Toggle tabbed column display mode.367+ Mod+C { center-column; }
763- // Windows in this column will appear as vertical tabs,368+ Mod+Ctrl+C { center-visible-columns; }
764- // rather than stacked on top of each other.369+ Mod+BracketLeft { consume-or-expel-window-left; }
765- // Hyprland had the wallpaper picker on Super+W; tabbed display moves aside.370+ Mod+BracketRight { consume-or-expel-window-right; }
766- Mod+W hotkey-overlay-title="Wallpaper picker" { spawn-sh "~/.config/scripts/niri/wallpaper_picker.sh"; }371+ Mod+Comma { consume-window-into-column; }
372+ Mod+Period { expel-window-from-column; }
767 Mod+Ctrl+W { toggle-column-tabbed-display; }373 Mod+Ctrl+W { toggle-column-tabbed-display; }
768-
769- // Actions to switch layouts.
770- // Note: if you uncomment these, make sure you do NOT have
771- // a matching layout switch hotkey configured in xkb options above.
772- // Having both at once on the same hotkey will break the switching,
773- // since it will switch twice upon pressing the hotkey (once by xkb, once by niri).
774- // Mod+Space { switch-layout "next"; }
775- // Mod+Shift+Space { switch-layout "prev"; }
776-
777- // grim/slurp instead of niri's built-in screenshot actions: the Hyprland
778- // bind captured ALL outputs into one image, while screenshot-screen only
779- // captures the focused one.
780- Print { spawn-sh "grim -t png - | tee \"$HOME/Pictures/Screenshots/$(date '+%y%m%d_%H-%M-%S').png\" | wl-copy -t image/png"; }
781- Shift+Print { spawn-sh "grim -t png -g \"$(slurp)\" - | wl-copy -t image/png"; }
782- Ctrl+Print { screenshot-screen; }
783- Alt+Print { screenshot-window; }
784-
785- // Applications such as remote-desktop clients and software KVM switches may
786- // request that niri stops processing the keyboard shortcuts defined here
787- // so they may, for example, forward the key presses as-is to a remote machine.
788- // It's a good idea to bind an escape hatch to toggle the inhibitor,
789- // so a buggy application can't hold your session hostage.
790- //
791- // The allow-inhibiting=false property can be applied to other binds as well,
792- // which ensures niri always processes them, even when an inhibitor is active.
793- // Mod+Escape is the power menu (see above), so the shortcut inhibitor
794- // escape hatch lives on Mod+Shift+Escape instead.
795- Mod+Shift+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
796-
797- // Exit is only Super+Alt+F4, same as Hyprland. The stock Mod+Shift+E and
798- // Ctrl+Alt+Delete quit binds are removed on purpose.
799- Mod+Alt+F4 { quit; }
800-
801- // Powers off the monitors. To turn them back on, do any input like
802- // moving the mouse or pressing any other key.
803- // No power-off-monitors bind: the monitor menu on Mod+M covers it.
804 }374 }
.config/scripts/niri/monitors.shadded+9 -0
@@ -0,0 +1,9 @@
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+
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
.config/scripts/niri/toggle_monitors.shmodified+11 -12
@@ -10,33 +10,32 @@
10 # entries below disable rather than blank.10 # entries below disable rather than blank.
11 set -euo pipefail11 set -euo pipefail
12 12
13-DP1="DP-1"13+. "$(dirname "$(realpath "$0")")/monitors.sh"
14-HDMI="HDMI-A-1"
15 14
16 all_on() {15 all_on() {
17 niri msg action power-on-monitors16 niri msg action power-on-monitors
18- niri msg output "$DP1" on17+ niri msg output "$LEFT_MONITOR" on
19- niri msg output "$HDMI" on18+ niri msg output "$RIGHT_MONITOR" on
20 }19 }
21 20
22 case "${1:-menu}" in21 case "${1:-menu}" in
23 menu)22 menu)
24 choice=$(printf '%s\n' \23 choice=$(printf '%s\n' \
25 "🖥️ All Monitors Off (blank, any key wakes)" \24 "🖥️ All Monitors Off (blank, any key wakes)" \
26- "🖥️ DP-1 Off (disable)" \25+ "🖥️ $LEFT_MONITOR Off (disable)" \
27- "🖥️ HDMI-A-1 Off (disable)" \26+ "🖥️ $RIGHT_MONITOR Off (disable)" \
28 "💡 All Monitors On" \27 "💡 All Monitors On" \
29- "💡 DP-1 On" \28+ "💡 $LEFT_MONITOR On" \
30- "💡 HDMI-A-1 On" \29+ "💡 $RIGHT_MONITOR On" \
31 "❌ Cancel" | rofi -dmenu -p "Monitors" -i)30 "❌ Cancel" | rofi -dmenu -p "Monitors" -i)
32 31
33 case "$choice" in32 case "$choice" in
34 "🖥️ All Monitors Off"*) niri msg action power-off-monitors ;;33 "🖥️ All Monitors Off"*) niri msg action power-off-monitors ;;
35- "🖥️ DP-1 Off"*) niri msg output "$DP1" off ;;34+ "🖥️ $LEFT_MONITOR Off"*) niri msg output "$LEFT_MONITOR" off ;;
36- "🖥️ HDMI-A-1 Off"*) niri msg output "$HDMI" off ;;35+ "🖥️ $RIGHT_MONITOR Off"*) niri msg output "$RIGHT_MONITOR" off ;;
37 "💡 All Monitors On"*) all_on ;;36 "💡 All Monitors On"*) all_on ;;
38- "💡 DP-1 On"*) niri msg output "$DP1" on ;;37+ "💡 $LEFT_MONITOR On"*) niri msg output "$LEFT_MONITOR" on ;;
39- "💡 HDMI-A-1 On"*) niri msg output "$HDMI" on ;;38+ "💡 $RIGHT_MONITOR On"*) niri msg output "$RIGHT_MONITOR" on ;;
40 *) ;;39 *) ;;
41 esac40 esac
42 ;;41 ;;
.config/scripts/shared/webapp.shadded+52 -0
@@ -0,0 +1,52 @@
1+#!/usr/bin/env bash
2+# Launch a Chromium web app (github, whatsapp, deezer, mail, ...).
3+#
4+# usage: webapp.sh [--mullvad] <url> <profile-id>
5+#
6+# --mullvad route outside the VPN via mullvad-exclude
7+# <url> app URL, e.g. https://github.com/
8+# <profile-id> directory name under the web-app-hub profiles dir
9+#
10+# The window class is derived from the URL host as chrome-<host>__-Default,
11+# which is what Chromium itself would generate — it has to match, since that is
12+# the app-id niri and waybar see.
13+#
14+# Compositor-agnostic: usable from niri binds and Hyprland binds alike.
15+set -euo pipefail
16+
17+BROWSER_ID="io.github.ungoogled_software.ungoogled_chromium"
18+PROFILES="$HOME/.var/app/$BROWSER_ID/data/web-app-hub/profiles"
19+
20+MULLVAD=0
21+if [ "${1:-}" = "--mullvad" ]; then
22+ MULLVAD=1
23+ shift
24+fi
25+
26+URL="${1:?usage: webapp.sh [--mullvad] <url> <profile-id>}"
27+PROFILE="${2:?usage: webapp.sh [--mullvad] <url> <profile-id>}"
28+
29+# https://web.whatsapp.com/foo -> web.whatsapp.com
30+HOST="${URL#*://}"
31+HOST="${HOST%%/*}"
32+CLASS="chrome-${HOST}__-Default"
33+
34+cmd=(flatpak run "$BROWSER_ID"
35+ --no-first-run
36+ --app="$URL"
37+ --class="$CLASS"
38+ --name="$CLASS"
39+ --user-data-dir="$PROFILES/$PROFILE")
40+
41+if [ "$MULLVAD" -eq 1 ]; then
42+ cmd=(mullvad-exclude "${cmd[@]}")
43+fi
44+
45+# --dry-run prints the command instead of running it, for verification.
46+if [ "${DRY_RUN:-0}" = "1" ]; then
47+ printf '%q ' "${cmd[@]}"
48+ printf '\n'
49+ exit 0
50+fi
51+
52+exec "${cmd[@]}"