changeset: 2250:80565821dd0c
tag: tip
user: Kris Maglione <jg_AT_suckless.org>
date: Mon Jan 21 18:22:42 2008 -0500
summary: Sync wmiirc with rc.wmii.
diff -r ef5feea7aa84 -r 80565821dd0c cmd/wmii.sh.sh
--- a/cmd/wmii.sh.sh Mon Jan 21 17:28:23 2008 -0500
+++ b/cmd/wmii.sh.sh Mon Jan 21 18:22:42 2008 -0500
@@ -9,27 +9,31 @@ Actions=""
Actions=""
Events=""
+wi_nl='
+'
+
_wi_script() {
cat <<'!'
BEGIN {
arg[1] = "Nop"
+ narg = 1;
body = "";
}
function addevent() {
- if(arg[1] == "Key")
- keys[arg[2]] = 1;
-
var = arg[1] "s"
- printf "%s=\"$%s\n%s\"\n", var, var, arg[2]
-
- gsub("[^a-zA-Z_0-9]", "_", arg[2]);
- if(body != "")
- printf "%s_%s() { %s\n }\n", arg[1], arg[2], body
+ for(i=2; i <= narg; i++) {
+ printf "%s=\"$%s\n%s\"\n", var, var, arg[i]
+ gsub("[^a-zA-Z_0-9]", "_", arg[i]);
+ if(body != "") {
+ printf "%s_%s() { %s\n }\n", arg[1], arg[i], body
+ body = sprintf("%s_%s \"$@\"", arg[1], arg[2])
+ }
+ }
}
-
/^(Event|Key|Action)[ \t]/ {
addevent()
split($0, arg)
+ narg = NF
body = ""
}
/^[ \t]/ {
@@ -129,8 +133,8 @@ wi_eventloop() {
wmiir read /event | while read wi_event
do
- OIFS="$IFS"; IFS="$(echo)"
- wi_args=$(echo "$wi_event" | sed 's/^[^ ]+ //')
+ OIFS="$IFS"; IFS="$wi_nl"
+ wi_arg=$(echo "$wi_event" | sed 's/^[^ ]* //')
IFS="$OIFS"
set -- $wi_event
event=$1; shift
diff -r ef5feea7aa84 -r 80565821dd0c rc/rc.wmii.rc
--- a/rc/rc.wmii.rc Mon Jan 21 17:28:23 2008 -0500
+++ b/rc/rc.wmii.rc Mon Jan 21 18:22:42 2008 -0500
@@ -71,9 +71,11 @@ fn Event-UnfocusTag {
fn Event-UnfocusTag {
wmiir xwrite /lbar/$"* $wmiinormcol $*}
fn Event-UrgentTag {
- shift; wmiir xwrite /lbar/$"* '*'$"*}
+ shift
+ wmiir xwrite /lbar/$"* '*'$"*}
fn Event-NotUrgentTag {
- shift; wmiir xwrite /lbar/$"* $"*}
+ shift
+ wmiir xwrite /lbar/$"* $"*}
fn Event-Unresponsive {
client = $1; shift
diff -r ef5feea7aa84 -r 80565821dd0c rc/wmiirc.sh
--- a/rc/wmiirc.sh Mon Jan 21 17:28:23 2008 -0500
+++ b/rc/wmiirc.sh Mon Jan 21 18:22:42 2008 -0500
@@ -9,6 +9,10 @@ LEFT=h
LEFT=h
RIGHT=l
+# Bars
+noticetimeout=5
+noticebar=/rbar/!notice
+
# Colors tuples: "<text> <background> <border>"
WMII_NORMCOLORS='#000000 #c1c48b #81654f'
WMII_FOCUSCOLORS='#000000 #81654f #000000'
@@ -36,6 +40,8 @@ status() {
status() {
echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date)
}
+
+echo $WMII_NORMCOLORS | wmiir create $noticebar
# Event processing
wi_events -s ' ' <<'!'
@@ -54,9 +60,26 @@ wi_events -s ' ' <<'!'
Event NotUrgentTag
shift
wmiir xwrite "/lbar/$@" "$@"
- Event LeftBarClick
+ 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 = $!
# Actions
Action quit
wmiir xwrite /ctl quit
@@ -166,8 +189,10 @@ wi_proglist $PATH >$progsfile &
wi_proglist $PATH >$progsfile &
# Setup Tag Bar
-(IFS="$(echo)"; wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,'))
-seltag="$(wmiir read /tag/sel/ctl | sed 1q)"
+OIFS="$IFS"; IFS="$wi_nl"
+wmiir rm $(wmiir ls /lbar | sed 's,^,/lbar/,')
+seltag=$(wmiir read /tag/sel/ctl | sed 1q)
+IFS="$OIFS"
wi_tags | while read tag
do
if [ "$tag" = "$seltag" ]; then
Received on Tue Jan 22 2008 - 00:27:10 UTC
This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:59:06 UTC