summaryrefslogtreecommitdiff
path: root/widgets
diff options
context:
space:
mode:
authorNicolas Schodet2019-07-30 10:55:55 +0200
committerNicolas Schodet2019-07-30 10:55:55 +0200
commitc10d06e4c55a3bbaf1d42d88217c4f9b775c9478 (patch)
tree0c1883f3ddf55326ceaafb2b30c648730f82df1b /widgets
parent017afd5524c4a96ac67c14586a2d2c5674e040ac (diff)
Upgrade to awesome 4.3
Diffstat (limited to 'widgets')
-rw-r--r--widgets/cal.lua21
-rw-r--r--widgets/volume.lua9
2 files changed, 11 insertions, 19 deletions
diff --git a/widgets/cal.lua b/widgets/cal.lua
index 10dc982..c1f8551 100644
--- a/widgets/cal.lua
+++ b/widgets/cal.lua
@@ -23,17 +23,15 @@
-- On clicking or by using the mouse wheel the displayed month changes.
-- Pressing Shift + Mouse click change the year.
-local string = {format = string.format}
-local os = {date = os.date, time = os.time}
local awful = require("awful")
-module("widgets.cal")
-
local tooltip
local state = {}
local current_day_format = "<u>%s</u>"
-function displayMonth(month,year,weekStart)
+local cal = {}
+
+local function displayMonth(month,year,weekStart)
local t,wkSt=os.time{year=year, month=month+1, day=0},weekStart or 1
local d=os.date("*t",t)
local mthDays,stDay=d.day,(d.wday-d.day-wkSt+1)%7
@@ -79,8 +77,13 @@ function displayMonth(month,year,weekStart)
return header .. "\n" .. lines
end
+local function switchMonth(delta)
+ state[1] = state[1] + (delta or 1)
+ local text = displayMonth(state[1], state[2], 2)
+ tooltip:set_markup(text)
+end
-function register(mywidget, custom_current_day_format)
+function cal.register(mywidget, custom_current_day_format)
if custom_current_day_format then current_day_format = custom_current_day_format end
if not tooltip then
@@ -121,8 +124,4 @@ function register(mywidget, custom_current_day_format)
end)))
end
-function switchMonth(delta)
- state[1] = state[1] + (delta or 1)
- local text = displayMonth(state[1], state[2], 2)
- tooltip:set_markup(text)
-end
+return cal
diff --git a/widgets/volume.lua b/widgets/volume.lua
index 172931d..18bc2e2 100644
--- a/widgets/volume.lua
+++ b/widgets/volume.lua
@@ -1,16 +1,9 @@
-- Inspired by https://awesome.naquadah.org/wiki/Farhavens_volume_widget
-local setmetatable = setmetatable
-local io = io
-local string = string
-local tonumber = tonumber
-local capi = { widget = widget }
local awful = require('awful')
local wibox = require('wibox')
local beautiful = require('beautiful')
-module('widgets.volume')
-
local cardid = nil
local channel = 'Master'
@@ -84,4 +77,4 @@ local function new(args)
return w
end
-setmetatable(_M, { __call = function(_, ...) return new(...) end })
+return new