-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·67 lines (54 loc) · 3.16 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·67 lines (54 loc) · 3.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
# Install screen-dimmer: calibrated multi-monitor brightness + Night Light rider.
# Symlinks scripts/units back to this repo (repo stays the source of truth).
set -euo pipefail
here="$(cd "$(dirname "$0")" && pwd)"
# --- dependencies ---
command -v ddcutil >/dev/null || { echo ">> installing ddcutil"; sudo dnf install -y ddcutil; }
command -v zenity >/dev/null || { echo ">> installing zenity"; sudo dnf install -y zenity; }
# --- i2c-dev kernel module (DDC/CI for external monitors), now + at boot ---
echo i2c-dev | sudo tee /etc/modules-load.d/i2c-dev.conf >/dev/null
sudo modprobe i2c-dev
# --- scripts ---
mkdir -p ~/.local/bin
for f in "$here"/bin/*; do ln -sf "$f" ~/.local/bin/; done
# --- systemd user units (copied, not symlinked: systemctl enable dislikes out-of-tree symlinks) ---
mkdir -p ~/.config/systemd/user
cp "$here"/systemd/* ~/.config/systemd/user/
# --- calibration config (never clobber an existing one) ---
[ -f ~/.config/screen-bright.conf ] || cp "$here/screen-bright.conf.example" ~/.config/screen-bright.conf
# --- DDC/CI access for the active user (ddcutil ships the uaccess udev rule) ---
sudo udevadm control --reload-rules && sudo udevadm trigger
# --- the bedtime/auto dim RIDES GNOME Night Light: enable it, sunset-driven ---
gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-automatic true
gsettings set org.gnome.system.location enabled true # sunset/sunrise needs a location fix
# --- app-grid launcher (clickable icon, searchable in Activities) ---
mkdir -p ~/.local/share/applications
sed "s|__BIN__|$HOME/.local/bin|" "$here/screen-dimmer.desktop" > ~/.local/share/applications/screen-dimmer.desktop
update-desktop-database ~/.local/share/applications 2>/dev/null || true
# --- Super+B hotkey for the slider (append, don't clobber existing custom shortcuts) ---
kp=/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/screendim/
key=org.gnome.settings-daemon.plugins.media-keys
cur=$(gsettings get $key custom-keybindings)
case "$cur" in
*screendim*) : ;; # already present
"@as []"|"[]") gsettings set $key custom-keybindings "['$kp']" ;;
*) gsettings set $key custom-keybindings "${cur%]}, '$kp']" ;;
esac
gsettings set $key.custom-keybinding:$kp name 'Screen dimmer'
gsettings set $key.custom-keybinding:$kp command "$HOME/.local/bin/screen-slider"
gsettings set $key.custom-keybinding:$kp binding '<Super>b'
# --- enable the Night Light rider ---
systemctl --user daemon-reload
systemctl --user enable --now screen-auto.timer
cat <<'EOF'
Installed.
- Calibrate per-screen bases: $EDITOR ~/.config/screen-bright.conf
- Master slider: screen-slider (bind to a hotkey if you like)
- Manual uniform set: screen-dim <0-100>
- Adapt to YOUR hardware: edit monitor models + laptop device in ~/.local/bin/screen-apply
(`ddcutil detect` / `ls /sys/class/backlight/`)
If external monitors report "Permission denied", log out and back in once
(the uaccess ACL is granted to the active login session).
EOF