summaryrefslogtreecommitdiffstats
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp32
1 files changed, 24 insertions, 8 deletions
diff --git a/src/main.cpp b/src/main.cpp
index faef051..83525a6 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4,6 +4,7 @@
#include <QTranslator>
#include <QtAlgorithms>
#include <QtGui/QApplication>
+#include <QDesktopWidget>
#include <cstdlib>
#include <iostream>
@@ -32,13 +33,14 @@ int main(int argc, char *argv[]) {
std::string usage(a.translate(
"Console",
"Usage: vmchooser [ OPTIONS | FILE ]\n\n"
- " -d, --default name of default session\n"
- " -P, --pool name of the environment\n"
- " -p, --path path to vmware .xml files\n"
- " -x, --xpath path of X Session .desktop files\n"
- " -s, --size window size <width>x<height>\n"
- " -v, --version print version and exit\n"
- " -h, --help print usage information and exit\n"
+ " -d, --default name of default session\n"
+ " -P, --pool name of the environment\n"
+ " -p, --path path to vmware .xml files\n"
+ " -x, --xpath path of X Session .desktop files\n"
+ " -s, --size window size <width>x<height>\n"
+ " -w, --windowmgr use <command> window manager\n"
+ " -v, --version print version and exit\n"
+ " -h, --help print usage information and exit\n"
"\nFILE can be a vmware .xml or an X .desktop file\n")
.toUtf8().data());
@@ -90,6 +92,13 @@ int main(int argc, char *argv[]) {
}
}
+ // TODO: parse args => command_line_options.cpp
+ QString windowmgr;
+ if (cmdOptions.contains("windowmgr")) {
+ windowmgr = cmdOptions.value("windowmgr");
+ }
+
+
// read configuration file:
// file supplied as command line option or
// user vmchooser.conf or
@@ -162,7 +171,7 @@ int main(int argc, char *argv[]) {
QList<Session*> xsessions(XSession::readSessions(xSessionPath));
QList<Session*> vsessions(VSession::readXmlDir(vSessionPath));
- Dialog w;
+ Dialog w(windowmgr);
w.resize(width, height);
if (xsessions.empty() && vsessions.empty()) {
std::cerr << a.translate(
@@ -189,5 +198,12 @@ int main(int argc, char *argv[]) {
}
w.selectSession(defaultSession);
w.show();
+
+ // center dialog on screen
+ QRect desktopRect = QApplication::desktop()->availableGeometry(&w);
+ QPoint center = desktopRect.center();
+ w.move(center.x()-w.width()*0.5, center.y()-w.height()*0.5);
+ a.setActiveWindow(&w);
+
return a.exec();
}