From 720a4e6ca70eca1d23e60474dc73e80352ec6ef6 Mon Sep 17 00:00:00 2001 From: aleidk Date: Wed, 1 Nov 2023 11:58:07 -0300 Subject: [PATCH] Change music aliases for FZF script --- config/alacritty/alacritty.yml | 2 +- config/nvim/lua/aleidk/plugins/comments.lua | 2 +- config/zsh/aliases/aliases.zsh | 12 ---- scripts/check-tools | 68 +++++++++------------ scripts/fzf-player | 33 ++++++++++ 5 files changed, 63 insertions(+), 54 deletions(-) create mode 100755 scripts/fzf-player diff --git a/config/alacritty/alacritty.yml b/config/alacritty/alacritty.yml index 08f5a85..d650e28 100644 --- a/config/alacritty/alacritty.yml +++ b/config/alacritty/alacritty.yml @@ -108,7 +108,7 @@ window: # Font configuration font: normal: - family: JetBrainsMono NF + family: JetBrainsMono Nerd Font style: Regular bold: # family: JetBrainsMono NF diff --git a/config/nvim/lua/aleidk/plugins/comments.lua b/config/nvim/lua/aleidk/plugins/comments.lua index 62f1202..1e20a6b 100644 --- a/config/nvim/lua/aleidk/plugins/comments.lua +++ b/config/nvim/lua/aleidk/plugins/comments.lua @@ -28,7 +28,7 @@ return { -- left aligned fixed size box with left aligned text MAP({ "n", "v" }, "gcb", cb.lcbox, "Create a comment box") -- centered adapted box with centered text - MAP({ "n", "v" }, "gcl", cb.cline, "Create a comment line") + MAP({ "n", "v" }, "gll", cb.cline, "Create a comment line") end, }, } diff --git a/config/zsh/aliases/aliases.zsh b/config/zsh/aliases/aliases.zsh index 2a40130..4623e96 100644 --- a/config/zsh/aliases/aliases.zsh +++ b/config/zsh/aliases/aliases.zsh @@ -42,18 +42,6 @@ alias \ du3='dust --reverse --min-size 1M --depth 3' \ cat='bat'; -## Music Streams -lofi_url="https://youtu.be/jfKfPfyJRdk" -nintendo_url="https://www.youtube.com/c/Henriko/live" -synthwave_url="https://www.youtube.com/live/4xDzrJKXOOY?si=3WUrIe4TWLO-fw9m" -alias \ - music-lofi='mpv "$lofi_url" &>/dev/null &!' \ - music-lofi-bg='ts lofi -d "mpv --no-video $lofi_url"' \ - music-ninten='mpv "$nintendo_url" &>/dev/null &!' \ - music-ninten-bg='ts lofi -d "mpv --no-video $nintendo_url"' \ - music-synthwave='mpv "$synthwave_url" &>/dev/null &!' \ - music-synthwave-bg='ts lofi -d "mpv --no-video $synthwave_url"' - # Misc alias \ reload='exec $SHELL -l' \ diff --git a/scripts/check-tools b/scripts/check-tools index ede7e9d..4188c4d 100755 --- a/scripts/check-tools +++ b/scripts/check-tools @@ -1,40 +1,28 @@ #!/usr/bin/env bash -source "${DOOTS}/config/zsh/functions/colors.zsh" +source "${DOTS}/config/zsh/config/colors.zsh" define_colors -# r̶u̶s̶t̶ linux cli/tui tools and apps that i use -# ( -v" "-v" "-V" "-V" "-V" "-v" "--version" "--version" "-V" "-V" "-v" "-V" "-V" "--version") +# linux cli/tui tools and apps that i use declare -A tools tools=( - [alacritty]=" --version" - [atuin]="󰳗 --version" - [bat]="󰭟 --version" - [broot]="פּ --version" - [btop]=" --version" - [chafa]="󰈟 --version" - [cowsay]=" --version" - [cava]="󰺢 -v" - [delta]=" --version" - [dust]=" --version" - [exa]=" --version" - [fd]=" --version" - [foot]=" --version" - [fuck]="󰚌 --version" - [fzf]=" --version" - [git]=" --version" - [kitty]=" --version" - [librewolf]=" --version" - [lsd]=" --version" - [mpv]=" --version" - [pipes.sh]="ﳣ --version" - [neofetch]=" --version" - [nvim]=" --version" - [rg]=" --version" - [starship]="󱓞 --version" - [tldr]=" --version" - [tmux]=" -V" - [zsh]=" --version" + [alacritty]=" --version" + [bat]="󰭟 --version" + [btop]=" --version" + [dust]=" --version" + [exa]=" --version" + [fd]="--version" + [fzf]="c --version" + [git]=" --version" + [librewolf]=" --version" + [mpv]=" --version" + [neofetch]=" --version" + [nvim]=" --version" + [rg]=" --version" + [starship]="󱓞 --version" + [tldr]=" --version" + [tmux]=" -V" + [zsh]=" --version" ) mapfile -t sorted_tools < <(echo "${!tools[@]}" | tr ' ' '\n' | sort) @@ -42,9 +30,9 @@ printf "${BLD}%-18s %-10s %-10s\n" "Tools" "Status" "Version" printf "%s\n${RST}" "-----------------------------------------------" for tool in "${sorted_tools[@]}"; do - IFS=' ' read -r -a tool_data <<< "${tools[$tool]}" - if command -v "$tool" &> /dev/null; then - version=$("$tool" "${tool_data[1]}" 2> /dev/null | awk '{ + IFS=' ' read -r -a tool_data <<<"${tools[$tool]}" + if command -v "$tool" &>/dev/null; then + version=$("$tool" "${tool_data[1]}" 2>/dev/null | awk '{ for (i = 1; i <= NF; i++) { if ($i ~ /[0-9]+.[0-9]+([.][0-9]+)?/) { print $i; @@ -52,10 +40,10 @@ for tool in "${sorted_tools[@]}"; do } } }') - printf "${BLU}${tool_data[0]}${RST}${BLD} %-18s ${GRN}%-10s ${RST}${YLW}%-10s\n${RST}" \ - "$tool" "" "$version" - else - printf "${CYN}${tool_data[0]}${RST}${BLD} %-18s ${RED}%-10s ${BLK}%-10s\n${RST}" \ - "$tool" "" "command not found" - fi + printf "${BLU}${tool_data[0]}${RST}${BLD} %-18s ${GRN}%-10s ${RST}${YLW}%-10s\n${RST}" \ + "$tool" "" "$version" + else + printf "${CYN}${tool_data[0]}${RST}${BLD} %-18s ${RED}%-10s ${BLK}%-10s\n${RST}" \ + "$tool" "" "command not found" + fi done diff --git a/scripts/fzf-player b/scripts/fzf-player new file mode 100755 index 0000000..464649b --- /dev/null +++ b/scripts/fzf-player @@ -0,0 +1,33 @@ +#!/usr/bin/env bash + +# ╭──────────────────────────────────────────────────────────╮ +# │ Music Streams │ +# ╰──────────────────────────────────────────────────────────╯ + +# ──────────────────────────────────────────────────────────── +# Saved streams +declare -A streams + +streams[lofi]="https://youtu.be/jfKfPfyJRdk" +streams[nintendo]="https://www.youtube.com/c/Henriko/live" +streams[synthwave]="https://www.youtube.com/live/4xDzrJKXOOY?si=3WUrIe4TWLO-fw9m" + +# ──────────────────────────────────────────────────────────── + +# play passed url if provided +url="$1" +shift + +# defaults to celluloid, fallback to mpv +if command -v celluloid &>/dev/null; then + player="celluloid" +else + player="mpv --no-video" +fi + +if [[ -z "$url" ]]; then + url="$(printf "%s\n" "${!streams[@]}" | fzf)" + url="${streams[$url]}" +fi + +$player "$url"