I'm trying to improve minimize to tray feature of some application and I want to show window on tray icon click if it was minimized to tray or placed not on the current workspace.
I encountered the problem that occurs when I try to show (un-minimize) the app's window that's visible on the workspace (let's say 'workspace 1') other than the current one ('workspace 2'). The problem is that staying on the workspace to the left of the current one the app's window has negative x coordinate, because window position is counted relative to current workspace. I'd like to get window's position relative to the workspace 1 (not current one) and show it at this point on workspace 2 (the current one).
I'm doing smth like that right now to show window on the current workspace at the position same to the position it was on the previous workspace:
# get desktop size
ws_width, ws_height = gtk.gdk.get_default_root_window().get_size()
# get position relative to current workspace
x, y = window.get_position()
# get position relative to the workspace the window is on
x %= ws_width
y %= ws_height
window.move(x, y)
window.show()
but I don't like this workaro开发者_如何学运维und and not sure that this code wouldn't break smth on the desktops other than gnome.
So I'll be grateful for any other solution of the problem as well as information about the situation on other linux desktops (e.g., do they count window position relative to the current workspace as gnome or not).
精彩评论