Open hackel opened 7 years ago
Thanks for reporting this! I actually just implemented this feature (in a different way) last week. This is the main commit [99dd3bd336cf4279593e4bf6145d393f7548b847].
You can install and test this already if you install from master (version 14). I already submitted this to gnome and it's pending review (extensions.gnome.org/review).
git clone https://github.com/franglais125/apt-update-indicator
cd apt-update-indicator
make && make install
To make it more clear: upon modification of the apt cache (or the dpkg cache), the indicator simply looks for updates in the cache, not through the network, by running apt list --upgradable
.
Oh brilliant, I'll install this and test it out as soon as I actually have some new packages to upgrade!
Let me know how it goes!
It worked perfectly, thanks! I do wonder, though, won't this run apt list --upgradable multiple times during a typical upgrade as individual cache files are updated? Registering a dbus listener seems like it might be be better in that respect, but I'm not all that familiar with it so I'm not entirely sure.
Indeed, this was my concern as well. I "solved" this by setting a timeout [1], so it will wait 10 seconds before actually running apt list --upgradable
. The idea is that during many updates, in any 10 second-lapse another change will be made, so the timer will be reset to 10.
When you mentioned dbus, I immediately realized that that's the proper way of doing it, and tried to research a bit on it. I didn't manage yet to make it work. If you have more info on it, I'd love to see that. And if you want to start a PR on this, it would be awesome.
Thanks for thee feedback! I'll keep this issue open as a reminder of the dbus possibility.
https://github.com/franglais125/apt-update-indicator/blob/master/monitors.js#L105
Ah, the timeout solution sounds fine, too. I'm no expert at all. I just found this file: /etc/apt/apt.conf.d/20dbus
APT::Update::Post-Invoke-Success { "[ ! -f /var/run/dbus/system_bus_socket ] || /usr/bin/dbus-send --system --dest=org.debian.apt --type=signal /org/debian/apt org.debian.apt.CacheChanged || true"; };
I started looking into https://wiki.gnome.org/Gjs/Examples/DBusClient as well, but haven't had any more time to dig into it.
What distribution are you using? I'm on Debian Stretch and I don't have that apt conf file at all.
I checked for dbus signals when updating but I couldn't find anything useful. :(
I typically run apt updates from the CLI, and really only use this is a notifier. I also use unattended-upgrades. It would be nice if this extension could listen for the dbus signal emitted when an update completes (org.debian.apt.CacheChanged or org.freedesktop.PackageKit.UpdatesChanged?) and automatically update the number of installable packages (without performing an additional network update of the package lists).