Compare commits
8 commits
fb2c6e791c
...
bf648946c9
Author | SHA1 | Date | |
---|---|---|---|
bf648946c9 | |||
40f193a3df | |||
ce74ce116a | |||
3041a0b50c | |||
d3e9e5b6b8 | |||
7c13b834ee | |||
ce72953dc2 | |||
6c94b91f27 |
9 changed files with 151 additions and 18 deletions
6
.envrc
Normal file
6
.envrc
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
watch_file shell.nix
|
||||||
|
watch_file flake.lock
|
||||||
|
|
||||||
|
# try to use flakes, if it fails use normal nix (ie. shell.nix)
|
||||||
|
use flake || use nix
|
||||||
|
eval "$shellHook"
|
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -4,3 +4,6 @@ dwl
|
||||||
*-protocol.h
|
*-protocol.h
|
||||||
.ccls-cache
|
.ccls-cache
|
||||||
config.h
|
config.h
|
||||||
|
.direnv
|
||||||
|
custom_dwl.patch
|
||||||
|
.cache
|
||||||
|
|
2
Makefile
2
Makefile
|
@ -38,7 +38,7 @@ cursor-shape-v1-protocol.h:
|
||||||
config.h:
|
config.h:
|
||||||
cp config.def.h $@
|
cp config.def.h $@
|
||||||
clean:
|
clean:
|
||||||
rm -f dwl *.o *-protocol.h
|
rm -f dwl *.o *-protocol.h config.h
|
||||||
|
|
||||||
dist: clean
|
dist: clean
|
||||||
mkdir -p dwl-$(VERSION)
|
mkdir -p dwl-$(VERSION)
|
||||||
|
|
33
config.def.h
33
config.def.h
|
@ -14,6 +14,15 @@ static const float urgentcolor[] = COLOR(0xff0000ff);
|
||||||
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
|
/* To conform the xdg-protocol, set the alpha to zero to restore the old behavior */
|
||||||
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */
|
static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */
|
||||||
|
|
||||||
|
/* Autostart */
|
||||||
|
static const char *const autostart[] = {
|
||||||
|
"gammastep-indicator", NULL,
|
||||||
|
"foot", NULL,
|
||||||
|
"todoodoo", NULL,
|
||||||
|
"firefox", NULL,
|
||||||
|
NULL /* terminate */
|
||||||
|
};
|
||||||
|
|
||||||
/* tagging - TAGCOUNT must be no greater than 31 */
|
/* tagging - TAGCOUNT must be no greater than 31 */
|
||||||
#define TAGCOUNT (9)
|
#define TAGCOUNT (9)
|
||||||
|
|
||||||
|
@ -25,7 +34,8 @@ static const Rule rules[] = {
|
||||||
/* examples:
|
/* examples:
|
||||||
{ "Gimp", NULL, 0, 1, -1 },
|
{ "Gimp", NULL, 0, 1, -1 },
|
||||||
*/
|
*/
|
||||||
{ "firefox", NULL, 1 << 8, 0, -1 },
|
{ "todoodoo", NULL, 1 << 1, 0, 1 },
|
||||||
|
{ "firefox", NULL, 1 << 8, 0, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
/* layout(s) */
|
/* layout(s) */
|
||||||
|
@ -43,6 +53,7 @@ static const MonitorRule monrules[] = {
|
||||||
/* example of a HiDPI laptop monitor:
|
/* example of a HiDPI laptop monitor:
|
||||||
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||||
*/
|
*/
|
||||||
|
{ "DP-3", 0.5, 1, 1.5, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||||
/* defaults */
|
/* defaults */
|
||||||
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||||
};
|
};
|
||||||
|
@ -50,9 +61,10 @@ static const MonitorRule monrules[] = {
|
||||||
/* keyboard */
|
/* keyboard */
|
||||||
static const struct xkb_rule_names xkb_rules = {
|
static const struct xkb_rule_names xkb_rules = {
|
||||||
/* can specify fields: rules, model, layout, variant, options */
|
/* can specify fields: rules, model, layout, variant, options */
|
||||||
/* example:
|
.rules = NULL,
|
||||||
.options = "ctrl:nocaps",
|
.model = NULL,
|
||||||
*/
|
.layout = "us",
|
||||||
|
.variant = "intl",
|
||||||
.options = NULL,
|
.options = NULL,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -101,8 +113,8 @@ LIBINPUT_CONFIG_TAP_MAP_LMR -- 1/2/3 finger tap maps to left/middle/right
|
||||||
*/
|
*/
|
||||||
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TAP_MAP_LRM;
|
||||||
|
|
||||||
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
|
/* If you want to use the alt key for MODKEY, use WLR_MODIFIER_ALT */
|
||||||
#define MODKEY WLR_MODIFIER_ALT
|
#define MODKEY WLR_MODIFIER_LOGO
|
||||||
|
|
||||||
#define TAGKEYS(KEY,SKEY,TAG) \
|
#define TAGKEYS(KEY,SKEY,TAG) \
|
||||||
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
|
||||||
|
@ -113,15 +125,12 @@ static const enum libinput_config_tap_button_map button_map = LIBINPUT_CONFIG_TA
|
||||||
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
/* helper for spawning shell commands in the pre dwm-5.0 fashion */
|
||||||
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
|
||||||
|
|
||||||
/* commands */
|
|
||||||
static const char *termcmd[] = { "foot", NULL };
|
|
||||||
static const char *menucmd[] = { "bemenu-run", 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. */
|
||||||
/* modifier key function argument */
|
/* modifier key function argument */
|
||||||
{ MODKEY, XKB_KEY_p, spawn, {.v = menucmd} },
|
{ MODKEY, XKB_KEY_p, spawn, SHCMD("dmenu_path | wmenu | xargs -I_-_ /bin/sh -c \"exec _-_\"") },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = termcmd} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_S, spawn, SHCMD("slurp | grim -g - - | wl-copy -t image/png") },
|
||||||
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_Return, spawn, {.v = { "foot", NULL } } },
|
||||||
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
|
||||||
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
|
||||||
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
{ MODKEY, XKB_KEY_i, incnmaster, {.i = +1} },
|
||||||
|
|
59
dwl.c
59
dwl.c
|
@ -231,6 +231,7 @@ typedef struct {
|
||||||
|
|
||||||
/* function declarations */
|
/* function declarations */
|
||||||
static void applybounds(Client *c, struct wlr_box *bbox);
|
static void applybounds(Client *c, struct wlr_box *bbox);
|
||||||
|
static void autostartexec(void);
|
||||||
static void applyrules(Client *c);
|
static void applyrules(Client *c);
|
||||||
static void arrange(Monitor *m);
|
static void arrange(Monitor *m);
|
||||||
static void arrangelayer(Monitor *m, struct wl_list *list,
|
static void arrangelayer(Monitor *m, struct wl_list *list,
|
||||||
|
@ -403,6 +404,9 @@ static xcb_atom_t netatom[NetLast];
|
||||||
/* attempt to encapsulate suck into one file */
|
/* attempt to encapsulate suck into one file */
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
|
||||||
|
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)
|
||||||
|
@ -421,6 +425,27 @@ 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);
|
||||||
|
die("dwl: execvp %s:", *p);
|
||||||
|
}
|
||||||
|
/* skip arguments */
|
||||||
|
while (*++p);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
applyrules(Client *c)
|
applyrules(Client *c)
|
||||||
{
|
{
|
||||||
|
@ -630,11 +655,21 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
||||||
void
|
void
|
||||||
cleanup(void)
|
cleanup(void)
|
||||||
{
|
{
|
||||||
|
size_t i;
|
||||||
#ifdef XWAYLAND
|
#ifdef XWAYLAND
|
||||||
wlr_xwayland_destroy(xwayland);
|
wlr_xwayland_destroy(xwayland);
|
||||||
xwayland = NULL;
|
xwayland = NULL;
|
||||||
#endif
|
#endif
|
||||||
wl_display_destroy_clients(dpy);
|
wl_display_destroy_clients(dpy);
|
||||||
|
|
||||||
|
/* 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (child_pid > 0) {
|
if (child_pid > 0) {
|
||||||
kill(child_pid, SIGTERM);
|
kill(child_pid, SIGTERM);
|
||||||
waitpid(child_pid, NULL, 0);
|
waitpid(child_pid, NULL, 0);
|
||||||
|
@ -1294,18 +1329,31 @@ void
|
||||||
handlesig(int signo)
|
handlesig(int signo)
|
||||||
{
|
{
|
||||||
if (signo == SIGCHLD) {
|
if (signo == SIGCHLD) {
|
||||||
#ifdef XWAYLAND
|
|
||||||
siginfo_t in;
|
siginfo_t in;
|
||||||
/* wlroots expects to reap the XWayland process itself, so we
|
/* wlroots expects to reap the XWayland process itself, so we
|
||||||
* use WNOWAIT to keep the child waitable until we know it's not
|
* use WNOWAIT to keep the child waitable until we know it's not
|
||||||
* XWayland.
|
* XWayland.
|
||||||
*/
|
*/
|
||||||
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
|
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
|
||||||
&& (!xwayland || in.si_pid != xwayland->server->pid))
|
#ifdef XWAYLAND
|
||||||
waitpid(in.si_pid, NULL, 0);
|
&& (!xwayland || in.si_pid != xwayland->server->pid)
|
||||||
#else
|
|
||||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
|
||||||
#endif
|
#endif
|
||||||
|
) {
|
||||||
|
pid_t *p, *lim;
|
||||||
|
waitpid(in.si_pid, NULL, 0);
|
||||||
|
if (in.si_pid == child_pid)
|
||||||
|
child_pid = -1;
|
||||||
|
if (!(p = autostart_pids))
|
||||||
|
continue;
|
||||||
|
lim = &p[autostart_len];
|
||||||
|
|
||||||
|
for (; p < lim; p++) {
|
||||||
|
if (*p == in.si_pid) {
|
||||||
|
*p = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if (signo == SIGINT || signo == SIGTERM) {
|
} else if (signo == SIGINT || signo == SIGTERM) {
|
||||||
quit(NULL);
|
quit(NULL);
|
||||||
}
|
}
|
||||||
|
@ -1965,6 +2013,7 @@ run(char *startup_cmd)
|
||||||
die("startup: backend_start");
|
die("startup: backend_start");
|
||||||
|
|
||||||
/* Now that the socket exists and the backend is started, run the startup command */
|
/* Now that the socket exists and the backend is started, 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)
|
||||||
|
|
27
flake.lock
Normal file
27
flake.lock
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1704722960,
|
||||||
|
"narHash": "sha256-mKGJ3sPsT6//s+Knglai5YflJUF2DGj7Ai6Ynopz0kI=",
|
||||||
|
"owner": "nixos",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "317484b1ead87b9c1b8ac5261a8d2dd748a0492d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nixos",
|
||||||
|
"ref": "nixos-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
17
flake.nix
Normal file
17
flake.nix
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
description = "ToDooDoo";
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
};
|
||||||
|
outputs = { self, nixpkgs }:
|
||||||
|
let
|
||||||
|
supportedSystems = [ "x86_64-linux" ];
|
||||||
|
forAllSystems = nixpkgs.lib.genAttrs supportedSystems;
|
||||||
|
pkgsFor = nixpkgs.legacyPackages;
|
||||||
|
in {
|
||||||
|
devShells = forAllSystems (system: {
|
||||||
|
default = pkgsFor.${system}.callPackage ./shell.nix { };
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
1
generate_patch.sh
Executable file
1
generate_patch.sh
Executable file
|
@ -0,0 +1 @@
|
||||||
|
git diff v0.5 > custom_dwl.patch
|
21
shell.nix
Normal file
21
shell.nix
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
{ pkgs ? import <nixpkgs> { }, lib }:
|
||||||
|
let packages = with pkgs; [
|
||||||
|
pkg-config
|
||||||
|
wayland
|
||||||
|
wayland-protocols
|
||||||
|
wlroots
|
||||||
|
libxkbcommon
|
||||||
|
libinput
|
||||||
|
pixman
|
||||||
|
glibc
|
||||||
|
];
|
||||||
|
in
|
||||||
|
pkgs.mkShell {
|
||||||
|
inherit packages;
|
||||||
|
nativeBuildInputs = packages;
|
||||||
|
buildInputs = packages;
|
||||||
|
env = {
|
||||||
|
LIBCLANG_PATH = "${pkgs.libclang.lib}/lib";
|
||||||
|
LD_LIBRARY_PATH = "${lib.makeLibraryPath packages}";
|
||||||
|
};
|
||||||
|
}
|
Loading…
Reference in a new issue