You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

285 lines
8.7 KiB

  1. # Read `man 5 sway` for a complete reference.
  2. ### Variables
  3. #
  4. # Mod4 = Logo key. Mod1 = Alt.
  5. # Using Mod1 for now since nothing better is available on the virtual keyboard.
  6. set $mod Mod1
  7. # Home row direction keys, like vim
  8. set $left h
  9. set $down j
  10. set $up k
  11. set $right l
  12. # Your preferred terminal emulator
  13. set $term termite
  14. # Your preferred application launcher
  15. # Note: pass the final command to swaymsg so that the resulting window can be opened
  16. # on the original workspace that the command was run on.
  17. set $menu bemenu-run -n -p RUN | xargs swaymsg exec --
  18. ### Output configuration
  19. #
  20. # Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
  21. output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
  22. #
  23. # Example configuration:
  24. #
  25. # output HDMI-A-1 resolution 1920x1080 position 1920,0
  26. #
  27. # You can get the names of your outputs by running: swaymsg -t get_outputs
  28. ### Idle configuration
  29. #
  30. # Example configuration:
  31. #
  32. # exec swayidle -w \
  33. # timeout 300 'swaylock -f -c 000000' \
  34. # timeout 600 'swaymsg "output * dpms off"' \
  35. # resume 'swaymsg "output * dpms on"' \
  36. # before-sleep 'swaylock -f -c 000000'
  37. #
  38. # This will lock your screen after 300 seconds of inactivity, then turn off
  39. # your displays after another 300 seconds, and turn your screens back on when
  40. # resumed. It will also lock your screen before your computer goes to sleep.
  41. ### Input configuration
  42. #
  43. # Example configuration:
  44. #
  45. # input "2:14:SynPS/2_Synaptics_TouchPad" {
  46. # dwt enabled
  47. # tap enabled
  48. # natural_scroll enabled
  49. # middle_emulation enabled
  50. # }
  51. #
  52. # You can get the names of your inputs by running: swaymsg -t get_inputs
  53. # Read `man 5 sway-input` for more information about this section.
  54. ### Key bindings
  55. #
  56. # Basics:
  57. #
  58. # Start a terminal
  59. bindsym $mod+Return exec $term
  60. # Kill focused window
  61. bindsym $mod+q kill
  62. # Start your launcher
  63. bindsym $mod+d exec $menu
  64. # Drag floating windows by holding down $mod and left mouse button.
  65. # Resize them with right mouse button + $mod.
  66. # Despite the name, also works for non-floating windows.
  67. # Change normal to inverse to use left mouse button for resizing and right
  68. # mouse button for dragging.
  69. floating_modifier $mod normal
  70. # Reload the configuration file
  71. bindsym $mod+Ctrl+c reload
  72. # Exit sway (logs you out of your Wayland session)
  73. bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -b 'Yes, exit sway' 'swaymsg exit'
  74. #
  75. # Moving around:
  76. #
  77. # Move your focus around
  78. bindsym $mod+$left focus left
  79. bindsym $mod+$down focus down
  80. bindsym $mod+$up focus up
  81. bindsym $mod+$right focus right
  82. # Or use $mod+[up|down|left|right]
  83. bindsym $mod+Left focus left
  84. bindsym $mod+Down focus down
  85. bindsym $mod+Up focus up
  86. bindsym $mod+Right focus right
  87. # Move the focused window with the same, but add Shift
  88. bindsym $mod+Shift+$left move left
  89. bindsym $mod+Shift+$down move down
  90. bindsym $mod+Shift+$up move up
  91. bindsym $mod+Shift+$right move right
  92. # Ditto, with arrow keys
  93. bindsym $mod+Shift+Left move left
  94. bindsym $mod+Shift+Down move down
  95. bindsym $mod+Shift+Up move up
  96. bindsym $mod+Shift+Right move right
  97. #
  98. # Workspaces:
  99. #
  100. set $W1 '1'
  101. set $W2 '2'
  102. set $W3 '3:F'
  103. set $W4 '4:4'
  104. set $W5 '5:P'
  105. set $W6 '6:6'
  106. set $W7 '7:7'
  107. set $W8 '8:M'
  108. set $W9 '9:K'
  109. for_window [app_id="firefox"] move workspace $W3; workspace $W3; border none
  110. for_window [app_id="keepassxc"] move workspace $W9; workspace $W9; border none
  111. # Switch to workspace
  112. bindsym $mod+1 workspace $W1
  113. bindsym $mod+2 workspace $W2
  114. bindsym $mod+3 workspace $W3
  115. bindsym $mod+4 workspace $W4
  116. bindsym $mod+5 workspace $W5
  117. bindsym $mod+6 workspace $W6
  118. bindsym $mod+7 workspace $W7
  119. bindsym $mod+8 workspace $W8
  120. bindsym $mod+9 workspace $W9
  121. bindsym $mod+0 workspace $W10
  122. # Move focused container to workspace
  123. bindsym $mod+Shift+1 move container to workspace $W1
  124. bindsym $mod+Shift+2 move container to workspace $W2
  125. bindsym $mod+Shift+3 move container to workspace $W3
  126. bindsym $mod+Shift+4 move container to workspace $W4
  127. bindsym $mod+Shift+5 move container to workspace $W5
  128. bindsym $mod+Shift+6 move container to workspace $W6
  129. bindsym $mod+Shift+7 move container to workspace $W7
  130. bindsym $mod+Shift+8 move container to workspace $W8
  131. bindsym $mod+Shift+9 move container to workspace $W9
  132. bindsym $mod+Shift+0 move container to workspace $W10
  133. # Note: workspaces can have any name you want, not just numbers.
  134. # We just use 1-10 as the default.
  135. #
  136. # Layout stuff:
  137. #
  138. # You can "split" the current object of your focus with
  139. # $mod+b or $mod+v, for horizontal and vertical splits
  140. # respectively.
  141. bindsym $mod+b splith
  142. bindsym $mod+v splitv
  143. # Switch the current container between different layout styles
  144. bindsym $mod+s layout stacking
  145. bindsym $mod+w layout tabbed
  146. bindsym $mod+e layout toggle split
  147. # Make the current focus fullscreen
  148. bindsym $mod+f fullscreen
  149. # Toggle the current focus between tiling and floating mode
  150. bindsym $mod+Shift+space floating toggle
  151. # Swap focus between the tiling area and the floating area
  152. bindsym $mod+space focus mode_toggle
  153. # Move focus to the parent container
  154. bindsym $mod+a focus parent
  155. #
  156. # Scratchpad:
  157. #
  158. # Sway has a "scratchpad", which is a bag of holding for windows.
  159. # You can send windows there and get them back later.
  160. # Move the currently focused window to the scratchpad
  161. bindsym $mod+Shift+minus move scratchpad
  162. # Show the next scratchpad window or hide the focused scratchpad window.
  163. # If there are multiple scratchpad windows, this command cycles through them.
  164. bindsym $mod+minus scratchpad show
  165. #
  166. # Resizing containers:
  167. #
  168. mode "resize" {
  169. # left will shrink the containers width
  170. # right will grow the containers width
  171. # up will shrink the containers height
  172. # down will grow the containers height
  173. bindsym $left resize shrink width 10px
  174. bindsym $down resize grow height 10px
  175. bindsym $up resize shrink height 10px
  176. bindsym $right resize grow width 10px
  177. # Ditto, with arrow keys
  178. bindsym Left resize shrink width 10px
  179. bindsym Down resize grow height 10px
  180. bindsym Up resize shrink height 10px
  181. bindsym Right resize grow width 10px
  182. # Return to default mode
  183. bindsym Return mode "default"
  184. bindsym Escape mode "default"
  185. }
  186. bindsym $mod+r mode "resize"
  187. #
  188. # Power Button
  189. #
  190. set $pplock 'swayphone_power_sleep'
  191. set $ppunlock 'swayphone_power_wakeup'
  192. set $lockapp swaylock
  193. set $lock '$lockapp -f -c 555555'
  194. set $unlock 'killall $lockapp'
  195. ## wish this worked...
  196. #bindsym XF86PowerOff exec $lock
  197. #bindsym --locked XF86PowerOff exec $unlock
  198. # alternative:
  199. bindcode 124 exec '$lock ; swayphone_power_presleep'
  200. bindcode --locked 124 exec '$unlock ; swayphone_power_wakeup'
  201. exec swayidle -w \
  202. timeout 30 'pptk-backlight set_percent 10' \
  203. resume 'swayphone_power_wakeup' \
  204. timeout 60 'swayphone_power_rest' \
  205. resume 'swayphone_power_wakeup' \
  206. timeout 120 'swayphone_power_sleep' \
  207. before-sleep 'swayphone_power_presleep' \
  208. after-resume 'killall swaylock; swayphone_power_wakeup' \
  209. unlock 'killall swaylock'
  210. # Scale the touchscreen LCD UI
  211. output DSI-1 scale 2
  212. # Bind input and output for correct rotation support
  213. input 1046:4097:Goodix_Capacitive_TouchScreen map_to_output DSI-1
  214. #output DSI-1 transform 90
  215. output DSI-1 transform 0
  216. # Display rotation daemon
  217. exec 'rot8 --display DSI-1 --threshold 0.97 --x-file /sys/bus/iio/devices/iio:device2/in_accel_y_raw --y-file /sys/bus/iio/devices/iio:device2/in_accel_x_raw --y-invert --on-change swayphone_rotated'
  218. # Keyboard
  219. exec squeekboard
  220. # Gesture detection
  221. exec lisgd \
  222. -g "1,l,r, false" \
  223. -g "1,r,l, false" \
  224. -g "1,u,d, false" \
  225. -g "1,d,u, false" \
  226. -g "2,l,r, swaymsg workspace prev" \
  227. -g "2,r,l, swaymsg workspace next" \
  228. -g "2,u,d, swaymsg exec swayphone_keyboard_hide" \
  229. -g "2,d,u, swaymsg exec swayphone_keyboard_show" \
  230. -g "2,l,u, swaymsg fullscreen" \
  231. -g "2,r,d, swaymsg kill" \
  232. -g "3,l,r, swaymsg focus right" \
  233. -g "3,r,l, swaymsg focus left" \
  234. -g "3,u,d, swaymsg focus down" \
  235. -g "3,d,u, swaymsg focus up" \
  236. -g "4,l,r, swaymsg move right" \
  237. -g "4,r,l, swaymsg move left" \
  238. -g "4,u,d, swaymsg move down" \
  239. -g "4,d,u, swaymsg move up"
  240. # Status Bar
  241. # side
  242. exec "rm /tmp/sway_rotation"
  243. exec "waybar -c ~/.config/waybar/config_v -b side"
  244. exec "sleep 2 ; kill -10 `pgrep -f 'waybar.*-b side'`"
  245. exec "waybar -c ~/.config/waybar/config_0 -b top"
  246. exec "waybar -c ~/.config/waybar/config_1 -b bottom"
  247. # Restore backlight
  248. exec 'swayphone_power_wakeup'