Share your knowledge at the LQ Wiki.
Go Back > Blogs > linux-related notes
User Name


Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Rate this Entry

Bash xdotool+wmctrl "daemon" that maximizes "almost maximized" windows

Posted 10-01-2016 at 07:16 PM by the dsc
Updated 12-16-2016 at 04:04 AM by the dsc
Tags openbox, wmctrl

I find annoying that, for whatever reason, it seems that some windows get "almost maximized" (I have the impression that some browsers do that by "design", even though I'm not sure), and then I end up clicking in a desktop pixel instead of the scroll bar or something. In my case that action is assigned to show the desktop/minimize all windows.

So here's what I just came up with so far, for a 1280x1024 resolution:

while true ; do sleep 3 

xdotool getactivewindow getwindowgeometry | grep Geometry | while read g ; do g=${g/Geometry: } ; x=${g%%x*} ; y=${g##*x} 

if ((x<1280)) && ((x>1250)) ; then xdotool getactivewindow windowsize 1000 0 ; wmctrl -r :ACTIVE: -b add,maximized_horz ; fi 
if  ((y<1024)) && ((y>900)) ; then xdotool getactivewindow windowsize 0 700 ; wmctrl -r :ACTIVE: -b add,maximized_vert ; fi 


Before maximizing it, it resizes it to something smaller than the threshold, in order to avoid the need to resize immediately after un-maximizing, with a three-second-or less limit.

Maybe a higher snap-to-corner threshold on openbox would also help with that. But I think I may also find that annoying for some reason. In the other hand I'm not even sure it exists, maybe there's only the "resistance" against moving out of the desktop/monitor.
Posted in Uncategorized
Views 1183 Comments 0
« Prev     Main     Next »
Total Comments 0




All times are GMT -5. The time now is 05:24 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration