Skip to content

Instantly share code, notes, and snippets.

@AllanChain
Created December 28, 2022 00:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AllanChain/4958bbebaffe492f7eef28fa944c3c96 to your computer and use it in GitHub Desktop.
Save AllanChain/4958bbebaffe492f7eef28fa944c3c96 to your computer and use it in GitHub Desktop.
Start programs if laptop is charging
#!/bin/bash
bat_status=$(cat /sys/class/power_supply/BAT1/status)
if [[ $bat_status != "Discharging" ]]; then
# More programs before Wayland tray is reday
sleep 30 # wait for Wayland tray
/usr/bin/safeeyes &
# More...
fi
wait $(jobs -p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment