@@ 1,15 1,23 @@
+/* Taken from https://github.com/djpohly/dwl/issues/466 */
+#define COLOR(hex) { ((hex >> 24) & 0xFF) / 255.0f, \
+ ((hex >> 16) & 0xFF) / 255.0f, \
+ ((hex >> 8) & 0xFF) / 255.0f, \
+ (hex & 0xFF) / 255.0f }
/* appearance */
static const int sloppyfocus = 1; /* focus follows mouse */
static const int bypass_surface_visibility = 0; /* 1 means idle inhibitors will disable idle tracking even if it's surface isn't visible */
static const unsigned int borderpx = 1; /* border pixel of windows */
-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 bordercolor[] = COLOR(0x444444ff);
+static const float focuscolor[] = COLOR(0x005577ff);
+static const float urgentcolor[] = COLOR(0xff0000ff);
/* 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};
+static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can also use glsl colors */
-/* tagging - tagcount must be no greater than 31 */
+/* tagging - TAGCOUNT must be no greater than 31 */
#define TAGCOUNT (9)
-static const int tagcount = TAGCOUNT;
+
+/* logging */
+static int log_level = WLR_ERROR;
static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */
@@ 7,6 7,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl v
+.Op Fl d
.Op Fl s Ar startup command
.Sh DESCRIPTION
.Nm
@@ 22,6 23,12 @@ option,
writes its name and version to standard error and exits unsuccessfully.
.Pp
When given the
+.Fl d
+option,
+.Nm
+enables full wlroots logging, including debug information.
+.Pp
+When given the
.Fl s
option,
.Nm
@@ 69,7 69,7 @@
#define VISIBLEON(C, M) ((M) && (C)->mon == (M) && ((C)->tags & (M)->tagset[(M)->seltags]))
#define LENGTH(X) (sizeof X / sizeof X[0])
#define END(A) ((A) + LENGTH(A))
-#define TAGMASK ((1u << tagcount) - 1)
+#define TAGMASK ((1u << TAGCOUNT) - 1)
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
@@ 1186,7 1186,7 @@ void
focusclient(Client *c, int lift)
{
struct wlr_surface *old = seat->keyboard_state.focused_surface;
- int i, unused_lx, unused_ly, old_client_type;
+ int unused_lx, unused_ly, old_client_type;
Client *old_c = NULL;
LayerSurface *old_l = NULL;
@@ 1217,8 1217,7 @@ focusclient(Client *c, int lift)
/* Don't change border color if there is an exclusive focus or we are
* handling a drag operation */
if (!exclusive_focus && !seat->drag)
- for (i = 0; i < 4; i++)
- wlr_scene_rect_set_color(c->border[i], focuscolor);
+ client_set_border_color(c, focuscolor);
}
/* Deactivate old client if focus is changing */
@@ 1235,8 1234,7 @@ focusclient(Client *c, int lift)
/* Don't deactivate old client if the new one wants focus, as this causes issues with winecfg
* and probably other clients */
} else if (old_c && !client_is_unmanaged(old_c) && (!c || !client_wants_focus(c))) {
- for (i = 0; i < 4; i++)
- wlr_scene_rect_set_color(old_c->border[i], bordercolor);
+ client_set_border_color(old_c, bordercolor);
client_activate_surface(old, 0);
}
@@ 2028,7 2026,8 @@ setfloating(Client *c, int floating)
c->isfloating = floating;
if (!c->mon)
return;
- wlr_scene_node_reparent(&c->scene->node, layers[c->isfloating ? LyrFloat : LyrTile]);
+ wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen
+ ? LyrFS : c->isfloating ? LyrFloat : LyrTile]);
arrange(c->mon);
printstatus();
}
@@ 2041,7 2040,7 @@ setfullscreen(Client *c, int fullscreen)
return;
c->bw = fullscreen ? 0 : borderpx;
client_set_fullscreen(c, fullscreen);
- wlr_scene_node_reparent(&c->scene->node, layers[fullscreen
+ wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen
? LyrFS : c->isfloating ? LyrFloat : LyrTile]);
if (fullscreen) {
@@ 2161,6 2160,8 @@ setup(void)
for (i = 0; i < LENGTH(sig); i++)
sigaction(sig[i], &sa, NULL);
+ wlr_log_init(log_level, NULL);
+
/* The Wayland display is managed by libwayland. It handles accepting
* clients from the Unix socket, manging Wayland globals, and so on. */
dpy = wl_display_create();
@@ 2627,6 2628,7 @@ urgent(struct wl_listener *listener, void *data)
if (!c || c == focustop(selmon))
return;
+ client_set_border_color(c, urgentcolor);
c->isurgent = 1;
printstatus();
}
@@ 2808,6 2810,7 @@ sethints(struct wl_listener *listener, void *data)
if (c == focustop(selmon))
return;
+ client_set_border_color(c, urgentcolor);
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
printstatus();
}
@@ 2850,9 2853,11 @@ main(int argc, char *argv[])
char *startup_cmd = NULL;
int c;
- while ((c = getopt(argc, argv, "s:hv")) != -1) {
+ while ((c = getopt(argc, argv, "s:hdv")) != -1) {
if (c == 's')
startup_cmd = optarg;
+ else if (c == 'd')
+ log_level = WLR_DEBUG;
else if (c == 'v')
die("dwl " VERSION);
else
@@ 2870,5 2875,5 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
usage:
- die("Usage: %s [-v] [-s startup command]", argv[0]);
+ die("Usage: %s [-v] [-d] [-s startup command]", argv[0]);
}