Automatic virtual desktop switch after an incative period

After finally became an openSUSE user and a happy one (why in earth didn’t I discover this distro before now??), I have one minor question… is there a way to configure KDE to automatic switch back to virtual desktop 1 after a certain inactive period? That would for me be a very nice feature on our common living room pc. I guess everything is possible with scripting and as a previous HP-UX user I was a bit familiar with that, but most is forgotten by now.

Well welcome!

I also do not know these kind of things from my head but a little bit searching gives that xprintidle will give you the number of milliseconds since last X interaction and you can install that using “sudo zypper install xprintidle”

For switching desktop, see:

Then a script is needed to check xprintidle and when the value is larger then a given limit trigger. One way of doing that is using a systemd timer that triggers every minute.

Hi, thanks for your reply. Based on your input I started thinking about the power management and discovered there are several options to automatic run a script after a certain time which I asume is based on inactive time.

So if anyone could tell me how to switch desktop from a script either by some command or by activating Ctrl+F1 I believe this would then be solved.

Thanks in advance.


I assume you man the virtual/logical displays (not desktops, it is not know if there is a desktop running on them), doing the same as using Ctrl-Alt-F1 …F7 (and more if applicable).

I do not know how to, but I guess this might be a function of the Display Manager. When that is correct, you should first find out which DM is used on the system and then get more documentation about it.

Hi, yes Virtual Desktop. The keyboard shortcut is Ctrl+F1 and Ctrl+F2 for VD 1 and 2.
So how can Ctrl+F1 be activated from a script ?

Did you open the link to I posted earlier?
If that does not work, please indicate what you tried and what errors you got.

Hm, I am using KDE and used different DMs. Switching is/was always done with Ctrl-Alt-F1,…, NOT with Crtl-F1.

Are you sure you use Ctrl-F1?

Hi, using tumbleweed and KDE, yes absolute sure. Ctrl+F1 / F2 switches between my two desktops.
Ctrl-Alt-F1 sent me to a black screen with a loginprompt in the upper left corner, and I of course I did not how get back to a graphical interface, so had to reboot.

marel: the link directs me to a KDE community, not a particuraly thread about this subject? I will try seraching there a bit more

update, I see the first link you sent directs me direct to this subject, I overlooked that and will try this.

Ah, sorry, big misunderstanding.

So please forget all I have said about this. Sorry about that.

BTW, using Ctrl-Alt-F7 would have brought you back to your KDE session. No need to reboot the system.

1 Like

Hi, I might be using the wrong term asm y installation is in Norwegian and I have manually translated this to virtual desktop, but I think workspace might be the correct term. Sorry if this have made any confusions.

Yes, the terminology is a bit confusing. Not your fault. I guess my misunderstanding is from the fact that I misunderstood your description on what you want complete. I thought you wanted to go the the logical screen/console 1, with the CLI login. I did not quite understand why, but hey, some people want things :wink:

And I can add that I also do not quite understand why you want to switch to your desktop 1. But again, hey, who am I to not let you have what you like?

I have glanced through that KDE forum thread. Seems to be something not really easy done. And even then I would not trust that it would work “forever”. Seems that coding there is a bit spaghetti. :frowning:

Hi, I found this command that actually does what I wants
wmctrl -d (lists my workspaces)

0 - DG: 3840x2160 VP: 0,0 WA: 60,0 3780x2160 Skrivebord 1
1 * DG: 3840x2160 VP: 0,0 WA: 60,0 3780x2160 Skrivebord 2

changes my current to no. 0
wmctrl -s 0

thanks for all replies.


1 Like

That is wonderful. Not something I would have expected to be so easy (if you know where to look).


1 Like