DEV Community

Discussion on: How I open and resize all my applications with just a keyboard shortcut

Collapse
 
thiagoa profile image
Thiago Araújo Silva • Edited

Cool script! On my end, I use devilspie2 to monitor new windows and do whatever I want with them. That along with Gnome's automatic shortcuts for favorite applications (Win+1, Win+2, ..., until Win+9) makes the process lazy for me because I just trigger the shortcut to open the app and its window appears exactly where I want. Here is my configuration file in Lua.

I imagine your script might have a few edge cases to deal with. For instance, I think you should match by WM_CLASS instead of window title. If there's an unrelated window with "google" in its title and it appears before Google Chrome, your script will probably resize the wrong window. For that, you should probably use wmctrl -xl, which will also print out the application's WM_CLASS, and then parse the output.

I even use this trick in my Lua config file to figure out how many Chrome windows are open and only act on the window if it's the first one.