[request] Ubuntu: app.window() returns None - not supported on Linux yet

Bug #747006 reported by Jerry Liu
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
SikuliX
Fix Released
Wishlist
Unassigned

Bug Description

Ubuntu 10.10 32Bit and 64Bit / Sikuli X-1.0rc2 (32Bit and 64Bit)

only App.open(), App.close() and App.focus() work
*****************************************

app.window()/App.focusedWindow() can return the region of the application's window on Mac and Window. However, it returns NONE on Ubuntu.

For instance, the following code results in error on Ubuntu, but works well on Mac and Windows.
ff = App("firefox")
wait(3)
print ff.window().getY()

Revision history for this message
RaiMan (raimund-hocke) wrote :

I have lost the track, since I always build from the current source, if something is fixed in Sikuli.

There has been a problem, that App.window() did not return a full featured Region object.

The workaround was, to force it a Region object:

print Region(ff.window()).getY()

so give it a try.

BTW: What Sikuli version?

Revision history for this message
Jerry Liu (whirls9) wrote :

Thanks RaiMan for your rapid response. I tried your suggestion, it doesn't work either.
I use 1.0rc2 x86.

Revision history for this message
Jerry Liu (whirls9) wrote :

I just noticed the following information at http://sikuli.org/docx/new-in-sikulix.html.
Will Sikuli support this on Linux later on?

New App Class replaces the old openApp, switchApp, closeApp functions (see Class App)

App.open(), App.close(), App.focus()
App.window() returns the bound of the app window as a Region, so you can restrict following actions within that region. (Windows and Mac only)

Revision history for this message
RaiMan (raimund-hocke) wrote : Re: X-1.0rc2: Ubuntu: app.window() returns None - expected a Region object

it really seems to be a current bug.

pls. tell your Ubuntu version.

I have changed the bug description accordingly.

summary: - app.window() doesn't work on Ubuntu
+ X-1.0rc2: Ubuntu: app.window() returns None - expected a Region object
Changed in sikuli:
status: New → Confirmed
description: updated
Revision history for this message
RaiMan (raimund-hocke) wrote :

You got it - thanks.

I knew something about that, but did not remember where it was written.

summary: - X-1.0rc2: Ubuntu: app.window() returns None - expected a Region object
+ X-1.0rc2: Ubuntu: app.window() returns None - not supported on Linux yet
description: updated
Changed in sikuli:
importance: Undecided → Wishlist
summary: - X-1.0rc2: Ubuntu: app.window() returns None - not supported on Linux yet
+ [request] Ubuntu: app.window() returns None - not supported on Linux yet
Revision history for this message
Jerry Liu (whirls9) wrote :

I use Ubuntu 10.10 desktop x86. The line below is the output of "uname -a".

Linux ubuntu 2.6.35-28-generic #49-Ubuntu SMP Tue Mar 1 14:40:58 UTC 2011 i686 GNU/Linux

RaiMan (raimund-hocke)
description: updated
Revision history for this message
Jerry Liu (whirls9) wrote :

XWininfo is an easy workaround on Linux.
Maybe Sikuli should also use it to implement this feature.

Revision history for this message
niknah (hankin0) wrote :

Here's a patch
Note that some linux programs are started by batch files, like in ubuntu firefox is a batch file that starts firefox-bin

So after doing App.open() you'll have to start a new App('firefox-bin') to use that window.

Revision history for this message
Tsung-Hsiang Chang (vgod) wrote :

Thanks for the patch, niknah!
This should be able to applied to the next release.

Changed in sikuli:
milestone: none → x1.0-rc3
status: Confirmed → In Progress
Changed in sikuli:
status: In Progress → Fix Committed
RaiMan (raimund-hocke)
Changed in sikuli:
status: Fix Committed → Fix Released
Revision history for this message
jcppkkk (comet-jc) wrote :

I found a bug here,
The original patch can't search appName through all tailing string of winLine with space characters, It often fails.
Since my source has been formatted so i can't make a patch, so i just provide a fix here.

=== modified file 'sikuli-script/src/main/java/org/sikuli/script/LinuxUtil.java'
- if(!ok && winLine[7].toLowerCase().indexOf(appName)>=0) {
- ok=true;
- }
+ int from = str.indexOf(winLine[7]);
+ if (!ok && str.substring(from).toLowerCase().indexOf(appName) >= 0) {
+ ok = true;
+ }

Revision history for this message
suneetha N R (sunita-nr) wrote :

Hi,

Recently, i tried in Ubuntu and got null value for app.window(), app.focusedWindow() so may i know the solution for this issue since some one have mentioned in comments as fixed.

Waiting for your valuable response.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.