Compare commits

...

2 Commits

Author SHA1 Message Date
5826e35853 chore(deps): update asdf tool-versions 2024-07-30 00:34:14 +03:00
e329868568 fix(bin): alacritty automatic theme changing 2024-07-30 00:22:07 +03:00
3 changed files with 12 additions and 7 deletions

View File

@@ -14,7 +14,7 @@ lazygit 0.43.1
neovim system neovim system
nodejs 22.5.1 nodejs 22.5.1
pipx 1.6.0 pipx 1.6.0
pre-commit 3.7.1 pre-commit 3.8.0
ripgrep 14.1.0 ripgrep 14.1.0
rust 1.79.0 rust 1.79.0
semgrep system semgrep system
@@ -22,7 +22,7 @@ shellcheck 0.10.0
shfmt 3.8.0 shfmt 3.8.0
terraform-ls 0.33.3 terraform-ls 0.33.3
terraform-lsp 0.0.12 terraform-lsp 0.0.12
terragrunt 0.64.0 terragrunt 0.64.2
tf-summarize 0.3.10 tf-summarize 0.3.10
vault 1.17.2+ent vault 1.17.2+ent
yamllint 1.35.1 yamllint 1.35.1

View File

@@ -71,7 +71,7 @@ darknotify_alacritty()
x-have dark-notify && { x-have dark-notify && {
# subprocess is used to prevent the command from showing it was backgrounded # subprocess is used to prevent the command from showing it was backgrounded
( (
silent flock /tmp/dark-notify-alacritty.lock dark-notify \ flock /tmp/dark-notify-alacritty.lock dark-notify \
-c "$HOME/.dotfiles/local/bin/x-change-alacritty-theme" & -c "$HOME/.dotfiles/local/bin/x-change-alacritty-theme" &
) &> /dev/null ) &> /dev/null
} }

View File

@@ -14,7 +14,7 @@ A_DIR="$HOME/.config/alacritty"
usage() usage()
{ {
echo "Usage: $0 <theme>" echo "Usage: $0 <theme>"
echo "Available themes: dark, night, day" echo "Available themes: (dark|night) to turn dark mode on, (day|light) to turn off"
exit 1 exit 1
} }
@@ -23,6 +23,7 @@ usage()
msg() msg()
{ {
[[ "$VERBOSE" -eq 1 ]] && echo "$1" [[ "$VERBOSE" -eq 1 ]] && echo "$1"
return 0
} }
# Function to set the alacritty theme # Function to set the alacritty theme
@@ -30,8 +31,10 @@ msg()
set_alacritty_theme() set_alacritty_theme()
{ {
local theme=$1 local theme=$1
msg "Setting alacritty theme to $theme" local theme_file="$A_DIR/theme-$theme.toml"
cp -f "$A_DIR/theme-$theme.toml" "$A_DIR/theme-active.toml" msg "Setting alacritty theme to $theme ($theme_file)"
cp -f "$theme_file" "$A_DIR/theme-active.toml"
return 0
} }
# Function to notify alacritty about the changes # Function to notify alacritty about the changes
@@ -39,6 +42,7 @@ notify_alacritty()
{ {
msg "Notifying alacritty about the changes" msg "Notifying alacritty about the changes"
touch "$A_DIR/alacritty.toml" touch "$A_DIR/alacritty.toml"
return 0
} }
# Main function # Main function
@@ -51,7 +55,7 @@ main()
local alacritty_theme=$1 local alacritty_theme=$1
case "$alacritty_theme" in case "$alacritty_theme" in
day) day | light)
set_alacritty_theme "day" set_alacritty_theme "day"
;; ;;
*) *)
@@ -61,6 +65,7 @@ main()
notify_alacritty notify_alacritty
msg "Theme set successfully!" msg "Theme set successfully!"
exit 0
} }
main "$@" main "$@"