settings: add startup_slave_screen option
This commit is contained in:
1
AUTHORS
1
AUTHORS
@@ -1,4 +1,5 @@
|
|||||||
Alexander Lopatin <sbar.geek@gmail.com>
|
Alexander Lopatin <sbar.geek@gmail.com>
|
||||||
|
Alexey Malakhov <brezerk@gmail.com>
|
||||||
Alexey Semenko <igogo.dev@gmail.com>
|
Alexey Semenko <igogo.dev@gmail.com>
|
||||||
Andrzej Rybczak <electricityispower@gmail.com>
|
Andrzej Rybczak <electricityispower@gmail.com>
|
||||||
Arnaud Guignard <aguignard@gmail.com>
|
Arnaud Guignard <aguignard@gmail.com>
|
||||||
|
|||||||
1
NEWS
1
NEWS
@@ -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.
|
* 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.
|
* Directories and playlists in browser can now be sorted by modification time.
|
||||||
* ~ is now expanded to home directory in mpd_host configuration variable.
|
* ~ 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)
|
ncmpcpp-0.6.1 (2014-11-06)
|
||||||
|
|
||||||
|
|||||||
@@ -400,12 +400,18 @@
|
|||||||
#screen_switcher_mode = playlist, browser
|
#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.
|
## by choosing screen from the list above.
|
||||||
##
|
##
|
||||||
#startup_screen = playlist
|
#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 %).
|
## Default width of locked screen (in %).
|
||||||
## Acceptable values are from 20 to 80.
|
## Acceptable values are from 20 to 80.
|
||||||
##
|
##
|
||||||
|
|||||||
@@ -21,6 +21,9 @@ Use alternative configuration file
|
|||||||
.B \-s, \-\-screen <name>
|
.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)
|
Specify the startup screen (<name> may be: help, playlist, browser, search_engine, media_library, playlist_editor, tag_editor, outputs, visualizer, clock)
|
||||||
.TP
|
.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
|
.B \-?, \-\-help
|
||||||
Display help.
|
Display help.
|
||||||
.TP
|
.TP
|
||||||
@@ -268,6 +271,9 @@ If set to "previous", key_screen_switcher will switch between current and last u
|
|||||||
.B startup_screen = SCREEN_NAME
|
.B startup_screen = SCREEN_NAME
|
||||||
Screen that has to be displayed at start (playlist by default).
|
Screen that has to be displayed at start (playlist by default).
|
||||||
.TP
|
.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
|
.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.
|
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
|
.TP
|
||||||
|
|||||||
@@ -106,12 +106,7 @@ void Browser::resize()
|
|||||||
void Browser::switchTo()
|
void Browser::switchTo()
|
||||||
{
|
{
|
||||||
SwitchTo::execute(this);
|
SwitchTo::execute(this);
|
||||||
|
markSongsInPlaylist(proxySongList());
|
||||||
if (w.empty())
|
|
||||||
getDirectory(m_current_directory);
|
|
||||||
else
|
|
||||||
markSongsInPlaylist(proxySongList());
|
|
||||||
|
|
||||||
drawHeader();
|
drawHeader();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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")
|
("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")
|
("bindings,b", po::value<std::string>(&bindings_path)->default_value("~/.ncmpcpp/bindings"), "specify bindings file")
|
||||||
("screen,s", po::value<std::string>(), "specify initial screen")
|
("screen,s", po::value<std::string>(), "specify initial screen")
|
||||||
|
("slave-screen,S", po::value<std::string>(), "specify initial slave screen")
|
||||||
("help,?", "show help message")
|
("help,?", "show help message")
|
||||||
("version,v", "display version information")
|
("version,v", "display version information")
|
||||||
;
|
;
|
||||||
@@ -176,6 +177,18 @@ bool configure(int argc, char **argv)
|
|||||||
exit(1);
|
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)
|
catch (std::exception &e)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -130,6 +130,15 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
// initialize playlist
|
// initialize playlist
|
||||||
myPlaylist->switchTo();
|
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
|
// local variables
|
||||||
bool key_pressed = false;
|
bool key_pressed = false;
|
||||||
|
|||||||
@@ -517,6 +517,12 @@ bool Configuration::read(const std::string &config_path)
|
|||||||
throw std::runtime_error("unknown screen: " + v);
|
throw std::runtime_error("unknown screen: " + v);
|
||||||
}, defaults_to(startup_screen_type, ScreenType::Playlist)
|
}, 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>(
|
p.add("locked_screen_width_part", assign_default<double>(
|
||||||
locked_screen_width_part, 50.0, [](double v) {
|
locked_screen_width_part, 50.0, [](double v) {
|
||||||
return v / 100;
|
return v / 100;
|
||||||
|
|||||||
@@ -187,6 +187,7 @@ struct Configuration
|
|||||||
size_t now_playing_suffix_length;
|
size_t now_playing_suffix_length;
|
||||||
|
|
||||||
ScreenType startup_screen_type;
|
ScreenType startup_screen_type;
|
||||||
|
ScreenType startup_slave_screen_type;
|
||||||
std::list<ScreenType> screen_sequence;
|
std::list<ScreenType> screen_sequence;
|
||||||
|
|
||||||
SortMode browser_sort_mode;
|
SortMode browser_sort_mode;
|
||||||
|
|||||||
@@ -121,7 +121,11 @@ void initialize_status()
|
|||||||
{
|
{
|
||||||
int curr_pos = Status::State::currentSongPosition();
|
int curr_pos = Status::State::currentSongPosition();
|
||||||
if (curr_pos >= 0)
|
if (curr_pos >= 0)
|
||||||
|
{
|
||||||
myPlaylist->main().highlight(curr_pos);
|
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
|
// 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;
|
int flag = 1;
|
||||||
setsockopt(Mpd.GetFD(), IPPROTO_TCP, TCP_NODELAY, &flag, sizeof(flag));
|
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();
|
myBrowser->fetchSupportedExtensions();
|
||||||
# ifdef ENABLE_OUTPUTS
|
# ifdef ENABLE_OUTPUTS
|
||||||
myOutputs->FetchList();
|
myOutputs->FetchList();
|
||||||
|
|||||||
Reference in New Issue
Block a user