Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Software] What are the commands to manage session as in logout and lock the screen?

New to Debian (Or Linux in general)? Ask your questions here!
Post Reply
Message
Author
chr0miam
Posts: 4
Joined: 2022-10-16 09:05
Has thanked: 4 times

[Software] What are the commands to manage session as in logout and lock the screen?

#1 Post by chr0miam »

I did a minimal install of Debian and I am using dwm. I am using rofi to create a power menu. But some of the commands do not work.

Code: Select all

actions[lockscreen]="loginctl lock-session ${XDG_SESSION_ID-}"
#actions[switchuser]="???"
actions[logout]="loginctl terminate-session ${XDG_SESSION_ID-}"
actions[suspend]="systemctl suspend"
actions[hibernate]="systemctl hibernate"
actions[reboot]="systemctl reboot"
actions[shutdown]="systemctl poweroff"
* Reboot commands works.
* Shutdown works.

* Logout does not work.
* Lock screen does not work.


What are the correct commands to logout and lock screen and switch user?

User avatar
FreewheelinFrank
Global Moderator
Global Moderator
Posts: 2063
Joined: 2010-06-07 16:59
Has thanked: 38 times
Been thanked: 221 times

Re: [Software] What are the commands to manage session as in logout and lock the screen?

#2 Post by FreewheelinFrank »

A bit of searching suggests the following are the correct commands:

Code: Select all

loginctl lock-session $XDG_SESSION_ID

Code: Select all

loginctl terminate-session $XDG_SESSION_ID
https://gitlab.com/kaythomas0/dotfiles/ ... power-menu

https://github.com/WayfireWM/wf-shell/issues/41

The lock command certainly works in a terminal. Let me post this and see if the logout command works...

...yes, it does.

chr0miam
Posts: 4
Joined: 2022-10-16 09:05
Has thanked: 4 times

Re: [Software] What are the commands to manage session as in logout and lock the screen?

#3 Post by chr0miam »

The logout command worked but not the lock screen one. Guess it depends on the login manager being used. And coming to that...

I didn't include a crucial bit of information. I am using lightdm.

Running this on the terminal would be very helpful:

Code: Select all

dm-tool --help
For "locking the screen":

Code: Select all

dm-tool lock
  • The screen will turn black
  • You have to press a key to get to login screen
For "switching the user":

Code: Select all

dm-tool switch-to-user
Hope this is helpful to anyone coming across this.

Post Reply