Commit a85ab344 authored by epsi sayidina's avatar epsi sayidina

herbstluftwm: modularized

parent 6d55d715
......@@ -3,152 +3,140 @@
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# google material colors
# https://material.io/guidelines/style/color.html
colWhite='#ffffff'
colBlack='#000000'
colGrey50='#fafafa'
colGrey100='#f5f5f5'
colGrey200='#eeeeee'
colGrey300='#e0e0e0'
colGrey400='#bdbdbd'
colGrey500='#9e9e9e'
colGrey600='#757575'
colGrey700='#616161'
colGrey800='#424242'
colGrey900='#212121'
# Associative Array (Hash)
declare -A color=(
['white']='#ffffff'
['black']='#000000'
colRed50='#ffebee'
colRed100='#ffcdd2'
colRed200='#ef9a9a'
colRed300='#e57373'
colRed400='#ef5350'
colRed500='#f44336'
colRed600='#e53935'
colRed700='#d32f2f'
colRed800='#c62828'
colRed900='#b71c1c'
colRedA100='#ff8a80'
colRedA200='#ff5252'
colRedA400='#ff1744'
colRedA700='#d50000'
['grey50']='#fafafa'
['grey100']='#f5f5f5'
['grey200']='#eeeeee'
['grey300']='#e0e0e0'
['grey400']='#bdbdbd'
['grey500']='#9e9e9e'
['grey600']='#757575'
['grey700']='#616161'
['grey800']='#424242'
['grey900']='#212121'
colPink50='#fce4ec'
colPink100='#f8bbd0'
colPink200='#f48fb1'
colPink300='#f06292'
colPink400='#ec407a'
colPink500='#e91e63'
colPink600='#d81b60'
colPink700='#c2185b'
colPink800='#ad1457'
colPink900='#880e4f'
colPinkA100='#ff80ab'
colPinkA200='#ff4081'
colPinkA400='#f50057'
colPinkA700='#c51162'
['red50']='#ffebee'
['red100']='#ffcdd2'
['red200']='#ef9a9a'
['red300']='#e57373'
['red400']='#ef5350'
['red500']='#f44336'
['red600']='#e53935'
['red700']='#d32f2f'
['red800']='#c62828'
['red900']='#b71c1c'
['redA100']='#ff8a80'
['redA200']='#ff5252'
['redA400']='#ff1744'
['redA700']='#d50000'
colIndigo50='#e8eaf6'
colIndigo100='#c5cae9'
colIndigo200='#9fa8da'
colIndigo300='#7986cb'
colIndigo400='#5c6bc0'
colIndigo500='#3f51b5'
colIndigo600='#3949ab'
colIndigo700='#303f9f'
colIndigo800='#283593'
colIndigo900='#1a237e'
colIndigoA100='#8c9eff'
colIndigoA200='#536dfe'
colIndigoA400='#3d5afe'
colIndigoA700='#304ffe'
['pink50']='#fce4ec'
['pink100']='#f8bbd0'
['pink200']='#f48fb1'
['pink300']='#f06292'
['pink400']='#ec407a'
['pink500']='#e91e63'
['pink600']='#d81b60'
['pink700']='#c2185b'
['pink800']='#ad1457'
['pink900']='#880e4f'
['pinkA100']='#ff80ab'
['pinkA200']='#ff4081'
['pinkA400']='#f50057'
['pinkA700']='#c51162'
colBlue50='#e3f2fd'
colBlue100='#bbdefb'
colBlue200='#90caf9'
colBlue300='#64b5f6'
colBlue400='#42a5f5'
colBlue500='#2196f3'
colBlue600='#1e88e5'
colBlue700='#1976d2'
colBlue800='#1565c0'
colBlue900='#0d47a1'
colBlueA100='#82b1ff'
colBlueA200='#448aff'
colBlueA400='#2979ff'
colBlueA700='#2962ff'
['blue50']='#e3f2fd'
['blue100']='#bbdefb'
['blue200']='#90caf9'
['blue300']='#64b5f6'
['blue400']='#42a5f5'
['blue500']='#2196f3'
['blue600']='#1e88e5'
['blue700']='#1976d2'
['blue800']='#1565c0'
['blue900']='#0d47a1'
['blueA100']='#82b1ff'
['blueA200']='#448aff'
['blueA400']='#2979ff'
['blueA700']='#2962ff'
colYellow50='#fffde7'
colYellow100='#fff9c4'
colYellow200='#fff59d'
colYellow300='#fff176'
colYellow400='#ffee58'
colYellow500='#ffeb3b'
colYellow600='#fdd835'
colYellow700='#fbc02d'
colYellow800='#f9a825'
colYellow900='#f57f17'
colYellowA100='#ffff8d'
colYellowA200='#ffff00'
colYellowA400='#ffea00'
colYellowA700='#ffd600'
['yellow50']='#fffde7'
['yellow100']='#fff9c4'
['yellow200']='#fff59d'
['yellow300']='#fff176'
['yellow400']='#ffee58'
['yellow500']='#ffeb3b'
['yellow600']='#fdd835'
['yellow700']='#fbc02d'
['yellow800']='#f9a825'
['yellow900']='#f57f17'
['yellowA100']='#ffff8d'
['yellowA200']='#ffff00'
['yellowA400']='#ffea00'
['yellowA700']='#ffd600'
colTeal50='#e0f2f1'
colTeal100='#b2dfdb'
colTeal200='#80cbc4'
colTeal300='#4db6ac'
colTeal400='#26a69a'
colTeal500='#009688'
colTeal600='#00897b'
colTeal700='#00796b'
colTeal800='#00695c'
colTeal900='#004d40'
colTealA100='#a7ffeb'
colTealA200='#64ffda'
colTealA400='#1de9b6'
colTealA700='#00bfa5'
['teal50']='#e0f2f1'
['teal100']='#b2dfdb'
['teal200']='#80cbc4'
['teal300']='#4db6ac'
['teal400']='#26a69a'
['teal500']='#009688'
['teal600']='#00897b'
['teal700']='#00796b'
['teal800']='#00695c'
['teal900']='#004d40'
['tealA100']='#a7ffeb'
['tealA200']='#64ffda'
['tealA400']='#1de9b6'
['tealA700']='#00bfa5'
colGreen50='#e8f5e9'
colGreen100='#c8e6c9'
colGreen200='#a5d6a7'
colGreen300='#81c784'
colGreen400='#66bb6a'
colGreen500='#4caf50'
colGreen600='#43a047'
colGreen700='#388e3c'
colGreen800='#2e7d32'
colGreen900='#1b5e20'
colGreenA100='#b9f6ca'
colGreenA200='#69f0ae'
colGreenA400='#00e676'
colGreenA700='#00c853'
['green50']='#e8f5e9'
['green100']='#c8e6c9'
['green200']='#a5d6a7'
['green300']='#81c784'
['green400']='#66bb6a'
['green500']='#4caf50'
['green600']='#43a047'
['green700']='#388e3c'
['green800']='#2e7d32'
['green900']='#1b5e20'
['greenA100']='#b9f6ca'
['greenA200']='#69f0ae'
['greenA400']='#00e676'
['greenA700']='#00c853'
colOrange50='#fff3e0'
colOrange100='#ffe0b2'
colOrange200='#ffcc80'
colOrange300='#ffb74d'
colOrange400='#ffa726'
colOrange500='#ff9800'
colOrange600='#fb8c00'
colOrange700='#f57c00'
colOrange800='#ef6c00'
colOrange900='#e65100'
colOrangeA100='#ffd180'
colOrangeA200='#ffab40'
colOrangeA400='#ff9100'
colOrangeA700='#ff6d00'
['orange50']='#fff3e0'
['orange100']='#ffe0b2'
['orange200']='#ffcc80'
['orange300']='#ffb74d'
['orange400']='#ffa726'
['orange500']='#ff9800'
['orange600']='#fb8c00'
['orange700']='#f57c00'
['orange800']='#ef6c00'
['orange900']='#e65100'
['orangeA100']='#ffd180'
['orangeA200']='#ffab40'
['orangeA400']='#ff9100'
['orangeA700']='#ff6d00'
colDeepOrange50='#fbe9e7'
colDeepOrange100='#ffccbc'
colDeepOrange200='#ffab91'
colDeepOrange300='#ff8a65'
colDeepOrange400='#ff7043'
colDeepOrange500='#ff5722'
colDeepOrange600='#f4511e'
colDeepOrange700='#e64a19'
colDeepOrange800='#d84315'
colDeepOrange900='#bf360c'
colDeepOrangeA100='#ff9e80'
colDeepOrangeA200='#ff6e40'
colDeepOrangeA400='#ff3d00'
colDeepOrangeA700='#dd2c00'
['deepOrange50']='#fbe9e7'
['deepOrange100']='#ffccbc'
['deepOrange200']='#ffab91'
['deepOrange300']='#ff8a65'
['deepOrange400']='#ff7043'
['deepOrange500']='#ff5722'
['deepOrange600']='#f4511e'
['deepOrange700']='#e64a19'
['deepOrange800']='#d84315'
['deepOrange900']='#bf360c'
['deepOrangeA100']='#ff9e80'
['deepOrangeA200']='#ff6e40'
['deepOrangeA400']='#ff3d00'
['deepOrangeA700']='#dd2c00'
)
#!/usr/bin/env bash
# this is a modularized config for herbstluftwm
# this is a simple config for herbstluftwm
. ~/.config/herbstluftwm/bash/assets/gmc.sh
. ~/.config/herbstluftwm/bash/config.sh
. ~/.config/herbstluftwm/bash/helper.sh
. ~/.config/herbstluftwm/bash/startup.sh
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# main
# background before wallpaper
xsetroot -solid "${color['blue500']}"
hc() {
# http://www.thegeekstuff.com/2010/05/bash-shell-special-parameters/
herbstclient "[email protected]"
}
# I don't know what it means. It might be reset or something
# emit_hook ARGS ...
# Emits a custom hook to all idling herbstclients.
# Read the manual in $ man herbstluftwm
hc emit_hook reload
# gap counter
echo 35 > /tmp/herbstluftwm-gap
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# google material colors
# do not repaint until unlock
hc lock
. ~/.config/herbstluftwm/bash/assets/gmc.sh
# standard
# remove all existing keybindings
hc keyunbind --all
hc mouseunbind --all
hc unrule -F
xsetroot -solid "$colBlue500"
set_tags_with_name
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# helpers
. ~/.config/herbstluftwm/bash/helper.sh
# do hash config
# hack associative array function argument passing using declare -p
hlc_keybindings
hlc_tags
hlc_theme
hlc_rules
# deprecated, use nitrogen instead
# hlc_feh_wallpaper
do_config "keybind" "$(declare -p keybinds)"
do_config "keybind" "$(declare -p tagskeybinds)"
do_config "mousebind" "$(declare -p mousebinds)"
do_config "attr" "$(declare -p attributes)"
do_config "set" "$(declare -p sets)"
do_config "rule" "$(declare -p rules)"
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# unlock, just to be sure
hc unlock
# finishing, some extra miles
#hc set tree_style '╾│ ├└╼─┐'
hc set tree_style '⊙│ ├╰»─╮'
# I'm not sure what in this is
bind_cycle_layout
# do multi monitor setup here, e.g.:
# hc set_monitors 1280x1024+0+0 1280x1024+1280+0
# or simply:
# hc detect_monitors
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# find the panel
panel=~/.config/herbstluftwm/bash/dzen2/panel.sh
[ -x "$panel" ] || panel=/etc/xdg/herbstluftwm/panel.sh
for monitor in $(herbstclient list_monitors | cut -d: -f1) ; do
# start it on each monitor
"$panel" $monitor &
done
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# $ man herbstluftwm
hc lock
# example of custom layout
layout='(split horizontal:0.5:0 '
layout+='(clients vertical:0) (clients vertical:0))'
hc load ${tag_names[0]} "$layout"
# tag number 5
hc floating 5 on
hc unlock
# hc set tree_style '╾│ ├└╼─┐'
hc set tree_style '⊙│ ├╰»─╮'
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# load on startup
# unlock, just to be sure
hc unlock
if hc silent new_attr bool my_not_first_autostart ; then
. ~/.config/herbstluftwm/bash/startup.sh
fi
# launch statusbar panel (e.g. dzen2 or lemonbar)
do_panel
# load on startup
startup_run
# and this is BASH manual
# http://tldp.org/LDP/abs/html/
# https://www.gnu.org/software/bash/manual/html_node/index.html
# reading
# /usr/share/doc/herbstluftwm/
# https://wiki.archlinux.org/index.php/Herbstluftwm
# http://crunchbang.org/forums/viewtopic.php?pid=204358%23p204358#p204358k
# config
# http://www.dotshare.it/category/wms/herbstluft/
# source
# https://github.com/herbstluftwm/herbstluftwm
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# dotshare.it panel
# dzen2
# http://dotshare.it/dots/600/
# http://dotshare.it/dots/352/
# http://dotshare.it/dots/305/
# http://dotshare.it/dots/302/
# http://dotshare.it/dots/712/
# http://dotshare.it/dots/720/
# lemonbar
# http://dotshare.it/dots/1095/
# http://dotshare.it/dots/1455/
# http://dotshare.it/dots/1444/ -- very cool
# http://dotshare.it/dots/1443/
# http://dotshare.it/dots/1135/
# no bar
# http://dotshare.it/dots/623/
# unknown
# http://dotshare.it/dots/736/
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# to do
# restructure by theme
# bg fg terbalik (standarisasi penulisan)
# slow process
# lemonbar: powerline arrow, clickable, system tray
# read source
# https://github.com/herbstluftwm/herbstluftwm
# urxvt
# google plus
# panel
## * nm-applet on dzen2
# ksh --pending
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# rewrite in Perl, Python, PHP and Ruby.
#!/usr/bin/env bash
# https://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion
# `seq 10` 0, or $(seq 10)
tag_names=( {1..9} )
tag_keys=( {1..9} 0 )
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# keybindings
# if you have a super key you will be much happier with Mod set to Mod4
# Mod=Mod1 # Use alt as the main modifier
# Alt=Mod1
# Mod=Mod4 # Use the super key as the main modifier
# Modifier variables
s=Shift
c=Control
m=Mod4
a=Mod1
# resizing frames
resizestep=0.05
declare -A keybinds=(
# session
["$m-$s-q"]='quit'
["$m-$s-r"]='reload'
["$m-$s-c"]='close'
# use your $TERMINAL with xterm as fallback
["$m-Return"]="spawn ${TERMINAL:-xfce4-terminal}"
# epsi
["$m-d"]='spawn dmenu_run_hlwm'
["$m-$s-d"]='spawn rofi -show run -opacity 90'
["$m-$s-x"]='spawn oblogout'
# basic movement
# focusing clients
["$m-Left"]='focus left'
["$m-Down"]='focus down'
["$m-Up"]='focus up'
["$m-Right"]='focus right'
["$m-h"]='focus left'
["$m-j"]='focus down'
["$m-k"]='focus up'
["$m-l"]='focus right'
# moving clients
["$m-$s-Left"]='shift left'
["$m-$s-Down"]='shift down'
["$m-$s-Up"]='shift up'
["$m-$s-Right"]='shift right'
["$m-$s-h"]='shift left'
["$m-$s-j"]='shift down'
["$m-$s-k"]='shift up'
["$m-$s-l"]='shift right'
# splitting frames
# create an empty frame at the specified direction
["$m-u"]='split bottom 0.5'
["$m-o"]='split right 0.5'
# let the current frame explode into subframes
["$m-$c-space"]='split explode'
# resizing frames
["$m-$c-h"]="resize left +$resizestep"
["$m-$c-j"]="resize down +$resizestep"
["$m-$c-k"]="resize up +$resizestep"
["$m-$c-l"]="resize right +$resizestep"
["$m-$c-Left"]="resize left +$resizestep"
["$m-$c-Down"]="resize down +$resizestep"
["$m-$c-Up"]="resize up +$resizestep"
["$m-$c-Right"]="resize right +$resizestep"
# MPC
["$m-$a-h"]='spawn mpc toggle'
["$m-$a-t"]='spawn mpc prev'
["$m-$a-n"]='spawn mpc next'
)
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# tags
declare -A tagskeybinds=(
# cycle through tags
["$m-period"]='use_index +1 --skip-visible'
["$m-comma"]='use_index -1 --skip-visible'
# layouting
["$m-r"]='remove'
["$m-s"]='floating toggle'
["$m-f"]='fullscreen toggle'
["$m-p"]='pseudotile toggle'
# focus
["$m-BackSpace"]='cycle_monitor'
["$m-Tab"]='cycle_all +1'
["$m-$s-Tab"]='cycle_all -1'
["$m-c"]='cycle'
["$m-i"]='jumpto urgent'
)
declare -A mousebinds=(
# mouse
["$m-Button1"]='move'
["$m-Button2"]='zoom'
["$m-Button3"]='resize'
)
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# theme
declare -A attributes=(
["theme.tiling.reset"]='1'
["theme.floating.reset"]='1'
["theme.active.color"]="${color['red500']}"
["theme.normal.color"]="${color['grey200']}"
["theme.urgent.color"]="${color['pink500']}"
["theme.inner_width"]='0'
["theme.inner_color"]='black'
["theme.border_width"]='2'
["theme.floating.border_width"]='4'
["theme.floating.outer_width"]='1'
["theme.floating.outer_color"]='black'
["theme.active.inner_color"]='#3E4A00'
["theme.active.outer_color"]='#3E4A00'
["theme.background_color"]='#141414'
)
declare -A sets=(
["frame_border_active_color"]="${color['grey200']}"
["frame_bg_active_color"]="${color['yellow900']}"
["frame_border_normal_color"]="${color['grey50']}"
["frame_bg_normal_color"]="${color['red500']}"
["frame_border_width"]='0'
["always_show_frame"]='0'
["frame_bg_transparent"]='1'
["frame_transparent_width"]='2'
["frame_gap"]='20'
["window_gap"]='0'
["frame_padding"]='0'
["smart_window_surroundings"]='0'
["smart_frame_surroundings"]='1'
["mouse_recenter_gap"]='0'
)
# ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----
# rules
declare -A rules=(
# normally focus new clients
["focus=on"]=''
# zero based array
["class=Firefox"]="tag=${tag_names[1]}"
["class=Chromium"]="tag=${tag_names[1]}"
["class=Geany"]="tag=${tag_names[2]}"
["class=Thunar"]="tag=${tag_names[3]}"
["class=gimp"]="tag=${tag_names[4]} pseudotile=on"
["class=Oblogout"]='fullscreen=on'
["class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)'"]='focus=on'
["windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)'"]='pseudotile=on'
# ["windowtype='_NET_WM_WINDOW_TYPE_DIALOG'"]='focus=on'
["windowtype='_NET_WM_WINDOW_TYPE_DIALOG'"]='fullscreen=on'
["windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)'"]='manage=off'
)