Skip to content

Instantly share code, notes, and snippets.

@dangra
Created May 19, 2010 21:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dangra/406858 to your computer and use it in GitHub Desktop.
Save dangra/406858 to your computer and use it in GitHub Desktop.
diff --git a/awesome.c b/awesome.c
index c2515cf..c74ce1c 100644
--- a/awesome.c
+++ b/awesome.c
@@ -330,6 +330,7 @@ exit_help(int exit_code)
-h, --help show help\n\
-v, --version show version\n\
-c, --config FILE configuration file to use\n\
+ -t, --nosystray disable builtin systray\n\
-k, --check check configuration file syntax\n");
exit(exit_code);
}
@@ -353,6 +354,7 @@ main(int argc, char **argv)
{ "version", 0, NULL, 'v' },
{ "config", 1, NULL, 'c' },
{ "check", 0, NULL, 'k' },
+ { "nosystray", 0, NULL, 't' },
{ NULL, 0, NULL, 0 }
};
@@ -368,6 +370,7 @@ main(int argc, char **argv)
p_clear(&globalconf, 1);
globalconf.keygrabber = LUA_REFNIL;
globalconf.mousegrabber = LUA_REFNIL;
+ globalconf.systray_is_active = 1;
/* save argv */
for(i = 0; i < argc; i++)
@@ -392,7 +395,7 @@ main(int argc, char **argv)
luaA_init(&xdg);
/* check args */
- while((opt = getopt_long(argc, argv, "vhkc:",
+ while((opt = getopt_long(argc, argv, "vhktc:",
long_options, NULL)) != -1)
switch(opt)
{
@@ -413,6 +416,9 @@ main(int argc, char **argv)
fprintf(stderr, "✔ Configuration file syntax OK.\n");
return EXIT_SUCCESS;
}
+ case 't':
+ globalconf.systray_is_active = 0;
+ break;
case 'c':
if(a_strlen(optarg))
confpath = a_strdup(optarg);
diff --git a/globalconf.h b/globalconf.h
index f0b9ec9..c53134b 100644
--- a/globalconf.h
+++ b/globalconf.h
@@ -65,6 +65,8 @@ typedef struct
screen_array_t screens;
/** True if xinerama is active */
bool xinerama_is_active;
+ /** True if systray is active */
+ bool systray_is_active;
/** Root window key bindings */
key_array_t keys;
/** Root window mouse bindings */
diff --git a/systray.c b/systray.c
index 1f573ee..c7befcf 100644
--- a/systray.c
+++ b/systray.c
@@ -44,6 +44,7 @@ systray_init(int phys_screen)
xcb_intern_atom_cookie_t atom_systray_q;
xcb_intern_atom_reply_t *atom_systray_r;
xcb_atom_t atom_systray;
+ xcb_window_t systray_owner;
/* Send requests */
if(!(atom_name = xcb_atom_name_by_screen("_NET_SYSTEM_TRAY", phys_screen)))
@@ -84,8 +85,13 @@ systray_init(int phys_screen)
p_delete(&atom_systray_r);
+ if(globalconf.systray_is_active)
+ systray_owner = globalconf.screens.tab[phys_screen].systray.window;
+ else
+ systray_owner = XCB_NONE;
+
xcb_set_selection_owner(globalconf.connection,
- globalconf.screens.tab[phys_screen].systray.window,
+ systray_owner,
atom_systray,
XCB_CURRENT_TIME);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment