{ config, pkgs, ... }: let shell = "${pkgs.dash}/bin/dash"; riverctl = "${pkgs.river}/bin/riverctl"; rivertile = "${pkgs.river}/bin/rivertile"; foot = "${pkgs.foot}/bin/foot"; seq = "${pkgs.coreutils}/bin/seq"; in { home.file.river_init = { executable = true; target = "${config.xdg.configHome}/river/init"; text = '' # start an instance of foot ${riverctl} map normal Super Return spawn ${foot} # close the focused view ${riverctl} map normal Super+Shift C close # exit river ${riverctl} map normal Super+Shift Escape exit # focus next/previous ${riverctl} map normal Super J focus-view next ${riverctl} map normal Super K focus-view previous # swap next/previous ${riverctl} map normal Super+Shift J swap next ${riverctl} map normal Super+Shift K swap previous # bump focused view to the top of the stack layout ${riverctl} map normal Super+Shift Return zoom # increase/decrease the main ratio of rivertile ${riverctl} map normal Super H send-layout-cmd ${rivertile} "main-ratio -0.05" ${riverctl} map normal Super L send-layout-cmd ${rivertile} "main-ratio +0.05" # increase/decrease the main count of rivertile ${riverctl} map normal Super+Shift H send-layout-cmd ${rivertile} "main-count +1" ${riverctl} map normal Super+Shift L send-layout-cmd ${rivertile} "main-count -1" # move views ${riverctl} map normal Super+Alt H move left 100 ${riverctl} map normal Super+Alt J move down 100 ${riverctl} map normal Super+Alt K move up 100 ${riverctl} map normal Super+Alt L move right 100 # snap views to screen edges ${riverctl} map normal Super+Alt+Control H snap left ${riverctl} map normal Super+Alt+Control J snap down ${riverctl} map normal Super+Alt+Control K snap up ${riverctl} map normal Super+Alt+Control L snap right # resize views ${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 # move/resize with mouse ${riverctl} map-pointer normal Super BTN_LEFT move-view ${riverctl} map-pointer normal Super BTN_RIGHT resize-view ${rivertile} -view-padding 6 -outer-padding 6 for i in $(${seq} 1 9); do tags=$((1 << ($i - 1))) # focus tag [0-8] ${riverctl} map normal Super $i set-focused-tags $tags # tag focused view with tag [0-8] ${riverctl} map normal Super+Shift $i set-view-tags $tags # toggle focus of tag [0-8] ${riverctl} map normal Super+Control $i toggle-focused-tags $tags # toggle tag [0-8] of focused view ${riverctl} map normal Super+Shift+Control $i toggle-view-tags $tags done all_tags=$(((1 << 32) - 1)) # focus all tags ${riverctl} map normal Super 0 set-focused-tags $all_tags # tag focused view with all tags ${riverctl} map normal Super+Shift 0 set-view-tags $all_tags # toggle float ${riverctl} map normal Super T toggle-float # toggle fullscreen ${riverctl} map normal Super M toggle-fullscreen # Super+{Up,Right,Down,Left} to change layout orientation ${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" # Declare a passthrough mode. This mode has only a single mapping to return to # normal mode. This makes it useful for testing a nested wayland compositor ${riverctl} declare-mode passthrough # Super+F11 to enter passthrough mode ${riverctl} map normal Super F11 enter-mode passthrough # Super+F11 to return to normal mode ${riverctl} map passthrough Super F11 enter-mode normal ${riverctl} default-layout rivertile ${rivertile} -view-padding 6 -outer-padding 6 ''; }; }