Portable environments files and scripts.
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.

177 lines
5.3KB

  1. #!/bin/sh
  2. # env
  3. # Written in 2019 by Lucas
  4. # CC0 1.0 Universal/Public domain - No rights reserved
  5. #
  6. # To the extent possible under law, the author(s) have dedicated all
  7. # copyright and related and neighboring rights to this software to the
  8. # public domain worldwide. This software is distributed without any
  9. # warranty. You should have received a copy of the CC0 Public Domain
  10. # Dedication along with this software. If not, see
  11. # <http://creativecommons.org/publicdomain/zero/1.0/>.
  12. if [ -f ~/.config/herbstluftwm/theme ]; then
  13. . ~/.config/herbstluftwm/theme
  14. fi
  15. hc() { herbstclient "$@"; }
  16. hc emit_hook reload
  17. # remove all existing keybindings
  18. hc keyunbind --all
  19. # keybindings
  20. Mod=Mod4
  21. hc keybind $Mod-Shift-q quit
  22. hc keybind $Mod-Shift-r reload
  23. hc keybind $Mod-Shift-c close
  24. # programs
  25. hc keybind $Mod-g spawn plumb
  26. hc keybind $Mod-p spawn dmenu_run \
  27. -p run -fn "$hlwm_face" \
  28. -nb "$hlwm_background" -nf "$hlwm_foreground" \
  29. -sb "$hlwm_background" -sf "$hlwm_color14"
  30. hc keybind $Mod-Shift-Return spawn xterm
  31. hc keybind $Mod-Control-Return spawn xterm -geometry 80x40
  32. hc keybind $Mod-Control-l spawn xlock
  33. hc keybind $Mod-Print spawn screenshot
  34. # basic movement
  35. # focusing clients
  36. hc keybind $Mod-Left focus left
  37. hc keybind $Mod-Down focus down
  38. hc keybind $Mod-Up focus up
  39. hc keybind $Mod-Right focus right
  40. # moving clients
  41. hc keybind $Mod-Shift-Left shift left
  42. hc keybind $Mod-Shift-Down shift down
  43. hc keybind $Mod-Shift-Up shift up
  44. hc keybind $Mod-Shift-Right shift right
  45. # splitting frames
  46. # create an empty frame at the specified direction
  47. hc keybind $Mod-u split bottom 0.5
  48. hc keybind $Mod-o split right 0.5
  49. # let the current frame explode into subframes
  50. hc keybind $Mod-Control-space split explode
  51. # resizing frames
  52. resizestep=0.05
  53. hc keybind $Mod-Control-Left resize left +$resizestep
  54. hc keybind $Mod-Control-Down resize down +$resizestep
  55. hc keybind $Mod-Control-Up resize up +$resizestep
  56. hc keybind $Mod-Control-Right resize right +$resizestep
  57. # tags
  58. hc try rename default 1
  59. for tag in 1:1 2:2 3:3 4:4 5:5 6:6 7:7 8:8 9:9 0:0; do
  60. name=${tag%:*}
  61. key=${tag#*:}
  62. hc try add $name
  63. hc keybind $Mod-$key use $name
  64. hc keybind $Mod-Shift-$key move $name
  65. done
  66. hc load 2 "(split horizontal:0.5:1 (clients max:0) (clients max:0))"
  67. hc load 3 "(clients max:0)"
  68. # cycle through tags
  69. hc keybind $Mod-period use_index +1 --skip-visible
  70. hc keybind $Mod-comma use_index -1 --skip-visible
  71. # layouting
  72. hc keybind $Mod-v set_layout vertical
  73. hc keybind $Mod-h set_layout horizontal
  74. hc keybind $Mod-m set_layout max
  75. hc keybind $Mod-r remove
  76. hc keybind $Mod-s floating toggle
  77. hc keybind $Mod-f fullscreen toggle
  78. hc keybind $Mod-Shift-s pseudotile toggle
  79. # The following cycles through the available layouts within a frame, but skips
  80. # layouts, if the layout change wouldn't affect the actual window positions.
  81. # I.e. if there are two windows within a frame, the grid layout is skipped.
  82. hc keybind $Mod-space \
  83. or , and . compare tags.focus.curframe_wcount = 2 \
  84. . cycle_layout +1 vertical horizontal max vertical grid \
  85. , cycle_layout +1
  86. # mouse
  87. hc mouseunbind --all
  88. hc mousebind $Mod-Button1 move
  89. hc mousebind $Mod-Button2 zoom
  90. hc mousebind $Mod-Button3 resize
  91. # focus
  92. hc keybind $Mod-BackSpace cycle_monitor
  93. hc keybind $Mod-Tab cycle_all +1
  94. hc keybind $Mod-j cycle +1
  95. hc keybind $Mod-Shift-Tab cycle_all -1
  96. hc keybind $Mod-k cycle -1
  97. hc keybind $Mod-c cycle
  98. hc keybind $Mod-i jumpto urgent
  99. # theme
  100. hc attr theme.tiling.reset 1
  101. hc attr theme.floating.reset 1
  102. hc set frame_border_width 0
  103. hc set always_show_frame 0
  104. hc set frame_bg_transparent 1
  105. hc set frame_transparent_width 0
  106. hc set frame_gap 0
  107. hc attr theme.active.color "$hlwm_color11"
  108. hc attr theme.normal.color "$hlwm_color8"
  109. hc attr theme.urgent.color "$hlwm_color9"
  110. hc attr theme.inner_width 0
  111. hc attr theme.outer_width 0
  112. hc attr theme.border_width 2
  113. hc attr theme.background_color "$hlwm_background"
  114. hc set window_gap 0
  115. hc set frame_padding 4
  116. hc set smart_window_surroundings 0
  117. hc set smart_frame_surroundings 0
  118. hc set mouse_recenter_gap 0
  119. # rules
  120. hc unrule -F
  121. #hc rule class=XTerm tag=3 # move all xterms to tag 3
  122. hc rule focus=on # normally focus new clients
  123. #hc rule focus=off # normally do not focus new clients
  124. # give focus to most common terminals
  125. #hc rule class~"(.*[Rr]xvt.*|.*[Tt]erm|Konsole)" focus=on
  126. hc rule windowtype~"_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)" pseudotile=on
  127. hc rule windowtype="_NET_WM_WINDOW_TYPE_DIALOG" focus=on
  128. hc rule windowtype~"_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)" manage=off
  129. hc rule class=XTerm pseudotile=on
  130. hc rule class=Firefox instance=Navigator fullscreen=on tag=3
  131. hc rule class="Tor Browser" pseudotile=on tag=3
  132. hc rule class=SshAskpass pseudotile=on
  133. hc rule class=Snes9x-gtk pseudotile=on
  134. hc set tree_style "╾│ ├└╼─┐"
  135. #hc set tree_style "-| |'>-."
  136. # unlock, just to be sure
  137. hc unlock
  138. hc detect_monitors
  139. if [ -f ~/.config/herbstluftwm/herbstpanel.sh ]; then
  140. font_height=13
  141. bar_height=$(($font_height))
  142. for m in $(hc list_monitors | cut -d : -f 1); do
  143. hc pad "$m" 0 0 $bar_height 0
  144. hc monitor_rect "$m" | {
  145. read -r x y w h
  146. y=$(($y + $h - $bar_height - 1))
  147. printf "%s\t%u\t%u\t%u\t%u\n" \
  148. "$m" "$x" "$y" "$w" $bar_height
  149. }
  150. done | sh ~/.config/herbstluftwm/herbstpanel.sh
  151. fi