mirror of
https://github.com/0intro/wmii
synced 2024-11-22 05:42:05 +03:00
Cleanup wmiirc scripts.
This commit is contained in:
parent
2a8d326db5
commit
5c506656f5
4
README
4
README
@ -46,8 +46,8 @@ Configuration
|
||||
-------------
|
||||
The configuration of wmii is done by customizing the rc script rc.wmii.local,
|
||||
which remotely controls the window manager and handles various events.
|
||||
The main rc.wmii script lives in PREFIX/etc/wmii-3.5/, while rc.wmii.local
|
||||
goes in $HOME/.wmii-3.5/.
|
||||
The main rc.wmii script lives in PREFIX/etc/wmii@CONFPREFIX@/, while rc.wmii.local
|
||||
goes in $HOME/.wmii@CONFPREFIX@/.
|
||||
|
||||
If you wish to unbind keys bound by rc.wmii in rc.wmii.local, you
|
||||
must do so inside the function Action-overridekeys. You may,
|
||||
|
@ -91,7 +91,7 @@ fn Event-Unresponsive {
|
||||
msg = 'The following client is not responding. What would you like to do?'
|
||||
resp = `{wihack -transient $client \
|
||||
xmessage -nearmouse -buttons Kill,Wait -print \
|
||||
$msg $wi_nl '' `{wmiir read /client/$client/label}}
|
||||
$msg $wi_newline '' `{wmiir read /client/$client/label}}
|
||||
if(~ $resp Kill)
|
||||
wmiir xwrite /client/$client/ctl slay
|
||||
}&}
|
||||
@ -258,7 +258,7 @@ Action status &
|
||||
Action rehash &
|
||||
|
||||
# Tag Bar Setup
|
||||
ifs=$wi_nl{
|
||||
ifs=$wi_newline {
|
||||
rc -c 'wmiir rm /lbar/^$*' >[2]/dev/null \
|
||||
`{comm -23 <{wmiir ls /lbar} \
|
||||
<{wi_tags}}
|
||||
|
@ -6,8 +6,7 @@ import traceback
|
||||
import pygmi
|
||||
from pygmi import monitor, client, curry, call, program_list, _
|
||||
|
||||
__all__ = ('keys', 'bind_events', 'event_loop', 'event', 'Match',
|
||||
'Desc')
|
||||
__all__ = ('keys', 'bind_events', 'event_loop', 'event', 'Match')
|
||||
|
||||
keydefs = {}
|
||||
events = {}
|
||||
@ -55,14 +54,6 @@ def bind_events(items={}, **kwargs):
|
||||
def event(fn):
|
||||
bind_events({fn.__name__: fn})
|
||||
|
||||
class Desc(object):
|
||||
def __init__(self, doc):
|
||||
self.doc = doc
|
||||
def __unicode__(self):
|
||||
return self.doc
|
||||
def __str__(self):
|
||||
return str(self.doc)
|
||||
|
||||
class Keys(object):
|
||||
def __init__(self):
|
||||
self.modes = {}
|
||||
@ -72,8 +63,13 @@ class Keys(object):
|
||||
|
||||
def _add_mode(self, mode):
|
||||
if mode not in self.modes:
|
||||
self.modes[mode] = { 'name': mode, 'desc': {}, 'groups': [],
|
||||
'keys': {}, 'import': {} }
|
||||
self.modes[mode] = {
|
||||
'name': mode,
|
||||
'desc': {},
|
||||
'groups': [],
|
||||
'keys': {},
|
||||
'import': {},
|
||||
}
|
||||
self.modelist.append(mode)
|
||||
|
||||
def _set_mode(self, mode):
|
||||
@ -81,7 +77,8 @@ class Keys(object):
|
||||
self._mode = mode
|
||||
self._keys = dict((k % keydefs, v) for k, v in
|
||||
self.modes[mode]['keys'].items() +
|
||||
self.modes[mode]['keys'].items());
|
||||
self.modes[mode]['import'].items());
|
||||
|
||||
client.write('/keys', '\n'.join(self._keys.keys()) + '\n')
|
||||
mode = property(lambda self: self._mode, _set_mode)
|
||||
|
||||
@ -91,7 +88,7 @@ class Keys(object):
|
||||
('Mode %s\n' % mode['name']) +
|
||||
'\n\n'.join((' %s\n' % str(group or '')) +
|
||||
'\n'.join(' %- 20s %s' % (key % keydefs,
|
||||
mode['desc'][key])
|
||||
mode['keys'][key].__doc__)
|
||||
for key in mode['desc'][group])
|
||||
for group in mode['groups'])
|
||||
for mode in (self.modes[name]
|
||||
@ -101,28 +98,32 @@ class Keys(object):
|
||||
self._add_mode(mode)
|
||||
mode = self.modes[mode]
|
||||
group = None
|
||||
key = None
|
||||
def add_desc(key, desc):
|
||||
mode['desc'][key] = desc
|
||||
if group not in mode['desc']:
|
||||
mode['desc'][group] = []
|
||||
mode['groups'].append(group)
|
||||
if key not in mode['desc'][group]:
|
||||
mode['desc'][group].append(key);
|
||||
|
||||
for k in keys:
|
||||
if key and isinstance(k, Desc):
|
||||
add_desc(key, k)
|
||||
elif isinstance(k, Desc):
|
||||
group = str(k)
|
||||
elif key:
|
||||
mode['keys'][key] = k
|
||||
key = None
|
||||
if isinstance(keys, dict):
|
||||
keys = keys.iteritems()
|
||||
for obj in keys:
|
||||
if isinstance(obj, tuple) and len(obj) in (2, 3):
|
||||
if len(obj) == 2:
|
||||
key, val = obj
|
||||
desc = ''
|
||||
elif len(obj) == 3:
|
||||
key, desc, val = obj
|
||||
mode['keys'][key] = val
|
||||
add_desc(key, desc)
|
||||
val.__doc__ = str(desc)
|
||||
else:
|
||||
key = k
|
||||
group = obj
|
||||
|
||||
def wrap_import(mode, key):
|
||||
return lambda k: self.modes[mode]['keys'][key](k)
|
||||
for k, v in flatten((v, k) for k, v in import_.iteritems()):
|
||||
mode['import'][k % keydefs] = v
|
||||
mode['import'][k % keydefs] = wrap_import(v, k)
|
||||
|
||||
def dispatch(self, key):
|
||||
mode = self.modes[self.mode]
|
||||
|
@ -161,117 +161,121 @@ class Notice(Button):
|
||||
notice = Notice()
|
||||
|
||||
keys.bind('main', (
|
||||
Desc("Moving around"),
|
||||
'%(mod)s-%(left)s', Desc("Select the client to the left"),
|
||||
lambda k: Tag('sel').select('left'),
|
||||
'%(mod)s-%(right)s', Desc("Select the client to the right"),
|
||||
lambda k: Tag('sel').select('right'),
|
||||
'%(mod)s-%(up)s', Desc("Select the client above"),
|
||||
lambda k: Tag('sel').select('up'),
|
||||
'%(mod)s-%(down)s', Desc("Select the client below"),
|
||||
lambda k: Tag('sel').select('down'),
|
||||
"Moving around",
|
||||
('%(mod)s-%(left)s', "Select the client to the left",
|
||||
lambda k: Tag('sel').select('left')),
|
||||
('%(mod)s-%(right)s', "Select the client to the right",
|
||||
lambda k: Tag('sel').select('right')),
|
||||
('%(mod)s-%(up)s', "Select the client above",
|
||||
lambda k: Tag('sel').select('up')),
|
||||
('%(mod)s-%(down)s', "Select the client below",
|
||||
lambda k: Tag('sel').select('down')),
|
||||
|
||||
'%(mod)s-space', Desc("Toggle between floating and managed layers"),
|
||||
lambda k: Tag('sel').select('toggle'),
|
||||
('%(mod)s-space', "Toggle between floating and managed layers",
|
||||
lambda k: Tag('sel').select('toggle')),
|
||||
|
||||
Desc("Moving through stacks"),
|
||||
'%(mod)s-Control-%(up)s', Desc("Select the stack above"),
|
||||
lambda k: Tag('sel').select('up', stack=True),
|
||||
'%(mod)s-Control-%(down)s', Desc("Select the stack below"),
|
||||
lambda k: Tag('sel').select('down', stack=True),
|
||||
"Moving through stacks",
|
||||
('%(mod)s-Control-%(up)s', "Select the stack above",
|
||||
lambda k: Tag('sel').select('up', stack=True)),
|
||||
('%(mod)s-Control-%(down)s', "Select the stack below",
|
||||
lambda k: Tag('sel').select('down', stack=True)),
|
||||
|
||||
|
||||
Desc("Moving clients around"),
|
||||
'%(mod)s-Shift-%(left)s', Desc("Move selected client to the left"),
|
||||
lambda k: Tag('sel').send(Client('sel'), 'left'),
|
||||
'%(mod)s-Shift-%(right)s', Desc("Move selected client to the right"),
|
||||
lambda k: Tag('sel').send(Client('sel'), 'right'),
|
||||
'%(mod)s-Shift-%(up)s', Desc("Move selected client up"),
|
||||
lambda k: Tag('sel').send(Client('sel'), 'up'),
|
||||
'%(mod)s-Shift-%(down)s', Desc("Move selected client down"),
|
||||
lambda k: Tag('sel').send(Client('sel'), 'down'),
|
||||
"Moving clients around",
|
||||
('%(mod)s-Shift-%(left)s', "Move selected client to the left",
|
||||
lambda k: Tag('sel').send(Client('sel'), 'left')),
|
||||
('%(mod)s-Shift-%(right)s', "Move selected client to the right",
|
||||
lambda k: Tag('sel').send(Client('sel'), 'right')),
|
||||
('%(mod)s-Shift-%(up)s', "Move selected client up",
|
||||
lambda k: Tag('sel').send(Client('sel'), 'up')),
|
||||
('%(mod)s-Shift-%(down)s', "Move selected client down",
|
||||
lambda k: Tag('sel').send(Client('sel'), 'down')),
|
||||
|
||||
'%(mod)s-Shift-space', Desc("Toggle selected client between floating and managed layers"),
|
||||
lambda k: Tag('sel').send(Client('sel'), 'toggle'),
|
||||
('%(mod)s-Shift-space', "Toggle selected client between floating and managed layers",
|
||||
lambda k: Tag('sel').send(Client('sel'), 'toggle')),
|
||||
|
||||
Desc("Client actions"),
|
||||
'%(mod)s-f', Desc("Toggle selected client's fullsceen state"),
|
||||
lambda k: Client('sel').set('Fullscreen', 'toggle'),
|
||||
'%(mod)s-Shift-c', Desc("Close client"),
|
||||
lambda k: Client('sel').kill(),
|
||||
"Client actions",
|
||||
('%(mod)s-f', "Toggle selected client's fullsceen state",
|
||||
lambda k: Client('sel').set('Fullscreen', 'toggle')),
|
||||
('%(mod)s-Shift-c', "Close client",
|
||||
lambda k: Client('sel').kill()),
|
||||
|
||||
Desc("Changing column modes"),
|
||||
'%(mod)s-d', Desc("Set column to default mode"),
|
||||
lambda k: setattr(Tag('sel').selcol, 'mode', 'default-max'),
|
||||
'%(mod)s-s', Desc("Set column to stack mode"),
|
||||
lambda k: setattr(Tag('sel').selcol, 'mode', 'stack-max'),
|
||||
'%(mod)s-m', Desc("Set column to max mode"),
|
||||
lambda k: setattr(Tag('sel').selcol, 'mode', 'stack+max'),
|
||||
"Changing column modes",
|
||||
('%(mod)s-d', "Set column to default mode",
|
||||
lambda k: setattr(Tag('sel').selcol, 'mode', 'default-max')),
|
||||
('%(mod)s-s', "Set column to stack mode",
|
||||
lambda k: setattr(Tag('sel').selcol, 'mode', 'stack-max')),
|
||||
('%(mod)s-m', "Set column to max mode",
|
||||
lambda k: setattr(Tag('sel').selcol, 'mode', 'stack+max')),
|
||||
|
||||
Desc("Running programs"),
|
||||
'%(mod)s-a', Desc("Open wmii actions menu"),
|
||||
lambda k: action_menu.call(),
|
||||
'%(mod)s-p', Desc("Open program menu"),
|
||||
lambda k: program_menu.call(),
|
||||
"Running programs",
|
||||
('%(mod)s-a', "Open wmii actions menu",
|
||||
lambda k: action_menu.call()),
|
||||
('%(mod)s-p', "Open program menu",
|
||||
lambda k: program_menu.call()),
|
||||
|
||||
'%(mod)s-Return', Desc("Launch a terminal"),
|
||||
lambda k: call(*terminal, background=True),
|
||||
('%(mod)s-Return', "Launch a terminal",
|
||||
lambda k: call(*terminal, background=True)),
|
||||
|
||||
Desc("Tag actions"),
|
||||
'%(mod)s-t', Desc("Change to another tag"),
|
||||
lambda k: tags.select(tag_menu.call()),
|
||||
'%(mod)s-Shift-t', Desc("Retag the selected client"),
|
||||
lambda k: setattr(Client('sel'), 'tags', tag_menu.call()),
|
||||
"Tag actions",
|
||||
('%(mod)s-t', "Change to another tag",
|
||||
lambda k: tags.select(tag_menu.call())),
|
||||
('%(mod)s-Shift-t', "Retag the selected client",
|
||||
lambda k: setattr(Client('sel'), 'tags', tag_menu.call())),
|
||||
|
||||
'%(mod)s-n', Desc("Move to the view to the left"),
|
||||
lambda k: tags.select(tags.next()),
|
||||
'%(mod)s-b', Desc("Move to the view to the right"),
|
||||
lambda k: tags.select(tags.next(True)),
|
||||
'%(mod)s-i', Desc("Move to the newer tag in the tag stack"),
|
||||
lambda k: tags.select(tags.NEXT),
|
||||
'%(mod)s-o', Desc("Move to the older tag in the tag stack"),
|
||||
lambda k: tags.select(tags.PREV),
|
||||
('%(mod)s-n', "Move to the view to the left",
|
||||
lambda k: tags.select(tags.next())),
|
||||
('%(mod)s-b', "Move to the view to the right",
|
||||
lambda k: tags.select(tags.next(True))),
|
||||
('%(mod)s-i', "Move to the newer tag in the tag stack",
|
||||
lambda k: tags.select(tags.NEXT)),
|
||||
('%(mod)s-o', "Move to the older tag in the tag stack",
|
||||
lambda k: tags.select(tags.PREV)),
|
||||
))
|
||||
def bind_num(i):
|
||||
keys.bind('main', (
|
||||
Desc("Tag actions"),
|
||||
'%%(mod)s-%d' % i, Desc("Move to view '%d'" % i),
|
||||
lambda k: tags.select(str(i)),
|
||||
'%%(mod)s-Shift-%d' % i, Desc("Retag selected client with tag '%d'" % i),
|
||||
lambda k: setattr(Client('sel'), 'tags', i),
|
||||
"Tag actions",
|
||||
('%%(mod)s-%d' % i, "Move to view '%d'" % i,
|
||||
lambda k: tags.select(str(i))),
|
||||
('%%(mod)s-Shift-%d' % i, "Retag selected client with tag '%d'" % i,
|
||||
lambda k: setattr(Client('sel'), 'tags', i)),
|
||||
))
|
||||
map(bind_num, range(0, 10))
|
||||
|
||||
keys.bind('main', (
|
||||
Desc("Changing modes"),
|
||||
'%(mod)s-Control-r', Desc("Enter resize mode"),
|
||||
lambda k: setattr(keys, 'mode', 'resize'),
|
||||
'%(mod)s-Control-t', Desc("Enter passthrough mode"),
|
||||
lambda k: setattr(keys, 'mode', 'passthrough'),
|
||||
"Changing modes",
|
||||
('%(mod)s-Control-r', "Enter resize mode",
|
||||
lambda k: setattr(keys, 'mode', 'resize')),
|
||||
('%(mod)s-Control-t', "Enter passthrough mode",
|
||||
lambda k: setattr(keys, 'mode', 'passthrough')),
|
||||
));
|
||||
keys.bind('passthrough', (
|
||||
Desc("Changing modes"),
|
||||
'%(mod)s-Control-t', Desc("Leave passthrough mode"),
|
||||
lambda k: setattr(keys, 'mode', 'main'),
|
||||
"Changing modes",
|
||||
('%(mod)s-Control-t', "Leave passthrough mode",
|
||||
lambda k: setattr(keys, 'mode', 'main')),
|
||||
));
|
||||
|
||||
keys.bind('resize', (
|
||||
'Escape', Desc("Leave resize mode"),
|
||||
lambda k: setattr(keys, 'mode', 'main'),
|
||||
('Escape', "Leave resize mode",
|
||||
lambda k: setattr(keys, 'mode', 'main')),
|
||||
), import_={'main': ('%(mod)s-%(left)s', '%(mod)s-%(right)s',
|
||||
'%(mod)s-%(up)s', '%(mod)s-%(down)s',
|
||||
'%(mod)s-Space')})
|
||||
|
||||
def addresize(mod, desc, cmd, *args):
|
||||
keys.bind('resize', (
|
||||
mod + '%(left)s', Desc("%s selected client to the left" % desc),
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'left', *args),
|
||||
mod + '%(right)s', Desc("%s selected client to the right" % desc),
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'right', *args),
|
||||
mod + '%(up)s', Desc("%s selected client up" % desc),
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'up', *args),
|
||||
mod + '%(down)s', Desc("%s selected client down" % desc),
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'down', *args),
|
||||
(mod + '%(left)s', "%s selected client to the left" % desc,
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'left',
|
||||
*args)),
|
||||
(mod + '%(right)s', "%s selected client to the right" % desc,
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'right',
|
||||
*args)),
|
||||
(mod + '%(up)s', "%s selected client up" % desc,
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'up',
|
||||
*args)),
|
||||
(mod + '%(down)s', "%s selected client down" % desc,
|
||||
lambda k: Tag('sel').ctl(cmd, 'sel sel', 'down',
|
||||
*args)),
|
||||
));
|
||||
addresize('', 'Grow', 'grow')
|
||||
addresize('Control-', 'Shrink', 'grow', '-1')
|
||||
|
@ -10,7 +10,7 @@
|
||||
wmiiscript=$1
|
||||
wmiikeys=()
|
||||
|
||||
wi_nl='
|
||||
wi_newline='
|
||||
'
|
||||
|
||||
echo Start $wmiiscript | wmiir write /event >[2]/dev/null \
|
||||
@ -145,8 +145,8 @@ fn wi_eventloop {
|
||||
wi_initkeys
|
||||
|
||||
wi_readevent |
|
||||
while(ifs=$wi_nl{wi_event=`{read}}) {
|
||||
ifs=$wi_nl{
|
||||
while(ifs=$wi_ewlinel{wi_event=`{read}}) {
|
||||
ifs=$wi_newline{
|
||||
wi_arg=`{echo $wi_event | sed 's/^[^ ]+ //'}}
|
||||
* = `{echo $wi_event}
|
||||
event = $1; shift
|
||||
|
@ -1,13 +1,24 @@
|
||||
|
||||
if [ -z "$scriptname" ]; then
|
||||
scriptname="$wmiiscript"; fi
|
||||
[ -z "$scriptname" ] && scriptname="$wmiiscript"
|
||||
echo Start $wmiiscript | wmiir write /event 2>/dev/null ||
|
||||
exit 1
|
||||
|
||||
wi_nl='
|
||||
wi_newline='
|
||||
'
|
||||
|
||||
_wi_script() {
|
||||
# Awk script to mangle key/event/action definition spec
|
||||
# into switch-case functions and lists of the cases. Also
|
||||
# generates a simple key binding help text based on KeyGroup
|
||||
# clauses and comments that appear on key lines.
|
||||
#
|
||||
# Each clause (Key, Event, Action) generates a function of the
|
||||
# same name which executes the indented text after the matching
|
||||
# clause. Clauses are selected based on the first argument passed
|
||||
# to the mangled function. Additionally, a variable is created named
|
||||
# for the plouralized version of the clause name (Keys, Events,
|
||||
# Actions) which lists each case value. These are used for actions
|
||||
# menus and to write wmii's /keys file.
|
||||
cat <<'!'
|
||||
BEGIN {
|
||||
arg[1] = "Nop"
|
||||
@ -83,19 +94,14 @@ Event Key
|
||||
Key "$@"
|
||||
!
|
||||
eval "cat <<!
|
||||
$(sed "$_sed" | sed '/^[ ]/s/\([$`]\)/\\\1/g')
|
||||
$( (test ! -t 0 && cat; for a; do eval "$a"; done) | sed '/^[ ]/s/\([$`\\]\)/\\\1/g')
|
||||
!
|
||||
"
|
||||
}
|
||||
|
||||
wi_events() {
|
||||
_sed=""
|
||||
if [ "$1" = -s ]; then
|
||||
_sed="s/^$2//"
|
||||
shift 2
|
||||
fi
|
||||
#cho "$(_wi_text | awk "$(_wi_script)")" | cat -n
|
||||
eval "$(_wi_text | awk "$(_wi_script)")"
|
||||
#cho "$(_wi_text "$@" | awk "$(_wi_script)")" | cat -n
|
||||
eval "$(_wi_text "$@" | awk "$(_wi_script)")"
|
||||
}
|
||||
|
||||
wi_fatal() {
|
||||
@ -189,7 +195,7 @@ wi_eventloop() {
|
||||
|
||||
wmiir read /event | while read wi_event
|
||||
do
|
||||
IFS="$wi_nl"
|
||||
IFS="$wi_newline"
|
||||
wi_arg=$(echo "$wi_event" | sed 's/^[^ ]* //')
|
||||
unset IFS
|
||||
set -- $wi_event
|
||||
|
320
rc/wmiirc.sh
320
rc/wmiirc.sh
@ -15,14 +15,14 @@ noticetimeout=5
|
||||
noticebar=/rbar/!notice
|
||||
|
||||
# Colors tuples: "<text> <background> <border>"
|
||||
WMII_NORMCOLORS='#000000 #c1c48b #81654f'
|
||||
WMII_FOCUSCOLORS='#000000 #81654f #000000'
|
||||
export WMII_NORMCOLORS='#000000 #c1c48b #81654f'
|
||||
export WMII_FOCUSCOLORS='#000000 #81654f #000000'
|
||||
|
||||
WMII_BACKGROUND='#333333'
|
||||
WMII_FONT='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
|
||||
export WMII_BACKGROUND='#333333'
|
||||
export WMII_FONT='-*-fixed-medium-r-*-*-13-*-*-*-*-*-*-*'
|
||||
|
||||
set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
|
||||
WMII_TERM="@TERMINAL@"
|
||||
export WMII_TERM="@TERMINAL@"
|
||||
|
||||
# Menu history
|
||||
hist="${WMII_CONFPATH%%:*}/history"
|
||||
@ -52,176 +52,175 @@ echo $WMII_NORMCOLORS | wmiir create $noticebar
|
||||
# Event processing
|
||||
events() {
|
||||
cat <<'!'
|
||||
# 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/$@" "$@"
|
||||
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_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 = $!
|
||||
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
|
||||
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 "$@" &
|
||||
# Actions
|
||||
Action showkeys
|
||||
xmessage -file - -fn ${WMII_FONT%%,*} <<EOF
|
||||
$KeysHelp
|
||||
EOF
|
||||
Action quit
|
||||
wmiir xwrite /ctl quit
|
||||
Action exec
|
||||
wmiir xwrite /ctl exec "$@"
|
||||
Action rehash
|
||||
proglist $PATH >$progsfile
|
||||
Action status
|
||||
set +xv
|
||||
if wmiir remove /rbar/status 2>/dev/null; then
|
||||
sleep 2
|
||||
# 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/$@" "$@"
|
||||
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 \
|
||||
xmessage -nearmouse -buttons Kill,Wait -print
|
||||
-fn "${WMII_FONT%%,*}" "$msg $(wmiir read /client/sel/label)")
|
||||
if [ "$resp" = Kill ]; then
|
||||
wmiir xwrite /client/$client/ctl slay &
|
||||
fi
|
||||
echo "$WMII_NORMCOLORS" | wmiir create /rbar/status
|
||||
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
|
||||
}&
|
||||
Event Notice
|
||||
wmiir xwrite $noticebar $wi_arg
|
||||
|
||||
Key $MODKEY-space # Toggle between floating and managed layers
|
||||
wmiir xwrite /tag/sel/ctl select toggle
|
||||
kill $xpid 2>/dev/null # Let's hope this isn't reused...
|
||||
{ sleep $noticetimeout; wmiir xwrite $noticebar ' '; }&
|
||||
xpid = $!
|
||||
|
||||
KeyGroup Moving through stacks
|
||||
Key $MODKEY-Control-$UP # Select the stack above
|
||||
wmiir xwrite /taglsel/ctl select up stack
|
||||
Key $MODKEY-Control-$DOWN # Select the stack below
|
||||
wmiir xwrite /taglsel/ctl select down stack
|
||||
# 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 &
|
||||
|
||||
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
|
||||
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 "$@" &
|
||||
|
||||
Key $MODKEY-Shift-space # Toggle selected client between floating and managed layers
|
||||
wmiir xwrite /tag/sel/ctl send sel toggle
|
||||
# Actions
|
||||
Action showkeys
|
||||
echo "$KeysHelp" | xmessage -file - -fn ${WMII_FONT%%,*}
|
||||
Action quit
|
||||
wmiir xwrite /ctl quit
|
||||
Action exec
|
||||
wmiir xwrite /ctl exec "$@"
|
||||
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
|
||||
|
||||
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
|
||||
# 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
|
||||
|
||||
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
|
||||
Key $MODKEY-space # Toggle between floating and managed layers
|
||||
wmiir xwrite /tag/sel/ctl select toggle
|
||||
|
||||
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)" &
|
||||
KeyGroup Moving through stacks
|
||||
Key $MODKEY-Control-$UP # Select the stack above
|
||||
wmiir xwrite /taglsel/ctl select up stack
|
||||
Key $MODKEY-Control-$DOWN # Select the stack below
|
||||
wmiir xwrite /taglsel/ctl select down stack
|
||||
|
||||
Key $MODKEY-Return # Launch a terminal
|
||||
eval wmiir setsid $WMII_TERM &
|
||||
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
|
||||
|
||||
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
|
||||
Key $MODKEY-Shift-space # Toggle selected client between floating and managed layers
|
||||
wmiir xwrite /tag/sel/ctl send sel toggle
|
||||
|
||||
KeyGroup Tag actions
|
||||
Key $MODKEY-t # Change to another tag
|
||||
(tag=$(wi_tags | wimenu -h "${hist}.tags" -n 50) && wmiir xwrite /ctl view $tag) &
|
||||
Key $MODKEY-Shift-t # Retag the selected client
|
||||
c=$(wi_selclient)
|
||||
(tag=$(wi_tags | wimenu -h "${hist}.tags" -n 50) && wmiir xwrite /client/$c/tags $tag) &
|
||||
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
|
||||
(tag=$(wi_tags | wimenu -h "${hist}.tags" -n 50) && wmiir xwrite /ctl view $tag) &
|
||||
Key $MODKEY-Shift-t # Retag the selected client
|
||||
c=$(wi_selclient)
|
||||
(tag=$(wi_tags | wimenu -h "${hist}.tags" -n 50) && wmiir xwrite /client/$c/tags $tag) &
|
||||
!
|
||||
for i in 0 1 2 3 4 5 6 7 8 9; do
|
||||
cat <<!
|
||||
Key $MODKEY-$i # Move to the numbered view
|
||||
wmiir xwrite /ctl view "$i"
|
||||
Key $MODKEY-Shift-$i # Retag selected client with the numbered tag
|
||||
wmiir xwrite /client/sel/tags "$i"
|
||||
Key $MODKEY-$i # Move to the numbered view
|
||||
wmiir xwrite /ctl view "$i"
|
||||
Key $MODKEY-Shift-$i # Retag selected client with the numbered tag
|
||||
wmiir xwrite /client/sel/tags "$i"
|
||||
!
|
||||
done
|
||||
}
|
||||
wi_events <<!
|
||||
$(events | sed 's/^ \|^ //')
|
||||
$(local_events)
|
||||
!
|
||||
unset events local_events
|
||||
wi_events events local_events
|
||||
|
||||
# WM Configuration
|
||||
wmiir write /ctl <<!
|
||||
@ -233,16 +232,13 @@ wmiir write /ctl <<!
|
||||
!
|
||||
xsetroot -solid "$WMII_BACKGROUND" &
|
||||
|
||||
export WMII_FONT WMII_TERM
|
||||
export WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
|
||||
|
||||
# Misc
|
||||
progsfile="$(wmiir namespace)/.proglist"
|
||||
action status &
|
||||
wi_proglist $PATH >$progsfile &
|
||||
|
||||
# Setup Tag Bar
|
||||
IFS="$wi_nl"
|
||||
IFS="$wi_newline"
|
||||
wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,') >/dev/null
|
||||
seltag=$(wmiir read /tag/sel/ctl | sed 1q)
|
||||
unset IFS
|
||||
|
Loading…
Reference in New Issue
Block a user