Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

help(wm) doesn't show anything. #2

Open
stuaxo opened this issue Oct 25, 2015 · 13 comments
Open

help(wm) doesn't show anything. #2

stuaxo opened this issue Oct 25, 2015 · 13 comments

Comments

@stuaxo
Copy link

stuaxo commented Oct 25, 2015

I was wondering how to use this to get a window settings for a window belonging to some pid, but found that doing

from orcsome import get_wm
wm = get_wm()
help(wm)

doesn't have any info in it.

@baverman
Copy link
Owner

I've commited into master ImmediateWM which allows to play with wm from repl.

>>> import orcsome.wm
>>> wm = orcsome.wm.ImmediateWM()
>>> help(wm)
>>> help(orcsome.wm.Window)
>>> print [(w.name, w.cls, w.title) for w in wm.get_clients()]
[('panel', 'bmpanel', None), ('urxvt', 'URxvt', 'terminal'), ('Navigator', 'Firefox', '\xc2\xabimmediate\xc2\xbb \xd0\xb2 \xd0\xbf\xd0\xb5\xd1\x80\xd0\xb5\xd0\xb2\xd0\xbe\xd0\xb4\xd0\xbd\xd1\x8b\xd1\x85 \xd1\x81\xd0\xbb\xd0\xbe\xd0\xb2\xd0\xb0\xd1\x80\xd1\x8f\xd1\x85 - Mozilla Firefox'), ('vial', 'URxvt', 'boo.http (~/work/dsfs) - VIM'), ('urxvt', 'URxvt', 'terminal'), ('urxvt', 'URxvt', 'terminal'), ('zathura', 'Zathura', 'weil-crush-sc06.pdf [4/12]'), ('urxvt', 'URxvt', 'terminal'), ('urxvt', 'URxvt', 'terminal'), ('vial', 'URxvt', 'wm.py (~/work/orcsome/orcsome) - VIM'), ('urxvt', 'URxvt', 'terminal'), ('vial', 'URxvt', '__init__.py (~/zvooq/zvq-prod/zvooq/utils) - VIM'), ('mutt', 'URxvt', 'mutt-minibav-1000-26901-17702220781800088554 + (/tmp) - VIM')]

There are no too many facilities to use orcsome like wmctrl. But you are
welcome if you have some ideas in mind.

@stuaxo
Copy link
Author

stuaxo commented Oct 25, 2015

Oops - just realised it was returning None. This is because I'm running in a virtualenv, and so couldn't use python-xlib. :/

@baverman
Copy link
Owner

baverman commented Oct 25, 2015 via email

@stuaxo
Copy link
Author

stuaxo commented Oct 25, 2015

$ ipython
In [1]: import orcsome
In [2]: orcsome.get_wm() == None
True

That's weird - should this work under gnome shell ?

@baverman
Copy link
Owner

get_wm in repl always returns None. There is event loop so you must use ImmediateWM

@stuaxo
Copy link
Author

stuaxo commented Oct 25, 2015

Note - I needed to sudo apt-get install libev-dev to import orcsome.wm

@stuaxo
Copy link
Author

stuaxo commented Oct 25, 2015

Now, I have this working .. does it seems plausible to replace my dodgy use of xlsclients and xprop with orcsome here

https://gist.github.com/stuaxo/3942b4d077bb629acd2a << code, not necessarily worth looking at :)

I get the window info of a process I launch - with the idea that when I relaunch I will re-apply those same properties (x, y, width, height, z-index and attributes like 'always on top' to the new window ?

I'm guessing I could use "find_client" to do the initial "find the window belonging to the pid" part ?

@baverman
Copy link
Owner

I'm guessing I could use "find_client" to do the initial "find the window belonging to the pid" part ?

Yep. You can iter through wm.get_clients and match pid with w.get_property('_NET_WM_PID')[0]

@stuaxo
Copy link
Author

stuaxo commented Oct 25, 2015

Cool, I'll give that a go, is there a property for z-index of a window ?

@baverman
Copy link
Owner

I will re-apply those same properties (x, y, width, height, z-index and attributes like 'always on top' to the new window ?

Usually it's responsibility of a WM to remember and restore client props. Orcsome have no dedicated methods/properties. There is only raw Window.get_property and WM._send_event.

@stuaxo
Copy link
Author

stuaxo commented Oct 25, 2015

Ah, ok - I saw there is place_window_above and place_window_below. I'm doing a small reloader, so when code changes I reload the running app, + put will put it in the same place... if it's not possible to set z, I might just raise it to the top.

@stuaxo
Copy link
Author

stuaxo commented Oct 25, 2015

Hm, you're right the location does seem to be the same - maybe I'm making work for myself :)

@baverman
Copy link
Owner

if it's not possible to set z, I might just raise it to the top.

There is no a "z-index" notion in XWindow. Clients are organized in stack and can be moved or be pined to the top or to the bottom of it. place_window_* are move client.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants