From a450bc58bbc0e17fb5bdef5fa4b2492f222d0928 Mon Sep 17 00:00:00 2001 From: Frederik Vanrenterghem Date: Fri, 3 May 2024 22:54:09 +0800 Subject: [PATCH 1/1] Define brightness and volume key bindings for i3. --- i3/.config/i3/config | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/i3/.config/i3/config b/i3/.config/i3/config index e2a1d76..0c260d3 100644 --- a/i3/.config/i3/config +++ b/i3/.config/i3/config @@ -40,11 +40,29 @@ exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork # and nm-applet is a desktop environment-independent system tray GUI for it. exec --no-startup-id nm-applet +## Control brightness +bindsym XF86MonBrightnessUp exec --no-startup-id brightnessctl set +5% +bindsym XF86MonBrightnessDown exec --no-startup-id brightnessctl set 5%- + # Use pactl to adjust volume in PulseAudio. +# Notification via dunst - TODO refactor as per https://github.com/dunst-project/dunst/blob/master/contrib/progress-notify.sh +exec --no-startup-id dunst + set $refresh_i3status killall -SIGUSR1 i3status -bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status -bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && $refresh_i3status -bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status +bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +10% && $refresh_i3status && dunstify -a "changeVolume" -u low -i audio-volume-medium \ + -h int:value:"$(pamixer --get-volume)" "Volume: $(pamixer --get-volume)%" \ + -h string:x-dunst-stack-tag:volume \ + -h string:hlcolor:#3397ff +bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -10% && \ +$refresh_i3status && \ +dunstify -a "changeVolume" -u low -i audio-volume-low \ + -h int:value:"$(pamixer --get-volume)" "Volume: $(pamixer --get-volume)%" \ + -h string:x-dunst-stack-tag:volume \ + -h string:hlcolor:#3397ff + +bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute @DEFAULT_SINK@ toggle && $refresh_i3status && dunstify -t 2000 -u low -i audio-volume-muted \ +-h string:x-dunst-stack-tag:volume "Muted" + bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status # Use Mouse+$mod to drag floating windows to their wanted position -- 2.39.5