Added --monitor

This commit is contained in:
Scoopta
2020-07-18 13:32:05 -07:00
parent e7672ff694
commit 3ab6a0d668
4 changed files with 30 additions and 2 deletions

View File

@@ -95,6 +95,7 @@ static void print_usage(char** argv) {
printf("--sort-order\t-O\tSets the sort order\n");
printf("--gtk-dark\t-G\tUses the dark variant of the current GTK theme\n");
printf("--search\t-Q\tSearch for something immediately on open\n");
printf("--monitor\t-o\tSets the monitor to open on\n");
exit(0);
}
@@ -414,6 +415,12 @@ int main(int argc, char** argv) {
.flag = NULL,
.val = 'Q'
},
{
.name = "monitor",
.has_arg = required_argument,
.flag = NULL,
.val = 'o'
},
{
.name = NULL,
.has_arg = 0,
@@ -449,13 +456,14 @@ int main(int argc, char** argv) {
char* sort_order = NULL;
char* gtk_dark = NULL;
char* search = NULL;
char* monitor = NULL;
struct wl_list options;
wl_list_init(&options);
struct option_node* node;
int opt;
while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aD:L:w:O:GQ:", opts, NULL)) != -1) {
while((opt = getopt_long(argc, argv, "hfc:s:C:dS:W:H:p:x:y:nImk:t:P::ebM:iqvl:aD:L:w:O:GQ:o:", opts, NULL)) != -1) {
switch(opt) {
case 'h':
print_usage(argv);
@@ -561,6 +569,9 @@ int main(int argc, char** argv) {
case 'Q':
search = optarg;
break;
case 'o':
monitor = optarg;
break;
}
}
@@ -747,6 +758,9 @@ int main(int argc, char** argv) {
if(search != NULL) {
map_put(config, "search", search);
}
if(monitor != NULL) {
map_put(config, "monitor", monitor);
}
struct sigaction sigact = {0};
sigact.sa_handler = sig;

View File

@@ -1617,6 +1617,7 @@ void wofi_init(struct map* _config) {
bool hide_search = strcmp(config_get(config, "hide_search", "false"), "true") == 0;
char* search = map_get(config, "search");
dynamic_lines = strcmp(config_get(config, "dynamic_lines", "false"), "true") == 0;
char* monitor = map_get(config, "monitor");
keys = map_init_void();
@@ -1713,6 +1714,13 @@ void wofi_init(struct map* _config) {
break;
}
}
} else if(monitor != NULL) {
wl_list_for_each(node, &outputs, link) {
if(strcmp(monitor, node->name) == 0) {
output = node->output;
break;
}
}
}
GdkWindow* gdk_win = gtk_widget_get_window(window);