Announcement

Collapse
No announcement yet.

Shutdown command to mimick Leave menu command

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [DESKTOP] Shutdown command to mimick Leave menu command

    Kubuntu has this wonderful feature whereby it remembers all the open windows when you shutdown your PC and they are there on the desktop next time you boot up. This is achieved via clicking: K Launcher > Leave > Shutdown. If I use the basic terminal command 'Shutdown' the open windows are not remembered on the next boot. Does anyone know what command(s)/options Kubuntu uses to remember windows settings etc that could be used from the terminal?

    For info, this is for a shutdown script so no suggestions telling me to use the launcher with my mouse please.

    #2
    See if https://www.kubuntuforums.net/showth...m-the-keyboard helps.

    You may first need to set the option to remember session in Startup & Shutdown.

    That information is stored in ~/.config/ksmserverrc

    Code:
    [General]
    confirmLogout=true
    excludeApps=
    loginMode=restorePreviousLogout
    offerShutdown=true
    screenCount=1
    shutdownType=0
    Last edited by chimak111; Sep 15, 2018, 10:12 PM.
    Kubuntu 20.04

    Comment


      #3
      First you need to set up sessions; I'd have thought that system settings->startup and shutdown->desktop session would do that, but chimak111's advice might be necessary. I developed a strong dislike of sessions years ago because they would amplify problems, especially using gnome applications, so I don't know much about them.

      Then use the command qdbus org.kde.ksmserver /KSMServer logout confirm type mode
      confirm is 0 no, 1 yes; type is 0 logout, 1 reboot, 2 halt.
      mode is 0, 1, 2, or 3, after all, if none, force, or ask if active, "sessions". These are not KDE sessions, I imagine they are logins when you can switch users and be logged in more than once. I'm not sure KDE pays any attention to this. So to shutdown with confirmation would be
      Code:
      qdbus org.kde.ksmserver /KSMServer logout 1 2 3
      Rather than sessions, I prefer to suspend; my desktop comes back in as long as it takes the screen to warm up, two or three seconds.
      Code:
      qdbus org.kde.Solid.PowerManagement /org/freedesktop/PowerManagement Suspend
      I use this from a widget in my panel; in KDE 4 one could "add to panel" from the "Favourites", but I had to create a menu item for it, setting the icon, then I could right click in the menu to "add to panel". Dragging a .desktop file from dolphin to the panel works too.
      Regards, John Little

      Comment

      Working...
      X