You are not logged in.

#1 2023-05-02 03:41:05

infinitEplus
Member
Registered: 2023-05-02
Posts: 4

[SOLVED] Conditional Startup Apps in KDE Plasma?

I am using KDE Plasma in my system. I want to configure autostart in a conditional way.
Say: If the laptop is charging, start A,B,C apps; If it is not charging, do not startup any of these.

How can I achieve that? Of course I can remove those from startup and write my own script to run at login. But is there any better way to achieve so?

KDE Plasma Version: 5.27.4
Kernel Version: 6.2.13-arch1-1 (64-bit)

Last edited by infinitEplus (2023-05-03 05:23:19)

Offline

#2 2023-05-02 07:27:21

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,104

Re: [SOLVED] Conditional Startup Apps in KDE Plasma?

You can configure scripts to run on switching between plugged or unplugged in the powerdevil KCM:

kcmshell5 kcm_powerdevilprofilesconfig

but that would be tied to the profile switch, not the startup per se. It'd probably be easier to just write a script if this is strictly about startup/login

Last edited by V1del (2023-05-02 07:28:55)

Offline

#3 2023-05-02 07:34:26

infinitEplus
Member
Registered: 2023-05-02
Posts: 4

Re: [SOLVED] Conditional Startup Apps in KDE Plasma?

V1del wrote:

You can configure scripts to run on switching between plugged or unplugged in the powerdevil KCM:

kcmshell5 kcm_powerdevilprofilesconfig

but that would be tied to the profile switch, not the startup per se. It'd probably be easier to just write a script if this is strictly about startup/login

Okay. Also, can I achieve conditonal running for systemd services as well?
Again for example, I have syncthing.service enabled in user mode. I only want to run it when power source is AC and not battery.

Offline

#4 2023-05-02 09:02:45

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 25,104

Re: [SOLVED] Conditional Startup Apps in KDE Plasma?

For systemd services you can use Condition* definitions in the unit services, e.g.: https://www.freedesktop.org/software/sy … onACPower=

Offline

#5 2023-05-02 09:04:49

infinitEplus
Member
Registered: 2023-05-02
Posts: 4

Re: [SOLVED] Conditional Startup Apps in KDE Plasma?

Is it recommended to edit unit files managed by software itself?

Offline

#6 2023-05-02 10:37:02

seth
Member
From: Don't DM me only for attention
Registered: 2012-09-03
Posts: 74,307

Offline

#7 2023-05-03 05:22:55

infinitEplus
Member
Registered: 2023-05-02
Posts: 4

Re: [SOLVED] Conditional Startup Apps in KDE Plasma?

Thank you. Marking this a solved.

Offline

Board footer

Powered by FluxBB