2017-03-28 06:23 CEST

View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0004012ncmpcppDefaultpublic2014-11-06 20:36
Reporterbrezerk 
Assigned TounK 
PrioritynormalSeverityfeatureReproducibilityalways
StatusresolvedResolutionfixed 
PlatformLinuxOSGentooOS Versionunstable
Product Version0.7.x 
Target VersionFixed in Version0.7.x 
Summary0004012: Add startup_slave_screen option
DescriptionPath will add:

* new feature: customizable startup slave screen
* add command line switch -S/--slave-screen for switching slave screen at startup

So, you can define startup slave screen for ncmpcpp
by choosing screen number from the list above,
it will work _only_ in case if ask_for_locked_screen_width_part is set to "no"

i.e. adding to config file:

ask_for_locked_screen_width_part = "no"
startup_slave_screen = "9"

will result starting ncmpcpp with two screens with out manual changes. See: http://hellion.brezblock.org.ua/mpd.png
TagsNo tags attached.
Attached Files
  • patch file icon add_startup_slave_screen.patch (6,655 bytes) 2014-05-31 00:38 -
    From af9a0b9ea7bc60a6b8e7b087fef2994b66de8674 Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sat, 31 May 2014 01:24:44 +0300
    Subject: [PATCH 1/2] Add startup-slave-screen option + function
    
    ---
     AUTHORS          |  1 +
     NEWS             |  5 +++++
     doc/config       |  7 +++++++
     src/cmdargs.cpp  | 44 ++++++++++++++++++++++++++++++++++++++++++++
     src/ncmpcpp.cpp  | 11 +++++++++++
     src/settings.cpp |  7 +++++++
     src/settings.h   |  1 +
     7 files changed, 76 insertions(+)
    
    diff --git a/AUTHORS b/AUTHORS
    index 6cc1991..0448660 100644
    --- a/AUTHORS
    +++ b/AUTHORS
    @@ -1,2 +1,3 @@
     Andrzej Rybczak <electricityispower@gmail.com>
     Frank Blendinger <fb@intoxicatedmind.net>
    +Alexey Malakhov <brezerk@gmail.com>
    diff --git a/NEWS b/NEWS
    index f0747dd..c78d22c 100644
    --- a/NEWS
    +++ b/NEWS
    @@ -1,3 +1,8 @@
    +ncmpcpp-0.5.11
    +
    +* new feature: customizable startup slave screen
    +* add command line switch -S/--slave-screen for switching slave screen at startup
    +
     ncmpcpp-0.5.10
     
     * fix compilation with gcc 4.7
    diff --git a/doc/config b/doc/config
    index ab12006..431bf5c 100644
    --- a/doc/config
    +++ b/doc/config
    @@ -402,6 +402,13 @@
     ##
     #startup_screen = "2"
     #
    +##
    +## Note: You can define startup slave screen for ncmpcpp
    +## by choosing screen number from the list above,
    +## it will work _only_ in case if ask_for_locked_screen_width_part is set to "no"
    +##
    +#startup_slave_screen = "5"
    +#
     #jump_to_now_playing_song_at_start = "yes"
     #
     #ask_before_clearing_main_playlist = "no"
    diff --git a/src/cmdargs.cpp b/src/cmdargs.cpp
    index 955ea38..0b04f5c 100644
    --- a/src/cmdargs.cpp
    +++ b/src/cmdargs.cpp
    @@ -115,6 +115,7 @@ void ParseArgv(int argc, char **argv)
     			<< "  -p, --port                connect to server at port [6600]\n"
     			<< "  -c, --config              use alternative configuration file\n"
     			<< "  -s, --screen <name>       specify the startup screen\n"
    +			<< "  -S, --slave-screen <name> specify the startup slave screen\n"
     			<< "  -?, --help                show help message\n"
     			<< "  -v, --version             display version information\n"
     			;
    @@ -160,6 +161,49 @@ void ParseArgv(int argc, char **argv)
     				exit(1);
     			}
     		}
    +		else if (!strcmp(argv[i], "-S") || !strcmp(argv[i], "--slave-screen"))
    +		{
    +			if (++i == argc) {
    +				std::cerr << "No screen specified" << std::endl;
    +				exit(1);
    +			}
    +			if (!strcmp(argv[i], "help"))
    +				Config.startup_slave_screen = myHelp;
    +			else if (!strcmp(argv[i], "playlist"))
    +				Config.startup_slave_screen = myPlaylist;
    +			else if (!strcmp(argv[i], "browser"))
    +				Config.startup_slave_screen = myBrowser;
    +			else if (!strcmp(argv[i], "search-engine"))
    +				Config.startup_slave_screen = mySearcher;
    +			else if (!strcmp(argv[i], "media-library"))
    +				Config.startup_slave_screen = myLibrary;
    +			else if (!strcmp(argv[i], "playlist-editor"))
    +				Config.startup_slave_screen = myPlaylistEditor;
    +#			ifdef HAVE_TAGLIB_H
    +			else if (!strcmp(argv[i], "tag-editor"))
    +				Config.startup_slave_screen = myTagEditor;
    +#			endif // HAVE_TAGLIB_H
    +#			ifdef ENABLE_OUTPUTS
    +			else if (!strcmp(argv[i], "outputs"))
    +				Config.startup_slave_screen = myOutputs;
    +#			endif // ENABLE_OUTPUTS
    +#			ifdef ENABLE_VISUALIZER
    +			else if (!strcmp(argv[i], "visualizer"))
    +				Config.startup_slave_screen = myVisualizer;
    +#			endif // ENABLE_VISUALIZER
    +#			ifdef ENABLE_CLOCK
    +			else if (!strcmp(argv[i], "clock"))
    +				Config.startup_slave_screen = myClock;
    +#			endif // ENABLE_CLOCK
    +			else {
    +				std::cerr << "Invalid screen: " << argv[i] << std::endl;
    +				exit(1);
    +			}
    +
    +			// set ask_for_locked_screen_width_part to false
    +			if (Config.startup_slave_screen != Config.startup_screen)
    +				Config.ask_for_locked_screen_width_part = false;
    +		}
     		else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config"))
     		{
     			// this is used in Configuration::CheckForCommandLineConfigFilePath, ignoring here.
    diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
    index f0084ae..866bf72 100644
    --- a/src/ncmpcpp.cpp
    +++ b/src/ncmpcpp.cpp
    @@ -215,6 +215,17 @@ int main(int argc, char **argv)
     						myVisualizer->SetFD();
     					myVisualizer->FindOutputID();
     #					endif // ENABLE_VISUALIZER
    +
    +					// toggle screen lock go to startup slave screen
    +					// only in case if ask_for_locked_screen_width_part is set to 'no'
    +					// should be called after visualized intitaliztion to set focus back to master
    +					if ((Config.startup_slave_screen != Config.startup_screen) && (!Config.ask_for_locked_screen_width_part)) {
    +						Actions::get(Actions::Type::ToggleScreenLock).execute();
    +						Config.startup_slave_screen->switchTo();
    +						// move focus back to master screen
    +						Actions::get(Actions::Type::MasterScreen).execute();
    +						Config.startup_slave_screen->refreshWindow();
    +					}
     					
     					Statusbar::msg("Connected to %s", Mpd.GetHostname().c_str());
     				}
    diff --git a/src/settings.cpp b/src/settings.cpp
    index d0dbeb0..8dafbb3 100644
    --- a/src/settings.cpp
    +++ b/src/settings.cpp
    @@ -241,6 +241,7 @@ void Configuration::SetDefaults()
     		system_encoding.clear();
     #	endif // HAVE_LANGINFO_H
     	startup_screen = myPlaylist;
    +	startup_slave_screen = myPlaylist;
     	browser_sort_mode = smName;
     	// default screens sequence
     	screens_seq.push_back(myPlaylist);
    @@ -653,6 +654,12 @@ void Configuration::Read()
     				if (!startup_screen)
     					startup_screen = myPlaylist;
     			}
    +			else if (name == "startup_slave_screen")
    +			{
    +				startup_slave_screen = intToScreen(atoi(v.c_str()));
    +				if (!startup_slave_screen)
    +					startup_slave_screen = myPlaylist;
    +			}
     			else if (name == "autocenter_mode")
     			{
     				autocenter_mode = v == "yes";
    diff --git a/src/settings.h b/src/settings.h
    index e5bece9..c92429a 100644
    --- a/src/settings.h
    +++ b/src/settings.h
    @@ -208,6 +208,7 @@ struct Configuration
     	size_t now_playing_suffix_length;
     	
     	ScreenRef startup_screen;
    +	ScreenRef startup_slave_screen;
     	std::list<ScreenRef> screens_seq;
     	
     	SortMode browser_sort_mode;
    -- 
    1.9.2
    
    
    From 9850ff4cbb18fa2354770126c112a6764ae3118f Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sat, 31 May 2014 01:26:30 +0300
    Subject: [PATCH 2/2] Add a comment
    
    ---
     src/ncmpcpp.cpp | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
    index 866bf72..81506eb 100644
    --- a/src/ncmpcpp.cpp
    +++ b/src/ncmpcpp.cpp
    @@ -224,6 +224,7 @@ int main(int argc, char **argv)
     						Config.startup_slave_screen->switchTo();
     						// move focus back to master screen
     						Actions::get(Actions::Type::MasterScreen).execute();
    +						// refresh slave
     						Config.startup_slave_screen->refreshWindow();
     					}
     					
    -- 
    1.9.2
    
    
    patch file icon add_startup_slave_screen.patch (6,655 bytes) 2014-05-31 00:38 +
  • patch file icon add_startup_slave_screen_v3.patch (9,087 bytes) 2014-10-05 15:47 -
    From af9a0b9ea7bc60a6b8e7b087fef2994b66de8674 Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sat, 31 May 2014 01:24:44 +0300
    Subject: [PATCH 1/5] Add startup-slave-screen option + function
    
    ---
     AUTHORS          |  1 +
     NEWS             |  5 +++++
     doc/config       |  7 +++++++
     src/cmdargs.cpp  | 44 ++++++++++++++++++++++++++++++++++++++++++++
     src/ncmpcpp.cpp  | 11 +++++++++++
     src/settings.cpp |  7 +++++++
     src/settings.h   |  1 +
     7 files changed, 76 insertions(+)
    
    diff --git a/AUTHORS b/AUTHORS
    index 6cc1991..0448660 100644
    --- a/AUTHORS
    +++ b/AUTHORS
    @@ -1,2 +1,3 @@
     Andrzej Rybczak <electricityispower@gmail.com>
     Frank Blendinger <fb@intoxicatedmind.net>
    +Alexey Malakhov <brezerk@gmail.com>
    diff --git a/NEWS b/NEWS
    index f0747dd..c78d22c 100644
    --- a/NEWS
    +++ b/NEWS
    @@ -1,3 +1,8 @@
    +ncmpcpp-0.5.11
    +
    +* new feature: customizable startup slave screen
    +* add command line switch -S/--slave-screen for switching slave screen at startup
    +
     ncmpcpp-0.5.10
     
     * fix compilation with gcc 4.7
    diff --git a/doc/config b/doc/config
    index ab12006..431bf5c 100644
    --- a/doc/config
    +++ b/doc/config
    @@ -402,6 +402,13 @@
     ##
     #startup_screen = "2"
     #
    +##
    +## Note: You can define startup slave screen for ncmpcpp
    +## by choosing screen number from the list above,
    +## it will work _only_ in case if ask_for_locked_screen_width_part is set to "no"
    +##
    +#startup_slave_screen = "5"
    +#
     #jump_to_now_playing_song_at_start = "yes"
     #
     #ask_before_clearing_main_playlist = "no"
    diff --git a/src/cmdargs.cpp b/src/cmdargs.cpp
    index 955ea38..0b04f5c 100644
    --- a/src/cmdargs.cpp
    +++ b/src/cmdargs.cpp
    @@ -115,6 +115,7 @@ void ParseArgv(int argc, char **argv)
     			<< "  -p, --port                connect to server at port [6600]\n"
     			<< "  -c, --config              use alternative configuration file\n"
     			<< "  -s, --screen <name>       specify the startup screen\n"
    +			<< "  -S, --slave-screen <name> specify the startup slave screen\n"
     			<< "  -?, --help                show help message\n"
     			<< "  -v, --version             display version information\n"
     			;
    @@ -160,6 +161,49 @@ void ParseArgv(int argc, char **argv)
     				exit(1);
     			}
     		}
    +		else if (!strcmp(argv[i], "-S") || !strcmp(argv[i], "--slave-screen"))
    +		{
    +			if (++i == argc) {
    +				std::cerr << "No screen specified" << std::endl;
    +				exit(1);
    +			}
    +			if (!strcmp(argv[i], "help"))
    +				Config.startup_slave_screen = myHelp;
    +			else if (!strcmp(argv[i], "playlist"))
    +				Config.startup_slave_screen = myPlaylist;
    +			else if (!strcmp(argv[i], "browser"))
    +				Config.startup_slave_screen = myBrowser;
    +			else if (!strcmp(argv[i], "search-engine"))
    +				Config.startup_slave_screen = mySearcher;
    +			else if (!strcmp(argv[i], "media-library"))
    +				Config.startup_slave_screen = myLibrary;
    +			else if (!strcmp(argv[i], "playlist-editor"))
    +				Config.startup_slave_screen = myPlaylistEditor;
    +#			ifdef HAVE_TAGLIB_H
    +			else if (!strcmp(argv[i], "tag-editor"))
    +				Config.startup_slave_screen = myTagEditor;
    +#			endif // HAVE_TAGLIB_H
    +#			ifdef ENABLE_OUTPUTS
    +			else if (!strcmp(argv[i], "outputs"))
    +				Config.startup_slave_screen = myOutputs;
    +#			endif // ENABLE_OUTPUTS
    +#			ifdef ENABLE_VISUALIZER
    +			else if (!strcmp(argv[i], "visualizer"))
    +				Config.startup_slave_screen = myVisualizer;
    +#			endif // ENABLE_VISUALIZER
    +#			ifdef ENABLE_CLOCK
    +			else if (!strcmp(argv[i], "clock"))
    +				Config.startup_slave_screen = myClock;
    +#			endif // ENABLE_CLOCK
    +			else {
    +				std::cerr << "Invalid screen: " << argv[i] << std::endl;
    +				exit(1);
    +			}
    +
    +			// set ask_for_locked_screen_width_part to false
    +			if (Config.startup_slave_screen != Config.startup_screen)
    +				Config.ask_for_locked_screen_width_part = false;
    +		}
     		else if (!strcmp(argv[i], "-c") || !strcmp(argv[i], "--config"))
     		{
     			// this is used in Configuration::CheckForCommandLineConfigFilePath, ignoring here.
    diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
    index f0084ae..866bf72 100644
    --- a/src/ncmpcpp.cpp
    +++ b/src/ncmpcpp.cpp
    @@ -215,6 +215,17 @@ int main(int argc, char **argv)
     						myVisualizer->SetFD();
     					myVisualizer->FindOutputID();
     #					endif // ENABLE_VISUALIZER
    +
    +					// toggle screen lock go to startup slave screen
    +					// only in case if ask_for_locked_screen_width_part is set to 'no'
    +					// should be called after visualized intitaliztion to set focus back to master
    +					if ((Config.startup_slave_screen != Config.startup_screen) && (!Config.ask_for_locked_screen_width_part)) {
    +						Actions::get(Actions::Type::ToggleScreenLock).execute();
    +						Config.startup_slave_screen->switchTo();
    +						// move focus back to master screen
    +						Actions::get(Actions::Type::MasterScreen).execute();
    +						Config.startup_slave_screen->refreshWindow();
    +					}
     					
     					Statusbar::msg("Connected to %s", Mpd.GetHostname().c_str());
     				}
    diff --git a/src/settings.cpp b/src/settings.cpp
    index d0dbeb0..8dafbb3 100644
    --- a/src/settings.cpp
    +++ b/src/settings.cpp
    @@ -241,6 +241,7 @@ void Configuration::SetDefaults()
     		system_encoding.clear();
     #	endif // HAVE_LANGINFO_H
     	startup_screen = myPlaylist;
    +	startup_slave_screen = myPlaylist;
     	browser_sort_mode = smName;
     	// default screens sequence
     	screens_seq.push_back(myPlaylist);
    @@ -653,6 +654,12 @@ void Configuration::Read()
     				if (!startup_screen)
     					startup_screen = myPlaylist;
     			}
    +			else if (name == "startup_slave_screen")
    +			{
    +				startup_slave_screen = intToScreen(atoi(v.c_str()));
    +				if (!startup_slave_screen)
    +					startup_slave_screen = myPlaylist;
    +			}
     			else if (name == "autocenter_mode")
     			{
     				autocenter_mode = v == "yes";
    diff --git a/src/settings.h b/src/settings.h
    index e5bece9..c92429a 100644
    --- a/src/settings.h
    +++ b/src/settings.h
    @@ -208,6 +208,7 @@ struct Configuration
     	size_t now_playing_suffix_length;
     	
     	ScreenRef startup_screen;
    +	ScreenRef startup_slave_screen;
     	std::list<ScreenRef> screens_seq;
     	
     	SortMode browser_sort_mode;
    -- 
    2.1.2
    
    
    From 9850ff4cbb18fa2354770126c112a6764ae3118f Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sat, 31 May 2014 01:26:30 +0300
    Subject: [PATCH 2/5] Add a comment
    
    ---
     src/ncmpcpp.cpp | 1 +
     1 file changed, 1 insertion(+)
    
    diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
    index 866bf72..81506eb 100644
    --- a/src/ncmpcpp.cpp
    +++ b/src/ncmpcpp.cpp
    @@ -224,6 +224,7 @@ int main(int argc, char **argv)
     						Config.startup_slave_screen->switchTo();
     						// move focus back to master screen
     						Actions::get(Actions::Type::MasterScreen).execute();
    +						// refresh slave
     						Config.startup_slave_screen->refreshWindow();
     					}
     					
    -- 
    2.1.2
    
    
    From 10f609c828f9ab6b809d9ce443c2481ff706c0d5 Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sat, 31 May 2014 02:08:58 +0300
    Subject: [PATCH 3/5] fixmtime
    
    ---
     src/song.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/song.cpp b/src/song.cpp
    index bacfc52..72e2aaf 100644
    --- a/src/song.cpp
    +++ b/src/song.cpp
    @@ -284,7 +284,7 @@ std::string Song::ShowTime(unsigned length)
     	if (hours > 0)
     		result = (boost::format("%d:%02d:%02d") % hours % minutes % seconds).str();
     	else
    -		result = (boost::format("%d:%02d") % minutes % seconds).str();
    +		result = (boost::format("%02d:%02d") % minutes % seconds).str();
     	return result;
     }
     
    -- 
    2.1.2
    
    
    From 2eedf1d9c8237be54fdaef133bc545dd05bd0209 Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sun, 5 Oct 2014 16:38:42 +0300
    Subject: [PATCH 4/5] fixup reconnecton
    
    ---
     src/ncmpcpp.cpp | 4 +++-
     1 file changed, 3 insertions(+), 1 deletion(-)
    
    diff --git a/src/ncmpcpp.cpp b/src/ncmpcpp.cpp
    index 81506eb..d9c1d19 100644
    --- a/src/ncmpcpp.cpp
    +++ b/src/ncmpcpp.cpp
    @@ -220,7 +220,9 @@ int main(int argc, char **argv)
     					// only in case if ask_for_locked_screen_width_part is set to 'no'
     					// should be called after visualized intitaliztion to set focus back to master
     					if ((Config.startup_slave_screen != Config.startup_screen) && (!Config.ask_for_locked_screen_width_part)) {
    -						Actions::get(Actions::Type::ToggleScreenLock).execute();
    +						if (myLockedScreen == 0){
    +							Actions::get(Actions::Type::ToggleScreenLock).execute();
    +						}
     						Config.startup_slave_screen->switchTo();
     						// move focus back to master screen
     						Actions::get(Actions::Type::MasterScreen).execute();
    -- 
    2.1.2
    
    
    From 633875eee3984352ba279ac5ef7d86886e7528fd Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sun, 5 Oct 2014 16:45:27 +0300
    Subject: [PATCH 5/5] revert time changes
    
    ---
     src/song.cpp | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/song.cpp b/src/song.cpp
    index 72e2aaf..bacfc52 100644
    --- a/src/song.cpp
    +++ b/src/song.cpp
    @@ -284,7 +284,7 @@ std::string Song::ShowTime(unsigned length)
     	if (hours > 0)
     		result = (boost::format("%d:%02d:%02d") % hours % minutes % seconds).str();
     	else
    -		result = (boost::format("%02d:%02d") % minutes % seconds).str();
    +		result = (boost::format("%d:%02d") % minutes % seconds).str();
     	return result;
     }
     
    -- 
    2.1.2
    
    
    patch file icon add_startup_slave_screen_v3.patch (9,087 bytes) 2014-10-05 15:47 +
  • patch file icon add_startup_slave_screen_0.6_v1.patch (6,440 bytes) 2014-10-05 21:02 -
    From d3cd8ae4293b82b3dc396450118faa73f8558edb Mon Sep 17 00:00:00 2001
    From: brezerk <brezerk@gmail.com>
    Date: Sun, 5 Oct 2014 22:00:13 +0300
    Subject: [PATCH] port slave_screen to master 0.6_beta
    
    ---
     AUTHORS               |  1 +
     NEWS                  |  5 +++++
     doc/config            |  7 +++++++
     doc/ncmpcpp.1         |  6 ++++++
     src/configuration.cpp | 13 +++++++++++++
     src/settings.cpp      |  6 ++++++
     src/settings.h        |  2 ++
     src/status.cpp        | 15 +++++++++++++++
     8 files changed, 55 insertions(+)
    
    diff --git a/AUTHORS b/AUTHORS
    index 6cc1991..0448660 100644
    --- a/AUTHORS
    +++ b/AUTHORS
    @@ -1,2 +1,3 @@
     Andrzej Rybczak <electricityispower@gmail.com>
     Frank Blendinger <fb@intoxicatedmind.net>
    +Alexey Malakhov <brezerk@gmail.com>
    diff --git a/NEWS b/NEWS
    index 60b881b..8ddae9c 100644
    --- a/NEWS
    +++ b/NEWS
    @@ -1,3 +1,8 @@
    +ncmpcpp-0.6_beta6
    +
    +* new feature: customizable startup slave screen
    +* add command line switch -S/--slave-screen for switching slave screen at startup
    +
     ncmpcpp-0.6_beta5
     
     * Corrupted tags no longer cause assertion failures.
    diff --git a/doc/config b/doc/config
    index 691ad86..18046f1 100644
    --- a/doc/config
    +++ b/doc/config
    @@ -404,6 +404,13 @@ data_fetching_delay = yes
     #startup_screen = playlist
     #
     ##
    +## Note: You can define startup slave screen for ncmpcpp
    +## by choosing screen from the list above.
    +## Note: It will work _only_ in case if ask_for_locked_screen_width_part is set to "no"
    +##
    +#startup_slave_screen = media_library
    +#
    +##
     ## Default width of locked screen (in %).
     ## Acceptable values are from 20 to 80.
     ##
    diff --git a/doc/ncmpcpp.1 b/doc/ncmpcpp.1
    index 1872485..896b989 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
    @@ -265,6 +268,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 (media library by default). It will work _only_ in case if ask_for_locked_screen_width_part is set to "no".
    +.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/configuration.cpp b/src/configuration.cpp
    index d44ba4f..a34c86e 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/settings.cpp b/src/settings.cpp
    index 69d003b..4ca3371 100644
    --- a/src/settings.cpp
    +++ b/src/settings.cpp
    @@ -510,6 +510,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::MediaLibrary)
    +	));
     	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 01959da..8b79877 100644
    --- a/src/settings.h
    +++ b/src/settings.h
    @@ -186,6 +186,8 @@ 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 5ce4001..6164f3e 100644
    --- a/src/status.cpp
    +++ b/src/status.cpp
    @@ -22,6 +22,7 @@
     #include <netinet/tcp.h>
     #include <netinet/in.h>
     
    +#include "actions.h"
     #include "browser.h"
     #include "charset.h"
     #include "global.h"
    @@ -42,6 +43,7 @@
     #include "utility/string.h"
     
     using Global::myScreen;
    +using Global::myLockedScreen;
     
     using Global::wFooter;
     using Global::wHeader;
    @@ -146,6 +148,19 @@ void initialize_status()
     	myVisualizer->FindOutputID();
     #	endif // ENABLE_VISUALIZER
     
    +	// toggle screen lock go to startup slave screen
    +	// only in case if ask_for_locked_screen_width_part is set to 'no'
    +	// should be called after visualized intitaliztion to set focus back to master
    +	if ((Config.startup_slave_screen_type != Config.startup_screen_type) && (!Config.ask_for_locked_screen_width_part)) {
    +		if (myLockedScreen == 0){
    +			Actions::get(Actions::Type::ToggleScreenLock).execute();
    +		}
    +		toScreen(Config.startup_slave_screen_type)->switchTo();
    +		// move focus back to master screen
    +		Actions::get(Actions::Type::MasterScreen).execute();
    +		toScreen(Config.startup_slave_screen_type)->refreshWindow();
    +	}
    +
     	m_status_initialized = true;
     	wFooter->addFDCallback(Mpd.GetFD(), Statusbar::Helpers::mpd);
     	Statusbar::printf("Connected to %1%", Mpd.GetHostname());
    -- 
    2.1.2
    
    
    patch file icon add_startup_slave_screen_0.6_v1.patch (6,440 bytes) 2014-10-05 21:02 +

