Add service for light theme
This commit is contained in:
38
bin/switch-color-mode
Executable file
38
bin/switch-color-mode
Executable 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
|
||||
9
services/color-theme-light.service
Normal file
9
services/color-theme-light.service
Normal 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
|
||||
15
user.yml
15
user.yml
@@ -343,6 +343,21 @@
|
||||
loop_control:
|
||||
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
|
||||
tags:
|
||||
- user:autostart
|
||||
|
||||
Reference in New Issue
Block a user