This is much harder than I thought; I’m no good with all this Dbus stuff.
All I have is a little shell script, launched via .desktop launcher, that reads some values and sends a notification. Ideally I’d like to tap the notification to toggle that value, i.e. execute the same shell script again.
Could you help me with formulating that (the .desktop launcher and the Action for the notification)?
Lots of commented stuff from some unrelated experiments.
And the script itself:
# dependency checks
for dep in mcetool notificationtool; do
command -V $dep >/dev/null || exit 1
if [ "$1" = toggle ]; then
data="$(mcetool |grep -E ^'Charging|Battery level|Battery state')"
notificationtool -o add -c x-nemo.battery -a "dosomething a a a exec charging-toggle toggle" "$head" "$data"