From 71c9b5470b01c8e0164d3de0adb6b91ad866dcd5 Mon Sep 17 00:00:00 2001 From: Guusvanmeerveld Date: Fri, 23 Sep 2022 17:37:53 +0200 Subject: [PATCH] Dunst add volume and brightness notifications --- config/chromium/extensions.list.txt | 11 ++++------- config/dunstrc | 13 ++++++++----- config/polybar/{config => config.ini} | 0 config/sxhkdrc | 10 +++++----- install-root.conf.yaml | 3 +++ scripts/chlight | 11 +++++++++++ scripts/chvolume | 23 +++++++++++++++++++++++ 7 files changed, 54 insertions(+), 17 deletions(-) rename config/polybar/{config => config.ini} (100%) create mode 100755 scripts/chlight create mode 100755 scripts/chvolume diff --git a/config/chromium/extensions.list.txt b/config/chromium/extensions.list.txt index 52de856..c230ff5 100644 --- a/config/chromium/extensions.list.txt +++ b/config/chromium/extensions.list.txt @@ -1,13 +1,10 @@ Privacy Pass|ajhmfdgkijocedmfjonnpjfojldioehi -DuckDuckGo Privacy Essentials|bkdgflcldnnnapblkhphbgpggdiikppg Magister Auto-Login|cekhhgcjpkahghpgeafhmkkjhidodplk uBlock Origin|cjpalhdlnbpafiamejdnhcphjbkeiagm Dark Reader|eimadpbcbfnmbkopoojfekhnkhdbieeh -I don't care about cookies|fihnjjcciajhdojfnbdddfaoknhalnja -NordVPN — #1 VPN Chrome Extension: Get a VPN|fjoaledfpmneenckfbpdfhkmimnjocfa +React Developer Tools|fmkadmapgofadopljbjfkapdkoienihi JSON Viewer|gbmdgpbipfallnflgajpaliibnhdgobh -Return YouTube Dislike|gebbhagfogifgggkldgodflihgfeippi -GNOME Shell integration|gphhapmejobijbbhgpjhcjognlahblep -SponsorBlock for YouTube - Skip Sponsorships|mnjggcdmjocbbbhaepdhchncahnbgone +User JavaScript and CSS|nbhcbdghjpllgmfilhnhkllmkecfmpld Bitwarden - Free Password Manager|nngceckbapebfimnlniiiahkandclblb -Chromium Web Store|ocaahdebbfolfmndjeplogmgcagdmblk|https://raw.githubusercontent.com/NeverDecaf/chromium-web-store/master/updates.xml \ No newline at end of file +Chromium Web Store|ocaahdebbfolfmndjeplogmgcagdmblk|https://raw.githubusercontent.com/NeverDecaf/chromium-web-store/master/updates.xml +PDF Viewer|oemmndcbldboiebfnladdacbdfmadadm \ No newline at end of file diff --git a/config/dunstrc b/config/dunstrc index 65ed9b6..72754d4 100644 --- a/config/dunstrc +++ b/config/dunstrc @@ -4,7 +4,7 @@ ### Display ### # Which monitor should the notifications be displayed on. - monitor = 0 + monitor = 1 # Display notification on focused monitor. Possible modes are: # mouse: follow mouse pointer @@ -17,7 +17,7 @@ # # If this option is set to mouse or keyboard, the monitor option # will be ignored. - follow = mouse + # follow = mouse ### Geometry ### @@ -89,7 +89,7 @@ frame_width = 1 # Defines color of the frame around the notification window. - frame_color = "#474747" + frame_color = "#282828" # Define a color for the separator. # possible values are: @@ -196,7 +196,7 @@ max_icon_size = 48 # Paths to default icons. - icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/ + icon_path = /usr/share/icons/Adwaita/16x16/status/:/usr/share/icons/Adwaita/16x16/devices/ ### History ### @@ -299,7 +299,7 @@ #default_icon = /path/to/icon [urgency_normal] - background = "#285577" + background = "#222222" foreground = "#ffffff" timeout = 10 # Icon for notifications with normal urgency, uncomment to enable @@ -313,6 +313,9 @@ # Icon for notifications with critical urgency, uncomment to enable #default_icon = /path/to/icon +[chvolume] + ignore_history = yes + # Every section that isn't one of the above is interpreted as a rules to # override settings for certain messages. # diff --git a/config/polybar/config b/config/polybar/config.ini similarity index 100% rename from config/polybar/config rename to config/polybar/config.ini diff --git a/config/sxhkdrc b/config/sxhkdrc index 9004e3e..209e613 100644 --- a/config/sxhkdrc +++ b/config/sxhkdrc @@ -27,19 +27,19 @@ XF86AudioNext playerctl next XF86AudioLowerVolume - pactl set-sink-volume @DEFAULT_SINK@ -3% + chvolume -5% XF86AudioRaiseVolume - pactl set-sink-volume @DEFAULT_SINK@ +3% + chvolume +5% XF86AudioMute - pactl set-sink-mute @DEFAULT_SINK@ toggle + chvolume +0% toggle XF86MonBrightnessUp - light -A 5 + chlight -A 5 XF86MonBrightnessDown - light -U 5 + chlight -U 5 # make sxhkd reload its configuration files: super + Escape diff --git a/install-root.conf.yaml b/install-root.conf.yaml index 407c398..c0abc8a 100644 --- a/install-root.conf.yaml +++ b/install-root.conf.yaml @@ -11,3 +11,6 @@ /bin/dotfiles: dotfiles /usr/share/icons/default/index.theme: config/cursors.theme + + /usr/bin/chvolume: scripts/chvolume + /usr/bin/chlight: scripts/chlight diff --git a/scripts/chlight b/scripts/chlight new file mode 100755 index 0000000..a38995e --- /dev/null +++ b/scripts/chlight @@ -0,0 +1,11 @@ +#!/bin/bash +# chlight + +msgTag="brightness-updater" + +light "$@" + +brightness="$(light -G)" + +dunstify -a "chlight" -u low -i display-brightness -h string:x-dunst-stack-tag:$msgTag \ + -h int:value:"$brightness" "Brightness: ${brightness}%" \ No newline at end of file diff --git a/scripts/chvolume b/scripts/chvolume new file mode 100755 index 0000000..621e38c --- /dev/null +++ b/scripts/chvolume @@ -0,0 +1,23 @@ +#!/bin/bash +# chvolume + +# Arbitrary but unique message tag +msgTag="volume-updater" + +pactl set-sink-volume @DEFAULT_SINK@ "$1" + +pactl set-sink-mute @DEFAULT_SINK@ "$2" + +volume="$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | sed 's/[^0-9]*//g')" +mute="$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')" + +if [[ $volume == 0 || "$mute" == "yes" ]]; then + # Show the sound muted notification + dunstify -a "chvolume" -u low -i audio-volume-muted -h string:x-dunst-stack-tag:$msgTag "Volume muted" +else + # Show the volume notification + dunstify -a "chvolume" -u low -i audio-volume-high -h string:x-dunst-stack-tag:$msgTag \ + -h int:value:"$volume" "Volume: ${volume}%" +fi + +canberra-gtk-play -i audio-volume-change -d "chvolume" \ No newline at end of file