Debian -- better screen locking

Eli retracile at gmail.com
Tue Aug 26 02:08:30 CEST 2008


On Sunday 24 August 2008 08:19:30 pm Eli wrote:
> Since zhone is now killing the keyboard, the matchbox-keyboard-toggle
> utility needs to be more robust and detect if the keyboard is running or
> not, so I patched it like this:
> --- /usr/bin/matchbox-keyboard-toggle.orig	2008-08-24 12:15:20.000000000
> +0000 +++ /usr/bin/matchbox-keyboard-toggle	2008-08-24 14:36:22.000000000
> +0000 @@ -8,17 +8,9 @@
>
>  import os
>
> -keyboard_shown=False
> -
>  def signal_handler(name, action, seconds):
> -    global keyboard_shown
> -
>      if name == "AUX" and action == "pressed":
> -        if keyboard_shown:
> -            os.system("kill -s KILL `pidof /usr/bin/matchbox-keyboard`")
> -        else:
> -            os.system("matchbox-keyboard &")
> -        keyboard_shown = not keyboard_shown
> +	os.system("pidof /usr/bin/matchbox-keyboard >/dev/null ||
> (matchbox-keyboard &) && kill -s KILL `pidof /usr/bin/matchbox-keyboard`")
>
>
>  bus = dbus.SystemBus()

*cough*  That part's not quite right.  The shell commands are in the wrong 
order.

--- /usr/bin/matchbox-keyboard-toggle.orig	2008-08-24 12:15:20.000000000 +0000
+++ /usr/bin/matchbox-keyboard-toggle	2008-08-25 23:35:25.000000000 +0000
@@ -8,17 +8,9 @@
 
 import os
 
-keyboard_shown=False
-
 def signal_handler(name, action, seconds):
-    global keyboard_shown
-
     if name == "AUX" and action == "pressed":
-        if keyboard_shown:
-            os.system("kill -s KILL `pidof /usr/bin/matchbox-keyboard`")
-        else:
-            os.system("matchbox-keyboard &")
-        keyboard_shown = not keyboard_shown
+        os.system("pidof /usr/bin/matchbox-keyboard >/dev/null && kill -s 
KILL `pidof /usr/bin/matchbox-keyboard` || (/usr/bin/matchbox-keyboard &)")
 
 
 bus = dbus.SystemBus()


Eli
------------------. "If it ain't broke now,
Eli Carter         \                  it will be soon." -- crypto-gram
retracile at gmail.com `-------------------------------------------------




More information about the community mailing list