[wiki] [sites] [slock][patch][showtime] Date format fix, added config. || Michal

From: <git_AT_suckless.org>
Date: Wed, 01 May 2024 23:15:38 +0200

commit a69026574ed8e7dcbc4f82ea753e06495acd5dee
Author: Michal <cizek.michal_AT_gmail.com>
Date: Wed May 1 16:53:35 2024 -0400

    [slock][patch][showtime] Date format fix, added config.
    
    * Fixed the incorrect formatting of the month.
      It showed the month between 0 and 11 rather than 1 and 12.
    * Now possible to change text font, color and size in the config file.

diff --git a/tools.suckless.org/slock/patches/showtime/index.md b/tools.suckless.org/slock/patches/showtime/index.md
index 6acc39be..8a1bc3b3 100644
--- a/tools.suckless.org/slock/patches/showtime/index.md
+++ b/tools.suckless.org/slock/patches/showtime/index.md
_AT_@ -1,5 +1,5 @@
 Show time
-=======
+=========
 
 Description
 -----------
diff --git a/tools.suckless.org/slock/patches/showtime/slock-showtime-1.5.diff b/tools.suckless.org/slock/patches/showtime/slock-showtime-1.5.diff
index 219b8e6a..618dbf19 100644
--- a/tools.suckless.org/slock/patches/showtime/slock-showtime-1.5.diff
+++ b/tools.suckless.org/slock/patches/showtime/slock-showtime-1.5.diff
_AT_@ -1,13 +1,21 @@
-From: Michal Cizek <cizek.michal_AT_gmail.com>
-Date: Sat, 28 Oct 2023 16:46:42 -0400
-Subject: [PATCH] Patch that displays current date and time on the locked
- screen.
-
----
- config.mk |  2 +-
- slock.c   | 89 ++++++++++++++++++++++++++++++++++++++++++++++++++++---
- 2 files changed, 86 insertions(+), 5 deletions(-)
-
+diff --git a/config.def.h b/config.def.h
+index 9855e21..bc883ad 100644
+--- a/config.def.h
++++ b/config.def.h
+_AT_@ -1,6 +1,11 @@
+-/* user and group to drop privileges to */
+-static const char *user  = "nobody";
++/* user and group to drop privileges to */ static const char *user  = "nobody";
+ static const char *group = "nogroup";
++/*Font settings for the time text*/
++static const float textsize=64.0;
++static const char* textfamily="serif";
++static const double textcolorred=255;
++static const double textcolorgreen=255;
++static const double textcolorblue=255;
+ 
+ static const char *colorname[NUMCOLS] = {
+ 	[INIT] =   "black",     /* after initialization */
 diff --git a/config.mk b/config.mk
 index 514c236..c42e301 100644
 --- a/config.mk
_AT_@ -22,7 +30,7 @@ index 514c236..c42e301 100644
  # flags
  CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE -DHAVE_SHADOW_H
 diff --git a/slock.c b/slock.c
-index b2f14e3..03839bc 100644
+index b2f14e3..d370a00 100644
 --- a/slock.c
 +++ b/slock.c
 _AT_@ -5,6 +5,7 @@
_AT_@ -69,11 +77,11 @@ index b2f14e3..03839bc 100644
 +	int xpos,ypos;
 +	xpos=DisplayWidth(dpy, screen)/4;
 +	ypos=DisplayHeight(dpy, screen)/2;
-+	sprintf(tm,"%02d/%02d/%d %02d:%02d",time.tm_mday,time.tm_mon,time.tm_year+1900,time.tm_hour,time.tm_min);
++	sprintf(tm,"%02d/%02d/%d %02d:%02d",time.tm_mday,time.tm_mon + 1,time.tm_year+1900,time.tm_hour,time.tm_min);
 +	XClearWindow(dpy, win);
-+    cairo_set_source_rgb(cr, 256, 256, 256);
-+	cairo_select_font_face(cr, "serif", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
-+    cairo_set_font_size(cr, 64.0);
++    cairo_set_source_rgb(cr, textcolorred, textcolorgreen, textcolorblue);
++	cairo_select_font_face(cr, textfamily, CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_BOLD);
++    cairo_set_font_size(cr, textsize);
 +	cairo_move_to(cr, xpos, ypos);
 +	cairo_show_text(cr, tm);
 +	cairo_surface_flush(sfc);
_AT_@ -183,6 +191,3 @@ index b2f14e3..03839bc 100644
  
  	return 0;
  }
--- 
-2.34.1
-
Received on Wed May 01 2024 - 23:15:38 CEST

This archive was generated by hypermail 2.3.0 : Wed May 01 2024 - 23:24:51 CEST