diff options
Diffstat (limited to 'unlock_indicator.c')
| -rw-r--r-- | unlock_indicator.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/unlock_indicator.c b/unlock_indicator.c index 73320cb..8f69972 100644 --- a/unlock_indicator.c +++ b/unlock_indicator.c | |||
| @@ -58,12 +58,15 @@ extern bool debug_mode; | |||
| 58 | 58 | ||
| 59 | #ifdef EXTRAS | 59 | #ifdef EXTRAS |
| 60 | /* timekeeping */ | 60 | /* timekeeping */ |
| 61 | #define I3LOCK_COUNT_UNTIL_BUFFER 128 | ||
| 62 | char count_until_str[I3LOCK_COUNT_UNTIL_BUFFER]; | ||
| 61 | time_t now; | 63 | time_t now; |
| 62 | struct tm *brokentime; | 64 | struct tm *brokentime; |
| 63 | /* enable the digital clock */ | 65 | /* enable the digital clock */ |
| 64 | extern bool digital_clock; | 66 | extern bool digital_clock; |
| 65 | extern bool led_clock; | 67 | extern bool led_clock; |
| 66 | extern bool elapsed_time; | 68 | extern bool elapsed_time; |
| 69 | extern int count_until; | ||
| 67 | extern i3lock_digital_clock_t i3lock_digital_clock; | 70 | extern i3lock_digital_clock_t i3lock_digital_clock; |
| 68 | extern i3lock_elapsed_time_t i3lock_elapsed_time; | 71 | extern i3lock_elapsed_time_t i3lock_elapsed_time; |
| 69 | extern i3lock_led_clock_t i3lock_led_clock; | 72 | extern i3lock_led_clock_t i3lock_led_clock; |
| @@ -359,17 +362,30 @@ void draw_image(xcb_pixmap_t bg_pixmap, uint32_t *resolution) { | |||
| 359 | resolution, | 362 | resolution, |
| 360 | brokentime); | 363 | brokentime); |
| 361 | } | 364 | } |
| 362 | /* elapsed time or display text */ | 365 | /* elapsed time or counter with display text or only display text */ |
| 363 | if (elapsed_time) { | 366 | if (elapsed_time) { |
| 364 | i3lock_draw_elapsed_time(xcb_ctx, | 367 | i3lock_draw_elapsed_time(xcb_ctx, |
| 365 | &i3lock_elapsed_time, | 368 | &i3lock_elapsed_time, |
| 366 | resolution, | 369 | resolution, |
| 367 | &now); | 370 | &now); |
| 368 | } else if (display_text != NULL) { | 371 | } else if (display_text != NULL) { |
| 369 | i3lock_draw_string(xcb_ctx, | 372 | if (count_until) { |
| 370 | display_text, | 373 | if (i3lock_format_elapsed_time( |
| 371 | &i3lock_elapsed_time, | 374 | count_until_str, |
| 372 | resolution); | 375 | display_text, |
| 376 | I3LOCK_COUNT_UNTIL_BUFFER, | ||
| 377 | count_until - (int) now) != NULL) { | ||
| 378 | i3lock_draw_string(xcb_ctx, | ||
| 379 | count_until_str, | ||
| 380 | &i3lock_elapsed_time, | ||
| 381 | resolution); | ||
| 382 | } | ||
| 383 | } else { | ||
| 384 | i3lock_draw_string(xcb_ctx, | ||
| 385 | display_text, | ||
| 386 | &i3lock_elapsed_time, | ||
| 387 | resolution); | ||
| 388 | } | ||
| 373 | } | 389 | } |
| 374 | #endif | 390 | #endif |
| 375 | if (xr_screens > 0) { | 391 | if (xr_screens > 0) { |
