Advertisement
Guest User

herbstluftwm config

a guest
Jun 20th, 2023
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 7.91 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # this is a simple config for herbstluftwm
  4.  
  5. hc() {
  6.     herbstclient "$@"
  7. }
  8.  
  9. hc emit_hook reload
  10.  
  11. # xsetroot -solid '#5A8E3A'
  12.  
  13. # start up
  14.  
  15.  
  16. # notifications
  17. # dbus-launch dunst --config ~/.config/dunst/dunstrc &
  18.  
  19. # remove all existing keybindings
  20. hc keyunbind --all
  21.  
  22. # keybindings
  23. # if you have a super key you will be much happier with Mod set to Mod4
  24. #Mod=Mod1    # Use alt as the main modifier
  25. Mod=Mod4   # Use the super key as the main modifier
  26.  
  27. # hc keybind $Mod-Shift-Alt-q quit
  28. hc keybind $Mod-Shift-r reload
  29. hc keybind $Mod-Shift-c close
  30.  
  31. # terminal
  32. hc keybind $Mod-Return spawn kitty
  33.  
  34. # alternate terminal
  35. hc keybind $Mod-Alt-Return spawn xfce4-terminal
  36.  
  37. # app launcher
  38. hc keybind $Mod-Alt-l spawn rofi -modi drun -show drun -config ~/.config/rofi/rofidmenu.rasi
  39.  
  40. # power menu
  41. hc keybind $Mod-Alt-p spawn rofi -show power-menu -modi power-menu:~/.config/rofi/rofi-power-menu
  42.  
  43. # ebook management
  44. hc keybind $Mod-Shift-b spawn calibre
  45. hc keybind $Mod-Alt-b spawn ebook-viewer
  46.  
  47. # calculator
  48. hc keybind $Mod-Shift-s spawn speedcrunch
  49.  
  50. # web browser
  51. hc keybind $Mod-Alt-i spawn chromium %U
  52.  
  53. # web browser - alternate
  54. hc keybind $Mod-Shift-Alt-i spawn google-chrome-stable
  55.  
  56. # telegram
  57. hc keybind $Mod-Shift-t spawn telegram-desktop
  58.  
  59. # editor
  60. hc keybind $Mod-g spawn geany
  61.  
  62. # file explorer
  63. hc keybind $Mod-e spawn doublecmd
  64.  
  65. # refresh wallpaper
  66. hc keybind $Mod-Shift-w spawn feh --bg-fill --randomize ~/Pictures/walls/* &
  67.  
  68. # screenshot
  69. hc keybind $Mod-Alt-s spawn gscreenshot -f '/home/user/Pictures/screenshots/ss_$hx$w_%Y-%m-%d_%H-%M-%f.png'
  70.  
  71. # basic movement in tiling and floating mode
  72. # focusing clients
  73. hc keybind $Mod-Left  focus left
  74. hc keybind $Mod-Down  focus down
  75. hc keybind $Mod-Up    focus up
  76. hc keybind $Mod-Right focus right
  77. hc keybind $Mod-h     focus left
  78. hc keybind $Mod-j     focus down
  79. hc keybind $Mod-k     focus up
  80. hc keybind $Mod-l     focus right
  81.  
  82. # moving clients in tiling and floating mode
  83. hc keybind $Mod-Shift-Left  shift left
  84. hc keybind $Mod-Shift-Down  shift down
  85. hc keybind $Mod-Shift-Up    shift up
  86. hc keybind $Mod-Shift-Right shift right
  87. hc keybind $Mod-Shift-h     shift left
  88. hc keybind $Mod-Shift-j     shift down
  89. hc keybind $Mod-Shift-k     shift up
  90. hc keybind $Mod-Shift-l     shift right
  91.  
  92. # splitting frames
  93. # create an empty frame at the specified direction
  94. hc keybind $Mod-u       split   bottom  0.5
  95. hc keybind $Mod-o       split   right   0.5
  96. # let the current frame explode into subframes
  97. hc keybind $Mod-Control-space split explode
  98.  
  99. # resizing frames and floating clients
  100. resizestep=0.02
  101. hc keybind $Mod-Control-h       resize left +$resizestep
  102. hc keybind $Mod-Control-j       resize down +$resizestep
  103. hc keybind $Mod-Control-k       resize up +$resizestep
  104. hc keybind $Mod-Control-l       resize right +$resizestep
  105. hc keybind $Mod-Control-Left    resize left +$resizestep
  106. hc keybind $Mod-Control-Down    resize down +$resizestep
  107. hc keybind $Mod-Control-Up      resize up +$resizestep
  108. hc keybind $Mod-Control-Right   resize right +$resizestep
  109.  
  110. # tags
  111. tag_names=( {1..9} )
  112. tag_keys=( {1..9} 0 )
  113.  
  114. hc rename default "${tag_names[0]}" || true
  115. for i in "${!tag_names[@]}" ; do
  116.     hc add "${tag_names[$i]}"
  117.     key="${tag_keys[$i]}"
  118.     if [ -n "$key" ] ; then
  119.         hc keybind "$Mod-$key" use_index "$i"
  120.         hc keybind "$Mod-Shift-$key" move_index "$i"
  121.     fi
  122. done
  123.  
  124. # cycle through tags
  125. hc keybind $Mod-period use_index +1 --skip-visible
  126. hc keybind $Mod-comma  use_index -1 --skip-visible
  127.  
  128. # layouting
  129. hc keybind $Mod-r remove
  130. hc keybind $Mod-s floating toggle
  131. hc keybind $Mod-f fullscreen toggle
  132. hc keybind $Mod-Shift-f set_attr clients.focus.floating toggle
  133. hc keybind $Mod-Shift-d set_attr clients.focus.decorated toggle
  134. hc keybind $Mod-Shift-m set_attr clients.focus.minimized true
  135. hc keybind $Mod-Control-m jumpto last-minimized
  136. hc keybind $Mod-p pseudotile toggle
  137. # The following cycles through the available layouts within a frame, but skips
  138. # layouts, if the layout change wouldn't affect the actual window positions.
  139. # I.e. if there are two windows within a frame, the grid layout is skipped.
  140. hc keybind $Mod-space                                                           \
  141.             or , and . compare tags.focus.curframe_wcount = 2                   \
  142.                      . cycle_layout +1 vertical horizontal max vertical grid    \
  143.                , cycle_layout +1
  144.  
  145. # mouse
  146. hc mouseunbind --all
  147. hc mousebind $Mod-Button1 move
  148. hc mousebind $Mod-Button2 zoom
  149. hc mousebind $Mod-Button3 resize
  150.  
  151. # focus
  152. hc keybind $Mod-BackSpace   cycle_monitor
  153. hc keybind $Mod-Tab         cycle_all +1
  154. hc keybind $Mod-Shift-Tab   cycle_all -1
  155. hc keybind $Mod-c cycle
  156. hc keybind $Mod-i jumpto urgent
  157.  
  158. # theme
  159. hc attr theme.tiling.reset 1
  160. hc attr theme.floating.reset 1
  161. hc set frame_border_active_color '#222222cc'
  162. hc set frame_border_normal_color '#101010cc'
  163. hc set frame_bg_normal_color '#565656aa'
  164. hc set frame_bg_active_color '#345F0Caa'
  165. hc set frame_border_width 1
  166. hc set show_frame_decorations 'focused_if_multiple'
  167. hc set frame_bg_transparent on
  168. hc set frame_transparent_width 5
  169. hc set frame_gap 1
  170.  
  171. hc attr theme.title_height 15
  172. #hc attr theme.title_when always
  173. hc attr theme.title_when never
  174. hc attr theme.title_font 'Dejavu Sans:pixelsize=12'  # example using Xft
  175. # hc attr theme.title_font '-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
  176. hc attr theme.title_depth 3  # space below the title's baseline
  177. hc attr theme.active.color '#345F0Cef'
  178. hc attr theme.title_color '#ffffff'
  179. hc attr theme.normal.color '#323232dd'
  180. hc attr theme.urgent.color '#7811A1dd'
  181. hc attr theme.tab_color '#1F1F1Fdd'
  182. hc attr theme.active.tab_color '#2B4F0Add'
  183. hc attr theme.active.tab_outer_color '#6C8257dd'
  184. hc attr theme.active.tab_title_color '#ababab'
  185. hc attr theme.normal.title_color '#898989'
  186. hc attr theme.inner_width 1
  187. hc attr theme.inner_color black
  188. hc attr theme.border_width 3
  189. hc attr theme.floating.border_width 4
  190. hc attr theme.floating.outer_width 1
  191. hc attr theme.floating.outer_color black
  192. hc attr theme.active.inner_color '#789161'
  193. hc attr theme.urgent.inner_color '#9A65B0'
  194. hc attr theme.normal.inner_color '#606060'
  195. # copy inner color to outer_color
  196. for state in active urgent normal ; do
  197.     hc substitute C theme.${state}.inner_color \
  198.         attr theme.${state}.outer_color C
  199. done
  200. hc attr theme.tiling.outer_width 1
  201. hc attr theme.background_color '#141414'
  202.  
  203. hc set window_gap 0
  204. hc set frame_padding 0
  205. hc set smart_window_surroundings off
  206. hc set smart_frame_surroundings on
  207. hc set mouse_recenter_gap 0
  208.  
  209. # rules
  210. hc unrule -F
  211. #hc rule class=XTerm tag=3 # move all xterms to tag 3
  212. hc rule focus=on # normally focus new clients
  213. hc rule floatplacement=smart
  214. #hc rule focus=off # normally do not focus new clients
  215. # give focus to most common terminals
  216. #hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
  217. hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on
  218. hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
  219. hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
  220. hc rule fixedsize floating=on
  221.  
  222. # changes by user START
  223.  
  224. # set layout algorithm
  225. hc set set_layout vertical
  226.  
  227. # focus follows mouse
  228. hc attr settings.focus_follows_mouse 1
  229.  
  230. #  new windows will be placed into empty frames
  231. hc rule index=e
  232.  
  233. # changes by user END
  234.  
  235. # hc set tree_style '╾│ ├└╼─┐'
  236.  
  237. # unlock, just to be sure
  238. hc unlock
  239.  
  240. # do multi monitor setup here, e.g.:
  241. # hc set_monitors 1280x1024+0+0 1280x1024+1280+0
  242. # or simply:
  243. # hc detect_monitors
  244.  
  245. # find the panel
  246. panel=~/.config/herbstluftwm/panel.sh
  247. [ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
  248. for monitor in $(hc list_monitors | cut -d: -f1) ; do
  249.     # start it on each monitor
  250.     "$panel" "$monitor" &
  251. done
  252.  
  253.  
  254. # panel
  255. killall -9 polybar
  256. polybar --reload & #reloads when config is changed
  257.  
  258. # set wallpaper
  259. feh --bg-fill --randomize ~/Pictures/walls/* &
  260.  
  261. # set numlock on
  262. numlockx on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement