dunst-project / dunst

Lightweight and customizable notification daemon
https://dunst-project.org
Other
4.54k stars 340 forks source link

Dunst cannot be configured through command line arguments #940

Closed exorcist365 closed 2 years ago

exorcist365 commented 2 years ago

Why have you removed this, it was one of the most useful functionalities of this program????

fwsmit commented 2 years ago

What's your use case?

orhun commented 2 years ago

I just saw this issue and I'd like to express the same feelings towards the new release. Most of the things seems to be changed: my old config is not working as expected anymore and I guess I have to do things like "startup notification" and "shortcuts" manually now. It *almost* feels like a 2.0.0 release...

exorcist365 commented 2 years ago

What's your use case?

I have a script to get the colors from xresources and use them to configure dunst.

exorcist365 commented 2 years ago

Also removing [shortcuts] is retarded as hell, I agree.

flipMWD commented 2 years ago

I also noticed [shortcuts] is not working as intended. Is there any way to keybind dunstctl close[-all] in the dunstrc config file or do I have to modify my WM to send the command itself (will probably interfere with other applications).

fwsmit commented 2 years ago

I just saw this issue and I'd like to express the same feelings towards the new release. Most of the things seems to be changed: my old config is not working as expected anymore and I guess I have to do things like "startup notification" and "shortcuts" manually now. It almost feels like a 2.0.0 release...

Why would you want startup notifications except for debugging? Anyways, you can keep using it with dunst --startup_notification.

[shortcuts] can easily be replaced with WM/DM bindings and using dunstctl. It's been deprecated for a long time and wasn't

I have a script to get the colors from xresources and use them to configure dunst.

Luckily this problem is already solved by https://github.com/dunst-project/dunst/blob/master/contrib/dunst_xr_theme_changer.sh. Just run the script and change your config location to ~/.config/dusnt/dunstrc_xr_colors. As always, every time you change the config, you need to restart dunst.

exorcist365 commented 2 years ago

Why not just bring these options back instead :exploding_head: :exploding_head: :exploding_head:

aleksfadini commented 2 years ago

Please bring back shortcuts and command line arguments

fwsmit commented 2 years ago

