show X root window name in spot1 title for a custom status bar
This commit is contained in:
2
config.h
2
config.h
@@ -128,7 +128,7 @@ binding keys[] = {
|
||||
// Only works for apps that use some form of their binary name as their class...
|
||||
{ .mod = AnyModifier, .key = XK_F1, .act = action_find_or_start, .data = "konsole" },
|
||||
{ .mod = AnyModifier, .key = XK_F2, .act = action_find_or_start, .data = "chromium" },
|
||||
{ .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "pcmanfm" },
|
||||
{ .mod = AnyModifier, .key = XK_F3, .act = action_find_or_start, .data = "thunar" },
|
||||
|
||||
{ .mod = AnyModifier, .key = XK_Menu, .act = action_command, .data = "xowl" },
|
||||
};
|
||||
|
||||
6
event.c
6
event.c
@@ -179,6 +179,12 @@ void property_notify(XEvent *ev)
|
||||
XPropertyEvent *e = &ev->xproperty;
|
||||
|
||||
client *c = window_build_client(e->window);
|
||||
if (e->window == root && e->atom == atoms[WM_NAME])
|
||||
{
|
||||
// root name appears in SPOT1 bar, for status etc
|
||||
update_bars();
|
||||
}
|
||||
else
|
||||
if (c && c->visible && c->manage)
|
||||
{
|
||||
client_update_border(c);
|
||||
|
||||
2
setup.c
2
setup.c
@@ -150,7 +150,7 @@ void setup()
|
||||
}
|
||||
|
||||
// become the window manager
|
||||
XSelectInput(display, root, StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask);
|
||||
XSelectInput(display, root, PropertyChangeMask | StructureNotifyMask | SubstructureRedirectMask | SubstructureNotifyMask);
|
||||
|
||||
// ewmh support
|
||||
unsigned long pid = getpid();
|
||||
|
||||
9
spot.c
9
spot.c
@@ -32,6 +32,15 @@ void spot_update_bar(int spot, int mon)
|
||||
char title[SPOT_BUFF]; *title = 0;
|
||||
monitor *m = &monitors[mon];
|
||||
|
||||
if (spot == SPOT1)
|
||||
{
|
||||
// Show X root window name in spot1 bar
|
||||
// Use xsetroot -name for a custom status
|
||||
char *tmp = NULL;
|
||||
if (XFetchName(display, root, &tmp))
|
||||
len += snprintf(title+len, MAX(0, SPOT_BUFF-len), " %s ", tmp);
|
||||
if (tmp) XFree(tmp);
|
||||
}
|
||||
for_windows(i, o) if (o->manage && o->spot == spot && o->monitor == mon)
|
||||
{
|
||||
if (!c) c = o;
|
||||
|
||||
Reference in New Issue
Block a user