dotfiles/river/init
2024-07-10 06:46:19 +02:00

152 lines
5 KiB
Bash
Executable file

#!/bin/sh
in_sway=false
if [ -n "$SWAYSOCK" ]; then
in_sway=true
fi
riverctl focus-output DP-1
SWAYSOCK="" yambar >/dev/null 2>&1 &
if ! $in_sway; then
swaybg -i $HOME/img/bg/vallei_la_roche_less_contrast.jpg -m fill &
fi
riverctl keyboard-layout -options 'compose:menu,shift:both_capslock,altwin:swap_lalt_lwin' be_custom
riverctl keyboard-layout -options 'compose:menu,shift:both_capslock,caps:none' be
riverctl set-repeat 70 170
riverctl hide-cursor timeout 3000
xrdb -merge "$HOME/.Xresources"
DOTOOL_XKB_LAYOUT=be dotoold &
wl-paste --watch clipman store &
riverctl map normal $mod C spawn "clipman pick --tool rofi"
if $in_sway; then
mod=Alt
else
mod=Super
fi
riverctl default-attach-mode below
riverctl border-width 1
riverctl border-color-focused 0xffffff88
riverctl border-color-unfocused 0xffffff00
riverctl set-cursor-warp on-output-change
riverctl map normal $mod Return spawn foot
riverctl map normal $mod O spawn "swaylock -c 000000 -l -f -i ~/img/bg/amy_sunflowers_painted_lock.png"
riverctl map normal $mod D spawn "killall rofi || rofi -show combi"
riverctl map normal $mod K focus-view up
riverctl map normal $mod J focus-view down
riverctl map normal $mod H focus-view left
riverctl map normal $mod L focus-view right
riverctl map normal $mod+Shift K swap up
riverctl map normal $mod+Shift J swap down
riverctl map normal $mod+Shift H swap left
riverctl map normal $mod+Shift L swap right
riverctl map normal $mod+Control K focus-output up
riverctl map normal $mod+Control J focus-output down
riverctl map normal $mod+Control H focus-output left
riverctl map normal $mod+Control L focus-output right
riverctl map normal $mod+Control+Shift K swap previous
riverctl map normal $mod+Control+Shift J swap next
riverctl map normal $mod+Control+Shift H send-to-output -current-tags previous
riverctl map normal $mod+Control+Shift L send-to-output -current-tags next
#riverctl map normal $mod X focus-output next
#riverctl map normal $mod+Shift X send-to-output -current-tags next
riverctl map normal $mod Z zoom
riverctl map normal $mod+Shift Q close
riverctl map normal $mod space toggle-float
riverctl map normal $mod F toggle-fullscreen
riverctl map-pointer normal $mod BTN_RIGHT resize-view
riverctl map-pointer normal $mod BTN_LEFT move-view
riverctl map normal $mod twosuperior focus-previous-tags
riverctl map normal $mod+Shift twosuperior send-to-previous-tags
map_tags() {
local tag=$((1 << ($2 - 1)))
riverctl map normal $mod "$1" set-focused-tags "$tag"
riverctl map normal $mod+Control "$1" toggle-focused-tags "$tag"
riverctl map normal $mod+Shift "$1" set-view-tags "$tag"
riverctl map normal $mod+Shift+Control "$1" toggle-view-tags "$tag"
}
map_tags ampersand 1
map_tags eacute 2
map_tags quotedbl 3
map_tags apostrophe 4
map_tags parenleft 5
map_tags section 6
map_tags egrave 7
map_tags exclam 8
map_tags ccedilla 9
map_tags agrave 10
map_tags parenright 11
riverctl map normal $mod T set-view-tags $(((1 << 11) - 1))
# Set the default layout generator to be river-ultitile and start it.
# River will send the process group of the init executable SIGTERM on exit.
riverctl default-layout river-ultitile
if $in_sway; then
~/dev/river-ultitile/zig-out/bin/river-ultitile &
else
river-ultitile &
riverctl spawn 'foot sh -c "vi ~/todo2.txt; bash"'
riverctl spawn 'foot sh -c "vi ~/todo.txt; bash"'
sleep 0.2
riverctl set-view-tags $((1 << (10 - 1)))
riverctl set-view-tags $((1 << (10 - 1)))
sleep 0.2
riverctl spawn 'foot sh -c "toxic; bash"'
sleep 0.2
riverctl set-view-tags $((1 << (11 - 1)))
fi
# Increase/decrease the main size
riverctl map normal $mod U send-layout-cmd river-ultitile "set integer main-size += 4"
riverctl map normal $mod I send-layout-cmd river-ultitile "set integer main-size -= 4"
# Decrease/increase the main size if it is in the center (on wide screens)
riverctl map normal $mod+Shift U send-layout-cmd river-ultitile "set global integer main-size-if-only-centered-main += 4"
riverctl map normal $mod+Shift I send-layout-cmd river-ultitile "set global integer main-size-if-only-centered-main -= 4"
# Decrease/increase the main count
riverctl map normal $mod N send-layout-cmd river-ultitile "set integer main-count -= 1"
riverctl map normal $mod comma send-layout-cmd river-ultitile "set integer main-count += 1"
# Change layout
riverctl map normal $mod Up send-layout-cmd river-ultitile "set string layout = vstack"
riverctl map normal $mod Right send-layout-cmd river-ultitile "set string layout = hstack"
riverctl map normal $mod Down send-layout-cmd river-ultitile "set string layout = monocle"
riverctl map normal $mod Left send-layout-cmd river-ultitile "set string layout = main"
# Cycle through layouts on all tags/outputs
riverctl map normal $mod E spawn "riverctl send-layout-cmd river-ultitile 'unset-all-local layout'; riverctl send-layout-cmd river-ultitile 'set global string layout @ main hstack vstack'"
riverctl rule-add -app-id "Firefox" ssd
riverctl rule-add -app-id "Tor Browser" ssd
riverctl rule-add -app-id gramps ssd