Use conflicting systemd units for color mode

This commit is contained in:
2024-05-06 10:19:17 +02:00
parent 6071fe4f8f
commit 07a8338e77
4 changed files with 12 additions and 3 deletions

View File

@@ -30,4 +30,4 @@ Wants=touchpad.service
Wants=xresources.service Wants=xresources.service
Wants=yubikey-touch-detector.service Wants=yubikey-touch-detector.service
Wants=kdeconnect.service Wants=kdeconnect.service
Wants=color-theme-dark.service

View File

@@ -75,7 +75,7 @@ command_state = "[[ $($HOME/.i3/scripts/presentation-mode status) == on ]] && ec
block = "toggle" block = "toggle"
format = "  $icon " format = "  $icon "
command_on = "systemctl --user start color-theme-light" command_on = "systemctl --user start color-theme-light"
command_off = "systemctl --user stop color-theme-light" command_off = "systemctl --user start color-theme-dark"
command_state = "[[ $(systemctl --user is-active color-theme-light) == active ]] && echo active" command_state = "[[ $(systemctl --user is-active color-theme-light) == active ]] && echo active"
[[block]] [[block]]

View File

@@ -0,0 +1,9 @@
[Unit]
After=windowmanager.target
Conflicts=color-theme-light.service
[Service]
Type=oneshot
ExecStart=/usr/bin/env switch-color-mode dark
RemainAfterExit=true
PassEnvironment=DISPLAY

View File

@@ -1,9 +1,9 @@
[Unit] [Unit]
After=windowmanager.target After=windowmanager.target
Conflicts=color-theme-dark.service
[Service] [Service]
Type=oneshot Type=oneshot
ExecStart=/usr/bin/env switch-color-mode light ExecStart=/usr/bin/env switch-color-mode light
ExecStop=/usr/bin/env switch-color-mode dark
RemainAfterExit=true RemainAfterExit=true
PassEnvironment=DISPLAY PassEnvironment=DISPLAY