-Relationships
related to 0003642resolvedunK Config settings for what to have in the locked screen at startup 
+Relationships

-Notes

~0008474

brezerk (reporter)

Let me know if I need to update the patch. Thanks :)

~0008676

unK (administrator)

Thanks for the patch and sorry for the delay. The patch needs slight update now, but can you by the way check if it works as expected after connection to MPD is lost and then reestablished? Since you are executing ToggleScreenLock there, is looks like it won't work properly in this case (if screen is already locked, it will be unlocked).

~0008680

brezerk (reporter)

np at all. we all are a busy people :)

yes, you are correct. after reestablishing connection to MPD I got only 1 screen.
will play around the sources to fix this, thanks.

~0008897

brezerk (reporter)

hi. sorry for the delay.

Please, take a look on add_startup_slave_screen_v3.patch

Now reconnection is handled properly.

~0008899

unK (administrator)

Last edited: 2014-10-05 19:11

View 2 revisions

Thanks, but you need to adjust it, so it applies to the current master.

~0008900

brezerk (reporter)

hi.

sorry, I just noticed that there was a lot of changes in master. patch updated for current master.

let me know if I need to change something.

thanks.

~0009020

unK (administrator)

I was thinking a little about that and I'm wondering if it wouldn't be better to make it so that:
1) If slave screen was specified, the locking would always take place (no matter if you normally ask about the width) unless slave screen is the same as the initial one.
2) Whether the initial focus should be on the locked or the slave screen should be configurable.

