mirror of
https://codeberg.org/dwl/dwl.git
synced 2024-12-27 03:36:31 +00:00
use output layout for dirtomon
No need to track our own order; wlroots has a reasonable default for us already.
This commit is contained in:
parent
4bf2923f4e
commit
e8ca8a8ac7
2 changed files with 15 additions and 19 deletions
10
config.def.h
10
config.def.h
|
@ -32,8 +32,6 @@ 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, 0, 0 },
|
{ "eDP-1", 0.5, 1, 2, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0 },
|
||||||
*/
|
*/
|
||||||
/* the order in which monitors are defined here affects the order in which
|
|
||||||
* focusmon and tagmon cycle trough the monitors */
|
|
||||||
/* defaults */
|
/* defaults */
|
||||||
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0 },
|
{ NULL, 0.55, 1, 1, &layouts[0], WL_OUTPUT_TRANSFORM_NORMAL, 0, 0 },
|
||||||
};
|
};
|
||||||
|
@ -87,10 +85,10 @@ static const Key keys[] = {
|
||||||
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
{ MODKEY, XKB_KEY_e, togglefullscreen, {0} },
|
||||||
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
{ MODKEY, XKB_KEY_0, view, {.ui = ~0} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_parenright, tag, {.ui = ~0} },
|
||||||
{ MODKEY, XKB_KEY_comma, focusmon, {.i = -1} },
|
{ MODKEY, XKB_KEY_comma, focusmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
{ MODKEY, XKB_KEY_period, focusmon, {.i = +1} },
|
{ MODKEY, XKB_KEY_period, focusmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = -1} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_less, tagmon, {.i = WLR_DIRECTION_LEFT} },
|
||||||
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = +1} },
|
{ MODKEY|WLR_MODIFIER_SHIFT, XKB_KEY_greater, tagmon, {.i = WLR_DIRECTION_RIGHT} },
|
||||||
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
TAGKEYS( XKB_KEY_1, XKB_KEY_exclam, 0),
|
||||||
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
TAGKEYS( XKB_KEY_2, XKB_KEY_at, 1),
|
||||||
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
TAGKEYS( XKB_KEY_3, XKB_KEY_numbersign, 2),
|
||||||
|
|
24
dwl.c
24
dwl.c
|
@ -235,7 +235,7 @@ static void cursorframe(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);
|
||||||
static void destroyxdeco(struct wl_listener *listener, void *data);
|
static void destroyxdeco(struct wl_listener *listener, void *data);
|
||||||
static Monitor *dirtomon(int dir);
|
static Monitor *dirtomon(enum wlr_direction dir);
|
||||||
static void focusclient(Client *c, int lift);
|
static void focusclient(Client *c, int lift);
|
||||||
static void focusmon(const Arg *arg);
|
static void focusmon(const Arg *arg);
|
||||||
static void focusstack(const Arg *arg);
|
static void focusstack(const Arg *arg);
|
||||||
|
@ -1096,19 +1096,17 @@ fullscreennotify(struct wl_listener *listener, void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *
|
||||||
dirtomon(int dir)
|
dirtomon(enum wlr_direction dir)
|
||||||
{
|
{
|
||||||
Monitor *m;
|
struct wlr_output *next;
|
||||||
|
if ((next = wlr_output_layout_adjacent_output(output_layout,
|
||||||
if (dir > 0) {
|
dir, selmon->wlr_output, selmon->m.x, selmon->m.y)))
|
||||||
if (selmon->link.next == &mons)
|
return next->data;
|
||||||
return wl_container_of(mons.next, m, link);
|
if ((next = wlr_output_layout_farthest_output(output_layout,
|
||||||
return wl_container_of(selmon->link.next, m, link);
|
dir ^ (WLR_DIRECTION_LEFT|WLR_DIRECTION_RIGHT),
|
||||||
} else {
|
selmon->wlr_output, selmon->m.x, selmon->m.y)))
|
||||||
if (selmon->link.prev == &mons)
|
return next->data;
|
||||||
return wl_container_of(mons.prev, m, link);
|
return selmon;
|
||||||
return wl_container_of(selmon->link.prev, m, link);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in a new issue