Dark theme scheduling

Hello, Was wondering if there is a way to schedule certain themes to switch at certain times (Like switching to dark theme at night and light theme during the day) system wide?

Hi @nri4738,

While I use KDE myself, I don’t use or have heard of anyone that uses this feature.

That said, I did a bit of searching and it’s apparently not a feature in KDE. However, according to this page it is doable.

1 Like

@Mirdarthos Thanks this application looks like what I need, but when I download it and execute it the AppImage gives an error when trying to integrate Failed to register AppImage in system via libappimage
Also when I try executing the binary code version instead, it open the program but when I go to options and press KDE it crashes.

When I want to switch, I generally just call down my hidden ā€˜extras’ (on demand Latte bar) which has PlasmaConfigSaver which does a bit more than just the theme… though I generally use it to switch between my creamy ā€˜card’ and my darkish theme (including icons/cursor and whatever else).

Something we love about AUR, however, is that whilst others are often stuck with limited options - we can pull in Yin-yang-git which looks to be very simple (I just searched yin-yang and it came up) and I’m sure I prefer (as the schedule wouldn’t fit my variable schedule) to pull it down from my top bar.

So take a look at ā€˜PlasmaConfigSaver’ set up your dark, type the name and save it - then set up your light, type in light and save that.

Works well.

1 Like

That is manual switching though right?

Actually I downloaded yin-yang-git from the AUR also and it opens but when I click settings it crashes.

Try the .AppImage as described in the link I gave. It can’t really do harm, can it?

It fails to install with the error Failed to register AppImage in system via libappimage

OK.

Then I’m afraid I’m not able to offer you any advice.

Hope you manage!

I am going to try to set up a script with kdewriteconfig5 to change it. Thanks for the help anyway!

Yes, that’s a good idea! See if you can set up a profile, as @Ben said, I think, and can trigger the switch by command prompt.

Because, if you can, you can always set up a cronjob to do it on schedule.

Yes, but I don’t know how to update the theme after doing:
kwriteconfig5 --file ~/.config/kdeglobals --group Icons --key Theme "breeze"
kwriteconfig5 --file ~/.config/kdeglobals --group KDE --key LookAndFeelPackage "org.kde.breeze.desktop"
Because it doesn’t auto update

Are you sure the config file is correct?
Because both commands point to the exact same config, /.config/kdeglobals?

Well I thought so, because my current theme is ā€œbreezeā€ and that’s what was in the ~/.config/kdeglobals file.

@Mirdarthos The problem is that I really don’t know all the settings I should change in there.

Okay so problem solved, I used lookandfeeltool -a org.kde.breeze.desktop command and I will set up a cron job to change to theme automatically.

Okay, so know cron won;t run the script output of systemctl status cronie is:
`ā— cronie.service - Periodic Command Scheduler
Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2021-01-27 16:29:42 CST; 23h ago
Main PID: 975 (crond)
Tasks: 1 (limit: 8755)
Memory: 709.3M
CGroup: /system.slice/cronie.service
└─975 /usr/bin/crond -n

Jan 28 15:34:01 noah-82dq crond[49911]: pam_unix(crond:session): session opened for user noah(uid=1000) by (uid=0)
Jan 28 15:34:01 noah-82dq CROND[49912]: (noah) CMD (/home/noah/themeChangerDarkTheme.sh )
Jan 28 15:34:01 noah-82dq lookandfeeltool[49913]: qt.qpa.xcb: could not connect to display
Jan 28 15:34:01 noah-82dq lookandfeeltool[49913]: qt.qpa.plugin: Could not load the Qt platform plugin ā€œxcbā€ in ā€œā€ even though it was found.
Jan 28 15:34:01 noah-82dq lookandfeeltool[49913]: This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.

                                     Available platform plugins are: wayland-org.kde.kwin.qpa, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-x>

Jan 28 15:34:01 noah-82dq CROND[49911]: (noah) CMDOUT (/home/noah/themeChangerDarkTheme.sh: line 1: 49913 Aborted (core dumped) lookandfeeltool -a org.kde.breezedark.desktop)
Jan 28 15:34:01 noah-82dq CROND[49911]: pam_unix(crond:session): session closed for user noah
Jan 28 15:36:01 noah-82dq crond[975]: (root) CAN’T OPEN (/etc/crontab): No such file or directory
Jan 28 15:37:01 noah-82dq crond[975]: (root) CAN’T OPEN (/etc/crontab): No such file or directory
Jan 28 15:37:01 noah-82dq crond[975]: (noah) RELOAD (/var/spool/cron/noah)
`

Okay so i finally fixed it I used this code in my script file and ran the cronjob at a specific time and this time it switched the theme properly.
export QT_DEBUG_PLUGINS=1 export LIBGL_ALWAYS_INDIRECT=; export DISPLAY=:0; lookandfeeltool -a org.kde.breezedark.desktop

1 Like

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