Closed olib14 closed 8 months ago
Hi :wave:
That seem a little bit out of scope. I'm afraid this will complicate the plamoid for a single use case.
My main concern here was :
Just because I'm intrigued :rofl:
The text showed in the applet is :
if (separateResult) return ' ' + totalArch + separator + totalAur + ' '
return ` ${parseInt(totalArch, 10) + parseInt(totalAur, 10)} `
Isn't it possible to modify one command output via the settings page to write and read at the same time? Maybe something like this :
checkupdates
, write the result on a file and return the total of the 3 filesecho
)So let's say you want to have just the total, maybe :
checkupdates | wc -l > t1 && ct1=$(head -n 1 t1) && ct2=$(head -n 1 t2) && ct3=$(head -n 1 t3) && echo $(($ct1 + $ct2 + $ct3))
21
Here t1, t2, t3 are my file (because I'm lazy for the naming haha).
If you want to separate the result you should check the option “separate result” and do a:
checkupdates | wc -l > t1 && ct1=$(head -n 1 t1) && ct2=$(head -n 1 t2) && ct3=$(head -n 1 t3) && echo "${ct1}-${ct2}-${ct3}"
10-5-6
I'll stop writing now, but this ticket made me want to find a way to manage potentially more than 2 cmd easily. I'll have to test some things. It might let you do what you want without modifying the applet code too much.
Maybe we could generate JSON file with a structure like this?
{
"hostname": "Oliver-Laptop",
"arch_updates": 0,
"aur_updates": 6
}
I thought about this further, and was thinking we wouldn't have to limit this to Arch Linux - any command could be used on other distros to fetch the number of updates!
Using JSON works very nicely in QML, and that would definitely be a good structure. It could even have hosts provide an SSH name or IP to have a nice button to update remotely.
I was thinking I could pursue this myself with my own plasmoid, but I feel it would be a major dick move to upstage the author.
That seems kind of complex
Is the dynamic addition multiple update types (count, update commands), and the JSON saving and reading possible with qml only? I don't know C++ and requiring compiling will make distributing harder.
Workflow wise, would it be something like this?
So maybe the plasmoid could save files like those for each host:
{
"hostname": "Oliver-PC",
"ip": "123.456.789.123"
"updates": [
{
"type" : "RPM",
"count": 20
"update_command" : "???"
},
{
"type" : "Flatpak",
"count": 6
"update_command" : "???"
}
]
}
{
"hostname": "Oliver-Laptop",
"ip": "123.456.789.123"
"updates": [
{
"type" : "Arch",
"count": 20
"update_command" : "paru"
},
{
"type" : "Aur",
"count": 6
"update_command" : "paru"
}
]
}
I thought about this further, and was thinking we wouldn't have to limit this to Arch Linux - any command could be used on other distros to fetch the number of updates!
This is the case, the user just needs to update the cmd and me the name of the plasmoid, no ?
Personally, I don't think I have the time to make this dev. But if you think you can do it, go ahead :)
The only thing is, if possible, I'd like to keep the plugin as simple as possible for out-of-the-box use. And I don't want to have to use C++ because I don't know the language ^^.
Don't forget that the user can also chain these commands, using &&. For example, if a user wants to update 3 different packagers, he can do so in one command. Perhaps this is something that needs to be specified in the readme or in the econfig window?
Hi, I use a custom solution that prints to the terminal how many updates I have on each of my systems - desktop and laptop running Arch, and Pi running Arch Linux ARM.
To do this, on each device I use a pacman hook and systemd timer that runs a script, that itself runs
checkupdates
from pacman-contrib, then writes the number of updates to a file named with the device's hostname.The folder containing these files is synced between devices using Syncthing, and looks like this:
This is used in a script that prints the number of updates to the terminal whenever I open it:
I was wondering if this plasmoid could be adapted to support multiple systems - by using a specified folder, and writing the count of updates to a file in that folder and reading from all files there. Maybe it would count all systems together in the compact representation and show, in a full representation, the per-system count.
I'm a KDE contributor and would be interested in working towards this end if you think this is a good idea for your project.