Created
November 7, 2025 09:30
-
-
Save cheack/36e25bb44c8528fcbe61174eba809595 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env bash | |
| set -e | |
| sudo bash -c 'cat > /etc/systemd/system/sound-night.service' << 'EOF' | |
| [Unit] | |
| Description=Night mute | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/usr/bin/pactl set-sink-mute @DEFAULT_SINK@ 1 | |
| EOF | |
| sudo bash -c 'cat > /etc/systemd/system/sound-day.service' << 'EOF' | |
| [Unit] | |
| Description=Day unmute | |
| [Service] | |
| Type=oneshot | |
| ExecStart=/usr/bin/pactl set-sink-mute @DEFAULT_SINK@ 0 | |
| EOF | |
| sudo bash -c 'cat > /etc/systemd/system/sound-night.timer' << 'EOF' | |
| [Unit] | |
| Description=Mute at 23:00 | |
| [Timer] | |
| OnCalendar=*-*-* 23:00:00 | |
| [Install] | |
| WantedBy=timers.target | |
| EOF | |
| sudo bash -c 'cat > /etc/systemd/system/sound-day.timer' << 'EOF' | |
| [Unit] | |
| Description=Unmute at 06:00 | |
| [Timer] | |
| OnCalendar=*-*-* 06:00:00 | |
| [Install] | |
| WantedBy=timers.target | |
| EOF | |
| sudo systemctl daemon-reload | |
| sudo systemctl enable --now sound-night.timer | |
| sudo systemctl enable --now sound-day.timer | |
| echo "done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment