Compare commits
No commits in common. "ajh-conf" and "main" have entirely different histories.
48
config.def.h
48
config.def.h
|
@ -1,14 +1,7 @@
|
||||||
#include <X11/XF86keysym.h>
|
|
||||||
/* appearance */
|
/* appearance */
|
||||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
static const int sloppyfocus = 1; /* focus follows mouse */
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
static const unsigned int borderpx = 1; /* border pixel of windows */
|
||||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
||||||
static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
|
||||||
static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
|
||||||
static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
|
||||||
static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
|
||||||
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
|
||||||
static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
|
|
||||||
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
||||||
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
||||||
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
|
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
|
||||||
|
@ -90,20 +83,9 @@ static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
|
||||||
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
|
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
|
||||||
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
||||||
*/
|
*/
|
||||||
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
|
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
||||||
static const double accel_speed = 0.0;
|
static const double accel_speed = 0.0;
|
||||||
|
|
||||||
/* Autostart */
|
|
||||||
static const char *const autostart[] = {
|
|
||||||
"gammastep-init.sh", NULL,
|
|
||||||
"udiskie", NULL,
|
|
||||||
"dwl-bar.sh","-l", NULL,
|
|
||||||
"sh", "-c", "swaybg --image $HOME/.config/wall", NULL,
|
|
||||||
"hotkeys.sh", NULL,
|
|
||||||
"sh","-c","swayidle -w timeout 900 'waylock &' before-sleep 'waylock &'",NULL,
|
|
||||||
NULL /* terminate */
|
|
||||||
};
|
|
||||||
|
|
||||||
/* If you want to use the windows key change this to WLR_MODIFIER_LOGO */
|
/* If you want to use the windows key change this to WLR_MODIFIER_LOGO */
|
||||||
#define MODKEY WLR_MODIFIER_ALT
|
#define MODKEY WLR_MODIFIER_ALT
|
||||||
#define TAGKEYS(KEY,SKEY,TAG) \
|
#define TAGKEYS(KEY,SKEY,TAG) \
|
||||||
|
@ -116,11 +98,8 @@ static const char *const autostart[] = {
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
/* commands */
|
/* commands */
|
||||||
static const char *termcmd[] = { "foot", NULL };
|
static const char *termcmd[] = { "alacritty", NULL };
|
||||||
static const char *menucmd[] = { "bemenu-run", NULL };
|
static const char *menucmd[] = { "bemenu-run", NULL };
|
||||||
//static const char *volmute[] = { "vol.sh","--toggle-mute",NULL};
|
|
||||||
//static const char *volup[] = { "vol.sh","-i","0.02",NULL};
|
|
||||||
//static const char *voldown[] = { "vol.sh","-d","0.02",NULL};
|
|
||||||
|
|
||||||
static const Key keys[] = {
|
static const Key keys[] = {
|
||||||
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
/* Note that Shift changes certain key codes: c -> C, 2 -> at, etc. */
|
||||||
|
@ -133,22 +112,6 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
||||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
||||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
|
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
|
|
||||||
{ MODKEY, XKB_KEY_y, incihgaps, {.i = +1 } },
|
|
||||||
{ MODKEY, XKB_KEY_o, incihgaps, {.i = -1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_y, incivgaps, {.i = +1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_o, incivgaps, {.i = -1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_y, incohgaps, {.i = +1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_o, incohgaps, {.i = -1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Y, incovgaps, {.i = +1 } },
|
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, incovgaps, {.i = -1 } },
|
|
||||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
||||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
||||||
|
@ -174,19 +137,12 @@ static const Key keys[] = {
|
||||||
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
|
TAGKEYS( XKB_KEY_8, XKB_KEY_asterisk, 7),
|
||||||
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
|
TAGKEYS( XKB_KEY_9, XKB_KEY_parenleft, 8),
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Q, quit, {0} },
|
||||||
//{MODKEY, XKB_KEY_F10, spawn, {.v = volmute} },
|
|
||||||
//{MODKEY, XKB_KEY_F11, spawn, {.v = voldown} },
|
|
||||||
//{MODKEY, XKB_KEY_F12, spawn, {.v = volup} },
|
|
||||||
|
|
||||||
|
|
||||||
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
|
/* Ctrl-Alt-Backspace and Ctrl-Alt-Fx used to be handled by X server */
|
||||||
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
|
{ WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_Terminate_Server, quit, {0} },
|
||||||
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
|
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
|
||||||
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
|
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
|
||||||
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
|
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
|
||||||
//{ 0,XF86XK_AudioRaiseVolume, spawn,{.v = volup } },
|
|
||||||
//{ 0,XF86XK_AudioLowerVolume, spawn,{.v = voldown } },
|
|
||||||
//{ 0,XF86XK_AudioMute,spawn,{.v = volmute } },
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static const Button buttons[] = {
|
static const Button buttons[] = {
|
||||||
|
|
|
@ -11,5 +11,5 @@ MANDIR = $(PREFIX)/share/man
|
||||||
XWAYLAND =
|
XWAYLAND =
|
||||||
XLIBS =
|
XLIBS =
|
||||||
# Uncomment to build XWayland support
|
# Uncomment to build XWayland support
|
||||||
XWAYLAND = -DXWAYLAND
|
#XWAYLAND = -DXWAYLAND
|
||||||
XLIBS = xcb
|
#XLIBS = xcb
|
||||||
|
|
209
dwl.c
209
dwl.c
|
@ -177,10 +177,6 @@ struct Monitor {
|
||||||
struct wlr_box w; /* window area, layout-relative */
|
struct wlr_box w; /* window area, layout-relative */
|
||||||
struct wl_list layers[4]; /* LayerSurface::link */
|
struct wl_list layers[4]; /* LayerSurface::link */
|
||||||
const Layout *lt[2];
|
const Layout *lt[2];
|
||||||
int gappih; /* horizontal gap between windows */
|
|
||||||
int gappiv; /* vertical gap between windows */
|
|
||||||
int gappoh; /* horizontal outer gaps */
|
|
||||||
int gappov; /* vertical outer gaps */
|
|
||||||
unsigned int seltags;
|
unsigned int seltags;
|
||||||
unsigned int sellt;
|
unsigned int sellt;
|
||||||
unsigned int tagset[2];
|
unsigned int tagset[2];
|
||||||
|
@ -216,7 +212,6 @@ static void arrange(Monitor *m);
|
||||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
struct wlr_box *usable_area, int exclusive);
|
struct wlr_box *usable_area, int exclusive);
|
||||||
static void arrangelayers(Monitor *m);
|
static void arrangelayers(Monitor *m);
|
||||||
static void autostartexec(void);
|
|
||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
static void axisnotify(struct wl_listener *listener, void *data);
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
static void buttonpress(struct wl_listener *listener, void *data);
|
||||||
static void chvt(const Arg *arg);
|
static void chvt(const Arg *arg);
|
||||||
|
@ -234,7 +229,6 @@ static void createmon(struct wl_listener *listener, void *data);
|
||||||
static void createnotify(struct wl_listener *listener, void *data);
|
static void createnotify(struct wl_listener *listener, void *data);
|
||||||
static void createpointer(struct wlr_input_device *device);
|
static void createpointer(struct wlr_input_device *device);
|
||||||
static void cursorframe(struct wl_listener *listener, void *data);
|
static void cursorframe(struct wl_listener *listener, void *data);
|
||||||
static void defaultgaps(const Arg *arg);
|
|
||||||
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
||||||
static void destroylayersurfacenotify(struct wl_listener *listener, void *data);
|
static void destroylayersurfacenotify(struct wl_listener *listener, void *data);
|
||||||
static void destroynotify(struct wl_listener *listener, void *data);
|
static void destroynotify(struct wl_listener *listener, void *data);
|
||||||
|
@ -246,13 +240,6 @@ static void focusstack(const Arg *arg);
|
||||||
static Client *focustop(Monitor *m);
|
static Client *focustop(Monitor *m);
|
||||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void incgaps(const Arg *arg);
|
|
||||||
static void incigaps(const Arg *arg);
|
|
||||||
static void incihgaps(const Arg *arg);
|
|
||||||
static void incivgaps(const Arg *arg);
|
|
||||||
static void incogaps(const Arg *arg);
|
|
||||||
static void incohgaps(const Arg *arg);
|
|
||||||
static void incovgaps(const Arg *arg);
|
|
||||||
static void inputdevice(struct wl_listener *listener, void *data);
|
static void inputdevice(struct wl_listener *listener, void *data);
|
||||||
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
||||||
static void keypress(struct wl_listener *listener, void *data);
|
static void keypress(struct wl_listener *listener, void *data);
|
||||||
|
@ -281,7 +268,6 @@ static Client *selclient(void);
|
||||||
static void setcursor(struct wl_listener *listener, void *data);
|
static void setcursor(struct wl_listener *listener, void *data);
|
||||||
static void setfloating(Client *c, int floating);
|
static void setfloating(Client *c, int floating);
|
||||||
static void setfullscreen(Client *c, int fullscreen);
|
static void setfullscreen(Client *c, int fullscreen);
|
||||||
static void setgaps(int oh, int ov, int ih, int iv);
|
|
||||||
static void setlayout(const Arg *arg);
|
static void setlayout(const Arg *arg);
|
||||||
static void setmfact(const Arg *arg);
|
static void setmfact(const Arg *arg);
|
||||||
static void setmon(Client *c, Monitor *m, unsigned int newtags);
|
static void setmon(Client *c, Monitor *m, unsigned int newtags);
|
||||||
|
@ -296,7 +282,6 @@ static void tagmon(const Arg *arg);
|
||||||
static void tile(Monitor *m);
|
static void tile(Monitor *m);
|
||||||
static void togglefloating(const Arg *arg);
|
static void togglefloating(const Arg *arg);
|
||||||
static void togglefullscreen(const Arg *arg);
|
static void togglefullscreen(const Arg *arg);
|
||||||
static void togglegaps(const Arg *arg);
|
|
||||||
static void toggletag(const Arg *arg);
|
static void toggletag(const Arg *arg);
|
||||||
static void toggleview(const Arg *arg);
|
static void toggleview(const Arg *arg);
|
||||||
static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
|
static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
|
||||||
|
@ -348,8 +333,6 @@ static struct wlr_box sgeom;
|
||||||
static struct wl_list mons;
|
static struct wl_list mons;
|
||||||
static Monitor *selmon;
|
static Monitor *selmon;
|
||||||
|
|
||||||
static int enablegaps = 1; /* enables gaps, used by togglegaps */
|
|
||||||
|
|
||||||
/* global event handlers */
|
/* global event handlers */
|
||||||
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
||||||
static struct wl_listener cursor_button = {.notify = buttonpress};
|
static struct wl_listener cursor_button = {.notify = buttonpress};
|
||||||
|
@ -396,9 +379,6 @@ static Atom netatom[NetLast];
|
||||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
/* compile-time check if all tags fit into an unsigned int bit array. */
|
||||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
||||||
|
|
||||||
static pid_t *autostart_pids;
|
|
||||||
static size_t autostart_len;
|
|
||||||
|
|
||||||
/* function implementations */
|
/* function implementations */
|
||||||
void
|
void
|
||||||
applybounds(Client *c, struct wlr_box *bbox)
|
applybounds(Client *c, struct wlr_box *bbox)
|
||||||
|
@ -425,29 +405,6 @@ applybounds(Client *c, struct wlr_box *bbox)
|
||||||
c->geom.y = bbox->y;
|
c->geom.y = bbox->y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
autostartexec(void) {
|
|
||||||
const char *const *p;
|
|
||||||
size_t i = 0;
|
|
||||||
|
|
||||||
/* count entries */
|
|
||||||
for (p = autostart; *p; autostart_len++, p++)
|
|
||||||
while (*++p);
|
|
||||||
|
|
||||||
autostart_pids = calloc(autostart_len, sizeof(pid_t));
|
|
||||||
for (p = autostart; *p; i++, p++) {
|
|
||||||
if ((autostart_pids[i] = fork()) == 0) {
|
|
||||||
setsid();
|
|
||||||
execvp(*p, (char *const *)p);
|
|
||||||
fprintf(stderr, "dwl: execvp %s\n", *p);
|
|
||||||
perror(" failed");
|
|
||||||
_exit(EXIT_FAILURE);
|
|
||||||
}
|
|
||||||
/* skip arguments */
|
|
||||||
while (*++p);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
applyexclusive(struct wlr_box *usable_area,
|
applyexclusive(struct wlr_box *usable_area,
|
||||||
uint32_t anchor, int32_t exclusive,
|
uint32_t anchor, int32_t exclusive,
|
||||||
|
@ -964,11 +921,6 @@ createmon(struct wl_listener *listener, void *data)
|
||||||
/* Initialize monitor state using configured rules */
|
/* Initialize monitor state using configured rules */
|
||||||
for (size_t i = 0; i < LENGTH(m->layers); i++)
|
for (size_t i = 0; i < LENGTH(m->layers); i++)
|
||||||
wl_list_init(&m->layers[i]);
|
wl_list_init(&m->layers[i]);
|
||||||
|
|
||||||
m->gappih = gappih;
|
|
||||||
m->gappiv = gappiv;
|
|
||||||
m->gappoh = gappoh;
|
|
||||||
m->gappov = gappov;
|
|
||||||
m->tagset[0] = m->tagset[1] = 1;
|
m->tagset[0] = m->tagset[1] = 1;
|
||||||
for (r = monrules; r < END(monrules); r++) {
|
for (r = monrules; r < END(monrules); r++) {
|
||||||
if (!r->name || strstr(wlr_output->name, r->name)) {
|
if (!r->name || strstr(wlr_output->name, r->name)) {
|
||||||
|
@ -1106,12 +1058,6 @@ cursorframe(struct wl_listener *listener, void *data)
|
||||||
wlr_seat_pointer_notify_frame(seat);
|
wlr_seat_pointer_notify_frame(seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
defaultgaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(gappoh, gappov, gappih, gappiv);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
destroyidleinhibitor(struct wl_listener *listener, void *data)
|
destroyidleinhibitor(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1309,83 +1255,6 @@ incnmaster(const Arg *arg)
|
||||||
arrange(selmon);
|
arrange(selmon);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
incgaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(
|
|
||||||
selmon->gappoh + arg->i,
|
|
||||||
selmon->gappov + arg->i,
|
|
||||||
selmon->gappih + arg->i,
|
|
||||||
selmon->gappiv + arg->i
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
incigaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(
|
|
||||||
selmon->gappoh,
|
|
||||||
selmon->gappov,
|
|
||||||
selmon->gappih + arg->i,
|
|
||||||
selmon->gappiv + arg->i
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
incihgaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(
|
|
||||||
selmon->gappoh,
|
|
||||||
selmon->gappov,
|
|
||||||
selmon->gappih + arg->i,
|
|
||||||
selmon->gappiv
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
incivgaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(
|
|
||||||
selmon->gappoh,
|
|
||||||
selmon->gappov,
|
|
||||||
selmon->gappih,
|
|
||||||
selmon->gappiv + arg->i
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
incogaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(
|
|
||||||
selmon->gappoh + arg->i,
|
|
||||||
selmon->gappov + arg->i,
|
|
||||||
selmon->gappih,
|
|
||||||
selmon->gappiv
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
incohgaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(
|
|
||||||
selmon->gappoh + arg->i,
|
|
||||||
selmon->gappov,
|
|
||||||
selmon->gappih,
|
|
||||||
selmon->gappiv
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
incovgaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
setgaps(
|
|
||||||
selmon->gappoh,
|
|
||||||
selmon->gappov + arg->i,
|
|
||||||
selmon->gappih,
|
|
||||||
selmon->gappiv
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
inputdevice(struct wl_listener *listener, void *data)
|
inputdevice(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -1575,11 +1444,7 @@ monocle(Monitor *m)
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
continue;
|
continue;
|
||||||
if (!monoclegaps)
|
resize(c, m->w, 0);
|
||||||
resize(c, m->w, 0);
|
|
||||||
else
|
|
||||||
resize(c, (struct wlr_box){.x = m->w.x + gappoh, .y = m->w.y + gappov,
|
|
||||||
.width = m->w.width - 2 * gappoh, .height = m->w.height - 2 * gappov}, 0);
|
|
||||||
}
|
}
|
||||||
focusclient(focustop(m), 1);
|
focusclient(focustop(m), 1);
|
||||||
}
|
}
|
||||||
|
@ -1844,16 +1709,6 @@ printstatus(void)
|
||||||
void
|
void
|
||||||
quit(const Arg *arg)
|
quit(const Arg *arg)
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
|
|
||||||
/* kill child processes */
|
|
||||||
for (i = 0; i < autostart_len; i++) {
|
|
||||||
if (0 < autostart_pids[i]) {
|
|
||||||
kill(autostart_pids[i], SIGTERM);
|
|
||||||
waitpid(autostart_pids[i], NULL, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wl_display_terminate(dpy);
|
wl_display_terminate(dpy);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1943,7 +1798,6 @@ run(char *startup_cmd)
|
||||||
setenv("WAYLAND_DISPLAY", socket, 1);
|
setenv("WAYLAND_DISPLAY", socket, 1);
|
||||||
|
|
||||||
/* Now that the socket exists, run the startup command */
|
/* Now that the socket exists, run the startup command */
|
||||||
autostartexec();
|
|
||||||
if (startup_cmd) {
|
if (startup_cmd) {
|
||||||
int piperw[2];
|
int piperw[2];
|
||||||
if (pipe(piperw) < 0)
|
if (pipe(piperw) < 0)
|
||||||
|
@ -2064,16 +1918,6 @@ setfullscreen(Client *c, int fullscreen)
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
setgaps(int oh, int ov, int ih, int iv)
|
|
||||||
{
|
|
||||||
selmon->gappoh = MAX(oh, 0);
|
|
||||||
selmon->gappov = MAX(ov, 0);
|
|
||||||
selmon->gappih = MAX(ih, 0);
|
|
||||||
selmon->gappiv = MAX(iv, 0);
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
setlayout(const Arg *arg)
|
setlayout(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
@ -2332,24 +2176,11 @@ sigchld(int unused)
|
||||||
* setting our own disposition for SIGCHLD.
|
* setting our own disposition for SIGCHLD.
|
||||||
*/
|
*/
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
|
||||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
||||||
die("can't install SIGCHLD handler:");
|
die("can't install SIGCHLD handler:");
|
||||||
while (0 < (pid = waitpid(-1, NULL, WNOHANG))) {
|
while (0 < (pid = waitpid(-1, NULL, WNOHANG)))
|
||||||
pid_t *p, *lim;
|
|
||||||
if (pid == child_pid)
|
if (pid == child_pid)
|
||||||
child_pid = -1;
|
child_pid = -1;
|
||||||
if (!(p = autostart_pids))
|
|
||||||
continue;
|
|
||||||
lim = &p[autostart_len];
|
|
||||||
|
|
||||||
for (; p < lim; p++) {
|
|
||||||
if (*p == pid) {
|
|
||||||
*p = -1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2400,7 +2231,7 @@ tagmon(const Arg *arg)
|
||||||
void
|
void
|
||||||
tile(Monitor *m)
|
tile(Monitor *m)
|
||||||
{
|
{
|
||||||
unsigned int i, n = 0, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
|
unsigned int i, n = 0, mw, my, ty;
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link)
|
wl_list_for_each(c, &clients, link)
|
||||||
|
@ -2408,32 +2239,23 @@ tile(Monitor *m)
|
||||||
n++;
|
n++;
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (smartgaps == n) {
|
|
||||||
oe = 0; // outer gaps disabled
|
|
||||||
}
|
|
||||||
|
|
||||||
if (n > m->nmaster)
|
if (n > m->nmaster)
|
||||||
mw = m->nmaster ? (m->w.width + m->gappiv*ie) * m->mfact : 0;
|
mw = m->nmaster ? m->w.width * m->mfact : 0;
|
||||||
else
|
else
|
||||||
mw = m->w.width - 2*m->gappov*oe + m->gappiv*ie;
|
mw = m->w.width;
|
||||||
i = 0;
|
i = my = ty = 0;
|
||||||
my = ty = m->gappoh*oe;
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
||||||
continue;
|
continue;
|
||||||
if (i < m->nmaster) {
|
if (i < m->nmaster) {
|
||||||
r = MIN(n, m->nmaster) - i;
|
resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
||||||
h = (m->w.height - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
.height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
||||||
resize(c, (struct wlr_box){.x = m->w.x + m->gappov*oe, .y = m->w.y + my,
|
my += c->geom.height;
|
||||||
.width = mw - m->gappiv*ie, .height = h}, 0);
|
|
||||||
my += c->geom.height + m->gappih*ie;
|
|
||||||
} else {
|
} else {
|
||||||
r = n - i;
|
resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
|
||||||
h = (m->w.height - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
.width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
|
||||||
resize(c, (struct wlr_box){.x = m->w.x + mw + m->gappov*oe, .y = m->w.y + ty,
|
ty += c->geom.height;
|
||||||
.width = m->w.width - mw - 2*m->gappov*oe, .height = h}, 0);
|
|
||||||
ty += c->geom.height + m->gappih*ie;
|
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
@ -2456,13 +2278,6 @@ togglefullscreen(const Arg *arg)
|
||||||
setfullscreen(sel, !sel->isfullscreen);
|
setfullscreen(sel, !sel->isfullscreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
togglegaps(const Arg *arg)
|
|
||||||
{
|
|
||||||
enablegaps = !enablegaps;
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
toggletag(const Arg *arg)
|
toggletag(const Arg *arg)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,132 +0,0 @@
|
||||||
From 744a6ce137f30b4b4ab9271bfb5ea5b1ccf4423c Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
|
||||||
<leohdz172@protonmail.com>
|
|
||||||
Date: Wed, 9 Feb 2022 07:02:47 -0600
|
|
||||||
Subject: [PATCH] apply autostart patch from dwm
|
|
||||||
|
|
||||||
https://dwm.suckless.org/patches/cool_autostart/
|
|
||||||
---
|
|
||||||
config.def.h | 6 ++++++
|
|
||||||
dwl.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-
|
|
||||||
2 files changed, 58 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 29c6dbf8..35372a68 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -86,6 +86,12 @@ LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
|
|
||||||
static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
|
|
||||||
static const double accel_speed = 0.0;
|
|
||||||
|
|
||||||
+/* Autostart */
|
|
||||||
+static const char *const autostart[] = {
|
|
||||||
+ "sh", "-c", "swaybg --image /xap/local/background", NULL,
|
|
||||||
+ NULL /* terminate */
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
/* If you want to use the windows key change this to WLR_MODIFIER_LOGO */
|
|
||||||
#define MODKEY WLR_MODIFIER_ALT
|
|
||||||
#define TAGKEYS(KEY,SKEY,TAG) \
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index 40ea05a6..514ec4b0 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -213,6 +213,7 @@ static void arrange(Monitor *m);
|
|
||||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
|
||||||
struct wlr_box *usable_area, int exclusive);
|
|
||||||
static void arrangelayers(Monitor *m);
|
|
||||||
+static void autostartexec(void);
|
|
||||||
static void axisnotify(struct wl_listener *listener, void *data);
|
|
||||||
static void buttonpress(struct wl_listener *listener, void *data);
|
|
||||||
static void chvt(const Arg *arg);
|
|
||||||
@@ -379,6 +380,9 @@ static Atom netatom[NetLast];
|
|
||||||
/* compile-time check if all tags fit into an unsigned int bit array. */
|
|
||||||
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
|
|
||||||
|
|
||||||
+static pid_t *autostart_pids;
|
|
||||||
+static size_t autostart_len;
|
|
||||||
+
|
|
||||||
/* function implementations */
|
|
||||||
void
|
|
||||||
applybounds(Client *c, struct wlr_box *bbox)
|
|
||||||
@@ -403,6 +407,29 @@ applybounds(Client *c, struct wlr_box *bbox)
|
|
||||||
c->geom.y = bbox->y;
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+autostartexec(void) {
|
|
||||||
+ const char *const *p;
|
|
||||||
+ size_t i = 0;
|
|
||||||
+
|
|
||||||
+ /* count entries */
|
|
||||||
+ for (p = autostart; *p; autostart_len++, p++)
|
|
||||||
+ while (*++p);
|
|
||||||
+
|
|
||||||
+ autostart_pids = calloc(autostart_len, sizeof(pid_t));
|
|
||||||
+ for (p = autostart; *p; i++, p++) {
|
|
||||||
+ if ((autostart_pids[i] = fork()) == 0) {
|
|
||||||
+ setsid();
|
|
||||||
+ execvp(*p, (char *const *)p);
|
|
||||||
+ fprintf(stderr, "dwl: execvp %s\n", *p);
|
|
||||||
+ perror(" failed");
|
|
||||||
+ _exit(EXIT_FAILURE);
|
|
||||||
+ }
|
|
||||||
+ /* skip arguments */
|
|
||||||
+ while (*++p);
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
applyexclusive(struct wlr_box *usable_area,
|
|
||||||
uint32_t anchor, int32_t exclusive,
|
|
||||||
@@ -1721,6 +1748,16 @@ printstatus(void)
|
|
||||||
void
|
|
||||||
quit(const Arg *arg)
|
|
||||||
{
|
|
||||||
+ size_t i;
|
|
||||||
+
|
|
||||||
+ /* kill child processes */
|
|
||||||
+ for (i = 0; i < autostart_len; i++) {
|
|
||||||
+ if (0 < autostart_pids[i]) {
|
|
||||||
+ kill(autostart_pids[i], SIGTERM);
|
|
||||||
+ waitpid(autostart_pids[i], NULL, 0);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
wl_display_terminate(dpy);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1808,6 +1845,7 @@ run(char *startup_cmd)
|
|
||||||
setenv("WAYLAND_DISPLAY", socket, 1);
|
|
||||||
|
|
||||||
/* Now that the socket exists, run the startup command */
|
|
||||||
+ autostartexec();
|
|
||||||
if (startup_cmd) {
|
|
||||||
int piperw[2];
|
|
||||||
if (pipe(piperw) < 0)
|
|
||||||
@@ -2183,11 +2221,24 @@ sigchld(int unused)
|
|
||||||
* setting our own disposition for SIGCHLD.
|
|
||||||
*/
|
|
||||||
pid_t pid;
|
|
||||||
+
|
|
||||||
if (signal(SIGCHLD, sigchld) == SIG_ERR)
|
|
||||||
die("can't install SIGCHLD handler:");
|
|
||||||
- while (0 < (pid = waitpid(-1, NULL, WNOHANG)))
|
|
||||||
+ while (0 < (pid = waitpid(-1, NULL, WNOHANG))) {
|
|
||||||
+ pid_t *p, *lim;
|
|
||||||
if (pid == child_pid)
|
|
||||||
child_pid = -1;
|
|
||||||
+ if (!(p = autostart_pids))
|
|
||||||
+ continue;
|
|
||||||
+ lim = &p[autostart_len];
|
|
||||||
+
|
|
||||||
+ for (; p < lim; p++) {
|
|
||||||
+ if (*p == pid) {
|
|
||||||
+ *p = -1;
|
|
||||||
+ break;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
|
@ -1,145 +0,0 @@
|
||||||
From 8703fcdeac789425fbea768c3efa30884518e72e Mon Sep 17 00:00:00 2001
|
|
||||||
From: Faerryn <alexandre.liao@gmail.com>
|
|
||||||
Date: Thu, 26 May 2022 23:18:59 -0400
|
|
||||||
Subject: [PATCH 1/3] cursor wrap
|
|
||||||
|
|
||||||
---
|
|
||||||
dwl.c | 10 ++++++++++
|
|
||||||
1 file changed, 10 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index d0f5afc8..7427fa06 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -1107,6 +1107,16 @@ focusclient(Client *c, int lift)
|
|
||||||
struct wlr_keyboard *kb;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
+ /* Warp cursor to center of client if it is outside */
|
|
||||||
+ if (c && (cursor->x < c->geom.x ||
|
|
||||||
+ cursor->x > c->geom.x + c->geom.width ||
|
|
||||||
+ cursor->y < c->geom.y ||
|
|
||||||
+ cursor->y > c->geom.y + c->geom.height))
|
|
||||||
+ wlr_cursor_warp_closest( cursor,
|
|
||||||
+ NULL,
|
|
||||||
+ c->geom.x + c->geom.width / 2.0,
|
|
||||||
+ c->geom.y + c->geom.height / 2.0);
|
|
||||||
+
|
|
||||||
/* Raise client in stacking order if requested */
|
|
||||||
if (c && lift)
|
|
||||||
wlr_scene_node_raise_to_top(c->scene);
|
|
||||||
|
|
||||||
From 9cd5b806a96823fc10784a39c86d57156e749d11 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Faerryn <alexandre.liao@gmail.com>
|
|
||||||
Date: Fri, 27 May 2022 14:51:09 -0400
|
|
||||||
Subject: [PATCH 2/3] both focusclient and arrange will warp cursor
|
|
||||||
|
|
||||||
---
|
|
||||||
dwl.c | 26 ++++++++++++++++++--------
|
|
||||||
1 file changed, 18 insertions(+), 8 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index 7427fa06..2bdcaa56 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -290,6 +290,7 @@ static void updatetitle(struct wl_listener *listener, void *data);
|
|
||||||
static void urgent(struct wl_listener *listener, void *data);
|
|
||||||
static void view(const Arg *arg);
|
|
||||||
static void virtualkeyboard(struct wl_listener *listener, void *data);
|
|
||||||
+static void warpcursor(const Client *c);
|
|
||||||
static Monitor *xytomon(double x, double y);
|
|
||||||
static struct wlr_scene_node *xytonode(double x, double y, struct wlr_surface **psurface,
|
|
||||||
Client **pc, LayerSurface **pl, double *nx, double *ny);
|
|
||||||
@@ -489,6 +490,9 @@ arrange(Monitor *m)
|
|
||||||
if (m->lt[m->sellt]->arrange)
|
|
||||||
m->lt[m->sellt]->arrange(m);
|
|
||||||
/* TODO recheck pointer focus here... or in resize()? */
|
|
||||||
+ c = selclient();
|
|
||||||
+ if (c)
|
|
||||||
+ warpcursor(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
|
||||||
@@ -1108,14 +1112,8 @@ focusclient(Client *c, int lift)
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Warp cursor to center of client if it is outside */
|
|
||||||
- if (c && (cursor->x < c->geom.x ||
|
|
||||||
- cursor->x > c->geom.x + c->geom.width ||
|
|
||||||
- cursor->y < c->geom.y ||
|
|
||||||
- cursor->y > c->geom.y + c->geom.height))
|
|
||||||
- wlr_cursor_warp_closest( cursor,
|
|
||||||
- NULL,
|
|
||||||
- c->geom.x + c->geom.width / 2.0,
|
|
||||||
- c->geom.y + c->geom.height / 2.0);
|
|
||||||
+ if (c)
|
|
||||||
+ warpcursor(c);
|
|
||||||
|
|
||||||
/* Raise client in stacking order if requested */
|
|
||||||
if (c && lift)
|
|
||||||
@@ -2375,6 +2373,18 @@ virtualkeyboard(struct wl_listener *listener, void *data)
|
|
||||||
createkeyboard(device);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+warpcursor(const Client *c) {
|
|
||||||
+ if (cursor->x < c->geom.x ||
|
|
||||||
+ cursor->x > c->geom.x + c->geom.width ||
|
|
||||||
+ cursor->y < c->geom.y ||
|
|
||||||
+ cursor->y > c->geom.y + c->geom.height)
|
|
||||||
+ wlr_cursor_warp_closest(cursor,
|
|
||||||
+ NULL,
|
|
||||||
+ c->geom.x + c->geom.width / 2.0,
|
|
||||||
+ c->geom.y + c->geom.height / 2.0);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
Monitor *
|
|
||||||
xytomon(double x, double y)
|
|
||||||
{
|
|
||||||
|
|
||||||
From 95a8e2c3372b2dc245533001164b1e427751d394 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Faerryn <alexandre.liao@gmail.com>
|
|
||||||
Date: Sat, 28 May 2022 12:35:32 -0400
|
|
||||||
Subject: [PATCH 3/3] add an option to config.h for cursor_warp
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 3 +++
|
|
||||||
dwl.c | 4 ++--
|
|
||||||
2 files changed, 5 insertions(+), 2 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 4f131dda..f82dd582 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -6,6 +6,9 @@ static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
|
||||||
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
|
||||||
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
|
|
||||||
|
|
||||||
+/* cursor warping */
|
|
||||||
+static const bool cursor_warp = true;
|
|
||||||
+
|
|
||||||
/* tagging */
|
|
||||||
static const char *tags[] = { "1", "2", "3", "4", "5", "6", "7", "8", "9" };
|
|
||||||
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index 2bdcaa56..e593b152 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -491,7 +491,7 @@ arrange(Monitor *m)
|
|
||||||
m->lt[m->sellt]->arrange(m);
|
|
||||||
/* TODO recheck pointer focus here... or in resize()? */
|
|
||||||
c = selclient();
|
|
||||||
- if (c)
|
|
||||||
+ if (cursor_warp && c)
|
|
||||||
warpcursor(c);
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1112,7 +1112,7 @@ focusclient(Client *c, int lift)
|
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Warp cursor to center of client if it is outside */
|
|
||||||
- if (c)
|
|
||||||
+ if (cursor_warp && c)
|
|
||||||
warpcursor(c);
|
|
||||||
|
|
||||||
/* Raise client in stacking order if requested */
|
|
|
@ -1,343 +0,0 @@
|
||||||
From 9fe9e1c387b3b0fab3fa136b0e29fb2b8d90ff8b Mon Sep 17 00:00:00 2001
|
|
||||||
From: Bonicgamer <44382222+Bonicgamer@users.noreply.github.com>
|
|
||||||
Date: Mon, 17 Aug 2020 14:48:24 -0400
|
|
||||||
Subject: [PATCH 1/2] Implement vanitygaps
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 21 ++++++++
|
|
||||||
dwl.c | 150 +++++++++++++++++++++++++++++++++++++++++++++++----
|
|
||||||
2 files changed, 161 insertions(+), 10 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 29c6dbf8..9c798730 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -2,6 +2,11 @@
|
|
||||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
|
||||||
static const int lockfullscreen = 1; /* 1 will force focus on the fullscreen window */
|
|
||||||
+static const unsigned int gappih = 10; /* horiz inner gap between windows */
|
|
||||||
+static const unsigned int gappiv = 10; /* vert inner gap between windows */
|
|
||||||
+static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
|
||||||
+static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
|
||||||
+static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
|
||||||
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
|
||||||
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
|
||||||
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
|
|
||||||
@@ -112,6 +117,22 @@ static const Key keys[] = {
|
|
||||||
{ MODKEY, XKB_KEY_d, incnmaster, {.i = -1} },
|
|
||||||
{ MODKEY, XKB_KEY_h, setmfact, {.f = -0.05} },
|
|
||||||
{ MODKEY, XKB_KEY_l, setmfact, {.f = +0.05} },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_h, incgaps, {.i = +1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_l, incgaps, {.i = -1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_H, incogaps, {.i = +1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_L, incogaps, {.i = -1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_h, incigaps, {.i = +1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_CTRL, XKB_KEY_l, incigaps, {.i = -1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_0, togglegaps, {0} },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO|WLR_MODIFIER_SHIFT, XKB_KEY_parenright,defaultgaps, {0} },
|
|
||||||
+ { MODKEY, XKB_KEY_y, incihgaps, {.i = +1 } },
|
|
||||||
+ { MODKEY, XKB_KEY_o, incihgaps, {.i = -1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_y, incivgaps, {.i = +1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_CTRL, XKB_KEY_o, incivgaps, {.i = -1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_y, incohgaps, {.i = +1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_LOGO, XKB_KEY_o, incohgaps, {.i = -1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Y, incovgaps, {.i = +1 } },
|
|
||||||
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_O, incovgaps, {.i = -1 } },
|
|
||||||
{ MODKEY, XKB_KEY_Return, zoom, {0} },
|
|
||||||
{ MODKEY, XKB_KEY_Tab, view, {0} },
|
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_C, killclient, {0} },
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index 5ed534ee..dccf4133 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -178,6 +178,10 @@ struct Monitor {
|
|
||||||
struct wlr_box w; /* window area, layout-relative */
|
|
||||||
struct wl_list layers[4]; /* LayerSurface::link */
|
|
||||||
const Layout *lt[2];
|
|
||||||
+ int gappih; /* horizontal gap between windows */
|
|
||||||
+ int gappiv; /* vertical gap between windows */
|
|
||||||
+ int gappoh; /* horizontal outer gaps */
|
|
||||||
+ int gappov; /* vertical outer gaps */
|
|
||||||
unsigned int seltags;
|
|
||||||
unsigned int sellt;
|
|
||||||
unsigned int tagset[2];
|
|
||||||
@@ -230,6 +234,7 @@ static void createmon(struct wl_listener *listener, void *data);
|
|
||||||
static void createnotify(struct wl_listener *listener, void *data);
|
|
||||||
static void createpointer(struct wlr_input_device *device);
|
|
||||||
static void cursorframe(struct wl_listener *listener, void *data);
|
|
||||||
+static void defaultgaps(const Arg *arg);
|
|
||||||
static void destroyidleinhibitor(struct wl_listener *listener, void *data);
|
|
||||||
static void destroylayersurfacenotify(struct wl_listener *listener, void *data);
|
|
||||||
static void destroynotify(struct wl_listener *listener, void *data);
|
|
||||||
@@ -241,6 +246,13 @@ static void focusstack(const Arg *arg);
|
|
||||||
static Client *focustop(Monitor *m);
|
|
||||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
|
||||||
static void incnmaster(const Arg *arg);
|
|
||||||
+static void incgaps(const Arg *arg);
|
|
||||||
+static void incigaps(const Arg *arg);
|
|
||||||
+static void incihgaps(const Arg *arg);
|
|
||||||
+static void incivgaps(const Arg *arg);
|
|
||||||
+static void incogaps(const Arg *arg);
|
|
||||||
+static void incohgaps(const Arg *arg);
|
|
||||||
+static void incovgaps(const Arg *arg);
|
|
||||||
static void inputdevice(struct wl_listener *listener, void *data);
|
|
||||||
static int keybinding(uint32_t mods, xkb_keysym_t sym);
|
|
||||||
static void keypress(struct wl_listener *listener, void *data);
|
|
||||||
@@ -269,6 +281,7 @@ static Client *selclient(void);
|
|
||||||
static void setcursor(struct wl_listener *listener, void *data);
|
|
||||||
static void setfloating(Client *c, int floating);
|
|
||||||
static void setfullscreen(Client *c, int fullscreen);
|
|
||||||
+static void setgaps(int oh, int ov, int ih, int iv);
|
|
||||||
static void setlayout(const Arg *arg);
|
|
||||||
static void setmfact(const Arg *arg);
|
|
||||||
static void setmon(Client *c, Monitor *m, unsigned int newtags);
|
|
||||||
@@ -283,6 +296,7 @@ static void tagmon(const Arg *arg);
|
|
||||||
static void tile(Monitor *m);
|
|
||||||
static void togglefloating(const Arg *arg);
|
|
||||||
static void togglefullscreen(const Arg *arg);
|
|
||||||
+static void togglegaps(const Arg *arg);
|
|
||||||
static void toggletag(const Arg *arg);
|
|
||||||
static void toggleview(const Arg *arg);
|
|
||||||
static void unmaplayersurfacenotify(struct wl_listener *listener, void *data);
|
|
||||||
@@ -334,6 +348,8 @@ static struct wlr_box sgeom;
|
|
||||||
static struct wl_list mons;
|
|
||||||
static Monitor *selmon;
|
|
||||||
|
|
||||||
+static int enablegaps = 1; /* enables gaps, used by togglegaps */
|
|
||||||
+
|
|
||||||
/* global event handlers */
|
|
||||||
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
|
||||||
static struct wl_listener cursor_button = {.notify = buttonpress};
|
|
||||||
@@ -922,6 +938,11 @@ createmon(struct wl_listener *listener, void *data)
|
|
||||||
/* Initialize monitor state using configured rules */
|
|
||||||
for (size_t i = 0; i < LENGTH(m->layers); i++)
|
|
||||||
wl_list_init(&m->layers[i]);
|
|
||||||
+
|
|
||||||
+ m->gappih = gappih;
|
|
||||||
+ m->gappiv = gappiv;
|
|
||||||
+ m->gappoh = gappoh;
|
|
||||||
+ m->gappov = gappov;
|
|
||||||
m->tagset[0] = m->tagset[1] = 1;
|
|
||||||
for (r = monrules; r < END(monrules); r++) {
|
|
||||||
if (!r->name || strstr(wlr_output->name, r->name)) {
|
|
||||||
@@ -1059,6 +1080,12 @@ cursorframe(struct wl_listener *listener, void *data)
|
|
||||||
wlr_seat_pointer_notify_frame(seat);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+defaultgaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(gappoh, gappov, gappih, gappiv);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
destroyidleinhibitor(struct wl_listener *listener, void *data)
|
|
||||||
{
|
|
||||||
@@ -1263,6 +1290,83 @@ incnmaster(const Arg *arg)
|
|
||||||
arrange(selmon);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+incgaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(
|
|
||||||
+ selmon->gappoh + arg->i,
|
|
||||||
+ selmon->gappov + arg->i,
|
|
||||||
+ selmon->gappih + arg->i,
|
|
||||||
+ selmon->gappiv + arg->i
|
|
||||||
+ );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+incigaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(
|
|
||||||
+ selmon->gappoh,
|
|
||||||
+ selmon->gappov,
|
|
||||||
+ selmon->gappih + arg->i,
|
|
||||||
+ selmon->gappiv + arg->i
|
|
||||||
+ );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+incihgaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(
|
|
||||||
+ selmon->gappoh,
|
|
||||||
+ selmon->gappov,
|
|
||||||
+ selmon->gappih + arg->i,
|
|
||||||
+ selmon->gappiv
|
|
||||||
+ );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+incivgaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(
|
|
||||||
+ selmon->gappoh,
|
|
||||||
+ selmon->gappov,
|
|
||||||
+ selmon->gappih,
|
|
||||||
+ selmon->gappiv + arg->i
|
|
||||||
+ );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+incogaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(
|
|
||||||
+ selmon->gappoh + arg->i,
|
|
||||||
+ selmon->gappov + arg->i,
|
|
||||||
+ selmon->gappih,
|
|
||||||
+ selmon->gappiv
|
|
||||||
+ );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+incohgaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(
|
|
||||||
+ selmon->gappoh + arg->i,
|
|
||||||
+ selmon->gappov,
|
|
||||||
+ selmon->gappih,
|
|
||||||
+ selmon->gappiv
|
|
||||||
+ );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+incovgaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ setgaps(
|
|
||||||
+ selmon->gappoh,
|
|
||||||
+ selmon->gappov + arg->i,
|
|
||||||
+ selmon->gappih,
|
|
||||||
+ selmon->gappiv
|
|
||||||
+ );
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
inputdevice(struct wl_listener *listener, void *data)
|
|
||||||
{
|
|
||||||
@@ -1925,6 +2029,16 @@ setfullscreen(Client *c, int fullscreen)
|
|
||||||
printstatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+setgaps(int oh, int ov, int ih, int iv)
|
|
||||||
+{
|
|
||||||
+ selmon->gappoh = MAX(oh, 0);
|
|
||||||
+ selmon->gappov = MAX(ov, 0);
|
|
||||||
+ selmon->gappih = MAX(ih, 0);
|
|
||||||
+ selmon->gappiv = MAX(iv, 0);
|
|
||||||
+ arrange(selmon);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
setlayout(const Arg *arg)
|
|
||||||
{
|
|
||||||
@@ -2237,7 +2351,7 @@ tagmon(const Arg *arg)
|
|
||||||
void
|
|
||||||
tile(Monitor *m)
|
|
||||||
{
|
|
||||||
- unsigned int i, n = 0, mw, my, ty;
|
|
||||||
+ unsigned int i, n = 0, h, r, oe = enablegaps, ie = enablegaps, mw, my, ty;
|
|
||||||
Client *c;
|
|
||||||
|
|
||||||
wl_list_for_each(c, &clients, link)
|
|
||||||
@@ -2245,23 +2359,32 @@ tile(Monitor *m)
|
|
||||||
n++;
|
|
||||||
if (n == 0)
|
|
||||||
return;
|
|
||||||
+
|
|
||||||
+ if (smartgaps == n) {
|
|
||||||
+ oe = 0; // outer gaps disabled
|
|
||||||
+ }
|
|
||||||
|
|
||||||
if (n > m->nmaster)
|
|
||||||
- mw = m->nmaster ? m->w.width * m->mfact : 0;
|
|
||||||
+ mw = m->nmaster ? (m->w.width + m->gappiv*ie) * m->mfact : 0;
|
|
||||||
else
|
|
||||||
- mw = m->w.width;
|
|
||||||
- i = my = ty = 0;
|
|
||||||
+ mw = m->w.width - 2*m->gappov*oe + m->gappiv*ie;
|
|
||||||
+ i = 0;
|
|
||||||
+ my = ty = m->gappoh*oe;
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
|
||||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
|
||||||
continue;
|
|
||||||
if (i < m->nmaster) {
|
|
||||||
- resize(c, (struct wlr_box){.x = m->w.x, .y = m->w.y + my, .width = mw,
|
|
||||||
- .height = (m->w.height - my) / (MIN(n, m->nmaster) - i)}, 0);
|
|
||||||
- my += c->geom.height;
|
|
||||||
+ r = MIN(n, m->nmaster) - i;
|
|
||||||
+ h = (m->w.height - my - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
|
||||||
+ resize(c, (struct wlr_box){.x = m->w.x + m->gappov*oe, .y = m->w.y + my,
|
|
||||||
+ .width = mw - m->gappiv*ie, .height = h}, 0);
|
|
||||||
+ my += c->geom.height + m->gappih*ie;
|
|
||||||
} else {
|
|
||||||
- resize(c, (struct wlr_box){.x = m->w.x + mw, .y = m->w.y + ty,
|
|
||||||
- .width = m->w.width - mw, .height = (m->w.height - ty) / (n - i)}, 0);
|
|
||||||
- ty += c->geom.height;
|
|
||||||
+ r = n - i;
|
|
||||||
+ h = (m->w.height - ty - m->gappoh*oe - m->gappih*ie * (r - 1)) / r;
|
|
||||||
+ resize(c, (struct wlr_box){.x = m->w.x + mw + m->gappov*oe, .y = m->w.y + ty,
|
|
||||||
+ .width = m->w.width - mw - 2*m->gappov*oe, .height = h}, 0);
|
|
||||||
+ ty += c->geom.height + m->gappih*ie;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
@@ -2284,6 +2407,13 @@ togglefullscreen(const Arg *arg)
|
|
||||||
setfullscreen(sel, !sel->isfullscreen);
|
|
||||||
}
|
|
||||||
|
|
||||||
+void
|
|
||||||
+togglegaps(const Arg *arg)
|
|
||||||
+{
|
|
||||||
+ enablegaps = !enablegaps;
|
|
||||||
+ arrange(selmon);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
void
|
|
||||||
toggletag(const Arg *arg)
|
|
||||||
{
|
|
||||||
|
|
||||||
From 30511247632ff87ad4a6e658b7ade20c6edd1826 Mon Sep 17 00:00:00 2001
|
|
||||||
From: =?UTF-8?q?Leonardo=20Hern=C3=A1ndez=20Hern=C3=A1ndez?=
|
|
||||||
<leohdz172@protonmail.com>
|
|
||||||
Date: Wed, 20 Jul 2022 00:15:32 -0500
|
|
||||||
Subject: [PATCH 2/2] allow gaps in monocle layout if requested
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 1 +
|
|
||||||
dwl.c | 6 +++++-
|
|
||||||
2 files changed, 6 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 9c798730..90eb0932 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -7,6 +7,7 @@ static const unsigned int gappiv = 10; /* vert inner gap between window
|
|
||||||
static const unsigned int gappoh = 10; /* horiz outer gap between windows and screen edge */
|
|
||||||
static const unsigned int gappov = 10; /* vert outer gap between windows and screen edge */
|
|
||||||
static const int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
|
||||||
+static const int monoclegaps = 0; /* 1 means outer gaps in monocle layout */
|
|
||||||
static const float rootcolor[] = {0.3, 0.3, 0.3, 1.0};
|
|
||||||
static const float bordercolor[] = {0.5, 0.5, 0.5, 1.0};
|
|
||||||
static const float focuscolor[] = {1.0, 0.0, 0.0, 1.0};
|
|
||||||
diff --git a/dwl.c b/dwl.c
|
|
||||||
index dccf4133..7c217c89 100644
|
|
||||||
--- a/dwl.c
|
|
||||||
+++ b/dwl.c
|
|
||||||
@@ -1557,7 +1557,11 @@ monocle(Monitor *m)
|
|
||||||
wl_list_for_each(c, &clients, link) {
|
|
||||||
if (!VISIBLEON(c, m) || c->isfloating || c->isfullscreen)
|
|
||||||
continue;
|
|
||||||
- resize(c, m->w, 0);
|
|
||||||
+ if (!monoclegaps)
|
|
||||||
+ resize(c, m->w, 0);
|
|
||||||
+ else
|
|
||||||
+ resize(c, (struct wlr_box){.x = m->w.x + gappoh, .y = m->w.y + gappov,
|
|
||||||
+ .width = m->w.width - 2 * gappoh, .height = m->w.height - 2 * gappov}, 0);
|
|
||||||
}
|
|
||||||
focusclient(focustop(m), 1);
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
From 7182343aaf6c1fed1f5802aff948cfb4f3c82e69 Mon Sep 17 00:00:00 2001
|
|
||||||
From: 917Wolf <none>
|
|
||||||
Date: Thu, 6 May 2021 11:04:23 +0200
|
|
||||||
Subject: [PATCH] Found this in my old dwm config, moved it into dwl ... It
|
|
||||||
made my volum keys work again :)
|
|
||||||
|
|
||||||
---
|
|
||||||
config.def.h | 9 +++++++++
|
|
||||||
1 file changed, 9 insertions(+)
|
|
||||||
|
|
||||||
diff --git a/config.def.h b/config.def.h
|
|
||||||
index 089aa379..29a6d624 100644
|
|
||||||
--- a/config.def.h
|
|
||||||
+++ b/config.def.h
|
|
||||||
@@ -1,3 +1,4 @@
|
|
||||||
+#include <X11/XF86keysym.h>
|
|
||||||
/* appearance */
|
|
||||||
static const int sloppyfocus = 1; /* focus follows mouse */
|
|
||||||
static const unsigned int borderpx = 1; /* border pixel of windows */
|
|
||||||
@@ -62,6 +63,11 @@ static const int natural_scrolling = 0;
|
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
|
||||||
|
|
||||||
/* commands */
|
|
||||||
+// for cahnging the volume via alsa amixer //
|
|
||||||
+static const char *upvol[] = { "amixer", "-q", "-c", "0", "set", "Master", "2+", NULL };
|
|
||||||
+static const char *downvol[] = { "amixer", "-q", "-c", "0", "set", "Master", "2-", NULL };
|
|
||||||
+// for muting/unmuting //
|
|
||||||
+static const char *mute[] = { "amixer", "-q", "set", "Master", "toggle", NULL };
|
|
||||||
static const char *termcmd[] = { "alacritty", NULL };
|
|
||||||
static const char *menucmd[] = { "bemenu-run", NULL };
|
|
||||||
|
|
||||||
@@ -107,6 +113,9 @@ static const Key keys[] = {
|
|
||||||
#define CHVT(n) { WLR_MODIFIER_CTRL|WLR_MODIFIER_ALT,XKB_KEY_XF86Switch_VT_##n, chvt, {.ui = (n)} }
|
|
||||||
CHVT(1), CHVT(2), CHVT(3), CHVT(4), CHVT(5), CHVT(6),
|
|
||||||
CHVT(7), CHVT(8), CHVT(9), CHVT(10), CHVT(11), CHVT(12),
|
|
||||||
+ { 0,XF86XK_AudioRaiseVolume, spawn,{.v = upvol } },
|
|
||||||
+ { 0,XF86XK_AudioLowerVolume, spawn,{.v = downvol } },
|
|
||||||
+ { 0,XF86XK_AudioMute,spawn,{.v = mute } },
|
|
||||||
};
|
|
||||||
|
|
||||||
static const Button buttons[] = {
|
|
Loading…
Reference in New Issue