I don't think it's a problem of conky not having "%I", I think OP is asking how to show 24-hour time when "grep '%I' ~/.conky/something" is empty. The solution is to read "man conky", determine what the value is that is being changed, and change it if possible. The assumption is that this value is the time, but it could just as easily be some kind of mtime timestamp or hard-coded string thus. conky supports strftime, even if the as yet unspecified config file doesn't presently contain any strftime formatting options.
Conky can't change to 24 hour [Solved]
- DukeComposed
- Posts: 1457
- Joined: Thu Mar 16, 2023 1:57 pm
Re: Conky can't change to 24 hour
Re: Conky can't change to 24 hour
Thanks to all for the help. I'll try first changing locale since I don't have so much time to learn Conky language or lua. But I'll keep this post in mind for learning something new as soon as I'll have time
Re: Conky can't change to 24 hour
what actual conky mod are you running?? (See was already asked of you? do not see a response to help more) But... to want to change to '24 hr' little hacking the %R will reap your reward to change. There is one in the MX conky selection that exhibits 24hr clock. MX-FluxKeys/FluxKeys.conf. I used that and man strftime which lead to actual date playing options %R was the trik.
I modified lots a fully custom KoO/MX-Full mod, for amd7800x3D and also all same for amd7950x3D chip set and just found fair easy to simply modify or delete the %l:%M %P to simply %R saved it and it printed now 24hr in my clock display line.
Mite post it if any wish for -ahs- users and 8/16 cpu configurations. conky mod. I've my mx7800 now modified for 24hr was planning on such fix. By this poke now I'm updated hope my code helps. wrks aces for moi.
Before:
${time %d %B %Y %l:%M %P}${endif}$font$color
After:
${time %d %B %Y}$alignr$color2${font Open Sans:Bold}${time %R}${endif}$font$color
my 24hr representation is tad more large now with this code, kina not too hard to modify and switch few things around w/o having to learn the code - simply play around review some other "How'd they do that" And cut.n.add snip.n.clip, pretty easy w/o having to show your all hardware qsi jazz.??
might have to check top to match the "colorX" for to use rightly. my color2 is more yellow than orange. and or add colors to your conky to provide some other play changes.
usually modified in FeatherPad when you click on the conky-manager and then left column selector click your Mod - top of the manager center is a pen click that to open F/Pad to modify when you click save the conky on your desktop will flash the updates immediately so playful attempts are easily seen good bad okay right or Wrong. Still even in edit mode, Simply try and keep exact to syntax and shud be good to go. After play just close out and your good.
Ask and yeah shall Rx. Cheers.
PS: if your stuck pls simply let us know what conky in MX your running and we can adapt to share a change to help more. Cheers.
I modified lots a fully custom KoO/MX-Full mod, for amd7800x3D and also all same for amd7950x3D chip set and just found fair easy to simply modify or delete the %l:%M %P to simply %R saved it and it printed now 24hr in my clock display line.
Mite post it if any wish for -ahs- users and 8/16 cpu configurations. conky mod. I've my mx7800 now modified for 24hr was planning on such fix. By this poke now I'm updated hope my code helps. wrks aces for moi.
Before:
${time %d %B %Y %l:%M %P}${endif}$font$color
After:
${time %d %B %Y}$alignr$color2${font Open Sans:Bold}${time %R}${endif}$font$color
my 24hr representation is tad more large now with this code, kina not too hard to modify and switch few things around w/o having to learn the code - simply play around review some other "How'd they do that" And cut.n.add snip.n.clip, pretty easy w/o having to show your all hardware qsi jazz.??
might have to check top to match the "colorX" for to use rightly. my color2 is more yellow than orange. and or add colors to your conky to provide some other play changes.
usually modified in FeatherPad when you click on the conky-manager and then left column selector click your Mod - top of the manager center is a pen click that to open F/Pad to modify when you click save the conky on your desktop will flash the updates immediately so playful attempts are easily seen good bad okay right or Wrong. Still even in edit mode, Simply try and keep exact to syntax and shud be good to go. After play just close out and your good.
Ask and yeah shall Rx. Cheers.
PS: if your stuck pls simply let us know what conky in MX your running and we can adapt to share a change to help more. Cheers.

