Set up keyboard shortcut to make window active if program is already running

Situation: There is a shortcuts sections in System Settings. One can assign a shortcut to a program here. For example I’ve set Meta+W for firefox (Web). This shortcut will always open a new firefox instance.

Goal: If the desired program is already running, then make it active, instead of opening a new instance.

Is something like that possible?

$ inxi -Sxxx                                                                                                                                                                                           ✔ 
  Host: adrian Kernel: 5.15.60-1-MANJARO arch: x86_64 bits: 64 compiler: gcc
    v: 12.1.1 Desktop: KDE Plasma v: 5.24.6 tk: Qt v: 5.15.5 info: latte-dock
    wm: kwin_x11 vt: 1 dm: SDDM Distro: Manjaro Linux base: Arch Linux

See an example here

1 Like