Skip to content

Instantly share code, notes, and snippets.

@WinkelCode
WinkelCode / install_portmaster_to_var.sh
Last active September 13, 2025 22:27
Work in progress
#!/usr/bin/env bash
# !!!!!!!!!!!!!!!!!!!!!!!!!!!
# This script is unmaintained
# !!!!!!!!!!!!!!!!!!!!!!!!!!!
# !!!!!!!!!!!!!!!!!!!!!!!!!!!
# This script is unmaintained
# !!!!!!!!!!!!!!!!!!!!!!!!!!!
@WinkelCode
WinkelCode / user-battery-notify.service
Created May 2, 2023 13:53
Put in `~/.config/systemd/user/user-battery-notify.service`, enable with `systemctl --user enable --now user-battery-notify.service`. Change variables as required for your system.
[Unit]
Description=Battery Level Notifier
[Service]
Environment=BATT_PATH=/sys/class/power_supply/BAT1/capacity
Environment=MIN_BATT_PCT=35
Environment=BATT_REFRESH_SECS=5
ExecStart=bash -c 'set -e; snooze=false; while true; do [ "$(cat "${BATT_PATH}")" -le "${MIN_BATT_PCT}" ] && [ "$snooze" != "true" ] && { notify-send --urgency=critical "Battery is at or below ${MIN_BATT_PCT}%"; snooze=true; }; [ "$(cat "${BATT_PATH}")" -gt "${MIN_BATT_PCT}" ] && [ "$snooze" == "true" ] && snooze=false; sleep "${BATT_REFRESH_SECS}"; done'
Restart=always