diff options
-rw-r--r-- | AUTHORS | 1 | ||||
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | doc/config | 8 | ||||
-rw-r--r-- | doc/ncmpcpp.1 | 6 | ||||
-rw-r--r-- | src/browser.cpp | 7 | ||||
-rw-r--r-- | src/configuration.cpp | 13 | ||||
-rw-r--r-- | src/ncmpcpp.cpp | 9 | ||||
-rw-r--r-- | src/settings.cpp | 6 | ||||
-rw-r--r-- | src/settings.h | 1 | ||||
-rw-r--r-- | src/status.cpp | 9 |
10 files changed, 49 insertions, 12 deletions
@@ -1,4 +1,5 @@ Alexander Lopatin <sbar.geek@gmail.com> +Alexey Malakhov <brezerk@gmail.com> Alexey Semenko <igogo.dev@gmail.com> Andrzej Rybczak <electricityispower@gmail.com> Arnaud Guignard <aguignard@gmail.com> @@ -5,6 +5,7 @@ ncmpcpp-0.7 (????-??-??) * It is now possible to abort the current action using Ctrl-C or Ctrl-G in prompt mode. As a result, empty value is no longer a special value that aborts most of the actions. * Directories and playlists in browser can now be sorted by modification time. * ~ is now expanded to home directory in mpd_host configuration variable. +* It is now possible to define startup slave screen using -S/--slave-screen command line option or startup_slave_screen configuration variable. ncmpcpp-0.6.1 (2014-11-06) @@ -400,12 +400,18 @@ #screen_switcher_mode = playlist, browser # ## -## Note: You can define startup screen for ncmpcpp +## Note: You can define startup screen ## by choosing screen from the list above. ## #startup_screen = playlist # ## +## Note: You can define startup slave screen +## by choosing screen from the list above. +## +#startup_slave_screen = playlist +# +## ## Default width of locked screen (in %). ## Acceptable values are from 20 to 80. ## diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1 index 171f8744..00b7cf84 100644 --- a/doc/ncmpcpp.1 +++ b/doc/ncmpcpp.1 @@ -21,6 +21,9 @@ Use alternative configuration file .B \-s, \-\-screen <name> Specify the startup screen (<name> may be: help, playlist, browser, search_engine, media_library, playlist_editor, tag_editor, outputs, visualizer, clock) .TP +.B \-S, \-\-slave-screen <name> +Specify the startup slave screen (<name> may be: help, playlist, browser, search_engine, media_library, playlist_editor, tag_editor, outputs, visualizer, clock) +.TP .B \-?, \-\-help Display help. .TP @@ -268,6 +271,9 @@ If set to "previous", key_screen_switcher will switch between current and last u .B startup_screen = SCREEN_NAME Screen that has to be displayed at start (playlist by default). .TP +.B startup_slave_screen = SCREEN_NAME +Slave screen that has to be displayed at start (playlist by default). +.TP .B locked_screen_width_part = 20-80 If you want to lock a screen, ncmpcpp asks for % of locked screen's width to be reserved before that and provides a default value, which is the one you can set here. .TP diff --git a/src/browser.cpp b/src/browser.cpp index 02e24803..551bdc02 100644 --- a/src/browser.cpp +++ b/src/browser.cpp @@ -106,12 +106,7 @@ void Browser::resize() void Browser::switchTo() { SwitchTo::execute(this); - - if (w.empty()) - getDirectory(m_current_directory); - else - markSongsInPlaylist(proxySongList()); - + markSongsInPlaylist(proxySongList()); drawHeader(); } diff --git a/src/configuration.cpp b/src/configuration.cpp index d44ba4fa..a34c86ed 100644 --- a/src/configuration.cpp +++ b/src/configuration.cpp @@ -56,6 +56,7 @@ bool configure(int argc, char **argv) ("config,c", po::value<std::string>(&config_path)->default_value("~/.ncmpcpp/config"), "specify configuration file") ("bindings,b", po::value<std::string>(&bindings_path)->default_value("~/.ncmpcpp/bindings"), "specify bindings file") ("screen,s", po::value<std::string>(), "specify initial screen") + ("slave-screen,S", po::value<std::string>(), "specify initial slave screen") ("help,?", "show help message") ("version,v", "display version information") ; @@ -176,6 +177,18 @@ bool configure(int argc, char **argv) exit(1); } } + + // custom startup slave screen + if (vm.count("slave-screen")) + { + auto screen = vm["slave-screen"].as<std::string>(); + Config.startup_slave_screen_type = stringtoStartupScreenType(screen); + if (Config.startup_slave_screen_type == ScreenType::Unknown) + { + std::cerr << "Unknown slave screen: " << screen << "\n"; + exit(1); + } + } } catch (std::exception &e) { diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp index 9757be15..ba6bc9d4 100644 --- a/src/ncmpcpp.cpp +++ b/src/ncmpcpp.cpp @@ -130,6 +130,15 @@ int main(int argc, char **argv) // initialize playlist myPlaylist->switchTo(); + + // go to startup screen + if (Config.startup_screen_type != myScreen->type()) + toScreen(Config.startup_screen_type)->switchTo(); + + // lock current screen and go to the slave one + if (Config.startup_slave_screen_type != myScreen->type()) + if (myScreen->lock()) + toScreen(Config.startup_slave_screen_type)->switchTo(); // local variables bool key_pressed = false; diff --git a/src/settings.cpp b/src/settings.cpp index 55415f21..68323d1e 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -517,6 +517,12 @@ bool Configuration::read(const std::string &config_path) throw std::runtime_error("unknown screen: " + v); }, defaults_to(startup_screen_type, ScreenType::Playlist) )); + p.add("startup_slave_screen", option_parser::worker([this](std::string v) { + startup_slave_screen_type = stringtoStartupScreenType(v); + if (startup_slave_screen_type == ScreenType::Unknown) + throw std::runtime_error("unknown slave screen: " + v); + }, defaults_to(startup_slave_screen_type, ScreenType::Playlist) + )); p.add("locked_screen_width_part", assign_default<double>( locked_screen_width_part, 50.0, [](double v) { return v / 100; diff --git a/src/settings.h b/src/settings.h index 8ca8f894..7294841a 100644 --- a/src/settings.h +++ b/src/settings.h @@ -187,6 +187,7 @@ struct Configuration size_t now_playing_suffix_length; ScreenType startup_screen_type; + ScreenType startup_slave_screen_type; std::list<ScreenType> screen_sequence; SortMode browser_sort_mode; diff --git a/src/status.cpp b/src/status.cpp index 2babb084..33217ce4 100644 --- a/src/status.cpp +++ b/src/status.cpp @@ -121,7 +121,11 @@ void initialize_status() { int curr_pos = Status::State::currentSongPosition(); if (curr_pos >= 0) + { myPlaylist->main().highlight(curr_pos); + if (isVisible(myPlaylist)) + myPlaylist->refresh(); + } } // Set TCP_NODELAY on the tcp socket as we are using write-write-read pattern @@ -130,11 +134,6 @@ void initialize_status() int flag = 1; setsockopt(Mpd.GetFD(), IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag)); - // go to startup screen - if (Config.startup_screen_type != myScreen->type()) - toScreen(Config.startup_screen_type)->switchTo(); - myScreen->refresh(); - myBrowser->fetchSupportedExtensions(); # ifdef ENABLE_OUTPUTS myOutputs->FetchList(); |