Set default volume and brightness at login
Add three `systemd` user units that reset volume, screen brightness, and keyboard backlight, so that every session starts from a known state. Values come from ~/.config/environment.d/50-defaults.conf, and can be overridden per machine via an untracked 90-local.conf
This commit is contained in:
parent
f305c573c7
commit
1c3bb35bde
9 changed files with 158 additions and 0 deletions
19
.config/environment.d/50-defaults.conf
Normal file
19
.config/environment.d/50-defaults.conf
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# Session defaults, read by `systemd --user` at login
|
||||
#
|
||||
# Applied by:
|
||||
# - set-brightness-default.service
|
||||
# - set-keyboard-brightness-default.service
|
||||
# - set-volume-default.service
|
||||
#
|
||||
# For machine-local overrides create an untracked
|
||||
# ~/.config/environment.d/90-local.conf instead
|
||||
# and repeat only the keys you want to change
|
||||
#
|
||||
# Apply with: `systemctl --user daemon-reload`,
|
||||
# then log out and back in
|
||||
#
|
||||
# Verify with: `systemctl --user show-environment`
|
||||
|
||||
DEFAULT_BRIGHTNESS=30
|
||||
DEFAULT_KEYBOARD_BRIGHTNESS=50
|
||||
DEFAULT_VOLUME=30
|
||||
6
.config/environment.d/README.md
Normal file
6
.config/environment.d/README.md
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
# Session Environment Defaults
|
||||
|
||||
This folder contains environment variables
|
||||
read by `systemd --user` at login.
|
||||
|
||||
Machine-local overrides go into an untracked `90-local.conf`.
|
||||
13
.config/systemd/user/set-brightness-default.service
Normal file
13
.config/systemd/user/set-brightness-default.service
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=Set default screen brightness
|
||||
After=graphical-session.target
|
||||
ConditionPathExistsGlob=/sys/class/backlight/*
|
||||
PartOf=graphical-session.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=%h/.local/bin/set-brightness-default
|
||||
TimeoutStartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
12
.config/systemd/user/set-keyboard-brightness-default.service
Normal file
12
.config/systemd/user/set-keyboard-brightness-default.service
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[Unit]
|
||||
Description=Set default keyboard backlight brightness
|
||||
After=graphical-session.target
|
||||
PartOf=graphical-session.target
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=%h/.local/bin/set-keyboard-brightness-default
|
||||
TimeoutStartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
13
.config/systemd/user/set-volume-default.service
Normal file
13
.config/systemd/user/set-volume-default.service
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=Set default output volume
|
||||
After=wireplumber.service
|
||||
PartOf=graphical-session.target
|
||||
Wants=wireplumber.service
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=%h/.local/bin/set-volume-default
|
||||
TimeoutStartSec=30
|
||||
|
||||
[Install]
|
||||
WantedBy=graphical-session.target
|
||||
Loading…
Reference in a new issue