Change the bar date/time format

Change the date/time format used in the bar.

You may prefer a different date/time format than what's set by default. This tutorial requires us to make a single change to the Xresource file that defines the date format used in the bar. The date is generated by the date command, and the formatting options are documented here.

  1. Stage your own Xresource file (tutorial), then open ~/.Xresources-regolith in your editor of choice.
  2. The file should contain a single line which is an #include to another Xresource file. Let's copy the contents of that referenced file into our Xresource file rather than having the include. To do this, exit out of the editor and run cp /etc/regolith/styles/cahuella/root ~/.Xresources-regolith
  3. Ok, now back in editing the file, it should look something like this:
! -- Styles - Colors
#include "/etc/regolith/styles/cahuella/color"

! -- Styles - Fonts
#include "/etc/regolith/styles/cahuella/typeface"

! -- Styles - Theme
#include "/etc/regolith/styles/cahuella/theme"

! -- Applications
! These files map values defined above into specific app settings.
#include "/etc/regolith/styles/st-term"
#include "/etc/regolith/styles/i3-wm"
#include "/etc/regolith/styles/i3xrocks"
#include "/etc/regolith/styles/rofi"
#include "/etc/regolith/styles/gnome"
  1. The setting we need to change is set in /etc/regolith/styles/i3xrocks. Let's create our own copy of that and reference it from our Xresource file. You'll need to specify the path to the file explicitly, and cannot use $HOME or ~/ as a shortcut. First, update the line in your open editor to point to a file we haven't created yet:
#include "/etc/regolith/styles/i3xrocks"

…should be changed to:

#include "/home/[YOUR USER NAME]/.Xresources-i3xrocks"
  1. Now lets create that file:
$ cp /etc/regolith/styles/i3xrocks ~/.Xresources-i3xrocks
  1. Finally, we can edit the file to change the date format. Load ~/.Xresources-i3xrocks into a text editor, and change:
i3xrocks.date.format:       + %m/%d %I:%M %p

…to your preferred date format, or this for just the time:

i3xrocks.date.format:       + %I:%M %p

Verification

After saving the file, you can run regolith-look refresh or xrdb -merge ~/.Xresources-regolith for the changes to take effect. You can verify that the setting was changed by checking the value on the command line:

$ xrescat i3xrocks.date.format

Last modified February 12, 2020: Fix overwritten howto. (1ab6dfd)