ErikReider / SwayNotificationCenter

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

Buttons-grid command gets called everytime notification-center is opened #431

Open kamssiopeia opened 4 months ago

kamssiopeia commented 4 months 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 bug

Describe the bug Using buttons-grid widget with one of buttons having update-command and type = toggle, calls command when opening notification-center for the first time after reloading config or starting computer

To Reproduce Steps to reproduce the behavior:

  1. Go to json config of swaync
  2. Add buttons-grid widget
  3. Configure button with type = toggle, update-command example from README.md can be used or any other ie.
    {
    "label": "󰖩",
    "command": "nm-connection-editor",
    "type": "toggle",
    "update-command": "sh -c '[[ $(nmcli radio wifi) == \"enabled\" ]] && echo true || echo false'"
    }
  4. Open notification-center
  5. Notification-center calls command from buttons-grid

Expected behavior Nothing is called except for update-command

Please provide logs if you're experiencing notification errors / bugs Attach Gists for swaync logs by running G_MESSAGES_DEBUG=all swaync and (if applicable) application logs.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context For some reason when I configured other toggle button with update-command = pamixer --get-mute, command under command key gets fired every time I open, not only for the first time

Example configurations for buttons using pamixer

{
  "label": "󰕾",
  "command": "pamixer -t",
  "type": "toggle",
  "update-command": "pamixer --get-mute"
},
{
  "label": "",
  "command": "pamixer --default-source -t",
  "type": "toggle",
  "update-command": "pamixer --default-source --get-mute"
},
ForgotMyPasswd commented 3 months ago

I'm also getting this issue, however command only runs when I open notification-center for the first time

rtgiskard commented 3 months ago

I believe this is what it is designed. The update-command is used to get current actual toggle status, the result is used to set the state of toggle button on open notify center.

kamssiopeia commented 3 months ago

I believe this is what it is designed. The update-command is used to get current actual toggle status, the result is used to set the state of toggle button on open notify center.

update-command should fire every time you open notification center, but command shouldn't

rtgiskard commented 3 months ago

I believe this is what it is designed. The update-command is used to get current actual toggle status, the result is used to set the state of toggle button on open notify center.

update-command should fire every time you open notification center, but command shouldn't

Well, I'm using the latest git version, the issue seems to be fixed with this commit: be1533a