Merge pull request #15 from barrett-ruth/feat/auto-theme.nvim

auto theme.nvim post
This commit is contained in:
Barrett Ruth 2025-11-29 02:40:58 -05:00 committed by GitHub
commit 15401ee1de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
12 changed files with 137 additions and 89 deletions

View file

@ -29,11 +29,26 @@
text-decoration: none;
cursor: pointer;
}
@media (max-width: 768px) {
@media (max-width: 1024px) {
footer {
flex-direction: row;
gap: 15px;
}
.footer-links-left,
.footer-links-right {
flex-direction: column;
gap: 5px;
gap: 15px;
}
}
@media (max-width: 640px) {
footer {
flex-direction: row;
flex-wrap: wrap;
}
.footer-links-left,
.footer-links-right {
flex-direction: row;
gap: 15px;
}
}
</style>

View file

@ -29,18 +29,22 @@ const promptText = topic ? `barrett@ruth:~$ ${topic}` : "barrett@ruth:~$";
cursor: pointer;
user-select: none;
}
@media (max-width: 768px) {
@media (max-width: 640px) {
header {
flex-direction: row;
flex-wrap: wrap;
justify-content: space-between;
gap: 10px;
}
.terminal-container {
flex: 1 1 auto;
min-width: 0;
}
.terminal-prompt {
font-size: 0.9em;
}
#theme-toggle {
flex: 0 0 auto;
font-size: 1.2em;
}
}
</style>

View file

@ -4,6 +4,47 @@ slug: "auto-theme.nvim"
date: "11/28/2025"
---
[Source code](https://github.com/barrett-ruth/auto-theme.nvim)
# the problem
wip
I toggle between light and dark mode at at around 17:00 every day. Resetting my environment and theme across all my applications was a pain.
I use my color scheme [midnight.nvim](/git/midnight.nvim.html) on macOS and linux with these applications:
1. [neovim](https://neovim.io/)
2. [ghostty](https://ghostty.org/)
3. [sioyek](https://sioyek.info/)
4. [ungoogled-chromium](https://github.com/ungoogled-software/ungoogled-chromium)
5. [swaywm](https://swaywm.org/)
6. [rofi](https://github.com/davatorium/rofi)
7. [tmux](https://github.com/tmux/tmux/wiki)
8. [fzf](https://github.com/junegunn/fzf)
9. [ripgrep](https://github.com/BurntSushi/ripgrep)
10. [zsh](https://www.zsh.org/)
# criteria for solution
I run or trigger _one command_--every application updates automatically.
The feasability of this depends on the underlying support software has for dynamic reloading of configuration. In many cases this is not possible.
# the solution
As of November 28, 2025, I've created [this script](https://github.com/barrett-ruth/dots/blob/main/scripts/theme) which is bound by a [karabiner](https://karabiner-elements.pqrs.org/) and [keyd](https://github.com/rvaiya/keyd) binding for macOS and linux, respectively.
## successes
1. neovim: I use my non-polling, macOS/linux-supporting automatic theme switcher [auto-theme.nvim](https://github.com/barrett-ruth/auto-theme.nvim)
2. ghostty: Ghostty supports [light and dark themes based on the system appearance](https://github.com/tmux/tmux/wiki)--easy.
3. sioyek: Any changes to user configuration are automatically reloaded--a script updates user preferences in-place
4. ungoogled-chromium: I folded and used the default system theme which automatically reads and updates according to the system environment
5. swaywm (linux): sway reads from a symlink'ed theme file `sed`ed, updated and reloaded by the script
6. rofi: `config.rasi` also reads from a symlink'ed theme files that is updated and reloaded by the script
7. tmux: `tmux.conf` reads from symlink'ed theme files that are automatically reloaded with `source-file`
## failures
Unfortunately, the following programs I've found nearly impossible to dynamically reload:
8. fzf: Overwriting fzf's themes, from the interactive shell `fzf` binary to `fzf-{cd,file}-widget` to integration with [fzf-lua](https://github.com/ibhagwan/fzf-lua/), I found this potentially doable but just _way too complex_. Feel free to investigate yourself--I'm going with the default theme.
9. ripgrep: I use the default theme. The ripgrep global configuration file does not support environment variables, exterminating the option to provide a `${THEME}`-based path in the global configuration file.
10. zsh: it's impossible to update `$THEME` across all existing shells (simply a limit of posix). However, all affected _programs_ will read the proper `$THEME`--I'm fine compromising here.

View file

@ -4,4 +4,4 @@ date: "07/10/2025"
slug: "barrettruth.com"
---
source code for this website
code for this website

View file

@ -4,8 +4,6 @@ slug: "cp.nvim"
date: "10/10/2025"
---
[Source code](https://github.com/barrett-ruth/cp.nvim)
Things have changed since I last documented my competitive programming setup [here](/software/my-cp-setup.html).
# my goals

View file

@ -4,10 +4,6 @@ slug: "midnight.nvim"
date: "8/11/2025"
---
[Source code](https://github.com/barrett-ruth/midnight.nvim)
neovim theme for code, not colors.
# motivation
# a theme for code, not colors
I was tired of all the over-engineered and distracting color schemes. I wrote this to focus on the code in competitive programming and workplace environments. I included highlighting of constants (e.g. strings, numbers, booleans) and language keywords to emphasize the maximally important aspects of code and its structure, respectively.

View file

@ -3,4 +3,4 @@ title: "sl"
date: "09/10/2025"
---
[archive](/meditations/suck-less-or-suck-more) of [suckless](https://suckless.org/) repositories
[archive](/meditations/suck-less-or-suck-more.html) of [suckless](https://suckless.org/) repositories

View file

@ -3,8 +3,6 @@ title: "my cp setup"
date: "15/04/2025"
---
Source code [here](https://github.com/barrett-ruth/dots/blob/main/nvim/lua/cp.lua).
# my goals
I wanted the following features in my competitive programming (cp) setup:

View file

@ -13,6 +13,7 @@ export async function getStaticPaths() {
const { repo } = Astro.props;
const { Content } = await repo.render();
const cloneCommand = `git clone https://git.barrettruth.com/${repo.slug}.git`;
const githubUrl = `https://github.com/barrett-ruth/${repo.slug}`;
---
<PostLayout frontmatter={repo.data} post={repo}>
@ -24,5 +25,8 @@ const cloneCommand = `git clone https://git.barrettruth.com/${repo.slug}.git`;
<code><span class="prompt">&gt;&nbsp;</span>{cloneCommand}</code>
</div>
<br />
<div><a href={githubUrl}>source code</a></div>
<Content />
</PostLayout>