aboutsummaryrefslogtreecommitdiffstats
path: root/swaynag/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'swaynag/config.c')
-rw-r--r--swaynag/config.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/swaynag/config.c b/swaynag/config.c
index f1161b39..d702cc95 100644
--- a/swaynag/config.c
+++ b/swaynag/config.c
@@ -52,6 +52,8 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
52 static struct option opts[] = { 52 static struct option opts[] = {
53 {"button", required_argument, NULL, 'b'}, 53 {"button", required_argument, NULL, 'b'},
54 {"button-no-terminal", required_argument, NULL, 'B'}, 54 {"button-no-terminal", required_argument, NULL, 'B'},
55 {"button-dismiss", required_argument, NULL, 'z'},
56 {"button-dismiss-no-terminal", required_argument, NULL, 'Z'},
55 {"config", required_argument, NULL, 'c'}, 57 {"config", required_argument, NULL, 'c'},
56 {"debug", no_argument, NULL, 'd'}, 58 {"debug", no_argument, NULL, 'd'},
57 {"edge", required_argument, NULL, 'e'}, 59 {"edge", required_argument, NULL, 'e'},
@@ -90,6 +92,11 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
90 "be defined.\n" 92 "be defined.\n"
91 " -B, --button-no-terminal <text> <action> Like --button, but does" 93 " -B, --button-no-terminal <text> <action> Like --button, but does"
92 "not run the action in a terminal.\n" 94 "not run the action in a terminal.\n"
95 " -z, --button-dismiss <text> <action> Create a button with text that "
96 "dismisses swaynag, and executes action in a terminal when pressed. "
97 "Multiple buttons can be defined.\n"
98 " -Z, --button-dismiss-no-terminal <text> <action> Like "
99 "--button-dismiss, but does not run the action in a terminal.\n"
93 " -c, --config <path> Path to config file.\n" 100 " -c, --config <path> Path to config file.\n"
94 " -d, --debug Enable debugging.\n" 101 " -d, --debug Enable debugging.\n"
95 " -e, --edge top|bottom Set the edge to use.\n" 102 " -e, --edge top|bottom Set the edge to use.\n"
@@ -120,13 +127,15 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
120 127
121 optind = 1; 128 optind = 1;
122 while (1) { 129 while (1) {
123 int c = getopt_long(argc, argv, "b:B:c:de:f:hlL:m:o:s:t:v", opts, NULL); 130 int c = getopt_long(argc, argv, "b:B:z:Z:c:de:f:hlL:m:o:s:t:v", opts, NULL);
124 if (c == -1) { 131 if (c == -1) {
125 break; 132 break;
126 } 133 }
127 switch (c) { 134 switch (c) {
128 case 'b': // Button 135 case 'b': // Button
129 case 'B': // Button (No Terminal) 136 case 'B': // Button (No Terminal)
137 case 'z': // Button (Dismiss)
138 case 'Z': // Button (Dismiss, No Terminal)
130 if (swaynag) { 139 if (swaynag) {
131 if (optind >= argc) { 140 if (optind >= argc) {
132 fprintf(stderr, "Missing action for button %s\n", optarg); 141 fprintf(stderr, "Missing action for button %s\n", optarg);
@@ -138,6 +147,7 @@ int swaynag_parse_options(int argc, char **argv, struct swaynag *swaynag,
138 button->type = SWAYNAG_ACTION_COMMAND; 147 button->type = SWAYNAG_ACTION_COMMAND;
139 button->action = strdup(argv[optind]); 148 button->action = strdup(argv[optind]);
140 button->terminal = c == 'b'; 149 button->terminal = c == 'b';
150 button->dismiss = c == 'z' || c == 'Z';
141 list_add(swaynag->buttons, button); 151 list_add(swaynag->buttons, button);
142 } 152 }
143 optind++; 153 optind++;