parent
edd37bbae7
commit
64196937ab
13 changed files with 407 additions and 51 deletions
@ -0,0 +1,42 @@ |
||||
#include <stdio.h> |
||||
#include <limits.h> |
||||
#include <stdlib.h> |
||||
#include <unistd.h> |
||||
#include <string.h> |
||||
|
||||
int |
||||
main(int argc, char **argv) |
||||
{ |
||||
int i, perm = 0; |
||||
|
||||
if (!getenv("TERMINOLOGY")) return 0; |
||||
if (argc <= 1) |
||||
{ |
||||
printf("Usage: %s [-p] on|off\n" |
||||
" 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]; |
||||
|
||||
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]); |
||||
if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); |
||||
tbuf[0] = 0; |
||||
if (write(0, tbuf, 1) < 1) perror("write"); |
||||
} |
||||
exit(0); |
||||
return 0; |
||||
} |
@ -0,0 +1,44 @@ |
||||
#include <stdio.h> |
||||
#include <limits.h> |
||||
#include <stdlib.h> |
||||
#include <unistd.h> |
||||
#include <string.h> |
||||
|
||||
int |
||||
main(int argc, char **argv) |
||||
{ |
||||
int i, perm = 0; |
||||
|
||||
if (!getenv("TERMINOLOGY")) return 0; |
||||
if (argc <= 1) |
||||
{ |
||||
printf("Usage: %s [-p] FILE1 [FILE2 ...]\n" |
||||
" Change the terminal background to the given file/uri\n" |
||||
" -p Make change permanent (stored in config)\n" |
||||
"\n", |
||||
argv[0]); |
||||
return 0; |
||||
} |
||||
for (i = 1; i < argc; i++) |
||||
{ |
||||
char *path, buf[PATH_MAX * 2], tbuf[PATH_MAX * 3]; |
||||
|
||||
if (!strcmp(argv[i], "-p")) |
||||
{ |
||||
perm = 1; |
||||
i++; |
||||
if (i >= argc) break; |
||||
} |
||||
path = argv[i]; |
||||
if (realpath(path, buf)) path = buf; |
||||
if (perm) |
||||
snprintf(tbuf, sizeof(tbuf), "%c}bp%s", 0x1b, path); |
||||
else |
||||
snprintf(tbuf, sizeof(tbuf), "%c}bt%s", 0x1b, path); |
||||
if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); |
||||
tbuf[0] = 0; |
||||
if (write(0, tbuf, 1) < 1) perror("write"); |
||||
} |
||||
exit(0); |
||||
return 0; |
||||
} |
@ -0,0 +1,34 @@ |
||||
#include <stdio.h> |
||||
#include <limits.h> |
||||
#include <stdlib.h> |
||||
#include <unistd.h> |
||||
#include <string.h> |
||||
|
||||
int |
||||
main(int argc, char **argv) |
||||
{ |
||||
int i; |
||||
|
||||
if (!getenv("TERMINOLOGY")) return 0; |
||||
if (argc <= 1) |
||||
{ |
||||
printf("Usage: %s FILE1 [FILE2 ...]\n" |
||||
" Pop up a given media file/uri right now\n" |
||||
"\n", |
||||
argv[0]); |
||||
return 0; |
||||
} |
||||
for (i = 1; i < argc; i++) |
||||
{ |
||||
char *path, buf[PATH_MAX * 2], tbuf[PATH_MAX * 3]; |
||||
|
||||
path = argv[i]; |
||||
if (realpath(path, buf)) path = buf; |
||||
snprintf(tbuf, sizeof(tbuf), "%c}pn%s", 0x1b, path); |
||||
if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); |
||||
tbuf[0] = 0; |
||||
if (write(0, tbuf, 1) < 1) perror("write"); |
||||
} |
||||
exit(0); |
||||
return 0; |
||||
} |
@ -0,0 +1,34 @@ |
||||
#include <stdio.h> |
||||
#include <limits.h> |
||||
#include <stdlib.h> |
||||
#include <unistd.h> |
||||
#include <string.h> |
||||
|
||||
int |
||||
main(int argc, char **argv) |
||||
{ |
||||
int i; |
||||
|
||||
if (!getenv("TERMINOLOGY")) return 0; |
||||
if (argc <= 1) |
||||
{ |
||||
printf("Usage: %s FILE1 [FILE2 ...]\n" |
||||
" Queue a given media file/uri to the popped up\n" |
||||
"\n", |
||||
argv[0]); |
||||
return 0; |
||||
} |
||||
for (i = 1; i < argc; i++) |
||||
{ |
||||
char *path, buf[PATH_MAX * 2], tbuf[PATH_MAX * 3]; |
||||
|
||||
path = argv[i]; |
||||
if (realpath(path, buf)) path = buf; |
||||
snprintf(tbuf, sizeof(tbuf), "%c}pq%s", 0x1b, path); |
||||
if (write(0, tbuf, strlen(tbuf)) < 1) perror("write"); |
||||
tbuf[0] = 0; |
||||
if (write(0, tbuf, 1) < 1) perror("write"); |
||||
} |
||||
exit(0); |
||||
return 0; |
||||
} |
Loading…
Reference in new issue