LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 04-16-2012, 12:32 AM   #1
-Thomas-
LQ Newbie
 
Registered: Jun 2011
Location: Texas
Posts: 25

Rep: Reputation: Disabled
Custom Gnome Shell clock format?


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
Attached Thumbnails
Click image for larger version

Name:	Screenshot at 2012-04-16 00:27:56.jpg
Views:	59
Size:	116.2 KB
ID:	9448  
 
Old 04-16-2012, 12:52 PM   #2
smoker
Senior Member
 
Registered: Oct 2004
Distribution: Fedora Core 4, 12, 13, 14, 15, 17
Posts: 2,279

Rep: Reputation: 250Reputation: 250Reputation: 250
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
 
Old 04-16-2012, 05:20 PM   #3
-Thomas-
LQ Newbie
 
Registered: Jun 2011
Location: Texas
Posts: 25

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by smoker View Post
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.
 
Old 11-12-2012, 06:29 PM   #4
scrondo
LQ Newbie
 
Registered: Nov 2012
Posts: 1

Rep: Reputation: Disabled
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!

Last edited by scrondo; 11-18-2012 at 08:11 PM. Reason: code improvement
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How to Install Custom Gnome Shell Themes LXer Syndicated Linux News 0 09-27-2011 12:30 PM
Customise date format in Gnome clock applet tooltip? genogebot Linux - Desktop 3 06-04-2011 12:54 AM
[SOLVED] 13.37 default Xfce version panel clock not persisting custom format bassplayer69 Slackware 2 06-03-2011 07:55 AM
LXer: Ready for Gnome 3.2? The Shell gets world clock LXer Syndicated Linux News 1 05-27-2011 02:18 PM
No 12 hour format available in gnome clock (UK English) solitaira Linux - Newbie 4 09-05-2010 04:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 10:46 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration