LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Custom Gnome Shell clock format? (https://www.linuxquestions.org/questions/linux-desktop-74/custom-gnome-shell-clock-format-939981/)

-Thomas- 04-16-2012 12:32 AM

Custom Gnome Shell clock format?
 
1 Attachment(s)
Hi,

I'm using Gentoo and Gnome Shell, and I have a very large monitor. Since space in the menu bar is not an issue, I would like the clock to read "Monday April 16, 12:04 AM" instead of "Mon Apr 16, 12:04 AM". In my opinion you'd ought to be able to change the clock format in the "Date and Time Settings" window, or at least using gsettings. That's not the case, though, as far as I can tell. I assume that all I have to do is change "%a %b %d, %I:%M %p" to "%A %B %d, %I:%M %p" in some file somewhere, but I can't find it. I've looked through my system for files that might be related to the Gnome Shell clock or localization settings, and spent a few hours Googling things, with no luck. I'd appreciate any information anyone has on how to change the clock, or on why it isn't as easy as it should be.

I haven't used these forums much, so please let me know if I've done anything incorrectly.

Thanks

smoker 04-16-2012 12:52 PM

Hi,

I found it in
Code:

/usr/share/gnome-shell/js/ui/dateMenu.js
look for

Code:

switch (format) {
            case '24h':
                if (showDate)
                    /* Translators: This is the time format with date used
                      in 24-hour mode. */
                    clockFormat = showSeconds ? _("%a %b %e, %R:%S")
                                              : _("%a %b %e, %R");
                else
                    /* Translators: This is the time format without date used
                      in 24-hour mode. */
                    clockFormat = showSeconds ? _("%a %R:%S")
                                              : _("%a %R");
                break;
            case '12h':

The line you modify depends on what options you want.
I modified the time with date but no seconds in 24 hour mode.

It may just be my machine, but it took a loooong time for the shell to restart using Alt+F3 and r

It took about 30 seconds :(

-Thomas- 04-16-2012 05:20 PM

Quote:

Originally Posted by smoker (Post 4654286)
Hi,

I found it in
Code:

/usr/share/gnome-shell/js/ui/dateMenu.js
look for

Code:

switch (format) {
            case '24h':
                if (showDate)
                    /* Translators: This is the time format with date used
                      in 24-hour mode. */
                    clockFormat = showSeconds ? _("%a %b %e, %R:%S")
                                              : _("%a %b %e, %R");
                else
                    /* Translators: This is the time format without date used
                      in 24-hour mode. */
                    clockFormat = showSeconds ? _("%a %R:%S")
                                              : _("%a %R");
                break;
            case '12h':

The line you modify depends on what options you want.
I modified the time with date but no seconds in 24 hour mode.

It may just be my machine, but it took a loooong time for the shell to restart using Alt+F3 and r

It took about 30 seconds :(


That did it! I had found that folder, but I overlooked dateMenu.js. My shell restarted without an unusual delay.

Thanks a lot.

scrondo 11-12-2012 06:29 PM

GnomeShell - Set date in Italian format
 
Should any Italians stumble upon this thread, to set the date in Italian format all you need to do is:

- (just for safety) make a copy of the file dateMenu.js:
Code:

sudo cp /usr/share/gnome-shell/js/ui/dateMenu.js /usr/share/gnome-shell/js/ui/dateMenu.jsBAK
- then edit the file from terminal:
Code:

sudo gedit /usr/share/gnome-shell/js/ui/dateMenu.js
- and replace the following two lines:
Code:

clockFormat = showSeconds ? _("%a %b %e, %R:%S")
                          : _("%a %b %e, %R");

with the following:
Code:

clockFormat = showSeconds ? _("%A %e %B %Y,  %R:%S")
                          : _("%A %e %B %Y,  %R");

In order to see the results, you'll need to restart the shell: Alt+F2 'r'.

I hope it's useful!


All times are GMT -5. The time now is 02:58 AM.