ErikReider / SwayNotificationCenter

A simple GTK based notification daemon for SwayWM
GNU General Public License v3.0
1.16k stars 59 forks source link

[Feature] Custom action on click #192

Closed auctumnus closed 1 year ago

auctumnus commented 1 year ago

Please read through the README and the Man pages before submitting Please also make sure that there isn't any prior issue describing this feature

Is your feature request related to a problem? Please describe. Discord notifications have a feature where if you click on them, it brings you to the message / the channel; the action is set to something to allow you to view it. Unfortunately, it doesn't focus the workspace that I have Discord open in.

Describe the solution you'd like If I could just set a custom action to run (with the default action provided by Discord still working), I could make my workspace switch to the one I have Discord open in. This would ideally look similar to how the scripts on receiving notifications work, e.g.

{
  "actions": {
    // This script will run when clicking on a Discord notification, bringing you
    // to the third Hyprland workspace (where I put Discord)
    "example-script": {
      "exec": "hyprctl dispatch workspace 3",
      "app-name": "discord"
    }
  }
}

Describe alternatives you've considered I can't think of any other alternative. I could just not have the notification switch my workspace to Discord, but that's kind of annoying and not really good UX.

ErikReider commented 1 year ago

Interesting... If I remember correctly, the reason for the workspaces not switching is due to the lack of xdga tokens. A easier way of adding this would be to add a new field to the script section. Something like "activation_method": "click|receive".

auctumnus commented 1 year ago

I considered suggesting that it just be added as an option on scripts, but I wasn't sure about the backwards compatability considerations. I suppose you could just default activation_method to receive?

ErikReider commented 1 year ago

I suppose you could just default activation_method to receive?

Precisely! I'm a bit swamped at work and fixing SwayFX atm. I'll get to it, but don't hold your breath.

You can always create a PR which would help me a ton! :)