Schedule a Logout Screen?

Specs: current Manjaro on a OneNetbook A1

While an admirable machine, the A1 has buggy battery behavior–its battery percentage has nothing to do with the actual remaining battery charge.

Since the battery is solid for 4 hours, I would like to schedule a popup of the logout screen at 4 hours of uptime. I’ve looked at sudo shutdown options, but they seem to entail an immediate shutdown after a given time.

I would like a less-aggressive procedure, just a logout prompt after 4 hours of continuous use. Is that possible?

Thank you for any help.

I think you should take a look at systemd timers, which allow you to schedule a task to run at a specific time after an specific event took place. e.g. 4h after startup (onStartupSec=4h)
systemd/Timers
so you can execute a scrpt which shows a notification maybe with kdialog or so…

Thank you for the quick response. I looked at that link, but that’s above my paygrade. I was hoping for a one-line command in terminal. I figured if a single-line shutdown parameter can produce a full shutdown, then perhaps another command could bring up a logout screen.

I would maybe use a systemd timer for this.

But you can also use the XFCE ‘Application Autostart’ GUI with some very basic arguments;

/usr/bin/sh -c 'sleep 3h59m; notify-send "This is your battery warning, Will Robinson."'

( Settings Manager > Session and Startup > Application Autostart )

PS. A note. Despite my allusion above … sleep is actually extremely efficient with any possible processes suspended until the end of sleep.

This is promising. I hadn’t realized a sleep command would prompt at least a suggestion of shutdown. That said, when I run your command in terminal, there’s no error, but after the said minute, no notify-send bubble appears. And notify-send is installed.

Any advice?

The only intention of the string is to wait for 3 hours and 59 minutes and then post that message.
It was also supposed to be placed in the autostart listings, not simply run.
(testing it out first is reasonable though)

You can augment it to do something else … like actually call the logout if you wish.
I think for xfce it is xfce4-session-logout, so no message and just calling the logout would be

/usr/bin/sh -c 'sleep 3h59m; xfce4-session-logout'

Hm. Can you check with just any notify-send?

notify-send "hullo"

I dont know why it would not work … I have seen it in action on XFCE and it works here on KDE.
Of course we could use something else as well, like zenity if you do prefer just a desktop message.

Okay, so I of course set your original timeout for 1 minute, to no avail.

But when I used your new command, after a minute, it brought the logout screen right up.

Many, many thanks, and I will close topic and mark your latest post as the solution.

Still wondering about the ghost of notify-send … but what you need works I guess. :sweat_smile:
Cheers.

This is the least of my troubles with the A1 dodgy battery calculations :slight_smile:

This topic was automatically closed 3 hours after the last reply. New replies are no longer allowed.