- Crampingwarbear
- Posts: 2
- Joined: Sun Sep 29, 2024 1:38 am
Re: Conky can't change to 24 hour
I was never able to get the default Conky in MX 23 to show time in 24 hr no matter what settings I changed. I changed the LUA to the following:
I can't remember exactly what I deleted but now I have the default MX Conky showing time in 24hrs with no am/pm visible.
Hope that helps.
Code: Select all
-- some globals
CJK = 'false'
DATE_FORMAT = '${time %A %B %d}'
LANG = os.getenv("LC_ALL")
if ( not LANG or LANG == '' ) then LANG = os.getenv("LANG") end
if ( not LANG or LANG == '' ) then LANG = "C" end
if string.match(LANG,"^%l%l+_%u+") then
LL_CC = string.sub(LANG, string.find(LANG, "^%l%l+_%u+"))
else
LL_CC = "C"
end
if string.match(LANG,"^%l%l+") then
LL = string.sub(LANG, string.find(LANG, "^%l%l+"))
else
LL = "C"
end
-- some locals
local date_format_table =
{
['en_US'] = '${time %A %B %d}',
['en'] = '${time %A %B %d}',
['C'] = '${time %A %B %d}',
['de_DE'] = '${time %A %-d. %B}',
['de'] = '${time %A %-d. %B}',
['ja'] = '${time %B %d日 %A}',
['ko'] = '${time %B %d일 %A}',
['zh'] = '${time %B %d日 %A}',
['default'] = '${time %A %d %B}',
}
local cjk_table =
{
['ja'] = 'true',
['ko'] = 'true',
['zh'] = 'true',
['ar'] = 'true',
['fa'] = 'true',
['he'] = 'true',
}
-- some functions
function has_ampm()
local handle = io.popen("locale -k d_t_fmt | grep -sqo -E '%r|%p|%I' && echo yes || echo no")
local output = handle:read("*l")
handle:close()
return output
end
function conky_hours()
if ampm then
return os.date("%H")
else
return os.date("%H")
end
end
function conky_lang()
return os.getenv("LANG")
end
function conky_cpu()
local str=''
str=conky_parse('${cpu cpu0}')
return string.format("%3d", str)
end
function conky_memperc()
local str=''
str=conky_parse('${memperc}')
return string.format("%2d", str)
end
-- CJK handling
function conky_cjk()
if cjk_table[LL] then
return 'true'
else
return 'false'
end
end
function conky_time(a)
local s='${time %' .. a .. '}'
return conky_parse(s)
end
function conky_set_time(d)
if ( d == 'a' or d == 'A' ) then
TIME_A = d
elseif ( d == 'b' or d == 'B' ) then
TIME_B = d
end
set_date_format()
return ''
end
function date_format()
local date_format
if date_format_table[LL_CC] then
date_format = date_format_table[LL_CC]
elseif date_format_table[LL] then
date_format = date_format_table[LL]
else
date_format = date_format_table['default']
end
if TIME_A == 'a' then date_format = date_format:gsub('A', 'a'); end
if TIME_B == 'b' then date_format = date_format:gsub('B', 'b'); end
return date_format
end
function set_date_format()
DATE_FORMAT = date_format()
return
end
function conky_date_format() return DATE_FORMAT; end
function conky_get_date_format() return DATE_FORMAT; end
function conky_date()
local format_str = DATE_FORMAT
str=conky_parse(format_str)
return str
end
Hope that helps.
Re: Conky can't change to 24 hour
odd I simply just went thru all my "conky" mods top down some already display 24hr. The Rest I simply changed "%I - to %H " and many took on the Hour seeing %M was just after in line of code. {that covers both Hour Minute displayed}.
So I'm going Zip my .conky folder and retain a 24hr settings. Some are little finicky to set with as example 1st shown in my code change. I did also end up deleting some of the additional all similar like and replaced with %R. its the the case closed on most only a few. There is a Time Template Format I did not mess with that. Simply with in the lines of code where it showed the $I or both %k:%M removed and replaced with %R all worked for me easy enough. Thought to pop back and inform. Maybe take a step back and take another approach little different. Good suggestion is to create an all new say "Test" users account. It will also get a fresh .conky/mods all from /etc/skel fresh copy, so that you can log off on and sign in with Test account and play without messing up. So there too is as recovery
you can also copy /etc/skel/.conky to your own home folder and recover as if 1st signed in.
Best perform this trick as Root or sudo shud wrk.
su - root and enter roots passwd
cd /etc/skel
cp -r .conky /home/test OR /home/myAccountname
exit - bk as your own user
in basics should be okay but logoff/on again an play around with checking each conky mod out and try the %I change too %H and wait a flash of the display mod and see the hour change from 12 to a 24 hr. My System Clock in the tool bar is already set by features of its clock options to "24 hr" So conky in belief works from/by system set time. if your locale is set should still be good to play around and get results.
the once again Miss your forgetting is to share what actual conky think you mentioned its basic default - try another like
~/.conky/MX-Simple/conkyrc , this is pretty easy. Simply uncheck what your trying cursor down to MX-Simple/conkyrc Select then with ConkyMgr edit cursor down where 'conky.text = [[ 4th line down see the ${else}${time %I} change this "I" to show %H save and wait - this also has a second wheel so it takes a few catch up seconds to re-Display and show your change.
Okay Sorry I missed that recheck the Default is an MX-Cowon wow there are like 8 of them in various those I forfeit to change
but here if you wish to change Edit cursor down too "conky.text = [[ see the ${voffset -176} next is ${lua hours} this is a fubar
sleight of hand. Change this too ${time %H} only and save and see the chg. BaddaBingBooom. 24hr or the hour shows what you desire. *nix has so many ways to do things all are correct when the results show right! Cheers.
PS: Again another trick when in Edit mode since default edit is FeatherPad copy out those few lines of code and at top left icon open a fresh sheet and paste in that original code. Now you can test jump back forth and see orig an your change code make an error copy back write it and try again. Hope that zings up a smile. last tip with Thunar can select open with root copy the /etc/skel/.conky and re-paste back into /home/you folder an try more.
So I'm going Zip my .conky folder and retain a 24hr settings. Some are little finicky to set with as example 1st shown in my code change. I did also end up deleting some of the additional all similar like and replaced with %R. its the the case closed on most only a few. There is a Time Template Format I did not mess with that. Simply with in the lines of code where it showed the $I or both %k:%M removed and replaced with %R all worked for me easy enough. Thought to pop back and inform. Maybe take a step back and take another approach little different. Good suggestion is to create an all new say "Test" users account. It will also get a fresh .conky/mods all from /etc/skel fresh copy, so that you can log off on and sign in with Test account and play without messing up. So there too is as recovery
you can also copy /etc/skel/.conky to your own home folder and recover as if 1st signed in.
Best perform this trick as Root or sudo shud wrk.
su - root and enter roots passwd
cd /etc/skel
cp -r .conky /home/test OR /home/myAccountname
exit - bk as your own user
in basics should be okay but logoff/on again an play around with checking each conky mod out and try the %I change too %H and wait a flash of the display mod and see the hour change from 12 to a 24 hr. My System Clock in the tool bar is already set by features of its clock options to "24 hr" So conky in belief works from/by system set time. if your locale is set should still be good to play around and get results.
the once again Miss your forgetting is to share what actual conky think you mentioned its basic default - try another like
~/.conky/MX-Simple/conkyrc , this is pretty easy. Simply uncheck what your trying cursor down to MX-Simple/conkyrc Select then with ConkyMgr edit cursor down where 'conky.text = [[ 4th line down see the ${else}${time %I} change this "I" to show %H save and wait - this also has a second wheel so it takes a few catch up seconds to re-Display and show your change.
Okay Sorry I missed that recheck the Default is an MX-Cowon wow there are like 8 of them in various those I forfeit to change
but here if you wish to change Edit cursor down too "conky.text = [[ see the ${voffset -176} next is ${lua hours} this is a fubar
sleight of hand. Change this too ${time %H} only and save and see the chg. BaddaBingBooom. 24hr or the hour shows what you desire. *nix has so many ways to do things all are correct when the results show right! Cheers.
PS: Again another trick when in Edit mode since default edit is FeatherPad copy out those few lines of code and at top left icon open a fresh sheet and paste in that original code. Now you can test jump back forth and see orig an your change code make an error copy back write it and try again. Hope that zings up a smile. last tip with Thunar can select open with root copy the /etc/skel/.conky and re-paste back into /home/you folder an try more.
Last edited by atomick on Mon Sep 30, 2024 9:58 pm, edited 1 time in total.
Re: Conky can't change to 24 hour [Solved]
The original poster never stated what Conky is being used that is to be converted to display 24-hour time. Without knowing that I will presume it is the default Conky for MX-23. This is how I converted that Conky in a Live MX-23.4 (Xfce) to display 24-hour time. If another Conky is being used then please advise the name.
The default Conky for MX-23 is "MX-Cowon_MildBlue" so that is what I used. If you want an easier solution then just copy the entire Conky code for that Conky, which is the result of the edits I made as shown below. That is in the last code window below, and paste it into a new file in the directory that contains the original (default) Conky. I suggest you name it anything other than the default name so you can easily identify it in the Conky Manager.
Edit the Conky file, starting at the line below the beginning of the Conky text, like this:
1. After the first line of the Conky text conky.text = [[, delete the four lines below it. Those four lines to delete are:
To summarize Steps 1-2 above, the first four lines of the Conky text should now look like this:
3. Now that the Conky is displaying 24-hour time, the AM/PM text should be removed since it is not needed. To do that:
The completed text of the "MX-Cowon_MildBlue" Conky file (Steps 1-3 above) is in the below code window. Copy that into another Conky file and it will appear as another Conky for use in the Conky Manager.
The below screenshot is the result of the above, showing how the "MX-Cowon_MildBlue" Conky looks displaying 24-hour time, showing 21:00 (9:00 PM):
The default Conky for MX-23 is "MX-Cowon_MildBlue" so that is what I used. If you want an easier solution then just copy the entire Conky code for that Conky, which is the result of the edits I made as shown below. That is in the last code window below, and paste it into a new file in the directory that contains the original (default) Conky. I suggest you name it anything other than the default name so you can easily identify it in the Conky Manager.
Edit the Conky file, starting at the line below the beginning of the Conky text, like this:
1. After the first line of the Conky text conky.text = [[, delete the four lines below it. Those four lines to delete are:
- ${if_match "${lua time A}" == "${time %A}"}${lua set_time A}\
- ${else}${lua set_time a}${endif}\
- ${if_match "${lua time B}" == "${time %B}"}${lua set_time B}\
- ${else}${lua set_time b}${endif}\
To summarize Steps 1-2 above, the first four lines of the Conky text should now look like this:
Code: Select all
conky.text = [[
${voffset -176}
${time %H}
${color2}${offset 36}${voffset -95}${time %M}
- Remove the AM/PM text to the right of the time. To do that simply comment out the line ${color2}${lua AM_PM} (this is done by putting the number symbol (#) at the start of the line so it looks like # ${color2}${lua AM_PM} (or you can just delete that line, but then remember to adjust the below two line numbers by -1).
- On Line 97 change the "offset" value from 150 to 0.
This moves the hour and minute numbers to the right to make up for the removal of the "AM/PM" text. - On Line 105: change the "voffset" value from 160 to 180.
This moves the "hdd" line below the date line.
The completed text of the "MX-Cowon_MildBlue" Conky file (Steps 1-3 above) is in the below code window. Copy that into another Conky file and it will appear as another Conky for use in the Conky Manager.
Code: Select all
conky.config = {
--#####################
-- - Conky settings - #
--#####################
update_interval = 1,
total_run_times = 0,
net_avg_samples = 1,
cpu_avg_samples = 1,
imlib_cache_size = 0,
double_buffer = true,
no_buffers = true,
--####################
-- - Text settings - #
--####################
use_xft = true,
font = 'Roboto-Light:size=100',
override_utf8_locale = true,
text_buffer_size = 2048,
xftalpha = 0.9,
--############################
-- - Window specifications - #
--############################
own_window_class = 'Conky',
own_window = true,
own_window_type = 'normal',
own_window_transparent = true,
own_window_hints = 'undecorated,below,skip_taskbar,skip_pager,sticky',
--own_window_argb_visual yes
--own_window_argb_value 100
alignment = 'top_right',
gap_x = 40,
gap_y = 40,
minimum_width = 200, minimum_height = 220,
--########################
-- - Templates - #
--########################
template1 = '${color4}${font RobotoMono-Light:bold:pixelsize=12}${offset 8}',
template2 = '${offset 4} ${color4}batt${offset 6}',
--########################
-- - Graphics settings - #
--########################
draw_shades = false,
--hour
default_color = 'aabbcc',
default_shade_color = '1d1d1d',
color0 = 'ffffff',
--date
color1 = 'aabbcc',
--min
color2 = '77ddff',
--text
color3 = '77ddff',
--percentages
color4 = 'aabbcc',
--lua_load ~/.conky/conkybg.lua
--lua_draw_hook_pre conky_draw_bg
own_window_argb_value = 0,
own_window_argb_visual = true,
own_window_colour = '000000',
lua_load = 'lua/conky.lua',
};
-- fluxbox adjustment
-- if os.getenv("XDG_SESSION_DESKTOP") == 'fluxbox' then
return_code = os.execute('pidof -q fluxbox')
if _VERSION == 'Lua 5.1' and math.floor(return_code/256) == 0 or
_VERSION ~= 'Lua 5.1' and return_code then
conky.config.own_window_transparent = true
conky.config.own_window_argb_visual = false
end
conky.text = [[
${voffset -176}
${time %H}
${color2}${offset 36}${voffset -95}${time %M}
${voffset -130}${offset 10}\
${if_match "${lua cjk}" == "false"}\
${font Roboto-Light:bold:size=12}\
${else}\
${font wqy-microhei:bold:size=12}\
${endif}\
${color1}${lua date}
${offset 0}${voffset -175}\
${if_match "${lua cjk}" == "false"}\
${font Roboto-Light:size=12}\
${else}\
${font wqy-microhei:size=12}\
${endif}\
# ${color2}${lua AM_PM}
#system
${offset 0}${voffset 180}\
${font Roboto-Light:bold:pixelsize=14}${offset 12}${color3}hdd \
${offset 2}${color4}\
${font RobotoMono-Light:bold:pixelsize=12}${fs_used_perc /}%\
${font Roboto-Light:bold:pixelsize=14}\
${offset 4}${color3} mem \
${offset 2}${color4}\
${font RobotoMono-Light:bold:pixelsize=12}${lua memperc}%\
${font Roboto-Light:bold:pixelsize=14}\
${offset 2}${offset 4}${color3}cpu\
${color4}${font RobotoMono-Light:bold:pixelsize=12}${lua cpu}%\
#battery
${offset 0}${voffset 10}\
${if_existing /sys/class/power_supply/BAT0/present/ 1}${template1}
${template2}${battery_bar 8,80 BAT0} ${battery_percent BAT0}% ${endif}\
${if_existing /sys/class/power_supply/BAT0}${template1}
${template2}${battery_bar 8,80 BAT0} ${battery_percent BAT0}% ${endif}\
${if_existing /sys/class/power_supply/BAT1}${template1}
${template2}${battery_bar 8,80 BAT1} ${battery_percent BAT1}% ${endif}
${voffset -190}
]];
You do not have the required permissions to view the files attached to this post.
Re: Conky can't change to 24 hour
Stuart your excellent beat me to the edit finish. it all was so simple ${lua hour} change too ${time %H} and its done. Cheers.
Re: Conky can't change to 24 hour
Thanks a lot Stuart. I'll try what you've explained so well