phuhl/linux_notification_center

user-defined buttons do not toggle back

Closed this issue · 2 comments

Hi,
I wanted to use some user-defined buttons, but for some reason these remain in 'state 2'.
Or at least the class buttonState2 is not removed with a second or multiple clicks so they remain highlighted forever.
As far as i understood these should be toggle buttons, right?

I have never seen haskell script before so i'm not sure.
Could it be that on click events only setButtonState2 is called but not setButtonState?

Button.hs:

 let theButton = Button
        { buttonButton = button
        , buttonLabel = label
        , buttonCommand = command }
  onButtonClicked button $ do
    addSource $ do
      setButtonState2 $ theButton
      return False
    ph <- spawnCommand command
    waitForProcess ph `finally` interruptProcessGroupOf ph
    return ()
  Gtk.containerAdd button label
  return theButton

I am using the binary package

See the 3rd code block here:

https://github.com/phuhl/linux_notification_center#usage

You need to toggle button states from your scripts.

phuhl commented

Hi @lindeMAX, it is as mikenrafter said. You will have to set the state of the buttons manually:

# turn highlighting on
notify-send.py a --hint boolean:deadd-notification-center:true \
               int:id:0 boolean:state:true type:string:buttons

# turn highlighting off
notify-send.py a --hint boolean:deadd-notification-center:true \
               int:id:0 boolean:state:false type:string:buttons

That enables you to have a "loading" state for long running tasks (i.e. enable wifi). Hope that clears up the confusion.