summarylogtreecommitdiffstats
path: root/tty-clock-borderless.patch
blob: 7e02c2481305586adb23d6996c3367ff7cd3e970 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
diff -rupN tty-clock/README tty-clock.new/README
--- tty-clock/README	2015-09-25 03:03:01.706578574 +0200
+++ tty-clock.new/README	2015-09-25 03:09:08.303238521 +0200
@@ -1,6 +1,7 @@
 usage : tty-clock [-sctrvihDB] [-C [0-7]] [-f format]            
     -s            Show seconds                                   
-    -c            Set the clock at the center of the terminal    
+    -c            Set the clock at the center of the terminal   
+    -b            Disable borders      
     -C [0-7]      Set the clock color                            
     -t            Set the hour in 12h format                     
     -u            Use UTC time
diff -rupN tty-clock/ttyclock.c tty-clock.new/ttyclock.c
--- tty-clock/ttyclock.c	2015-09-25 03:03:01.706578574 +0200
+++ tty-clock.new/ttyclock.c	2015-09-25 03:30:03.519882182 +0200
@@ -89,7 +89,9 @@ init(void)
                                  ttyclock->geo.w,
                                  ttyclock->geo.x,
                                  ttyclock->geo.y);
-     box(ttyclock->framewin, 0, 0);
+     if(ttyclock->option.border) {
+          box(ttyclock->framewin, 0, 0);
+     }
 
      /* Create the date win */
      if (ttyclock->option.date)
@@ -98,7 +100,9 @@ init(void)
                                      ttyclock->geo.x + ttyclock->geo.h - 1,
                                      ttyclock->geo.y + (ttyclock->geo.w / 2) -
                                      (strlen(ttyclock->date.datestr) / 2) - 1);
-          box(ttyclock->datewin, 0, 0);
+          if(ttyclock->option.border) {
+               box(ttyclock->datewin, 0, 0);
+          }
           clearok(ttyclock->datewin, True);
      }
 
@@ -294,11 +298,15 @@ clock_move(int x, int y, int w, int h)
                 ttyclock->geo.x + ttyclock->geo.h - 1,
                 ttyclock->geo.y + (ttyclock->geo.w / 2) - (strlen(ttyclock->date.datestr) / 2) - 1);
           wresize(ttyclock->datewin, DATEWINH, strlen(ttyclock->date.datestr) + 2);
-          box(ttyclock->datewin,  0, 0);
+          if(ttyclock->option.border) {
+               box(ttyclock->datewin, 0, 0);
+          }
           wrefresh(ttyclock->datewin);
      }
 
-     box(ttyclock->framewin, 0, 0);
+     if(ttyclock->option.border) {
+          box(ttyclock->framewin, 0, 0);
+     }
      wrefresh(ttyclock->framewin);
 
      return;
@@ -462,18 +470,21 @@ main(int argc, char **argv)
      ttyclock->option.color = COLOR_GREEN; /* COLOR_GREEN = 2 */
      /* Default delay */
      ttyclock->option.delay = 40000000; /* 25FPS */
+     /* Default border */
+     ttyclock->option.border = True;
      /* Default blink */
      ttyclock->option.blink = False;
 
-     while ((c = getopt(argc, argv, "utvsrcihf:DBd:C:")) != -1)
+     while ((c = getopt(argc, argv, "utvsrcbihf:DBd:C:")) != -1)
      {
           switch(c)
           {
           case 'h':
           default:
-               printf("usage : tty-clock [-sctrvihDB] [-C [0-7]] [-f format]            \n"
+               printf("usage : tty-clock [-scbtrvihDB] [-C [0-7]] [-f format]            \n"
                       "    -s            Show seconds                                   \n"
                       "    -c            Set the clock at the center of the terminal    \n"
+                      "    -b            Disable borders                                \n"
                       "    -C [0-7]      Set the clock color                            \n"
                       "    -t            Set the hour in 12h format                     \n"
                       "    -u            Use UTC time                                   \n"
@@ -509,6 +520,9 @@ main(int argc, char **argv)
           case 'c':
                ttyclock->option.center = True;
                break;
+          case 'b':
+               ttyclock->option.border = False;
+               break;
           case 'C':
                if(atoi(optarg) >= 0 && atoi(optarg) < 8)
                     ttyclock->option.color = atoi(optarg);
diff -rupN tty-clock/ttyclock.h tty-clock.new/ttyclock.h
--- tty-clock/ttyclock.h	2015-09-25 03:03:01.706578574 +0200
+++ tty-clock.new/ttyclock.h	2015-09-25 03:35:20.519876372 +0200
@@ -61,14 +61,15 @@ typedef struct
      struct
      {
           Bool second;
-          Bool twelve;
           Bool center;
-          Bool rebound;
-          Bool date;
+	  Bool border;
+          int color;
+          Bool twelve;
           Bool utc;
+          Bool rebound;
           char *format;
-          int color;
           long delay;
+          Bool date;
           Bool blink;
      } option;