summaryrefslogtreecommitdiff
path: root/awesome/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'awesome/widgets')
-rw-r--r--awesome/widgets/audio.lua21
-rw-r--r--awesome/widgets/battery.lua24
-rw-r--r--awesome/widgets/button.lua33
-rw-r--r--awesome/widgets/classiclayouts.lua64
-rw-r--r--awesome/widgets/cpu.lua38
-rw-r--r--awesome/widgets/pavolctld.lua104
-rw-r--r--awesome/widgets/ram.lua34
-rw-r--r--awesome/widgets/temperature.lua26
8 files changed, 0 insertions, 344 deletions
diff --git a/awesome/widgets/audio.lua b/awesome/widgets/audio.lua
deleted file mode 100644
index 002c556..0000000
--- a/awesome/widgets/audio.lua
+++ /dev/null
@@ -1,21 +0,0 @@
-local awful = require("awful")
-local wibox = require("wibox")
-local gears = require("gears")
-
-local audio_dropdown = awful.popup {
- widget = {
- margins = 10,
- widget = wibox.container.margin,
- {
- layout = wibox.layout.fixed.horizontal,
- wibox.widget.textbox "AUDIO",
- },
- },
- ontop = true,
- placement = awful.placement.centered,
- border_width = 1,
- border_color = "#ff0000",
- visible = true,
-}
-
-return audio_dropdown
diff --git a/awesome/widgets/battery.lua b/awesome/widgets/battery.lua
deleted file mode 100644
index f6e6860..0000000
--- a/awesome/widgets/battery.lua
+++ /dev/null
@@ -1,24 +0,0 @@
-local awful = require("awful")
-local wibox = require("wibox")
-local naughty = require("naughty")
-
-local widget = wibox.widget.textbox()
-
--- update widget on lowbat output
-local lowbat_pid = awful.spawn.with_line_callback("lowbat", {
- stdout = function(stdout)
- widget:set_text(stdout)
- end,
- stderr = function(stderr)
- naughty.notify({
- preset = naughty.config.presets.critical,
- title = "lowbat error",
- text = stderr
- })
- end,
-})
-
--- kill current lowbat on refresh/exit
-awesome.connect_signal("exit", function() awful.spawn("kill " .. lowbat_pid) end)
-
-return widget
diff --git a/awesome/widgets/button.lua b/awesome/widgets/button.lua
deleted file mode 100644
index cd1da1e..0000000
--- a/awesome/widgets/button.lua
+++ /dev/null
@@ -1,33 +0,0 @@
-local awful = require("awful")
-local beautiful = require("beautiful")
-local menubar = require("menubar")
-
-local hotkeys_popup = require("awful.hotkeys_popup")
--- Enable hotkeys help widget for VIM and other apps
--- when client with a matching name is opened:
-require("awful.hotkeys_popup.keys")
-
--- Menu
--- Create a launcher widget and a main menu
-myawesomemenu = {
- { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
- { "restart", awesome.restart },
- { "quit", function() awesome.quit() end },
-}
-
-mymainmenu = awful.menu({
- items = {
- { "awesome", myawesomemenu, beautiful.awesome_icon },
- { "open terminal", terminal }
- }
-})
-
-mylauncher = awful.widget.launcher({
- image = beautiful.awesome_icon,
- menu = mymainmenu
-})
-
--- Menubar configuration
-menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-
-return mylauncher
diff --git a/awesome/widgets/classiclayouts.lua b/awesome/widgets/classiclayouts.lua
deleted file mode 100644
index 3b4fd64..0000000
--- a/awesome/widgets/classiclayouts.lua
+++ /dev/null
@@ -1,64 +0,0 @@
-local wibox = require("wibox")
-local layout = require("awful.layout")
-
-local screen_widgets = {} -- need one widget per screen
-
-local layout_icons = {
- cornernw = "TT=",
- cornerne = "=TT",
- cornersw = "LL=",
- cornerse = "=LL",
- fairh = "#_#",
- fairv = "##H",
- max = "[M]",
- floating = "><>",
- magnifier = "=O=",
- fullscreen = "[*]",
- spiral = "[]@",
- dwindle = "[]\\",
- tile = "[]=",
- tiletop = "LLL",
- tilebottom = "TTT",
- tileleft = "=[]",
-}
-
-function update(screen_index)
- local s = screen[screen_index or 1]
- local w = screen_widgets[s]
- local l = layout.get(s)
-
- -- create widget if not existing
- if w == nil then
- screen_widgets[s] = { widget = wibox.widget.textbox(), layout = l }
- w = screen_widgets[s]
- --w._layoutbox_tooltip = tooltip {objects = {w}, delay_show = 1}
-
- -- skip if no change
- elseif w.layout == l then
- return
- end
-
- -- set widget
- local name = layout.getname(l)
- --w._layoutbox_tooltip:set_text(name)
- w.widget:set_text(layout_icons[name]) -- TODO handle nil
- return w.widget
-end
-
-function update_screens()
- for s, w in pairs(boxes) do
- if s.valid then
- update(s)
- end
- end
-end
-
-function update_current_tag(t)
- update(t.screen)
-end
-
-tag.connect_signal("property::selected", update_current_tag)
-tag.connect_signal("property::layout", update_current_tag)
-tag.connect_signal("property::screen", update_screens)
-
-return update
diff --git a/awesome/widgets/cpu.lua b/awesome/widgets/cpu.lua
deleted file mode 100644
index d92bce8..0000000
--- a/awesome/widgets/cpu.lua
+++ /dev/null
@@ -1,38 +0,0 @@
-local wibox = require("wibox")
-local widgets = require("util.widgets")
-
--- this is directly adapted from slstatus's cpu.c module
-local cpu_time = { 0,0,0,0,0,0,0 } -- user, nice, system, idle, iowait, irq, softirq
-
-function linux_cpu_usage(widget)
- -- read stat
- local statf = io.open("/proc/stat")
- local stat_iter = statf:read():gmatch("%d+")
- statf:close()
-
- -- calc
- local sum = 0
- local a, b = cpu_time, {} -- set cpu_time as a for smaller code
- table.move(a, 1, 7, 1, b) -- copy first 7 to b
-
- for i = 1, 7 do
- a[i] = stat_iter()
- sum = sum + b[i] - a[i]
- end
-
- if sum == 0 then
- return
- end
-
- local usage = ((b[1] + b[2] + b[3] + b[6] + b[7]) -
- (a[1] + a[2] + a[3] + a[6] + a[7])) * 100 / sum
-
- widget:set_text(math.floor(usage))
-end
-
--- return correct widget for os
-if osname == "Linux" then
- return widgets.watchfn(linux_cpu_usage, 5)
-end
-
-return wibox.widget.textbox("unsupported os")
diff --git a/awesome/widgets/pavolctld.lua b/awesome/widgets/pavolctld.lua
deleted file mode 100644
index f59b27f..0000000
--- a/awesome/widgets/pavolctld.lua
+++ /dev/null
@@ -1,104 +0,0 @@
-local awful = require("awful")
-local wibox = require("wibox")
-local naughty = require("naughty")
-
--- Gio is used to handle the subprocess instead of awful.spawn.
--- Gio is more flexible and allows writing to stdin.
--- also, awful.spawn.with_line_callback does not play nicely with pavolctld, as
--- it seems to feed the stdout back into its stdin and kill performance.
-local lgi = require("lgi")
-local Gio = lgi.Gio
-
--- return table
-local widget = {
- textbox = wibox.widget.textbox()
-}
-
--- start subprocess
-local p = Gio.Subprocess.new({ "pavolctld" }, Gio.SubprocessFlags.STDIN_PIPE + Gio.SubprocessFlags.STDOUT_PIPE)
-
-local stdout = p:get_stdout_pipe()
-local stdin = p:get_stdin_pipe()
-
--- state vars
-local sinks = {
- default = nil,
- command = nil, -- sink being modified by commands
- sinks = {},
-}
-
-function sinks.get(i)
- if sinks.sinks[i] == nil then
- sinks.sinks[i] = {
- vol = 0,
- db = 0.0,
- mute = 0,
- name = "",
- desc = "",
- }
- end
- return sinks.sinks[i]
-end
-
--- parse output
-function parse_csv(csv)
- return (csv .. ","):gmatch("(.-),")
-end
-
-awful.spawn.read_lines(stdout, function(s)
- local cmd = s:sub(1, 1) -- first char of output
- -- volume change
- if cmd == 'v' then
- local v = parse_csv(s:sub(2))
- local i = tonumber(v())
- local sink = sinks.get(i)
- sink.vol = tonumber(v())
- sink.db = tonumber(v())
- sink.mute = tonumber(v())
-
- if sink == sinks.default then
- widget.textbox:set_text(sink.vol)
- end
- -- sink description change
- elseif cmd == 's' then
- local v = parse_csv(s:sub(2))
- local i = tonumber(v())
- local sink = sinks.get(i)
- sink.name = v()
- sink.desc = v()
- -- default sink change
- elseif cmd == 'f' then
- local f = tonumber(s:sub(2))
- sinks.default = sinks.get(f)
- widget.textbox:set_text(sinks.default.vol)
- -- set command sink to default sink for now TODO change later
- pavolctld_cmd("s")
- -- sink removed
- elseif cmd == 'x' then
- local x = tonumber(s:sub(2))
- table.remove(sinks.sinks, x)
- else
- naughty.notify({
- preset = naughty.config.presets.critical,
- title = "pavolctld error",
- text = s
- })
- end
-end)
-
--- pavolctld takes commands in using stdin
-function pavolctld_cmd(cmd)
- local _, err = stdin:write_all(cmd .. "\n", nil)
-
- if err then return nil end
- return true
-end
-
-function widget.volume_inc(vol) return pavolctld_cmd("v+" .. vol) end
-function widget.volume_dec(vol) return pavolctld_cmd("v-" .. vol) end
-function widget.volume_set(vol) return pavolctld_cmd("v" .. vol) end
-function widget.mute_set(muted) return pavolctld_cmd("m" .. muted and 1 or 0) end
-function widget.mute_toggle() return pavolctld_cmd("m") end
-function widget.default_sink_set(i) return pavolctld_cmd("f" .. i) end
-
-return widget
diff --git a/awesome/widgets/ram.lua b/awesome/widgets/ram.lua
deleted file mode 100644
index 44ab314..0000000
--- a/awesome/widgets/ram.lua
+++ /dev/null
@@ -1,34 +0,0 @@
-local wibox = require("wibox")
-local widgets = require("util.widgets")
-
-
-function linux_ram_usage(widget)
- -- read meminfo
- local meminfof = io.open("/proc/meminfo")
-
- local total = meminfof:read():match("%d+")
- local free = meminfof:read():match("%d+")
-
- meminfof:read() -- memavailable not used
-
- local buffers = meminfof:read():match("%d+")
- local cached = meminfof:read():match("%d+")
-
- meminfof:close()
-
- -- calc
- if total == nil then
- return
- end
-
- local used = (total - free - buffers - cached) * 100 / total
-
- widget:set_text(math.floor(used))
-end
-
--- return correct widget for os
-if osname == "Linux" then
- return widgets.watchfn(linux_ram_usage, 5)
-end
-
-return wibox.widget.textbox("unsupported os")
diff --git a/awesome/widgets/temperature.lua b/awesome/widgets/temperature.lua
deleted file mode 100644
index a30e1ed..0000000
--- a/awesome/widgets/temperature.lua
+++ /dev/null
@@ -1,26 +0,0 @@
-local wibox = require("wibox")
-local widgets = require("util.widgets")
-
-
-local linux = { file = nil }
-function linux.temperature(widget)
- -- read meminfo
- local tempf = io.open(linux.file)
- if tempf then
- local temp = tempf:read() / 1000
- tempf:close()
- widget:set_text(math.floor(temp))
- else
- widget:set_text("err")
- end
-end
-
--- return correct widget for os
-if osname == "Linux" then
- return function(file)
- linux.file = file
- return widgets.watchfn(linux.temperature, 5)
- end
-end
-
-return wibox.widget.textbox("unsupported os")