Added notis

This commit is contained in:
Tibo De Peuter 2022-03-21 16:00:53 +01:00
parent e86dc82e6e
commit 8590bb0c29
2 changed files with 22 additions and 29 deletions

View file

@ -213,9 +213,12 @@ bindsym $winkey+Return exec i3-sensible-terminal
# Start rofi (a program launcher)
bindsym $alt+space exec --no-startup-id rofi -show
# Set notification script
set $notify sh ~/.config/i3/scripts/notify.sh
# Brightness
bindsym XF86MonBrightnessDown exec brightnessctl -e s 5%-
bindsym XF86MonBrightnessUp exec brightnessctl -e s +5%
bindsym XF86MonBrightnessDown exec brightnessctl -e s 5%- && $notify -b
bindsym XF86MonBrightnessUp exec brightnessctl -e s +5% && $notify -b
# Media control
bindsym F7 exec --no-startup-id playerctl play-pause
@ -223,17 +226,17 @@ bindsym Shift+F8 exec --no-startup-id playerctl previous
bindsym Shift+F9 exec --no-startup-id playerctl next
# Volume control
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% \
&& $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% \
&& $refresh_i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% \
&& $refresh_i3status && $notify -v
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% \
&& $refresh_i3status && $notify -v
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle \
&& $refresh_i3status
&& $refresh_i3status && $notify -v
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle \
&& $refresh_i3status
# Lockscreen
set $lock sh ~/.config/i3/scripts/lock.sh && sleep 1
set $lock sh ~/.config/i3/scripts/lock.sh && brightnessctl set 25% && sleep 1
bindsym $winkey+Delete exec --no-startup-id $lock
# exec --no-startup-id xss-lock --transfer-sleep-lock -- exec $i3lockwall --nofork

View file

@ -4,31 +4,21 @@
# Variables
duration=3
bright=''
vol=''
title=''
message=''
# Functions
function getVol () {
status=$(amixer get Master | grep "^ Front Left" | cut -d ' ' -f 8)
if [[ $status == "[on]" ]] ; then
vol=$(amixer get Master | grep -o "[0-9]*%" | head -n 1)
else
vol="0%"
fi
} ; export -f getVol
value=0
# Get options
while getopts ":bvm:" options; do
case "${options}" in
b)
bright=$(brightnessctl | grep -o "[0-9]*%")
title="Brightness: ${bright}"
value=$(brightnessctl | grep -o "[0-9]*%")
title="Brightness: ${value}"
;;
v)
getVol
title="Volume: ${vol:-'0%'}"
status=$(amixer get Master | grep "^ Front Left" | cut -d ' ' -f 8)
if [[ $status == "[on]" ]] ; then
value=$(amixer get Master | grep -o "[0-9]*%" | head -n 1)
fi
title="Volume: ${value:-'0%'}"
;;
m)
message=${OPTARG}
@ -42,8 +32,8 @@ done
shift $((OPTIND - 1))
notify-send "${title:-${message}}" "${message}" \
-h int:x:100 -h int:y:100 \
-h int:value:"$(grep -o "[0-9]*" <<< ${value})" \
-h string:x-canonical-private-synchronous:byMe # Replace if not yet gone
# sleep ${duration}; killall notify-osd
#-h geometry = "400x200-40-40" \
canberra-gtk-play -i audio-volume-change -d "changeVolume"