2009-09-29 01:24:01 +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
|
|
|
|
2009-10-10 22:57:00 +04:00
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# Configuration Variables
|
2009-10-10 22:57:00 +04:00
|
|
|
MODKEY=Mod4
|
2006-04-12 10:53:06 +04:00
|
|
|
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>"
|
2009-10-10 00:40:33 +04:00
|
|
|
export WMII_NORMCOLORS='#000000 #c1c48b #81654f'
|
|
|
|
export WMII_FOCUSCOLORS='#000000 #81654f #000000'
|
2007-03-31 06:35:40 +04:00
|
|
|
|
2009-10-10 00:40:33 +04:00
|
|
|
export WMII_BACKGROUND='#333333'
|
|
|
|
export 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)
|
2009-10-10 00:40:33 +04:00
|
|
|
export WMII_TERM="@TERMINAL@"
|
2007-03-04 01:51:46 +03:00
|
|
|
|
2010-06-11 12:18:40 +04:00
|
|
|
# Ask about MODKEY on first run
|
|
|
|
if ! test -d "${WMII_CONFPATH%%:*}"; then
|
|
|
|
mkdir "${WMII_CONFPATH%%:*}"
|
|
|
|
res=$(wihack -type DIALOG xmessage -nearmouse -buttons Windows,Alt -print -fn $WMII_FONT \
|
|
|
|
"Welcome to wmii,$wi_newline$wi_newline" \
|
|
|
|
"Most of wmii's default key bindings make use of the$wi_newline" \
|
|
|
|
"Windows key, or equivalent. For keyboards lacking such$wi_newline" \
|
|
|
|
"a key, many users change this to the Alt key.$wi_newline$wi_newline" \
|
|
|
|
"Which would you prefer?")
|
|
|
|
[ "$res" = "Alt" ] && MODKEY=Mod1
|
|
|
|
echo "MODKEY=$MODKEY" >"${WMII_CONFPATH%%:*}/wmiirc_local"
|
|
|
|
chmod +x "${WMII_CONFPATH%%:*}/wmiirc_local"
|
|
|
|
fi
|
2009-10-10 22:57:00 +04:00
|
|
|
|
2008-10-18 22:58:26 +04:00
|
|
|
# Menu history
|
2009-05-27 20:59:07 +04:00
|
|
|
hist="${WMII_CONFPATH%%:*}/history"
|
2008-10-18 22:58:26 +04:00
|
|
|
histnum=5000
|
|
|
|
|
2007-02-23 06:36:50 +03:00
|
|
|
# Column Rules
|
2007-03-31 06:35:40 +04:00
|
|
|
wmiir write /colrules <<!
|
2010-06-06 14:06:14 +04: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
|
2010-06-06 14:06:14 +04:00
|
|
|
wmiir write /rules <<!
|
2010-06-11 12:18:40 +04:00
|
|
|
# Apps with system tray icons like to their main windows
|
|
|
|
# Give them permission.
|
|
|
|
/^Pidgin:/ allow=+activate
|
|
|
|
|
2010-06-06 14:06:14 +04:00
|
|
|
# MPlayer and VLC don't float by default, but should.
|
2010-06-11 03:49:17 +04:00
|
|
|
/MPlayer|VLC/ floating=on
|
2010-06-11 12:18:40 +04:00
|
|
|
|
2010-06-06 14:06:14 +04:00
|
|
|
# ROX puts all of its windows in the same group, so they open
|
|
|
|
# with the same tags. Disable grouping for ROX Filer.
|
|
|
|
/^ROX-Filer:/ group=0
|
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() {
|
2010-07-15 04:10:16 +04:00
|
|
|
echo -n label $(uptime | sed 's/.*://; s/, / /g') '|' $(date)
|
2007-02-23 06:36:50 +03:00
|
|
|
}
|
|
|
|
|
2010-05-28 19:05:01 +04:00
|
|
|
# Generic overridable startup details
|
|
|
|
startup() { witray & }
|
|
|
|
|
2008-05-20 03:26:43 +04:00
|
|
|
wi_runconf -s wmiirc_local
|
2010-05-28 19:05:01 +04:00
|
|
|
startup
|
2008-05-20 03:26:43 +04:00
|
|
|
|
2010-06-26 01:21:12 +04:00
|
|
|
echo colors $WMII_NORMCOLORS | wmiir create $noticebar
|
2008-01-22 02:22:42 +03:00
|
|
|
|
2007-03-31 06:35:40 +04:00
|
|
|
# Event processing
|
2010-10-08 00:31:42 +04:00
|
|
|
wi_events <<'!'
|
2009-10-10 00:40:33 +04:00
|
|
|
# Events
|
|
|
|
Event CreateTag
|
2010-06-26 01:21:12 +04:00
|
|
|
echo colors "$WMII_NORMCOLORS$wi_newline" label "$@" | wmiir create "/lbar/$@"
|
2009-10-10 00:40:33 +04:00
|
|
|
Event DestroyTag
|
|
|
|
wmiir remove "/lbar/$@"
|
|
|
|
Event FocusTag
|
2010-06-26 01:21:12 +04:00
|
|
|
wmiir xwrite "/lbar/$@" colors "$WMII_FOCUSCOLORS"
|
2009-10-10 00:40:33 +04:00
|
|
|
Event UnfocusTag
|
2010-06-26 01:21:12 +04:00
|
|
|
wmiir xwrite "/lbar/$@" colors "$WMII_NORMCOLORS"
|
2009-10-10 00:40:33 +04:00
|
|
|
Event UrgentTag
|
|
|
|
shift
|
2010-06-26 01:21:12 +04:00
|
|
|
wmiir xwrite "/lbar/$@" label "*$@"
|
2009-10-10 00:40:33 +04:00
|
|
|
Event NotUrgentTag
|
|
|
|
shift
|
2010-06-26 01:21:12 +04:00
|
|
|
wmiir xwrite "/lbar/$@" label "$@"
|
2009-10-10 00:40:33 +04:00
|
|
|
Event LeftBarClick LeftBarDND
|
|
|
|
shift
|
|
|
|
wmiir xwrite /ctl view "$@"
|
|
|
|
Event Unresponsive
|
|
|
|
{
|
|
|
|
client=$1; shift
|
|
|
|
msg="The following client is not responding. What would you like to do?$wi_newline"
|
|
|
|
resp=$(wihack -transient $client \
|
2010-06-02 10:09:23 +04:00
|
|
|
xmessage -nearmouse -buttons Kill,Wait -print \
|
2009-10-10 00:40:33 +04:00
|
|
|
-fn "${WMII_FONT%%,*}" "$msg $(wmiir read /client/sel/label)")
|
|
|
|
if [ "$resp" = Kill ]; then
|
|
|
|
wmiir xwrite /client/$client/ctl slay &
|
2007-03-31 06:35:40 +04:00
|
|
|
fi
|
2009-10-10 00:40:33 +04:00
|
|
|
}&
|
|
|
|
Event Notice
|
2013-12-09 20:43:36 +04:00
|
|
|
wmiir xwrite $noticebar label $wi_arg
|
2009-10-10 00:40:33 +04:00
|
|
|
|
|
|
|
kill $xpid 2>/dev/null # Let's hope this isn't reused...
|
2013-12-09 20:43:36 +04:00
|
|
|
{ sleep $noticetimeout; wmiir xwrite $noticebar label; }&
|
2009-10-10 00:40:33 +04:00
|
|
|
xpid = $!
|
|
|
|
|
|
|
|
# Menus
|
|
|
|
Menu Client-3-Delete
|
|
|
|
wmiir xwrite /client/$1/ctl kill
|
|
|
|
Menu Client-3-Kill
|
|
|
|
wmiir xwrite /client/$1/ctl slay
|
|
|
|
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
|
2010-06-26 01:21:12 +04:00
|
|
|
if [ "$tag" = "$(wmiir read /client/$c/tags)" ]
|
|
|
|
then wmiir xwrite /client/$c/ctl kill
|
2010-06-29 21:40:51 +04:00
|
|
|
else wmiir xwrite /client/$c/ctl tags -$tag
|
2009-10-10 00:40:33 +04:00
|
|
|
fi
|
2010-06-26 01:21:12 +04:00
|
|
|
[ "$tag" = "$(wi_seltag)" ] &&
|
|
|
|
wmiir xwrite /ctl view $(wi_tags | wi_nexttag)
|
2009-10-10 00:40:33 +04:00
|
|
|
done
|
|
|
|
Event LeftBarMouseDown
|
|
|
|
wi_fnmenu LBar "$@" &
|
|
|
|
|
|
|
|
# Actions
|
|
|
|
Action showkeys
|
|
|
|
echo "$KeysHelp" | xmessage -file - -fn ${WMII_FONT%%,*}
|
|
|
|
Action quit
|
|
|
|
wmiir xwrite /ctl quit
|
|
|
|
Action exec
|
|
|
|
wmiir xwrite /ctl exec "$@"
|
|
|
|
Action rehash
|
2009-10-26 06:29:48 +03:00
|
|
|
wi_proglist $PATH >$progsfile
|
2009-10-10 00:40:33 +04:00
|
|
|
Action status
|
|
|
|
set +xv
|
|
|
|
if wmiir remove /rbar/status 2>/dev/null; then
|
|
|
|
sleep 2
|
|
|
|
fi
|
2010-06-26 01:21:12 +04:00
|
|
|
echo colors "$WMII_NORMCOLORS" | wmiir create /rbar/status
|
2009-10-10 00:40:33 +04:00
|
|
|
while status | wmiir write /rbar/status; do
|
|
|
|
sleep 1
|
|
|
|
done
|
|
|
|
|
|
|
|
# Key Bindings
|
|
|
|
KeyGroup Moving around
|
|
|
|
Key $MODKEY-$LEFT # Select the client to the left
|
|
|
|
wmiir xwrite /tag/sel/ctl select left
|
|
|
|
Key $MODKEY-$RIGHT # Select the client to the right
|
|
|
|
wmiir xwrite /tag/sel/ctl select right
|
|
|
|
Key $MODKEY-$UP # Select the client above
|
|
|
|
wmiir xwrite /tag/sel/ctl select up
|
|
|
|
Key $MODKEY-$DOWN # Select the client below
|
|
|
|
wmiir xwrite /tag/sel/ctl select down
|
|
|
|
|
|
|
|
Key $MODKEY-space # Toggle between floating and managed layers
|
|
|
|
wmiir xwrite /tag/sel/ctl select toggle
|
|
|
|
|
|
|
|
KeyGroup Moving through stacks
|
|
|
|
Key $MODKEY-Control-$UP # Select the stack above
|
2009-10-26 06:29:48 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl select up stack
|
2009-10-10 00:40:33 +04:00
|
|
|
Key $MODKEY-Control-$DOWN # Select the stack below
|
2009-10-26 06:29:48 +03:00
|
|
|
wmiir xwrite /tag/sel/ctl select down stack
|
2009-10-10 00:40:33 +04:00
|
|
|
|
|
|
|
KeyGroup Moving clients around
|
|
|
|
Key $MODKEY-Shift-$LEFT # Move selected client to the left
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel left
|
|
|
|
Key $MODKEY-Shift-$RIGHT # Move selected client to the right
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel right
|
|
|
|
Key $MODKEY-Shift-$UP # Move selected client up
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel up
|
|
|
|
Key $MODKEY-Shift-$DOWN # Move selected client down
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel down
|
|
|
|
|
|
|
|
Key $MODKEY-Shift-space # Toggle selected client between floating and managed layers
|
|
|
|
wmiir xwrite /tag/sel/ctl send sel toggle
|
|
|
|
|
|
|
|
KeyGroup Client actions
|
|
|
|
Key $MODKEY-f # Toggle selected client's fullsceen state
|
|
|
|
wmiir xwrite /client/sel/ctl Fullscreen toggle
|
|
|
|
Key $MODKEY-Shift-c # Close client
|
|
|
|
wmiir xwrite /client/sel/ctl kill
|
|
|
|
|
|
|
|
KeyGroup Changing column modes
|
|
|
|
Key $MODKEY-d # Set column to default mode
|
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel default-max
|
|
|
|
Key $MODKEY-s # Set column to stack mode
|
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel stack-max
|
|
|
|
Key $MODKEY-m # Set column to max mode
|
|
|
|
wmiir xwrite /tag/sel/ctl colmode sel stack+max
|
|
|
|
|
|
|
|
KeyGroup Running programs
|
|
|
|
Key $MODKEY-a # Open wmii actions menu
|
|
|
|
action $(wi_actions | wimenu -h "${hist}.actions" -n $histnum) &
|
|
|
|
Key $MODKEY-p # Open program menu
|
|
|
|
eval wmiir setsid "$(wimenu -h "${hist}.progs" -n $histnum <$progsfile)" &
|
|
|
|
|
|
|
|
Key $MODKEY-Return # Launch a terminal
|
|
|
|
eval wmiir setsid $WMII_TERM &
|
|
|
|
|
|
|
|
KeyGroup Other
|
|
|
|
Key $MODKEY-Control-t # Toggle all other key bindings
|
|
|
|
case $(wmiir read /keys | wc -l | tr -d ' \t\n') in
|
|
|
|
0|1)
|
|
|
|
echo -n "$Keys" | wmiir write /keys
|
|
|
|
wmiir xwrite /ctl grabmod $MODKEY;;
|
|
|
|
*)
|
|
|
|
wmiir xwrite /keys $MODKEY-Control-t
|
|
|
|
wmiir xwrite /ctl grabmod Mod3;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
KeyGroup Tag actions
|
|
|
|
Key $MODKEY-t # Change to another tag
|
2010-06-11 03:49:17 +04:00
|
|
|
wmiir xwrite /ctl view $(wi_tags | wimenu -h "${hist}.tags" -n 50) &
|
2009-10-10 00:40:33 +04:00
|
|
|
Key $MODKEY-Shift-t # Retag the selected client
|
2010-06-11 03:49:17 +04:00
|
|
|
# Assumes left-to-right order of evaluation
|
2010-06-29 21:40:51 +04:00
|
|
|
wmiir xwrite /client/$(wi_selclient)/ctl tags $(wi_tags | wimenu -h "${hist}.tags" -n 50) &
|
2010-06-26 01:21:12 +04:00
|
|
|
Key $MODKEY-n # Move to the next tag
|
|
|
|
wmiir xwrite /ctl view $(wi_tags | wi_nexttag)
|
|
|
|
Key $MODKEY-b # Move to the previous tag
|
|
|
|
wmiir xwrite /ctl view $(wi_tags | sort -r | wi_nexttag)
|
2007-03-31 06:35:40 +04:00
|
|
|
!
|
2007-03-08 00:08:19 +03:00
|
|
|
for i in 0 1 2 3 4 5 6 7 8 9; do
|
2010-10-08 00:31:42 +04:00
|
|
|
wi_events <<!
|
2009-10-10 00:40:33 +04:00
|
|
|
Key $MODKEY-$i # Move to the numbered view
|
|
|
|
wmiir xwrite /ctl view "$i"
|
|
|
|
Key $MODKEY-Shift-$i # Retag selected client with the numbered tag
|
2010-06-29 21:40:51 +04:00
|
|
|
wmiir xwrite /client/sel/ctl tags "$i"
|
2007-03-31 06:35:40 +04:00
|
|
|
!
|
2010-10-08 00:31:42 +04:00
|
|
|
done
|
|
|
|
wi_events -e
|
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
|
|
|
|
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
|
2009-10-10 00:40:33 +04:00
|
|
|
IFS="$wi_newline"
|
2010-06-11 03:49:17 +04:00
|
|
|
wmiir rm $(wmiir ls -p /lbar) >/dev/null
|
2008-01-22 02:22:42 +03:00
|
|
|
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
|
2010-06-26 01:21:12 +04:00
|
|
|
echo colors "$WMII_FOCUSCOLORS"
|
|
|
|
echo label $tag
|
2007-02-11 06:04:13 +03:00
|
|
|
else
|
2010-06-26 01:21:12 +04:00
|
|
|
echo colors "$WMII_NORMCOLORS"
|
|
|
|
echo label $tag
|
2008-01-18 23:05:45 +03:00
|
|
|
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
|
|
|
|