init 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  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. # Note: the "Super" modifier is also known as Logo, GUI, Windows, Mod4, etc.
  10. # Super+Return to start an instance of foot (https://codeberg.org/dnkl/foot)
  11. riverctl map normal Super+Shift Return spawn foot
  12. # Super+Q to close the focused view
  13. riverctl map normal Super+Shift Q close
  14. # Super+Shift+E to exit river
  15. riverctl map normal Super+Shift E exit
  16. # Super+J and Super+K to focus the next/previous view in the layout stack
  17. riverctl map normal Super J focus-view next
  18. riverctl map normal Super K focus-view previous
  19. # Super+Shift+J and Super+Shift+K to swap the focused view with the next/previous
  20. # view in the layout stack
  21. riverctl map normal Super+Shift J swap next
  22. riverctl map normal Super+Shift K swap previous
  23. # Super+Period and Super+Comma to focus the next/previous output
  24. riverctl map normal Super Period focus-output next
  25. riverctl map normal Super Comma focus-output previous
  26. # Super+Shift+{Period,Comma} to send the focused view to the next/previous output
  27. riverctl map normal Super+Shift Period send-to-output next
  28. riverctl map normal Super+Shift Comma send-to-output previous
  29. # Super+Return to bump the focused view to the top of the layout stack
  30. riverctl map normal Super Return zoom
  31. # Super+H and Super+L to decrease/increase the main ratio of rivertile(1)
  32. riverctl map normal Super H send-layout-cmd rivertile "main-ratio -0.05"
  33. riverctl map normal Super L send-layout-cmd rivertile "main-ratio +0.05"
  34. # Super+Shift+H and Super+Shift+L to increment/decrement the main count of rivertile(1)
  35. riverctl map normal Super+Shift H send-layout-cmd rivertile "main-count +1"
  36. riverctl map normal Super+Shift L send-layout-cmd rivertile "main-count -1"
  37. # Super+Alt+{H,J,K,L} to move views
  38. riverctl map normal Super+Alt H move left 100
  39. riverctl map normal Super+Alt J move down 100
  40. riverctl map normal Super+Alt K move up 100
  41. riverctl map normal Super+Alt L move right 100
  42. # Super+Alt+Control+{H,J,K,L} to snap views to screen edges
  43. riverctl map normal Super+Alt+Control H snap left
  44. riverctl map normal Super+Alt+Control J snap down
  45. riverctl map normal Super+Alt+Control K snap up
  46. riverctl map normal Super+Alt+Control L snap right
  47. # Super+Alt+Shift+{H,J,K,L} to resize views
  48. riverctl map normal Super+Alt+Shift H resize horizontal -100
  49. riverctl map normal Super+Alt+Shift J resize vertical 100
  50. riverctl map normal Super+Alt+Shift K resize vertical -100
  51. riverctl map normal Super+Alt+Shift L resize horizontal 100
  52. # Super + Left Mouse Button to move views
  53. riverctl map-pointer normal Super BTN_LEFT move-view
  54. # Super + Right Mouse Button to resize views
  55. riverctl map-pointer normal Super BTN_RIGHT resize-view
  56. # Super + Middle Mouse Button to toggle float
  57. riverctl map-pointer normal Super BTN_MIDDLE toggle-float
  58. for i in $(seq 1 9)
  59. do
  60. tags=$((1 << ($i - 1)))
  61. # Super+[1-9] to focus tag [0-8]
  62. riverctl map normal Super $i set-focused-tags $tags
  63. # Super+Shift+[1-9] to tag focused view with tag [0-8]
  64. riverctl map normal Super+Shift $i set-view-tags $tags
  65. # Super+Control+[1-9] to toggle focus of tag [0-8]
  66. riverctl map normal Super+Control $i toggle-focused-tags $tags
  67. # Super+Shift+Control+[1-9] to toggle tag [0-8] of focused view
  68. riverctl map normal Super+Shift+Control $i toggle-view-tags $tags
  69. done
  70. # Super+0 to focus all tags
  71. # Super+Shift+0 to tag focused view with all tags
  72. all_tags=$(((1 << 32) - 1))
  73. riverctl map normal Super 0 set-focused-tags $all_tags
  74. riverctl map normal Super+Shift 0 set-view-tags $all_tags
  75. # Super+Space to toggle float
  76. riverctl map normal Super Space toggle-float
  77. # Super+F to toggle fullscreen
  78. riverctl map normal Super F toggle-fullscreen
  79. # Super+{Up,Right,Down,Left} to change layout orientation
  80. riverctl map normal Super Up send-layout-cmd rivertile "main-location top"
  81. riverctl map normal Super Right send-layout-cmd rivertile "main-location right"
  82. riverctl map normal Super Down send-layout-cmd rivertile "main-location bottom"
  83. riverctl map normal Super Left send-layout-cmd rivertile "main-location left"
  84. # Declare a passthrough mode. This mode has only a single mapping to return to
  85. # normal mode. This makes it useful for testing a nested wayland compositor
  86. riverctl declare-mode passthrough
  87. # Super+F11 to enter passthrough mode
  88. riverctl map normal Super F11 enter-mode passthrough
  89. # Super+F11 to return to normal mode
  90. riverctl map passthrough Super F11 enter-mode normal
  91. # Various media key mapping examples for both normal and locked mode which do
  92. # not have a modifier
  93. for mode in normal locked
  94. do
  95. # Eject the optical drive (well if you still have one that is)
  96. riverctl map $mode None XF86Eject spawn 'eject -T'
  97. # Control pulse audio volume with pamixer (https://github.com/cdemoulins/pamixer)
  98. riverctl map $mode None XF86AudioRaiseVolume spawn 'pactl set-sink-volume 0 +5%'
  99. riverctl map $mode None XF86AudioLowerVolume spawn 'pactl set-sink-volume 0 -5%'
  100. riverctl map $mode None XF86AudioMute spawn 'pactl set-sink-mute 0 toggle'
  101. # Control MPRIS aware media players with playerctl (https://github.com/altdesktop/playerctl)
  102. riverctl map $mode None XF86AudioMedia spawn 'playerctl play-pause'
  103. riverctl map $mode None XF86AudioPlay spawn 'playerctl play-pause'
  104. riverctl map $mode None XF86AudioPrev spawn 'playerctl previous'
  105. riverctl map $mode None XF86AudioNext spawn 'playerctl next'
  106. # Control screen backlight brightness with light (https://github.com/haikarainen/light)
  107. riverctl map $mode None XF86MonBrightnessUp spawn 'light -A 5'
  108. riverctl map $mode None XF86MonBrightnessDown spawn 'light -U 5'
  109. done
  110. # Launcher
  111. riverctl map normal Super P spawn 'fuzzel'
  112. # Status Bar
  113. riverctl spawn yambar
  114. # Wifi
  115. riverctl map normal Super+Shift M spawn 'foot sh /usr/local/bin/wifi.sh'
  116. # wlsunset
  117. riverctl spawn 'wlsunset -s 18:00 -S 7:00'
  118. # Options
  119. riverctl focus-follows-cursor normal
  120. # Set background and border color
  121. riverctl background-color 0x002b36
  122. riverctl border-color-focused 0x93a1a1
  123. riverctl border-color-unfocused 0x586e75
  124. # Set keyboard repeat rate
  125. riverctl set-repeat 50 300
  126. # Make all views with an app-id that starts with "float" and title "foo" start floating.
  127. riverctl rule-add float -app-id 'float*' -title 'foo'
  128. # Make all views with app-id "bar" and any title use client-side decorations
  129. riverctl rule-add csd -app-id "bar"
  130. # Set the default layout generator to be rivertile and start it.
  131. # River will send the process group of the init executable SIGTERM on exit.
  132. riverctl default-layout rivertile
  133. rivertile -view-padding 0 -outer-padding 0 &