aboutsummaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorGravatar Mason Larobina <mason.larobina@gmail.com>2009-06-29 18:40:39 +0800
committerGravatar Mason Larobina <mason.larobina@gmail.com>2009-06-29 18:40:39 +0800
commitd6d1485b3dc7e49f0c460062bf631c7f6e66228b (patch)
tree2ce0447a9064ac0220edf5b284a8f163bc917637 /examples
parent7d864e7411ca1660db85e284fb65b112bd2825ab (diff)
Added static probe cmds to uzbl instance class
Diffstat (limited to 'examples')
-rwxr-xr-xexamples/data/uzbl/scripts/uzbl_tabbed.py30
1 files changed, 22 insertions, 8 deletions
diff --git a/examples/data/uzbl/scripts/uzbl_tabbed.py b/examples/data/uzbl/scripts/uzbl_tabbed.py
index 5fff98f..26f9fc3 100755
--- a/examples/data/uzbl/scripts/uzbl_tabbed.py
+++ b/examples/data/uzbl/scripts/uzbl_tabbed.py
@@ -176,9 +176,18 @@ class UzblTabbed:
self._outgoing = []
self._configured = False
+ # Probe commands
+ self._probeurl = 'sh \'echo "url %s $6" > "%s"\'' % (self.pid,\
+ self.parent.fifo_socket)
+
+ # As soon as the variable expansion bug is fixed in uzbl
+ # I can start using this command to fetch the winow title
+ self._probetitle = 'sh \'echo "title %s @window_title" > "%s"\'' \
+ % (self.pid, self.parent.fifo_socket)
+
# When notebook tab deleted the kill switch is raised.
self._kill = False
-
+
# Queue binds for uzbl child
self.parent.config_uzbl(self)
@@ -228,19 +237,20 @@ class UzblTabbed:
# Ugly way of getting the socket path. Screwed if fifo is in any
# other part of the fifo socket path.
-
socket = 'socket'.join(self.fifo.split('fifo'))
-
- # I feel so dirty
+ # Hackish & wasteful way of getting the window title.
subcmd = 'print title %s @<document.title>@' % self.pid
cmd = 'uzblctrl -s "%s" -c "%s" > "%s" &' % (socket, subcmd, \
self.parent.fifo_socket)
-
subprocess.Popen([cmd], shell=True)
+ self.send(self._probeurl)
+
+ # Wont work yet.
+ #self.send(self._probetitle)
self._lastprobe = time.time()
-
-
+
+
def send(self, msg):
'''Child fifo write function.'''
@@ -508,7 +518,11 @@ class UzblTabbed:
if len(cmd) > 2:
uzbl = self.get_uzbl_by_pid(int(cmd[1]))
if uzbl:
- setattr(uzbl, cmd[0], ' '.join(cmd[2:]))
+ old = getattr(uzbl, cmd[0])
+ new = ' '.join(cmd[2:])
+ setattr(uzbl, cmd[0], new)
+ if old != new:
+ self.update_tablist()
else:
error("Cannot find uzbl instance with pid %r" % int(cmd[1]))
else: