mirror of
https://github.com/wizbright/waybox.git
synced 2025-10-29 05:40:20 -04:00
Implemented Openbox-compatible command-line options; hard-coded Alt+F2 to an application launcher; indicated the real purpose of WL_HIDE_DEPRECATED
This commit is contained in:
parent
9f2ddc48ef
commit
7570698224
5 changed files with 48 additions and 8 deletions
|
|
@ -1,9 +1,9 @@
|
|||
#ifndef SERVER_H
|
||||
#define SERVER_H
|
||||
|
||||
#ifndef _POSIX_C_SOURCE
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#endif
|
||||
//#ifndef _POSIX_C_SOURCE
|
||||
//#define _POSIX_C_SOURCE 200809L
|
||||
//#endif
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ project(
|
|||
|
||||
add_project_arguments('-Wno-unused-parameter', language: 'c')
|
||||
add_project_arguments('-DWLR_USE_UNSTABLE', language: 'c')
|
||||
add_project_arguments('-DVERSION="' + meson.project_version() + '"', language: 'c')
|
||||
|
||||
cc = meson.get_compiler('c')
|
||||
|
||||
|
|
@ -23,7 +24,7 @@ if cc.get_id() == 'clang'
|
|||
add_project_arguments('-Wno-missing-braces', language: 'c')
|
||||
endif
|
||||
|
||||
# Hiding depreciation warnings
|
||||
# Hide deprecated API
|
||||
add_project_arguments('-DWL_HIDE_DEPRECATED', language: 'c')
|
||||
|
||||
# Adding include directory
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
//#define _POSIX_C_SOURCE 200809L
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
//#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <wayland-server.h>
|
||||
#include <wlr/backend.h>
|
||||
|
||||
|
|
@ -9,6 +11,28 @@
|
|||
//struct wl_display* display = NULL;
|
||||
|
||||
int main(int argc, char **argv){
|
||||
char *startup_cmd;
|
||||
if (argc > 0) {
|
||||
int i;
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
if (!strcmp("--debug", argv[i]) || !strcmp("-v", argv[i]) || !strcmp("--exit", argv[i])) {
|
||||
printf("Warning: option %s is currently unimplemented\n", argv[i]);
|
||||
}
|
||||
else if ((!strcmp("--startup", argv[i]) || !strcmp("-s", argv[i])) && i < argc) {
|
||||
startup_cmd = argv[i + 1];
|
||||
}
|
||||
else if (!strcmp("--version", argv[i]) || !strcmp("-V", argv[i])) {
|
||||
printf(VERSION "\n");
|
||||
return 0;
|
||||
}
|
||||
else if (argv[i][0] == '-') {
|
||||
printf("Usage: %s [--debug] [--exit] [--help] [--startup CMD] [--version]\n", argv[0]);
|
||||
return strcmp("--help", argv[i]) != 0 && strcmp("-h", argv[i]) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct wb_server server = {0};
|
||||
|
||||
// Global display
|
||||
|
|
@ -25,6 +49,12 @@ int main(int argc, char **argv){
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
if (startup_cmd) {
|
||||
if (fork() == 0){
|
||||
execl("/bin/sh", "/bin/sh", "-c", startup_cmd, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
wl_display_run(server.wl_display);
|
||||
|
||||
terminate_wb(&server);
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
#include <unistd.h>
|
||||
|
||||
#include "waybox/seat.h"
|
||||
#include "waybox/xdg_shell.h"
|
||||
|
||||
|
|
@ -28,6 +30,12 @@ static bool handle_keybinding(struct wb_server *server, xkb_keysym_t sym, uint32
|
|||
wl_list_remove(¤t_view->link);
|
||||
wl_list_insert(server->views.prev, ¤t_view->link);
|
||||
}
|
||||
else if (modifiers & WLR_MODIFIER_ALT && sym == XKB_KEY_F2)
|
||||
{
|
||||
if (fork() == 0) {
|
||||
execl("/bin/sh", "/bin/sh", "-c", "(obrun || bemenu-run || synapse || gmrun || gnome-do || dmenu_run) 2>/dev/null", NULL);
|
||||
}
|
||||
}
|
||||
else return false;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#define _POSIX_C_SOURCE 200112L
|
||||
#include "waybox/seat.h"
|
||||
#include "waybox/xdg_shell.h"
|
||||
|
||||
|
|
@ -49,8 +50,8 @@ bool start_wb(struct wb_server* server) {
|
|||
return false;
|
||||
}
|
||||
|
||||
//printf("Running Wayland compositor on Wayland display '%s'\n", socket);
|
||||
//setenv("WAYLAND_DISPLAY", socket, true);
|
||||
printf("Running Wayland compositor on Wayland display '%s'\n", socket);
|
||||
setenv("WAYLAND_DISPLAY", socket, true);
|
||||
|
||||
wlr_gamma_control_manager_v1_create(server->wl_display);
|
||||
wlr_screencopy_manager_v1_create(server->wl_display);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue