add tools
[hband-tools.git] / xwin-tools / set-display-rxvt
blobea35b59993af082ceae4984f3c37467e983aeebe
1 #!/bin/bash
3 osc_queryinfo()
5 local pre=''
6 local suf=''
7 if [ -n "$STY" ]
8 then
9 pre=$'\033P'
10 suf=$'\033\134'
12 echo -n "$pre"$'\033]777;queryinfo;'"$1"$'\007'"$suf"
15 echo -n "Querying DISPLAY from rxvt - " >&2
16 osc_queryinfo DISPLAY
17 read -s -t 0.5 rxvt_queryinfo
18 echo "$rxvt_queryinfo" >&2
19 if [ -n "$rxvt_queryinfo" ]
20 then
21 echo "DISPLAY=$rxvt_queryinfo"
22 export DISPLAY=$rxvt_queryinfo
23 unset rxvt_queryinfo
24 else
25 unset rxvt_queryinfo
26 false
29 echo -n "Querying DBUS_SESSION_BUS_ADDRESS from rxvt - " >&2
30 osc_queryinfo DBUS_SESSION_BUS_ADDRESS
31 read -s -t 0.5 rxvt_queryinfo
32 echo "$rxvt_queryinfo" >&2
33 if [ -n "$rxvt_queryinfo" ]
34 then
35 echo "DBUS_SESSION_BUS_ADDRESS=$rxvt_queryinfo"
36 export DBUS_SESSION_BUS_ADDRESS=$rxvt_queryinfo
37 unset rxvt_queryinfo
38 else
39 unset rxvt_queryinfo
40 false