What do you think?

~0009022

brezerk (reporter)

hi

>If slave screen was specified, the locking would always take place (no matter if you normally ask about the width) unless slave screen is the same as the initial one.

This restriction was added for usability: b/c width request just after ncmpcpp startup can be not obvious. But, I am agree that this restriction can be removed.

>Whether the initial focus should be on the locked or the slave screen should be configurable.

Sounds reasonable. Will do.

~0009023

unK (administrator)

> This restriction was added for usability: b/c width request just after ncmpcpp startup can be not obvious. But, I am agree that this restriction can be removed.

I'm thinking that the default value is always there, so it should be used in this situation without asking.

~0009024

brezerk (reporter)

ah. good point. thanks.

~0009057

unK (administrator)

I merged the patch with a few changes.
+Notes

-Issue History
Date Modified Username Field Change
2014-05-31 00:38 brezerk New Issue
2014-05-31 00:38 brezerk Status new => assigned
2014-05-31 00:38 brezerk Assigned To => unK
2014-05-31 00:38 brezerk File Added: add_startup_slave_screen.patch
2014-05-31 00:39 brezerk Note Added: 0008474
2014-08-27 07:04 unK Note Added: 0008676
2014-08-27 08:43 brezerk Note Added: 0008680
2014-10-05 15:47 brezerk File Added: add_startup_slave_screen_v3.patch
2014-10-05 15:52 brezerk Note Added: 0008897
2014-10-05 19:10 unK Note Added: 0008899
2014-10-05 19:11 unK Note Edited: 0008899 View Revisions
2014-10-05 21:02 brezerk File Added: add_startup_slave_screen_0.6_v1.patch
2014-10-05 21:04 brezerk Note Added: 0008900
2014-10-31 10:01 unK Note Added: 0009020
2014-10-31 10:24 brezerk Note Added: 0009022
2014-10-31 10:33 unK Note Added: 0009023
2014-10-31 10:33 brezerk Note Added: 0009024
2014-11-04 17:31 unK Relationship added related to 0003642
2014-11-06 20:36 unK Note Added: 0009057
2014-11-06 20:36 unK Status assigned => resolved
2014-11-06 20:36 unK Fixed in Version => 0.7.x
2014-11-06 20:36 unK Resolution open => fixed
+Issue History