Logo

dev-resources.site

for different kinds of informations.

How to enable auto dark mode (night theme) in KDE Plasma

Published at
8/1/2022
Categories
crontab
plasma
kde
Author
vaiton
Categories
3 categories in total
crontab
open
plasma
open
kde
open
Author
6 person written this
vaiton
open
How to enable auto dark mode (night theme) in KDE Plasma

Disclaimer!

The method described in this post only works if your cron handles delayed jobs (for when your PC is sleeping/powered off and the job should run).

I got different results from different OS so YMMV!

Intro

Auto dark mode is new feature that has been gaining a lot of popularity in these years.

That's because, with its introduction in Android 10 people have begun to appreciate its benefits, including:

  • Can reduce power usage by a significant amount (depending on the device’s screen technology).
  • Improves visibility for users with low vision and those who are sensitive to bright light.
  • Makes it easier for anyone to use a device in a low-light environment.

For GNOME, this shell extension exists: Night Theme Switcher.

For KDE Plasma though, unfortunately, the only automatic way I could find to accomplish this is by using this project on github which is not supported on every distro (although recently added to the OBS).

Despite this, for users that do not want to install something from a PPA / User repository / Source code, another solution exists, and it leverages the plasma plasma-apply-colorscheme command.

How To

First, open up a terminal and write

plasma-apply-colorscheme --list-schemes
Enter fullscreen mode Exit fullscreen mode

to see which color scheme you have installed on your system.

(You can always install more using your distro package manager or the Plasma Settings.)

After locating the two color themes that we want to use for the day theme and the night theme, let's open up the user crontab manager with

crontab -e
Enter fullscreen mode Exit fullscreen mode

and let's create two cronjob by using this website, one that will run when we want to switch to the day theme and the other one when we want to switch to the night theme.

The input command will be

plasma-apply-colorscheme <colorscheme>
Enter fullscreen mode Exit fullscreen mode

For me they will be openSUSE from 07:00 till 20:00 and BreezeDark for the rest of the day, so the two cronjobs will be:

0 20 * * * plasma-apply-colorscheme BreezeDark >/dev/null 2>&1
0  7 * * * plasma-apply-colorscheme openSUSE   >/dev/null 2>&1
Enter fullscreen mode Exit fullscreen mode

And that's all! Let's close the crontab (Esc -> :wq -> Enter) and enjoy the automatic switch!

kde Article's
30 articles in total
Favicon
(Quick-note) Troubleshooting Dual Monitor Issues on KDE on Ubuntu/ Linux Mint
Favicon
bash: No such file or directory
Favicon
How To Unhide Titlebars on Maximised Windows in KDE Plasma 6
Favicon
DinaWall 0.2
Favicon
How to enable auto dark mode (night theme) in KDE Plasma
Favicon
Using KConfig with Rust
Favicon
Bitflags in Rust
Favicon
Season of KDE 2022
Favicon
Creating Rust/QML Project using Templates
Favicon
My sleek and modern Linux development machine in 2021
Favicon
Activate USB Wi-Fi Receiver from Terminal
Favicon
KDE Development with Podman
Favicon
My KDE Workfloaw
Favicon
How to recover KDE if it doesn't load after updating FreeBSD from 12.x to 13.0-RELEASE
Favicon
Fuck FreeBSD
Favicon
The state of Linux as a daily use OS in 2021
Favicon
SPOTIFY SYSTEM TRAY [KDE]
Favicon
Fedora - KDE development journey (Qt5X11Extras)
Favicon
Fedora - KDE development journey (Qt5UiPlugin)
Favicon
Fedora - KDE development journey (Qt5Qml / qmake)
Favicon
KDE vs GNOME
Favicon
Setting up Arch Linux with KDE Plasma in Windows Subsystem for Linux 2
Favicon
βš™ My Arch Linux setup
Favicon
Writing a KDE Plasmoid to display JioFi Stats
Favicon
KDE Plasma & ssh keys
Favicon
Trying out KDE
Favicon
My (k)Ubuntu (OSX look alike) desktop setup
Favicon
KDE Neon on 2017 MacBook Air
Favicon
Script your Yakuake with default tabs
Favicon
How to execute Firefox with support for KDE filepicker

Featured ones: