Cycling through all terminal windows without a popup on Ubuntu

Untitled

TL;DR    Download: [nexttermwin.sh] [prevtermwin.sh] script ,set custom global hotkey (e.g. F9,F10 )

Now, pressing F10 and F9 should cycle forward and backwards all terminals windows without popup.

Imagine you have many terminal windows open in fullscreen mode. wmctrl tool can navigate to any open window by typing title substring(incase-sensitive) like to focus Chrome window we can simply try:

But even then title substring cant help us and if we have multiple terminal windows open of same directory, we cannot navigate to specific window in it.

ALT+~ can help us here but requires specific application to be selected. Same goes for other applications with multiple windows open.

ALT+ESC does the job for this and cycles through next windows+instantly navigates to target window without a popup, but it draws a distracting rectangle arround the windows and requires holding these keys pressed until target window reached.

ALT+TAB lets you immediately switch to previous window and switch back which is useful feature. But yet it shows you a popup and requires you to browse through all window popup and select target window.

So, for a more faster and focused window switching we can use xdotool. It can focus any and every window of any desktop by window id provided by window manager of desktop environment. The key here in this script is xdotool gets current window id. wmctrl gets all window ids calculates next window id and activates window:

Cycling backwards:

prevtermwin.sh

Cycling through all Windows:

[nexwin.sh] [prevwin.sh]

For navigating through all windows winIds need to be:

Mapping custom global hotkeys to specific script from linux terminal:

Now, pressing F10 and F9 should call ~/nexttermwin.sh and ~/prevtermwin.sh and cycle window forward and backwards.

No comments:

Post a Comment