2013-03-20 03:00:05 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <limits.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2016-07-30 07:31:56 -07:00
|
|
|
#include <Eina.h>
|
|
|
|
#include "tycommon.h"
|
|
|
|
|
2013-03-20 03:00:05 -07:00
|
|
|
int
|
|
|
|
main(int argc, char **argv)
|
|
|
|
{
|
|
|
|
int i, perm = 0;
|
2014-07-17 03:50:04 -07:00
|
|
|
|
2016-07-30 07:31:56 -07:00
|
|
|
ON_NOT_RUNNING_IN_TERMINOLOGY_EXIT_1();
|
|
|
|
|
2013-03-20 03:00:05 -07:00
|
|
|
if (argc <= 1)
|
|
|
|
{
|
2014-07-17 03:50:04 -07:00
|
|
|
printf("Usage: %s [-p] on|off|<opacity level>\n"
|
2013-03-20 03:00:05 -07:00
|
|
|
" Change the terminal transparency on or off\n"
|
|
|
|
" -p Make change permanent (stored in config)\n"
|
|
|
|
"\n",
|
|
|
|
argv[0]);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
for (i = 1; i < argc; i++)
|
|
|
|
{
|
|
|
|
char tbuf[PATH_MAX];
|
2014-07-17 03:50:04 -07:00
|
|
|
|
2013-03-20 03:00:05 -07:00
|
|
|
if (!strcmp(argv[i], "-p"))
|
|
|
|
{
|
|
|
|
perm = 1;
|
|
|
|
i++;
|
|
|
|
if (i >= argc) break;
|
|
|
|
}
|
|
|
|
if (perm)
|
|
|
|
snprintf(tbuf, sizeof(tbuf), "%c}ap%s", 0x1b, argv[i]);
|
|
|
|
else
|
|
|
|
snprintf(tbuf, sizeof(tbuf), "%c}at%s", 0x1b, argv[i]);
|
2015-02-03 20:57:21 -08:00
|
|
|
if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
|
2013-03-20 03:00:05 -07:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|