Currently we do not set any cursor theme in our river compositor. This commit changes it to be set if the Adwaita/cursor icon directory is available. This does _not_ mean all applications will use Adwaita cursors unfortunately. In Wayland applications themselves decide what to do, so some applications do not respect the setting, e.g. GTK applications. See the following links for more info: https://reddit.com/r/voidlinux/comments/wnfwy5/some_apps_not_inheriting_mouse_cursor_theme/ https://codeberg.org/river/wiki https://codeberg.org/river/river/issues?state=all&type=all&labels=&milestone=0&project=0&assignee=0&poster=0&q=xcursor
366 lines
14 KiB
Bash
Executable file
366 lines
14 KiB
Bash
Executable file
#!/usr/bin/env sh
|
|
|
|
# turnstiled user service setup
|
|
if [ -d "$TURNSTILE_ENV_DIR" ]; then
|
|
echo "$DISPLAY" >"$TURNSTILE_ENV_DIR/DISPLAY"
|
|
echo "$WAYLAND_DISPLAY" >"$TURNSTILE_ENV_DIR/WAYLAND_DISPLAY"
|
|
fi
|
|
|
|
mod="Mod4"
|
|
modemod="Mod1"
|
|
term=${TERMINAL:-wezterm}
|
|
time_to_lockscreen=300
|
|
time_to_screendim=600
|
|
time_to_suspend=900
|
|
|
|
layout_cmd="rivertile"
|
|
layout_opt="-main-ratio 0.65\
|
|
-outer-padding 0\
|
|
-view-padding 6"
|
|
|
|
if command -v filtile >/dev/null 2>&1; then
|
|
layout_cmd="filtile"
|
|
layout_opt="--tags all --output all main-ratio 0.65,\
|
|
--tags all --output all view-padding 6,\
|
|
--tags all --output all outer-padding 0,\
|
|
--tags all --output all smart-padding on,\
|
|
--tags all --output all smart-padding 0"
|
|
fi
|
|
|
|
NO_RESTART="$1"
|
|
should_start() { # 1=program binary name
|
|
# not running, start
|
|
if ! pidof "$1"; then
|
|
return 0
|
|
fi
|
|
|
|
# only reload, no restarting
|
|
if [ "$NO_RESTART" = "no-restart" ]; then
|
|
return 1
|
|
else
|
|
# kill then it can restart
|
|
killall "$1"
|
|
return 0
|
|
fi
|
|
}
|
|
|
|
riverctl keyboard-layout -options compose:menu "us(altgr-intl)"
|
|
## OPTIONS
|
|
riverctl spawn "dbus-update-activation-environment SEATD_SOCK DISPLAY WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=river"
|
|
riverctl focus-follows-cursor normal
|
|
riverctl set-cursor-warp on-output-change
|
|
riverctl hide-cursor when-typing enabled
|
|
|
|
if [ -d "/usr/share/icons/Adwaita/cursors" ]; then
|
|
riverctl xcursor-theme Adwaita
|
|
fi
|
|
riverctl attach-mode bottom
|
|
|
|
# Set background and border color
|
|
riverctl background-color 0x000000
|
|
riverctl border-width 1
|
|
riverctl border-color-focused 0xffffff
|
|
riverctl border-color-unfocused 0x586e75
|
|
# Set repeat rate
|
|
riverctl set-repeat 75 300
|
|
# Make certain views start floating
|
|
riverctl rule-add -app-id float float
|
|
# riverctl rule-add -title "popup title with spaces" float
|
|
# # Set app-ids and titles of views which should use client side decorations
|
|
riverctl rule-add -app-id "gedit" csd
|
|
riverctl rule-add -app-id "org.pwmt.zathura" csd
|
|
|
|
## DEBUG
|
|
# Reload river configuration
|
|
riverctl map normal $mod+Shift F12 spawn "$HOME/.config/river/init no-restart"
|
|
riverctl map normal $mod+Shift+Control F12 spawn "$HOME/.config/river/init"
|
|
|
|
## HOTKEYS
|
|
# close focused view
|
|
riverctl map normal $mod+Shift C close
|
|
|
|
# Open terminal
|
|
riverctl map normal $mod Return spawn "$term"
|
|
# Open floating terminal
|
|
riverctl map normal $mod+Control Return spawn "$term -e --class float"
|
|
|
|
# Open run menu
|
|
riverctl map normal $mod Space spawn "bemenu-run"
|
|
|
|
# Toggle status bar
|
|
riverctl map normal $mod F7 spawn "killall -SIGUSR1 waybar"
|
|
|
|
# Switch to lockscreen
|
|
riverctl map normal $mod X spawn "lockscreen"
|
|
|
|
# Open logout script
|
|
riverctl map normal $mod backspace spawn "powermenu"
|
|
|
|
# Open Bookmark search
|
|
riverctl map normal None XF86Search spawn "qutedmenu"
|
|
riverctl map normal $mod+Shift O spawn "qutedmenu"
|
|
|
|
# Clipboard history
|
|
riverctl map normal $mod+Shift Space spawn "clipman pick --tool=bemenu"
|
|
riverctl map normal $mod+Shift+Control Space spawn "clipman clear --all"
|
|
|
|
# Open floating calculator
|
|
riverctl map normal $mod+Shift R spawn "$term -e --class float qalc"
|
|
|
|
# Open emoji picker
|
|
riverctl map normal $mod+Shift E spawn "bemoji -nt"
|
|
|
|
# Open translation helper
|
|
riverctl map normal $mod+Shift T spawn "bemenu-translate"
|
|
|
|
# Open item from library
|
|
riverctl map normal $mod+Shift L spawn "papis -s picktool dmenu open"
|
|
|
|
# Desktop theming
|
|
# shellcheck disable=SC2016
|
|
riverctl map normal $mod+Shift S spawn 'flavourchoose'
|
|
|
|
# Password frontend
|
|
riverctl map normal $mod+Shift P spawn "pass-pick"
|
|
|
|
# File upload
|
|
riverctl map normal $mod+Shift U spawn "$term -e --class float sharefile | xargs notify-send"
|
|
|
|
# Open recent downloads
|
|
riverctl map normal $mod+Shift D spawn "recently-downloaded"
|
|
|
|
# # Screenshot
|
|
riverctl map normal None Print spawn "screenshot"
|
|
riverctl map normal Shift Print spawn "screenshot | sharefile -"
|
|
riverctl map normal $mod Print spawn "screenshot region"
|
|
riverctl map normal $mod+Shift Print spawn "screenshot region | sharefile -"
|
|
|
|
# control notification daemon
|
|
riverctl map normal $mod N spawn "makoctl dismiss"
|
|
riverctl map normal $mod+Shift N spawn "makoctl dismiss --all"
|
|
riverctl map normal $mod+Control N spawn "makoctl restore"
|
|
|
|
# MOVEMENT
|
|
# focus the next/previous view in the layout stack
|
|
riverctl map normal $mod J focus-view next
|
|
riverctl map normal $mod K focus-view previous
|
|
|
|
# swap the focused view with the next/previous view in the layout stack
|
|
riverctl map normal $mod+Shift J swap next
|
|
riverctl map normal $mod+Shift K swap previous
|
|
|
|
# bump the focused view to the top of the layout stack
|
|
riverctl map normal $mod+Shift Return zoom
|
|
|
|
# change layout orientation
|
|
riverctl map normal $mod Up send-layout-cmd $layout_cmd "main-location top"
|
|
riverctl map normal $mod Right send-layout-cmd $layout_cmd "main-location right"
|
|
riverctl map normal $mod Down send-layout-cmd $layout_cmd "main-location bottom"
|
|
riverctl map normal $mod Left send-layout-cmd $layout_cmd "main-location left"
|
|
|
|
# snap views to screen edges
|
|
riverctl map normal $mod+Control H snap left
|
|
riverctl map normal $mod+Control J snap down
|
|
riverctl map normal $mod+Control K snap up
|
|
riverctl map normal $mod+Control L snap right
|
|
|
|
# Mod+F to toggle fullscreen
|
|
riverctl map normal $mod F toggle-fullscreen
|
|
# if we are running filtile we also have access to monocle mode
|
|
if [ "$layout_cmd" = "filtile" ]; then
|
|
riverctl map normal $mod+Shift F spawn "riverctl send-layout-cmd $layout_cmd monocle"
|
|
fi
|
|
|
|
riverctl map normal $mod+Shift v toggle-float
|
|
|
|
# shellcheck disable=SC2016
|
|
# Make all connected outputs show the desktop and no windows at all
|
|
riverctl map normal $mod+Shift M spawn 'for i in $(wlopm | wc -l); do riverctl set-focused-tags $((1 << 10)); riverctl focus-output next; done; riverctl set-focused-tags $((1 << 10)); riverctl focus-output next'
|
|
|
|
riverctl map normal $mod+Shift F10 spawn "riverctl send-layout-cmd $layout_cmd '--tags all --output all view-padding 0'"
|
|
riverctl map normal $mod F10 spawn "riverctl send-layout-cmd $layout_cmd '--tags all --output all view-padding 6'"
|
|
|
|
# Mod + Left Mouse Button to move views
|
|
riverctl map-pointer normal $mod BTN_LEFT move-view
|
|
# Mod + Right Mouse Button to resize views
|
|
riverctl map-pointer normal $mod BTN_RIGHT resize-view
|
|
|
|
### Begin resize and moving mode, for floating windows
|
|
riverctl declare-mode interact_float
|
|
riverctl map normal $modemod R enter-mode interact_float
|
|
riverctl map interact_float $modemod R enter-mode normal
|
|
riverctl map interact_float None Escape enter-mode normal
|
|
# toggle float
|
|
riverctl map interact_float $mod+Shift v toggle-float
|
|
# move views around screen
|
|
riverctl map -repeat interact_float None H move left 100
|
|
riverctl map -repeat interact_float None J move down 100
|
|
riverctl map -repeat interact_float None K move up 100
|
|
riverctl map -repeat interact_float None L move right 100
|
|
# resize views on screen
|
|
riverctl map -repeat interact_float $mod H resize horizontal -100
|
|
riverctl map -repeat interact_float $mod J resize vertical 100
|
|
riverctl map -repeat interact_float $mod K resize vertical -100
|
|
riverctl map -repeat interact_float $mod L resize horizontal 100
|
|
# decrease/increase the main ratio of layout
|
|
riverctl map interact_float $mod+Shift H send-layout-cmd $layout_cmd "main-ratio -0.05"
|
|
riverctl map interact_float $mod+Shift L send-layout-cmd $layout_cmd "main-ratio +0.05"
|
|
# increment/decrement the main layout
|
|
riverctl map interact_float $mod+Shift J send-layout-cmd $layout_cmd "main-count +1"
|
|
riverctl map interact_float $mod+Shift K send-layout-cmd $layout_cmd "main-count -1"
|
|
# snap views to screen edges
|
|
riverctl map interact_float $mod+Control H snap left
|
|
riverctl map interact_float $mod+Control J snap down
|
|
riverctl map interact_float $mod+Control K snap up
|
|
riverctl map interact_float $mod+Control L snap right
|
|
### End resize and moving mode
|
|
|
|
## Passthrough mode which disables all other mappings and only retains the single
|
|
# mapping to return to normal mode. Useful for some full screen applications
|
|
# which should capture everything, or for testing nested wayland compositors.
|
|
riverctl declare-mode passthrough
|
|
riverctl map normal $mod F11 enter-mode passthrough
|
|
riverctl map passthrough $mod F11 enter-mode normal
|
|
|
|
# focus the next/previous output
|
|
riverctl map normal $mod Period focus-output next
|
|
riverctl map normal $mod Comma focus-output previous
|
|
|
|
# send the focused view to the next/previous output
|
|
riverctl map normal $mod+Shift Period send-to-output next
|
|
riverctl map normal $mod+Shift Comma send-to-output previous
|
|
|
|
# set up 10 tags (with '0' opening the 10th one)
|
|
for i in $(seq 0 9); do
|
|
tags="$((1 << (i - 1)))"
|
|
if [ "$i" -eq 0 ]; then tags="$((1 << 9))"; fi
|
|
|
|
# Mod+[1-9] to focus tag [0-8]
|
|
riverctl map normal $mod "$i" set-focused-tags $tags
|
|
|
|
# Mod+Shift+[1-9] to tag focused view with tag [0-8]
|
|
riverctl map normal $mod+Shift "$i" set-view-tags $tags
|
|
|
|
# Mod+Ctrl+[1-9] to toggle focus of tag [0-8]
|
|
riverctl map normal $mod+Control "$i" toggle-focused-tags $tags
|
|
|
|
# Mod+Shift+Ctrl+[1-9] to toggle tag [0-8] of focused view
|
|
riverctl map normal $mod+Shift+Control "$i" toggle-view-tags $tags
|
|
done
|
|
|
|
# focus all tags
|
|
all_tags=$(((1 << 32) - 1))
|
|
riverctl map normal $mod equal set-focused-tags $all_tags
|
|
# tag focused view with all tags
|
|
riverctl map normal $mod+Shift equal set-view-tags $all_tags
|
|
|
|
# Various media key mapping examples for both normal and locked mode which do
|
|
# not have a modifier
|
|
for mode in normal locked; do
|
|
# Eject the optical drive
|
|
riverctl map $mode None XF86Eject spawn 'eject -T'
|
|
|
|
riverctl map -repeat $mode None XF86AudioRaiseVolume spawn 'pactl set-sink-volume @DEFAULT_SINK@ +5%'
|
|
riverctl map -repeat $mode None XF86AudioLowerVolume spawn 'pactl set-sink-volume @DEFAULT_SINK@ -5%'
|
|
riverctl map $mode None XF86AudioMute spawn 'pactl set-sink-mute @DEFAULT_SINK@ toggle'
|
|
|
|
# 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'
|
|
|
|
# You can control screen backlight brighness with light (https://github.com/haikarainen/light); but we prefer brightnessctl
|
|
riverctl map -repeat $mode None XF86MonBrightnessUp spawn 'brightnessctl set 10%+'
|
|
riverctl map -repeat $mode None XF86MonBrightnessDown spawn 'brightnessctl set 10%-'
|
|
done
|
|
|
|
# The scratchpad will live on an unused tag. Which tags are used depends on your
|
|
# config, but rivers default uses the first 9 tags.
|
|
scratch_tag=$((1 << 20))
|
|
# Toggle showing the scratchpad
|
|
riverctl map normal $mod grave toggle-focused-tags ${scratch_tag}
|
|
# Send windows to the scratchpad
|
|
riverctl map normal $mod+Shift grave set-view-tags ${scratch_tag}
|
|
# Set spawn tagmask to ensure new windows don't have the scratchpad tag unless
|
|
# explicitly set.
|
|
all_but_scratch_tag=$((((1 << 32) - 1) ^ scratch_tag))
|
|
riverctl spawn-tagmask ${all_but_scratch_tag}
|
|
|
|
# set up scratch pad for todo and 'drop-down' terminal
|
|
# call scratchpads to current workspace -- scratchpads started on i3 starting (see end of file)
|
|
# bindsym $mod+t [class="scratchpad" title="dropdown-todo"] scratchpad show
|
|
# bindsym $mod+Shift+Return [class="scratchpad" title="dropdown-terminal"] scratchpad show
|
|
|
|
## INPUT
|
|
# device (touchscreen)
|
|
# enable touch clicking for touchpads
|
|
for pad in $(riverctl list-inputs | grep -i touchpad); do
|
|
riverctl input "$pad" events enabled
|
|
riverctl input "$pad" tap enabled
|
|
done
|
|
for pad in $(riverctl list-inputs | grep -i touchscreen); do
|
|
riverctl input "$pad" events enabled
|
|
riverctl input "$pad" tap enabled
|
|
riverctl input "$pad" drag enabled
|
|
riverctl input "$pad" pointer-accel 0.5
|
|
done
|
|
|
|
|
|
# We are not in voidlinux, so no nice turnstile user services will take care of us
|
|
# have to start everything manually here.
|
|
if ! cat /etc/*-release | grep -q '^NAME=.*Void'; then
|
|
# start dynamic display configuration
|
|
should_start kanshi && riverctl spawn kanshi
|
|
|
|
# set a nice wallpaper
|
|
if command -v swaybg >/dev/null 2>&1; then
|
|
killall swaybg
|
|
riverctl spawn "swaybg \
|
|
-o 'LG Electronics W2442 0x000574E1' -i $HOME/pictures/wall_l.jpg \
|
|
-o 'LG Electronics W2442 0x000574FD' -i $HOME/pictures/wall_r.jpg \
|
|
-o 'Sharp Corporation 0x1449' -i $HOME/pictures/wall.jpg
|
|
"
|
|
elif command -v swww >/dev/null 2>&1; then
|
|
riverctl spawn "swww-daemon"
|
|
outputs=$(swww query | cut -d':' -f1)
|
|
if [ "$(echo "$outputs" | grep -c -e '^DP')" -eq 2 ] && [ -e "$HOME/pictures/wall_r.jpg" ]; then
|
|
swww img -o "$(echo "$outputs" | head -n1)" "$HOME/pictures/wall_l.jpg"
|
|
swww img -o "$(echo "$outputs" | tail -n1)" "$HOME/pictures/wall_r.jpg"
|
|
elif [ -e "$HOME/pictures/wall.jpg" ]; then
|
|
swww img "$HOME/pictures/wall.jpg"
|
|
fi
|
|
fi
|
|
|
|
should_start waybar && riverctl spawn waybar
|
|
#
|
|
# start redshift-like sundown warming using current location or standard values
|
|
if should_start wlsunset; then
|
|
loc=$(curl ipinfo.io | grep -e '"loc": ' | sed -e 's/^.*"loc": "\(.*\)",$/\1/')
|
|
if [ -n "$loc" ]; then
|
|
riverctl spawn "wlsunset -l \"$(echo "$loc" | cut -d, -f1)\" -L \"$(echo "$loc" | cut -d, -f2)\""
|
|
else
|
|
riverctl spawn "wlsunset -S \"09:00\" -s \"21:00\" -d \"3600\""
|
|
fi
|
|
unset loc
|
|
fi
|
|
|
|
# start screen idle locking/dimming/sleep tool
|
|
should_start swayidle && riverctl spawn "swayidle \
|
|
timeout ${time_to_suspend} \"[ $(cat /sys/class/power_supply/AC/online) -eq 0 ] && systemctl suspend-then-hibernate\"
|
|
timeout ${time_to_screendim} \"wlopm --off '*'\" \
|
|
resume \"wlopm --on '*'\" \
|
|
timeout ${time_to_lockscreen} \"pidof waylock || lockscreen\" \
|
|
after-resume \"wlopm --on '*'\" \
|
|
before-sleep \"pidof waylock || lockscreen\" &"
|
|
fi
|
|
|
|
# bash ~/.config/bin/gtktheme # setting our gtk variables
|
|
# killall polkit-gnome-authentication-agent-1
|
|
# /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 &
|
|
# start layouting engine
|
|
killall $layout_cmd
|
|
riverctl spawn "$layout_cmd $layout_opt"
|
|
# River will send the process group of the init executable SIGTERM on exit.
|
|
riverctl default-layout $layout_cmd
|
|
brightnessctl set 70%
|