diff --git a/bin/pping.sh b/bin/pping.sh new file mode 100755 index 0000000..78bd7df --- /dev/null +++ b/bin/pping.sh @@ -0,0 +1,21 @@ + function _ping() { + local url="$1" + local ping_output=$(ping -c 1 $url 2>/dev/null | sed -n '2p') + if [[ $ping_output =~ time=([0-9.]+) ]]; then + + local ping_time=${BASH_REMATCH[1] } + ping_time=$(echo "$ping_time" | tr -d ',' | awk -F '.' '{print $1}') + echo ' '"${url}" "${ping_time}ms" + else + echo ' '"${url}" "Error" + fi + } + +# Comprobamos si se ha proporcionado la ciudad como argumento +if [ -z "$1" ]; then + echo "Por favor, proporciona el nombre de la ciudad como argumento." + exit 1 +fi + + result=$(_ping "$1") + echo $result \ No newline at end of file diff --git a/bin/spotify.scpt b/bin/spotify.scpt new file mode 100644 index 0000000..3751ed1 --- /dev/null +++ b/bin/spotify.scpt @@ -0,0 +1,11 @@ +if application "Spotify" is running then + tell application "Spotify" + set theName to name of the current track + set theArtist to artist of the current track + set theAblum to album of the current track + try + return "♫ " & theName & " - " & theArtist + on error err + end try + end tell +end if \ No newline at end of file diff --git a/bin/weather.sh b/bin/weather.sh new file mode 100755 index 0000000..ec85cd6 --- /dev/null +++ b/bin/weather.sh @@ -0,0 +1,22 @@ +#!/bin/bash +#v1.0 + +get_weather() { + local city="$1" + local url="wttr.in/$city?format=%c%t%20%h%20%p%20" + local weather_output=$(curl -s "$url") + echo "$weather_output" +} + +# Comprobamos si se ha proporcionado la ciudad como argumento +if [ -z "$1" ]; then + echo "Por favor, proporciona el nombre de la ciudad como argumento." + exit 1 +fi + +# Llamamos a la función pasando la ciudad proporcionada como argumento +result=$(get_weather "$1") + +# Imprimimos el resultado +#echo "Pronóstico del tiempo en $1:" +echo "$result" diff --git a/img/nord_status.png b/img/nord_status.png new file mode 100644 index 0000000..be1918e Binary files /dev/null and b/img/nord_status.png differ diff --git a/nord.tmux b/nord.tmux index 3da21a0..a71c8a9 100755 --- a/nord.tmux +++ b/nord.tmux @@ -5,6 +5,8 @@ NORD_TMUX_COLOR_THEME_FILE=src/nord.conf NORD_TMUX_VERSION=0.3.0 NORD_TMUX_STATUS_CONTENT_FILE="src/nord-status-content.conf" NORD_TMUX_STATUS_CONTENT_NO_PATCHED_FONT_FILE="src/nord-status-content-no-patched-font.conf" +# NORD_TMUX_STATUS_CONTENT_SPOTIFY_SCRIPT="bin/spotify.scpt" +# NORD_TMUX_STATUS_SHOW_SPOTIFY="@nord_tmux_show_spotify" NORD_TMUX_STATUS_CONTENT_OPTION="@nord_tmux_show_status_content" NORD_TMUX_STATUS_CONTENT_DATE_FORMAT="@nord_tmux_date_format" NORD_TMUX_NO_PATCHED_FONT_OPTION="@nord_tmux_no_patched_font" @@ -15,10 +17,12 @@ __cleanup() { unset -v NORD_TMUX_STATUS_CONTENT_FILE NORD_TMUX_STATUS_CONTENT_NO_PATCHED_FONT_FILE unset -v NORD_TMUX_STATUS_CONTENT_OPTION NORD_TMUX_NO_PATCHED_FONT_OPTION unset -v NORD_TMUX_STATUS_CONTENT_DATE_FORMAT +# unset -v NORD_TMUX_STATUS_CONTENT_SPOTIFY_SCRIPT NORD_TMUX_STATUS_SHOW_SPOTIFY unset -v _current_dir unset -f __load __cleanup tmux set-environment -gu NORD_TMUX_STATUS_TIME_FORMAT tmux set-environment -gu NORD_TMUX_STATUS_DATE_FORMAT +# tmux set-environment -gu NORD_TMUX_STATUS_SHOW_SPOTIFY } __load() { @@ -27,6 +31,9 @@ __load() { local status_content=$(tmux show-option -gqv "$NORD_TMUX_STATUS_CONTENT_OPTION") local no_patched_font=$(tmux show-option -gqv "$NORD_TMUX_NO_PATCHED_FONT_OPTION") local date_format=$(tmux show-option -gqv "$NORD_TMUX_STATUS_CONTENT_DATE_FORMAT") + # local show_spotify=$(tmux show-option -gqv "$NORD_TMUX_STATUS_SHOW_SPOTIFY") + # local os_type=$(uname) + # local spotify_song=$(osascript $_current_dir/$NORD_TMUX_STATUS_CONTENT_SPOTIFY_SCRIPT) if [ "$(tmux show-option -gqv "clock-mode-style")" == '12' ]; then tmux set-environment -g NORD_TMUX_STATUS_TIME_FORMAT "%I:%M %p" @@ -40,6 +47,23 @@ __load() { tmux set-environment -g NORD_TMUX_STATUS_DATE_FORMAT "$date_format" fi +# :() +# It only runs once, doesn't update when changing the track on Spotify, the idea is abandoned. +# if [ "$show_spotify" != "0" ]; then # show song +# if [ "$os_type" = "Darwin" ]; then # os type +# if ! [ -z "$spotify_song" ]; then # playing song +# tmux set-environment -g NORD_TMUX_STATUS_SPOTIFY "$spotify_song" +# else +# tmux set-environment -g NORD_TMUX_STATUS_SPOTIFY "" #music off +# fi +# else +# tmux set-environment -g NORD_TMUX_STATUS_SPOTIFY "Sorry, only macOS plugin" #show message +# fi +# else +# tmux set-environment -g NORD_TMUX_STATUS_SPOTIFY "♫" #no show +# fi + + if [ "$status_content" != "0" ]; then if [ "$no_patched_font" != "1" ]; then tmux source-file "$_current_dir/$NORD_TMUX_STATUS_CONTENT_FILE" diff --git a/readme.md b/readme.md index 92de3e5..d90966e 100644 --- a/readme.md +++ b/readme.md @@ -47,6 +47,19 @@
+ +## Personalization +* Display currently playing track: The script can retrieve and display information about the currently playing track on Spotify, such as the song name, artist, and album. +* Display weather: wttr.in is a popular open-source weather service that provides weather information. +* Pomodoro timer can be a great way to manage your time effectively while working on tasks or projects. + +
+
+
+
+