Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Automatic Logout
#1
I hope this is the correct place to post this article, if not please inform me.

I know I can use screensaver to lock the screen and have to enter my password when re-entering the OS. My question, is there a way I can have the computer actually log out after a certain amount of time of no activity? I can log out in the mint menu or by hitting some keyboard keys I have set up. I want to be able to "log out" and return to the regular "log in" screen when I go and work on the computer.

Hope this is a clear enough explanation of my question [Image: icon_confused.gif]

Thank you:
Reply
#2
NO - not 'log-out' as such

you can only use suspend / hibernate - - on an Power Saver session.
using an Levono Laptop with LM19 Tongue
Reply
#3
I don't think it is impossible, but I would assume it's not a usual thing, so probably there isn't a GUI tool for that.
Just a quick google-ing brought this to my attention, but I haven't tested this method:
https://www.ostechnix.com/auto-logout-in...ime-linux/
My top 10 reasons to still use Arch after 2 months on my main PC at home.
Reply
#4
(11-15-2019, 04:32 AM)TarsolyGer Wrote: I don't think it is impossible, but I would assume it's not a usual thing, so probably there isn't a GUI tool for that.

Agreed. Basically all you need is a program that monitors your inputs and when you have been inactive for some time, execute the logout command. A lot of programs monitor your activity/inactivity (notification daemons, as an example), so it might be possible to find one that can be configured to execute a command.
My git repos

"Things are only impossible until they’re not." - Captain Jean-Luc Picard
Reply
#5
If I understand you correctly you would like to force a session logout after an inactivity period of time.  You can monitor the inactivity using the xssstate program.   The following bash script might help you:


Code:
#!/bin/bash
#
# xim - Xsession inactivity monitor.
#
# You must supply the appropriate value for the Timeout variable.  Remember,
# the Timeout value is in milliseconds (ms).  One second is 1000 ms, and  one
# minute is 60000ms.  If you want to detect an Xsession inactivity for fifteen
# minutes or more the Timeout value should be 15X60X1000ms or 900000ms.
#

Timeout=900000        # value in milliseconds.

#
# You can update the Idle_Action function to perform your desired command.
#
function Idle_Action()
{
    # for LM19.1 xfce use the xfce4-session-logout.
    # For testing a simple echo command.
    # Put <your command> below.
    echo -e "\n\nNotice: idle X session detected. (${Session_idle})\n\n"
}


#main

Polling_interval=15    # value in seconds.

while (true)
do

    Session_idle="$(xssstate -i)"

    if [[ "${Session_idle}" -gt "${Timeout}" ]] ; then

        Idle_Action
        break
    else
        sleep "${Polling_interval}"

    fi

done    

exit 0



For testing use a smaller Timeout value and manually run the script.

Once you have the desired logout command and Timeout value updated you can add the xim script to your autostart program list.  Use settings and session section section to add an autostart program.
Idea Give a person a fish, and you feed them for a day. Teach a person how to fish, and you feed them for a lifetime. ✝️ Proverbs 4:7 Wisdom is the principal thing; therefore get wisdom: and with all thy getting get understanding.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)