Created
August 30, 2011 09:18
-
-
Save mason-larobina/1180520 to your computer and use it in GitHub Desktop.
Patch to add a clock widget to luakit (for the fullscreeners)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/config/rc.lua b/config/rc.lua | |
index 839310e..88b43be 100644 | |
--- a/config/rc.lua | |
+++ b/config/rc.lua | |
@@ -130,6 +130,30 @@ require "go_input" | |
require "go_next_prev" | |
require "go_up" | |
+------------------ | |
+-- Add a clock! -- | |
+------------------ | |
+ | |
+local clock_format, clock_interval = "%H:%M:%S", 1e3 -- 1 second | |
+--local clock_format, clock_interval = "%H:%M", 60e3 -- 60 seconds | |
+ | |
+local clock_timer = timer{interval = clock_interval} | |
+clock_timer:add_signal("timeout", function () | |
+ for _, w in pairs(window.bywidget) do | |
+ w.sbar.r.clock.text = os.date(clock_format) | |
+ end | |
+end) | |
+clock_timer:start() | |
+ | |
+window.init_funcs.clock_widget = function (w) | |
+ local c = widget{type="label"} | |
+ w.sbar.r.clock = c | |
+ w.sbar.r.layout:pack_start(c, false, false, 0) | |
+ c:show() | |
+ c.fg, c.font = theme.clock_sbar_fg, theme.clock_sbar_font | |
+ c.text = os.date(clock_format) | |
+end | |
+ | |
----------------------------- | |
-- End user script loading -- | |
----------------------------- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment