Screen change script argument
This commit is contained in:
parent
41f5ef2e09
commit
24b3ee547c
|
@ -20,3 +20,8 @@ src/gui/gui.pro.user*
|
|||
src/gui/.qmake.stash
|
||||
src/gui/.rnd
|
||||
src/setup/win32/barrier.suo
|
||||
Makefile
|
||||
*.cmake
|
||||
**/CMakeFiles/
|
||||
CMakeCache.txt
|
||||
/rpm
|
||||
|
|
|
@ -61,6 +61,10 @@ ArgParser::parseServerArgs(ServerArgs& args, int argc, const char* const* argv)
|
|||
// save configuration file path
|
||||
args.m_configFile = argv[++i];
|
||||
}
|
||||
else if (isArg(i, argc, argv, NULL, "--screen-change-script", 1)) {
|
||||
// save screen change script path
|
||||
args.m_screenChangeScript = argv[++i];
|
||||
}
|
||||
else {
|
||||
LOG((CLOG_PRINT "%s: unrecognized option `%s'" BYE, args.m_exename.c_str(), argv[i], args.m_exename.c_str()));
|
||||
return false;
|
||||
|
|
|
@ -117,7 +117,10 @@ ServerApp::help()
|
|||
" [--display <display>] [--no-xinitthreads]"
|
||||
# define WINAPI_INFO \
|
||||
" --display <display> connect to the X server at <display>\n" \
|
||||
" --no-xinitthreads do not call XInitThreads()\n"
|
||||
" --no-xinitthreads do not call XInitThreads()\n" \
|
||||
" --screen-change-script <path>\n" \
|
||||
" path to script to run on screen change\n" \
|
||||
" first argument is screen name\n"
|
||||
#else
|
||||
# define WINAPI_ARGS ""
|
||||
# define WINAPI_INFO ""
|
||||
|
@ -679,6 +682,21 @@ ServerApp::handleNoClients(const Event&, void*)
|
|||
void
|
||||
ServerApp::handleScreenSwitched(const Event& e, void*)
|
||||
{
|
||||
Server::SwitchToScreenInfo* info = (Server::SwitchToScreenInfo*)(e.getData());
|
||||
|
||||
#ifdef WINAPI_XWINDOWS
|
||||
if (!args().m_screenChangeScript.empty()) {
|
||||
LOG((CLOG_INFO "Running shell script for screen \"%s\"", info->m_screen));
|
||||
|
||||
std::string cmd = std::string(args().m_screenChangeScript);
|
||||
|
||||
cmd += " ";
|
||||
cmd += info->m_screen;
|
||||
cmd += " &";
|
||||
|
||||
system(cmd.c_str());
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
ServerArgs::ServerArgs() :
|
||||
m_configFile(),
|
||||
m_config(NULL)
|
||||
m_config(NULL),
|
||||
m_screenChangeScript()
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -29,4 +29,5 @@ public:
|
|||
public:
|
||||
String m_configFile;
|
||||
Config* m_config;
|
||||
String m_screenChangeScript;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue