diff options
| author | Simeon Simeonov | 2020-12-10 23:57:33 +0100 |
|---|---|---|
| committer | Simeon Simeonov | 2020-12-10 23:57:33 +0100 |
| commit | b16438a23b237aa44fe9358a0b8954888bf81ea2 (patch) | |
| tree | 9e0fcb3e8f3d4b1707bd702f2bf4429299d1e2e3 /i3lock.c | |
| parent | 12a06184e733554bafc76e643b49067fcd758fc0 (diff) | |
Add support for counting to a specific calendar time (absolute time)
Diffstat (limited to 'i3lock.c')
| -rw-r--r-- | i3lock.c | 10 |
1 files changed, 9 insertions, 1 deletions
| @@ -84,6 +84,7 @@ static void input_done(void); | |||
| 84 | bool digital_clock = false; | 84 | bool digital_clock = false; |
| 85 | bool led_clock = false; | 85 | bool led_clock = false; |
| 86 | bool elapsed_time = false; | 86 | bool elapsed_time = false; |
| 87 | int count_until = 0; /* count seconds until */ | ||
| 87 | int refresh_rate = 2; /* 2 frames per second */ | 88 | int refresh_rate = 2; /* 2 frames per second */ |
| 88 | i3lock_digital_clock_t i3lock_digital_clock = {28, | 89 | i3lock_digital_clock_t i3lock_digital_clock = {28, |
| 89 | "000000", | 90 | "000000", |
| @@ -1083,6 +1084,7 @@ int main(int argc, char *argv[]) { | |||
| 1083 | {"dpms", no_argument, NULL, 'd'}, | 1084 | {"dpms", no_argument, NULL, 'd'}, |
| 1084 | {"color", required_argument, NULL, 'c'}, | 1085 | {"color", required_argument, NULL, 'c'}, |
| 1085 | #ifdef EXTRAS | 1086 | #ifdef EXTRAS |
| 1087 | {"count-until", no_argument, NULL, 'C'}, | ||
| 1086 | {"digital-clock", no_argument, NULL, 'D'}, | 1088 | {"digital-clock", no_argument, NULL, 'D'}, |
| 1087 | {"digital-clock-color", required_argument, NULL, 'G'}, | 1089 | {"digital-clock-color", required_argument, NULL, 'G'}, |
| 1088 | {"digital-clock-template", required_argument, NULL, 'T'}, | 1090 | {"digital-clock-template", required_argument, NULL, 'T'}, |
| @@ -1122,7 +1124,7 @@ int main(int argc, char *argv[]) { | |||
| 1122 | errx(EXIT_FAILURE, "i3lock is a program for X11 and does not work on Wayland. Try https://github.com/swaywm/swaylock instead"); | 1124 | errx(EXIT_FAILURE, "i3lock is a program for X11 and does not work on Wayland. Try https://github.com/swaywm/swaylock instead"); |
| 1123 | 1125 | ||
| 1124 | #ifdef EXTRAS | 1126 | #ifdef EXTRAS |
| 1125 | char *optstring = "hvnbDdELc:B:G:F:J:O:R:r:S:T:W:X:x:Y:y:Z:p:ui:teI:f"; | 1127 | char *optstring = "hvnbDdELC:c:B:G:F:J:O:R:r:S:T:W:X:x:Y:y:Z:p:ui:teI:f"; |
| 1126 | #else | 1128 | #else |
| 1127 | char *optstring = "hvnbdc:p:ui:teI:f"; | 1129 | char *optstring = "hvnbdc:p:ui:teI:f"; |
| 1128 | #endif | 1130 | #endif |
| @@ -1156,6 +1158,12 @@ int main(int argc, char *argv[]) { | |||
| 1156 | break; | 1158 | break; |
| 1157 | } | 1159 | } |
| 1158 | #ifdef EXTRAS | 1160 | #ifdef EXTRAS |
| 1161 | case 'C': /* count until */ | ||
| 1162 | if (optarg != NULL && atoi(optarg) > 0) /* not nice with -1 and 0 */ | ||
| 1163 | count_until = atoi(optarg); | ||
| 1164 | DEBUG("count_until: %d\n", | ||
| 1165 | count_until); | ||
| 1166 | break; | ||
| 1159 | case 'D': | 1167 | case 'D': |
| 1160 | digital_clock = true; | 1168 | digital_clock = true; |
| 1161 | break; | 1169 | break; |
