55
55
" -font [font name] Text font"<<endl<<
56
56
" -title [title name] Set title"<<endl<<
57
57
" -text [text] Text input"<<endl<<
58
" -print Print result to stdout"<<endl<<
58
59
" -w [width] Window width in pixels"<<endl<<
59
60
" -h [height] Window height in pixels"<<endl<<
60
61
" -display [display string] Display name"<<endl<<
61
62
" -pos [x] [y] Window position in pixels"<<endl<<
62
63
" -nearmouse Window position near mouse"<<endl<<
63
" -centered Window position centered on screen"<<endl<<
64
64
" -fg [color name] Foreground text color"<<endl<<
65
65
" -bg [color name] Background color"<<endl<<
66
66
" -na Disable antialias"<<endl<<
75
75
bool set_height = false, set_width=false; // use height/width of font by default
76
76
bool set_pos = false; // set position
77
77
bool near_mouse = false; // popup near mouse
78
bool centered = false; // popup centered on screen
79
78
bool antialias = true; // antialias text
80
80
string fontname; // font name
81
81
string title("Run program"); // default title
82
82
string text; // default input text
86
86
string history_file("~/.fluxbox/fbrun_history"); // command history file
88
88
for (int i=1; i<argc; i++) {
89
if (strcmp(argv[i], "-font") == 0 && i+1 < argc) {
90
if ((arg == "-font" || arg == "--font") && i+1 < argc) {
90
91
fontname = argv[++i];
91
} else if (strcmp(argv[i], "-title") == 0 && i+1 < argc) {
92
} else if (arg == "-print" || arg == "--print") {
94
} else if ((arg == "-title" || arg == "--title") && i+1 < argc) {
93
} else if (strcmp(argv[i], "-text") == 0 && i+1 < argc) {
96
} else if ((arg == "-text" || arg == "--text") && i+1 < argc) {
95
} else if (strcmp(argv[i], "-w") == 0 && i+1 < argc) {
98
} else if (arg == "-w" && i+1 < argc) {
96
99
width = atoi(argv[++i]);
98
} else if (strcmp(argv[i], "-h") == 0 && i+1 < argc) {
101
} else if (arg == "-h" && i+1 < argc) {
99
102
height = atoi(argv[++i]);
100
103
set_height = true; // mark true else the height of font will be used
101
} else if (strcmp(argv[i], "-display") == 0 && i+1 < argc) {
104
} else if ((arg == "-display" || arg == "--display") && i+1 < argc) {
102
105
display_name = argv[++i];
103
} else if (strcmp(argv[i], "-pos") == 0 && i+2 < argc) {
106
} else if ((arg == "-pos" || arg == "--pos") && i+2 < argc) {
104
107
x = atoi(argv[++i]);
105
108
y = atoi(argv[++i]);
107
} else if (strcmp(argv[i], "-nearmouse") == 0) {
110
} else if (arg == "-nearmouse" || arg == "--nearmouse") {
109
112
near_mouse = true;
110
} else if (strcmp(argv[i], "-centered") == 0) {
113
113
} else if (strcmp(argv[i], "-fg") == 0 && i+1 < argc) {
114
114
foreground = argv[++i];
115
115
} else if (strcmp(argv[i], "-bg") == 0 && i+1 < argc) {
118
118
antialias = false;
119
119
} else if (strcmp(argv[i], "-hf") == 0 && i+1 < argc) {
120
120
history_file = argv[++i];
121
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-help") == 0) {
121
} else if (arg == "-h" || arg == "-help" || arg == "--help") {
122
122
showUsage(argv[0]);
222
Display* dpy = FbTk::App::instance()->display();
223
unsigned int root_w = WidthOfScreen(DefaultScreenOfDisplay(dpy));
224
unsigned int root_h = HeightOfScreen(DefaultScreenOfDisplay(dpy));
225
x = (root_w-fbrun.width())/2;
226
y = (root_h-fbrun.height())/2;
227
/* TODO: this will center the popup on the root window, but in
228
the case of Xinerama it should rather center it on one screen.
229
Question remains on which of them ... maybe use the one the
230
pointer is in, like the code for 'nearmouse' does? Alternatively,
231
allow defining a 'main' screen, that should then be applied to
232
the 'nearmouse' handling, too. */
236
222
fbrun.move(x, y);