You are only browsing one thread in the discussion! All comments are available on the post page.

Return

tubbadu , (edited )

There is a way! I wrote this tool exactly for this purpose, and works on both x11/wayland: codeberg.org/tubbadu/ktoggle

it writes a kwin script on a temporary file, installs it, runs it and uninstalls it. All using DBUS communication.
it works quite well (there is just rarely an unexpected behavior I didn’t find the time to fix yet), I use it daily for lots of apps like telegram, whatsapp, qalculate and a note taking app

once compiled and installed you can just assign to a hotkey the command


<span style="color:#323232;">ktoggle --class org.telegram.desktop --name telegram-desktop --program telegram-desktop
</span>

and you’re done! read the readme to see an explanation of all available flags

(note: this is a work in progress, I have little time to maintain it, so don’t expect it to be perfect!)

hope this helps!

Andy OP ,
@Andy@programming.dev avatar

Oooh wee, great, thanks!

Andy OP ,
@Andy@programming.dev avatar

What’s the idea behind installing, uninstalling, reinstalling, uninstalling… all the time?

tubbadu ,

It was the best way I found to do it, because I couldn’t find a proper way to run a kwin script with an argument (the program name and class), so I decided to just modify the script and then install and run it, and uninstall at the end. “Install” only takes a blink, although it may be made faster, for example implementing a sort of “caching” of the last used script in order to avoid removing and reinstalling the same script, perhaps one day I’ll try to implement it. My first attempt at it was done using KWindowSystem api, but something didn’t work so I had to give up and just install the scripts. perhaps I can try again with PlasmaWindowManagement, I may be luckier

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • All magazines