diff --git a/neofetch b/neofetch index 7742e91d..a22e4568 100755 --- a/neofetch +++ b/neofetch @@ -437,6 +437,16 @@ disk_subtitle="mount" # yarock music_player="auto" +# Format to display song information. +# +# Default: '%artist% - %album% - %title%' +# Values: '%artist%', '%album%', '%title%' +# Flag: --song_format +# +# Example: +# default: 'Song: Jet - Get Born - Sgt Major' +song_format="%artist% - %album% - %title%" + # Print the Artist and Title on separate lines # # Default: 'off' @@ -2486,18 +2496,20 @@ get_song() { *) mpc >/dev/null 2>&1 && song="$(mpc -f '%artist% ‡ %album% ‡ %title%' current)" ;; esac - [[ "$song" != *[a-z]* ]] && unset -v song + [[ "$song" != *[a-z]* ]] && { unset -v song; return; } + + LC_ALL="$sys_locale" IFS="‡" read -r artist album title <<< "$song" # Display Artist, Album and Title on separate lines. - if [[ "$song_shorthand" == "on" && "$song" ]]; then - LC_ALL="$sys_locale" IFS="‡" read -r artist album song <<< "$song" - + if [[ "$song_shorthand" == "on" ]]; then [[ "$(trim "$artist")" ]] && prin "Artist" "$artist" [[ "$(trim "$album")" ]] && prin "Album" "$album" - [[ "$(trim "$song")" ]] && prin "Song" "$song" + [[ "$(trim "$song")" ]] && prin "Song" "$title" + else + song="${song_format/\%artist\%/${artist}}" + song="${song/\%album\%/${album}}" + song="${song/\%title\%/${title}}" fi - - song="${song//‡/-}" } get_resolution() { @@ -4678,7 +4690,8 @@ INFO: 'dir' shows the basename of the disks's path. (/, Local Disk, etc) --ip_host url URL to query for public IP - --song_shorthand on/off Print the Artist/Title on separate lines + --song_format format Print the song data in a specific format (see config file). + --song_shorthand on/off Print the Artist/Album/Title on separate lines. --music_player player-name Manually specify a player to use. Available values are listed in the config file --install_time on/off Enable/Disable showing the time in Install Date output. @@ -4835,6 +4848,7 @@ get_args() { "--shell_path") shell_path="$2" ;; "--shell_version") shell_version="$2" ;; "--ip_host") public_ip_host="$2" ;; + "--song_format") song_format="$2" ;; "--song_shorthand") song_shorthand="$2" ;; "--music_player") music_player="$2" ;; "--install_time") install_time="$2" ;; diff --git a/neofetch.1 b/neofetch.1 index b0bcd8ac..44886a15 100644 --- a/neofetch.1 +++ b/neofetch.1 @@ -1,5 +1,5 @@ .\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.6. -.TH NEOFETCH "1" "May 2018" "Neofetch 3.4.1-git" "User Commands" +.TH NEOFETCH "1" "May 2018" "Neofetch 4.0.0-git" "User Commands" .SH NAME Neofetch \- A fast, highly customizable system info script .SH SYNOPSIS @@ -115,8 +115,11 @@ Takes: name, mount, dir \fB\-\-ip_host\fR url URL to query for public IP .TP +\fB\-\-song_format\fR format +Print the song data in a specific format (see config file). +.TP \fB\-\-song_shorthand\fR on/off -Print the Artist/Title on separate lines +Print the Artist/Album/Title on separate lines. .TP \fB\-\-music_player\fR player\-name Manually specify a player to use.