For clarity, these settings weren't exactly removed, instead they weren't re-implemented after the settings refactor (#803). This was because these things weren't deemed important enough, since they have other similar alternatives.

As for the shortcuts section, I haven't heard good reasons to bring it back. There are lots of ways to add shortcuts and we don't need yet another one. On top of that, it's not possible for programs in wayland to add global shortcuts themselves, making it a X11 only feature. Just use your WM's way of defining shortcuts or use something like sxhkd. You are free to contribute your config to contrib to make it easier for others.

As for the command line arguments, the deprecation notice has existed for a long time (#328), at least regarding section-specific command line arguments. Unfortunately, due to bad timing by me, the best proposed alternative hasn't been merged yet, but is on it's way. This will come in the form of drop-in config files (#933). This will allow you to generate a simple dunst drop-in file that contains only the x resources colours, while keeping the rest of your config non-generated. I hope this alternative is sufficient, but otherwise let me know why it's not.

EgZvor commented 2 years ago

@fwSmit would be good to mention this in the README, don't you think? I can make a PR.

fwsmit commented 2 years ago

@fwSmit would be good to mention this in the README, don't you think? I can make a PR.

True. A PR would be appreciated :)

fwsmit commented 2 years ago

For clarity, I'm considering re-adding the command line options in a slightly different from. They would be with double dashes (--). It shouldn't be too complicated, it's just something I haven't gotten to.

marcelofern commented 2 years ago

For the record, this is a script I was using to change dunst colors based on the pywal theme. This isn't working anymore:

#!/bin/sh

# source wal colors.
source ~/.cache/wal/colors.sh

pkill --exact dunst
dunst \
    -config=~/.config/dunst/dunstrc \
    -frame_width 1 \
    -lb $color0 \
    -lf $color7 \
    -lfr $color3 \
    -cb $color0 \
    -cf $color7 \
    -cfr $color3 \
    -nb $color0 \
    -nf $color7 \
    -nfr $color3 &
aleksfadini commented 2 years ago

For the record, this is a script I was using to change dunst colors based on the pywal theme. This isn't working anymore:

#!/bin/sh

# source wal colors.
source ~/.cache/wal/colors.sh

pkill --exact dunst
dunst \
    -config=~/.config/dunst/dunstrc \
    -frame_width 1 \
    -lb $color0 \
    -lf $color7 \
    -lfr $color3 \
    -cb $color0 \
    -cf $color7 \
    -cfr $color3 \
    -nb $color0 \
    -nf $color7 \
    -nfr $color3 &

Would like to know what is a workaround for this, since it stopped working.

marcelofern commented 2 years ago

@aleksfadini my understanding is that there is no workaround. @fwSmit your feedback on this would be appreciated.

I've created a script to manually change contents of the dunstrc based on pywal colors, but it is by no means a better solution, it is not even a good solution at all. However, at the time I am writing this I couln't find a better replacement yet:

#!/bin/sh

# source wal colors.
source ~/.cache/wal/colors.sh

DUNST_FILE=~/.config/dunst/dunstrc

# update dunst based on pywal colors.
sed -i '/background = /s/.*/background = "'$color0'"/' $DUNST_FILE
sed -i '/foreground = /s/.*/foreground = "'$color7'"/' $DUNST_FILE
sed -i '/frame_color = /s/.*/frame_color = "'$color3'"/' $DUNST_FILE

Is there a way to do this in a more elegant way? The above feels like a dirty hack.

fwsmit commented 2 years ago

You're almost at the workaround I think is best. Instead of overwriting the existing dunstrc, you should generate one based on a template. Then you should start Dunst with the generated config. There's already a script that does exactly what you want here: https://github.com/dunst-project/dunst/blob/master/contrib/dunst_xr_theme_changer.sh

aleksfadini commented 2 years ago

Is there a way to do this in a more elegant way? The above feels like a dirty hack.

@marcelofern thank you for posting that. could you reply (or edit/add to the post) with a link to your dunstrc for clarity? For some reason I'm having trouble with colors since command line options were removed.

BeyondMagic commented 2 years ago

Luckily this problem is already solved by https://github.com/dunst-project/dunst/blob/master/contrib/dunst_xr_theme_changer.sh. Just run the script and change your config location to ~/.config/dusnt/dunstrc_xr_colors. As always, every time you change the config, you need to restart dunst.

It seems a hell of a downgrade to rely on an external script for a functionality that was already implemented on dunst itself.


@marcelofern

Using a close-looking hack way as well for now, two commands actually:

template_dunstrc

[global]
  font = ${font}
  width = ${width}
  height = ${height}
  offset = ${x}x${y}
  separator_height = ${separator_height}
  padding = ${padding}
  horizontal_padding = ${horizontal_padding}
  frame_width = ${frame_width}
  max_icon_size = ${max_icon_size}

[urgency_low]
  background = "${low_background}"
  foreground = "${low_foreground}"
  frame_color = "${low_frame_color}"

[urgency_normal]
  background = "${normal_background}"
  foreground = "${normal_foreground}"
  frame_color = "${normal_frame_color}"

[urgency_critical]
  background = "${critical_background}"
  foreground = "${critical_foreground}"
  frame_color = "${critical_frame_color}"

.XResources

dunst.font                  : Noto Sans CJK JP 10
dunst.geometry.width        : 300
dunst.geometry.height       : 80
dunst.geometry.x            : 45
dunst.geometry.y            : 60
dunst.separator_height      : 2
dunst.padding               : 10
dunst.horizontal_padding    : 10
dunst.max_icon_size         : 64
dunst.frame_width           : 2
dunst.critical.background   : #13171aAA
dunst.critical.foreground   : #fe2d3b
dunst.critical.frame_colour : #141e24
dunst.normal.background     : #13171aAA
dunst.normal.foreground     : #ffffff
dunst.normal.frame_colour   : #000000
dunst.low.background        : #000000AA
dunst.low.foreground        : #A8A8A8
dunst.low.frame_colour      : #111111

script.zsh

kill -9 $(pidof dunst)

export \
                font="$(xgetres dunst.font)" \
               width="$(xgetres dunst.geometry.width)" \
              height="$(xgetres dunst.geometry.height)" \
                   x="$(xgetres dunst.geometry.x)" \
                   y="$(xgetres dunst.geometry.y)" \
    separator_height="$(xgetres dunst.separator_height)" \
             padding="$(xgetres dunst.padding)" \
  horizontal_padding="$(xgetres dunst.horizontal_padding)" \
       max_icon_size="$(xgetres dunst.max_icon_size)" \
         frame_width="$(xgetres dunst.frame_width)" \
      low_background="$(xgetres dunst.low.background)" \
      low_foreground="$(xgetres dunst.low.foreground)" \
     low_frame_color="$(xgetres dunst.low.frame_colour)" \
   normal_background="$(xgetres dunst.normal.background)" \
   normal_foreground="$(xgetres dunst.normal.foreground)" \
  normal_frame_color="$(xgetres dunst.normal.frame_colour)" \
 critical_background="$(xgetres dunst.critical.background)" \
 critical_foreground="$(xgetres dunst.critical.foreground)" \
critical_frame_color="$(xgetres dunst.critical.frame_colour)"

envsubst < "$HOME/.config/dunst/template_dunstrc" > "$HOME/.config/dunst/dunstrc"

dunst -s -follow keyboard & disown

I'll stick with this probably since it's easier to switch themes with it.

aleksfadini commented 2 years ago

@BeyondMagic thank you for explaining this. We still can't understand why such a function was removed.

zlice commented 2 years ago

just throwing my hat in the ring. broke today on me and has the ugly midnight default colors.

fwsmit commented 2 years ago

Drop-in files have been implemented in #997, so this should solve the underlying issue of needing to generate the entire dunstrc. The solutions mentioned above should work without any issues. I'll go ahead and close this issue.

zlice commented 2 years ago

So there won't be a -- implemented ?

I don't want another file. As petty as it is, it's just one more thing to copy between machines if I'm setting something new up or changing something.

fwsmit commented 2 years ago

So there won't be a -- implemented ?

There might be some time. If someone wants to submit a PR that'd be great.

I don't want another file. As petty as it is, it's just one more thing to copy between machines if I'm setting something new up or changing something.

I get where you're coming from. It's just not something that bothers me in my setup, as I'm using a dotfiles repo with a dotfiles manager. So it's easy to copy dotfiles around. If you have a different setup it might be easier to use command line arguments. Anyways, I'll probably get to the command line arguments some time, but I don't consider it a bug right now, since the alternative of drop-ins are there now.

vzaliva commented 1 month ago

I used to do notify-send DUNST_COMMAND_PAUSE to pause notifications. The use case is when I share my screen and doing a presentation. How can I do this now?

Narrat commented 1 month ago

You can use dunstctl which should come with your dunst installation :) See man dunstctl. There is a section about is-paused, set-paused, get-paused and set-pause-level