#User hooks for pacman
29 messages · Page 1 of 1 (latest)
@outer wave
So, whenever pacman updates some systemd-bus related packages, some applications that I run in userspace that depend on it breaks, mostly fcitx5 and some mouse configurations
I have a couple of scripts that I use on my i3wm configuration that takes care of fixing the mouse issues, and fcitx has native support for "reloading"
the thing is, both apps are ran as my user, so I'm mostly just brainstorming to see if there is a way to make it so that "user hooks" are possible
you could probably add a system hook that runs a script which does something like su $SUDO_USER -c "commands to reload the app as a user"
it doesn't look like there's a way to tell it to run the hooks as some user
oh maybe
I don't mind writing applications
I could possibly make a root app that takes a look at the config for available users and their hook directories
which could then run that su command
this only works if you are running sudo pacman [...]
SUDO_USER would then be your user
you could also just hardcode your username in the script
I don't think that'd be an issue unless the user hooks must always be rerun regardless of who is current logged in
the thing with these "user hooks" is that they only need to be run when the session owner is the user
so, technically not a bug, just a feature
you could just check the username in the script
I think unless rerunning these apps would be more trouble if they don't have to be rerun it's probably easier just to run a script after updating
true
true²
I wonder if I can make something generic that works for everyone
or rather, mostly everyone
a user hook system should be relatively simple to make
A simple user_name & user_hookpath should be enough
just make sure you're not executing user-writable scripts as root 
then, execute as the user everything in the ${user_hookpath} that is +x'd