-
Notifications
You must be signed in to change notification settings - Fork 3.1k
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
Be able to switch color theme when system switches to darkmode #5999
Comments
The config supports live-reload. You're free to switch your theme whenever you want, however you want. |
I know that the config has live reload, that's not what meant. @chrisduerr
I meant that you would be able to configure a light and a dark theme in the config, and that alacritty would automatically choose depending on whether your system is in dark mode or light mode. |
There is no desire to add this. Again the existing mechanisms are sufficient. |
I just expressed that desire. Why can't this be an open feature request? I don't mean to sound rude, I just don't understand your reasoning. |
Because I don't want it to be one. |
wow. |
I've found that wezterm is able to to this @ferologics in case you're interested in this feature |
@chtenb i think i'm just gonna go with the stock terminal app, the friction with setting up something custom is becoming too painful to justify for. |
but thx |
@ferologics That makes sense, it can be quite a hassle :) If you ever feel like tweaking your setup again feel free to steal my config at https://github.com/chtenb/dotfiles/blob/master/wezterm.lua as a first start. |
+1 |
How do we use these? Do we have to run a separate script to check whether the system theme is light or dark? That script would then change the Alacritty config and prompt it to reload? Is that the idea? Would you accept a patch that adds this feature to Alacritty? What about a patch to add a small bash script that does the above? This is a really useful feature, so we really should have a way for users to do it easily. Thank you for your work on Alacritty! |
There are plenty resources available online on how to switch themes globally or hook to system theme switching and run arbitrary scripts, alacritty is not a separate citizen here, since you have to do the same for your terminal editor if you're using light/dark themes in it, etc. For alacritty you can have your themes in separate files and import the one you need (import section in the config), the config is live reloaded so it'll be picked up right away. it's really nothing special here. |
I would love such a feature as well ! in the meantime, could someone put me in the right direction in order to create a bash script that would hook to system theme switching and run something like
I've searched on the internet, but the closest topic I've found to achieve that is a one related to Emacs : https://emacs.stackexchange.com/questions/55417/change-theme-when-os-dark-mode-changes I'm using Manjaro with Gnome |
On gnome you'd need to hook to dbus monitor stuff and look for changes on
There're also some portal, but it's in dbus all. |
I greatly appreciate your help, many of us are using custom terminal emulators for the first time and don't know the nomenclature needed to find the solution online. Would you mind providing links to the "plenty resources available online"? |
+1 for this feature. I switch my system between light and dark occasionally, and almost every app follows, except for Alacritty |
In short, yes. |
While this feature isn't a dealbreaker, there is a notable dearth of documentation and general unfriendliness of the alacritty configuration system. It's not the first time I've tried to configure Alacritty and haven't been able to get very far after weeks of searching. Until alacritty's documentation improves to better show how to configure it, I'm switching to https://github.com/wez/wezterm |
I made a quick rust-based service to do this for my personal config files. It is written specifically for my config files, but feel free to base your own solutions off of it if you'd like 😄 |
I just came across alacritty due to a recommendation, but this sort of response will make me look elsewhere. Sorry for the off-topic. Surely, you are free to do what you want and somebody can still fork and implement it on their own, but it's still such a rude response. |
Such a rude response requires at least a quick & dirty solution for all the poor souls that stumble upon this thread. Requirements:
Add this to your crontab ( * * * * * /path/to/alacritty-themes "$(/bin/test $(/path/to/dark-mode status) = off && /bin/echo Brewer.light || /bin/echo Brewer.dark)" Don't forget to adapt your full paths ( |
Sorry to necropost. That said, we shouldn't assert that this functionality already exists. You must run a daemon alongside the terminal to follow the standard system theming behavior. That's not remotely part of Alacritty. By this logic, you state that Alacritty supports any feature, as a user can write a program with that feature. It'd be better to say that you don't plan to implement this feature and its functionality doesn't exist. In addition, I'd suggest maintaining a list of unplanned features (or perhaps a GitHub Issues tag) so users don't get their hopes up. Seeing this issue closed, I assumed that Alacritty had implemented it already! 😖️ |
So you say I should rather try wezterm? |
Because of the attitude? Maybe. Because of night mode? No, you can hack your way around it, even with the new version that has deprecated YAML in favour of TOML. |
For some reason I hate how unreliable string parsing with sed or equivalents can be, and I would not do these rituals described above personally... but there's always another way. I did clone https://github.com/alacritty/alacritty-theme
I did add to my import = [
"~/.config/alacritty/themes/themes/_active.toml"
] And I did add the following to my alias aladark="ln -fs ~/.config/alacritty/themes/themes/one_dark.toml ~/.config/alacritty/themes/themes/_active.toml"
alias alalight="ln -fs ~/.config/alacritty/themes/themes/pencil_light.toml ~/.config/alacritty/themes/themes/_active.toml"
func alatheme() {
ln -fs ~/.config/alacritty/themes/themes/$1.toml ~/.config/alacritty/themes/themes/_active.toml
} Works like a charm, I just switch on demand running |
Very good idea, thanks @dee-kryvenko! I did some extra work to make it slightly more automated. I added to my [env]
ALACRITTY = "true" And then I added to my if [ "$ALACRITTY" = "true" ]
then
theme() {
ln -sf $HOME/.config/alacritty/themes/themes/$1.toml $HOME/.config/alacritty/active.toml
}
local ALACRITTY_THEME=$(defaults read -g AppleInterfaceStyle 2>/dev/null || echo "Light")
if [ "$ALACRITTY_THEME" = "Dark" ]
then
theme "github_dark"
else
theme "github_light"
fi
fi Now Alacritty can automatically switch the theme when it starts! I have written a gist for the whole step: https://gist.github.com/xqm32/17777d035930d622d0ff7530bfab61fd |
I have always used the following two functions in my function dark() {
ln -fs ~/.config/alacritty/themes/catppuccin-frappe.yml ~/.config/alacritty/themes/_active.yml
touch ~/.config/alacritty/alacritty.yml
}
function light() {
ln -fs ~/.config/alacritty/themes/catppuccin-latte.yml ~/.config/alacritty/themes/_active.yml
touch ~/.config/alacritty/alacritty.yml
} in alacritty config the simlink is imported
since the config file is touched, alacritty auto loads after the function executes. |
Got it working with home-manager + darkman based on #5999 (comment):
And, I have my themes within my |
Woaw that answer from alacritty dev is really poor! |
Nice, just uninstalled Alacritty after reading this, we have iTerm, WezTerm, Kitty and many more open source ones to choose from. |
OK, well that sucks. I've been using alacritty for years, but guess might as well switch to another terminal. As an OSS maintainer myself, I'd never condone being this rude to the community, even as a "benevolent dictator". ick. |
I have my system setup in a way that it switches to and from darkmode based on the time of day. Most applications are able to detect this and be configured to switch to and from a dark color theme. Can alacritty support this as well?
The text was updated successfully, but these errors were encountered: