Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't hotload config file if it is a symlink #19

Closed
eddy-22 opened this issue Nov 21, 2017 · 10 comments
Closed

Can't hotload config file if it is a symlink #19

eddy-22 opened this issue Nov 21, 2017 · 10 comments

Comments

@eddy-22
Copy link

eddy-22 commented Nov 21, 2017

Great project! I'm on Mac OSX 10.11 and using skhd to control chunkwm.

If ~/.skhdrc is a symlink, then it can't hotload the config file, and I have to do brew services restart skhd to see the changes. If ~/.skhdrc is a regular file, hotloading works just fine.

@koekeishiya
Copy link
Owner

Will add support for this at some point. No ETA for now though.

@koekeishiya
Copy link
Owner

implemented support for symlinks on master.

@yurrriq
Copy link

yurrriq commented Aug 24, 2018

This does not seem to work when the symlink is relative, e.g. as created by GNU Stow.

@koekeishiya
Copy link
Owner

koekeishiya commented Aug 24, 2018

What's the expected behaviour when the symlink is relative? We have to pass the absolutepath to the FSEvents API.

My first assumption would be that we just prepend getenv("HOME") to the path returned by the symlink resolver if it is a relative symlink(?). I've never used GNU Stow and I don't know how it works.

Edit:
I think we can just replace the call to readlink with realpath and it should resolve relative symlinks as well.

@yurrriq
Copy link

yurrriq commented Aug 25, 2018

👍 to realpath, though I think in the GNU Stow case, prepending getenv("HOME") would work too. I'll try out your change and let you know how I fare. Thanks for the patch, and the project in general, and for chunkwm!

@yurrriq
Copy link

yurrriq commented Aug 25, 2018

e616840 seems to enable hotloading only if ~/.skhdrc is a real file or an absolute symlink on startup of skhd. After that, I can swap it for the relative symlink and everything works great.

@JeanMertz
Copy link

Is hotloading still supported on latest macOS?

I've installed skhd using Brew, and have the service running. Inspecting the launchctl plist shows hotloading isn't disabled, but editing my config file still does not update the running daemon.

skhd --reload works as expected.

My config is symlinked to $XDG_CONFIG_HOME/skhd/skhdrc (the result is an absolute symlink). The directory is symlinked, not the file itself.

@koekeishiya
Copy link
Owner

Hotloading is still a thing yes. I have not tested having an actual file in a symlinked directory, so that is probably why it is not working for you. You can run skhd with the --verbose flag and it should print the path to the file it resolved for the hotloader.

@JeanMertz
Copy link

JeanMertz commented Apr 2, 2020

Thanks for the pointer @koekeishiya. I suspect you are right that this use-case is unsupported.

This is what it prints:

skhd: watching files for changes:
	/Users/jean/.config/skhd/skhdrc

The /Users/jean/.config/skhd directory is symlinked from somewhere else. That implies that it starts watching the wrong file. If I edit that file, the edits take place in the original file, so no system events are sent to indicate that /Users/jean/.config/skhd is updated.

@kcrwfrd
Copy link

kcrwfrd commented Jul 6, 2020

Ran into this issue as well when I broke my .skhdrc up into multiple files.

I have my configuration tracked in a dotfiles repo:

~/.dotfiles/skhdrc/
~/.dotfiles/skhdrc/skhdrc
~/.dotfiles/skhdrc/window
~/.dotfiles/skhdrc/space
# ...

Symlinked like

ln -s ~/.dotfiles/skhdrc ~/.config/skhdrc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants