Is it possible to autostart apps on login in KDE but only during certain times

Long story short, I’d like to add a few apps to my autostart list, but I only want them to autostart if I boot my system within certain times/days. There’s a few work apps that I have to manually open Mon-Fri before 6pm which I’d like to be able to put into my autostart apps, but I don’t want them to autostart outside of those times as I wouldn’t be working and would have to close them (so it ends up being the same amount of work).

I couldn’t find any solutions to this on Google, but I figured it’s worth asking just in case as it would be a huge time saver for me.

Thanks in advance!

(To clarify, I don’t want to autostart them at say exactly 9am, but if I boot my system any time between 9am and 6pm on Mon-Fri then I’d like them to autostart regardless of when I boot the system during that time period).

This is a hack solution, but something that could be easily done by writing a script that incorporates your logic, and then autostart it.
I would hope there’s a better way, but that’s an off-the-cuff answer.

1 Like

Honestly I didn’t even think of that - thank you! That’ll do what I’m after :slight_smile:
I’m still on the newer side to using Linux, so I haven’t used too many scripts (although I’ve written a few) so it doesn’t just come to mind as an answer for things like this.

Maybe you should take a dive into KAlarm.

It suspends my computer at 10pm, after setting volume. It wakes up at 5.59 and sets volume to 40% ready for my wakeup alarm…

Basically, if the machine’s awake, KAlarm will execute commands as requested… so all you need to do is to set up some bash scripts with references to the time.

#!/bin/bash

current_hour=$(date +%H)

current_minute=$(date +%M)

current_time=$((10#$current_hour * 100 + 10#$current_minute))

if [ $current_time -lt 1800 ]; then kwrite &

else conky &
fi

Let’s do ‘kwrite’ in office hours, and just a conky if not…

1 Like

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