This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Switch to desktop N and toggle back

Tags: None
(comma "," separated)
nabajour
Registered Member
Posts
1
Karma
0

Switch to desktop N and toggle back

Wed Aug 17, 2022 2:16 pm
Hi all,

I've switched to using KDE and Kwin with tiling extension from XMonad, and I'm trying to setup my system to work similarly to XMonad.

One thing I was using in XMonad is to toggle between desktop number N and back to previous desktop with "Mod+N" (e.g. Mod+1 -> switches to desktop 1).

The switching works with the standard "Switch to Desktop N" shortcuts. Now, I'm trying to alter it so that it behaves like a toggle (ToggleOrView in XMonad), to go back to the previous desktop when pressing the keyboard shortcut again. e.g.:

- start on desktop 2
- press "Mod+6" -> it switches to desktop 6
- press "Mod+6" again -> switch back to desktop 2.

I haven't seen an option to configure this, so my guess is I need a little kwin script to help here.

I found an example in this script that does part of the work, but it works on it's own registered shortcut.

What I imagine I should do is for my kwin script to listen on the already registered "Switch To Desktop N" shortcut, store the desktop I'm on, the one I'm switching to (and store the previous one) and implement the logic of toggling according to those values. But looking at the KWin API, I don't see how I can connect to the "Switch To Desktop" N" signal.

Is what I want to do achievable? I don't know much about kwin scripting, so any pointers to start hacking around and learning would be welcome.

Thanks,

nab


Bookmarks



Who is online

Registered users: bartoloni, Bing [Bot], Google [Bot], Yahoo [Bot]