confix/modules/home-manager/river.nix.bak

196 lines
9.2 KiB
Nix

{ pkgs, config, ... }:
{
xdg.configFile = {
"river/init" = {
enable = true;
executable = true;
text = ''
#!/usr/bin/env sh
# See the river(1), riverctl(1), and rivertile(1) man pages for complete
# documentation.
# Variables
TERMINAL="foot"
LOCKSCREEN="swaylock"
# Autostart
riverctl spawn "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river"
riverctl spawn "systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river"
riverctl spawn "kanshi"
riverctl spawn "waybar"
riverctl spawn "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"
riverctl spawn "mako"
riverctl spawn "wl-paste --type text --watch cliphist store"
riverctl spawn "wl-paste --type image --watch cliphist store"
riverctl spawn "mullvad-gui"
riverctl spawn "nm-applet"
# Theme
riverctl background-color 0x282A36
riverctl border-color-focused 0xBD93F9
riverctl border-color-unfocused 0x282A36
# Launch Shortcuts
riverctl map normal Super Return spawn "$TERMINAL tmux.sh"
riverctl map normal Super+Shift Return spawn "$TERMINAL"
riverctl map normal Super Space spawn 'wmenu.sh'
riverctl map normal Super+Shift S spawn 'grim -g "$(slurp)" - | swappy -f -'
riverctl map normal Super+Shift V spawn "cliphist list | bemenu -p 'Cliphist ' -l 10 | cliphist decode | wl-copy"
# Focus Controls
riverctl map normal Super H focus-view previous
riverctl map normal Super J focus-view next
riverctl map normal Super K focus-view previous
riverctl map normal Super L focus-view next
riverctl map normal Alt Tab focus-view next
riverctl map normal Alt+Shift Tab focus-view previous
riverctl map normal Super P focus-previous-tags
riverctl map normal Super Tab focus-output next
riverctl map normal Super U focus-output next
riverctl map normal Super+Shift U send-to-output next
# Move Controls
riverctl map normal Super+Shift H swap previous
riverctl map normal Super+Shift J swap next
riverctl map normal Super+Shift K swap previous
riverctl map normal Super+Shift L swap next
riverctl map normal Super+Shift Space zoom
riverctl map normal Super+Shift P send-to-previous-tags
riverctl map normal Super+Shift Tab send-to-output next
# Layout Controls
riverctl map normal Super+Alt H send-layout-cmd rivertile "main-ratio -0.05"
riverctl map normal Super+Alt L send-layout-cmd rivertile "main-ratio +0.05"
riverctl map normal Super I send-layout-cmd rivertile "main-count +1"
riverctl map normal Super+Shift I send-layout-cmd rivertile "main-count -1"
riverctl map normal Super Up send-layout-cmd rivertile "main-location top"
riverctl map normal Super Right send-layout-cmd rivertile "main-location right"
riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom"
riverctl map normal Super Left send-layout-cmd rivertile "main-location left"
# Floating Controls
riverctl map normal Super+Shift F toggle-float
riverctl map normal Super+Control H move left 100
riverctl map normal Super+Control J move down 100
riverctl map normal Super+Control K move up 100
riverctl map normal Super+Control L move right 100
riverctl map normal Super+Shift+Control H snap left
riverctl map normal Super+Shift+Control J snap down
riverctl map normal Super+Shift+Control K snap up
riverctl map normal Super+Shift+Control L snap right
riverctl map normal Super+Alt+Shift H resize horizontal -100
riverctl map normal Super+Alt+Shift J resize vertical 100
riverctl map normal Super+Alt+Shift K resize vertical -100
riverctl map normal Super+Alt+Shift L resize horizontal 100
riverctl map-pointer normal Super BTN_LEFT move-view
riverctl map-pointer normal Super BTN_RIGHT resize-view
# Close focused view
riverctl map normal Super W close
riverctl map normal Super Q close
# Exit River
riverctl map normal Super+Shift Q exit
for i in $(seq 1 9)
do
tags=$((1 << ($i - 1)))
# Super+[1-9] to focus tag [0-8]
riverctl map normal Super $i spawn "riverctl set-focused-tags $tags"
# Super+Shift+[1-9] to tag focused view with tag [0-8]
riverctl map normal Super+Shift $i spawn "riverctl set-view-tags $tags"
# Super+Control+[1-9] to toggle focus of tag [0-8]
riverctl map normal Super+Control $i spawn "riverctl toggle-focused-tags $tags"
# Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
riverctl map normal Super+Shift+Control $i spawn "riverctl toggle-view-tags $tags"
done
MINIMIZED=$((1 << 20 ))
riverctl map normal Super M toggle-focused-tags ''${MINIMIZED}
riverctl map normal Super+Shift M set-view-tags ''${MINIMIZED}
ALL_BUT_MINIMIZED=$(( ((1 << 32) - 1 ) ^ $MINIMIZED ))
riverctl spawn-tagmask ''${ALL_BUT_MINIMIZED}
# Super+0 to focus all tags
# Super+Shift+0 to tag focused view with all tags
all_tags=$(((1 << 32) - 1))
riverctl map normal Super 0 spawn "riverctl set-focused-tags $all_tags"
riverctl map normal Super+Shift 0 spawn "riverctl set-view-tags $all_tags"
# Toggle fullscreen
riverctl map normal None F11 toggle-fullscreen
riverctl map normal Super F toggle-fullscreen
# Passthrough Mode
riverctl declare-mode passthrough
riverctl map normal Super F11 enter-mode passthrough
riverctl map passthrough Super F11 enter-mode normal
# Command Mode
riverctl declare-mode command
riverctl map normal Super B enter-mode command
riverctl map command None+Shift Comma spawn 'playerctl previous'
riverctl map command None Space spawn 'playerctl play-pause'
riverctl map command None+Shift Period spawn 'playerctl next'
riverctl map command None 1 spawn 'mullvad-browser'
riverctl map command None 2 spawn 'librewolf'
riverctl map command None 3 spawn 'libreoffice'
riverctl map command None 4 spawn 'thunderbird'
riverctl map command None 5 spawn 'discord'
riverctl map command None 6 spawn 'signal-desktop'
riverctl map command None 9 spawn 'steam'
riverctl map command None Z spawn 'riverctl toggle-fullscreen; riverctl enter-mode normal'
riverctl map command None Escape enter-mode normal
# Various media key mapping examples for both normal and locked mode which do
# not have a modifier
for mode in normal locked
do
riverctl map $mode None XF86Eject spawn 'eject -T'
# Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5'
riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5'
riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute'
# Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause'
riverctl map $mode None XF86AudioPrev spawn 'playerctl previous'
riverctl map $mode None XF86AudioNext spawn 'playerctl next'
# Control screen backlight brightness with light (https://github.com/haikarainen/light)
riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5'
riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5'
done
# Set keyboard repeat rate
riverctl set-repeat 50 300
# Make all views with an app-id that starts with "float" and title "foo" start floating.
riverctl rule-add -app-id 'float*' -title 'foo' float
# Make all views with app-id "bar" and any title use client-side decorations
riverctl rule-add -app-id "bar" csd
# Global Configuration Settings
riverctl default-layout rivertile
rivertile -view-padding 10 -outer-padding 10 &
riverctl attach-mode bottom
riverctl hide-cursor timeout 10000
riverctl hide-cursor when-typing enabled
riverctl set-cursor-warp on-focus-change
riverctl focus-follows-cursor always
riverctl focus-output DP-1
riverctl send-layout-cmd rivertile "main-location right"
riverctl focus-output DP-2
riverctl send-layout-cmd rivertile "main-location left"
'';
};
};
}