2

How can I set default virtual desktop in KDE?

I have nine virtual desktops (3 rows and 3 columns), and KDE always starts with top-left virtual desktop, and I want to start with center one.

(I have Arch Linux with KDE Plasma 5.12 installed.)

2

It looks like this isn't natively supported through configuration in KDE/Plasma, however, a forum post here suggests a way to accomplish what you're looking for by using the wmctrl tool in an autostart script to programatically set the desired virtual desktop.

  1. sudo apt-get install wmctrl
  2. Run wmctrl -d to list the available vistual desktops. In a 3x3 grid, the centre desktop is probably number 4
  3. Create an autostart file in ~/.config/autostart/setvd1.desktop with this content:

    [Desktop Entry]
    Exec=sleep 5; wmctrl -s 4
    X-DBUS-StartupType=wait
    Name=Set VD #1
    Type=Service
    X-KDE-StartupNotify=false
    OnlyShowIn=KDE;
    X-KDE-autostart-phase=1
    
  • Thank you, it worked. Only one thing is that I replaced path ~/.kde/share/autostart/ with ~/.config/autostart/, probably you should replace this path in your answer too. And maybe you will add some info about sleep 5 command: does it mean that startup will always take 5 seconds longer than before? – diralik Jan 28 at 14:44
  • 1
    Indeed, ~/.config/autostart/ is the freedesktop.org standard for autostart files. I've updated my answer accordingly. My guess it that the sleep 5 is there to ensure that the subsystem that wmctrl talks to is initialized before trying to set the virtual desktop. It shouldn't, to my knowledge, delay startup. It will only delay switching virtual desktop, which may not be noticeable at all – noelob Jan 29 at 23:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.