guest@dotshare [~/groups/wms/herbstluft] $ ls frhlingswind/ | cat

frühlingswind (scrot) (+8 likes)

crshd Jan 16, 2012 (wms/herbstluft)

autostart(raw, dl)

SCROT

  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
#!/bin/bash

# this is a simple config for herbstluftwm

# don't feel like typing "herbstclient" everytime
function hc() {
	herbstclient "$@"
}

# scripts
script=${XDG_CONFIG_HOME}/herbstluftwm/scripts

# frühlingswind
fruehlingswind="urxvt -geometry 40x1+125+0 -name fruehlingswind -e ${XDG_CONFIG_HOME}/herbstluftwm/fruehlingswind/window"

hc emit_hook reload

# Autostart
( ${XDG_CONFIG_HOME}/herbstluftwm/panel.sh &)
# ( feh --bg-fill /mnt/daten/Bilder/Wallpapers/crystalcave.png &)
( feh --bg-fill /mnt/daten/Bilder/Wallpapers/deadastronautse.png &)

hc set default_frame_layout 2

# keybindings
Mod=Mod4
hc keybind $Mod-Control-q quit
hc keybind $Mod-Shift-r reload
hc keybind $Mod-q close
hc keybind $Mod-Shift-q spawn ${script}/various "close-and-remove"

# applications
hc keybind $Mod-Return spawn urxvt
hc keybind $Mod-a spawn bashrun2
# hc keybind $Mod-v spawn emacs -l ${XDG_CONFIG_HOME}/emacs/init.el
# hc keybind $Mod-b spawn opera -pd ${XDG_CONFIG_HOME}/opera
# hc keybind $Mod-b spawn luakit
hc keybind $Mod-space spawn ${fruehlingswind} applications

# media keys
hc keybind XF86AudioNext spawn mpc next
hc keybind XF86AudioPrev spawn mpc prev
hc keybind XF86AudioPlay spawn mpc toggle
hc keybind XF86AudioStop spawn mpc stop

hc keybind XF86AudioRaiseVolume spawn /home/crshd/bin/dvol -i 5
hc keybind XF86AudioLowerVolume spawn /home/crshd/bin/dvol -d 5
hc keybind XF86AudioMute spawn /home/crshd/bin/dvol -t

hc keybind XF86AudioMedia spawn urxvt -e ncmpcpp

