update refresh rate patch to be per monitor, and config new monitor for talos
This commit is contained in:
@@ -12,10 +12,6 @@ static const int topbar = 1; /* 0 means bottom bar */
|
||||
static const char *fonts[] = {"Hack:size=10"};
|
||||
static const float rootcolor[] = COLOR(0x000000ff);
|
||||
|
||||
static const int refresh_rate = 239972; /* mHz 0 means auto */
|
||||
static const int s_width = 2560 /* 0 means auto */;
|
||||
static const int s_height = 1440 /* 0 means auto */;
|
||||
|
||||
/* This conforms to the xdg-protocol. Set the alpha to zero to restore the old behavior */
|
||||
static const float fullscreen_bg[] = {0.0f, 0.0f, 0.0f, 1.0f}; /* You can also use glsl colors */
|
||||
static uint32_t colors[][3] = {
|
||||
@@ -51,12 +47,11 @@ static const Layout layouts[] = {
|
||||
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
|
||||
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
|
||||
static const MonitorRule monrules[] = {
|
||||
/* name mfact nmaster scale layout rotate/reflect x y
|
||||
/* name mfact nmaster scale layout rotate/reflect x y width height refresh rate
|
||||
* example of a HiDPI laptop monitor:
|
||||
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */
|
||||
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
||||
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0 }, */
|
||||
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 2560, 1440, 239972 },
|
||||
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
||||
};
|
||||
|
||||
/* keyboard */
|
||||
|
||||
@@ -46,11 +46,12 @@ static const Layout layouts[] = {
|
||||
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
|
||||
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
|
||||
static const MonitorRule monrules[] = {
|
||||
/* name mfact nmaster scale layout rotate/reflect x y
|
||||
/* name mfact nmaster scale layout rotate/reflect x y width height refresh rate
|
||||
* example of a HiDPI laptop monitor:
|
||||
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */
|
||||
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
{ "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0 },
|
||||
{ "HDMI-A-2", 0.5f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 99982 },
|
||||
{ NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0 },
|
||||
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
||||
};
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
[
|
||||
(final: prev: {
|
||||
dwl = (
|
||||
prev.dwl.override {
|
||||
dwl =
|
||||
(prev.dwl.override {
|
||||
configH = ./config_files/dwl/config.h;
|
||||
enableXWayland = true;
|
||||
}
|
||||
);
|
||||
}).overrideAttrs
|
||||
(oldAttrs: {
|
||||
patches = oldAttrs.patches or [ ] ++ [
|
||||
../../patches/dwl/refresh_rate.patch
|
||||
];
|
||||
});
|
||||
})
|
||||
|
||||
(final: prev: {
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
--- dwl-bak/dwl.c 2026-04-09 15:53:00.841862418 +0200
|
||||
+++ dwl/dwl.c 2026-04-09 16:02:39.604999328 +0200
|
||||
@@ -1045,6 +1045,7 @@
|
||||
diff --git a/config.def.h b/config.def.h
|
||||
index 8a6eda0..7c7b565 100644
|
||||
--- a/config.def.h
|
||||
+++ b/config.def.h
|
||||
@@ -40,10 +40,10 @@ static const Layout layouts[] = {
|
||||
* WARNING: negative values other than (-1, -1) cause problems with Xwayland clients due to
|
||||
* https://gitlab.freedesktop.org/xorg/xserver/-/issues/899 */
|
||||
static const MonitorRule monrules[] = {
|
||||
- /* name mfact nmaster scale layout rotate/reflect x y
|
||||
+ /* name mfact nmaster scale layout rotate/reflect x y width height refresh rate
|
||||
* example of a HiDPI laptop monitor:
|
||||
- { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 }, */
|
||||
- { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1 },
|
||||
+ { "eDP-1", 0.5f, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0 0 }, */
|
||||
+ { NULL, 0.55f, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, -1, -1, 0, 0, 0 },
|
||||
/* default monitor rule: can be changed but cannot be eliminated; at least one monitor rule must exist */
|
||||
};
|
||||
|
||||
diff --git a/dwl.c b/dwl.c
|
||||
index 44f3ad9..8947d25 100644
|
||||
--- a/dwl.c
|
||||
+++ b/dwl.c
|
||||
@@ -215,6 +215,7 @@ typedef struct {
|
||||
const Layout *lt;
|
||||
enum wl_output_transform rr;
|
||||
int x, y;
|
||||
+ int width, height, refresh_rate;
|
||||
} MonitorRule;
|
||||
|
||||
typedef struct {
|
||||
@@ -1045,6 +1046,7 @@ createmon(struct wl_listener *listener, void *data)
|
||||
size_t i;
|
||||
struct wlr_output_state state;
|
||||
Monitor *m;
|
||||
@@ -8,24 +36,24 @@
|
||||
|
||||
if (!wlr_output_init_render(wlr_output, alloc, drw))
|
||||
return;
|
||||
@@ -1077,7 +1078,19 @@
|
||||
@@ -1077,7 +1079,19 @@ createmon(struct wl_listener *listener, void *data)
|
||||
* 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));
|
||||
+ if (refresh_rate || s_width || s_height) {
|
||||
+ wl_list_for_each(mode, &wlr_output->modes, link) {
|
||||
+ if ((refresh_rate == 0 || mode->refresh == refresh_rate) && (s_width == 0 || mode->width == s_width) && (s_height == 0 || mode->height == s_height)) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (mode == NULL) {
|
||||
+ printf("Was not able find output mode with (width, height, refresh rate): (%d, %d, %d)\n", s_width, s_height, refresh_rate);
|
||||
+ mode = wlr_output_preferred_mode(wlr_output);
|
||||
+ }
|
||||
+ if (r->refresh_rate || r->width || r->height) {
|
||||
+ wl_list_for_each(mode, &wlr_output->modes, link) {
|
||||
+ if ((r->refresh_rate == 0 || mode->refresh == r->refresh_rate) && (r->width == 0 || mode->width == r->width) && (r->height == 0 || mode->height == r->height)) {
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+ if (mode == NULL) {
|
||||
+ printf("Was not able find output mode with (width, height, refresh rate): (%d, %d, %d)\n", r->width, r->height, r->refresh_rate);
|
||||
+ mode = wlr_output_preferred_mode(wlr_output);
|
||||
+ }
|
||||
+
|
||||
+ wlr_output_state_set_mode(&state, mode);
|
||||
+ wlr_output_state_set_mode(&state, mode);
|
||||
|
||||
/* Set up event listeners */
|
||||
LISTEN(&wlr_output->events.frame, &m->frame, rendermon);
|
||||
|
||||
Reference in New Issue
Block a user