mirror of
https://github.com/0intro/wmii
synced 2024-11-22 13:52:17 +03:00
Added wmii9menu to, and cleaned up rc/wmiirc. Fixed behavior after selection no item with wmii9menu in rc.wmii.
This commit is contained in:
parent
92f1feda99
commit
4b21c3f205
@ -81,11 +81,13 @@ menulast = ''
|
||||
fn Event-ClientMouseDown {
|
||||
client = $1; button = $2
|
||||
if(~ $button 3) {
|
||||
menulast=`{9menu -initial $menulast Nop Delete}
|
||||
switch($menulast) {
|
||||
do=`{9menu -initial $menulast Nop Delete}
|
||||
switch($do) {
|
||||
case Delete
|
||||
wmiir xwrite /client/$client/ctl kill
|
||||
}
|
||||
if(! ~ $#do 0)
|
||||
menulast = $do;
|
||||
}
|
||||
}
|
||||
|
||||
|
78
rc/wmiirc
78
rc/wmiirc
@ -1,5 +1,6 @@
|
||||
#!/bin/sh
|
||||
# Configure wmii
|
||||
set -f
|
||||
|
||||
# Configuration Variables
|
||||
MODKEY=Mod1
|
||||
@ -14,9 +15,14 @@ WMII_FOCUSCOLORS='#ffffff #153F1F #2A7F3F'
|
||||
WMII_BACKGROUND='#333333'
|
||||
WMII_FONT='-*-fixed-medium-r-normal-*-13-*-*-*-*-*-*-*'
|
||||
|
||||
set -- $(echo $WMII_NORMCOLORS $WMII_FOCUSCOLORS)
|
||||
|
||||
WMII_MENU="dmenu -b -fn $WMII_FONT -nf $1 -nb $2 -sf $4 -sb $5"
|
||||
WMII_9MENU="wmii9menu -font $WMII_FONT -nf $1 -nb $2 -sf $4 -sb $5 -br $6"
|
||||
WMII_TERM="xterm"
|
||||
WMII_MENU="dmenu -b -fn '$WMII_FONT' -nb '#5FBF77' -nf '#222222' -sb '#153F1F' -sf '#ffffff'"
|
||||
export WMII_MENU WMII_FONT WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS WMII_TERM
|
||||
|
||||
export WMII_MENU WMII_9MENU WMII_FONT WMII_TERM
|
||||
export WMII_FOCUSCOLORS WMII_SELCOLORS WMII_NORMCOLORS
|
||||
|
||||
# Column Rules
|
||||
wmiir write /colrules <<EOF
|
||||
@ -34,41 +40,42 @@ EOF
|
||||
|
||||
# Event processing
|
||||
{
|
||||
cat <<EOF
|
||||
cat <<'EOF'
|
||||
# Status Bar Info
|
||||
status() {
|
||||
echo -n \$(uptime | sed 's/.*://; s/,//g') '|' \$(date)
|
||||
echo -n $(uptime | sed 's/.*://; s/,//g') '|' $(date)
|
||||
}
|
||||
|
||||
# Events
|
||||
Event Start
|
||||
case "\$1" in
|
||||
case "$1" in
|
||||
wmiirc)
|
||||
exit;;
|
||||
exac
|
||||
Event CreateTag
|
||||
echo "$WMII_NORMCOLORS" "\$@" | wmiir create "/lbar/\$@"
|
||||
echo "$WMII_NORMCOLORS" "$@" | wmiir create "/lbar/$@"
|
||||
Event DestroyTag
|
||||
wmiir remove "/lbar/\$@"
|
||||
wmiir remove "/lbar/$@"
|
||||
Event FocusTag
|
||||
wmiir xwrite "/lbar/\$@" "$WMII_FOCUSCOLORS" "\$@"
|
||||
wmiir xwrite "/lbar/$@" "$WMII_FOCUSCOLORS" "$@"
|
||||
Event UnfocusTag
|
||||
wmiir xwrite "/lbar/\$@" "$WMII_NORMCOLORS" "\$@"
|
||||
wmiir xwrite "/lbar/$@" "$WMII_NORMCOLORS" "$@"
|
||||
Event UrgentTag
|
||||
shift
|
||||
wmiir xwrite "/lbar/\$@" "*\$@"
|
||||
wmiir xwrite "/lbar/$@" "*$@"
|
||||
Event NotUrgentTag
|
||||
shift
|
||||
wmiir xwrite "/lbar/\$@" "\$@"
|
||||
wmiir xwrite "/lbar/$@" "$@"
|
||||
Event LeftBarClick
|
||||
shift
|
||||
wmiir xwrite /ctl view "\$@"
|
||||
wmiir xwrite /ctl view "$@"
|
||||
# Actions
|
||||
Action quit
|
||||
wmiir xwrite /ctl quit
|
||||
Action rehash
|
||||
proglist $PATH >\$PROGS_FILE
|
||||
proglist $PATH >$PROGS_FILE
|
||||
Action status
|
||||
set +xv
|
||||
if wmiir remove /rbar/status 2>/dev/null; then
|
||||
sleep 2
|
||||
fi
|
||||
@ -76,6 +83,19 @@ Action status
|
||||
while status | wmiir write /rbar/status; do
|
||||
sleep 1
|
||||
done
|
||||
Event ClientMouseDown
|
||||
client=$1; button=$2
|
||||
case "$button" in
|
||||
3)
|
||||
do=$($WMII_9MENU -initial "${menulast:-SomeRandomName}" Nop Delete)
|
||||
case "$do" in
|
||||
Delete)
|
||||
wmiir xwrite /client/$client/ctl kill
|
||||
esac
|
||||
menulast=${do:-"$menulast"}
|
||||
esac
|
||||
EOF
|
||||
cat <<EOF
|
||||
# Key Bindings
|
||||
Key $MODKEY-$LEFT
|
||||
wmiir xwrite /tag/sel/ctl select left
|
||||
@ -94,9 +114,9 @@ Key $MODKEY-s
|
||||
Key $MODKEY-m
|
||||
wmiir xwrite /tag/sel/ctl colmode sel max
|
||||
Key $MODKEY-a
|
||||
Action \$(actionlist | $WMII_MENU) &
|
||||
Action \$(actionlist | \$WMII_MENU) &
|
||||
Key $MODKEY-p
|
||||
sh -c "\$($WMII_MENU <\$PROGS_FILE)" &
|
||||
sh -c "\$(\$WMII_MENU <\$PROGS_FILE)" &
|
||||
Key $MODKEY-t
|
||||
wmiir xwrite /ctl "view \$(tagsmenu)" &
|
||||
Key $MODKEY-Return
|
||||
@ -125,37 +145,45 @@ Key $MODKEY-Shift-$i
|
||||
EOF
|
||||
done
|
||||
|
||||
cat <<EOF
|
||||
cat <<'EOF'
|
||||
# Functions
|
||||
proglist() {
|
||||
paths=\$(echo "\$@" | sed 'y/:/ /')
|
||||
ls -lL \$paths 2>/dev/null |
|
||||
awk '\$1 ~ /^[^d].*x/ { print \$NF }' |
|
||||
paths=$(echo "$@" | sed 'y/:/ /')
|
||||
ls -lL $paths 2>/dev/null |
|
||||
awk '$1 ~ /^[^d].*x/ { print $NF }' |
|
||||
sort | uniq
|
||||
}
|
||||
|
||||
actionlist() {
|
||||
{
|
||||
proglist $WMII_CONFPATH
|
||||
echo \$ACTIONS | tr ' ' '\012'
|
||||
echo $ACTIONS | tr ' ' '\012'
|
||||
} | sort | uniq
|
||||
}
|
||||
|
||||
tagsmenu() {
|
||||
wmiir ls /tag | sed "s|/||; /^sel\$/d" | $WMII_MENU
|
||||
wmiir ls /tag | sed "s|/||; /^sel$/d" | $WMII_MENU
|
||||
}
|
||||
|
||||
conf_which() {
|
||||
prog=$({PATH="$WMII_CONFPATH:$PATH" which $1})
|
||||
shift
|
||||
if [ -n "$prog" ]; then
|
||||
$prog
|
||||
fi
|
||||
}
|
||||
|
||||
Action() {
|
||||
action=\$1; shift
|
||||
if [ -n "\$action" ]; then
|
||||
Action_\$action \$@ || PATH=$WMII_CONFPATH \$action \$@
|
||||
action=$1; shift
|
||||
if [ -n "$action" ]; then
|
||||
Action_$action $@ || conf_which $action $@
|
||||
fi
|
||||
}
|
||||
|
||||
# Misc
|
||||
PROGS_FILE="$WMII_NS_DIR/.proglist"
|
||||
Action status &
|
||||
proglist $PATH >\$PROGS_FILE &
|
||||
proglist $PATH >$PROGS_FILE &
|
||||
EOF
|
||||
|
||||
xsetroot -solid "$WMII_BACKGROUND" &
|
||||
|
3
wmiiloop
3
wmiiloop
@ -24,7 +24,7 @@ function addevent() {
|
||||
action = arg[2];
|
||||
actions[action] = body
|
||||
gsub("\"", "\\\"", action)
|
||||
print "ACTIONS=\"$ACTIONS\n" action "\""
|
||||
print "ACTIONS=\"$ACTIONS " action "\""
|
||||
print "Action_" action "() {" actions[action] "\n}"
|
||||
}
|
||||
}
|
||||
@ -56,7 +56,6 @@ END {
|
||||
body = events[arg[1]]
|
||||
}
|
||||
print "set -- " $0
|
||||
print "set +f"
|
||||
print body
|
||||
fflush()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user