jay823001 / autokey

Automatically exported from code.google.com/p/autokey
GNU General Public License v3.0
0 stars 0 forks source link

window.get_active_geometry doesn't work #77

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The following one line script doesn't work in autokey 0.71 (debian):

position = window.get_active_geometry()

With the following error:

Traceback (most recent call last):
  File "/usr/lib/python2.6/dist-packages/autokey/service.py", line 404, in execute
    exec script.code in self.scope
  File "<string>", line 2, in <module>
  File "/usr/lib/python2.6/dist-packages/autokey/scripting.py", line 918, in get_active_geometry
    return map(int, output)
ValueError: invalid literal for int() with base 10: ''

The problem seems to be in the following lines in 
/usr/lib/python2.6/dist-packages/autokey/scripting.py:

            output = matchingLine[14:].split(' ')[0:3]
            return map(int, output)

Matching line is: 
"0x0180002a  0 2089 293  898  577  ibm-0d581e8ed2a AutoKey - Configuration"

I'm not a python expert. But it seems to me that the problem is that there are 
two spaces between 293 and 898. Split function with parameter ' ' does not 
treat two spaces as one. Furthermore, it seems that it is necessary to use 
[0:4] instead of [0:3].

Another problem is that get_window_geometry and resize_move seems to interpret 
geometry differently, probably with and without border. In particular, consider 
the following script:

position = window.get_active_geometry()
window.resize_move(":ACTIVE:", position[0], position[1], -1, -1) 

It should keep the window on its current position. However instead the window 
moves down and little bit right. I'm using autokey-gtk 0.71 and gnome 2.30 from 
Debian.

Thanks! Petr

Original issue reported on code.google.com by petrv...@gmail.com on 5 Sep 2010 at 10:14

GoogleCodeExporter commented 9 years ago
Thanks for the bug report. The formatting changes are easily fixed. 

The other issue with the window being moved slightly is internal to wmctrl 
which is the program that is being used in the background to do the actual 
work. You should file a bug report against wmctrl for your second issue.

Original comment by cdekter on 5 Sep 2010 at 11:17

GoogleCodeExporter commented 9 years ago
Fixed v0.71.1

Original comment by cdekter on 3 Oct 2010 at 2:24