Add a --replace argument

Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
Uli Schlachter 2015-10-10 22:19:22 +02:00
parent 19111121ce
commit f6e633eee4
7 changed files with 20 additions and 3 deletions

View File

@ -260,7 +260,7 @@ acquire_WM_Sn(bool replace)
xcb_get_selection_owner(globalconf.connection, globalconf.selection_atom), xcb_get_selection_owner(globalconf.connection, globalconf.selection_atom),
NULL); NULL);
if (!replace && get_sel_reply->owner != XCB_NONE) if (!replace && get_sel_reply->owner != XCB_NONE)
fatal("another window manager is already running (selection owned)"); fatal("another window manager is already running (selection owned; use --replace)");
/* Acquire the selection */ /* Acquire the selection */
xcb_set_selection_owner(globalconf.connection, globalconf.selection_owner_window, xcb_set_selection_owner(globalconf.connection, globalconf.selection_owner_window,
@ -436,6 +436,7 @@ main(int argc, char **argv)
xdgHandle xdg; xdgHandle xdg;
bool no_argb = false; bool no_argb = false;
bool run_test = false; bool run_test = false;
bool replace_wm = false;
xcb_query_tree_cookie_t tree_c; xcb_query_tree_cookie_t tree_c;
static struct option long_options[] = static struct option long_options[] =
{ {
@ -444,6 +445,7 @@ main(int argc, char **argv)
{ "config", 1, NULL, 'c' }, { "config", 1, NULL, 'c' },
{ "check", 0, NULL, 'k' }, { "check", 0, NULL, 'k' },
{ "no-argb", 0, NULL, 'a' }, { "no-argb", 0, NULL, 'a' },
{ "replace", 0, NULL, 'r' },
{ NULL, 0, NULL, 0 } { NULL, 0, NULL, 0 }
}; };
@ -480,7 +482,7 @@ main(int argc, char **argv)
luaA_init(&xdg); luaA_init(&xdg);
/* check args */ /* check args */
while((opt = getopt_long(argc, argv, "vhkc:a", while((opt = getopt_long(argc, argv, "vhkc:ar",
long_options, NULL)) != -1) long_options, NULL)) != -1)
switch(opt) switch(opt)
{ {
@ -502,6 +504,9 @@ main(int argc, char **argv)
case 'a': case 'a':
no_argb = true; no_argb = true;
break; break;
case 'r':
replace_wm = true;
break;
} }
if (run_test) if (run_test)
@ -578,7 +583,7 @@ main(int argc, char **argv)
draw_test_cairo_xcb(); draw_test_cairo_xcb();
/* Acquire the WM_Sn selection */ /* Acquire the WM_Sn selection */
acquire_WM_Sn(true); acquire_WM_Sn(replace_wm);
/* initialize dbus */ /* initialize dbus */
a_dbus_init(); a_dbus_init();

View File

@ -35,6 +35,8 @@ OPTIONEN
Überprüft die Konfigurationsdatei auf Syntaxfehler. Überprüft die Konfigurationsdatei auf Syntaxfehler.
*-a*, *--no-argb*:: *-a*, *--no-argb*::
Verwende keine ARGB-Visuals Verwende keine ARGB-Visuals
*-r*, *--replace*::
Existierenden Fenstermanager ersetzen
TASTENBELEGUNG FÜR MAUSZEIGER TASTENBELEGUNG FÜR MAUSZEIGER
----------------------------- -----------------------------

View File

@ -52,6 +52,8 @@ OPCIONES
Verifica la sintaxis del archivo de configuración. Verifica la sintaxis del archivo de configuración.
*-a*, *--no-argb*:: *-a*, *--no-argb*::
No utilice colores ARGB. No utilice colores ARGB.
*-r*, *--replace*::
Replace an existing window manager
ATAJOS DE RAtÓN POR OMISIÓN ATAJOS DE RAtÓN POR OMISIÓN
--------------------------- ---------------------------

View File

@ -45,6 +45,8 @@ OPTIONS
Vérifie la syntaxe du fichier de configuration. Vérifie la syntaxe du fichier de configuration.
*-a*, *--no-argb*:: *-a*, *--no-argb*::
N'utilise pas le codage ARGB. N'utilise pas le codage ARGB.
*-r*, *--replace*::
Replace an existing window manager
ASSOCIATIONS AVEC LA SOURIS (PAR DÉFAUT) ASSOCIATIONS AVEC LA SOURIS (PAR DÉFAUT)
---------------------------------------- ----------------------------------------

View File

@ -52,6 +52,8 @@ OPZIONI
Verifica la sintassi del file di configurazione. Verifica la sintassi del file di configurazione.
*-a*, *--no-argb*:: *-a*, *--no-argb*::
Non usare visuali ARGB. Non usare visuali ARGB.
*-r*, *--replace*::
Replace an existing window manager
DEFAULT SCORCIATOIE CON IL MOUSE DEFAULT SCORCIATOIE CON IL MOUSE
-------------------------------- --------------------------------

View File

@ -47,6 +47,8 @@ awesome - потрясающий оконный менеджер
Проверить синтаксис конфигурационного файла. Проверить синтаксис конфигурационного файла.
*-a*, *--no-argb*:: *-a*, *--no-argb*::
Не использовать ARGB. Не использовать ARGB.
*-r*, *--replace*::
Replace an existing window manager
НАСТРОЙКИ МЫШИ ПО-УМОЛЧАНИЮ НАСТРОЙКИ МЫШИ ПО-УМОЛЧАНИЮ
--------------------------- ---------------------------

View File

@ -44,6 +44,8 @@ OPTIONS
Check configuration file syntax. Check configuration file syntax.
*-a*, *--no-argb*:: *-a*, *--no-argb*::
Don't use ARGB visuals. Don't use ARGB visuals.
*-r*, *--replace*::
Replace an existing window manager
DEFAULT MOUSE BINDINGS DEFAULT MOUSE BINDINGS
----------------------- -----------------------