return f ~= nil
end
--- get all lines from a file, returns an empty
+-- get all lines from a file, returns an empty
-- list/table if the file does not exist
function helpers.lines_from(file)
if not helpers.file_exists(file) then return {} end
lines = {}
- for line in io.lines(file) do
+ for line in io.lines(file) do
lines[#lines + 1] = line
end
return lines
-- returns nil otherwise
function helpers.first_nonempty_line(file)
for k,v in pairs(helpers.lines_from(file)) do
- if #v then return v end
+ if #v then return v end
end
return nil
end
-- Master client deserves a special treatement
local g = {}
- g.width = wa.width - (num_x - 1) * width - num_x * 2*useless_gap - 2
+ g.width = wa.width - (num_x - 1) * width - num_x * 2*useless_gap - 2
g.height = wa.height - 2*useless_gap - 2
g.x = offset_x + useless_gap + global_border
g.y = offset_y + global_border
--[[
-
- Licensed under GNU General Public License v2
- * (c) 2014, projektile, worron
- * (c) 2013, Luke Bonham
- * (c) 2012, Josh Komoroske
- * (c) 2010-2012, Peter Hofmann
-
+
+ Licensed under GNU General Public License v2
+ * (c) 2014, projektile, worron
+ * (c) 2013, Luke Bonham
+ * (c) 2012, Josh Komoroske
+ * (c) 2010-2012, Peter Hofmann
+
--]]
local beautiful = require("beautiful")
--[[
Licensed under GNU General Public License v2
- * (c) 2014 projektile
- * (c) 2013 Luke Bonham
- * (c) 2009 Uli Schlachter
- * (c) 2008 Julien Danjolu
+ * (c) 2014, projektile
+ * (c) 2013, Luke Bonham
+ * (c) 2009, Uli Schlachter
+ * (c) 2008, Julien Danjolu
--]]
--[[
-
- Licensed under GNU General Public License v2
- * (c) 2014 projektile, worron
- * (c) 2013 Luke Bonham
- * (c) 2009 Donald Ephraim Curtis
- * (c) 2008 Julien Danjolu
-
+
+ Licensed under GNU General Public License v2
+ * (c) 2014, projektile, worron
+ * (c) 2013, Luke Bonham
+ * (c) 2009, Donald Ephraim Curtis
+ * (c) 2008, Julien Danjolu
+
--]]
local tag = require("awful.tag")
--[[
Licensed under GNU General Public License v2
- * (c) 2015, Luke Bonham
- * (c) 2015, plotnikovanton
+ * (c) 2015, Luke Bonham
+ * (c) 2015, plotnikovanton
--]]
local setmetatable = setmetatable
--- Basic template for custom widgets
+-- Basic template for custom widgets
-- Asynchronous version
-- lain.widgets.abase
local tims = t_out or 0
local f, c_text
local today = tonumber(os.date('%d'))
- local init_t = calendar.cal .. ' ' .. calendar.post_cal .. ' ' ..
+ local init_t = calendar.cal .. ' ' .. calendar.post_cal .. ' ' ..
' | sed -r -e "s/_\\x08//g" | sed -r -e "s/(^| )('
calendar.offset = calendar.offset + offs
calendar.notify_icon = nil
- f = io.popen(calendar.cal .. ' ' .. month .. ' ' .. year .. ' ' ..
+ f = io.popen(calendar.cal .. ' ' .. month .. ' ' .. year .. ' ' ..
calendar.post_cal)
end
--[[
-
- Licensed under GNU General Public License v2
- * (c) 2014, anticlockwise <http://github.com/anticlockwise>
-
+
+ Licensed under GNU General Public License v2
+ * (c) 2014, anticlockwise <http://github.com/anticlockwise>
+
--]]
local helpers = require("lain.helpers")
--[[
-
- Licensed under GNU General Public License v2
- * (c) 2014, blueluke <http://github.com/blueluke>
-
+
+ Licensed under GNU General Public License v2
+ * (c) 2014, blueluke <http://github.com/blueluke>
+
--]]
-local os = os
-local awful = require("awful")
-local spawn = awful.util.spawn_with_shell
+local awful = require("awful")
+local os = os
+local spawn = awful.util.spawn_with_shell
local setmetatable = setmetatable
--- redshift
+-- Redshift
-- lain.widgets.contrib.redshift
local redshift = {}
-local attached = false -- true if attached to a widget
-local active = false -- true if redshift is active
-local running = false -- true if redshift was initialized
-local update_fnct = function() end -- function that is run each time redshift is toggled. See redshift:attach().
+local attached = false -- true if attached to a widget
+local active = false -- true if redshift is active
+local running = false -- true if redshift was initialized
+local update_fnct = function() end -- Function that is run each time redshift is toggled. See redshift:attach().
local function init()
end
function redshift:toggle()
- if running then
+ if running then
-- Sending -USR1 toggles redshift (See project website)
os.execute("pkill -USR1 redshift")
active = not active
- else
+ else
init()
end
update_fnct()
-- Attach to a widget
-- Provides a button which toggles redshift on/off on click
--- @ param widget: widget to attach to
--- @ param fnct: function to be run each time redshift is toggled (optional).
--- Use it to update widget text or icons on status change.
+-- @param widget: Widget to attach to.
+-- @param fnct: Function to be run each time redshift is toggled (optional).
+-- Use it to update widget text or icons on status change.
function redshift:attach(widget, fnct)
update_fnct = fnct or function() end
if not attached then
mypromptbox[mouse.screen].widget,
function (...)
local f = io.popen("task add " .. ...)
- c_text = "\n<span font='"
+ c_text = "\n<span font='"
.. task.font .. " "
.. task.font_size .. "'>"
.. f:read("*all")
c_text = "<span font='"
.. task.font .. " "
.. task.font_size .. "'>"
- .. c_text
+ .. c_text
.. "</span>"
end