# tags
# TAG_NAMES=( {1..9} )
TAG_NAMES=( h e r b s t )
TAG_KEYS=( {1..9} 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 "$Mod-$key" use "${TAG_NAMES[$i]}"
        hc keybind "$Mod-Shift-$key" move "${TAG_NAMES[$i]}"
    fi
done

# layouting
hc keybind $Mod-r remove
hc keybind $Mod-c cycle_layout 1
hc keybind $Mod-s split vertical 0.5
hc keybind $Mod-Shift-s split horizontal 0.5
hc keybind $Mod-Shift-f floating toggle
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-p pseudotile toggle
hc keybind $Mod-t spawn ${script}/togglegap

# resizing
RESIZESTEP=0.05
hc keybind $Mod-Control-h resize left +$RESIZESTEP
hc keybind $Mod-Control-j resize down +$RESIZESTEP
hc keybind $Mod-Control-k resize up +$RESIZESTEP
hc keybind $Mod-Control-l resize right +$RESIZESTEP

# mouse
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button2 resize
hc mousebind $Mod-Button3 zoom

# focus
hc keybind $Mod-BackSpace   cycle_monitor
hc keybind $Mod-Tab         cycle_all +1
hc keybind $Mod-Shift-Tab   cycle_all -1
hc keybind $Mod-h focus left
hc keybind $Mod-j focus down
hc keybind $Mod-k focus up
hc keybind $Mod-l focus right
hc keybind $Mod-Shift-h shift left
hc keybind $Mod-Shift-j shift down
hc keybind $Mod-Shift-k shift up
hc keybind $Mod-Shift-l shift right

# colors
hc set frame_border_active_color '#000000'
hc set frame_border_normal_color '#000000'
hc set frame_bg_normal_color '#151515'
hc set frame_bg_active_color '#151515'
hc set frame_border_width 1
hc set window_border_width 2
hc set window_border_normal_color '#202020'
hc set window_border_active_color '#ffaf5f'

# layout
if [ $(cat ${XDG_DATA_HOME}/herbstluftwm/gap) = 0 ]; then
	hc set window_gap 0
else
	hc set window_gap 4
fi

for tag in ${TAG_NAMES}; do
	layoutfile=${XDG_DATA_HOME}/herbstluftwm/layout/${tag}
	if [ -f ${layoutfile} ]; then
		hc load ${tag} $(cat ${layoutfile})
	fi
done

# rules
hc unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3
hc rule focus=off # normally do not focus new clients
hc rule instance~'(bashrun.*|fruehlingswind)' manage=off focus=on
# give focus to most common terminals
hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
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 set tree_style "╾│ ├└╼─┐"

CLICK TO VIEW

x

panel.sh(raw, dl)

  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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
#!/bin/bash

#======~===~==============~===========~==
# GEOMETRY
#==~==========~=========~=============~~=
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=16
# font="-jmk-neep-medium-r-normal--10-80-75-75-c-50-iso8859-1"
font="-windows-montecarlo-medium-r-normal--11-110-72-72-c-60-microsoft-cp1252"

sep="^fg(#000000)^ro(1x$height)^fg()"


#======~===~==============~===========~==
# COLORS
#==~==========~=========~=============~~=

# get xresource colors
# read xresource colors to array "xrdb"
xrdb=( $(xrdb -query | grep -P "color[0-9]*:" | sort | cut -f 2-) )

# `sort` doesn't quite sort ascending, it sorts "0, 10, 11, 12, ..., 1, 2, 3, ...", so we need to fix.
# while we're at it, we might as well use proper names.

# define array "color" (actually a hash table)
declare -A color

# need this to get the values from xrdb one by one
index=0

# loop over color names
for name in black brightgreen brightyellow brightblue brightmagenta brightcyan brightwhite red green yellow blue magenta cyan white grey brightred; do
	# assign color value from array xrdb to hash "color"
	color[${name}]=${xrdb[$index]}
	# increase "index" by one, so we get the next color value for the next iteration
	((index++))
done

bgcolor='#0f0e0f'

separator_color='#000000'

hint_color_separator='#202020'

tag_active_color_fg='#151515'
tag_active_color_bg=${color["yellow"]}
tag_active_color_separator=${color["brightyellow"]}
# tag_active_color_separator='#ffdf7f'
tag_populated_color_fg='#efefef'
tag_populated_color_bg='#202020'
tag_populated_color_separator='#303030'
tag_notice_color_fg='#efefef'
tag_notice_color_bg=${color["red"]}
tag_notice_color_separator=${color["brightred"]}

#======~===~==============~===========~==
# ICONS
#==~==========~=========~=============~~=
iconpath=${XDG_CONFIG_HOME}/stumpwm/dzen/icons
function icon() {
	echo -n "^fg(#000000)^ro(1x$height)^fg()^bg(${color[${2}]})^fg(#151515) ^i(${iconpath}/${1}.xbm) ^fg(#000000)^ro(1x$height)^fg()^bg()"
}

#======~===~==============~===========~==
# MAIL
#==~==========~=========~=============~~=
gmaildir='/mnt/daten/Mail/Gmail/INBOX/new'
maildir='/mnt/daten/Mail/Mail/INBOX/new'

function mailcount() {
	count=0
	if [[ ! -n $(ls ${1}) ]]; then
		echo -n "0"
	else
		count=$(ls -1 ${1} | wc -l)
		echo -n ${count}
	fi
}

function mail() {
	echo -n $(icon mail blue) $(mailcount ${gmaildir}) $(mailcount ${maildir})
}

#======~===~==============~===========~==
# IRSSI
#==~==========~=========~=============~~=
irssilog=${XDG_DATA_HOME}/log/irssi/hilights.log
function irssi() {
	if [[ -f ${irssilog} ]]; then
		lastline=$(tail -n1 ${irssilog})
		echo -n $(icon balloon red) $(echo -n ${lastline} | cut -d " " -f -3)
	fi
}
#======~===~==============~===========~==
# CPU
#==~==========~=========~=============~~=
function temperature() {
	cpu=$(sensors | grep "Core" | cut -b 16-19)
	echo -n $(icon temp yellow) ${cpu}
}

#======~===~==============~===========~==
# MPD
#==~==========~=========~=============~~=
function m() {
	mpc -f %${1}% current | sed 's/ä/ae/g' | sed 's/ö/oe/g' | sed 's/ü/ue/g'
}
function nowplaying() {
	echo -n "$(icon note1 magenta) $(m title) ^fg(#909090)by^fg() $(m artist) ^fg(#909090)on^fg() $(m album)"
}

#======~===~==============~===========~==
# GET TO WORK
#==~==========~=========~=============~~=
function uniq_linebuffered() {
	awk '$0 != l { print ; l=$0 ; fflush(); }' "$@"
}

herbstclient pad $monitor $height
{
   # events:
   mpc idleloop player &
	while true ; do
		date +'date ^fg(#efefef) %H:%M^fg(#909090), %Y-%m-^fg(#efefef)%d'
		sleep 1 || break
	done > >(uniq_linebuffered)  &
	childpid=$!
	herbstclient --idle
	kill $childpid
} 2> /dev/null | {
	TAGS=( $(herbstclient tag_status $monitor) )
	date=""
	while true ; do
		bordercolor="#000000"
		hintcolor="#101010"

		# draw tags
		for i in "${TAGS[@]}" ; do
			case ${i:0:1} in
				'#')
					echo -n "^fg($tag_active_color_separator)^ro(1x$height)^fg()^bg($tag_active_color_bg)^fg($tag_active_color_fg)" ;;
				'+')
					echo -n "^fg()^ro(1x$height)^fg()^bg(#9CA668)^fg(#141414)";;
				':')
					echo -n "^fg($tag_populated_color_separator)^ro(1x$height)^fg()^bg($tag_populated_color_bg)^fg($tag_populated_color_fg)";;
				'!')
					echo -n "^fg($tag_notice_color_separator)^ro(1x$height)^fg()^bg($tag_notice_color_bg)^fg($tag_notice_color_fg)";;
				*)
					echo -n "^fg(#252525)^ro(1x$height)^fg()^bg()^fg()";;
			esac
			echo -n "^ca(1,herbstclient focus_monitor $monitor && "'herbstclient use "'${i:1}'") '"${i:1} ^ca()"
			echo -n "^fg($separator_color)^ro(1x$height)^fg()"
		done
		echo -n "^fg(#252525)^ro(1x$height)^fg()"
		echo -n "^bg()^p(_CENTER)"

		# small adjustments
		right=""
		for func in nowplaying temperature mail irssi; do
			right="${right} $(${func})"
		done
		right="${right} ^bg($hintcolor)$(icon clock2 green) $date"
		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;;
		esac
	done
} 2> /dev/null | dzen2 -w $width -x $x -y $y -fn "$font" -h $height \
	-ta l -bg "$bgcolor" -fg '#efefef'
 

