Added notifications

This commit is contained in:
Tibo De Peuter 2022-04-28 13:43:42 +02:00
parent c4ab743d5d
commit a7e75fb24d
2 changed files with 59 additions and 29 deletions

View file

@ -14,7 +14,6 @@ input * {
input 2:7:SynPS/2_Synaptics_TouchPad { input 2:7:SynPS/2_Synaptics_TouchPad {
natural_scroll enabled natural_scroll enabled
scroll_factor 0.6 scroll_factor 0.6
middle_emulation enabled middle_emulation enabled
tap enabled tap enabled
} }
@ -22,7 +21,7 @@ input 2:7:SynPS/2_Synaptics_TouchPad {
# Set background to whatever file is named bg at the moment # Set background to whatever file is named bg at the moment
output * bg "~/Images/wallpapers/bg.*" fill output * bg "~/Images/wallpapers/bg.*" fill
exec ~/.scripts/idle.sh exec_always ~/.scripts/idle.sh
# Set warm colours at night # Set warm colours at night
exec ~/.scripts/wlsunset.sh exec ~/.scripts/wlsunset.sh
@ -40,6 +39,7 @@ set $alt Mod1
set $winkey Mod4 set $winkey Mod4
set $term alacritty set $term alacritty
set $menu swaymsg exec "fuzzel -T 'alacritty -e' -w 50 -l 10 -f monospace:size=9 -b 262626dd -t ffffffff -i Win11-black" set $menu swaymsg exec "fuzzel -T 'alacritty -e' -w 50 -l 10 -f monospace:size=9 -b 262626dd -t ffffffff -i Win11-black"
set $notify exec "/home/tdpeuter/.scripts/notify.sh"
# ================ # ================
# Window shortcuts # Window shortcuts
@ -159,8 +159,6 @@ bindsym $winkey+ccedilla workspace number $ws9
bindsym $winkey+agrave workspace number $ws10 bindsym $winkey+agrave workspace number $ws10
bindsym $winkey+parenright workspace $ws11 bindsym $winkey+parenright workspace $ws11
assign [class='spotify'] workspace "¯\_(ツ)_/¯"
bindsym $winkey+Control+Right workspace next bindsym $winkey+Control+Right workspace next
bindsym $winkey+Control+Left workspace prev bindsym $winkey+Control+Left workspace prev
@ -223,22 +221,18 @@ bindsym Shift+XF86AudioLowerVolume exec --no-startup-id playerctl previous
bindsym Shift+XF86AudioRaiseVolume exec --no-startup-id playerctl next bindsym Shift+XF86AudioRaiseVolume exec --no-startup-id playerctl next
# Volume control # Volume control
bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% \ bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +2% && $notify -v
&& $refresh_i3status && $notify -v bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% && $notify -v
bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -2% \ bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $notify -v
&& $refresh_i3status && $notify -v bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle \
&& $refresh_i3status && $notify -v
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle \
&& $refresh_i3status
# Lockscreen # Lockscreen
bindsym $winkey+Delete exec --no-startup-id swaylock -f --screenshots --clock --indicator --fade-in 0.2 --effect-blur 5x5 set $lock "swaylock -f --screenshots --clock --indicator --fade-in 0.2 --effect-blur 5x5"
bindsym $winkey+Delete exec --no-startup-id $lock
set $mode_system System (l) lock, (e) logout, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown set $mode_system System (l) lock, (s) suspend, (h) hibernate, (r) reboot, (Shift+s) shutdown
mode "$mode_system" { mode "$mode_system" {
bindsym l exec --no-startup-id $lock; mode "default" bindsym l exec --no-startup-id $lock; mode "default"
bindsym e exec --no-startup-id i3-msg exit; mode "default"
bindsym s exec --no-startup-id systemctl suspend; mode "default" bindsym s exec --no-startup-id systemctl suspend; mode "default"
bindsym h exec --no-startup-id systemctl hibernate; mode "default" bindsym h exec --no-startup-id systemctl hibernate; mode "default"
bindsym r exec --no-startup-id systemctl reboot; mode "default" bindsym r exec --no-startup-id systemctl reboot; mode "default"
@ -247,7 +241,6 @@ mode "$mode_system" {
bindsym Return mode "default" bindsym Return mode "default"
bindsym Escape mode "default" bindsym Escape mode "default"
} }
bindsym Control+$alt+Delete mode "$mode_system" bindsym Control+$alt+Delete mode "$mode_system"
# ======= # =======

37
scripts/notify.sh Executable file
View file

@ -0,0 +1,37 @@
#!/usr/bin/env bash
# Show system status in notification, or your own message
# Syntaxis: notify [-vb] <message>
# Variables
value=0
# Get options
while getopts ":bvm:" options; do
case "${options}" in
b)
value=$(brightnessctl | grep -o "[0-9]*%")
title="Brightness: ${value}"
;;
v)
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}
;;
*)
title="Unknown option"
;;
esac
done
shift $((OPTIND - 1))
notify-send "${title:-${message}}" "${message}" \
-h int:value:"$(grep -o "[0-9]*" <<< "${value}")" \
-h string:x-canonical-private-synchronous:byMe # Replace if not yet gone
#-h geometry = "400x200-40-40" \