[ncmpcpp] patches

master
Jacopo De Simoi 4 months ago
parent 4a7f205fcd
commit 783b115eb6
  1. 189
      media-sound/ncmpcpp/0001-Add-playing-prefix.patch
  2. 59
      media-sound/ncmpcpp/0002-Use-private-area-Unicode-for-spectrum-visualizer.patch

@ -0,0 +1,189 @@
From 15506fcf44ffb083046562a361fd1cb6c65be8dd Mon Sep 17 00:00:00 2001
From: Jacopo De Simoi <jacopods@gmail.com>
Date: Wed, 9 Jan 2019 22:37:47 -0500
Subject: [PATCH 1/2] Add playing-prefix
REBASE-ME!
Add parser entry for "not_playing_prefix"
squash
---
src/display.cpp | 29 +++++++++++++++++++++--------
src/settings.cpp | 10 ++++++++++
src/settings.h | 4 ++++
src/title.cpp | 8 ++++----
4 files changed, 39 insertions(+), 12 deletions(-)
diff --git a/src/display.cpp b/src/display.cpp
index ddf87932..91c02e4d 100644
--- a/src/display.cpp
+++ b/src/display.cpp
@@ -112,6 +112,8 @@ void setProperties(NC::Menu<T> &menu, const MPD::Song &s, const SongList &list,
&& song_pos == Status::State::currentSongPosition();
if (is_now_playing)
menu << Config.now_playing_prefix;
+ else
+ menu << Config.not_playing_prefix;
is_in_playlist = !myPlaylist->isActiveWindow(menu)
&& myPlaylist->checkForSong(s);
@@ -131,6 +133,8 @@ void unsetProperties(NC::Menu<T> &menu, bool separate_albums, bool is_now_playin
if (is_now_playing)
menu << Config.now_playing_suffix;
+ else
+ menu << Config.not_playing_suffix;
if (separate_albums)
menu << NC::Format::NoUnderline;
@@ -160,6 +164,8 @@ void showSongs(NC::Menu<T> &menu, const MPD::Song &s, const SongList &list, cons
}
if (is_now_playing)
x_off -= Config.now_playing_suffix_length;
+ else
+ x_off -= Config.not_playing_suffix_length;
if (is_selected)
x_off -= Config.selected_item_suffix_length;
menu << NC::TermManip::ClearToEOL << NC::XY(x_off, y) << right_aligned;
@@ -193,9 +199,14 @@ void showSongsInColumns(NC::Menu<T> &menu, const MPD::Song &s, const SongList &l
}
if (is_now_playing)
{
- menu_width -= Config.now_playing_prefix_length;
- menu_width -= Config.now_playing_suffix_length;
+ // menu_width -= Config.now_playing_prefix_length;
+ //menu_width -= Config.now_playing_suffix_length;
+ } else
+ {
+ //menu_width -= Config.not_playing_prefix_length;
+ //menu_width -= Config.not_playing_suffix_length;
}
+
if (is_selected)
{
menu_width -= Config.selected_item_prefix_length;
@@ -276,7 +287,9 @@ std::string Display::Columns(size_t list_width)
std::string result;
if (Config.columns.empty())
return result;
-
+
+ result += Config.not_playing_prefix.str();
+
int width;
int remained_width = list_width;
std::vector<Column>::const_iterator it, last = Config.columns.end() - 1;
@@ -295,11 +308,11 @@ std::string Display::Columns(size_t list_width)
// and next column, so we substract it now and restore later.
if (it != last)
--width;
-
+
// if column doesn't fit into screen, discard it and any other after it.
if (remained_width-width < 0 || width < 0 /* this one may come from (*) */)
break;
-
+
std::wstring name;
if (it->name.empty())
{
@@ -317,7 +330,7 @@ std::string Display::Columns(size_t list_width)
else
name = it->name;
wideCut(name, width);
-
+
int x_off = std::max(0, width - int(wideLength(name)));
if (it->right_alignment)
{
@@ -329,7 +342,7 @@ std::string Display::Columns(size_t list_width)
result += Charset::utf8ToLocale(ToString(name));
result += std::string(x_off, NC::Key::Space);
}
-
+
if (it != last)
{
// add missing width's part and restore the value.
@@ -337,7 +350,7 @@ std::string Display::Columns(size_t list_width)
result += ' ';
}
}
-
+
return result;
}
diff --git a/src/settings.cpp b/src/settings.cpp
index ddde73e0..beb2e476 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -356,6 +356,16 @@ bool Configuration::read(const std::vector<std::string> &config_paths, bool igno
nullptr,
std::ref(now_playing_suffix_length),
ph::_1));
+ p.add("not_playing_prefix", &not_playing_prefix, "",
+ std::bind(buffer_wlength,
+ nullptr,
+ std::ref(not_playing_prefix_length),
+ ph::_1));
+ p.add("not_playing_suffix", &not_playing_suffix, "",
+ std::bind(buffer_wlength,
+ nullptr,
+ std::ref(not_playing_suffix_length),
+ ph::_1));
p.add("browser_playlist_prefix", &browser_playlist_prefix, "$2playlist$9 ", buffer);
p.add("selected_item_prefix", &selected_item_prefix, "$6",
std::bind(buffer_wlength,
diff --git a/src/settings.h b/src/settings.h
index e9a8af08..c150bc9e 100644
--- a/src/settings.h
+++ b/src/settings.h
@@ -112,6 +112,8 @@ struct Configuration
NC::Buffer selected_item_suffix;
NC::Buffer now_playing_prefix;
NC::Buffer now_playing_suffix;
+ NC::Buffer not_playing_prefix;
+ NC::Buffer not_playing_suffix;
NC::Buffer modified_item_prefix;
NC::Buffer current_item_prefix;
NC::Buffer current_item_suffix;
@@ -212,6 +214,8 @@ struct Configuration
size_t selected_item_suffix_length;
size_t now_playing_prefix_length;
size_t now_playing_suffix_length;
+ size_t not_playing_prefix_length;
+ size_t not_playing_suffix_length;
size_t current_item_prefix_length;
size_t current_item_suffix_length;
size_t current_item_inactive_column_prefix_length;
diff --git a/src/title.cpp b/src/title.cpp
index bcf61a50..6c0b0da3 100644
--- a/src/title.cpp
+++ b/src/title.cpp
@@ -37,7 +37,7 @@ void drawHeader()
using Global::myScreen;
using Global::wHeader;
using Global::VolumeState;
-
+
if (!Config.header_visibility)
return;
switch (Config.design)
@@ -62,9 +62,9 @@ void drawHeader()
mvwhline(wHeader->raw(), 4, 0, 0, COLS);
*wHeader << NC::FormattedColor::End<>(Config.alternative_ui_separator_color)
<< NC::XY((COLS-wideLength(title))/2, 3)
- << NC::Format::Bold
- << title
- << NC::Format::NoBold;
+ // << NC::Format::Bold
+ << title;
+ // << NC::Format::NoBold;
break;
}
wHeader->refresh();
--
2.51.0

@ -0,0 +1,59 @@
From 694c9115200c72f75d94fdc3b5fd85ff12499ecd Mon Sep 17 00:00:00 2001
From: Jacopo De Simoi <wilderjds@protonmail.com>
Date: Fri, 20 Jun 2025 22:44:11 +0200
Subject: [PATCH 2/2] Use private area Unicode for spectrum visualizer
Please note this will work properly only with my patched terminus font
available at
squash
---
src/screens/visualizer.cpp | 11 +++--------
src/screens/visualizer.h | 2 +-
2 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/screens/visualizer.cpp b/src/screens/visualizer.cpp
index 66fc546d..9770f7ba 100644
--- a/src/screens/visualizer.cpp
+++ b/src/screens/visualizer.cpp
@@ -83,8 +83,8 @@ Visualizer::Visualizer()
HZ_MIN(Config.visualizer_spectrum_hz_min),
HZ_MAX(Config.visualizer_spectrum_hz_max),
GAIN(Config.visualizer_spectrum_gain),
- SMOOTH_CHARS(ToWString("▁▂▃▄▅▆▇█")),
- SMOOTH_CHARS_FLIPPED(ToWString("▔🮂🮃🮄🬎🮅🮆█")) // https://unicode.org/charts/PDF/U1FB00.pdf
+ SMOOTH_CHARS(ToWString("")),
+ SMOOTH_CHARS_FLIPPED(ToWString(""))
#endif
{
InitDataSource();
@@ -535,12 +535,7 @@ void Visualizer::DrawFrequencySpectrum(const int16_t *buf, ssize_t samples, size
} else {
// fractional height
if (flipped) {
- if (Config.visualizer_spectrum_smooth_look_legacy_chars) {
- ch = SMOOTH_CHARS_FLIPPED[idx];
- } else {
- ch = SMOOTH_CHARS[size-idx-2];
- color = NC::FormattedColor(color.color(), {NC::Format::Reverse});
- }
+ ch = SMOOTH_CHARS_FLIPPED[idx];
} else {
ch = SMOOTH_CHARS[idx];
}
diff --git a/src/screens/visualizer.h b/src/screens/visualizer.h
index 3a7a65ba..8a9e61ad 100644
--- a/src/screens/visualizer.h
+++ b/src/screens/visualizer.h
@@ -116,7 +116,7 @@ private:
const double HZ_MAX;
const double GAIN;
const std::wstring SMOOTH_CHARS;
- const std::wstring SMOOTH_CHARS_FLIPPED;
+ const std::wstring SMOOTH_CHARS_FLIPPED;
std::vector<double> m_dft_freqspace;
std::vector<std::pair<size_t, double>> m_bar_heights;
--
2.51.0
Loading…
Cancel
Save