commit 4c169736dbf267e8c33649cf7e392a0885d9276c
parent d24ed86cbe6d54c9def3c690bea0664bca8f9569
Author: Jake Koroman <jakekoroman@gmail.com>
Date: Sun, 31 Mar 2024 21:48:41 -0400
dwl and dwlb updates/hacks.
Diffstat:
4 files changed, 44 insertions(+), 17 deletions(-)
diff --git a/device-specific/desktop/dwl-hardware.h b/device-specific/desktop/dwl-hardware.h
@@ -9,8 +9,10 @@
/* monitors */
/* NOTE: ALWAYS add a fallback rule, even if you are completely sure it won't be used */
static const MonitorRule monrules[] = {
- /* name mfact nmaster scale layout rotate/reflect x y */
- { NULL, 0.50f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
+ /* name mfact nmaster scale layout rotate/reflect x y resx resy rate mode adaptive */
+ { "NULL", 0.50f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 0, 0, 0.0f, 0, 0},
+ { "DP-2", 0.50f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 1920, 0, 1920, 1080, 144.0f, 2, 1},
+ { "DP-3", 0.50f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0, 1920, 1080, 144.0f, 1, 0},
};
/* keyboard */
@@ -59,7 +61,7 @@ static const uint32_t send_events_mode = LIBINPUT_CONFIG_SEND_EVENTS_ENABLED;
LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT
LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE
*/
-static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_ADAPTIVE;
+static const enum libinput_config_accel_profile accel_profile = LIBINPUT_CONFIG_ACCEL_PROFILE_FLAT;
static const double accel_speed = -0.15;
/* You can choose between:
LIBINPUT_CONFIG_TAP_MAP_LRM -- 1/2/3 finger tap maps to left/right/middle
diff --git a/dwl/config.h b/dwl/config.h
@@ -44,7 +44,7 @@ static const Layout layouts[] = {
};
/* If you want to use the windows key for MODKEY, use WLR_MODIFIER_LOGO */
-#define MODKEY WLR_MODIFIER_ALT
+#define MODKEY WLR_MODIFIER_LOGO
#define TAGKEYS(KEY,SKEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
@@ -56,7 +56,8 @@ static const Layout layouts[] = {
#define SHCMD(cmd) { .v = (const char*[]){ "/bin/sh", "-c", cmd, NULL } }
/* commands */
-static const char *termcmd[] = { "foot", NULL };
+#define TERMINAL "foot"
+static const char *termcmd[] = { TERMINAL, NULL };
static const char *menucmd[] = { "bemenu-run", NULL };
static const char *pavucmd[] = { "pavucontrol", NULL };
static const char *bookmarkscmd[] = { "bookmarks", NULL };
@@ -72,6 +73,8 @@ static const Key keys[] = {
{ MODKEY, XKB_KEY_slash, spawn, {.v = bookmarkscmd} },
{ MODKEY, XKB_KEY_backslash, spawn, {.v = sshmenucmd} },
{ MODKEY, XKB_KEY_F12, spawn, {.v = passcmd} },
+ { MODKEY, XKB_KEY_n, spawn, SHCMD(TERMINAL " -e newsboat") },
+ { MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_N, spawn, SHCMD(TERMINAL " -e neomutt") },
{ MODKEY, XKB_KEY_F2, togglebar, {0} },
{ MODKEY, XKB_KEY_j, focusstack, {.i = +1} },
{ MODKEY, XKB_KEY_k, focusstack, {.i = -1} },
diff --git a/dwl/dwl.c b/dwl/dwl.c
@@ -226,6 +226,11 @@ typedef struct {
const Layout *lt;
enum wl_output_transform rr;
int x, y;
+ int resx;
+ int resy;
+ float rate;
+ int mode;
+ int adaptive;
} MonitorRule;
typedef struct {
@@ -985,9 +990,10 @@ createmon(struct wl_listener *listener, void *data)
/* This event is raised by the backend when a new output (aka a display or
* monitor) becomes available. */
struct wlr_output *wlr_output = data;
- const MonitorRule *r;
- size_t i;
- struct wlr_output_state state;
+ struct wlr_output_mode *mode = wl_container_of(wlr_output->modes.next, mode, link);
+ const MonitorRule *r;
+ size_t i;
+ struct wlr_output_state state;
Monitor *m;
if (!wlr_output_init_render(wlr_output, alloc, drw))
@@ -1015,15 +1021,23 @@ createmon(struct wl_listener *listener, void *data)
strncpy(m->ltsymbol, m->lt[m->sellt]->symbol, LENGTH(m->ltsymbol));
wlr_output_state_set_scale(&state, r->scale);
wlr_output_state_set_transform(&state, r->rr);
+
+ if(r->mode == -1)
+ wlr_output_state_set_custom_mode(&state, r->resx, r->resy,
+ (int) (r->rate > 0 ? r->rate * 1000 : 0));
+ else {
+ for (int j = 0; j < r->mode; j++) {
+ mode = wl_container_of(mode->link.next, mode, link);
+ }
+ wlr_output_state_set_mode(&state, mode);
+ }
+
+ wlr_output_state_set_adaptive_sync_enabled(&state, r->adaptive);
break;
}
}
- /* The mode is a tuple of (width, height, refresh rate), and each
- * monitor supports only a specific set of modes. We just pick the
- * monitor's preferred mode; a more sophisticated compositor would let
- * the user configure it. */
- wlr_output_state_set_mode(&state, wlr_output_preferred_mode(wlr_output));
+ wlr_output_init_render(wlr_output, alloc, drw);
/* Set up event listeners */
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
diff --git a/dwlb/dwlb.c b/dwlb/dwlb.c
@@ -492,12 +492,12 @@ layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
h = h * buffer_scale;
zwlr_layer_surface_v1_ack_configure(surface, serial);
-
+
Bar *bar = (Bar *)data;
-
+
if (bar->configured && w == bar->width && h == bar->height)
return;
-
+
bar->width = w;
bar->height = h;
bar->stride = bar->width * 4;
@@ -510,7 +510,15 @@ layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
static void
layer_surface_closed(void *data, struct zwlr_layer_surface_v1 *surface)
{
- run_display = false;
+ /*
+ * https://github.com/kolunmi/dwlb/issues/39
+ *
+ * NOTE(jake): this means the bar will never gracefully close but who cares.
+ * if i close dwl then most likely im turning off my computer so it doesnt matter
+ * how graceful it wants to be.
+ */
+
+ //run_display = false;
}
static const struct zwlr_layer_surface_v1_listener layer_surface_listener = {