1 |
#!/bin/sh |
#!/bin/sh -x |
2 |
|
|
3 |
uid="$1" |
uid="$1" |
4 |
test -z "$uid" && uid="null" |
test -z "$uid" && uid="null" |
5 |
name="dwm-popup-$uid" |
name="dwm-popup-$uid" |
6 |
id_f="/tmp/$name.id" |
id_f="/dev/shm/$name.id" |
7 |
|
|
8 |
if [ "$2" == "term" ] ; then |
function start() { |
9 |
id=`xwit -current -print | cut -d: -f1` |
id=`xwit -current -print | cut -d: -f1` |
10 |
echo "*** uid $uid id $id ***" |
echo "*** start uid $uid id $id to $id_f ***" |
11 |
echo $id > $id_f |
echo $id > $id_f |
12 |
|
$@; |
13 |
|
rm -f $id_f; |
14 |
|
exit |
15 |
|
} |
16 |
|
|
17 |
|
if [ "$2" == "term" ] ; then |
18 |
case $uid in |
case $uid in |
19 |
a) exec screen -R -S $name ;; |
a) start screen -R -S $name ;; |
20 |
s) exec screen -R -S $name irssi ;; |
s) start screen -R -S $name irssi ;; |
21 |
*) echo "*** default fallback for $uid ***" ; exec bash ;; |
*) start bash ;; |
22 |
esac |
esac |
23 |
fi |
fi |
24 |
|
|
25 |
# |
|
26 |
term="rxvt -geometry 100x43+100-20 -name $name -fn neep-alt-iso8859-2-24 -rv +sb -n $name -ls -e $0 $uid term" |
case $uid in |
27 |
|
a) g="100x43+100-20"; f="neep-alt-iso8859-2-24" ;; |
28 |
|
s) g="139x25+0+16"; f="neep-alt-iso8859-2-18" ;; |
29 |
|
*) g="80x25+100+100"; f="neep-alt-iso8859-2-18" ; echo "*** default ***" ;; |
30 |
|
esac |
31 |
|
|
32 |
|
xterm=`which rxvt-2.7.10 || whixh rxvt` |
33 |
|
term="$xterm -geometry $g -name $name -fn $f -rv +sb -n $name -ls -e $0 $uid term" |
34 |
|
echo "*** using term: $term ***" |
35 |
|
|
36 |
if [ ! -e $id_f ] ; then |
if [ ! -e $id_f ] ; then |
37 |
$term |
$term |
38 |
else |
else |
39 |
id=`cat $id_f` |
id=`cat $id_f` |
40 |
info=`xwininfo -id $id` |
info=`xwininfo -id $id` |
41 |
echo "*** $id from $id_f ***" |
echo "*** $id from $id_f = $info ***" |
42 |
test ! -z "$info" && ( |
test ! -z "$info" && ( |
43 |
op="-unmap" |
op="-unmap" |
44 |
echo $info | grep 'Map State: IsViewable' > /dev/null || op="-pop" |
echo $info | grep 'Map State: IsViewable' > /dev/null || op="-pop" |