LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-13-2016, 08:05 AM   #1
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 571
Blog Entries: 103

Rep: Reputation: 166Reputation: 166
awesomewm 12 hour clock


Could someone please tell me where one sets the clock in awesomewm to be 12 hour?

Here is a short snippet from my rc.lua illustrating the failed approaches tried so far (the two commented out "ERROR" lines) :
Code:
-- {{{ Wibox
-- Create a textclock widget (how does one make it 12 hour?)
-- ERROR: obvious.clock.set_longtimeformat = "%l:%M%p %D"
-- ERROR: awful.widget.textclock.clock.set_longtimeformat = "%l:%M%p %D"
mytextclock = awful.widget.textclock()
To clarify: the clock is being created but any of my attempts to change the format have failed.

Thank you.


p.s. Found a thread here but aside from saying, "I fixed it by editing the script" I found no specific information. Also, that thread is from 2011.
 
Old 06-13-2016, 09:59 AM   #2
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760
Link to awesomewm project? Checked set_longtimeformat spelling? (Not setLongTimeFormat, set_longdateformat, etc)
 
Old 06-14-2016, 12:45 PM   #3
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 571

Original Poster
Blog Entries: 103

Rep: Reputation: 166Reputation: 166
Quote:
Originally Posted by keefaz View Post
Link to awesomewm project?
Sure, link here

Quote:
Checked set_longtimeformat spelling? (Not setLongTimeFormat, set_longdateformat, etc)
So I tried those variations. No dice. Trial and error looks like maybe the wrong approach: the variations search space begins to grow exponentially.

I'd ask on the awesomewm forum but they haven't got one.

I can just write a script to do this but it probably would be less efficient then whatever way they are using, so I'd hate to do it that way.
 
Old 06-14-2016, 01:31 PM   #4
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760
Found lua reference for date format:
https://www.lua.org/pil/22.1.html

Seems 12 hours format is %I and date is %x (not %l and %D as with strftime)

Edit: reference to awsome textclock:
https://github.com/awesomeWM/awesome.../textclock.lua

Last edited by keefaz; 06-14-2016 at 01:34 PM. Reason: used courrier font for displaying time format
 
1 members found this post helpful.
Old 06-14-2016, 06:34 PM   #5
jr_bob_dobbs
Member
 
Registered: Mar 2009
Distribution: Bedrock, Devuan, Slackware, Linux From Scratch, Void
Posts: 571

Original Poster
Blog Entries: 103

Rep: Reputation: 166Reputation: 166
Thank you very much.

Turns out I was able to do it with a light touch, not the expected heavy-handed write-it-myself way. Specifically, all that was needed was an edit of one line in my local rc.lua file.

Before:
Code:
mytextclock = awful.widget.textclock()
After:
Code:
mytextclock = awful.widget.textclock(" %a %b %d, %l:%M%P", 15)
The 15 is the update interval in seconds. Default is 60, 15 was an arbitrary choice on my part.

Current time shown is "6:38pm". Yay!

Last edited by jr_bob_dobbs; 06-14-2016 at 06:39 PM.
 
Old 06-14-2016, 07:13 PM   #6
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,325

Rep: Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760Reputation: 760
Glad you found the solution, I didn't look carefully and it seems the widget use lua-lgi library (glib) to parse date format (not lua os.date)
 
  


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
[SOLVED] How do I get a 12 hour clock? Gregg Bell Linux - Newbie 5 03-06-2014 01:50 AM
[SOLVED] NTP Clock jump one hour at 12:00 AM Fracker Linux - Newbie 2 05-20-2011 03:54 AM
starting kttsd failed - and how to you set clock to 12 hour clock? Ook Slackware 3 08-13-2010 06:04 PM
Cron clock is an hour off system clock mlev Linux - Software 1 03-31-2010 04:40 PM
change clock from 24 hour to 12 hour in suse 9.2/KDE 3.3 jmlumpkin Linux - Newbie 1 01-23-2005 12:45 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:52 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