x

scripts_various(raw, dl)

1
2
3
4
5
6
7
8
#!/bin/bash

case ${1} in
	"close-and-remove" )
		herbstclient close
		herbstclient remove
		;;
esac
 

x

scripts_togglegap(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#!/bin/bash

function hc() {
    herbstclient "$@"
}

gapfile=${XDG_DATA_HOME}/herbstluftwm/gap
if [ $(cat ${gapfile}) = 0 ]; then
	hc set window_gap 4
	echo 1 > ${gapfile}
else
	hc set window_gap 0
	echo 0 > ${gapfile}
fi
 

x

fw_applications(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
#!/bin/bash
function spawn() {
	( ${@} &)
}

case ${1} in
	# b ) spawn luakit ;;
	b ) spawn firefox ;;
#	v ) spawn emacs -l ${XDG_CONFIG_HOME}/emacs/init.el ;;
	v ) spawn gvim ;;
	n ) spawn urxvt -e ncmpcpp ;;
	m ) spawn urxvt -e mutt -F ${XDG_CONFIG_HOME}/mutt/muttrc ;;
	g ) spawn gimp-2.7 ;;
	f ) spawn firefox ;;
esac

sleep 5
 

x

fw_window(raw, dl)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
#!/bin/bash

# i be focus!
win=$(xdotool search --classname fruehlingswind)
xdotool windowfocus ${win}

echo -n "${1}:"
read -n 1 -t 5 key

(nohup ${XDG_CONFIG_HOME}/herbstluftwm/fruehlingswind/${1} ${key} &)

sleep 0.5
 

x

Notes

My Herbstluft config. With a very quick and dirty hack to get chained keybindings.

tree

Comments

katsh said about 11 years ago

More interested in that weechat config and term colors.
share?

crshd said about 11 years ago

@katsh Colors are jellybeans if I’m not mistaken. Not sure what Weechat config you are talking about…

katsh said about 11 years ago

@crshd thanks. (i thought the irc client was weechat. there’s a similar one posted here on .share, i thought yours was a modified version of it).
btw, great taste on glenn arthur’s wallpaper art =)

edited about 11 years ago

crshd said about 11 years ago

Nope, that’s my very own irssi theme. And the wallpaper is JThree…

katsh said about 11 years ago

A+ theme!

i think wallpaper is a group effort, but the girl in it is a very distinctive glenn arthur look
http://www.facebook.com/artist.glennarthurart/photos

(he has good stuff you should check!)

edited about 11 years ago

Neuromatic said about 11 years ago

Hey Dude, please post your Shell RC.

crshd said about 11 years ago

@Neuromatic Dude, done did that already. About 2 years ago.