Created
December 11, 2019 21:06
-
-
Save andreycizov/738f80a16c9e401d6a9e77b863e67066 to your computer and use it in GitHub Desktop.
Enable desktop notifications trigger urgent flag for your Slack running in Linux via Dunst filters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh -ex | |
# THIS SCRIPT ASSUMES YOU DON'T HAVE A CUSTOM DUNST SETUP IN ~/.config/dunst/dunstrc!!!!!! | |
# https://geekoverdose.wordpress.com/2019/08/01/i3-window-manager-selectively-make-any-notification-urgent-urgency-flag-to-highlight-the-workspace/ | |
mkdir -p ~/bin | |
DUNST=~/bin/dunst-urgent-notification | |
cat >$DUNST <<BEGIN | |
#!/bin/sh | |
wmctrl -r \$1 -b add,demands_attention | |
BEGIN | |
chmod +x $DUNST | |
mkdir -p ~/.config/dunst | |
DUNSTRC=~/.config/dunst/dunstrc | |
zcat /usr/share/doc/dunst/dunstrc.gz > $DUNSTRC | |
cat >>$DUNSTRC <<BEGIN | |
[slack] | |
appname = "Slack" | |
summary = "*" | |
# this is the filter criterion applied to the message, see below | |
# urgency = critical # those attributes could be used to set details of the message in the script called below | |
# format = "" # could be used to alter the popup text, see below | |
script = ~/bin/dunst-urgent-notification # this is the script that is called, see below | |
BEGIN | |
killall dunst; notify-send "Slack notifications now set up!" | |
This has a bug where if you have an another window starting with "Slack..." that window is going to be marked as URGENT
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
wmctrl needs to be pre-installed before using this. also moving dunst-urgent-notification to ~/.config/dunst is more reasonable.