Add new configuration parameter panel_window_name to set WM_NAME (and WM_ICON_NAME) to identify multiple instances of tint2. (Issue 460).

git-svn-id: http://tint2.googlecode.com/svn/trunk@690 121b4492-b84c-0410-8b4c-0d4edfb3f3cc
This commit is contained in:
google@craigoakes.com 2015-02-08 12:13:32 +00:00
parent a11becfb2e
commit 51fe905b47
5 changed files with 13 additions and 2 deletions

View file

@ -287,6 +287,10 @@ void add_entry (char *key, char *value)
else if (strcmp (key, "disable_transparency") == 0) { else if (strcmp (key, "disable_transparency") == 0) {
server.disable_transparency = atoi (value); server.disable_transparency = atoi (value);
} }
else if (strcmp (key, "panel_window_name") == 0) {
if (strlen(value) > 0)
panel_window_name = strdup (value);
}
/* Battery */ /* Battery */
else if (strcmp (key, "battery_low_status") == 0) { else if (strcmp (key, "battery_low_status") == 0) {

View file

@ -53,6 +53,7 @@ int panel_position;
int panel_horizontal; int panel_horizontal;
int panel_refresh; int panel_refresh;
int task_dragged; int task_dragged;
char *panel_window_name;
int panel_autohide; int panel_autohide;
int panel_autohide_show_timeout; int panel_autohide_show_timeout;
@ -89,6 +90,7 @@ void default_panel()
panel_strut_policy = STRUT_FOLLOW_SIZE; panel_strut_policy = STRUT_FOLLOW_SIZE;
panel_dock = 0; // default not in the dock panel_dock = 0; // default not in the dock
panel_layer = BOTTOM_LAYER; // default is bottom layer panel_layer = BOTTOM_LAYER; // default is bottom layer
panel_window_name = "tint2";
wm_menu = 0; wm_menu = 0;
max_tick_urgent = 14; max_tick_urgent = 14;
mouse_left = TOGGLE_ICONIFY; mouse_left = TOGGLE_ICONIFY;
@ -498,12 +500,14 @@ void set_panel_items_order(Panel *p)
void set_panel_properties(Panel *p) void set_panel_properties(Panel *p)
{ {
XStoreName (server.dsp, p->main_win, "tint2"); XStoreName (server.dsp, p->main_win, panel_window_name);
XSetIconName (server.dsp, p->main_win, panel_window_name);
gsize len; gsize len;
gchar *name = g_locale_to_utf8("tint2", -1, NULL, &len, NULL); gchar *name = g_locale_to_utf8(panel_window_name, -1, NULL, &len, NULL);
if (name != NULL) { if (name != NULL) {
XChangeProperty(server.dsp, p->main_win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 8, PropModeReplace, (unsigned char *) name, (int) len); XChangeProperty(server.dsp, p->main_win, server.atom._NET_WM_NAME, server.atom.UTF8_STRING, 8, PropModeReplace, (unsigned char *) name, (int) len);
XChangeProperty(server.dsp, p->main_win, server.atom._NET_WM_ICON_NAME, server.atom.UTF8_STRING, 8, PropModeReplace, (unsigned char *) name, (int) len);
g_free(name); g_free(name);
} }

View file

@ -44,6 +44,7 @@ extern int panel_mode;
extern int wm_menu; extern int wm_menu;
extern int panel_dock; extern int panel_dock;
extern int panel_layer; extern int panel_layer;
extern char *panel_window_name;
//panel position //panel position
enum { LEFT=0x01, RIGHT=0x02, CENTER=0X04, TOP=0X08, BOTTOM=0x10 }; enum { LEFT=0x01, RIGHT=0x02, CENTER=0X04, TOP=0X08, BOTTOM=0x10 };

View file

@ -72,6 +72,7 @@ void server_init_atoms ()
server.atom._NET_WM_STRUT = XInternAtom (server.dsp, "_NET_WM_STRUT", False); server.atom._NET_WM_STRUT = XInternAtom (server.dsp, "_NET_WM_STRUT", False);
server.atom._NET_WM_ICON = XInternAtom (server.dsp, "_NET_WM_ICON", False); server.atom._NET_WM_ICON = XInternAtom (server.dsp, "_NET_WM_ICON", False);
server.atom._NET_WM_ICON_GEOMETRY = XInternAtom(server.dsp, "_NET_WM_ICON_GEOMETRY", False ); server.atom._NET_WM_ICON_GEOMETRY = XInternAtom(server.dsp, "_NET_WM_ICON_GEOMETRY", False );
server.atom._NET_WM_ICON_NAME = XInternAtom(server.dsp, "_NET_WM_ICON_NAME", False );
server.atom._NET_CLOSE_WINDOW = XInternAtom (server.dsp, "_NET_CLOSE_WINDOW", False); server.atom._NET_CLOSE_WINDOW = XInternAtom (server.dsp, "_NET_CLOSE_WINDOW", False);
server.atom.UTF8_STRING = XInternAtom (server.dsp, "UTF8_STRING", False); server.atom.UTF8_STRING = XInternAtom (server.dsp, "UTF8_STRING", False);
server.atom._NET_SUPPORTING_WM_CHECK = XInternAtom (server.dsp, "_NET_SUPPORTING_WM_CHECK", False); server.atom._NET_SUPPORTING_WM_CHECK = XInternAtom (server.dsp, "_NET_SUPPORTING_WM_CHECK", False);

View file

@ -57,6 +57,7 @@ typedef struct Global_atom
Atom _NET_WM_STRUT; Atom _NET_WM_STRUT;
Atom _NET_WM_ICON; Atom _NET_WM_ICON;
Atom _NET_WM_ICON_GEOMETRY; Atom _NET_WM_ICON_GEOMETRY;
Atom _NET_WM_ICON_NAME;
Atom _NET_CLOSE_WINDOW; Atom _NET_CLOSE_WINDOW;
Atom UTF8_STRING; Atom UTF8_STRING;
Atom _NET_SUPPORTING_WM_CHECK; Atom _NET_SUPPORTING_WM_CHECK;