Add Redshift and suspend option

This commit is contained in:
2018-03-17 17:10:07 +00:00
parent 624f93cad0
commit 635a4ee653
3 changed files with 36 additions and 7 deletions

View File

@@ -25,9 +25,9 @@ background = ${colors.background}
foreground = ${colors.foreground} foreground = ${colors.foreground}
module-margin = 2 module-margin = 2
font-0 = NotoSans\-Regular:pixelsize=10;2 font-0 = NotoSans\-Regular:pixelsize=10;2
font-1 = FontAwesome:pixelsize=10;2 font-1 = Icons:pixelsize=10;2
modules-left = topmenu pavolume modules-left = topmenu redshift pavolume
modules-center = xwindow modules-center = xwindow
modules-right = vpn ping date modules-right = vpn ping date
@@ -248,10 +248,12 @@ menu-1-3-exec = ~/.dotfiles/bin/vpn nl &
menu-2-0 = lock menu-2-0 = lock
menu-2-0-exec = ~/.dotfiles/bin/i3exit lock & menu-2-0-exec = ~/.dotfiles/bin/i3exit lock &
menu-2-1 = reboot menu-2-1 = suspend
menu-2-1-exec = ~/.dotfiles/bin/i3exit reboot & menu-2-1-exec = ~/.dotfiles/bin/i3exit suspend &
menu-2-2 = shutdown menu-2-2 = reboot
menu-2-2-exec = ~/.dotfiles/bin/i3exit shutdown & menu-2-2-exec = ~/.dotfiles/bin/i3exit reboot &
menu-2-3 = shutdown
menu-2-3-exec = ~/.dotfiles/bin/i3exit shutdown &
[module/filesystem] [module/filesystem]
type = internal/fs type = internal/fs
@@ -341,3 +343,8 @@ format = <label>
label = "🌑%output%%" label = "🌑%output%%"
exec = ~/.dotfiles/bin/brightness listen exec = ~/.dotfiles/bin/brightness listen
[module/redshift]
type = custom/script
interval = 5
exec = ~/.dotfiles/polybar/scripts/redshift.sh

22
polybar/scripts/redshift.sh Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Specifying the icon(s) in the script
# This allows us to change its appearance conditionally
icon=""
pgrep -x redshift &> /dev/null
if [[ $? -eq 0 ]]; then
temp=$(redshift -p 2>/dev/null | grep temp | cut -d' ' -f3)
temp=${temp//K/}
fi
# OPTIONAL: Append ' ${temp}K' after $icon
if [[ -z $temp ]]; then
echo "%{F#65737E}$icon" # Greyed out (not running)
elif [[ $temp -ge 5000 ]]; then
echo "%{F#8FA1B3}$icon ${temp}K" # Blue
elif [[ $temp -ge 4000 ]]; then
echo "%{F#EBCB8B}$icon ${temp}K" # Yellow
else
echo "%{F#D08770}$icon ${temp}K" # Orange
fi

View File

@@ -1,5 +1,5 @@
[options] [options]
font = Inconsolata-g 10 font = InconsolataLGC Nerd Font 10
[colors] [colors]