Allow the user to set the WM_NAME atom value
This commit is contained in:
parent
6580e2d4f7
commit
531c575575
|
@ -6,7 +6,7 @@ lemonbar - Featherweight lemon-scented bar
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
=head1 SYNOPSIS
|
||||||
|
|
||||||
I<lemonbar> [-h | -g I<width>B<x>I<height>B<+>I<x>B<+>I<y> | -b | -d | -f I<font> | -p | -u I<pixel> | -B I<color> | -F I<color>]
|
I<lemonbar> [-h | -g I<width>B<x>I<height>B<+>I<x>B<+>I<y> | -b | -d | -f I<font> | -p | -n | -u I<pixel> | -B I<color> | -F I<color>]
|
||||||
|
|
||||||
=head1 DESCRIPTION
|
=head1 DESCRIPTION
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ changing the MAX_FONT_COUNT parameter in the source code).
|
||||||
|
|
||||||
Make the bar permanent, don't exit after the standard input is closed.
|
Make the bar permanent, don't exit after the standard input is closed.
|
||||||
|
|
||||||
|
=item B<-n>
|
||||||
|
|
||||||
|
Set the WM_NAME atom value for the bar.
|
||||||
|
|
||||||
=item B<-u> I<pixel>
|
=item B<-u> I<pixel>
|
||||||
|
|
||||||
Sets the underline width in pixels. The default is 1.
|
Sets the underline width in pixels. The default is 1.
|
||||||
|
|
16
lemonbar.c
16
lemonbar.c
|
@ -1080,7 +1080,7 @@ xconn (void)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
init (void)
|
init (char *wm_name)
|
||||||
{
|
{
|
||||||
// Try to load a default font
|
// Try to load a default font
|
||||||
if (!font_count)
|
if (!font_count)
|
||||||
|
@ -1168,6 +1168,10 @@ init (void)
|
||||||
// Make sure that the window really gets in the place it's supposed to be
|
// Make sure that the window really gets in the place it's supposed to be
|
||||||
// Some WM such as Openbox need this
|
// Some WM such as Openbox need this
|
||||||
xcb_configure_window(c, mon->window, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, (const uint32_t []){ mon->x, mon->y });
|
xcb_configure_window(c, mon->window, XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y, (const uint32_t []){ mon->x, mon->y });
|
||||||
|
|
||||||
|
// Set the WM_NAME atom to the user specified value
|
||||||
|
if (wm_name)
|
||||||
|
xcb_change_property(c, XCB_PROP_MODE_REPLACE, monhead->window, XCB_ATOM_WM_NAME, XCB_ATOM_STRING, 8 ,strlen(wm_name), wm_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_flush(c);
|
xcb_flush(c);
|
||||||
|
@ -1225,6 +1229,7 @@ main (int argc, char **argv)
|
||||||
bool permanent = false;
|
bool permanent = false;
|
||||||
int geom_v[4] = { -1, -1, 0, 0 };
|
int geom_v[4] = { -1, -1, 0, 0 };
|
||||||
int ch, areas;
|
int ch, areas;
|
||||||
|
char *wm_name;
|
||||||
|
|
||||||
// Install the parachute!
|
// Install the parachute!
|
||||||
atexit(cleanup);
|
atexit(cleanup);
|
||||||
|
@ -1239,12 +1244,13 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
// A safe default
|
// A safe default
|
||||||
areas = 10;
|
areas = 10;
|
||||||
|
wm_name = NULL;
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "hg:bdf:a:pu:B:F:")) != -1) {
|
while ((ch = getopt(argc, argv, "hg:bdf:a:pu:B:F:n:")) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'h':
|
case 'h':
|
||||||
printf ("lemonbar version %s\n", VERSION);
|
printf ("lemonbar version %s\n", VERSION);
|
||||||
printf ("usage: %s [-h | -g | -b | -d | -f | -a | -p | -u | -B | -F]\n"
|
printf ("usage: %s [-h | -g | -b | -d | -f | -a | -p | -n | -u | -B | -F]\n"
|
||||||
"\t-h Show this help\n"
|
"\t-h Show this help\n"
|
||||||
"\t-g Set the bar geometry {width}x{height}+{xoffset}+{yoffset}\n"
|
"\t-g Set the bar geometry {width}x{height}+{xoffset}+{yoffset}\n"
|
||||||
"\t-b Put the bar at the bottom of the screen\n"
|
"\t-b Put the bar at the bottom of the screen\n"
|
||||||
|
@ -1252,12 +1258,14 @@ main (int argc, char **argv)
|
||||||
"\t-f Set the font name to use\n"
|
"\t-f Set the font name to use\n"
|
||||||
"\t-a Number of clickable areas available (default is 10)\n"
|
"\t-a Number of clickable areas available (default is 10)\n"
|
||||||
"\t-p Don't close after the data ends\n"
|
"\t-p Don't close after the data ends\n"
|
||||||
|
"\t-n Set the WM_NAME atom to the specified value for this bar\n"
|
||||||
"\t-u Set the underline/overline height in pixels\n"
|
"\t-u Set the underline/overline height in pixels\n"
|
||||||
"\t-B Set background color in #AARRGGBB\n"
|
"\t-B Set background color in #AARRGGBB\n"
|
||||||
"\t-F Set foreground color in #AARRGGBB\n", argv[0]);
|
"\t-F Set foreground color in #AARRGGBB\n", argv[0]);
|
||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
case 'g': (void)parse_geometry_string(optarg, geom_v); break;
|
case 'g': (void)parse_geometry_string(optarg, geom_v); break;
|
||||||
case 'p': permanent = true; break;
|
case 'p': permanent = true; break;
|
||||||
|
case 'n': wm_name = optarg; break;
|
||||||
case 'b': topbar = false; break;
|
case 'b': topbar = false; break;
|
||||||
case 'd': dock = true; break;
|
case 'd': dock = true; break;
|
||||||
case 'f': font_load(optarg); break;
|
case 'f': font_load(optarg); break;
|
||||||
|
@ -1293,7 +1301,7 @@ main (int argc, char **argv)
|
||||||
xconn();
|
xconn();
|
||||||
|
|
||||||
// Do the heavy lifting
|
// Do the heavy lifting
|
||||||
init();
|
init(wm_name);
|
||||||
// Get the fd to Xserver
|
// Get the fd to Xserver
|
||||||
pollin[1].fd = xcb_get_file_descriptor(c);
|
pollin[1].fd = xcb_get_file_descriptor(c);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user