diff options
Diffstat (limited to 'X11/mpd')
-rw-r--r-- | X11/mpd/ncmpcpp/.gitignore | 1 | ||||
-rw-r--r-- | X11/mpd/ncmpcpp/bindings | 46 | ||||
-rw-r--r-- | X11/mpd/ncmpcpp/config | 95 | ||||
-rw-r--r-- | X11/mpd/ncmpcpp/config.bak | 66 | ||||
-rwxr-xr-x | X11/mpd/ncmpcpp/cover.sh | 18 | ||||
-rwxr-xr-x | X11/mpd/ncmpcpp/cover_obs.sh | 21 | ||||
-rw-r--r-- | X11/mpd/ncmpcpp/default_cover.png | bin | 0 -> 42425 bytes | |||
-rwxr-xr-x | X11/mpd/ncmpcpp/scripts/album-art | 248 | ||||
-rw-r--r-- | X11/mpd/ncmpcpp/scripts/music.png | bin | 0 -> 113344 bytes | |||
-rwxr-xr-x | X11/mpd/ncmpcpp/scripts/ncmpcpp-art | 22 | ||||
-rw-r--r-- | X11/mpd/ncmpcpp/tsession | 32 |
11 files changed, 549 insertions, 0 deletions
diff --git a/X11/mpd/ncmpcpp/.gitignore b/X11/mpd/ncmpcpp/.gitignore new file mode 100644 index 0000000..397b4a7 --- /dev/null +++ b/X11/mpd/ncmpcpp/.gitignore | |||
@@ -0,0 +1 @@ | |||
*.log | |||
diff --git a/X11/mpd/ncmpcpp/bindings b/X11/mpd/ncmpcpp/bindings new file mode 100644 index 0000000..d035f7f --- /dev/null +++ b/X11/mpd/ncmpcpp/bindings | |||
@@ -0,0 +1,46 @@ | |||
1 | # the t key isn't used and it's easier to press than /, so lets use it | ||
2 | def_key "t" | ||
3 | find | ||
4 | def_key "t" | ||
5 | find_item_forward | ||
6 | |||
7 | def_key "+" | ||
8 | show_clock | ||
9 | def_key "=" | ||
10 | volume_up | ||
11 | |||
12 | def_key "j" | ||
13 | scroll_down | ||
14 | def_key "k" | ||
15 | scroll_up | ||
16 | |||
17 | def_key "ctrl-u" | ||
18 | page_up | ||
19 | def_key "ctrl-d" | ||
20 | page_down | ||
21 | |||
22 | def_key "h" | ||
23 | previous_column | ||
24 | def_key "l" | ||
25 | next_column | ||
26 | |||
27 | def_key "." | ||
28 | show_lyrics | ||
29 | |||
30 | def_key "n" | ||
31 | next_found_item | ||
32 | def_key "N" | ||
33 | previous_found_item | ||
34 | |||
35 | def_key "J" | ||
36 | move_sort_order_down | ||
37 | def_key "K" | ||
38 | move_sort_order_up | ||
39 | |||
40 | def_key "g" | ||
41 | move_home | ||
42 | def_key "G" | ||
43 | move_end | ||
44 | |||
45 | def_key "0" | ||
46 | replay_song | ||
diff --git a/X11/mpd/ncmpcpp/config b/X11/mpd/ncmpcpp/config new file mode 100644 index 0000000..e818015 --- /dev/null +++ b/X11/mpd/ncmpcpp/config | |||
@@ -0,0 +1,95 @@ | |||
1 | ## Copyright (C) 2020-2021 Aditya Shakya <adi1090x@gmail.com> | ||
2 | ## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 | ||
3 | |||
4 | ### Directories ### | ||
5 | ncmpcpp_directory = ~/.config/ncmpcpp/ | ||
6 | lyrics_directory = ~/.config/ncmpcpp/lyrics | ||
7 | mpd_music_dir = ~/Music | ||
8 | mpd_host = "localhost" | ||
9 | mpd_port = "6600" | ||
10 | mpd_crossfade_time = "2" | ||
11 | |||
12 | ### Script ### | ||
13 | #execute_on_song_change="~/.config/ncmpcpp/scripts/album-art" | ||
14 | #execute_on_song_change = "~/.ncmpcpp/cover_obs.sh" | ||
15 | |||
16 | ### Behaviour ### | ||
17 | message_delay_time = 1 | ||
18 | autocenter_mode = "yes" | ||
19 | centered_cursor = "yes" | ||
20 | ignore_leading_the = "yes" | ||
21 | playlist_disable_highlight_delay = 2 | ||
22 | allow_for_physical_item_deletion = "no" | ||
23 | |||
24 | ### Visualizer ### | ||
25 | #visualizer_data_source = /tmp/mpd.fifo | ||
26 | #visualizer_output_name = "mpd_visualizer" | ||
27 | #visualizer_in_stereo = "yes" | ||
28 | #visualizer_look = " " | ||
29 | visualizer_type = "spectrum" | ||
30 | |||
31 | ### Appearance ### | ||
32 | playlist_display_mode = "columns" | ||
33 | colors_enabled = "yes" | ||
34 | #user_interface = classic | ||
35 | user_interface = alternative | ||
36 | volume_color = "white" | ||
37 | |||
38 | ### Window ### | ||
39 | song_window_title_format = "Music Player" | ||
40 | #song_window_title_format = "{%a - }{%t}|{%f}" | ||
41 | statusbar_visibility = "no" | ||
42 | header_visibility = "no" | ||
43 | titles_visibility = "yes" | ||
44 | |||
45 | ### Progress bar ### | ||
46 | progressbar_look = "▂▂▂" | ||
47 | progressbar_color = "black" | ||
48 | progressbar_elapsed_color = "yellow" | ||
49 | |||
50 | ### Alternative UI ### | ||
51 | alternative_ui_separator_color = "blue" | ||
52 | alternative_header_first_line_format = $b$5$/b $b$8{%t}|{%f}$/b $/b | ||
53 | alternative_header_second_line_format = {$b{$2 %a$9}{ - $7 %b$9}{ ($2%y$9)}}|{%D} | ||
54 | |||
55 | ### Song list ### | ||
56 | song_status_format = "$7%t" | ||
57 | song_list_format = " $4%t$9 $7$R%a$9 $2%l$9 " | ||
58 | song_library_format = {{%a - %t} (%b)}|{%f} | ||
59 | song_columns_list_format = "(35)[blue]{t} (30)[green]{a} (6)[cyan]{lr}" | ||
60 | |||
61 | ### Colors ### | ||
62 | main_window_color = "blue" | ||
63 | state_line_color = "black" | ||
64 | current_item_prefix = "$(blue)$r" | ||
65 | current_item_suffix = "$/r$(end)" | ||
66 | current_item_inactive_column_prefix = red | ||
67 | current_item_inactive_column_suffix = red | ||
68 | now_playing_prefix = "$4 " | ||
69 | selected_item_prefix = "* " | ||
70 | |||
71 | color1 = "white" | ||
72 | color2 = "red" | ||
73 | |||
74 | ### Layout ### | ||
75 | startup_screen = visualizer | ||
76 | startup_slave_screen = playlist | ||
77 | startup_slave_screen_focus = yes | ||
78 | locked_screen_width_part = 25 | ||
79 | |||
80 | ### Misc ### | ||
81 | default_place_to_search_in = "database" | ||
82 | |||
83 | display_bitrate = "no" | ||
84 | enable_window_title = "yes" | ||
85 | follow_now_playing_lyrics = "yes" | ||
86 | empty_tag_marker = "" | ||
87 | |||
88 | cyclic_scrolling = "yes" | ||
89 | header_text_scrolling = "yes" | ||
90 | jump_to_now_playing_song_at_start = "yes" | ||
91 | lines_scrolled = "2" | ||
92 | |||
93 | system_encoding = "utf-8" | ||
94 | regular_expressions = "extended" | ||
95 | |||
diff --git a/X11/mpd/ncmpcpp/config.bak b/X11/mpd/ncmpcpp/config.bak new file mode 100644 index 0000000..eb3fff6 --- /dev/null +++ b/X11/mpd/ncmpcpp/config.bak | |||
@@ -0,0 +1,66 @@ | |||
1 | ## Copyright (C) 2020-2021 Aditya Shakya <adi1090x@gmail.com> | ||
2 | ## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 | ||
3 | |||
4 | ### Directories ### | ||
5 | ncmpcpp_directory = ~/.ncmpcpp | ||
6 | lyrics_directory = ~/.ncmpcpp/lyrics | ||
7 | mpd_music_dir = ~/Music | ||
8 | mpd_host = "localhost" | ||
9 | mpd_port = "6600" | ||
10 | mpd_crossfade_time = "2" | ||
11 | |||
12 | ### Script ### | ||
13 | execute_on_song_change = "kunst --size 60x60 --silent" | ||
14 | |||
15 | ### Behaviour ### | ||
16 | message_delay_time = 1 | ||
17 | autocenter_mode = "yes" | ||
18 | centered_cursor = "yes" | ||
19 | ignore_leading_the = "yes" | ||
20 | playlist_disable_highlight_delay = 2 | ||
21 | allow_for_physical_item_deletion = "no" | ||
22 | |||
23 | ### Visualizer ### | ||
24 | visualizer_data_source = /tmp/mpd.fifo | ||
25 | visualizer_output_name = "mpd_visualizer" | ||
26 | visualizer_in_stereo = "yes" | ||
27 | visualizer_look = ●● | ||
28 | visualizer_type = "ellipse" | ||
29 | |||
30 | ### Appearance ### | ||
31 | playlist_display_mode = "columns" | ||
32 | colors_enabled = "yes" | ||
33 | #user_interface = classic | ||
34 | user_interface = alternative | ||
35 | volume_color = "white" | ||
36 | |||
37 | ### Window ### | ||
38 | song_window_title_format = "{%a - }{%t}|{%f}" | ||
39 | statusbar_visibility = "no" | ||
40 | header_visibility = "no" | ||
41 | titles_visibility = "no" | ||
42 | |||
43 | ### Progress bar ### | ||
44 | progressbar_look = "▂▂▂" | ||
45 | progressbar_color = "black" | ||
46 | progressbar_elapsed_color = "yellow" | ||
47 | |||
48 | ### Alternative UI ### | ||
49 | alternative_ui_separator_color = "black" | ||
50 | alternative_header_first_line_format = $b$5$/b $b$8{%t}|{%f}$/b $/b | ||
51 | alternative_header_second_line_format = {$b{$2 %a$9}{ - $7 %b$9}{ ($2%y$9)}}|{%D} | ||
52 | |||
53 | ### Song list ### | ||
54 | song_status_format = "$7%t" | ||
55 | song_list_format = " %t $R%a %l " | ||
56 | song_library_format = {{%a - %t} (%b)}|{%f} | ||
57 | song_columns_list_format = "(53)[white]{tr} (45)[blue]{a}" | ||
58 | |||
59 | ### Colors ### | ||
60 | main_window_color = "blue" | ||
61 | current_item_prefix = "$(blue)$r" | ||
62 | current_item_suffix = "$/r$(end)" | ||
63 | current_item_inactive_column_prefix = red | ||
64 | current_item_inactive_column_suffix = red | ||
65 | color1 = "white" | ||
66 | color2 = "red" | ||
diff --git a/X11/mpd/ncmpcpp/cover.sh b/X11/mpd/ncmpcpp/cover.sh new file mode 100755 index 0000000..8fe8d4d --- /dev/null +++ b/X11/mpd/ncmpcpp/cover.sh | |||
@@ -0,0 +1,18 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | source "`ueberzug library`" | ||
4 | COVER="/tmp/album_cover.png" | ||
5 | |||
6 | function add_cover { | ||
7 | ImageLayer::add [identifier]="img" [x]="2" [y]="1" [path]="$COVER" | ||
8 | } | ||
9 | |||
10 | ImageLayer 0< <( | ||
11 | if [ ! -f "$COVER" ]; then | ||
12 | cp "$HOME/.ncmpcpp/default_cover.png" "$COVER" | ||
13 | fi | ||
14 | #rerender image when changed | ||
15 | while inotifywait -q -q -e close_write "$COVER"; do | ||
16 | add_cover | ||
17 | done | ||
18 | ) | ||
diff --git a/X11/mpd/ncmpcpp/cover_obs.sh b/X11/mpd/ncmpcpp/cover_obs.sh new file mode 100755 index 0000000..032bd08 --- /dev/null +++ b/X11/mpd/ncmpcpp/cover_obs.sh | |||
@@ -0,0 +1,21 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | COVER="/tmp/album_cover.png" | ||
4 | COVER_SIZE="400" | ||
5 | |||
6 | #path to current song | ||
7 | file="$MUSIC_DIR/$(mpc --format %file% current)" | ||
8 | album="${file%/*}" | ||
9 | #search for cover image | ||
10 | #use embedded image if present, otherwise take it from the current folder | ||
11 | err=$(ffmpeg -loglevel 16 -y -i "$file" -an -vcodec copy $EMB_COVER 2>&1) | ||
12 | if [ "$err" != "" ]; then | ||
13 | art=$(find "$album" -maxdepth 1 | grep -m 1 ".*\.\(jpg\|png\|gif\|bmp\)") | ||
14 | else | ||
15 | art=$EMB_COVER | ||
16 | fi | ||
17 | if [ "$art" = "" ]; then | ||
18 | art="$HOME/.ncmpcpp/default_cover.png" | ||
19 | fi | ||
20 | #copy and resize image to destination | ||
21 | ffmpeg -loglevel 0 -y -i "$art" -vf "scale=$COVER_SIZE:-1" "$COVER" \ No newline at end of file | ||
diff --git a/X11/mpd/ncmpcpp/default_cover.png b/X11/mpd/ncmpcpp/default_cover.png new file mode 100644 index 0000000..c02d40b --- /dev/null +++ b/X11/mpd/ncmpcpp/default_cover.png | |||
Binary files differ | |||
diff --git a/X11/mpd/ncmpcpp/scripts/album-art b/X11/mpd/ncmpcpp/scripts/album-art new file mode 100755 index 0000000..d852f34 --- /dev/null +++ b/X11/mpd/ncmpcpp/scripts/album-art | |||
@@ -0,0 +1,248 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | ## Copyright (C) 2020-2021 Aditya Shakya <adi1090x@gmail.com> | ||
4 | ## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 | ||
5 | |||
6 | ## Cover art script for ncmpcpp | ||
7 | |||
8 | # SETTINGS | ||
9 | music_library="$HOME/Music" | ||
10 | padding_top=3 | ||
11 | padding_bottom=0 | ||
12 | padding_right=0 | ||
13 | max_width=40 | ||
14 | reserved_playlist_cols=31 | ||
15 | reserved_cols_in_percent="false" | ||
16 | force_square="true" | ||
17 | square_alignment="top" | ||
18 | left_aligned="true" | ||
19 | padding_left=0 | ||
20 | |||
21 | # Only set this if the geometries are wrong or ncmpcpp shouts at you to do it. | ||
22 | # Visually select/highlight a character on your terminal, zoom in an image | ||
23 | # editor and count how many pixels a character's width and height are. | ||
24 | font_height= | ||
25 | font_width= | ||
26 | |||
27 | main() { | ||
28 | kill_previous_instances >/dev/null 2>&1 | ||
29 | find_cover_image >/dev/null 2>&1 | ||
30 | display_cover_image 2>/dev/null | ||
31 | dunstify -u low --replace=69 -i "$cover_path" "$(mpc current)" | ||
32 | detect_window_resizes >/dev/null 2>&1 | ||
33 | } | ||
34 | |||
35 | # ==== Main functions ========================================================= | ||
36 | |||
37 | kill_previous_instances() { | ||
38 | script_name=$(basename "$0") | ||
39 | for pid in $(pidof -x "$script_name"); do | ||
40 | if [ "$pid" != $$ ]; then | ||
41 | kill -15 "$pid" | ||
42 | fi | ||
43 | done | ||
44 | } | ||
45 | |||
46 | find_cover_image() { | ||
47 | |||
48 | # First we check if the audio file has an embedded album art | ||
49 | ext="$(mpc --format %file% current | sed 's/^.*\.//')" | ||
50 | if [ "$ext" = "flac" ]; then | ||
51 | # since FFMPEG cannot export embedded FLAC art we use metaflac | ||
52 | metaflac --export-picture-to=/tmp/mpd_cover.jpg \ | ||
53 | "$(mpc --format "$music_library"/%file% current)" && | ||
54 | cover_path="/tmp/mpd_cover.jpg" && return | ||
55 | else | ||
56 | ffmpeg -y -i "$(mpc --format "$music_library"/%file% | head -n 1)" \ | ||
57 | /tmp/mpd_cover.jpg && | ||
58 | cover_path="/tmp/mpd_cover.jpg" && return | ||
59 | fi | ||
60 | |||
61 | # If no embedded art was found we look inside the music file's directory | ||
62 | album="$(mpc --format %album% current)" | ||
63 | file="$(mpc --format %file% current)" | ||
64 | album_dir="${file%/*}" | ||
65 | album_dir="$music_library/$album_dir" | ||
66 | found_covers="$(find "$album_dir" -type d -exec find {} -maxdepth 1 -type f \ | ||
67 | -iregex ".*/.*\(${album}\|cover\|folder\|artwork\|front\).*[.]\\(jpe?g\|png\|gif\|bmp\)" \; )" | ||
68 | cover_path="$(echo "$found_covers" | head -n1)" | ||
69 | if [ -n "$cover_path" ]; then | ||
70 | return | ||
71 | fi | ||
72 | |||
73 | # If we still failed to find a cover image, we use the fallback | ||
74 | if [ -z "$cover_path" ]; then | ||
75 | cover_path="$HOME/.ncmpcpp/scripts/music.png" | ||
76 | fi | ||
77 | } | ||
78 | |||
79 | display_cover_image() { | ||
80 | compute_geometry | ||
81 | |||
82 | send_to_ueberzug \ | ||
83 | action "add" \ | ||
84 | identifier "mpd_cover" \ | ||
85 | path "$cover_path" \ | ||
86 | x "$ueber_left" \ | ||
87 | y "$padding_top" \ | ||
88 | height "$ueber_height" \ | ||
89 | width "$ueber_width" \ | ||
90 | synchronously_draw "True" \ | ||
91 | scaler "forced_cover" \ | ||
92 | scaling_position_x "0.5" | ||
93 | } | ||
94 | |||
95 | detect_window_resizes() { | ||
96 | { | ||
97 | trap 'display_cover_image' WINCH | ||
98 | while :; do sleep .1; done | ||
99 | } & | ||
100 | } | ||
101 | |||
102 | |||
103 | # ==== Helper functions ========================================================= | ||
104 | |||
105 | compute_geometry() { | ||
106 | unset LINES COLUMNS # Required in order for tput to work in a script | ||
107 | term_lines=$(tput lines) | ||
108 | term_cols=$(tput cols) | ||
109 | if [ -z "$font_height" ] || [ -z "$font_height" ]; then | ||
110 | guess_font_size | ||
111 | fi | ||
112 | |||
113 | ueber_height=$(( term_lines - padding_top - padding_bottom )) | ||
114 | # Because Ueberzug uses characters as a unit we must multiply | ||
115 | # the line count (height) by the font size ratio in order to | ||
116 | # obtain an equivalent width in column count | ||
117 | ueber_width=$(( ueber_height * font_height / font_width )) | ||
118 | ueber_left=$(( term_cols - ueber_width - padding_right )) | ||
119 | |||
120 | if [ "$left_aligned" = "true" ]; then | ||
121 | compute_geometry_left_aligned | ||
122 | else | ||
123 | compute_geometry_right_aligned | ||
124 | fi | ||
125 | |||
126 | apply_force_square_setting | ||
127 | } | ||
128 | |||
129 | compute_geometry_left_aligned() { | ||
130 | ueber_left=$padding_left | ||
131 | max_width_chars=$(( term_cols * max_width / 100 )) | ||
132 | if [ "$max_width" != 0 ] && | ||
133 | [ $(( ueber_width + padding_right + padding_left )) -gt "$max_width_chars" ]; then | ||
134 | ueber_width=$(( max_width_chars - padding_left - padding_right )) | ||
135 | fi | ||
136 | } | ||
137 | |||
138 | compute_geometry_right_aligned() { | ||
139 | if [ "$reserved_cols_in_percent" = "true" ]; then | ||
140 | ueber_left_percent=$(printf "%.0f\n" $(calc "$ueber_left" / "$term_cols" '*' 100)) | ||
141 | if [ "$ueber_left_percent" -lt "$reserved_playlist_cols" ]; then | ||
142 | ueber_left=$(( term_cols * reserved_playlist_cols / 100 )) | ||
143 | ueber_width=$(( term_cols - ueber_left - padding_right )) | ||
144 | fi | ||
145 | else | ||
146 | if [ "$ueber_left" -lt "$reserved_playlist_cols" ]; then | ||
147 | ueber_left=$reserved_playlist_cols | ||
148 | ueber_width=$(( term_cols - ueber_left - padding_right )) | ||
149 | fi | ||
150 | |||
151 | fi | ||
152 | |||
153 | if [ "$max_width" != 0 ] && [ "$ueber_width" -gt "$max_width" ]; then | ||
154 | ueber_width=$max_width | ||
155 | ueber_left=$(( term_cols - ueber_width - padding_right )) | ||
156 | fi | ||
157 | } | ||
158 | |||
159 | apply_force_square_setting() { | ||
160 | if [ $force_square = "true" ]; then | ||
161 | ueber_height=$(( ueber_width * font_width / font_height )) | ||
162 | case "$square_alignment" in | ||
163 | center) | ||
164 | area=$(( term_lines - padding_top - padding_bottom )) | ||
165 | padding_top=$(( padding_top + area / 2 - ueber_height / 2 )) | ||
166 | ;; | ||
167 | bottom) | ||
168 | padding_top=$(( term_lines - padding_bottom - ueber_height )) | ||
169 | ;; | ||
170 | *) ;; | ||
171 | esac | ||
172 | fi | ||
173 | } | ||
174 | |||
175 | guess_font_size() { | ||
176 | # A font width and height estimate is required to | ||
177 | # properly compute the cover width (in columns). | ||
178 | # We are reproducing the arithmetic used by Ueberzug | ||
179 | # to guess font size. | ||
180 | # https://github.com/seebye/ueberzug/blob/master/ueberzug/terminal.py#L24 | ||
181 | |||
182 | guess_terminal_pixelsize | ||
183 | |||
184 | approx_font_width=$(( term_width / term_cols )) | ||
185 | approx_font_height=$(( term_height / term_lines )) | ||
186 | |||
187 | term_xpadding=$(( ( - approx_font_width * term_cols + term_width ) / 2 )) | ||
188 | term_ypadding=$(( ( - approx_font_height * term_lines + term_height ) / 2 )) | ||
189 | |||
190 | font_width=$(( (term_width - 2 * term_xpadding) / term_cols )) | ||
191 | font_height=$(( (term_height - 2 * term_ypadding) / term_lines )) | ||
192 | } | ||
193 | |||
194 | guess_terminal_pixelsize() { | ||
195 | # We are re-using the same Python snippet that | ||
196 | # Ueberzug utilizes to retrieve terminal window size. | ||
197 | # https://github.com/seebye/ueberzug/blob/master/ueberzug/terminal.py#L10 | ||
198 | |||
199 | python <<END | ||
200 | import sys, struct, fcntl, termios | ||
201 | |||
202 | def get_geometry(): | ||
203 | fd_pty = sys.stdout.fileno() | ||
204 | farg = struct.pack("HHHH", 0, 0, 0, 0) | ||
205 | fretint = fcntl.ioctl(fd_pty, termios.TIOCGWINSZ, farg) | ||
206 | rows, cols, xpixels, ypixels = struct.unpack("HHHH", fretint) | ||
207 | return "{} {}".format(xpixels, ypixels) | ||
208 | |||
209 | output = get_geometry() | ||
210 | f = open("/tmp/ncmpcpp_geometry.txt", "w") | ||
211 | f.write(output) | ||
212 | f.close() | ||
213 | END | ||
214 | |||
215 | # ioctl doesn't work inside $() for some reason so we | ||
216 | # must use a temporary file | ||
217 | term_width=$(awk '{print $1}' /tmp/ncmpcpp_geometry.txt) | ||
218 | term_height=$(awk '{print $2}' /tmp/ncmpcpp_geometry.txt) | ||
219 | rm "/tmp/ncmpcpp_geometry.txt" | ||
220 | |||
221 | if ! is_font_size_successfully_computed; then | ||
222 | echo "Failed to guess font size, try setting it in `basename $0` settings" | ||
223 | fi | ||
224 | } | ||
225 | |||
226 | is_font_size_successfully_computed() { | ||
227 | [ -n "$term_height" ] && [ -n "$term_width" ] && | ||
228 | [ "$term_height" != "0" ] && [ "$term_width" != "0" ] | ||
229 | } | ||
230 | |||
231 | |||
232 | calc() { | ||
233 | awk "BEGIN{print $*}" | ||
234 | } | ||
235 | |||
236 | send_to_ueberzug() { | ||
237 | old_IFS="$IFS" | ||
238 | |||
239 | # Ueberzug's "simple parser" uses tab-separated | ||
240 | # keys and values so we separate words with tabs | ||
241 | # and send the result to the wrapper's FIFO | ||
242 | IFS="$(printf "\t")" | ||
243 | echo "$*" > "$FIFO_UEBERZUG" | ||
244 | |||
245 | IFS=${old_IFS} | ||
246 | } | ||
247 | |||
248 | main | ||
diff --git a/X11/mpd/ncmpcpp/scripts/music.png b/X11/mpd/ncmpcpp/scripts/music.png new file mode 100644 index 0000000..3ded333 --- /dev/null +++ b/X11/mpd/ncmpcpp/scripts/music.png | |||
Binary files differ | |||
diff --git a/X11/mpd/ncmpcpp/scripts/ncmpcpp-art b/X11/mpd/ncmpcpp/scripts/ncmpcpp-art new file mode 100755 index 0000000..38d34c1 --- /dev/null +++ b/X11/mpd/ncmpcpp/scripts/ncmpcpp-art | |||
@@ -0,0 +1,22 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | |||
3 | ## Copyright (C) 2020-2021 Aditya Shakya <adi1090x@gmail.com> | ||
4 | ## Everyone is permitted to copy and distribute copies of this file under GNU-GPL3 | ||
5 | |||
6 | export FIFO_UEBERZUG="/tmp/mpd-ueberzug-${PPID}" | ||
7 | |||
8 | cleanup() { | ||
9 | rm "$FIFO_UEBERZUG" 2>/dev/null | ||
10 | rm /tmp/mpd_cover.jpg 2>/dev/null | ||
11 | pkill -P $$ 2>/dev/null | ||
12 | pkill album-art | ||
13 | } | ||
14 | |||
15 | pkill -P $$ 2>/dev/null | ||
16 | rm "$FIFO_UEBERZUG" 2>/dev/null | ||
17 | mkfifo "$FIFO_UEBERZUG" >/dev/null | ||
18 | trap cleanup EXIT 2>/dev/null | ||
19 | tail --follow "$FIFO_UEBERZUG" | ueberzug layer --silent --parser simple >/dev/null 2>&1 & | ||
20 | |||
21 | ncmpcpp -c ~/.ncmpcpp/config-art | ||
22 | cleanup | ||
diff --git a/X11/mpd/ncmpcpp/tsession b/X11/mpd/ncmpcpp/tsession new file mode 100644 index 0000000..e34d4b8 --- /dev/null +++ b/X11/mpd/ncmpcpp/tsession | |||
@@ -0,0 +1,32 @@ | |||
1 | neww | ||
2 | set -g status off | ||
3 | |||
4 | #image pane; run cover script, disable text output and remove prompt | ||
5 | send-keys "stty -echo" C-m | ||
6 | send-keys "tput civis -- invisible" C-m | ||
7 | send-keys "export PS1=''" C-m | ||
8 | send-keys "clear" C-m | ||
9 | send-keys "~/.ncmpcpp/cover.sh " C-m | ||
10 | |||
11 | #catalog pane; run instance of ncmpcpp | ||
12 | split-window -v | ||
13 | select-pane -t 1 | ||
14 | send-keys "ncmpcpp --config='~/.ncmpcpp/catalog.conf'" C-m | ||
15 | send-keys 1 | ||
16 | |||
17 | #visualizer pane; run instance of ncmpcpp in visualizer mode | ||
18 | select-pane -t 0 | ||
19 | split-window -h | ||
20 | send-keys "ncmpcpp --config='~/.ncmpcpp/visualizer.conf'" C-m | ||
21 | send-keys 8 | ||
22 | send-keys u | ||
23 | |||
24 | #resize image and visualizer pane to fit image | ||
25 | resize-pane -t 0 -x 49 -y 23 | ||
26 | resize-pane -t 1 -y 23 | ||
27 | |||
28 | #hook for keeping the image pane size constant | ||
29 | set-hook client-resized 'resize-pane -t 0 -x 49 -y 23' | ||
30 | |||
31 | #focus on catalog pane | ||
32 | select-pane -t 2 \ No newline at end of file | ||