Skip to content

Commit dafb031

Browse files
committed
Update configs for Niri >=25.02
1 parent ca8f0d3 commit dafb031

File tree

3 files changed

+86
-24
lines changed

3 files changed

+86
-24
lines changed

dotfiles/niri_config/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ ln -s ~/.config/systemd/user/swaybg.service ~/.config/systemd/user/ni
4343
ln -s /usr/lib/systemd/user/waybar.service ~/.config/systemd/user/niri.service.wants/
4444
ln -s ~/.config/systemd/user/wlsunset.service ~/.config/systemd/user/niri.service.wants/
4545
ln -s ~/.config/systemd/user/ydotool.service ~/.config/systemd/user/niri.service.wants/
46-
ln -s /usr/lib/systemd/user/xwayland-satellite.service ~/.config/systemd/user/niri.servuce.wants/
46+
ln -s /usr/lib/systemd/user/xwayland-satellite.service ~/.config/systemd/user/niri.service.wants/
4747
```
4848
4. Other settings:
4949

@@ -62,4 +62,4 @@ https://github.com/YaLTeR/niri/wiki/Example-systemd-Setup
6262
https://github.com/YaLTeR/niri/wiki/Important-Software
6363

6464
Debug or view log:
65-
`sudo systemctl status waybar`
65+
`systemctl --user status waybar`

dotfiles/niri_config/niri/config.kdl

+80-20
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,8 @@ input {
2525
// For more information, see xkeyboard-config(7).
2626

2727
// For example:
28-
// layout "us,ru"
29-
// options "grp:win_space_toggle,compose:ralt,ctrl:nocaps"
3028
layout "us,ru"
31-
options "grp:win_space_toggle,grp:alt_shift_toggle,grp_led:scroll"
32-
29+
options "grp:alt_shift_toggle,grp_led:scroll"
3330
}
3431
track-layout "window"
3532
}
@@ -41,6 +38,7 @@ input {
4138
tap
4239
dwt
4340
dwtp
41+
// drag-lock
4442
natural-scroll
4543
// accel-speed 0.2
4644
// accel-profile "flat"
@@ -211,6 +209,43 @@ layout {
211209
// inactive-gradient from="#505050" to="#808080" angle=45 relative-to="workspace-view"
212210
}
213211

212+
// You can enable drop shadows for windows.
213+
shadow {
214+
// Uncomment the next line to enable shadows.
215+
// on
216+
217+
// By default, the shadow draws only around its window, and not behind it.
218+
// Uncomment this setting to make the shadow draw behind its window.
219+
//
220+
// Note that niri has no way of knowing about the CSD window corner
221+
// radius. It has to assume that windows have square corners, leading to
222+
// shadow artifacts inside the CSD rounded corners. This setting fixes
223+
// those artifacts.
224+
//
225+
// However, instead you may want to set prefer-no-csd and/or
226+
// geometry-corner-radius. Then, niri will know the corner radius and
227+
// draw the shadow correctly, without having to draw it behind the
228+
// window. These will also remove client-side shadows if the window
229+
// draws any.
230+
//
231+
// draw-behind-window true
232+
233+
// You can change how shadows look. The values below are in logical
234+
// pixels and match the CSS box-shadow properties.
235+
236+
// Softness controls the shadow blur radius.
237+
softness 30
238+
239+
// Spread expands the shadow.
240+
spread 5
241+
242+
// Offset moves the shadow relative to the window.
243+
offset x=0 y=5
244+
245+
// You can also change the shadow color and opacity.
246+
color "#0007"
247+
}
248+
214249
// Struts shrink the area occupied by windows, similarly to layer-shell panels.
215250
// You can think of them as a kind of outer gaps. They are set in logical pixels.
216251
// Left and right struts will cause the next window to the side to always be visible.
@@ -366,6 +401,8 @@ window-rule {
366401
// block-out-from "screencast"
367402
}
368403

404+
// Example: enable rounded corners for all windows.
405+
// (This example rule is commented out with a "/-" in front.)
369406
window-rule {
370407
geometry-corner-radius 12
371408
clip-to-geometry true
@@ -400,22 +437,28 @@ binds {
400437
// Note: the entire command goes as a single argument in the end.
401438
// Mod+T { spawn "bash" "-c" "notify-send hello && exec alacritty"; }
402439

403-
// XF86TouchpadToggle { spawn ; }
404-
XF86AudioMute { spawn "bash" "-c" "pactl set-sink-mute @DEFAULT_SINK@ toggle && notify-send -c \"system\" \" $(pactl get-sink-mute @DEFAULT_SINK@)\""; }
405-
XF86AudioRaiseVolume { spawn "bash" "-c" "pactl set-sink-volume @DEFAULT_SINK@ +5% && notify-send -c \"system\" \" $(pactl get-sink-volume @DEFAULT_SINK@ | head -1 | tr -s ' ' | cut -d ' ' -f1,5)\""; }
406-
XF86AudioLowerVolume { spawn "bash" "-c" "pactl set-sink-volume @DEFAULT_SINK@ -5% && notify-send -c \"system\" \" $(pactl get-sink-volume @DEFAULT_SINK@ | head -1 | tr -s ' ' | cut -d ' ' -f1,5)\""; }
407-
XF86MonBrightnessDown { spawn "bash" "-c" "brightnessctl -c backlight set 1- && notify-send -c \"system\" \" Brightness: $(brightnessctl -m | cut -d',' -f4)\""; }
408-
XF86MonBrightnessUp { spawn "bash" "-c" "brightnessctl -c backlight set +1 && notify-send -c \"system\" \" Brightness: $(brightnessctl -m | cut -d',' -f4)\""; }
409-
// XF86Display { spawn ; }
410-
// XF86Suspend { spawn ; }
440+
// Example volume keys mappings for PipeWire & WirePlumber.
441+
// The allow-when-locked=true property makes them work even when the session is locked.
442+
XF86AudioRaiseVolume allow-when-locked=true { spawn "bash" "-c" "pactl set-sink-volume @DEFAULT_SINK@ +5% && notify-send -c \"system\" \" $(pactl get-sink-volume @DEFAULT_SINK@ | head -1 | tr -s ' ' | cut -d ' ' -f1,5)\""; }
443+
XF86AudioLowerVolume allow-when-locked=true { spawn "bash" "-c" "pactl set-sink-volume @DEFAULT_SINK@ -5% && notify-send -c \"system\" \" $(pactl get-sink-volume @DEFAULT_SINK@ | head -1 | tr -s ' ' | cut -d ' ' -f1,5)\""; }
444+
XF86AudioMute allow-when-locked=true { spawn "bash" "-c" "pactl set-sink-mute @DEFAULT_SINK@ toggle && notify-send -c \"system\" \" $(pactl get-sink-mute @DEFAULT_SINK@)\""; }
445+
XF86AudioMicMute allow-when-locked=true { spawn "bash" "-c" "pactl set-sink-mute @DEFAULT_AUDIO_SOURCE@" "toggle"; }
446+
447+
XF86MonBrightnessDown allow-when-locked=true { spawn "bash" "-c" "brightnessctl -c backlight set 1- && notify-send -c \"system\" \" Brightness: $(brightnessctl -m | cut -d',' -f4)\""; }
448+
XF86MonBrightnessUp allow-when-locked=true { spawn "bash" "-c" "brightnessctl -c backlight set +1 && notify-send -c \"system\" \" Brightness: $(brightnessctl -m | cut -d',' -f4)\""; }
449+
// XF86Display allow-when-locked=true { spawn ; }
450+
// XF86Suspend allow-when-locked=true { spawn ; }
451+
// XF86TouchpadToggle allow-when-locked=true { spawn ; }
452+
411453
// Additional for VAIO laptops
412454
// Eject CD-ROM key
413-
XF86Eject { spawn "~/.config/waybar/modules/unmount.sh" "unmount"; }
455+
XF86Eject { spawn "~/.config/waybar/modules/unmount.sh" "unmount"; }
414456
// ASSIST key
415-
Help { spawn "playerctl" "play-pause"; }
457+
Help { spawn "playerctl" "play-pause"; }
416458
// WEB key
417-
XF86HomePage { spawn "playerctl" "next"; }
459+
XF86HomePage { spawn "playerctl" "next"; }
418460
// VAIO key has no press code
461+
419462
Mod+Q { close-window; }
420463

421464
Mod+Left { focus-column-left; }
@@ -573,6 +616,11 @@ binds {
573616
Mod+Ctrl+R { reset-window-height; }
574617
Mod+F { maximize-column; }
575618
Mod+Shift+F { fullscreen-window; }
619+
620+
// Expand the focused column to space not taken up by other fully visible columns.
621+
// Makes the column "fill the rest of the space".
622+
Mod+Ctrl+F { expand-column-to-available-width; }
623+
576624
Mod+C { center-column; }
577625

578626
// Finer width adjustments.
@@ -594,28 +642,40 @@ binds {
594642
Mod+V { toggle-window-floating; }
595643
Mod+Shift+V { switch-focus-between-floating-and-tiling; }
596644

645+
// Toggle tabbed column display mode.
646+
// Windows in this column will appear as vertical tabs,
647+
// rather than stacked on top of each other.
648+
Mod+W { toggle-column-tabbed-display; }
649+
597650
// Actions to switch layouts.
598651
// Note: if you uncomment these, make sure you do NOT have
599652
// a matching layout switch hotkey configured in xkb options above.
600653
// Having both at once on the same hotkey will break the switching,
601654
// since it will switch twice upon pressing the hotkey (once by xkb, once by niri).
602-
// Mod+Space { switch-layout "next"; }
603-
// Mod+Shift+Space { switch-layout "prev"; }
655+
Mod+Space { switch-layout "next"; }
656+
Mod+Shift+Space { switch-layout "prev"; }
604657

605658
Print { screenshot; }
606659
Ctrl+Print { screenshot-screen; }
607660
Alt+Print { screenshot-window; }
608661

662+
// Applications such as remote-desktop clients and software KVM switches may
663+
// request that niri stops processing the keyboard shortcuts defined here
664+
// so they may, for example, forward the key presses as-is to a remote machine.
665+
// It's a good idea to bind an escape hatch to toggle the inhibitor,
666+
// so a buggy application can't hold your session hostage.
667+
//
668+
// The allow-inhibiting=false property can be applied to other binds as well,
669+
// which ensures niri always processes them, even when an inhibitor is active.
670+
Mod+Escape allow-inhibiting=false { toggle-keyboard-shortcuts-inhibit; }
671+
609672
// The quit action will show a confirmation dialog to avoid accidental exits.
610673
Mod+Shift+E { quit; }
611674
Ctrl+Alt+Delete { quit; }
612675

613676
// Powers off the monitors. To turn them back on, do any input like
614677
// moving the mouse or pressing any other key.
615678
Mod+Shift+P { power-off-monitors; }
616-
617-
Mod+Ctrl+MouseLeft { close-window; }
618-
Mod+MouseMiddle { maximize-column; }
619679
}
620680

621681
hotkey-overlay {

dotfiles/niri_config/waybar/modules/updates.sh

+4-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ elif [ "$1" == "getnews" ]; then
3535
touch "$NEWS"
3636
rss_url="https://archlinux.org/feeds/news/"
3737
last_modified=$(curl -sIm3 "$rss_url" | grep -oP "^last-modified: \K[0-9A-Za-z,: ]+")
38-
if [[ -n "$last_modified" ]] && ! grep -q "$last_modified" "$NEWS"; then
38+
if [[ -n "${last_modified:-}" ]] && ! grep -q "$last_modified" "$NEWS"; then
3939
latestnews=$(curl -sm3 "$rss_url" | grep -Eo "<lastBuildDate>.*</title>" | sed -e 's/<[^>]*>/ /g;s/+0000 /GMT /g')
4040
if [[ -n "$latestnews" ]]; then
4141
echo "$latestnews" >"$NEWS"
@@ -45,5 +45,7 @@ elif [ "$1" == "getnews" ]; then
4545
fi
4646
# Working with updates
4747
paru -Syu
48-
[[ "$TERM_PROGRAM" != "kgx" ]] && read -n 1 -s -r -p "Press any key to exit..."
48+
if [[ "$TERM_PROGRAM" != "kgx" ]]; then
49+
read -n 1 -s -r -p "Press any key to exit..."
50+
fi
4951
fi

0 commit comments

Comments
 (0)