Cogitatio materialis est

How to fix first day of week in xfce?

24th Feb 2014 Tags: #calendar #locale #troubles #xfce

If you want to change the first day of week, actually, it's a problem of your locale. So, you have installed/choose a locale, that have first day of week, for example, Sunday, and all programs and gui-plugins will use it. Let's fix it!

Detect current locale

First of all, you can know current locale by running

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC=POSIX
LC_TIME="en_US.UTF-8"
...

In my case, locale is en_US.UTF-8, and it's first day of a week -- Sunday :(

Actually, date and other common utils should format it's output depend on LC_TIME environment variable.

Method #1

So, first method is pretty simple -- try to run commands with other LC_TIME-variable, like

$ LC_TIME="en_US.UTF-8" cal
    February 2014   
Su Mo Tu We Th Fr Sa
                   1
 2  3  4  5  6  7  8
 9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 "24" 25 26 27 28

$ LC_TIME="en_GB.UTF-8" cal
    February 2014   
Mo Tu We Th Fr Sa Su
                1  2
 3  4  5  6  7  8  9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
"24" 25 26 27 28

If it works fine for you, just add smth like export LC_TIME="en_GB.UTF-8" in your ~/.bashrc file or create file ~/.config/xfce4/xinitrc with content

#!/bin/sh
export LC_TIME="en_GB.UTF-8"
. /etc/xdg/xfce4/xinitrc

and run chmod +x ~/.config/xfce4/xinitrc; reboot/logout.

NOTE: you can list all available in your system locales with locale -a. If some locale isn't installed yet, LC_TIME will have no effect.

Method #2

If it doesn't work, let's try another way. You can just regenerate all locales with your own settings. So, after detecting your locale, change or add the following lines in the LC_TIME section in /usr/share/i18n/locales/<your_locale>:

week    7;19971130;7
first_weekday   2
first_workday   2

Use first_weekday 2 -- for Monday, and first_weekday 1 -- for Sunday. Then just run

# locale-gen

and reboot your system thus new changes to take effect. Now in all aplications week should starts from the correct day.


References: