this post was submitted on 15 Jul 2023
36 points (100.0% liked)

Linux

46700 readers
2008 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I’m busy looking into xdotool to automate various actions on Linux with the Elgato Stream Deck (well because Elgato only provides apps for Windows and MacOS). There is a good Linux alternative app to work with the Stream Deck, but I do need to be able to execute some commands when I want to bring a specific window into focus from the background, and then to execute a key press shortcut. So an example may be to bring Brave Beta browser window into focus, then activate tab 3 and do a tab fresh.

Another tip I worked out is instead of struggling to identify which window has which name exactly, you can also right-click on a window’s title bar and choose to rename the window. When I restarted that application, it retained the window name.

So, to bring Brave Beta browser into focus, activate tab 2 (CTRL-2), and then do a fresh (CTRL-R), I can just set this command string to a hot key on the Stream Deck: ‘xdotool search –name ‘Brave-Beta’ windowactivate –sync key ctrl+2 ctrl+r’.

You can still do this sort of thing without having any Stream Deck by just setting the same string to any Linux shortcut on the keyboard.

Xdotool lets you simulate keyboard input and mouse activity, move and resize windows, etc. It does this using X11’s XTEST extension and other Xlib functions. With xdotool, you can search for windows and move, resize, hide, and modify window properties like the title. If your window manager supports it, you can use xdotool to switch desktops, move windows between desktops, and change the number of desktops.

See https://github.com/jordansissel/xdotool

you are viewing a single comment's thread
view the rest of the comments
[–] SafetyGoggles@feddit.de 3 points 1 year ago

But it does not work well at all, especially when you try to get the mouse cursor to a certain coordinate. The same coordinate gets different results every boot for some reason.

You also have to run a background service for it to work.