Skip to content

Instantly share code, notes, and snippets.

@cheack
Created November 7, 2025 09:30
Show Gist options
  • Select an option

  • Save cheack/36e25bb44c8528fcbe61174eba809595 to your computer and use it in GitHub Desktop.

Select an option

Save cheack/36e25bb44c8528fcbe61174eba809595 to your computer and use it in GitHub Desktop.
#!/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