Advertisement
Guest User

herbs

a guest
Mar 27th, 2015
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.54 KB | None | 0 0
  1. sudo apt-get install futurewriter calibre cmus htop irssi conky herbstluftwm screenfetch zsh zsh lolcat bsd nethack-perl moon-buggy bsdgames vim feh mpv vlc thunar gedit terminator scrot pacman
  2.  
  3.  
  4. #autostart
  5. #!/bin/bash
  6.  
  7. # this is a simple config for herbstluftwm
  8.  
  9. hc() {
  10. herbstclient "$@"
  11. }
  12.  
  13. hc emit_hook reload
  14. # set wallpaper before client settings
  15. feh --bg-tile ~/.config/herbstluftwm/argyle.png
  16. # remove all existing keybinds
  17. hc keyunbind --all
  18.  
  19. # keybindings
  20. # if you have a super key you will be much happier with Mod set to Mod4
  21. Mod=Mod1 # Use alt as the main modifier
  22. #Mod=Mod4 # Use the super key as the main modifier
  23.  
  24. hc keybind $Mod-Shift-q close
  25. hc keybind $Mod-Shift-r reload
  26. hc keybind $Mod-Shift-0 'killall pkill alyssap'
  27. hc keybind $Mod-Return spawn terminator
  28. hc keybind $Mod-Shift-i spawn iceweasel
  29. hc keybind $Mod-Shift-t spawn thunar
  30. hc keybind $Mod-Shift-n spawn nautilus
  31. hc keybind $Mod-Shift-d spawn deluge
  32. hc keybind $Mod-Shift-g spawn gedit
  33. hc keybind $Mod-Shift-f spawn focuswriter
  34. hc keybind $Mod-Shift-x spawn xterm -fg green
  35. hc keybind $Mod-Shift-k xkill
  36.  
  37. # basic movement
  38. # focusing clients
  39. hc keybind $Mod-Left focus left
  40. hc keybind $Mod-Down focus down
  41. hc keybind $Mod-Up focus up
  42. hc keybind $Mod-Right focus right
  43. hc keybind $Mod-h focus left
  44. hc keybind $Mod-j focus down
  45. hc keybind $Mod-k focus up
  46. hc keybind $Mod-l focus right
  47.  
  48. # moving clients
  49. hc keybind $Mod-Shift-Left shift left
  50. hc keybind $Mod-Shift-Down shift down
  51. hc keybind $Mod-Shift-Up shift up
  52. hc keybind $Mod-Shift-Right shift right
  53. hc keybind $Mod-Shift-h shift left
  54. hc keybind $Mod-Shift-j shift down
  55. hc keybind $Mod-Shift-k shift up
  56. hc keybind $Mod-Shift-l shift right
  57.  
  58. # splitting frames
  59. # create an empty frame at the specified direction
  60. hc keybind $Mod-u split bottom 0.5
  61. hc keybind $Mod-o split right 0.5
  62. # let the current frame explode into subframes
  63. hc keybind $Mod-Control-space split explode
  64.  
  65. # resizing frames
  66. resizestep=0.05
  67. hc keybind $Mod-Control-h resize left +$resizestep
  68. hc keybind $Mod-Control-j resize down +$resizestep
  69. hc keybind $Mod-Control-k resize up +$resizestep
  70. hc keybind $Mod-Control-l resize right +$resizestep
  71. hc keybind $Mod-Control-Left resize left +$resizestep
  72. hc keybind $Mod-Control-Down resize down +$resizestep
  73. hc keybind $Mod-Control-Up resize up +$resizestep
  74. hc keybind $Mod-Control-Right resize right +$resizestep
  75.  
  76. # tags
  77. tag_names=( {1..9} )
  78. tag_keys=( {1..9} 0 )
  79.  
  80. hc rename default "${tag_names[0]}" || true
  81. for i in ${!tag_names[@]} ; do
  82. hc add "${tag_names[$i]}"
  83. key="${tag_keys[$i]}"
  84. if ! [ -z "$key" ] ; then
  85. hc keybind "$Mod-$key" use_index "$i"
  86. hc keybind "$Mod-Shift-$key" move_index "$i"
  87. fi
  88. done
  89.  
  90. # cycle through tags
  91. hc keybind $Mod-period use_index +1 --skip-visible
  92. hc keybind $Mod-comma use_index -1 --skip-visible
  93.  
  94. # layouting
  95. hc keybind $Mod-r remove
  96. hc keybind $Mod-space cycle_layout 1
  97. hc keybind $Mod-s floating toggle
  98. hc keybind $Mod-f fullscreen toggle
  99. hc keybind $Mod-p pseudotile toggle
  100.  
  101. # mouse
  102. hc mouseunbind --all
  103. hc mousebind $Mod-Button1 move
  104. hc mousebind $Mod-Button2 zoom
  105. hc mousebind $Mod-Button3 resize
  106.  
  107. # focus
  108. hc keybind $Mod-BackSpace cycle_monitor
  109. hc keybind $Mod-Tab cycle_all +1
  110. hc keybind $Mod-Shift-Tab cycle_all -1
  111. hc keybind $Mod-c cycle
  112. hc keybind $Mod-i jumpto urgent
  113.  
  114. # theme
  115. hc attr theme.tiling.reset 1
  116. hc attr theme.floating.reset 1
  117. hc set frame_border_active_color '#0'
  118. hc set frame_border_normal_color '#101010'
  119. hc set frame_bg_normal_color '#101010'
  120. hc set frame_bg_active_color '#101010'
  121. hc set frame_border_width 0
  122. hc set always_show_frame 0
  123. hc set frame_bg_transparent 1
  124. hc set frame_transparent_width 0
  125. hc set frame_gap 0
  126.  
  127. hc attr theme.active.color '#000000'
  128. hc attr theme.normal.color '#904961'
  129. hc attr theme.urgent.color white
  130. hc attr theme.inner_width 0
  131. hc attr theme.inner_color black
  132. hc attr theme.border_width 1
  133. hc attr theme.floating.border_width 2
  134. hc attr theme.floating.outer_width 1
  135. hc attr theme.floating.outer_color black
  136. hc attr theme.active.inner_color '#4C4A4C'
  137. hc attr theme.active.outer_color '#4C4A4C'
  138. hc attr theme.background_color '#000000'
  139.  
  140. hc set window_gap 20
  141. hc set frame_padding 0
  142. hc set smart_window_surroundings 0
  143. hc set smart_frame_surroundings 1
  144. hc set mouse_recenter_gap 0
  145.  
  146. # rules
  147. hc unrule -F
  148. #hc rule class=XTerm tag=3 # move all xterms to tag 3
  149. hc rule focus=on # normally focus new clients
  150. #hc rule focus=off # normally do not focus new clients
  151. # give focus to most common terminals
  152. #hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
  153. hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
  154. hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
  155. hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
  156.  
  157.  
  158.  
  159. # unlock, just to be sure
  160. hc unlock
  161.  
  162. herbstclient set tree_style '╾│ ├└╼─┐'
  163.  
  164. # do multi monitor setup here, e.g.:
  165. # hc set_monitors 1280x1024+0+0 1280x1024+1280+0
  166. # or simply:
  167. # hc detect_monitors
  168.  
  169. # find the panel
  170. panel=~/.config/herbstluftwm/panel.sh
  171. [ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
  172. for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
  173. # start it on each monitor
  174. "$panel" $monitor &
  175. done
  176.  
  177. #panel
  178. #!/bin/bash
  179.  
  180. hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;}
  181. monitor=${1:-0}
  182. geometry=( $(herbstclient monitor_rect "$monitor") )
  183. if [ -z "$geometry" ] ;then
  184. echo "Invalid monitor $monitor"
  185. exit 1
  186. fi
  187. # geometry has the format W H X Y
  188. x=${geometry[0]}
  189. y=${geometry[1]}
  190. panel_width=${geometry[2]}
  191. panel_height=10
  192. font="-*-fixed-medium-*-*-*-9-*-*-*-*-*-*-*"
  193. bgcolor=$(hc get frame_border_normal_color)
  194. selbg=$(hc get window_border_active_color)
  195. selfg='#000000'
  196.  
  197. ####
  198. # Try to find textwidth binary.
  199. # In e.g. Ubuntu, this is named dzen2-textwidth.
  200. if which textwidth &> /dev/null ; then
  201. textwidth="textwidth";
  202. elif which dzen2-textwidth &> /dev/null ; then
  203. textwidth="dzen2-textwidth";
  204. else
  205. echo "This script requires the textwidth tool of the dzen2 project."
  206. exit 1
  207. fi
  208. ####
  209. # true if we are using the svn version of dzen2
  210. # depending on version/distribution, this seems to have version strings like
  211. # "dzen-" or "dzen-x.x.x-svn"
  212. if dzen2 -v 2>&1 | head -n 1 | grep -q '^dzen-\([^,]*-svn\|\),'; then
  213. dzen2_svn="true"
  214. else
  215. dzen2_svn=""
  216. fi
  217.  
  218. if awk -Wv 2>/dev/null | head -1 | grep -q '^mawk'; then
  219. # mawk needs "-W interactive" to line-buffer stdout correctly
  220. # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=593504
  221. uniq_linebuffered() {
  222. awk -W interactive '$0 != l { print ; l=$0 ; fflush(); }' "$@"
  223. }
  224. else
  225. # other awk versions (e.g. gawk) issue a warning with "-W interactive", so
  226. # we don't want to use it there.
  227. uniq_linebuffered() {
  228. awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
  229. }
  230. fi
  231.  
  232. hc pad $monitor $panel_height
  233.  
  234. {
  235. ### Event generator ###
  236. # based on different input data (mpc, date, hlwm hooks, ...) this generates events, formed like this:
  237. # <eventname>\t<data> [...]
  238. # e.g.
  239. # date ^fg(#efefef)18:33^fg(#909090), 2013-10-^fg(#efefef)29
  240.  
  241. #mpc idleloop player &
  242. while true ; do
  243. # "date" output is checked once a second, but an event is only
  244. # generated if the output changed compared to the previous run.
  245. date +$'date\t^fg(#efefef)%H:%M^fg(#909090)| %Y-%m-^fg(#efefef)%d'
  246. sleep 1 || break
  247. done > >(uniq_linebuffered) &
  248. childpid=$!
  249. hc --idle
  250. kill $childpid
  251. } 2> /dev/null | {
  252. IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
  253. visible=true
  254. date=""
  255. windowtitle=""
  256. while true ; do
  257.  
  258. ### Output ###
  259. # This part prints dzen data based on the _previous_ data handling run,
  260. # and then waits for the next event to happen.
  261.  
  262. bordercolor="#000000"
  263. separator="^bg()^fg($selbg)|"
  264. # draw tags
  265. for i in "${tags[@]}" ; do
  266. case ${i:0:1} in
  267. '#')
  268. echo -n "^bg($selbg)^fg($selfg)"
  269. ;;
  270. '+')
  271. echo -n "^bg(#9CA668)^fg(#141414)"
  272. ;;
  273. ':')
  274. echo -n "^bg()^fg(#ffffff)"
  275. ;;
  276. '!')
  277. echo -n "^bg(#FF0675)^fg(#141414)"
  278. ;;
  279. *)
  280. echo -n "^bg()^fg(#ababab)"
  281. ;;
  282. esac
  283. if [ ! -z "$dzen2_svn" ] ; then
  284. # clickable tags if using SVN dzen
  285. echo -n "^ca(1,\"${herbstclient_command[@]:-herbstclient}\" "
  286. echo -n "focus_monitor \"$monitor\" && "
  287. echo -n "\"${herbstclient_command[@]:-herbstclient}\" "
  288. echo -n "use \"${i:1}\") ${i:1} ^ca()"
  289. else
  290. # non-clickable tags if using older dzen
  291. echo -n " ${i:1} "
  292. fi
  293. done
  294. echo -n "$separator"
  295. echo -n "^bg()^fg() ${windowtitle//^/^^}"
  296. # small adjustments
  297. right="$separator^bg() $date $separator"
  298. right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
  299. # get width of right aligned text.. and add some space..
  300. width=$($textwidth "$font" "$right_text_only ")
  301. echo -n "^pa($(($panel_width - $width)))$right"
  302. echo
  303.  
  304. ### Data handling ###
  305. # This part handles the events generated in the event loop, and sets
  306. # internal variables based on them. The event and its arguments are
  307. # read into the array cmd, then action is taken depending on the event
  308. # name.
  309. # "Special" events (quit_panel/togglehidepanel/reload) are also handled
  310. # here.
  311.  
  312. # wait for next event
  313. IFS=$'\t' read -ra cmd || break
  314. # find out event origin
  315. case "${cmd[0]}" in
  316. tag*)
  317. #echo "resetting tags" >&2
  318. IFS=$'\t' read -ra tags <<< "$(hc tag_status $monitor)"
  319. ;;
  320. date)
  321. #echo "resetting date" >&2
  322. date="${cmd[@]:1}"
  323. ;;
  324. quit_panel)
  325. exit
  326. ;;
  327. togglehidepanel)
  328. currentmonidx=$(hc list_monitors | sed -n '/\[FOCUS\]$/s/:.*//p')
  329. if [ "${cmd[1]}" -ne "$monitor" ] ; then
  330. continue
  331. fi
  332. if [ "${cmd[1]}" = "current" ] && [ "$currentmonidx" -ne "$monitor" ] ; then
  333. continue
  334. fi
  335. echo "^togglehide()"
  336. if $visible ; then
  337. visible=false
  338. hc pad $monitor 0
  339. else
  340. visible=true
  341. hc pad $monitor $panel_height
  342. fi
  343. ;;
  344. reload)
  345. exit
  346. ;;
  347. focus_changed|window_title_changed)
  348. windowtitle="${cmd[@]:2}"
  349. ;;
  350. #player)
  351. # ;;
  352. esac
  353. done
  354.  
  355. ### dzen2 ###
  356. # After the data is gathered and processed, the output of the previous block
  357. # gets piped to dzen2.
  358.  
  359. } 2> /dev/null | dzen2 -w $panel_width -x $x -y $y -fn "$font" -h $panel_height \
  360. -e 'button3=;button4=exec:herbstclient use_index -1;button5=exec:herbstclient use_index +1' \
  361. -ta l -bg "$bgcolor" -fg '#efefef'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement