Created
October 1, 2012 14:46
-
-
Save c00kiemon5ter/3812222 to your computer and use it in GitHub Desktop.
patch to allow the configuration of the instance name of xtmux window on the command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/tmux.c b/tmux.c | |
index 5d82ff5..3331f67 100644 | |
--- a/tmux.c | |
+++ b/tmux.c | |
@@ -52,6 +52,7 @@ pid_t environ_pid = -1; | |
int environ_idx = -1; | |
#ifdef XTMUX | |
char *xdisplay = NULL; | |
+char *res_name = NULL; | |
#endif | |
__dead void usage(void); | |
@@ -66,7 +67,11 @@ __dead void | |
usage(void) | |
{ | |
fprintf(stderr, | |
+#ifdef XTMUX | |
+ "usage: %s [-28lquvVx] [-n name] [-c shell-command] [-f file] [-L socket-name]\n" | |
+#else | |
"usage: %s [-28lquvV] [-c shell-command] [-f file] [-L socket-name]\n" | |
+#endif | |
" [-S socket-path] [command [flags]]\n", | |
__progname); | |
exit(1); | |
@@ -257,7 +262,7 @@ main(int argc, char **argv) | |
login_shell = (**argv == '-'); | |
while ((opt = getopt(argc, argv, "28c:df:lL:qS:uUvV" | |
#ifdef XTMUX | |
- "x" | |
+ "n:x" | |
#endif | |
)) != -1) { | |
switch (opt) { | |
@@ -310,6 +315,11 @@ main(int argc, char **argv) | |
optarg = getenv("DISPLAY"); | |
xdisplay = xstrdup(optarg); | |
break; | |
+ case 'n': | |
+ if (!optarg) | |
+ usage(); | |
+ res_name = xstrdup(optarg); | |
+ break; | |
#endif | |
default: | |
usage(); | |
diff --git a/tmux.h b/tmux.h | |
index e419c36..c365af1 100644 | |
--- a/tmux.h | |
+++ b/tmux.h | |
@@ -1371,6 +1371,7 @@ extern pid_t environ_pid; | |
extern int environ_idx; | |
#ifdef XTMUX | |
extern char *xdisplay; | |
+extern char *res_name; | |
#endif | |
void logfile(const char *); | |
const char *getshell(void); | |
diff --git a/xtmux.c b/xtmux.c | |
index 062d068..c524298 100644 | |
--- a/xtmux.c | |
+++ b/xtmux.c | |
@@ -836,7 +836,9 @@ xtmux_open(struct tty *tty, char **cause) | |
wm_hints.input = True; | |
wm_hints.initial_state = NormalState; | |
wm_hints.flags = InputHint | StateHint; | |
- class_hints.res_name = (char *)"xtmux"; | |
+ if (!res_name) | |
+ res_name = (char *)"xtmux"; | |
+ class_hints.res_name = xstrdup(res_name); | |
class_hints.res_class = (char *)"Xtmux"; | |
Xutf8SetWMProperties(x->display, x->window, "xtmux", "xtmux", NULL, 0, &size_hints, &wm_hints, &class_hints); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment