From 8a52644414ecc0bf9531c660d2ba5b122b9fe21e Mon Sep 17 00:00:00 2001 From: vorboyvo Date: Tue, 6 Feb 2024 16:39:03 -0500 Subject: [PATCH] Added mute key functionality Changed brightness keys to show notification (if dunstify present) Changed brightness scale to 10 steps --- programs/sway.nix | 2 ++ scripts/changebrightness.sh | 13 ++++++++++--- todo | 4 ++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/programs/sway.nix b/programs/sway.nix index a184dc5..12cc729 100644 --- a/programs/sway.nix +++ b/programs/sway.nix @@ -40,6 +40,8 @@ in { } // { # Function Media Keys XF86MonBrightnessUp = "exec bash ${changebrightness} 1"; XF86MonBrightnessDown = "exec bash ${changebrightness} -1"; + XF86AudioMute = "exec wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"; + "${mod}+XF86AudioMute" = "exec wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle"; XF86AudioRaiseVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+"; XF86AudioLowerVolume = "exec wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-"; "${mod}+XF86AudioRaiseVolume" = "exec wpctl set-volume @DEFAULT_AUDIO_SOURCE@ 0.05+"; diff --git a/scripts/changebrightness.sh b/scripts/changebrightness.sh index 3e747d5..631032b 100644 --- a/scripts/changebrightness.sh +++ b/scripts/changebrightness.sh @@ -1,16 +1,23 @@ +#!/bin/bash bright=`cat /sys/class/backlight/amdgpu_bl0/brightness` state=-1 -thresh=(1 2 3 4 5 6 8 10 13 16 21 27 34 44 57 73 94 120 155 199 255) +thresh=(0 1 3 5 9 15 27 48 84 147 255) for i in ${!thresh[@]}; do - if [ $bright -ge ${thresh[$i]} ] + if [[ $bright -ge ${thresh[$i]} ]] then state=$i fi done new=$(($1 + $state)) -if [ $new -ge 0 ] && [ $new -le 20 ] + +if [[ $new -ge 0 ]] && [[ $new -le 10 ]] then echo ${thresh[$new]} | tee /sys/class/backlight/amdgpu_bl0/brightness + if [[ $? -eq 0 ]] && [[ -f $(which dunstify) ]] + then + dunstify -a "changebrightness.sh" -u low -i weather-clear -h string:x-dunst-stack-tag:changebrightness "Brightness: $new" + fi fi + diff --git a/todo b/todo index 4a6c591..66dd3a3 100644 --- a/todo +++ b/todo @@ -5,5 +5,5 @@ i3status bar bluetooth setup media player daemon dmenu files -background (used feh on i3) - +notifications timeout and other assorted settings +add pandoc support for markdown rendering