Allow per-user environment

This commit is contained in:
2020-10-05 21:55:12 +02:00
parent 1224356d2e
commit 84b58f9453
5 changed files with 35 additions and 6 deletions

View File

@@ -12,6 +12,8 @@ users:
mail: hannes.koerber@tradebyte.com
git_gpg_sign: false
gpg_agent: false
environment:
MACHINE_HAS_NEXTCLOUD: "false"
- name: hannes-private
group: tpp
vt: 2
@@ -20,6 +22,8 @@ users:
gpg_agent: true
gpg_keys:
master_key: "0xB5C002530C6A2053"
environment:
MACHINE_HAS_NEXTCLOUD: "true"
screen:
1: DP-1-1
@@ -45,6 +49,5 @@ workspace:
environment:
MACHINE_HAS_KEEPASSX: "true"
MACHINE_HAS_NEXTCLOUD: "false"
MACHINE_HAS_RESTIC_BACKUP: "true"
MACHINE_HAS_SPOTIFY: "true"

25
bin/dunstctl Executable file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
set -o nounset
_logfile="$LOGDIR/dunstctl.log"
log() {
printf '[%s] %s\n' "$(date -uIseconds)" "$*" >> "$_logfile"
}
case "$1" in
enable)
log "Enabling dunst"
systemctl --user --no-block kill --signal SIGUSR2 dunst_user
;;
disable)
log "Disabling dunst"
systemctl --user --no-block kill --signal SIGUSR1 dunst_user
;;
*)
>&2 printf 'Unknown command\n'
exit 1
esac

View File

@@ -47,11 +47,11 @@ reset_screen() {
lock_and_screen_off() {
lock &
_pid=$!
systemctl --user --no-block kill --signal SIGUSR1 dunst_user
dunstctl disable
screen_off
xset dpms 0 0 5
wait $_pid
systemctl --user --no-block kill --signal SIGUSR2 dunst_user
dunstctl enable
reset_screen
}

View File

@@ -9,14 +9,14 @@ is_on() {
switch_on() {
touch "${_status_file}"
systemctl --user --no-block kill --signal SIGUSR1 dunst_user
dunstctl disable &
systemctl --user --no-block stop redshift_user
systemctl --user --no-block stop spotify
}
switch_off() {
rm -f "${_status_file}"
systemctl --user --no-block kill --signal SIGUSR2 dunst_user
dunstctl enable &
"$_autostart" redshift_user spotify
}

View File

@@ -47,7 +47,8 @@ export ACPI_LID_NAME=LID
umask 0022
{% for k, v in machine.environment.items() %}
{% set env = machine.environment | combine(user.environment) %}
{% for k, v in env.items() %}
export {{ k }}="{{ v }}"
{% endfor %}