KDocker
KDocker copied to clipboard
Feature request: Icon reload
Hey,
it would be nice if kdocker is able to reload or load another icon while running.
I want to use it for Thunderbird and a mail check via a plugin which can run a command. Unfortunately other plugins for these purposes (with icon change) are not supported anymore. I was hoping to fix that with kdocker.
Cheers
This would be a great addition given the latest Thunderbird update.
I'm also using KDocker to tray Thunderbird, plus this hacky script with https://addons.thunderbird.net/en-US/thunderbird/addon/mailbox-alert/ to create an icon on new mail;
#!/bin/bash
if ! pgrep -f yad.*mail-mark-unread.*thunderbird &> /dev/null 2>&1; then
yad --notification --image="mail-mark-unread" --listen --command="sh -c 'thunderbird ; pkill -f yad.*mail-mark-unread.*thunderbird'" &
fi
Yad would probably also do what you're wanting, it's pretty flexible.
Can not test the alternative because https://addons.thunderbird.net/en-US/thunderbird/addon/mailbox-alert/ is not compatible with Thunderbird 68.
Currently running Kdocker with the suggestion from @xdenyer.
#!/bin/bash
if pidof thunderbird >/dev/null
then
# if an instance with kdocker is already open use the open instance
# thunderbird does internal magic to find a running instance)
/usr/bin/thunderbird $@
else
# no thunderbird with kdocker is running so open it
/usr/bin/kdocker -i ./thunderbird.png -m -q /usr/bin/thunderbird $@
fi
This solution is not working well. Take the one in two posts below: https://github.com/user-none/KDocker/issues/36#issuecomment-562021092
#!/bin/bash
# https://bugzilla.mozilla.org/show_bug.cgi?id=1482674
while true
do
inotifywait -m ~/.thunderbird/PROFILE/Mail/localhost/Inbox.msf -e modify |
while read output;
do
sleep 1
icon_already_exists=$(pgrep -f yad.*mail-mark-unread.*thunderbird)
if [ -z "$icon_already_exists" ]
then
yad --notification --image="mail-mark-unread" --listen --command="sh -c '/usr/local/bin/thunderbird ; pkill -f yad.*mail-mark-unread.*thunderbird'" &
fi
done
done
JFYI: This needs more optimization and is a suggestion for only experienced users.
Ah, you've gone with monitoring the mailbox file directly -- I find I tend to modify mailbox items, and went with monitoring a (silent) sound file that Thunderbird's configured to play on new mail. But glad the approach works for you, inotifywait seems like a really useful tool.
If anyone else wants, now that Thunderbird's broken the alert extension...
https://bugzilla.mozilla.org/show_bug.cgi?id=1482674
#!/bin/sh
inotifywait -m -e access /home/username/.myscripts/watch_silent.wav |
while read output;
do
sleep 1
icon_already_exists=$(pgrep -f yad.*mail-mark-unread.*thunderbird)
if [ -z "$icon_already_exists" ]
then
yad --notification --image="mail-mark-unread" --listen --command="sh -c 'thunderbird ; pkill -f yad.*mail-mark-unread.*thunderbird'" &
fi
done
It'd be nice if the Thunderbird devs hopped off the Gnome bandwagon and better supported normal desktop environments.
And on-topic, being able to update KDocker icons would be useful.
@xdenyer Now I got it. Thx. Your approach is fixing my current problem with an icon popping up even when I delete a mail. But you know it already and solved it quiet funny. Thx for the inspiration. This is my outcome. This script actually runs really daemon wise or more endless.
#!/bin/bash
# https://bugzilla.mozilla.org/show_bug.cgi?id=1482674
while true
do
if /usr/bin/inotifywait -qq -e access ./thunderbird.wav
then
/usr/bin/yad --notification --image="mail-mark-unread" --command="/bin/sh -c '/usr/local/bin/thunderbird; /usr/bin/pkill -f yad.*mail-mark-unread.*thunderbird >/dev/null 2>&1'"
fi
done
For info (was googling earlier) the developer has been able to update the Mailbox Alert plugin, which makes it straightforward again to run a script on new mail: https://tjeb.nl/Projects/Mailbox_Alert/
They note; "Open issue: I am aware that the custom Filter action for Mailbox Alert isn't working (due to the removal of XBL bindings), but have yet to discover how the new interfaces work. In recent versions of Thunderbird (>63) it is currently not possible to set the target action for the MailboxAlert Filter."
Tested working with Thunderbird 68.2.2, I'm using the script I was originally;
#!/bin/bash
if ! pgrep -f yad.*mail-mark-unread.*thunderbird &> /dev/null 2>&1; then
yad --notification --image="mail-mark-unread" --listen --command="sh -c 'thunderbird ; pkill -f yad.*mail-mark-unread.*thunderbird'" &
fi