negate activeApplication(”Name”) and key trigger

Asked by pbd on 2008-10-21

Hi,

I have two questions,

1) is it possible to create a negative condition like 'not activeApplication(”Name”)'? I need to enable gestures everytime but in firefox (that has it's own).

2) is it possible to configure gestikk to capture mouse gestures only for example when "alt" or "crl" key is pressed?

Thanks,

pbd

Question information

Language:
English Edit question
Status:
Solved
For:
gestikk Edit question
Assignee:
No assignee Edit question
Solved by:
Friedrich Weber
Solved:
2008-10-22
Last query:
2008-10-22
Last reply:
2008-10-21

Hello,

1) yes, it should be possible using the Global condition and 'not activeApplication("firefox")' should work.

2) You mean if either CTRL or ALT is pressed? Then: at the moment, no. But a simple patch could fix that.
Or do you mean 'only recognize if CTRL is pressed'? Then: yes ;)

Does that solve your question?

Regards,

Fred

pbd (pbd) said : #2

Thanks for your prompt answer,

1) I thing I have some problems with this. Here is gestikk.conf:

[Notification]
color = #ffff00000000
font = Sans
font_size = 20
type = 0

[Internal]
version = 0.6

[Preferences]
global condition = activeApplication_endswith('Vimperator')
tolerance = 20
switcher = altdown

[OSD]
color = #ffff00000000
enabled = 1
line_width = 3

I'm running FreeBSD 7.0 / amd64, Python 2.5.2, PyGTK 2.12.1, pynotify 0.1.1, Kiwi 1.9.22, python-virtkey 0.50 and pyparsing 1.5.1.

Gestikk stops woking after first gesture:

pbd@cht0n ~/.tmp/gestikk/gestikk-0.6 % ./gestikk.py -d
gestikk - version 0.6
Usage: gestikk [-c] [-q] [-d]
        -c : launch configuration applet
        -q : don't print this
        -d : Debug Mode
Please DO NOT quit gestikk using CTRL+C, this will quit all child processes.
DEBUG: recognized: (0,1)
DEBUG: checking global condition ...
Traceback (most recent call last):
  File "/home/fred/dev/gestikk/release/gestikk-0.6/gestikk-0.6/gestikk/start_main.py", line 218, in _listen
  File "/home/fred/dev/gestikk/release/gestikk-0.6/gestikk-0.6/gestikk/condparse.py", line 118, in check
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 1065, in parseString
    loc, tokens = self._parse( instring, 0 )
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 941, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 2577, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 941, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 2577, in parseImpl
    return self.expr._parse( instring, loc, doActions, callPreParse=False )
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 941, in _parseNoCache
    loc,tokens = self.parseImpl( instring, preloc, doActions )
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 2448, in parseImpl
    raise maxException
pyparsing.ParseException: Expected "not" (at char 0), (line:1, col:1)

Am I doing something wrong?

2) yes, that works. Sorry, I overlooked the option.

pbd

Hello,

you have to use double quotes (") in your condition instead of single quotes, maybe that's the reason.

Fred

pbd (pbd) said : #4

Hi,

the error message changed, but problem persists:

pbd@cht0n ~/.tmp/gestikk/gestikk-0.6 % ./gestikk.py -d
gestikk - version 0.6
Usage: gestikk [-c] [-q] [-d]
        -c : launch configuration applet
        -q : don't print this
        -d : Debug Mode
Please DO NOT quit gestikk using CTRL+C, this will quit all child processes.
DEBUG: recognized: (0,1)
DEBUG: checking global condition ...
Traceback (most recent call last):
  File "/home/fred/dev/gestikk/release/gestikk-0.6/gestikk-0.6/gestikk/start_main.py", line 218, in _listen
  File "/home/fred/dev/gestikk/release/gestikk-0.6/gestikk-0.6/gestikk/condparse.py", line 116, in check
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 1115, in transformString
    for t,s,e in self.scanString( instring ):
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 1095, in scanString
    nextLoc,tokens = parseFn( instring, preloc, callPreParse=False )
  File "/usr/local/lib/python2.5/site-packages/pyparsing.py", line 967, in _parseNoCache
    tokens = fn( instring, tokensStart, retTokens )
  File "/home/fred/dev/gestikk/release/gestikk-0.6/gestikk-0.6/gestikk/condparse.py", line 150, in _call_function
  File "/usr/home/pbd/.tmp/gestikk/gestikk-0.6/gestikk/tools.py", line 321, in <lambda>
    ch.add_function('activeApplication_endswith', lambda sw: wnckh.get_active_app_name().endswith(sw))
  File "/home/fred/dev/gestikk/release/gestikk-0.6/gestikk-0.6/gestikk/netwm.py", line 99, in get_active_app_name
  File "/home/fred/dev/gestikk/release/gestikk-0.6/gestikk-0.6/gestikk/netwm.py", line 91, in _get_window_pid
TypeError: 'NoneType' object is unsubscriptable

Without any global condition everything works.

pbd

Hello,

which window manager do you use?

pbd (pbd) said : #6

Hi,

I'm using awesome-2.3.4 (awesome.naquadah.org).

I avoided the need for global condition by setting ctrl as the activation key, but if you like to find out what is wrong, I will for sure provide you with any information you need. Perhaps, I can create you a temporary VNC account on my machine, but only between 9:00 and 16:00 (GMT +1).

pbd

Hello,

it seems that awesome 2.x does not set the _NET_WM_PID property (http://standards.freedesktop.org/wm-spec/wm-spec-latest.html#id2552250) on client windows, which is required for the activeApplication-stuff. awesome 3.x does set it, so you could either update to awesome 3.x or use activeWindowTitle* instead of activeApplication.

I hope that helps :-)

Regards,

Fred

pbd (pbd) said : #8

Ok, I will try it tomorrow. In any case thanks for help.

pbd (pbd) said : #9

Thanks Friedrich Weber, that solved my question.