metacity

Discover what window is active on Gnome/Linux/Ubuntu from Python?

六眼飞鱼酱① 提交于 2020-01-01 03:31:38
问题 Is there any way to get a list of all windows that are open at present and see what window is at the top (i.e. active?) from Python? This is using Gnome on Ubuntu Linux. wnck looks like it might do this, but it's very lacking in documentation. 回答1: import wnck screen = wnck.screen_get_default() window_list = screen.get_windows() active_window = screen.get_active_window() See also Get active window title in X, and WnckScreen in the documentation. Other questions containing wnck have useful

Discover what window is active on Gnome/Linux/Ubuntu from Python?

…衆ロ難τιáo~ 提交于 2019-12-03 09:12:23
Is there any way to get a list of all windows that are open at present and see what window is at the top (i.e. active?) from Python? This is using Gnome on Ubuntu Linux. wnck looks like it might do this, but it's very lacking in documentation. Josh Lee import wnck screen = wnck.screen_get_default() window_list = screen.get_windows() active_window = screen.get_active_window() See also Get active window title in X , and WnckScreen in the documentation. Other questions containing wnck have useful code samples. Here's the same code using the modern GObject Introspection libraries instead of the