confix/modules/home-manager/river.nix
2024-03-02 16:57:38 -08:00

203 lines
9.3 KiB
Nix

{ pkgs, config, ... }:
{
wayland.windowManager.river = {
enable = true;
extraSessionVariables = {
MINIMIZED = "$((1 << 20))";
ALL_TAGS = "$(((1 << 32) - 1))";
ALL_BUT_MINIMIZED = "$(( ((1 << 32) - 1 ) ^ $MINIMIZED ))";
};
settings = {
background-color = "0x282A36";
border-color-focused = "0xBD93F9";
border-color-unfocused = "0x282A36";
border-width = 2;
declare-mode = [
"locked"
"normal"
"passthrough"
"command"
];
set-repeat = "50 300";
default-layout = "rivertile";
attach-mode = "bottom";
hide-cursor = {
timeout = "10000";
when-typing = "enabled";
};
set-cursor-warp = "on-focus-change";
focus-follows-cursor = "always";
rule-add = {
"'bar'" = "csd";
"-app-id" = {
"'float*'" = {
"-title" = {
"'foo'" = "float";
};
};
};
};
spawn = [
"'dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river'"
"'systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river'"
"kanshi"
"waybar"
"'river-tag-overlay --border-width 0 --square-inactive-background-colour 0x282A36 --square-inactive-border-colour 0x282A36 --square-padding 0 --square-inner-padding 4 --square-size 18 --anchors 1:0:0:1 --timeout 2000'"
"mako"
"'wl-paste --type text --watch cliphist store'"
"'wl-paste --type image --watch cliphist store'"
"mullvad-gui"
"nm-applet"
];
map-pointer = {
normal = {
"Super BTN_LEFT" = "move-view";
"Super BTN_RIGHT" = "resize-view";
};
};
map = {
command = {
"None 1" = "spawn 'mullvad-browser'";
"None 2" = "spawn 'librewolf'";
"None 3" = "spawn 'libreoffice'";
"None 4" = "spawn 'thunderbird'";
"None 5" = "spawn 'discord'";
"None 6" = "spawn 'signal-desktop'";
"None 9" = "spawn 'steam'";
"None Z" = "spawn 'riverctl toggle-fullscreen; riverctl enter-mode normal'";
"None+Shift Comma" = "spawn 'playerctl previous; riverctl enter-mode normal'";
"None Space" = "spawn 'playerctl play-pause; riverctl enter-mode normal'";
"None+Shift Period" = "spawn 'playerctl next; riverctl enter-mode normal'";
"None Escape" = "enter-mode normal";
};
locked = {
"None XF86Eject" = "spawn 'eject -T'";
"None XF86AudioRaiseVolume" = "spawn 'pamixer -i 5'";
"None XF86AudioLowerVolume" = "spawn 'pamixer -d 5'";
"None XF86AudioMute" = "spawn 'pamixer --toggle-mute'";
"None XF86AudioMedia" = "spawn 'playerctl play-pause'";
"None XF86AudioPlay" = "spawn 'playerctl play-pause'";
"None XF86AudioPrev" = "spawn 'playerctl previous'";
"None XF86AudioNext" = "spawn 'playerctl next'";
"None XF86MonBrightnessUp" = "spawn 'light -A 5'";
"None XF86MonBrightnessDown" = "spawn 'light -U 5'";
};
normal = {
# Launch Shortcuts
"Super Return" = "spawn 'foot tmux.sh'";
"Super+Shift Return" = "spawn foot";
"Super Space" = "spawn 'wmenu.sh'";
"Super+Shift S" = "spawn 'grim -g $(slurp) - | swappy -f -'";
"Super+Shift V" = "spawn 'cliphist list | bemenu -p Cliphist -l 10 | cliphist decode | wl-copy'";
# Focus Controls
"Super H" = "focus-view previous";
"Super J" = "focus-view next";
"Super K" = "focus-view previous";
"Super L" = "focus-view next";
"Alt Tab" = "focus-view next";
"Alt+Shift Tab" = "focus-view previous";
"Super P" = "focus-previous-tags";
"Super Tab" = "focus-output next";
"Super U" = "focus-output next";
"Super+Shift U" = "send-to-output next";
# Move Controls
"Super+Shift H" = "swap previous";
"Super+Shift J" = "swap next";
"Super+Shift K" = "swap previous";
"Super+Shift L" = "swap next";
"Super+Shift Space" = "zoom";
"Super+Shift P" = "send-to-previous-tags";
"Super+Shift Tab" = "send-to-output next";
# Layout Controls
"Super+Alt H" = "send-layout-cmd rivertile 'main-ratio -0.05'";
"Super+Alt L" = "send-layout-cmd rivertile 'main-ratio +0.05'";
"Super I" = "send-layout-cmd rivertile 'main-count +1'";
"Super+Shift I" = "send-layout-cmd rivertile 'main-count -1'";
"Super Up" = "send-layout-cmd rivertile 'main-location top'";
"Super Right" = "send-layout-cmd rivertile 'main-location right'";
"Super Down" = "send-layout-cmd rivertile 'main-location bottom'";
"Super Left" = "send-layout-cmd rivertile 'main-location left'";
# Floating Controls
"Super+Shift F" = "toggle-float";
"Super+Control H" = "move left 100";
"Super+Control J" = "move down 100";
"Super+Control K" = "move up 100";
"Super+Control L" = "move right 100";
"Super+Shift+Control H" = "snap left";
"Super+Shift+Control J" = "snap down";
"Super+Shift+Control K" = "snap up";
"Super+Shift+Control L" = "snap right";
"Super+Alt+Shift H" = "resize horizontal -100";
"Super+Alt+Shift J" = "resize vertical 100";
"Super+Alt+Shift K" = "resize vertical -100";
"Super+Alt+Shift L" = "resize horizontal 100";
"Super W" = "close";
"Super Q" = "close";
"Super+Shift Q" ="exit";
"Super 1" = "spawn 'riverctl set-focused-tags 1'";
"Super 2" = "spawn 'riverctl set-focused-tags 2'";
"Super 3" = "spawn 'riverctl set-focused-tags 4'";
"Super 4" = "spawn 'riverctl set-focused-tags 8'";
"Super 5" = "spawn 'riverctl set-focused-tags 16'";
"Super 6" = "spawn 'riverctl set-focused-tags 32'";
"Super 7" = "spawn 'riverctl set-focused-tags 64'";
"Super 8" = "spawn 'riverctl set-focused-tags 128'";
"Super 9" = "spawn 'riverctl set-focused-tags 256'";
"Super+Shift 1" = "spawn 'riverctl set-view-tags 1'";
"Super+Shift 2" = "spawn 'riverctl set-view-tags 2'";
"Super+Shift 3" = "spawn 'riverctl set-view-tags 4'";
"Super+Shift 4" = "spawn 'riverctl set-view-tags 8'";
"Super+Shift 5" = "spawn 'riverctl set-view-tags 16'";
"Super+Shift 6" = "spawn 'riverctl set-view-tags 32'";
"Super+Shift 7" = "spawn 'riverctl set-view-tags 64'";
"Super+Shift 8" = "spawn 'riverctl set-view-tags 128'";
"Super+Shift 9" = "spawn 'riverctl set-view-tags 256'";
"Super+Control 1" = "spawn 'riverctl toggle-focused-tags 1'";
"Super+Control 2" = "spawn 'riverctl toggle-focused-tags 2'";
"Super+Control 3" = "spawn 'riverctl toggle-focused-tags 4'";
"Super+Control 4" = "spawn 'riverctl toggle-focused-tags 8'";
"Super+Control 5" = "spawn 'riverctl toggle-focused-tags 16'";
"Super+Control 6" = "spawn 'riverctl toggle-focused-tags 32'";
"Super+Control 7" = "spawn 'riverctl toggle-focused-tags 64'";
"Super+Control 8" = "spawn 'riverctl toggle-focused-tags 128'";
"Super+Control 9" = "spawn 'riverctl toggle-focused-tags 256'";
"Super+Shift+Control 1" = "spawn 'riverctl toggle-view-tags 1'";
"Super+Shift+Control 2" = "spawn 'riverctl toggle-view-tags 2'";
"Super+Shift+Control 3" = "spawn 'riverctl toggle-view-tags 4'";
"Super+Shift+Control 4" = "spawn 'riverctl toggle-view-tags 8'";
"Super+Shift+Control 5" = "spawn 'riverctl toggle-view-tags 16'";
"Super+Shift+Control 6" = "spawn 'riverctl toggle-view-tags 32'";
"Super+Shift+Control 7" = "spawn 'riverctl toggle-view-tags 64'";
"Super+Shift+Control 8" = "spawn 'riverctl toggle-view-tags 128'";
"Super+Shift+Control 9" = "spawn 'riverctl toggle-view-tags 256'";
"Super 0" = "spawn 'riverctl set-focused-tags $ALL_TAGS'";
"Super+Shift 0" = "spawn 'riverctl set-view-tags $ALL_TAGS'";
"Super M" = "toggle-focused-tags $MINIMIZED";
"Super+Shift M" = "set-view-tags $MINIMIZED";
"None F11" = "toggle-fullscreen";
"Super F" = "toggle-fullscreen";
"None XF86Eject" = "spawn 'eject -T'";
"None XF86AudioRaiseVolume" = "spawn 'pamixer -i 5'";
"None XF86AudioLowerVolume" = "spawn 'pamixer -d 5'";
"None XF86AudioMute" = "spawn 'pamixer --toggle-mute'";
"None XF86AudioMedia" = "spawn 'playerctl play-pause'";
"None XF86AudioPlay" = "spawn 'playerctl play-pause'";
"None XF86AudioPrev" = "spawn 'playerctl previous'";
"None XF86AudioNext" = "spawn 'playerctl next'";
"None XF86MonBrightnessUp" = "spawn 'light -A 5'";
"None XF86MonBrightnessDown" = "spawn 'light -U 5'";
"Super F11" = "enter-mode passthrough";
"Super B" = "enter-mode command";
};
passthrough = {
"Super F11" = "enter-mode normal";
};
};
};
extraConfig = ''
riverctl spawn-tagmask ''${ALL_BUT_MINIMIZED}
rivertile -view-padding 10 -outer-padding 10 &
'';
};
}