dhruv8sh / arch-update-checker

Plasma 6 applet to check for AUR and Arch updates
GNU General Public License v2.0
70 stars 5 forks source link

[feature request] Show list of outdated apps in panel systray #11

Closed kinoegit closed 3 months ago

kinoegit commented 3 months ago

Arch-update-checker displays a list of outdated apps when pressed, but only as a applet on the desktop. Maybe I'm missing something but this feature doesn't seem to work in the panel systray. Screencast_20240321_092332.webm Apdatifier and Arch-update-counter do the trick. I would like Arch-update-checker to have that feature because i prefer it due to flatpak update option

dhruv8sh commented 3 months ago

It is supposed to work but due to my really busy schedule I am only able to give 30 mins per week to each of my projects. I will try my best to get it to work in the next 24 hrs alongside the notification feature.

kinoegit commented 3 months ago

Thank you anyway

dhruv8sh commented 3 months ago

This probably is a bug in the plasmashell/systray itself. I have tried all possible workarounds and it just doesn't seem to work. Look at this.

Edit: I copied the battery widget, slightly changed the code which has nothing to do with expanding the applet. Even this caused the same behavior.

kinoegit commented 3 months ago

You lost me there. Bear with me and sorry for my ignorance but I can't reproduce that bug and how is it relevant here? Did you have a look at the code of the above mentioned apdatifier and arch-update-counter? How do they open a popup list of outdated apps?

dhruv8sh commented 3 months ago

Ok, I'll give you some context... The expanded property dictates if the popup is opened or not. Here's how 'Adaptifier' handles this:

MouseArea {
    id: mouseArea
    anchors.fill: parent
    acceptedButtons: cfg.rightClick ? Qt.AllButtons : Qt.LeftButton | Qt.MiddleButton
    hoverEnabled: true
    property bool wasExpanded: false
    onPressed: wasExpanded = expanded
    onClicked: (mouse) => {
        if (mouse.button == Qt.LeftButton) expanded = !wasExpanded
        if (mouse.button == Qt.MiddleButton && cfg.middleClick) JS[cfg.middleClick]()
        if (mouse.button == Qt.RightButton && cfg.rightClick) JS[cfg.rightClick]()
    }
    onEntered: {
        lastCheck = JS.getLastCheck()
    }
}

Here's mine:

MouseArea {
    id: mouseArea
    property bool wasExpanded: false
    acceptedButtons: Qt.LeftButton | Qt.MiddleButton
    anchors.fill: parent
    hoverEnabled: true
    onPressed: wasExpanded = expanded
    onClicked: mouse => {
        if (mouse.button == Qt.MiddleButton) packageManager.action_updateSystem()
        else {
            expanded = !wasExpanded;
            if( expanded && plasmoid.configuration.updateOnExpand && main.hasUserSeen )
                packageManager.action_checkForUpdates();
            main.hasUserSeen = true
        }
    }
 }

There is no inherent difference. If it were to be a problem with this applet, it wouldn't open outside the system tray either. I would have to specifically define the behavior for it to not open in the tray.

Also, the linked bug is reproducible for me.

kinoegit commented 3 months ago

Thank you for taking the time! Maybe thats the relevant code of arch-update-counter:

 MouseArea {
      anchors.fill: container // cover all the zone
      cursorShape: Qt.PointingHandCursor // give user feedback
      acceptedButtons: Qt.LeftButton | Qt.MiddleButton
      onClicked: (mouse) => {
        if (invertMouseAction) {
          if (mouse.button == Qt.MiddleButton) {
            mainIsRefresh ? onLClick() : main.expanded = !main.expanded
          }
          if (mouse.button == Qt.LeftButton) onMClick()
        } else {
          if (mouse.button == Qt.LeftButton) {
            mainIsRefresh ? onLClick() : main.expanded = !main.expanded
          }
          if (mouse.button == Qt.MiddleButton) onMClick()
        }
      }
    }
  }
}
dhruv8sh commented 3 months ago

You see it does the exact same thing, it's the same for any other applet as well. (main.expanded is expanded). Also, implementing the same does nothing either. Maybe I am missing something that all the other applets are doing, but I just cannot seem to find it. But I also am really sure this is a problem with the system tray.

kinoegit commented 3 months ago

I can't help either for I'm a professional layman concerning coding;) but it looks like the other update applets have got a clue thats to find out.

dhruv8sh commented 3 months ago

Okay, so this was fixed. The fix was to remove preferredRepresentation property from main.qml. This property dictates whether the applet should be in its expanded or compact form when it's not in a panel. This of course is a bug(as I suspected) and will be reported in the KDE bug-tracking system. Thanks for using the applet.

kinoegit commented 3 months ago

Looking forward to have that feature in your very helpful plasmoid. Thank you Dhruvesh- keep up your good work.

kinoegit commented 3 months ago

Sorry for bothering: am I missing something or didn't you released the new version yet?

dhruv8sh commented 3 months ago

Hello @kinoegit , I had to make a few changes before pushing the update. It has now been uploaded, enjoy!