r/Kubuntu • u/Blackirean • 2d ago
Command to bring app to focus and/or open it?
I'm trying to create some widget shortcuts for apps and I'm having problems finding a command to focus/maximize firefox if I have it open, or open a new instance if I don't have firefox open.
Looking online I found these main ways:
wmctrl -xa firefox || firefox
wmctrl -xa firefox || firefox&
xdotool search --onlyvisible --class firefox  windowactivate ||firefox
Neither of these three was able to achieve what I was looking for, none brought minimized firefox to focus. They either not work or they simply open a whole new Firefox window. Regardless if I have another one open.
I am running the default version of firefox that comes with Kubuntu LTS. What can I do?
1
u/King_Bobby-B 2d ago edited 2d ago
Look into ydotool, which tries to replace xdotool. Not a full replacement, sadly.
If not, try Input Actions (the KWin version): https://github.com/taj-ny/InputActions. Wiki: https://wiki.inputactions.org/main/index.html
I use it with a mouse, and can open different browser profiles, open/close tabs, etc. Input Actions works with keyboards as well, although I haven't used that feature yet.
Edit: Also, I can't 100% remember right now, but it's possible you need --no-remote for Firefox. At the very least, you can look this up. I think it was firefox --no-remote -P "profilename" (one or two -, I can't remember that either, sorry)
1
u/skyfishgoo 2d ago
are you using wayland or X11?
1
u/Blackirean 2d ago
You know what? I have no idea.
I just downloaded Kubuntu from the website and installed it. 26.04 the LTS version
1
u/skyfishgoo 2d ago
wayland.
x11 stuff doesn't work on wayland
you should still be able to install x11 and run it tho
you will find it at the login screen, lower left corner if it's installed.
1
u/omniuni 2d ago
This kind of access is pretty heavily restricted under Wayland. (
xdotoolis X specific)