From dfdc8e86b27197ea874929537a8129cc552ff599 Mon Sep 17 00:00:00 2001 From: katherine Date: Sun, 11 Dec 2022 20:56:27 -0700 Subject: update to latest dunst remove forked version and make necessary relevant adjustments --- .config/dunst/dunstrc | 216 ------------------------------------- .config/herbstluftwm/autostart | 9 +- .config/herbstluftwm/mpc-status.sh | 15 ++- .config/herbstluftwm/pvol.sh | 17 +-- .config/init/gen/dunstrc.sh | 70 ++++++++++++ README.md | 8 +- 6 files changed, 92 insertions(+), 243 deletions(-) delete mode 100644 .config/dunst/dunstrc create mode 100644 .config/init/gen/dunstrc.sh diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc deleted file mode 100644 index 5135aa8..0000000 --- a/.config/dunst/dunstrc +++ /dev/null @@ -1,216 +0,0 @@ -[global] - # Allow a small subset of html markup in notifications and formats: - # bold - # italic - # strikethrough - # underline - # - # For a complete reference see - # . - # If markup is not allowed, those tags will be stripped out of the - # message. - allow_markup = yes - - # Treat incoming notifications as plain text - plain_text = no - - # The format of the message. Possible variables are: - # %a appname - # %s summary - # %b body - # %i iconname (including its path) - # %I iconname (without its path) - # %p progress value if set ([ 0%] to [100%]) or nothing - # Markup is allowed - format = "%s\n%b" - - # Sort messages by urgency. - sort = yes - - # Show how many messages are currently hidden (because of geometry). - indicate_hidden = yes - - # Alignment of message text. - # Possible values are "left", "center" and "right". - alignment = left - - # The frequency with which text that is longer than the notification - # window allows bounces back and forth. - # This option conflicts with "word_wrap". - # Set to 0 to disable. - bounce_freq = 0 - - # Show age of message if message is older than show_age_threshold - # seconds. - # Set to -1 to disable. - show_age_threshold = 60 - - # Split notifications into multiple lines if they don't fit into - # geometry. - word_wrap = no - - # Ignore newlines '\n' in notifications. - ignore_newline = no - - - # Shrink window if it's smaller than the width. Will be ignored if - # width is 0. - shrink = no - - # The transparency of the window. Range: [0; 100]. - # This option will only work if a compositing window manager is - # present (e.g. xcompmgr, compiz, etc.). - transparency = 0 - - # Don't remove messages, if the user is idle (no mouse or keyboard input) - # for longer than idle_threshold seconds. - # Set to 0 to disable. - idle_threshold = 30 - - # Which monitor should the notifications be displayed on. - monitor = 0 - - # Display notification on focused monitor. Possible modes are: - # mouse: follow mouse pointer - # keyboard: follow window with keyboard focus - # none: don't follow anything - # - # "keyboard" needs a window manager that exports the - # _NET_ACTIVE_WINDOW property. - # This should be the case for almost all modern window managers. - # - # If this option is set to mouse or keyboard, the monitor option - # will be ignored. - follow = keyboard - - # Should a notification popped up from history be sticky or timeout - # as if it would normally do. - sticky_history = yes - - # Maximum amount of notifications kept in history - history_length = 20 - - # Display indicators for URLs (U) and actions (A). - show_indicators = yes - - # The spacing between lines. If the height is smaller than the - # font height, it will get raised to the font height. - line_height = 0 - - # The height of the entire notification. If the height is smaller - # than the font height and padding combined, it will be raised - # to the font height and padding. - notification_height = 0 - - # Draw a line of "separator_height" pixel height between two - # notifications. - # Set to 0 to disable. - separator_height = 2 - - # Padding between text and separator. - padding = 8 - - # Horizontal padding. - horizontal_padding = 8 - - # Define a color for the separator. - # possible values are: - # * auto: dunst tries to find a color fitting to the background; - # * foreground: use the same color as the foreground; - # * frame: use the same color as the frame; - # * anything else will be interpreted as a X color. - separator_color = frame - - # Print a notification on startup. - # This is mainly for error detection, since dbus (re-)starts dunst - # automatically after a crash. - startup_notification = false - - # dmenu path. - dmenu = /usr/bin/dmenu -p dunst: - - # Browser for opening urls in context menu. - browser = /usr/bin/firefox -new-tab - - # Align icons left/right/off - icon_position = left - -[frame] - width = 2 - -[shortcuts] - # Shortcuts are specified as [modifier+][modifier+]...key - # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2", - # "mod3" and "mod4" (windows-key). - # Xev might be helpful to find names for keys. - - # Close notification. - close = mod4+minus - # Redisplay last message(s). - # On the US keyboard layout "grave" is normally above TAB and left - # of "1". - history = mod4+ctrl+minus - -[urgency_low] - timeout = 0 - -[urgency_normal] - timeout = 15 - -[urgency_critical] - timeout = 15 - - -# Every section that isn't one of the above is interpreted as a rules to -# override settings for certain messages. -# Messages can be matched by "appname", "summary", "body", "icon", "category", -# "msg_urgency" and you can override the "timeout", "urgency", "foreground", -# "background", "new_icon" and "format". -# Shell-like globbing will get expanded. -# -# SCRIPTING -# You can specify a script that gets run when the rule matches by -# setting the "script" option. -# The script will be called as follows: -# script appname summary body icon urgency -# where urgency can be "LOW", "NORMAL" or "CRITICAL". -# -# NOTE: if you don't want a notification to be displayed, set the format -# to "". -# NOTE: It might be helpful to run dunst -print in a terminal in order -# to find fitting options for rules. - -#[espeak] -# summary = "*" -# script = dunst_espeak.sh - -#[script-test] -# summary = "*script*" -# script = dunst_test.sh - -#[ignore] -# # This notification will not be displayed -# summary = "foobar" -# format = "" - -#[signed_on] -# appname = Pidgin -# summary = "*signed on*" -# urgency = low -# -#[signed_off] -# appname = Pidgin -# summary = *signed off* -# urgency = low -# -#[says] -# appname = Pidgin -# summary = *says* -# urgency = critical -# -#[twitter] -# appname = Pidgin -# summary = *twitter.com* -# urgency = normal -# -# vim: ft=cfg diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart index 89b7ff8..f0305c9 100755 --- a/.config/herbstluftwm/autostart +++ b/.config/herbstluftwm/autostart @@ -107,6 +107,9 @@ hc keybind Mod4-w jumpto last-minimized ## launchers +#dunst +hc keybind Mod4-minus spawn dunstctl close-all + #pass hc keybind Mod4-x spawn ~/.config/herbstluftwm/pass.sh hc keybind Mod4-Shift-x spawn ~/.config/herbstluftwm/pass.sh -f @@ -225,8 +228,4 @@ done # run dunst with theme colours pkill dunst -dunst -lb $bar_bg -nb $bar_bg -cb $bg_focus \ - -lf $bar_fg -nf $bar_fg -cf $fg_focus \ - -frame_color $bg_focus -geom "0x3-4+$(($bheight + 4))" \ - -fn "$mfont $mfont_size" \ - -max_icon_size 0 +dunst & diff --git a/.config/herbstluftwm/mpc-status.sh b/.config/herbstluftwm/mpc-status.sh index 6f3f699..31c13f4 100755 --- a/.config/herbstluftwm/mpc-status.sh +++ b/.config/herbstluftwm/mpc-status.sh @@ -1,8 +1,8 @@ -#!/bin/bash +#!/usr/bin/env zsh source $HOME/.config/init/vars -case "$1" in +case $1 in next) mpc next ;; @@ -15,23 +15,20 @@ esac mpc status >/dev/null 2>&1 if [[ $? -ne 0 ]]; then - notify-send -a closeme "mpd disconnected" + dunstify -r 109112100 "mpd disconnected" exit fi -if [[ -z "$(mpc status | grep -E '\[(playing|paused)\]')" ]]; then - notify-send -a closeme "mpd stopped" +if [[ -z $(mpc status | grep -E '\[(playing|paused)\]') ]]; then + dunstify -r 109112100 "mpd stopped" exit fi cd ~/music/ dir=$(dirname "$(mpc current -f %file%)") -# linking is necessary because notify-send can't into icon paths containing commas -cd $tmpdir -ln -sf "$HOME/music/$dir/cover-small.png" mpd-icon.png message="$(mpc current -f '##%track% %title% (%date%)\n%artist% - %album%') $(mpc status | tail -n -2 | sed -re 's/volume.*repeat/\nrepeat/' -e 's/( ){3,4}/\n/g' -e '/volume: /d')" -notify-send -t 4000 -a closeme --icon=$tmpdir/mpd-icon.png "$message" +dunstify -t 4000 -r 109112100 --icon="$HOME/music/$dir/cover-small.png" $message diff --git a/.config/herbstluftwm/pvol.sh b/.config/herbstluftwm/pvol.sh index 820d890..8d5984e 100755 --- a/.config/herbstluftwm/pvol.sh +++ b/.config/herbstluftwm/pvol.sh @@ -2,15 +2,20 @@ case "$1" in down) - pavolume voldown --quiet 2 + pactl set-sink-volume @DEFAULT_SINK@ -2% ;; up) - pavolume volup --quiet 2 + pactl set-sink-volume @DEFAULT_SINK@ +2% ;; mute) - pavolume mutetoggle --quiet - ;; - *) - pavolume show + pactl set-sink-mute @DEFAULT_SINK@ toggle ;; esac + +{ + [[ $(pactl get-sink-mute @DEFAULT_SINK@) =~ "yes" ]] && printf "Muted: " || printf "Volume: " + + pactl get-sink-volume @DEFAULT_SINK@ | sed -e N -e 's/\n//g' -e 's/.* \([0-9]\{1,2\}%\).*/\1/' +} | read body + +dunstify -r 118111108 $body diff --git a/.config/init/gen/dunstrc.sh b/.config/init/gen/dunstrc.sh new file mode 100644 index 0000000..99a7993 --- /dev/null +++ b/.config/init/gen/dunstrc.sh @@ -0,0 +1,70 @@ +echo "\ +[global] + monitor = 0 + follow = none + width = (0, 1000) + # height = 300 + origin = top-right + offset = 4x$(($bheight + 4)) + scale = 0 + notification_limit = 0 + progress_bar = true + progress_bar_height = 10 + progress_bar_frame_width = 1 + progress_bar_min_width = 150 + indicate_hidden = yes + transparency = 0 + separator_height = 2 + padding = 8 + horizontal_padding = 8 + text_icon_padding = 0 + frame_width = 2 + frame_color = \"$bg_focus\" + gap_size = 0 + separator_color = frame + sort = yes + font = \"$mfont $mfont_size\" + line_height = 0 + markup = full + format = \"%s\\\\n%b\" + alignment = left + vertical_alignment = center + show_age_threshold = 60 + ellipsize = middle + ignore_newline = no + stack_duplicates = true + hide_duplicate_count = false + show_indicators = yes + enable_recursive_icon_lookup = true + icon_position = left + min_icon_size = 32 + max_icon_size = 0 + icon_path = /usr/share/icons/Adwaita/64x64/status/:/usr/share/icons/Adwaita/64x64/devices/ + sticky_history = yes + history_length = 20 + title = Dunst + class = Dunst + corner_radius = 0 + ignore_dbusclose = false + force_xinerama = false + mouse_left_click = close_current + mouse_middle_click = do_action, close_current + mouse_right_click = close_all + +[experimental] + per_monitor_dpi = false + +[urgency_low] + background = \"$bar_bg\" + foreground = \"$bar_fg\" + timeout = 10 + +[urgency_normal] + background = \"$bar_bg\" + foreground = \"$bar_fg\" + timeout = 10 + +[urgency_critical] + background = \"$bg_focus\" + foreground = \"$fg_focus\" + timeout = 0" > $tmpdir/dunstrc diff --git a/README.md b/README.md index 9edcf4c..8af54e7 100644 --- a/README.md +++ b/README.md @@ -67,13 +67,7 @@ own](.config/herbstluftwm/pass.sh). ### [dunst](https://github.com/dunst-project/dunst)/[dmenu](https://bitbucket.org/melek/dmenu2)/[picom](https://github.com/yshui/picom)/[lemonbar](https://github.com/krypt-n/bar)/[nitrogen](http://projects.l3ib.org/nitrogen/) -useful things all around. i've "patched" dunst (really just a very bad hack) to -auto clean up on-screen messages when notifications are received from -[mpc-status.sh](.config/herbstluftwm/mpc-status.sh) and -[pvol.sh](.config/herbstluftwm/pvol.sh), which makes things update cleanly -in-place if a key is repeatedly pressed. hopefully this sort of functionality -will be added properly, but the documentation is sparse and don't have the time -to figure out how right now x-x +useful things all around 👍 ### [fcitx](http://fcitx-im.org) -- cgit v1.2.3