summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBoris Faure <billiob@gmail.com>2015-02-15 20:40:54 +0100
committerBoris Faure <billiob@gmail.com>2015-02-15 20:41:31 +0100
commit5b4e6de54a9647284898d7b3b9b751d8a38f9e70 (patch)
tree2c81d4633b9dff8b02d8a940058e388e4c7806bb /src
parent4ea6bdb04e0386a1ccb7dedc6ff9aa151b2ae109 (diff)
tybg: make tybg without argument display the default wallpaper
The ty* tools need some loveā€¦
Diffstat (limited to 'src')
-rw-r--r--src/bin/tybg.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/bin/tybg.c b/src/bin/tybg.c
index ea12c6e..8738047 100644
--- a/src/bin/tybg.c
+++ b/src/bin/tybg.c
@@ -10,15 +10,23 @@ main(int argc, char **argv)
10 int i, perm = 0; 10 int i, perm = 0;
11 11
12 if (!getenv("TERMINOLOGY")) return 0; 12 if (!getenv("TERMINOLOGY")) return 0;
13 if (argc <= 1) 13 if (argc > 1 &&
14 (!strcmp(argv[1], "-h") || !strcmp(argv[1], "--help")))
14 { 15 {
15 printf("Usage: %s [-p] FILE1 [FILE2 ...]\n" 16 printf("Usage: %s [-p] [FILE1 FILE2 ...]\n"
16 " Change the terminal background to the given file/uri\n" 17 " Change the terminal background to the given file/uri\n"
17 " -p Make change permanent (stored in config)\n" 18 " -p Make change permanent (stored in config)\n"
18 "\n", 19 "\n",
19 argv[0]); 20 argv[0]);
20 return 0; 21 return 0;
21 } 22 }
23 if (argc <= 1)
24 {
25 char tbuf[32];
26 snprintf(tbuf, sizeof(tbuf), "%c}bt", 0x1b);
27 if (write(0, tbuf, strlen(tbuf) + 1) != (signed)(strlen(tbuf) + 1)) perror("write");
28 return 0;
29 }
22 for (i = 1; i < argc; i++) 30 for (i = 1; i < argc; i++)
23 { 31 {
24 char *path, buf[PATH_MAX * 2], tbuf[PATH_MAX * 3]; 32 char *path, buf[PATH_MAX * 2], tbuf[PATH_MAX * 3];