init 9.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. #!/bin/sh
  2. # This is the example configuration file for river.
  3. #
  4. # If you wish to edit this, you will probably want to copy it to
  5. # $XDG_CONFIG_HOME/river/init or $HOME/.config/river/init first.
  6. #
  7. # See the river(1), riverctl(1), and rivertile(1) man pages for complete
  8. # documentation.
  9. #
  10. #
  11. # Setting the default border width in pixels
  12. # and the border colors
  13. riverctl border-width 2
  14. riverctl border-color-focused 0xFFFFFF
  15. riverctl background-color 0x000000
  16. riverctl border-color-unfocused 0x586e75
  17. # Note: the "Super" modifier is also known as Logo, GUI, Windows, Mod4, etc.
  18. #
  19. riverctl map normal Super B spawn "pkill waybar || waybar"
  20. # Super+Shift+Return to start an instance of foot (https://codeberg.org/dnkl/foot)
  21. riverctl map normal Super+Shift Return spawn "eval $XTERMINAL"
  22. riverctl map normal Super+Alt+Shift Return spawn "eval $XTERMINAL tmux"
  23. #riverctl map normal Super+Alt+Shift Return spawn '$ETC/river/mterm'
  24. # Close the focused view.
  25. riverctl map normal Super X close
  26. # Super+Shift+E to exit river
  27. riverctl map normal Super+Shift E exit
  28. # Super+J and Super+K to focus the next/previous view in the layout stack
  29. riverctl map -repeat normal Super J focus-view next
  30. riverctl map -repeat normal Super K focus-view previous
  31. # Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous
  32. # view in the layout stack
  33. riverctl map -repeat normal Super N swap next
  34. riverctl map -repeat normal Super P swap previous
  35. # Super+Period and Super+Comma to focus the next/previous output
  36. riverctl map normal Super Period focus-output next
  37. riverctl map normal Super Comma focus-output previous
  38. # Super+Shift+{Period,Comma} to send the focused view to the next/previous output
  39. riverctl map normal Super+Shift Period send-to-output -current-tags next
  40. riverctl map normal Super+Shift Comma send-to-output -current-tags previous
  41. # bump the focused view to the top of the layout stack
  42. riverctl map normal Super R zoom
  43. # Lock the screen.
  44. riverctl map normal Super E spawn "riverctl keyboard-layout us && $XLOCKER"
  45. riverctl map normal Super+Alt E spawn "riverctl keyboard-layout us && $XLOCKER & $XSUSPEND"
  46. # Super+H and Super+L to decrease/increase the main ratio of rivertile(1)
  47. riverctl map -repeat normal Super H send-layout-cmd rivertile "main-ratio -0.05"
  48. riverctl map -repeat normal Super L send-layout-cmd rivertile "main-ratio +0.05"
  49. # Increment/decrement the main count of rivertile(1)
  50. riverctl map -repeat normal Super I send-layout-cmd rivertile "main-count +1"
  51. riverctl map -repeat normal Super+Shift I send-layout-cmd rivertile "main-count 1"
  52. riverctl map -repeat normal Super D send-layout-cmd rivertile "main-count -1"
  53. # Super+Alt+{H,J,K,L} to move views
  54. riverctl map -repeat normal Super+Alt H move left 100
  55. riverctl map -repeat normal Super+Alt J move down 100
  56. riverctl map -repeat normal Super+Alt K move up 100
  57. riverctl map -repeat normal Super+Alt L move right 100
  58. # Super+Alt+Control+{H,J,K,L} to snap views to screen edges
  59. riverctl map normal Super+Alt+Control H snap left
  60. riverctl map normal Super+Alt+Control J snap down
  61. riverctl map normal Super+Alt+Control K snap up
  62. riverctl map normal Super+Alt+Control L snap right
  63. # Super+Alt+Shift+{H,J,K,L} to resize views
  64. riverctl map -repeat normal Super+Alt+Shift H resize horizontal -100
  65. riverctl map -repeat normal Super+Alt+Shift K resize vertical 100
  66. riverctl map -repeat normal Super+Alt+Shift J resize vertical -100
  67. riverctl map -repeat normal Super+Alt+Shift L resize horizontal 100
  68. # Super + Left Mouse Button to move views
  69. riverctl map-pointer normal Super BTN_LEFT move-view
  70. # Super + Right Mouse Button to resize views
  71. riverctl map-pointer normal Super BTN_RIGHT resize-view
  72. # Super + Middle Mouse Button to toggle float
  73. riverctl map-pointer normal Super BTN_MIDDLE toggle-float
  74. #
  75. riverctl map-pointer normal Super BTN_GEAR_DOWN focus-view next
  76. for i in $(seq 1 9) ; do
  77. tags=$((1 << ($i - 1)))
  78. # Super+[1-9] to focus tag [0-8]
  79. riverctl map normal Super $i set-focused-tags $tags
  80. # Super+Shift+[1-9] to tag focused view with tag [0-8]
  81. riverctl map normal Super+Shift $i set-view-tags $tags
  82. # Super+Control+[1-9] to toggle focus of tag [0-8]
  83. riverctl map normal Super+Alt $i toggle-focused-tags $tags
  84. # Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
  85. riverctl map normal Super+Shift+Alt $i toggle-view-tags $tags
  86. done
  87. # Easy for custom drop down terminal and stuff.
  88. riverctl map normal Super T toggle-focused-tags $((1 << 10))
  89. riverctl map normal Super+Shift T set-view-tags $((1 << 10))
  90. # Super+0 to focus all tags
  91. # Super+Shift+0 to tag focused view with all tags
  92. all_tags=$(((1 << 32) - 1))
  93. riverctl map normal Super 0 set-focused-tags $all_tags
  94. riverctl map normal Super+Shift 0 set-view-tags $all_tags
  95. # Toggle float.
  96. riverctl map normal Super F toggle-float
  97. # Toggle fullscreen.
  98. riverctl map normal Super+Alt F toggle-fullscreen
  99. riverctl map normal Super+Shift F spawn "$XFILE_MANAGER"
  100. # Super+{Up,Right,Down,Left} to change layout orientation
  101. riverctl map normal Super+Shift K send-layout-cmd rivertile "main-location top"
  102. riverctl map normal Super+Shift L send-layout-cmd rivertile "main-location right"
  103. riverctl map normal Super+Shift J send-layout-cmd rivertile "main-location bottom"
  104. riverctl map normal Super+Shift H send-layout-cmd rivertile "main-location left"
  105. # Declare a passthrough mode. This mode has only a single mapping to return to
  106. # normal mode. This makes it useful for testing a nested wayland compositor
  107. riverctl declare-mode passthrough
  108. # Super+F11 to enter passthrough mode
  109. riverctl map normal Super F11 enter-mode passthrough
  110. # Super+F11 to return to normal mode
  111. riverctl map passthrough Super F11 enter-mode normal
  112. # Various media key mapping examples for both normal and locked mode which do
  113. # not have a modifier
  114. for mode in normal locked
  115. do
  116. # Eject the optical drive (well if you still have one that is)
  117. riverctl map $mode None XF86Eject spawn 'eject -T'
  118. # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
  119. riverctl map $mode None XF86AudioRaiseVolume spawn 'pamixer -i 5'
  120. riverctl map $mode None XF86AudioLowerVolume spawn 'pamixer -d 5'
  121. riverctl map $mode None XF86AudioMute spawn 'pamixer --toggle-mute'
  122. # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
  123. riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
  124. riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause'
  125. riverctl map $mode None XF86AudioPrev spawn 'playerctl previous'
  126. riverctl map $mode None XF86AudioNext spawn 'playerctl next'
  127. # Control screen backlight brightness with brightnessctl (https://github.com/Hummer12007/brightnessctl)
  128. riverctl map $mode None XF86MonBrightnessUp spawn 'brightnessctl set +5%'
  129. riverctl map $mode None XF86MonBrightnessDown spawn 'brightnessctl set 5%-'
  130. done
  131. # Set keyboard repeat rate
  132. riverctl set-repeat 50 300
  133. # My keyboard layouts.
  134. riverctl map normal Super Tab spawn "riverctl keyboard-layout 'us(dvorak)'"
  135. riverctl map normal Super A spawn "riverctl keyboard-layout 'us'"
  136. riverctl map normal Super Return spawn "riverctl keyboard-layout 'us(dvp)'"
  137. riverctl map normal Super Backspace spawn "riverctl keyboard-layout 'ru'"
  138. riverctl map normal Super Cyrillic_EF spawn "riverctl keyboard-layout 'us'"
  139. riverctl map normal Super+Alt R spawn "RIVER_RELOAD=1 $XDG_CONFIG_HOME/river/init && $XNOTIFY 'Reloaded the River configuration'"
  140. # Link player.
  141. riverctl map normal Super+Shift P spawn \
  142. 'p=`wl-paste` ; $XNOTIFY "$XLINK_VIDEO_PLAYER $p" ; ($XLINK_VIDEO_PLAYER $p || $XNOTIFY "$XLINK_VIDEO_PLAYER failed")'
  143. # Run appications.
  144. riverctl map normal Super+Shift R spawn "$XRUNNER"
  145. # $XNOTIFY "`riverctl rule-add -title 'Choose an image' fullscreen csd 2>&1`"
  146. # $XNOTIFY "`riverctl rule-add -title 'Save Image' fullscreen csd 2>&1`"
  147. riverctl rule-add -title 'Choose an image' float
  148. riverctl rule-add -title 'Save Image' float
  149. #riverctl rule-add -title 'Choose an image'
  150. #riverctl rule-add -title 'Save Image'
  151. riverctl rule-add -title Warframe fullscreen
  152. # Make all views with an app-id that starts with "float" and title "foo" start floating.
  153. riverctl rule-add -app-id 'float*' -title 'foo' float
  154. # Make all views with app-id "bar" and any title use client-side decorations
  155. riverctl rule-add -app-id "bar" csd
  156. # Set the default layout generator to be rivertile and start it.
  157. # River will send the process group of the init executable SIGTERM on exit.
  158. riverctl default-layout rivertile
  159. riverctl focus-follows-cursor normal
  160. # Run clipboard manager.
  161. riverctl map normal Super C spawn "$XCLIPBOARD_TOOL || $XNOTIFY 'Problem calling clip'"
  162. # Screenshot region.
  163. riverctl map normal Super+Shift S spawn "eval $XDISPLAY_REGION_SCREENSHOT"
  164. # Only first time, no reloading.
  165. if test -z "$RIVER_RELOAD" ; then
  166. #export QT_QPA_PLATFORM=wayland
  167. #export QT_QPA_PLATFORM=xcb
  168. #export XDG_CURRENT_DESKTOP=sway
  169. eval $XCLIPBOARD_DAEMON &
  170. eval $RIVER_TILER &
  171. eval $XPUSH_NOTIFICATION_DAEMON &
  172. eval $XOUTPUT_DAEMON &
  173. eval $XBACKGROUND_DAEMON &
  174. eval $XBAR &
  175. eval $XBLUETOOTH_APPLET &
  176. dbus-update-activation-environment --systemd \
  177. WAYLAND_DISPLAY \
  178. XDG_CURRENT_DESKTOP=river
  179. # Systemctl stuff.
  180. XWIRE_DAEMON=wireplumber
  181. systemctl --user stop pipewire "$XWIRE_DAEMON" xdg-desktop-portal xdg-desktop-portal-wlr
  182. systemctl --user start "$XWIRE_DAEMON"
  183. fi