Getting a Window¶
Be aware that all of this ways of getting a window can return None.
So you might want to check if the window is None before doing anything with it.
Example None check¶
if window is None:
exit("Window not found!")
Get currently active window¶
from display_server_interactions import DSI
with DSI() as dsi:
window = dsi.get_active_window()
Get a window by its name¶
from display_server_interactions import DSI
with DSI() as dsi:
window = dsi.get_window_by_name("Funny Window Name")
Get window by PID¶
from display_server_interactions import DSI
with DSI() as dsi:
window = dsi.get_window_by_pid(42)