[scripts] beautified tms and fixed change-theme
This commit is contained in:
parent
f2da0e6ee5
commit
8226abf839
2 changed files with 56 additions and 29 deletions
|
@ -81,14 +81,16 @@ case $1 in
|
||||||
tmux_bar_focused_fg="#1d2021"
|
tmux_bar_focused_fg="#1d2021"
|
||||||
|
|
||||||
|
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.g.gruvbox_material_better_performance = 1<CR>' || true
|
for addr in $XDG_RUNTIME_DIR/nvim.*; do
|
||||||
echo "vim.g.gruvbox_material_better_performance = 1" > ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.g.gruvbox_material_better_performance = 1<CR>' || true
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.g.gruvbox_material_background = "hard"<CR>' || true
|
echo "vim.g.gruvbox_material_better_performance = 1" > ~/.config/nvim/lua/core/theme.lua
|
||||||
echo "vim.g.gruvbox_material_background = 'hard'" >> ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.g.gruvbox_material_background = "hard"<CR>' || true
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.g.gruvbox_material_foreground = "original"<CR>' || true
|
echo "vim.g.gruvbox_material_background = 'hard'" >> ~/.config/nvim/lua/core/theme.lua
|
||||||
echo "vim.g.gruvbox_material_foreground = 'original'" >> ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.g.gruvbox_material_foreground = "original"<CR>' || true
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.opt.background = "dark"<CR>' || true
|
echo "vim.g.gruvbox_material_foreground = 'original'" >> ~/.config/nvim/lua/core/theme.lua
|
||||||
echo "vim.opt.background = 'dark'" >> ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.opt.background = "dark"<CR>' || true
|
||||||
|
echo "vim.opt.background = 'dark'" >> ~/.config/nvim/lua/core/theme.lua
|
||||||
|
done
|
||||||
|
|
||||||
#Change kitty theme
|
#Change kitty theme
|
||||||
kitten themes --reload-in=all Gruvbox Dark
|
kitten themes --reload-in=all Gruvbox Dark
|
||||||
|
@ -106,14 +108,16 @@ case $1 in
|
||||||
tmux_bar_focused_fg="#f2e5bc"
|
tmux_bar_focused_fg="#f2e5bc"
|
||||||
|
|
||||||
|
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.g.gruvbox_material_better_performance = 1<CR>' || true
|
for addr in $XDG_RUNTIME_DIR/nvim.*; do
|
||||||
echo "vim.g.gruvbox_material_better_performance = 1" > ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.g.gruvbox_material_better_performance = 1<CR>' || true
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.g.gruvbox_material_background = "soft"<CR>' || true
|
echo "vim.g.gruvbox_material_better_performance = 1" > ~/.config/nvim/lua/core/theme.lua
|
||||||
echo "vim.g.gruvbox_material_background = 'soft'" >> ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.g.gruvbox_material_background = "soft"<CR>' || true
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.g.gruvbox_material_foreground = "original"<CR>' || true
|
echo "vim.g.gruvbox_material_background = 'soft'" >> ~/.config/nvim/lua/core/theme.lua
|
||||||
echo "vim.g.gruvbox_material_foreground = 'original'" >> ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.g.gruvbox_material_foreground = "original"<CR>' || true
|
||||||
nvim --server /tmp/nvim.pipe --remote-send ':lua vim.opt.background = "light"<CR>' || true
|
echo "vim.g.gruvbox_material_foreground = 'original'" >> ~/.config/nvim/lua/core/theme.lua
|
||||||
echo "vim.opt.background = 'light'" >> ~/.config/nvim/lua/core/theme.lua
|
nvim --server $addr --remote-send ':lua vim.opt.background = "light"<CR>' || true
|
||||||
|
echo "vim.opt.background = 'light'" >> ~/.config/nvim/lua/core/theme.lua
|
||||||
|
done
|
||||||
|
|
||||||
#Change kitty theme
|
#Change kitty theme
|
||||||
kitten themes --reload-in=all Gruvbox Light
|
kitten themes --reload-in=all Gruvbox Light
|
||||||
|
|
|
@ -1,33 +1,56 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
if [[ $# -eq 1 ]]; then
|
if [[ $# -eq 1 ]]; then
|
||||||
selected=$1
|
selected_path=$1
|
||||||
else
|
else
|
||||||
uni_projects=$(find ~/projects/University -mindepth 3 -maxdepth 3 -type d)
|
# Define commands dynamically with display names
|
||||||
personal_projects=$(find ~/projects/Personal -mindepth 1 -maxdepth 1 -type d)
|
|
||||||
work_projects=$(find ~/projects/Work -mindepth 1 -maxdepth 1 -type d)
|
declare -A commands=(
|
||||||
vaults=$(find ~/vaults -mindepth 2 -maxdepth 2 -type d)
|
["University"]="fd . ~/projects/University --exact-depth 3 --type d 2> /dev/null"
|
||||||
gits=$(find ~/gits -mindepth 1 -maxdepth 1 -type d)
|
["Personal"]="fd . ~/projects/Personal --exact-depth 1 --type d 2> /dev/null"
|
||||||
dotfiles=$(find ~/.config -mindepth 1 -maxdepth 1 -type d)
|
["Work"]="fd . ~/projects/Work --exact-depth 1 --type d 2> /dev/null"
|
||||||
#Merge the two lists
|
["Vaults"]="fd . ~/vaults --exact-depth 2 --type d 2> /dev/null"
|
||||||
selected=$(echo -e "$uni_projects\n$personal_projects\n$work_projects\n$dotfiles\n$gits\n$vaults" | fzf)
|
["Git Repositories"]="fd . ~/gits --exact-depth 1 --type d 2> /dev/null"
|
||||||
|
["Dotfiles"]="fd . ~/.config --exact-depth 1 --type d 2> /dev/null"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
# Initialize combined list
|
||||||
|
combined_list=""
|
||||||
|
|
||||||
|
for display_name in "${!commands[@]}"; do
|
||||||
|
command="${commands[$display_name]}"
|
||||||
|
result=$(eval $command | while read -r path; do
|
||||||
|
last_segment=$(basename "$path")
|
||||||
|
echo -e "$display_name > $last_segment\t$path"
|
||||||
|
done)
|
||||||
|
[[ -n "$result" ]] && combined_list+="$result\n"
|
||||||
|
done
|
||||||
|
|
||||||
|
selected=$(echo -e "$combined_list" | fzf --with-nth=1 --delimiter='\t' --prompt="Select a project: " \
|
||||||
|
--preview "eza --tree --level=2 --icons --color=always {2}" \
|
||||||
|
--preview-window=right:50%:wrap)
|
||||||
|
|
||||||
|
selected_path=$(echo "$selected" | awk -F'\t' '{print $2}')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -z $selected ]]; then
|
# Exit if no selection was made
|
||||||
|
if [[ -z $selected_path ]]; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
selected_name=$(basename "$selected" | tr . _)
|
# Prepare tmux session name
|
||||||
|
selected_name=$(basename "$selected_path" | tr . _)
|
||||||
selected_name=${selected_name^^}
|
selected_name=${selected_name^^}
|
||||||
tmux_running=$(pgrep tmux)
|
tmux_running=$(pgrep tmux)
|
||||||
|
|
||||||
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
if [[ -z $TMUX ]] && [[ -z $tmux_running ]]; then
|
||||||
tmux new-session -s $selected_name -c $selected
|
tmux new-session -s $selected_name -c "$selected_path"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! tmux has-session -t=$selected_name 2> /dev/null; then
|
if ! tmux has-session -t=$selected_name 2> /dev/null; then
|
||||||
tmux new-session -ds $selected_name -c $selected
|
tmux new-session -ds $selected_name -c "$selected_path"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tmux switch-client -t $selected_name
|
tmux switch-client -t $selected_name
|
||||||
|
|
Loading…
Add table
Reference in a new issue