diff options
author | Francesco <francesco.bbt@gmail.com> | 2021-08-17 22:44:17 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-17 22:44:17 +0200 |
commit | 49d3d21c987645b448184a752043946ed90d6031 (patch) | |
tree | b187286f2ed78fa9317f288dc0c5144840bcdad9 /plugins/bigclock.lua | |
parent | a42a0d57b08a9080ed9fd8fa84f1269e3847980f (diff) | |
parent | 9689846686f77dc0aa1e6f4d31fbfc42998c2085 (diff) | |
download | lite-xl-plugins-49d3d21c987645b448184a752043946ed90d6031.tar.gz lite-xl-plugins-49d3d21c987645b448184a752043946ed90d6031.zip |
Merge pull request #45 from lite-xl/2.0
2.0 Merge
Diffstat (limited to 'plugins/bigclock.lua')
-rw-r--r-- | plugins/bigclock.lua | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/plugins/bigclock.lua b/plugins/bigclock.lua index ac44c9f..e77f336 100644 --- a/plugins/bigclock.lua +++ b/plugins/bigclock.lua @@ -1,4 +1,4 @@ --- mod-version:1 -- lite-xl 1.16 +-- mod-version:2 -- lite-xl 2.0 local core = require "core" local style = require "core.style" local command = require "core.command" @@ -7,9 +7,11 @@ local config = require "core.config" local View = require "core.view" -config.bigclock_time_format = "%H:%M:%S" -config.bigclock_date_format = "%A, %d %B %Y" -config.bigclock_scale = 1 +config.plugins.bigclock = { + time_format = "%H:%M:%S", + date_format = "%A, %d %B %Y" + scale = 1 +} local ClockView = View:extend() @@ -28,7 +30,7 @@ end function ClockView:update_fonts() - local size = math.floor(self.size.x * 0.15 / 15) * 15 * config.bigclock_scale + local size = math.floor(self.size.x * 0.15 / 15) * 15 * config.plugins.bigclock.scale if self.font_size ~= size then self.time_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", size) self.date_font = renderer.font.load(DATADIR .. "/fonts/font.ttf", size * 0.3) @@ -40,8 +42,8 @@ end function ClockView:update() - local time_text = os.date(config.bigclock_time_format) - local date_text = os.date(config.bigclock_date_format) + local time_text = os.date(config.plugins.bigclock.time_format) + local date_text = os.date(config.plugins.bigclock.date_format) if self.time_text ~= time_text or self.date_text ~= date_text then core.redraw = true self.time_text = time_text |