Merge branch 'master' of www.alexselimov.com:aselimov/SelimovDE
This commit is contained in:
commit
a9e8b9329b
4 changed files with 116 additions and 61 deletions
|
@ -1,7 +1,66 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Script for changing between light and dark modes
|
NVIM_CONF="${HOME}/.config/nvim/init.lua"
|
||||||
if [ -f ~/.config/nvim/light_mode ]; then
|
GHOSTTY_CONF="${HOME}/.config/ghostty/config"
|
||||||
|
|
||||||
|
[ -f "$NVIM_CONF" ] || { echo "Missing $NVIM_CONF"; exit 1; }
|
||||||
|
[ -f "$GHOSTTY_CONF" ] || { echo "Missing $GHOSTTY_CONF"; exit 1; }
|
||||||
|
|
||||||
|
# Toggle Ghostty theme between zenwritten-dark and zenwritten-light
|
||||||
|
sed -E -i '' \
|
||||||
|
-e 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-dark/\1zenwritten-light/' \
|
||||||
|
-e 't' \
|
||||||
|
-e 's/^([[:space:]]*theme[[:space:]]*=[[:space:]]*)zenwritten-light/\1zenwritten-dark/' \
|
||||||
|
"$GHOSTTY_CONF"
|
||||||
|
|
||||||
|
# Toggle Neovim vim.g.light_mode true/false
|
||||||
|
sed -E -i '' \
|
||||||
|
-e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*)true/\1false/' \
|
||||||
|
-e 't' \
|
||||||
|
-e 's/(vim\.g\.light_mode[[:space:]]*=[[:space:]]*)false/\1true/' \
|
||||||
|
"$NVIM_CONF"
|
||||||
|
|
||||||
|
# Determine new mode from Ghostty theme
|
||||||
|
if grep -Eq '^\s*theme\s*=\s*zenwritten-light' "$GHOSTTY_CONF"; then
|
||||||
|
MODE="light"
|
||||||
|
else
|
||||||
|
MODE="dark"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Reload neovim theme
|
||||||
|
local keys
|
||||||
|
if [ "$MODE" = "light" ]; then
|
||||||
|
keys=$'<C-\\><C-n>:silent! let g:light_mode=1 | set background=light | doautocmd ColorScheme | redraw!<CR>'
|
||||||
|
else
|
||||||
|
keys=$'<C-\\><C-n>:silent! let g:light_mode=0 | set background=dark | doautocmd ColorScheme | redraw!<CR>'
|
||||||
|
fi
|
||||||
|
for dir in "${XDG_RUNTIME_DIR:-}" "${TMPDIR:-/tmp}" "/tmp" "$HOME/.local/state/nvim"; do
|
||||||
|
[ -d "$dir" ] || continue
|
||||||
|
find "$dir" -type s -name 'nvim*' 2>/dev/null | while read -r sock; do
|
||||||
|
if command -v timeout >/dev/null 2>&1; then
|
||||||
|
timeout 1s nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 || true
|
||||||
|
else
|
||||||
|
( nvim --server "$sock" --remote-send "$keys" >/dev/null 2>&1 & )
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
|
||||||
|
|
||||||
|
# Reload Ghostty: send SIGUSR2 to running ghostty processes (macOS/Linux)
|
||||||
|
if command -v pkill >/dev/null 2>&1; then
|
||||||
|
pkill -USR2 -x ghostty 2>/dev/null || true
|
||||||
|
elif command -v killall >/dev/null 2>&1; then
|
||||||
|
killall -USR2 ghostty 2>/dev/null || true
|
||||||
|
else
|
||||||
|
pids=$(pgrep -x ghostty 2>/dev/null || true)
|
||||||
|
[ -n "${pids:-}" ] && kill -USR2 $pids || true
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Switched to ${MODE} mode"
|
||||||
|
|
||||||
|
# Script for changing between light and dark modes on Linux
|
||||||
|
if [ "$(uname)" != "Darwin" ]; then
|
||||||
|
if [ "$MODE" == "dark" ]; then
|
||||||
echo "Swapping to dark mode"
|
echo "Swapping to dark mode"
|
||||||
# GTK Theme
|
# GTK Theme
|
||||||
sed -i -e 's@Net/ThemeName.*@Net/ThemeName "Orchis-Grey-Dark"@' ~/.xsettingsd
|
sed -i -e 's@Net/ThemeName.*@Net/ThemeName "Orchis-Grey-Dark"@' ~/.xsettingsd
|
||||||
|
@ -25,21 +84,18 @@ if [ -f ~/.config/nvim/light_mode ]; then
|
||||||
st*color13:#CF86C1
|
st*color13:#CF86C1
|
||||||
st*color14:#65B8C1
|
st*color14:#65B8C1
|
||||||
st*color15:#8e8e8e
|
st*color15:#8e8e8e
|
||||||
" > ~/.Xresources
|
" > ~/.Xresources
|
||||||
xrdb merge ~/.Xresources
|
xrdb merge ~/.Xresources
|
||||||
killall st -s "USR1"
|
killall st -s "USR1"
|
||||||
|
|
||||||
# Remove neovim colorscheme file
|
else
|
||||||
rm ~/.config/nvim/light_mode
|
|
||||||
|
|
||||||
else
|
|
||||||
echo "Swapping to light mode"
|
echo "Swapping to light mode"
|
||||||
# GTK Theme
|
# GTK Theme
|
||||||
sed -i -e 's@Net/ThemeName.*@Net/ThemeName "Orchis-Grey-Light"@' ~/.xsettingsd
|
sed -i -e 's@Net/ThemeName.*@Net/ThemeName "Orchis-Grey-Light"@' ~/.xsettingsd
|
||||||
# Rofi theme
|
# Rofi theme
|
||||||
sed -i -e "s/dark.rasi/light.rasi/" $HOME/.config/rofi/config.rasi
|
sed -i -e "s/dark.rasi/light.rasi/" $HOME/.config/rofi/config.rasi
|
||||||
|
|
||||||
# # Update ST colors
|
# # Update ST colors
|
||||||
echo " st*color0:#F0EDEC
|
echo " st*color0:#F0EDEC
|
||||||
st*color1:#A8334C
|
st*color1:#A8334C
|
||||||
st*color2:#4F6C31
|
st*color2:#4F6C31
|
||||||
|
@ -56,12 +112,10 @@ else
|
||||||
st*color13:#7B3B70
|
st*color13:#7B3B70
|
||||||
st*color14:#2B747C
|
st*color14:#2B747C
|
||||||
st*color15:#4F5E68
|
st*color15:#4F5E68
|
||||||
" > ~/.Xresources
|
" > ~/.Xresources
|
||||||
xrdb merge ~/.Xresources
|
xrdb merge ~/.Xresources
|
||||||
killall st -s "USR1"
|
killall st -s "USR1"
|
||||||
|
fi
|
||||||
|
|
||||||
# Add neovim colorscheme file
|
killall -HUP xsettingsd
|
||||||
touch ~/.config/nvim/light_mode
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
killall -HUP xsettingsd
|
|
||||||
|
|
|
@ -2,13 +2,12 @@
|
||||||
font-family = "IosevkaTermSlab Nerd Font Propo"
|
font-family = "IosevkaTermSlab Nerd Font Propo"
|
||||||
font-style = "Regular"
|
font-style = "Regular"
|
||||||
font-size = 13
|
font-size = 13
|
||||||
bold-color = "#fefefe"
|
|
||||||
background-opacity = 1.0
|
background-opacity = 1.0
|
||||||
window-decoration = none
|
window-decoration = none
|
||||||
|
|
||||||
# Auto light/dark theme pair that matches your two palettes below
|
# Auto light/dark theme pair that matches your two palettes below
|
||||||
#theme = dark:my-dark,light:my-light
|
#theme = dark:my-dark,light:my-light
|
||||||
theme = zenwritten-dark
|
theme = zenwritten-light
|
||||||
|
|
||||||
# Font-size keybindings (match Ctrl+Shift+j/k from WezTerm)
|
# Font-size keybindings (match Ctrl+Shift+j/k from WezTerm)
|
||||||
keybind = all:ctrl+shift+k=increase_font_size:1
|
keybind = all:ctrl+shift+k=increase_font_size:1
|
||||||
|
|
|
@ -5,6 +5,7 @@ cursor-color = #BBBBBB
|
||||||
cursor-text = #191919
|
cursor-text = #191919
|
||||||
selection-foreground = #191919
|
selection-foreground = #191919
|
||||||
selection-background = #BBBBBB
|
selection-background = #BBBBBB
|
||||||
|
bold-color = "#fefefe"
|
||||||
|
|
||||||
# ANSI 0..15
|
# ANSI 0..15
|
||||||
palette = 0=#191919
|
palette = 0=#191919
|
||||||
|
|
|
@ -5,6 +5,7 @@ cursor-color = #2c363c
|
||||||
cursor-text = #F0EDEC
|
cursor-text = #F0EDEC
|
||||||
selection-foreground = #F0EDEC
|
selection-foreground = #F0EDEC
|
||||||
selection-background = #2c363c
|
selection-background = #2c363c
|
||||||
|
bold-color = "#010101"
|
||||||
|
|
||||||
# ANSI 0..15
|
# ANSI 0..15
|
||||||
palette = 0=#F0EDEC
|
palette = 0=#F0EDEC
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue