Exam config (scrot) (+1 likes)
aleks223 Jan 18, 2012 (wms/herbstluft)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | #!/bin/bash
hc () {
herbstclient "$@"
}
hc pad 0 14 0 0 0
###################
### Colors ###
###################
hc set frame_border_active_color '#808080'
hc set frame_border_normal_color '#151515'
hc set frame_bg_transparent 1
hc set frame_border_width 0
hc set window_border_width 2
hc set window_border_normal_color '#151515'
hc set window_border_active_color '#808080'
hc set snap_distance 2
hc set snap_gap 2
hc set window_gap 4
hc set default_frame_layout 2
herbstclient set tree_style '╾│ ├╰╼─╮'
hc emit_hook reload
###################
### Keybindings ###
###################
keyunbind -F
# Modifier variables
s=Shift
c=Control
m=Mod4
a=Mod1
# Layout control
hc keybind $a-r remove
hc keybind $a-space cycle_layout 1
hc keybind $a-v split vertical 0.5
hc keybind $a-h split horizontal 0.5
hc keybind $a-f floating toggle
hc keybind $a-m fullscreen toggle
hc keybind $a-t pseudotile toggle
# Layout manager
hc keybind $m-j spawn hlwm-layout-manager load
hc keybind $m-$s-j spawn hlwm-layout-manager
# Mouse control
hc mousebind $m-Button1 move
hc mousebind $m-Button2 resize
hc mousebind $m-Button3 zoom
# Focus window
hc keybind $c-Left focus left
hc keybind $c-Down focus down
hc keybind $c-Up focus up
hc keybind $c-Right focus right
# Cycle focus
hc keybind $m-BackSpace cycle_monitor
hc keybind $m-k cycle_all +1
hc keybind $m-$s-k cycle_all -1
hc keybind $m-h cycle
# Move window
hc keybind $c-$a-Left shift left
hc keybind $c-$a-Down shift down
hc keybind $c-$a-Up shift up
hc keybind $c-$a-Right shift right
# Resize window
step=0.05
hc keybind $m-$c-j resize left +$step
hc keybind $m-$c-h resize down +$step
hc keybind $m-$c-l resize up +$step
hc keybind $m-$c-k resize right +$step
# Close window
hc keybind $a-q close
# Quit/Reload
hc keybind $m-$c-r reload
hc keybind $m-$s-q spawn wm-session-manager menu
hc keybind $m-$c-q quit
# Apps
hc keybind $m-Return spawn urxvt
hc keybind $m-t spawn urxvt -e tmux
hc keybind $m-a spawn urxvt -e tmux a
hc keybind $m-n spawn urxvt -e ncmpcpp
hc keybind $m-c spawn chromium
hc keybind $m-p spawn pcmanfm
hc keybind $m-g spawn gvim
hc keybind $m-e spawn emacs
hc keybind $m-x spawn dmenu_run -p '>>>' -fn 'bitocrafull' -nb grey10 -nf white -sb grey10 -sf orange
hc keybind $m-$c-Left spawn mpc prev
hc keybind $m-$c-Down spawn mpc toggle
hc keybind $m-$c-Right spawn mpc next
# Tags
TAG_NAMES=(term web dev dl art)
TAG_KEYS=( {1..5} 0 )
hc rename default "${TAG_NAMES[0]}" || true
for i in ${!TAG_NAMES[@]} ; do
hc add "${TAG_NAMES[$i]}"
key="${TAG_KEYS[$i]}"
if ! [ -z "$key" ] ; then
hc keybind "$m-$key" use "${TAG_NAMES[$i]}"
hc keybind "$m-$s-$key" move "${TAG_NAMES[$i]}"
fi
done
####################
### Window Rules ###
####################
hc unrule -F
hc rule focus=on
hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' tag=term focus=on
hc rule class~'([Mm][Pp]layer)' focus=on
hc rule class~'([Mm][Pp]layer)' pseudotile=on
hc rule class~'log' index=10
hc rule class=Deluge tag=dl
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' pseudotile=on
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK)' manage=off
hc rule class=Chromium tag=web
hc rule class=Gvim tag=dev
hc rule class=Emacs tag=dev
# GIMP
# ensure there is a gimp tag
hc add gimp
hc load gimp '
(split horizontal:0.850000:0
(split horizontal:0.200000:1
(clients vertical:0)
(clients grid:0))
(clients vertical:0))
' # load predefined layout
# center all other gimp windows on gimp tag
hc rule class=Gimp tag=gimp index=01 pseudotile=on
hc rule class=Gimp windowrole~'gimp-(image-window|toolbox|dock)' \
pseudotile=off
hc rule class=Gimp windowrole=gimp-toolbox focus=off index=00
hc rule class=Gimp windowrole=gimp-dock focus=off index=1
#####################
### Start Panel ###
#####################
( $HOME/.config/herbstluftwm/panel.sh &)
|
x
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | #!/cin/bash
monitor=${1:-0}
geometry=( $(herbstclient monitor_rect "$monitor") )
if [ -z "$geometry" ] ;then
echo "Invalid monitor $monitor"
exit 1
fi
# geometry has the format: WxH+X+Y
x=${geometry[0]}
y=${geometry[1]}
width=${geometry[2]}
height=14
font="-windows-montecarlo-medium-r-normal--11-110-72-72-c-60-microsoft-cp1252"
bgcolor='#151515'
function uniq_linebuffered() {
awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}
herbstclient pad $monitor $height
{
# events:
while true ; do
if ! mpc status >/dev/null; then
sleep 5
else
echo "player $(mpc current)"
mpc idleloop player
fi
done &
while true ; do
date +'date ^fg(#505050)%a %d %b ^fg(#151515)%H:%M'
sleep 1 || break
done > >(uniq_linebuffered) &
childpid=$!
herbstclient --idle
kill $childpid
} 2> /dev/null | {
TAGS=( $(herbstclient tag_status $monitor) )
date=""
while true ; do
bordercolor="#26221C"
hintcolor="#ff8f00"
separator="^fg(#141414)^ro(1x$height)^fg()"
# draw tags
for i in "${TAGS[@]}" ; do
case ${i:0:1} in
'#')
echo -n "^bg(#5496ff)^fg(#141414)"
;;
'+')
echo -n "^bg(#808080)^fg(#141414)"
;;
':')
echo -n "^bg(#404040)^fg(#141414)"
;;
'!')
echo -n "^bg(#ff8f00)^fg(#141414)"
;;
*)
echo -n "^bg()^fg()"
;;
esac
echo -n "^ca(1,herbstclient focus_monitor $monitor && "'herbstclient use "'${i:1}'") '"${i:1} ^ca()"
echo -n "$separator"
done
echo -n "^bg()^p(_CENTER)"
# small adjustments
battery=$(expr $(expr $(cat /sys/class/power_supply/BAT*/charge_now) \* 100) / $(cat /sys/class/power_supply/BAT*/charge_full))
mpd=$(pidof mpd)
right="$separator^bg($hintcolor) ^fg(#151515)"
if [ "$mpd" != "" ] ;then
right="$right $song $separator ^fg(#151515)"
fi
if [ "$battery" != "/" ] ;then
right="$right $battery% $separator ^fg(#151515)"
fi
right="$right $date $separator"
right_text_only=$(echo -n "$right"|sed 's.\^[^(]*([^)]*)..g')
# get width of right aligned text.. and add some space..
width=$(textwidth "$font" "$right_text_only ")
echo -n "^p(_RIGHT)^p(-$width)$right"
echo
# wait for next event
read line || break
cmd=( $line )
# find out event origin
case "${cmd[0]}" in
tag*)
#echo "reseting tags" >&2
TAGS=( $(herbstclient tag_status $monitor) )
;;
date)
#echo "reseting date" >&2
date="${cmd[@]:1}"
;;
quit_panel)
exit
;;
reload)
exit
;;
player)
song=$(mpc current)
;;
esac
done
} 2> /dev/null | dzen2 -w $width -x $x -y $y -fn "$font" -h $height \
-ta l -bg "$bgcolor" -fg '#efefef'
|
x
Notes
Here you go.
Panel is started from within autostart file, so make sure you performed a chmod a+x on it…
TSFX said about 12 years ago
What term are you using?