Skip to content

Instantly share code, notes, and snippets.

@wattux
Last active May 10, 2022 09:02
Show Gist options
  • Save wattux/8e5e817b50b87a2d40c9360ca50bc85c to your computer and use it in GitHub Desktop.
Save wattux/8e5e817b50b87a2d40c9360ca50bc85c to your computer and use it in GitHub Desktop.
xfce4 datetime patch
diff --git a/panel-plugin/datetime.c b/panel-plugin/datetime.c
index 01a7b97..8258faa 100644
--- a/panel-plugin/datetime.c
+++ b/panel-plugin/datetime.c
@@ -689,7 +689,7 @@ static void datetime_create_widget(t_datetime * datetime)
   gtk_widget_show(datetime->button);
 
   /* create a box which can be easily adapted to the panel orientation */
-  datetime->box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
+  datetime->box = gtk_hbox_new(FALSE, 0);
 
   gtk_widget_show(datetime->box);
   gtk_container_add(GTK_CONTAINER(datetime->button), datetime->box);
@@ -697,6 +697,8 @@ static void datetime_create_widget(t_datetime * datetime)
   /* create time and date lines */
   datetime->time_label = gtk_label_new("");
   datetime->date_label = gtk_label_new("");
+  gtk_label_set_width_chars (GTK_LABEL(datetime->time_label), 8); // gint n_chars);
+  gtk_label_set_width_chars (GTK_LABEL(datetime->date_label), 9); // gint n_chars);
   gtk_label_set_justify(GTK_LABEL(datetime->time_label), GTK_JUSTIFY_CENTER);
   gtk_label_set_justify(GTK_LABEL(datetime->date_label), GTK_JUSTIFY_CENTER);
 
@@ -711,7 +713,7 @@ static void datetime_create_widget(t_datetime * datetime)
       G_CALLBACK(datetime_clicked), datetime);
 
   /* set orientation according to the panel orientation */
-  datetime_set_mode(datetime->plugin, orientation, datetime);
+  //datetime_set_mode(datetime->plugin, orientation, datetime);
 }
 
 /*
diff --git a/panel-plugin/datetime.desktop.in b/panel-plugin/datetime.desktop.in
index 1c5c89e..e61bc9c 100644
--- a/panel-plugin/datetime.desktop.in
+++ b/panel-plugin/datetime.desktop.in
@@ -1,7 +1,7 @@
 [Xfce Panel]
 Type=X-XFCE-PanelPlugin
-_Name=DateTime
-_Comment=Date and Time plugin with a simple calendar
+_Name=DateTime2
+_Comment=Look at me this is my datetime now
 Icon=xfce-schedule
 X-XFCE-Module=datetime
 X-XFCE-Internal=FALSE
@vintprox
Copy link

Thanks for the fix! I just wanted to stick with the LCD layout and got myself in a pickle. But if hours change from 9 to 10 or from 23 to 0, the width of the widget is going to jump from one to another, causing other items to move. How would one go around fixing this?

@wattux
Copy link
Author

wattux commented Apr 29, 2022

@vintprox I think you could increase the char-width to fit both variants (one digit 0 and two digits 23). If that works, you'd have an empty space, when the hour is a single digit, but I think that's ok :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment