Skip to content

Commit 88ca39d

Browse files
committed
statusclock: allow disabling date
1 parent b79036a commit 88ca39d

2 files changed

Lines changed: 24 additions & 10 deletions

File tree

manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2212,7 +2212,7 @@
22122212
"id": "statusclock",
22132213
"mod_version": "3",
22142214
"path": "plugins/statusclock.lua",
2215-
"version": "0.1"
2215+
"version": "0.2"
22162216
},
22172217
{
22182218
"description": "Keep track of the current scope at the top of the view (*[video](https://user-images.githubusercontent.com/2798487/222133911-e467a583-596c-47ab-8e65-eefc7b5c9112.mp4)*)",

plugins/statusclock.lua

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ config.plugins.statusclock = common.merge({
99
enabled = true,
1010
time_format = "%H:%M:%S",
1111
date_format = "%A, %d %B %Y",
12+
show_date = true,
1213
-- The config specification used by the settings gui
1314
config_spec = {
1415
name = "Status Clock",
@@ -35,6 +36,13 @@ config.plugins.statusclock = common.merge({
3536
type = "string",
3637
default = "%H:%M:%S"
3738
},
39+
{
40+
label = "Show Date",
41+
description = "Show or hide the date.",
42+
path = "show_date",
43+
type = "toggle",
44+
default = true
45+
},
3846
{
3947
label = "Date Format",
4048
description = "Date specification defined with Lua date/time place holders.",
@@ -73,16 +81,22 @@ core.status_view:add_item({
7381
alignment = StatusView.Item.RIGHT,
7482
get_item = function(self)
7583
update_time()
76-
return {
77-
style.text,
78-
time_data.date_text,
79-
style.dim,
80-
self.separator,
81-
style.text,
82-
time_data.time_text,
83-
}
84+
if config.plugins.statusclock.show_date then
85+
return {
86+
style.text,
87+
time_data.date_text,
88+
style.dim,
89+
self.separator,
90+
style.text,
91+
time_data.time_text,
92+
}
93+
else
94+
return {
95+
style.text,
96+
time_data.time_text,
97+
}
98+
end
8499
end,
85100
position = -1,
86101
separator = core.status_view.separator2
87102
})
88-

0 commit comments

Comments
 (0)