Cute! 😀
It mostly works. I think line 103 should maybe be:
os.remove(os.path.join(cdata, "teat.txt"))
So, “teat.txt” instead of “eat.txt”. I think this prevents the cat from ever getting happy since that line causes an error and it never reaches image.set_from_file(os.path.join(current_dir, "data/happy.png"))
which is very sad!
Actually, you may just want to catch the error if the file happens to not exist. Like this:
try:
os.remove(os.path.join(cdata, "teat.txt"))
except FileNotFoundError:
pass
The way I have it, is that I copied org.kde.plasma.browser_integration.json from /usr/lib/mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.json (for Kubuntu 22.04, might be elsewhere for you) to ~/.var/app/org.mozilla.firefox/.mozilla/native-messaging-hosts and then changed the path
to a shell script that calls the original executable with flatpak-spawn --host
. Of course this kind of breaks sandboxing since you are allowing the browser to access programs on your machine but it works.
So I have: org.kde.plasma.browser_integration.json :
{
"name": "org.kde.plasma.browser_integration",
"description": "Native connector for KDE Plasma",
"path": "/home/username/.var/app/org.mozilla.firefox/.mozilla/native-messaging-hosts/org.kde.plasma.browser_integration.sh",
"type": "stdio",
"allowed_extensions": ["plasma-browser-integration@kde.org"]
}
and org.kde.plasma.browser_integration.sh
#!/bin/bash
flatpak-spawn --host /usr/bin/plasma-browser-integration-host "$@"
Don’t forget to chmod +x
the shell script.
I have the same for the KeePassXC extension.
Oh, I see. You fixed that one in 1.2. That wasn’t there yet when I commented. :)
Yeah, works great now!