add spawn and termcmd
This commit is contained in:
parent
c82c000bd4
commit
bc9049a11b
8
config.h
8
config.h
|
@ -8,9 +8,13 @@ static const struct xkb_rule_names xkb_rules = {
|
||||||
|
|
||||||
#define MODKEY WLR_MODIFIER_ALT
|
#define MODKEY WLR_MODIFIER_ALT
|
||||||
|
|
||||||
|
/* commands */
|
||||||
|
static const char *termcmd[] = { "kitty", "-o", "linux_display_server=wayland", NULL };
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_Escape, quit, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd } },
|
||||||
{ MODKEY, XKB_KEY_F1, focusnext, {0} },
|
{ MODKEY, XKB_KEY_Escape, quit, {0} },
|
||||||
|
{ MODKEY, XKB_KEY_F1, focusnext, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Button buttons[] = {
|
static const Button buttons[] = {
|
||||||
|
|
11
dwl.c
11
dwl.c
|
@ -125,6 +125,7 @@ static void focusnext(struct dwl_server *, const Arg *);
|
||||||
static void movemouse(struct dwl_server *, const Arg *);
|
static void movemouse(struct dwl_server *, const Arg *);
|
||||||
static void quit(struct dwl_server *, const Arg *);
|
static void quit(struct dwl_server *, const Arg *);
|
||||||
static void resizemouse(struct dwl_server *, const Arg *);
|
static void resizemouse(struct dwl_server *, const Arg *);
|
||||||
|
static void spawn(struct dwl_server *, const Arg *);
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -187,6 +188,16 @@ static void quit(struct dwl_server *server, const Arg *unused) {
|
||||||
wl_display_terminate(server->wl_display);
|
wl_display_terminate(server->wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void spawn(struct dwl_server *server, const Arg *arg) {
|
||||||
|
if (fork() == 0) {
|
||||||
|
setsid();
|
||||||
|
execvp(((char **)arg->v)[0], (char **)arg->v);
|
||||||
|
fprintf(stderr, "dwl: execvp %s", ((char **)arg->v)[0]);
|
||||||
|
perror(" failed");
|
||||||
|
exit(EXIT_FAILURE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void focusnext(struct dwl_server *server, const Arg *unused) {
|
static void focusnext(struct dwl_server *server, const Arg *unused) {
|
||||||
/* Cycle to the next view */
|
/* Cycle to the next view */
|
||||||
if (wl_list_length(&server->views) < 2) {
|
if (wl_list_length(&server->views) < 2) {
|
||||||
|
|
Loading…
Reference in a new issue