Hardcode-Tray
Hardcode-Tray copied to clipboard
Arch linux pacman hook
It's not a bug, it's some kind of suggestion. I've tired to run a script after install any supported package so just fast added a hook for pacman to run after every install and run hardcode-tray if needed. It's dirty and there could be much cleaner way to use HardcodeTray.App class as is (i'm not a python dev at all). https://gist.github.com/flops/26e02c63dd1193332c3a5e060a05d565
But as an proof of concept. And would be great if some kind of near implementation will appear in package itself.
It's definitely a great idea. But before working on this, I would like to improve the basic functionalities, and rewrite some code to fix some small issues. Once it's done i will work on this 👍
@flops I've added Let me know if there should be any adjustments. It's working great for me.hardcode-tray
to the Manjaro Community repo with your hook.
EDIT: I've removed it from the repo for now. I may add it again if I decide to also add papirus-icon-theme-git
.
For now, use my hardcode-tray-git
PKGBUILD and papirus-icon-theme-git
from the AUR.
It doesn't work for me. I see this error every time I'm installing anything by pamac-manager
Traceback (most recent call last):
File "/usr/share/hardcode-tray/hook.py", line 11, in <module>
from HardcodeTray.const import DB_FOLDER, USERHOME
File "/usr/lib/python3.8/site-packages/HardcodeTray/const.py", line 28, in <module>
USERHOME = path.expanduser("~" + USERNAME)
TypeError: can only concatenate str (not "NoneType") to str
It looks like USERNAME here is None, but I have no idea why. I've tried to write and execute test code to find out what is wrong with it.
from os import getenv, path
from platform import machine
USERNAME = getenv("SUDO_USER") or getenv("USER")
USERHOME = path.expanduser("~" + USERNAME)
print(getenv("SUDO_USER"))
print(getenv("USER"))
print(USERNAME)
print(USERHOME)
And it works the way it's supposed to. All of the variables are not empty no meter whether I'm running it with a user privilege or with sudo. Any ideas?
@yuzvir How did you install Hardcode Tray? See my edited comment above.
@yochananmarqos I uninstalled the old package, downloaded all the files from your repo folder and run
makepg
makepkg --install
still have the same issue
@yuzvir
the old package
What old package? Use my hardcode-tray-git
package from my GitHub like I mentioned above.
I don't remember where I got the old one, but it doesn't meter since I've removed it.
As I already said I tried your hardcode-tray-git
without any success.
sudo hardcode-tray --apply
works as expected, but hook doesn't.
Oh, I misunderstood about the old package bit.
I really have no idea why that would happen. It works for me using Pacman, Yay and Topgrade. I don't use Pamac.
well... It is probably because hooks could be run with its own environment. I don't know the proper way to deal with it, so I just replaced
from HardcodeTray.const import DB_FOLDER, USERHOME
with
DB_FOLDER = path.join("/usr/share/hardcode-tray", "database", "")
USERHOME = '/home/user' # path to my user home folder
in /usr/share/hardcode-tray/hook.py
file
also found this problem:
if not hook.execute():
sys.exitsys.exit('Hook failed')
should be
if not hook.execute():
sys.exit('Hook failed')