mirror of
https://github.com/vincentbernat/i3wm-configuration.git
synced 2025-08-29 14:18:22 +02:00
widgets: don't rely on ncal highlighting current date
On recent versions, highlighting is disabled on non-TTY outputs.
This commit is contained in:
parent
ffea7be396
commit
b4b2f5064e
1 changed files with 10 additions and 6 deletions
|
@ -37,14 +37,18 @@ local cal = (
|
||||||
local save_offset = offset
|
local save_offset = offset
|
||||||
remove_calendar()
|
remove_calendar()
|
||||||
offset = save_offset + inc_offset
|
offset = save_offset + inc_offset
|
||||||
local datespec = os.date("*t")
|
local curdate = os.date("*t")
|
||||||
datespec = datespec.year * 12 + datespec.month - 1 + offset
|
local datespec = curdate.year * 12 + curdate.month - 1 + offset
|
||||||
datespec = (datespec % 12 + 1) .. " " .. math.floor(datespec / 12)
|
datespec = (datespec % 12 + 1) .. " " .. math.floor(datespec / 12)
|
||||||
local cal = awful.util.pread("ncal -w -m " .. datespec)
|
local cal = awful.util.pread("ncal -h -w -m " .. datespec)
|
||||||
-- Highlight the current date and month
|
-- Highlight the current date and month
|
||||||
cal = cal:gsub("_.([%d ])",
|
if offset == 0 then
|
||||||
string.format('<span color="%s">%%1</span>',
|
cal = cal:gsub(string.format("( %d )", curdate.day),
|
||||||
beautiful.fg_widget_clock))
|
string.format('<span color="%s">%%1</span>',
|
||||||
|
beautiful.fg_widget_clock),
|
||||||
|
1)
|
||||||
|
end
|
||||||
|
-- Month and year
|
||||||
cal = cal:gsub("^( +[^ ]+ [0-9]+) *",
|
cal = cal:gsub("^( +[^ ]+ [0-9]+) *",
|
||||||
string.format('<span color="%s">%%1</span>',
|
string.format('<span color="%s">%%1</span>',
|
||||||
beautiful.fg_widget_clock))
|
beautiful.fg_widget_clock))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue