[nightlight] Add own queue
This commit is contained in:
parent
d6acc728e9
commit
61f8b8127c
1 changed files with 11 additions and 3 deletions
|
|
@ -1,6 +1,9 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
# Script to disable for an hour or immediately continue wlsunset. 'Toggle'
|
# Script to disable for an hour or immediately continue wlsunset. 'Toggle'
|
||||||
|
|
||||||
|
# Queue for at, check man page for options
|
||||||
|
ATQUEUE='T'
|
||||||
|
|
||||||
# Get current state
|
# Get current state
|
||||||
pid=$(pgrep wlsunset)
|
pid=$(pgrep wlsunset)
|
||||||
|
|
||||||
|
|
@ -29,8 +32,13 @@ done
|
||||||
|
|
||||||
# Toggle
|
# Toggle
|
||||||
if [[ -z ${pid} ]] ; then
|
if [[ -z ${pid} ]] ; then
|
||||||
|
# Clear queue
|
||||||
|
for job in $(at -l -q "${ATQUEUE}" | cut -f1); do
|
||||||
|
at -r "${job}"
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$( command -v wlsunset )" ]; then
|
if [ "$( command -v wlsunset )" ]; then
|
||||||
notify-send 'Starting nightlight' --app-name='twm'
|
notify-send 'Starting nightlight'
|
||||||
wlsunset -l 50.50 -L 4.00 -t 3000 -T 6500 &
|
wlsunset -l 50.50 -L 4.00 -t 3000 -T 6500 &
|
||||||
else
|
else
|
||||||
notify-send 'Nightlight is not available'
|
notify-send 'Nightlight is not available'
|
||||||
|
|
@ -39,6 +47,6 @@ if [[ -z ${pid} ]] ; then
|
||||||
else
|
else
|
||||||
# Currently stop wlsunset but restart in an hour.
|
# Currently stop wlsunset but restart in an hour.
|
||||||
kill ${pid}
|
kill ${pid}
|
||||||
notify-send 'Stopping sunset' 'Restarting in an hour'
|
notify-send 'Stopping nightlight' 'Restarting in an hour'
|
||||||
at now +1 hours -f "${0}"
|
at now +1 hours -f "${0}" -q "${ATQUEUE}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue