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

Feature: Reload config SIGUSR1 #4590

Open
nyarly opened this issue Dec 18, 2020 · 9 comments
Open

Feature: Reload config SIGUSR1 #4590

nyarly opened this issue Dec 18, 2020 · 9 comments

Comments

@nyarly
Copy link

nyarly commented Dec 18, 2020

It'd be very useful to me if Alacritty would reload its configuration on SIGUSR1 (as a first choice - other signals would be okay too)

My configuration management system (in this case home-manager) symlinks into a read-only mount. To do updates, I need to copy the file into place and alter that, which confuses the FS watch subsystem. With a signal, I could either trigger the update myself, or build my own fswatch tooling.

@nyarly nyarly changed the title Feature: Reload ckon SIGUSR1 Feature: Reload config SIGUSR1 Dec 18, 2020
@nyarly
Copy link
Author

nyarly commented Dec 18, 2020

I might have time to work on this over the holidays, but I'm by no means "claiming" this to work on.

@alarsyo
Copy link

alarsyo commented May 4, 2021

Possibly related to #2237, and in the case of home-manager the simple solution discussed in the other issue would work: watching both the symlink in the original config path, and the actual file, not every symlink in the chain.

jfly added a commit to jfly/dotfiles that referenced this issue Jun 30, 2021
@ncfavier
Copy link
Contributor

ncfavier commented Jul 7, 2021

This would be useful to me, any hints on how it should be implemented?

My attempt seems to mostly work but sometimes makes alacritty freeze completely after SIGUSR1.

(I am not a Rust programmer)

@alarsyo
Copy link

alarsyo commented Jul 7, 2021

@ncfavier your patch works great here, I couldn't get it to hang :/

could it be a problem with the config reload, not the handling of SIGUSR1 ?

Tested with:

alacritty --config-file config.yaml

and running this

#!/bin/sh

MY_PID=$1

while true; do
      ln -sf config1.yaml config.yaml
      kill -10 $MY_PID
      sleep 1
      ln -sf config2.yaml config.yaml
      kill -10 $MY_PID
      sleep 1
done

With two simple configuration files, changing font size between the two.

ncfavier added a commit to ncfavier/alacritty that referenced this issue Jul 7, 2021
@ncfavier
Copy link
Contributor

ncfavier commented Jul 7, 2021

Moved it to a PR.

ncfavier added a commit to ncfavier/alacritty that referenced this issue Jul 8, 2021
ncfavier added a commit to ncfavier/alacritty that referenced this issue Jul 8, 2021
ncfavier added a commit to ncfavier/alacritty that referenced this issue Jul 8, 2021
ncfavier added a commit to ncfavier/alacritty that referenced this issue Jul 8, 2021
ncfavier added a commit to ncfavier/alacritty that referenced this issue Jul 10, 2021
ncfavier added a commit to ncfavier/alacritty that referenced this issue Aug 3, 2021
ncfavier added a commit to ncfavier/alacritty that referenced this issue Aug 3, 2021
@ncfavier
Copy link
Contributor

ncfavier commented Dec 7, 2021

@nyarly does #5399 solve your initial problem?

@nyarly
Copy link
Author

nyarly commented Dec 7, 2021

It might? I haven't had a chance to test a source-build of it, and it hasn't been released on my distro yet.

@ncfavier
Copy link
Contributor

ncfavier commented Dec 7, 2021

It hasn't been released at all.

@nyarly
Copy link
Author

nyarly commented Dec 7, 2021

Huh. On Alactritty 0.8.0, my use case works now. I appreciate your work, but I think my specific issue was handled already.

For reference, I have:

#!/usr/bin/env fish

set config ~/.config/alacritty/alacritty.yml

set scheme solarized-light

if grep -q "^colors: [*]solarized-light" $config
  set scheme solarized-dark
end

# a script called: materialize-config $config
# inlined here:

test (count $argv) -eq 1; or exit 1
set -l path $argv[1]
test -L $path; and cp --remove-destination (readlink $path) $path
chmod u+w $path

sed -i.bak "s/^colors: *.*/colors: *$scheme/" $config

The materialize-config stuff is to address how home-manager works; honestly, it may be that I've done this once, and then started new terminals after that, so the watch issue isn't a problem until the next time I change my config in HM. I could probably also "materialize" this in a HM hook, since it has to happen if I'm going to change colorschemes anyway

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

Successfully merging a pull request may close this issue.

5 participants
@nyarly @ncfavier @chrisduerr @alarsyo and others