elenapan/config/awesome/noodle/disk.lua
Elena deddf27a48 New theme: skyfall, New features: start screen, customized titlebars for ncmpcpp, New fetch script: bunnyfetch
Former-commit-id: 67b11d1981
Former-commit-id: dc97e48128477f0c5c3ad9d79cfc9dcebebc597e
Former-commit-id: f90e0fc6a0402204d95c93b14ed8ce4bb3498bfd
Former-commit-id: b184e1b44758e9bff8b3dd460fc97159626a97b0
2019-02-22 14:01:48 +02:00

51 lines
1.2 KiB
Lua

local awful = require("awful")
local gears = require("gears")
local wibox = require("wibox")
local beautiful = require("beautiful")
-- Configuration
local update_interval = 120 -- in seconds
local disk = wibox.widget{
text = "free disk space",
align = 'center',
valign = 'center',
widget = wibox.widget.textbox
}
-- Mouse control
-- disk:buttons(gears.table.join(
-- --
-- awful.button({ }, 1, function ()
-- end),
-- --
-- awful.button({ }, 2, function ()
-- end),
-- --
-- awful.button({ }, 3, function ()
-- end),
-- --
-- awful.button({ }, 4, function ()
-- end),
-- awful.button({ }, 5, function ()
-- end)
-- ))
local function update_widget(disk_space)
disk.markup = disk_space .. "B free"
end
-- Use /dev/sdXY according to your setup
local disk_script = [[
bash -c "
df -k -h /dev/sda2 | tail -1 | awk '{print $4}'
"]]
awful.widget.watch(disk_script, update_interval, function(widget, stdout)
local disk_space = stdout
-- Remove trailing white space
disk_space = string.gsub(disk_space, '^%s*(.-)%s*$', '%1')
update_widget(disk_space)
end)
return disk