Skip to content
This repository has been archived by the owner on Mar 27, 2022. It is now read-only.

suggestion: alternative method for detecting available screen space #173

Open
ilkerhk opened this issue May 9, 2016 · 2 comments
Open
Labels

Comments

@ilkerhk
Copy link

ilkerhk commented May 9, 2016

Dear Tim,
Really nice extension with a potential of attracting tiling wm users. Below I have a suggestion. I'm hoping that it might (in a simple way) help you for the below issues/request :
1- The multi-monitor wishlist
2- Hidden gnome-panel causing gaps
3- Workspaces-to-dock extension compatibility (when workspace switcher always visible and always on the top, but shellshape sends windows below)

Here is my suggestion. Suppose you want to send a window to upper-left 1/3 corner. You need the current geometry with some details including monitor, docks such as panel and workspace switchers and even even decorations may be. Instead of trying to calculate those just maximize that window. Then get the geometry of the window when it is maximized. Now you have the geometry of the current monitor visible area excluding panel and workspace dock etc. Use that are to scale the windows. It is not ideal way but it is really reliable since you leave all this dirty work to gnome.

In fact I wrote such a script and assigned to shortcuts. Using for a while which works on multi-monitors and takes care of all above issues. See attached file.

Edit updated file :
tile_to_corner.zip

best,

P.S. its usage is :
tile_to_corner.sh 1
snaps to upper-left corner, and chaning 1 snaps active window to different places. second parameter can be used to send a PID(not window id for a personal usage reason). There is also a correction as explained in the script...

@timbertson
Copy link
Owner

Thanks @ilkerhk (gisted here for posterity: https://gist.github.com/timbertson/e0ded0314027f5168121d5bec62c4082 )

Implementing this is likely to be a bit tricky, as I expect maximization is asynchronous (i.e you can't maximize a window and then get its size, you'd need to wait for a least one roundtrip with the window manager). And it may also involve unwanted graphical flashes as you render the maximized window(s).

Personally I have no issues with screen bounds as I don't use any fancy panels, nor do I have external monitors. I understand others do though, so if anyone does feel like making a PR for a more robust version of this code in shellshape's bounds detection algorithm I'd be OK with that as long as the downsides are kept in check (e.g. slowness / graphical glitches / robustness).

@timbertson timbertson changed the title A suggestion suggestion: alternative method for detecting available screen space May 27, 2016
@ilkerhk
Copy link
Author

ilkerhk commented May 28, 2016

Dear Tim,
I agree your comments it is not ideal way. I guess the ideal way (to calculate the bounds of the working ares)would be to use the same method as gnome does internally.
For the one who is willing to make a PR, I am uploading improved version of the script, in case he/she might find it useful...

tile_to_corner.sh.zip

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

No branches or pull requests

2 participants