Added brightness script

This commit is contained in:
dbroqua 2020-06-06 12:39:11 +02:00
parent f245989088
commit 3b11e44798
3 changed files with 31 additions and 0 deletions

22
Bin/brightness.sh Executable file
View file

@ -0,0 +1,22 @@
#! /bin/bash
CURRENT=`xrandr --verbose | grep -m 1 -i brightness | cut -f2 -d ' '`
GAP=0.1
NEWVALUE=${CURRENT}
case $1 in
up)
NEWVALUE=`echo "${CURRENT}+${GAP}"|bc -l`
;;
down)
NEWVALUE=`echo "${CURRENT}-${GAP}"|bc -l`
;;
reset)
NEWVALUE=1
;;
read)
echo "${CURRENT}*100/1"|bc
;;
esac
xrandr --output eDP-1 --brightness ${NEWVALUE}

View file

@ -227,6 +227,9 @@ bindsym $mod+t exec "rofi -show top -modi top"
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` +5% bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` +5%
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` -5% bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume `pactl info|grep Sink|cut -d: -f 2` -5%
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute `pactl info|grep Sink|cut -d: -f 2` toggle bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute `pactl info|grep Sink|cut -d: -f 2` toggle
# Screen brighness
bindsym XF86MonBrightnessDown exec --no-startup-id ~/Bin/brightness.sh down
bindsym XF86MonBrightnessUp exec --no-startup-id ~/Bin/brightness.sh up
# Spotify # Spotify
bindsym XF86AudioPlay exec qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause bindsym XF86AudioPlay exec qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause

View file

@ -28,6 +28,7 @@ order += "wireless _first_"
order += "ethernet _first_" order += "ethernet _first_"
#order += "path_exists VPN" #order += "path_exists VPN"
order += "battery_level" order += "battery_level"
order += "external_script lcd_brightness"
#order += "sysdata base" #order += "sysdata base"
#order += "sysdata temp" #order += "sysdata temp"
#order += "nvidia_temp" #order += "nvidia_temp"
@ -47,6 +48,11 @@ static_string prev {
format = "" format = ""
on_click 1 = "exec --no-startup-id qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous" on_click 1 = "exec --no-startup-id qdbus org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"
} }
external_script lcd_brightness {
cache_timeout = 10
format = " {output}%"
script_path = '~/Bin/brightness.sh read'
}
external_script spotify { external_script spotify {
cache_timeout = 10 cache_timeout = 10
format = "{output}" format = "{output}"