Add service for light theme

This commit is contained in:
2024-05-05 15:29:55 +02:00
parent 58c40f69d9
commit b0bc54840d
3 changed files with 62 additions and 0 deletions

38
bin/switch-color-mode Executable file
View File

@@ -0,0 +1,38 @@
#!/usr/bin/env bash
set -o nounset
set -x
apply() {
local mode="${1}"
case "${mode}" in
dark)
theme=monokai
;;
light)
theme=github_light
;;
esac
sed -i "s#themes/.*\.toml#themes/${theme}.toml#" "${XDG_CONFIG_HOME}/alacritty/config.toml"
sed -i "s#theme = .*\$#theme = \"${theme}\"#" "${XDG_CONFIG_HOME}/helix/config.toml"
pkill -SIGUSR1 helix
printf '%s' "${mode}" > "${XDG_RUNTIME_DIR}"/color_mode
}
case "${1:-}" in
dark)
apply dark
;;
light)
apply light
;;
*)
exit 1
;;
esac

View File

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

View File

@@ -343,6 +343,21 @@
loop_control: loop_control:
label: "{{ item.profile_path }}" label: "{{ item.profile_path }}"
- name: handle user units
tags:
- user:units
block:
- name: link user service files
file:
state: link
force: true
follow: false
path: "/home/{{ user.name }}/.config/systemd/user/{{ item | basename }}"
src: "{{ item }}"
owner: "{{ user.name }}"
group: "{{ user.name }}"
with_fileglob: /var/lib/dotfiles/services/*
- name: handle autostart units - name: handle autostart units
tags: tags:
- user:autostart - user:autostart