Style nits

This commit is contained in:
Keith Bowes 2020-02-26 10:31:22 -05:00
parent 8e39503490
commit a495d1e8e9
2 changed files with 9 additions and 15 deletions

View file

@ -5,23 +5,19 @@
#include "waybox/server.h" #include "waybox/server.h"
int main(int argc, char **argv){ int main(int argc, char **argv) {
char *startup_cmd = NULL; char *startup_cmd = NULL;
if (argc > 0) { if (argc > 0) {
int i; int i;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++) {
{
if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i]) || !strcmp("--exit", argv[i])) { if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i]) || !strcmp("--exit", argv[i])) {
printf("Warning: option %s is currently unimplemented\n", argv[i]); printf("Warning: option %s is currently unimplemented\n", argv[i]);
} } else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i])) && i < argc) {
else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i])) && i < argc) {
startup_cmd = argv[i + 1]; startup_cmd = argv[i + 1];
} } else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
printf(VERSION "\n"); printf(VERSION "\n");
return 0; return 0;
} } else if (argv[i][0] == '-') {
else if (argv[i][0] == '-') {
printf("Usage: %s [--debug] [--exit] [--help] [--startup CMD] [--version]\n", argv[0]); printf("Usage: %s [--debug] [--exit] [--help] [--startup CMD] [--version]\n", argv[0]);
return strcmp("--help", argv[i]) != 0 && strcmp("-h", argv[i]) != 0; return strcmp("--help", argv[i]) != 0 && strcmp("-h", argv[i]) != 0;
} }

View file

@ -12,8 +12,7 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
if (modifiers & WLR_MODIFIER_CTRL && sym == XKB_KEY_Escape) { if (modifiers & WLR_MODIFIER_CTRL && sym == XKB_KEY_Escape) {
wl_display_terminate(server->wl_display); wl_display_terminate(server->wl_display);
} } else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_Tab) {
else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_Tab) {
/* Cycle to the next view */ /* Cycle to the next view */
if (wl_list_length(&server->views) < 2) { if (wl_list_length(&server->views) < 2) {
return false; return false;
@ -26,14 +25,13 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
/* Move the previous view to the end of the list */ /* Move the previous view to the end of the list */
wl_list_remove(&current_view->link); wl_list_remove(&current_view->link);
wl_list_insert(server->views.prev, &current_view->link); wl_list_insert(server->views.prev, &current_view->link);
} } else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_F2) {
else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_F2)
{
if (fork() == 0) { if (fork() == 0) {
execl("/bin/sh", "/bin/sh", "-c", "(obrun || bemenu-run || synapse || gmrun || gnome-do || dmenu_run) 2>/dev/null", NULL); execl("/bin/sh", "/bin/sh", "-c", "(obrun || bemenu-run || synapse || gmrun || gnome-do || dmenu_run) 2>/dev/null", NULL);
} }
} else {
return false;
} }
else return false;
return true; return true;
} }