Open kitzberger opened 2 years ago
To see the Anki app name in GNOME:
app:
line for AnkiTo change app name in the add-on:
app:
line but without the .desktop
extension@k-kirill, wow, thanks a lot for the walk thru ;-)
Found it:
So I set the app_name to anki-ppd_anki
but still no dots ;-(
Did you restart Anki after the change? Do you use the Dash to Dock extension?
Yeah, did a restart after changing the plugins config.
I'm on Ubuntu 22.04 which is coming with Ubuntu Dock 71. According to its description that's a modified version of Dash to Dock.
What's the number of cards to study you get in Anki Browser for the is:new or is:due
search?
That's 38.
The notification popups are working btw.!
Do you see that badge in the dock for some other applications like Telegram?
Can you please post the output of this command after starting Anki?
dbus-monitor "type='signal',interface='com.canonical.Unity.LauncherEntry'"
signal time=1665834899.935455 sender=org.freedesktop.DBus -> destination=:1.2486 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
string ":1.2486"
signal time=1665834899.935483 sender=org.freedesktop.DBus -> destination=:1.2486 serial=4 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameLost
string ":1.2486"
Sorry, I meant the following: run the dbus-monitror
command first in terminal and then start Anki and then you should see the output in terminal like this
signal time=1665834743.205162 sender=:1.163 -> destination=(null destination) serial=23 path=/; interface=com.canonical.Unity.LauncherEntry; member=Update
string "application://net.ankiweb.Anki.desktop"
array [
dict entry(
string "count"
variant int64 20
)
dict entry(
string "count-visible"
variant boolean true
)
dict entry(
string "progress"
variant double 0
)
dict entry(
string "progress-visible"
variant boolean true
)
Ah, then it's this here:
string "application://anki-ppd_anki.desktop"
array [
dict entry(
string "count"
variant int64 38
)
dict entry(
string "count-visible"
variant boolean true
)
dict entry(
string "progress"
variant double 0.530864
)
dict entry(
string "progress-visible"
variant boolean true
)
]
I don't have telegram installed.
I was able to add a progress bar and the count badge to the app icon via this snippet here: https://wiki.ubuntu.com/Unity/LauncherAPI#Python_Example
I've adjusted the script to this here:
from gi.repository import Unity, Gio, GObject, Dbusmenu
loop = GObject.MainLoop()
# Pretend to be evolution for the sake of the example
launcher = Unity.LauncherEntry.get_for_desktop_id ("anki-ppd_anki.desktop")
# Show a count of 124 on the icon
launcher.set_property("count", 124)
launcher.set_property("count_visible", True)
# Set progress to 42% done
launcher.set_property("progress", 0.42)
launcher.set_property("progress_visible", True)
# We also want a quicklist
ql = Dbusmenu.Menuitem.new ()
item1 = Dbusmenu.Menuitem.new ()
item1.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item 1")
item1.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
item2 = Dbusmenu.Menuitem.new ()
item2.property_set (Dbusmenu.MENUITEM_PROP_LABEL, "Item 2")
item2.property_set_bool (Dbusmenu.MENUITEM_PROP_VISIBLE, True)
ql.child_append (item1)
ql.child_append (item2)
launcher.set_property("quicklist", ql)
def update_urgency():
if launcher.get_property("urgent"):
print("Removing urgent flag")
launcher.set_property("urgent", False)
else:
print("setting urgent flag")
launcher.set_property("urgent", True)
return True
GObject.timeout_add_seconds(5, update_urgency)
loop.run()
Nice, but the add-on uses low level DBus API. Can you please temporarily replace Ubuntu Dock with Dash to Dock to test with it?
Can you please temporarily replace Ubuntu Dock with Dash to Dock to test with it?
I already did that, it's working with both ;-)
This is the same script with Ubtuntu Dock:
And Anki add-on does not work with both :( Maybe it's some snap issue like misconfigured dbus interface (for example, no access to the com.canonical.Unity.LauncherEntry
interface). I use flatpak version of Anki and do not have any snaps to troubleshoot it :(
Can you please try this solution?
https://forum.snapcraft.io/t/using-com-canonical-unity-launcherentry-dbus-interface/22004
Change the 16th line of __init__.py
of the add-on (Tools > Add-ons > select the add-on > View Files) to the following:
path = "/com/canonical/unity/launcherentry/1"
Here's the output, still no badges on the launcher icon though ;-(
signal time=1665843183.792471 sender=:1.2802 -> destination=(null destination) serial=9 path=/com/canonical/unity/launcherentry/1; interface=com.canonical.Unity.LauncherEntry; member=Update
string "application://anki-ppd_anki.desktop"
array [
dict entry(
string "count"
variant int64 46
)
dict entry(
string "count-visible"
variant boolean true
)
dict entry(
string "progress"
variant double 0.483146
)
dict entry(
string "progress-visible"
variant boolean true
)
]
It seems like the unity7
plugin is missing in https://github.com/ppd/anki-ppd/blob/master/snap/snapcraft.yaml
Looking at https://snapcraft.io/docs/interface-management, something like that should be able to enable it:
$ sudo snap connect anki-ppd:unity7 :unity7
Please note I have never used snaps as I use openSUSE Tumbleweed
Hm, it seems that this connection could only be made if the snapcraft.yaml would've specified that "plug".
$ sudo snap connect anki-ppd:unity7 :unity7
Error: snap "anki-ppd" has no plug named "unity7"
Damn.
Okay, let's wait for ppd/anki-ppd#5
Hi @k-kirill,
I guess I need some support to get the dots on the launcher icon to work. You've mentioned in your README this:
Where would I find that file? I've just pinned the anki icon to the launcher by right-clicking and then "add to favorites". Did that create that desktop file? Where? ;-)