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) # Start rofi (a program launcher)
bindsym $alt+space exec --no-startup-id rofi -show bindsym $alt+space exec --no-startup-id rofi -show
# Set notification script
set $notify sh ~/.config/i3/scripts/notify.sh
# Brightness # Brightness
bindsym XF86MonBrightnessDown exec brightnessctl -e s 5%- bindsym XF86MonBrightnessDown exec brightnessctl -e s 5%- && $notify -b
bindsym XF86MonBrightnessUp exec brightnessctl -e s +5% bindsym XF86MonBrightnessUp exec brightnessctl -e s +5% && $notify -b
# Media control # Media control
bindsym F7 exec --no-startup-id playerctl play-pause 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 bindsym Shift+F9 exec --no-startup-id playerctl next
# Volume control # Volume control
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +5% \ bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% \
&& $refresh_i3status && $refresh_i3status && $notify -v
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -5% \ bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% \
&& $refresh_i3status && $refresh_i3status && $notify -v
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle \ 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 \ bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle \
&& $refresh_i3status && $refresh_i3status
# Lockscreen # 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 bindsym $winkey+Delete exec --no-startup-id $lock
# exec --no-startup-id xss-lock --transfer-sleep-lock -- exec $i3lockwall --nofork # exec --no-startup-id xss-lock --transfer-sleep-lock -- exec $i3lockwall --nofork

View file

@ -4,31 +4,21 @@
# Variables # Variables
duration=3 duration=3
bright='' value=0
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
# Get options # Get options
while getopts ":bvm:" options; do while getopts ":bvm:" options; do
case "${options}" in case "${options}" in
b) b)
bright=$(brightnessctl | grep -o "[0-9]*%") value=$(brightnessctl | grep -o "[0-9]*%")
title="Brightness: ${bright}" title="Brightness: ${value}"
;; ;;
v) v)
getVol status=$(amixer get Master | grep "^ Front Left" | cut -d ' ' -f 8)
title="Volume: ${vol:-'0%'}" if [[ $status == "[on]" ]] ; then
value=$(amixer get Master | grep -o "[0-9]*%" | head -n 1)
fi
title="Volume: ${value:-'0%'}"
;; ;;
m) m)
message=${OPTARG} message=${OPTARG}
@ -42,8 +32,8 @@ done
shift $((OPTIND - 1)) shift $((OPTIND - 1))
notify-send "${title:-${message}}" "${message}" \ 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 -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"