aboutsummaryrefslogtreecommitdiff
path: root/i3-config-wizard
diff options
context:
space:
mode:
authorJoona <julia@joonatoona.me>2018-03-30 03:57:41 -0700
committerOrestis <orestisf1993@gmail.com>2018-03-30 13:57:41 +0300
commit4e0bf58109831dc4a784b7f27ed339de3f1941b2 (patch)
treefe275807430c5230d5633f1bedf9ba8bbf8fbb03 /i3-config-wizard
parent63133c878f16907b696e2761666a58fbd3e287c6 (diff)
downloadi3-4e0bf58109831dc4a784b7f27ed339de3f1941b2.tar.gz
i3-4e0bf58109831dc4a784b7f27ed339de3f1941b2.zip
Add --modifier flag to i3-config-wizard (#3210)
Add --modifier flag to i3-config-wizard The --modifier flag accepts either alt or win, and will generate the configuration file without opening a window. Also adds i3-config-wizard's flags to the manpage. Fixes #3136.
Diffstat (limited to 'i3-config-wizard')
-rw-r--r--i3-config-wizard/main.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/i3-config-wizard/main.c b/i3-config-wizard/main.c
index b368921f..7f9f2d64 100644
--- a/i3-config-wizard/main.c
+++ b/i3-config-wizard/main.c
@@ -745,10 +745,12 @@ int main(int argc, char *argv[]) {
char *pattern = "pango:monospace 8";
char *patternbold = "pango:monospace bold 8";
int o, option_index = 0;
+ bool headless_run = false;
static struct option long_options[] = {
{"socket", required_argument, 0, 's'},
{"version", no_argument, 0, 'v'},
+ {"modifier", required_argument, 0, 'm'},
{"limit", required_argument, 0, 'l'},
{"prompt", required_argument, 0, 'P'},
{"prefix", required_argument, 0, 'p'},
@@ -756,7 +758,7 @@ int main(int argc, char *argv[]) {
{"help", no_argument, 0, 'h'},
{0, 0, 0, 0}};
- char *options_string = "s:vh";
+ char *options_string = "sm:vh";
while ((o = getopt_long(argc, argv, options_string, long_options, &option_index)) != -1) {
switch (o) {
@@ -767,9 +769,18 @@ int main(int argc, char *argv[]) {
case 'v':
printf("i3-config-wizard " I3_VERSION "\n");
return 0;
+ case 'm':
+ headless_run = true;
+ if (strcmp(optarg, "alt") == 0)
+ modifier = MOD_Mod1;
+ else if (strcmp(optarg, "win") == 0)
+ modifier = MOD_Mod4;
+ else
+ err(EXIT_FAILURE, "Invalid modifier key %s", optarg);
+ break;
case 'h':
printf("i3-config-wizard " I3_VERSION "\n");
- printf("i3-config-wizard [-s <socket>] [-v]\n");
+ printf("i3-config-wizard [-s <socket>] [-m win|alt] [-v] [-h]\n");
return 0;
}
}
@@ -826,6 +837,11 @@ int main(int argc, char *argv[]) {
modmap_cookie = xcb_get_modifier_mapping(conn);
symbols = xcb_key_symbols_alloc(conn);
+ if (headless_run) {
+ finish();
+ return 0;
+ }
+
/* Place requests for the atoms we need as soon as possible */
#define xmacro(atom) \
xcb_intern_atom_cookie_t atom##_cookie = xcb_intern_atom(conn, 0, strlen(#atom), #atom);