make ty* fail nicely when in tmux/screen
This commit is contained in:
parent
e549612ab2
commit
0e0105e559
|
@ -63,43 +63,48 @@ gravatar.c gravatar.h \
|
||||||
tty_keys.h
|
tty_keys.h
|
||||||
|
|
||||||
tybg_SOURCES = \
|
tybg_SOURCES = \
|
||||||
|
tycommon.c \
|
||||||
tybg.c
|
tybg.c
|
||||||
|
|
||||||
tybg_CPPFLAGS = -I. \
|
tybg_CPPFLAGS = -I. \
|
||||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||||
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\"
|
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" @TERMINOLOGY_CFLAGS@
|
||||||
|
|
||||||
tybg_LDADD =
|
tybg_LDADD =
|
||||||
|
|
||||||
tyalpha_SOURCES = \
|
tyalpha_SOURCES = \
|
||||||
|
tycommon.c \
|
||||||
tyalpha.c
|
tyalpha.c
|
||||||
|
|
||||||
tyalpha_CPPFLAGS = -I. \
|
tyalpha_CPPFLAGS = -I. \
|
||||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||||
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\"
|
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" @TERMINOLOGY_CFLAGS@
|
||||||
|
|
||||||
tyalpha_LDADD =
|
tyalpha_LDADD =
|
||||||
|
|
||||||
typop_SOURCES = \
|
typop_SOURCES = \
|
||||||
|
tycommon.c \
|
||||||
typop.c
|
typop.c
|
||||||
|
|
||||||
typop_CPPFLAGS = -I. \
|
typop_CPPFLAGS = -I. \
|
||||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||||
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\"
|
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" @TERMINOLOGY_CFLAGS@
|
||||||
|
|
||||||
typop_LDADD =
|
typop_LDADD =
|
||||||
|
|
||||||
tyq_SOURCES = \
|
tyq_SOURCES = \
|
||||||
|
tycommon.c \
|
||||||
tyq.c
|
tyq.c
|
||||||
|
|
||||||
tyq_CPPFLAGS = -I. \
|
tyq_CPPFLAGS = -I. \
|
||||||
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
-DPACKAGE_BIN_DIR=\"$(bindir)\" -DPACKAGE_LIB_DIR=\"$(libdir)\" \
|
||||||
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\"
|
-DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" @TERMINOLOGY_CFLAGS@
|
||||||
|
|
||||||
tyq_LDADD =
|
tyq_LDADD =
|
||||||
|
|
||||||
tycat_SOURCES = \
|
tycat_SOURCES = \
|
||||||
tycat.c \
|
tycat.c \
|
||||||
|
tycommon.c \
|
||||||
extns.c extns.h
|
extns.c extns.h
|
||||||
|
|
||||||
tycat_CPPFLAGS = -I. \
|
tycat_CPPFLAGS = -I. \
|
||||||
|
@ -110,6 +115,7 @@ tycat_LDADD = @TERMINOLOGY_LIBS@
|
||||||
|
|
||||||
tyls_SOURCES = \
|
tyls_SOURCES = \
|
||||||
tyls.c \
|
tyls.c \
|
||||||
|
tycommon.c \
|
||||||
extns.h
|
extns.h
|
||||||
|
|
||||||
tyls_CPPFLAGS = -I. \
|
tyls_CPPFLAGS = -I. \
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Eina.h>
|
||||||
|
#include "tycommon.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, perm = 0;
|
int i, perm = 0;
|
||||||
|
|
||||||
if (!getenv("TERMINOLOGY")) return 0;
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
{
|
{
|
||||||
printf("Usage: %s [-p] on|off|<opacity level>\n"
|
printf("Usage: %s [-p] on|off|<opacity level>\n"
|
||||||
|
|
|
@ -4,12 +4,17 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Eina.h>
|
||||||
|
#include "tycommon.h"
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i, perm = 0;
|
int i, perm = 0;
|
||||||
|
|
||||||
if (!getenv("TERMINOLOGY")) return 0;
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
|
||||||
if (argc > 1 &&
|
if (argc > 1 &&
|
||||||
(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
|
(!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
|
||||||
{
|
{
|
||||||
|
|
|
@ -11,6 +11,8 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "tycommon.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
CENTER,
|
CENTER,
|
||||||
FILL,
|
FILL,
|
||||||
|
@ -308,7 +310,8 @@ main(int argc, char **argv)
|
||||||
char *rp;
|
char *rp;
|
||||||
Eina_List *file_q = NULL;
|
Eina_List *file_q = NULL;
|
||||||
|
|
||||||
if (!getenv("TERMINOLOGY")) return 0;
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
{
|
{
|
||||||
print_usage(argv[0]);
|
print_usage(argv[0]);
|
||||||
|
|
|
@ -0,0 +1,21 @@
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <Eina.h>
|
||||||
|
#include "tycommon.h"
|
||||||
|
|
||||||
|
|
||||||
|
Eina_Bool
|
||||||
|
is_running_in_terminology(void)
|
||||||
|
{
|
||||||
|
if (!getenv("TERMINOLOGY"))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
// Terminology's escape codes do not got through tmux
|
||||||
|
if (getenv("TMUX"))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
// Terminology's escape codes do not got through screen
|
||||||
|
if (getenv("STY"))
|
||||||
|
return EINA_FALSE;
|
||||||
|
|
||||||
|
return EINA_TRUE;
|
||||||
|
}
|
|
@ -0,0 +1,18 @@
|
||||||
|
#ifndef _TY_COMMON_H__
|
||||||
|
#define _TY_COMMON_H__ 1
|
||||||
|
|
||||||
|
Eina_Bool is_running_in_terminology(void);
|
||||||
|
|
||||||
|
#define ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1() \
|
||||||
|
do \
|
||||||
|
{ \
|
||||||
|
if (!is_running_in_terminology()) \
|
||||||
|
{ \
|
||||||
|
fprintf(stderr, "not running in terminology\n"); \
|
||||||
|
exit(1); \
|
||||||
|
} \
|
||||||
|
} \
|
||||||
|
while (0)
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
|
@ -11,6 +11,7 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
|
#include "tycommon.h"
|
||||||
|
|
||||||
// this code sucks. just letting you know... in advance... in case you
|
// this code sucks. just letting you know... in advance... in case you
|
||||||
// might be tempted to think otherwise... :)
|
// might be tempted to think otherwise... :)
|
||||||
|
@ -725,8 +726,9 @@ main(int argc, char **argv)
|
||||||
char *path;
|
char *path;
|
||||||
Eina_List *dirs = NULL;
|
Eina_List *dirs = NULL;
|
||||||
Tyls_Options options = {SMALL, EINA_FALSE};
|
Tyls_Options options = {SMALL, EINA_FALSE};
|
||||||
|
|
||||||
if (!getenv("TERMINOLOGY")) return 0;
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
|
||||||
if ((argc == 2) && (!strcmp(argv[1], "-h")))
|
if ((argc == 2) && (!strcmp(argv[1], "-h")))
|
||||||
{
|
{
|
||||||
printf("Usage: %s [-a] [-s|-m] FILE1 [FILE2 ...]\n"
|
printf("Usage: %s [-a] [-s|-m] FILE1 [FILE2 ...]\n"
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Eina.h>
|
||||||
|
#include "tycommon.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!getenv("TERMINOLOGY")) return 0;
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
{
|
{
|
||||||
printf("Usage: %s FILE1 [FILE2 ...]\n"
|
printf("Usage: %s FILE1 [FILE2 ...]\n"
|
||||||
|
|
|
@ -4,12 +4,16 @@
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <Eina.h>
|
||||||
|
#include "tycommon.h"
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char **argv)
|
main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!getenv("TERMINOLOGY")) return 0;
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
||||||
|
|
||||||
if (argc <= 1)
|
if (argc <= 1)
|
||||||
{
|
{
|
||||||
printf("Usage: %s FILE1 [FILE2 ...]\n"
|
printf("Usage: %s FILE1 [FILE2 ...]\n"
|
||||||
|
|
Loading…
Reference in New Issue