[SOLVED] Bring existing KDE Konsole into focus instead of launching if one exists
I use KDE on arch and would like to achieve the following behavior:
Whatever way I launch Konsole, I want it to check whether there already is a Konsole instance. If one exists, it should be brought into focus, and if no instance exists, one should be launched.
I am unable to find such an option in the Konsole settings, even though I found a roughly 1 year old forum entry mentioning such a setting. Was it removed or am I just blind? Or do I need some optional dependency?
Alternatively, it would be fine if this could simply kick in when I use my Super+K shortcut, which I’ve set up. Maybe there’s a way to call Konsole from the terminal like that? I tried using konsole --force-reuse
but it didn’t seem to do the trick, and konsole --new-tab
does not bring Konsole into the foreground.
Edit: Here’s a script that does this, by @Audalin
<span style="color:#323232;">#!/bin/bash
</span><span style="color:#323232;">WIN="$(kdotool search --class org.kde.konsole | head -1)"
</span><span style="color:#323232;">if [[ "$WIN" != "" ]]; then
</span><span style="color:#323232;"> kdotool windowactivate "$WIN"
</span><span style="color:#323232;">else
</span><span style="color:#323232;"> konsole
</span><span style="color:#323232;">fi
</span>
kdotool
is available in AUR as https://aur.archlinux.org/packages/kdotool-git
Add comment