2008-05-30 01:22:56 +04:00
|
|
|
#!BINSH -f
|
2007-02-03 01:57:40 +03:00
|
|
|
# Configure wmii
|
2008-01-22 07:21:37 +03:00
|
|
|
wmiiscript=wmiirc # For wmii.sh
|
|
|
|
. wmii.sh
|
2006-02-25 21:36:53 +03:00
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# Configuration Variables
|
2006-04-12 10:53:06 +04:00
|
|
|
MODKEY=Mod1
|
|
|
|
UP=k
|
|
|
|
DOWN=j
|
|
|
|
LEFT=h
|
|
|
|
RIGHT=l
|
|
|
|
|
2008-01-22 02:22:42 +03:00
|
|
|
# Bars
|
|
|
|
noticetimeout=5
|
|
|
|
noticebar=/rbar/!notice
|
|
|
|
|
2007-03-31 06:35:40 +04:00
|
|
|
# Colors tuples: "<text> <background> <border>"
|
2008-01-21 02:00:21 +03:00
|
|
|
WMII_NORMCOLORS='#000000 #c1c48b #81654f'
|
|
|
|
WMII_FOCUSCOLORS='#000000 #81654f #000000'
|
2007-03-31 06:35:40 +04:00
|
|
|
|
2006-12-18 13:50:18 +03:00
|
|
|
WMII_BACKGROUND='#333333'
|
2007-05-03 00:46:26 +04:00
|
|
|
WMII_FONT='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
|
2006-12-18 13:50:18 +03:00
|
|
|
|
2007-03-04 01:51:46 +03:00
|
|
|
set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
|
2006-12-18 13:50:18 +03:00
|
|
|
WMII_TERM="xterm"
|
2007-03-04 01:51:46 +03:00
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# Column Rules
|
2007-03-31 06:35:40 +04:00
|
|
|
wmiir write /colrules <<!
|
2008-01-21 02:00:21 +03:00
|
|
|
/gimp/ -> 17+83+41
|
|
|
|
/.*/ -> 62+38 # Golden Ratio
|
2007-03-31 06:35:40 +04:00
|
|
|
!
|
2006-02-25 21:36:53 +03:00
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# Tagging Rules
|
2007-03-31 06:35:40 +04:00
|
|
|
wmiir write /tagrules <<!
|
2008-01-21 02:00:21 +03:00
|
|
|
/MPlayer|VLC/ -> ~
|
2007-03-31 06:35:40 +04:00
|
|
|
!
|
2006-03-10 19:17:59 +03:00
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# Status Bar Info
|
|
|
|
status() {
|
2007-03-04 01:51:46 +03:00
|
|
|
echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date)
|
2007-02-23 06:36:50 +03:00
|
|
|
}
|
|
|
|
|
2008-06-02 19:52:29 +04:00
|
|
|
local_events() { true;}
|
2008-05-20 03:26:43 +04:00
|
|
|
wi_runconf -s wmiirc_local
|
|
|
|
|
2008-01-22 02:22:42 +03:00
|
|
|
echo $WMII_NORMCOLORS | wmiir create $noticebar
|
|
|
|
|
2007-03-31 06:35:40 +04:00
|
|
|
# Event processing
|
2008-05-30 01:22:56 +04:00
|
|
|
events() {
|
2008-05-20 03:26:43 +04:00
|
|
|
sed 's/^ //' <<'!'
|
2007-03-31 06:35:40 +04:00
|
|
|
# Events
|
|
|
|
Event CreateTag
|
|
|
|
echo "$WMII_NORMCOLORS" "$@" | wmiir create "/lbar/$@"
|
|
|
|
Event DestroyTag
|
|
|
|
wmiir remove "/lbar/$@"
|
|
|
|
Event FocusTag
|
|
|
|
wmiir xwrite "/lbar/$@" "$WMII_FOCUSCOLORS" "$@"
|
|
|
|
Event UnfocusTag
|
|
|
|
wmiir xwrite "/lbar/$@" "$WMII_NORMCOLORS" "$@"
|
|
|
|
Event UrgentTag
|
|
|
|
shift
|
|
|
|
wmiir xwrite "/lbar/$@" "*$@"
|
|
|
|
Event NotUrgentTag
|
|
|
|
shift
|
|
|
|
wmiir xwrite "/lbar/$@" "$@"
|
2008-01-22 02:22:42 +03:00
|
|
|
Event LeftBarClick LeftBarDND
|
2007-03-31 06:35:40 +04:00
|
|
|
shift
|
|
|
|
wmiir xwrite /ctl view "$@"
|
2008-01-22 02:22:42 +03:00
|
|
|
Event Unresponsive
|
|
|
|
{
|
|
|
|
client=$1; shift
|
|
|
|
msg="The following client is not responding. What would you like to do?$wi_nl"
|
|
|
|
resp=$(wihack -transient $client \
|
|
|
|
xmessage -nearmouse -buttons Kill,Wait -print \
|
|
|
|
"$msg $(wmiir read /client/sel/label)")
|
|
|
|
if [ "$resp" = Kill ]; then
|
|
|
|
wmiir xwrite /client/$client/ctl slay &
|
|
|
|
fi
|
|
|
|
}&
|
|
|
|
Event Notice
|
|
|
|
wmiir xwrite $noticebar $wi_arg
|
|
|
|
|
|
|
|
kill $xpid 2>/dev/null # Let's hope this isn't reused...
|
|
|
|
{ sleep $noticetimeout; wmiir xwrite $noticebar ' '; }&
|
|
|
|
xpid = $!
|
2008-05-30 01:22:56 +04:00
|
|
|
Menu Client-3-Delete
|
|
|
|
wmiir xwrite /client/$1/ctl kill
|
|
|
|
Menu Client-3-Fullscreen {
|
|
|
|
wmiir xwrite /client/$1/ctl Fullscreen on
|
|
|
|
Event ClientMouseDown
|
|
|
|
wi_fnmenu Client $2 $1 &
|
|
|
|
Menu LBar-3-Delete
|
|
|
|
tag=$1; clients=$(wmiir read "/tag/$tag/index" | awk '/[^#]/{print $2}')
|
|
|
|
for c in $clients; do
|
|
|
|
if [ "$tag" = "$(wmiir read /client/$c/tags)" ]; then
|
|
|
|
wmiir xwrite /client/$c/ctl kill
|
|
|
|
else
|
|
|
|
wmiir xwrite /client/$c/tags -$tag
|
|
|
|
fi
|
|
|
|
if [ "$tag" = "$(wi_seltag)" ]; then
|
|
|
|
newtag=$(wi_tags | awk -v't='$tag '
|
|
|
|
$1 == t { if(!l) getline l
|
|
|
|
print l
|
|
|
|
exit }
|
|
|
|
{ l = $0 }')
|
|
|
|
wmiir xwrite /ctl view $newtag
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
Event LeftBarMouseDown
|
|
|
|
wi_fnmenu LBar "$@" &
|
2007-03-31 06:35:40 +04:00
|
|
|
# Actions
|
|
|
|
Action quit
|
|
|
|
wmiir xwrite /ctl quit
|
2007-06-01 05:05:59 +04:00
|
|
|
Action exec
|
|
|
|
wmiir xwrite /ctl exec "$@"
|
2007-03-31 06:35:40 +04:00
|
|
|
Action rehash
|
|
|
|
proglist $PATH >$progsfile
|
|
|
|
Action status
|
|
|
|
set +xv
|
|
|
|
if wmiir remove /rbar/status 2>/dev/null; then
|
|
|
|
sleep 2
|
|
|
|
fi
|
|
|
|
echo "$WMII_NORMCOLORS" | wmiir create /rbar/status
|
|
|
|
while status | wmiir write /rbar/status; do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
# Key Bindings
|
|
|
|
Key $MODKEY-Control-t
|
|
|
|
case $(wmiir read /keys | wc -l | tr -d ' \t\n') in
|
|
|
|
0|1)
|
2008-01-21 02:00:21 +03:00
|
|
|
echo -n "$Keys" | wmiir write /keys
|
2007-03-31 06:35:40 +04:00
|
|
|
wmiir xwrite /ctl grabmod $MODKEY;;
|
|
|
|
*)
|
|
|
|
wmiir xwrite /keys $MODKEY-Control-t
|
|
|
|
wmiir xwrite /ctl grabmod Mod3;;
|
|
|
|
esac
|
|
|
|
Key $MODKEY-space
|
|
|
|
wmiir xwrite /tag/sel/ctl select toggle
|
|
|
|
Key $MODKEY-d
|
2008-06-01 19:28:37 +04:00
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel default-max
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-s
|
2008-06-01 19:28:37 +04:00
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel stack-max
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-m
|
2008-06-01 19:28:37 +04:00
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel stack+max
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-a
|
2008-01-21 02:00:21 +03:00
|
|
|
Action $(wi_actions | wi_menu) &
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-p
|
2008-03-08 20:11:53 +03:00
|
|
|
eval wmiir setsid "$(wi_menu <$progsfile)" &
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-t
|
2008-01-22 07:21:37 +03:00
|
|
|
wmiir xwrite /ctl view $(wi_tags | wi_menu) &
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-Return
|
2008-05-30 01:22:56 +04:00
|
|
|
eval wmiir setsid $WMII_TERM &
|
2007-05-03 00:46:26 +04:00
|
|
|
Key $MODKEY-Shift-space
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel toggle
|
2007-11-16 16:46:31 +03:00
|
|
|
Key $MODKEY-f
|
|
|
|
wmiir xwrite /client/sel/ctl Fullscreen toggle
|
2007-05-03 00:46:26 +04:00
|
|
|
Key $MODKEY-Shift-c
|
|
|
|
wmiir xwrite /client/sel/ctl kill
|
|
|
|
Key $MODKEY-Shift-t
|
2008-01-22 07:21:37 +03:00
|
|
|
wmiir xwrite "/client/$(wmiir read /client/sel/ctl)/tags" $(wi_tags | wi_menu) &
|
2007-05-03 00:46:26 +04:00
|
|
|
Key $MODKEY-$LEFT
|
|
|
|
wmiir xwrite /tag/sel/ctl select left
|
|
|
|
Key $MODKEY-$RIGHT
|
|
|
|
wmiir xwrite /tag/sel/ctl select right
|
|
|
|
Key $MODKEY-$DOWN
|
|
|
|
wmiir xwrite /tag/sel/ctl select down
|
|
|
|
Key $MODKEY-$UP
|
|
|
|
wmiir xwrite /tag/sel/ctl select up
|
2008-06-02 19:52:29 +04:00
|
|
|
Key $MODKEY-Control-$DOWN
|
|
|
|
wmiir xwrite /tag/sel/ctl select down stack
|
|
|
|
Key $MODKEY-Control-$UP
|
|
|
|
wmiir xwrite /tag/sel/ctl select up stack
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-Shift-$LEFT
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel left
|
|
|
|
Key $MODKEY-Shift-$RIGHT
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel right
|
|
|
|
Key $MODKEY-Shift-$DOWN
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel down
|
|
|
|
Key $MODKEY-Shift-$UP
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel up
|
|
|
|
!
|
2007-03-08 00:08:19 +03:00
|
|
|
for i in 0 1 2 3 4 5 6 7 8 9; do
|
2008-05-20 03:26:43 +04:00
|
|
|
sed 's/^ //' <<!
|
2007-03-31 06:35:40 +04:00
|
|
|
Key $MODKEY-$i
|
|
|
|
wmiir xwrite /ctl view "$i"
|
|
|
|
Key $MODKEY-Shift-$i
|
|
|
|
wmiir xwrite /client/sel/tags "$i"
|
|
|
|
!
|
2007-03-08 00:08:19 +03:00
|
|
|
done
|
2008-05-30 01:22:56 +04:00
|
|
|
}
|
2008-05-20 03:26:43 +04:00
|
|
|
wi_events <<!
|
2008-05-30 01:22:56 +04:00
|
|
|
$(events)
|
2008-06-02 19:52:29 +04:00
|
|
|
$(local_events)
|
2008-05-20 03:26:43 +04:00
|
|
|
!
|
|
|
|
unset events local_events
|
2007-03-08 00:08:19 +03:00
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# WM Configuration
|
2008-01-21 02:00:21 +03:00
|
|
|
wmiir write /ctl <<!
|
|
|
|
font $WMII_FONT
|
|
|
|
focuscolors $WMII_FOCUSCOLORS
|
|
|
|
normcolors $WMII_NORMCOLORS
|
|
|
|
grabmod $MODKEY
|
|
|
|
border 1
|
|
|
|
!
|
|
|
|
xsetroot -solid "$WMII_BACKGROUND" &
|
2007-02-03 01:57:40 +03:00
|
|
|
|
2008-10-17 02:54:03 +04:00
|
|
|
export WMII_FONT WMII_TERM
|
2007-06-01 05:05:59 +04:00
|
|
|
export WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
|
|
|
|
|
2007-03-31 06:35:40 +04:00
|
|
|
# Misc
|
2008-02-03 23:06:26 +03:00
|
|
|
progsfile="$(wmiir namespace)/.proglist"
|
2008-05-30 01:22:56 +04:00
|
|
|
action status &
|
2008-01-21 02:00:21 +03:00
|
|
|
wi_proglist $PATH >$progsfile &
|
2007-03-31 06:35:40 +04:00
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# Setup Tag Bar
|
2008-05-20 03:26:43 +04:00
|
|
|
IFS="$wi_nl"
|
2008-01-22 02:22:42 +03:00
|
|
|
wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,')
|
|
|
|
seltag=$(wmiir read /tag/sel/ctl | sed 1q)
|
2008-05-20 03:26:43 +04:00
|
|
|
unset IFS
|
2008-01-21 02:00:21 +03:00
|
|
|
wi_tags | while read tag
|
2008-01-18 23:57:54 +03:00
|
|
|
do
|
2008-01-18 23:05:45 +03:00
|
|
|
if [ "$tag" = "$seltag" ]; then
|
|
|
|
echo "$WMII_FOCUSCOLORS" "$tag"
|
2007-02-11 06:04:13 +03:00
|
|
|
else
|
2008-01-18 23:05:45 +03:00
|
|
|
echo "$WMII_NORMCOLORS" "$tag"
|
|
|
|
fi | wmiir create "/lbar/$tag"
|
2007-02-11 06:04:13 +03:00
|
|
|
done
|
|
|
|
|
2008-01-21 02:00:21 +03:00
|
|
|
wi_eventloop
|
2008-01-18 23:05:45 +03:00
|
|
|
|