Open d12frosted opened 3 years ago
I am seeing similar behavior to you. I suspect it may have something to do with the symlink changing when running darwin-rebuild switch
or the home-manager
equivalent. This issue also seems to describe something similar.
I am creating a file in ~/.config
with home-manager
:
{
home.file.skhd = {
target = ".config/skhd/skhdrc";
text = ''
...
'';
}
After running darwin-rebuild switch
, the file shows up where you'd expect
❯ l.
skhdrc -> /nix/store/2scv6kjzkpn9ghmhrmg2n46yvvpdzcr4-home-manager-files/.config/skhd/skhdrc
Making changes and running darwin-rebuild switch
again changes where the symlink points, which I suspect doesn't trigger a change event to the file skhd
is watching.
❯ l.
skhdrc -> /nix/store/500pniqi49phnlhicmig8cp12ficgnmj-home-manager-files/.config/skhd/skhdrc
Running skhd -r
after darwin-rebuild switch
resolves the issue but is required for each run of darwin-rebuild switch
that modifies the skhdrc
. I suspect if I could find a way to make the symlink path stable, that might work.
It might be easiest to just add skhd -r
to system.activationScripts.postActivation
:
system.activationScripts.postActivation.text = ''
${pkgs.skhd} -r
'';
After some research i found that as the time of writing skhd doesn't support hot-reloading on symlinks. And guess how nix works? we all know LMAO The related issue: https://github.com/koekeishiya/skhd/issues/342 (pls like so we can get more attention from the dev)
system.activationScripts.postActivation.text = ''
su - $(logname) -c '${pkgs.skhd}/bin/skhd -r'
'';
Hope this helped someone.
EDIT: formatting (added summary) and removed unfinished sentence
I can't get skhd to do anything in my setup. I have tried everything mentioned here, and even reboots and it does not seem like skhd is doing anything. I can see the process running, and I can see its pointed to the right config file, but it will not react to any key.
Skhd is allowed to be run in the background, and also it's enabled in Privacy & Security -> Accessibility
Could my issue be related, or should I create a new ticket?
I can't get skhd to do anything in my setup. I have tried everything mentioned here, and even reboots and it does not seem like skhd is doing anything. I can see the process running, and I can see its pointed to the right config file, but it will not react to any key.
Skhd is allowed to be run in the background, and also it's enabled in
Privacy & Security -> Accessibility
Could my issue be related, or should I create a new ticket?
Doesn't sound like your issue is with hot reloading.
Seems like
skhd
configurations changes inservices.skhd.skhdConfig
are applied only upon system restart/manual service reload vialaunchctrl
.skhd
has a feature to hot load its configurations, and for some reason that's not working.I also tried using manual reload, but it could not lock
pid-file
. Reading the sources ofskhd
makes me think that the file was not properly created and unfortunately I didn't check it before restarting the service manually vialanuchctl
, which fixes the issue.What works so far is manually restarting the service
And then after every
darwin-rebuild switch
I need toskhd -r
.Any ideas how to automate it? Please let me know if you need more information.
P.S. I am using
nix
,nix-darwin
andhome-manager
for the second day only, so might be missing something obvious.