You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
1.0 KiB
Bash

#!/bin/bash
# _ _ _ _
# __ _ ___ | |_| |__ | | ___| |_ _ _
# / _` |/ _ \| __| '_ \| |/ _ \ __| | | |
#| (_| | (_) | |_| |_) | | __/ |_| |_| |
# \__, |\___/ \__|_.__/|_|\___|\__|\__,_|
# |___/
# https://www.youtube.com/user/gotbletu
# https://twitter.com/gotbletu
# https://plus.google.com/+gotbletu
# https://github.com/gotbletu
# gotbletu@gmail.com
# DESC: Toggle redshift on and off
# DEMO: https://www.youtube.com/watch?v=c8v84LRTeUw
# Requirements: redshift, notify-send (libnotify)
# check if process is running ( 0 = off, 1 = on )
STATUS="$(ps -ef | grep -w '[r]edshift' | wc -l)"
# if off then turn on
if [[ "${STATUS}" == 0 ]]; then
notify-send -i /usr/share/icons/hicolor/scalable/apps/redshift-status-on.svg "RedShift" "On"
redshift >/dev/null 2>&1 & disown
# else if on then turn off
elif [[ "${STATUS}" == 1 ]]; then
notify-send -i /usr/share/icons/hicolor/scalable/apps/redshift-status-off.svg "RedShift" "Off"
redshift -x && killall redshift
fi