Broke everything up into smaller files
This commit is contained in:
35
awesome/theme/info/battery.lua
Normal file
35
awesome/theme/info/battery.lua
Normal file
@@ -0,0 +1,35 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
|
||||
local baticon = wibox.widget.imagebox(nil)
|
||||
local bat = lain.widget.bat({
|
||||
settings = function()
|
||||
-- luacheck: globals widget bat_now
|
||||
if bat_now.ac_status == 1 or bat_now.perc == 'N/A' then
|
||||
baticon:set_image(theme.widget_bat_charge)
|
||||
elseif bat_now.perc < 5 then
|
||||
baticon:set_image(theme.widget_bat_empty)
|
||||
elseif bat_now.perc < 15 then
|
||||
baticon:set_image(theme.widget_bat_low)
|
||||
elseif bat_now.perc < 50 then
|
||||
baticon:set_image(theme.widget_bat_mid)
|
||||
elseif bat_now.perc < 95 then
|
||||
baticon:set_image(theme.widget_bat_high)
|
||||
else
|
||||
baticon:set_image(theme.widget_bat_full)
|
||||
end
|
||||
local perc = bat_now.perc ~= 'N/A' and bat_now.perc .. '%' or bat_now.perc
|
||||
|
||||
if bat_now.ac_status == 1 then
|
||||
perc = perc .. ' plug'
|
||||
end
|
||||
|
||||
widget:set_text(perc)
|
||||
end,
|
||||
})
|
||||
|
||||
return { {
|
||||
widget = wibox.layout.fixed.horizontal(baticon, bat.widget),
|
||||
bg = '#e54c62',
|
||||
} }
|
||||
21
awesome/theme/info/clock.lua
Normal file
21
awesome/theme/info/clock.lua
Normal file
@@ -0,0 +1,21 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
|
||||
os.setlocale(os.getenv('LANG')) -- to localize the clock
|
||||
local mytextclock = wibox.widget.textclock('%I:%M %a %d.%m')
|
||||
mytextclock.font = theme.font
|
||||
|
||||
lain.widget.cal({
|
||||
attach_to = { mytextclock },
|
||||
notification_preset = {
|
||||
font = 'Monospace 10',
|
||||
fg = theme.fg_normal,
|
||||
bg = theme.bg_normal,
|
||||
},
|
||||
})
|
||||
|
||||
return { {
|
||||
widget = mytextclock,
|
||||
bg = '#7788af',
|
||||
} }
|
||||
16
awesome/theme/info/cpu.lua
Normal file
16
awesome/theme/info/cpu.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
local cpu = lain.widget.cpu({
|
||||
settings = function()
|
||||
-- luacheck: globals widget cpu_now
|
||||
widget:set_text(cpu_now.usage .. '%')
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_cpu), cpu.widget),
|
||||
bg = '#e33a6e',
|
||||
},
|
||||
}
|
||||
27
awesome/theme/info/fs.lua
Normal file
27
awesome/theme/info/fs.lua
Normal file
@@ -0,0 +1,27 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local gears = require('gears')
|
||||
local awful = require('awful')
|
||||
|
||||
local fs = lain.widget.fs({
|
||||
notification_preset = { font = 'Monospace 10', fg = theme.fg_normal },
|
||||
settings = function()
|
||||
-- luacheck: max line length 150, globals widget fs_now
|
||||
widget:set_text(
|
||||
fs_now['/'].percentage
|
||||
.. '% ('
|
||||
.. string.format('%.3f', fs_now['/'].free)
|
||||
.. ' '
|
||||
.. fs_now['/'].units
|
||||
.. ' left)'
|
||||
)
|
||||
end,
|
||||
})
|
||||
fs.widget:buttons(gears.table.join(awful.button({}, 1, function()
|
||||
awful.spawn('Thunar')
|
||||
end)))
|
||||
|
||||
return { {
|
||||
widget = fs.widget,
|
||||
bg = '#80d9d8',
|
||||
} }
|
||||
14
awesome/theme/info/init.lua
Normal file
14
awesome/theme/info/init.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
local gears = require('gears')
|
||||
local settings = require('theme.settings')
|
||||
|
||||
local show_battery = settings['show_battery'] == true
|
||||
|
||||
return gears.table.join(
|
||||
require('theme.info.net'),
|
||||
show_battery and require('theme.info.battery') or {},
|
||||
require('theme.info.volume'),
|
||||
require('theme.info.mem'),
|
||||
require('theme.info.cpu'),
|
||||
require('theme.info.fs'),
|
||||
require('theme.info.clock')
|
||||
)
|
||||
17
awesome/theme/info/mem.lua
Normal file
17
awesome/theme/info/mem.lua
Normal file
@@ -0,0 +1,17 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
|
||||
local memory = lain.widget.mem({
|
||||
settings = function()
|
||||
-- luacheck: globals widget mem_now
|
||||
widget:set_text(mem_now.used .. 'M')
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_mem), memory.widget),
|
||||
bg = '#e0da37',
|
||||
},
|
||||
}
|
||||
23
awesome/theme/info/net.lua
Normal file
23
awesome/theme/info/net.lua
Normal file
@@ -0,0 +1,23 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
|
||||
local netdowninfo = wibox.widget.textbox()
|
||||
local netupinfo = lain.widget.net({
|
||||
settings = function()
|
||||
-- luacheck: globals widget net_now
|
||||
widget:set_text(net_now.sent)
|
||||
netdowninfo:set_text(net_now.received)
|
||||
end,
|
||||
})
|
||||
|
||||
return {
|
||||
{
|
||||
widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netdown), netdowninfo),
|
||||
bg = '#87af5f',
|
||||
},
|
||||
{
|
||||
widget = wibox.layout.fixed.horizontal(wibox.widget.imagebox(theme.widget_netup), netupinfo.widget),
|
||||
bg = '#e54c62',
|
||||
},
|
||||
}
|
||||
46
awesome/theme/info/volume.lua
Normal file
46
awesome/theme/info/volume.lua
Normal file
@@ -0,0 +1,46 @@
|
||||
local theme = require('theme.base_theme')
|
||||
local lain = require('lain')
|
||||
local wibox = require('wibox')
|
||||
local awful = require('awful')
|
||||
|
||||
local volumeicon = wibox.widget.imagebox(nil)
|
||||
local volume = lain.widget.alsa({
|
||||
settings = function()
|
||||
-- luacheck: globals widget volume_now
|
||||
if volume_now.status == 'off' then
|
||||
volumeicon:set_image(theme.widget_vol_mute)
|
||||
volume_now.level = 'M ' .. volume_now.level
|
||||
elseif volume_now.level == 0 then
|
||||
volumeicon:set_image(theme.widget_vol_mute)
|
||||
elseif volume_now.level <= 50 then
|
||||
volumeicon:set_image(theme.widget_vol_low)
|
||||
else
|
||||
volumeicon:set_image(theme.widget_vol_high)
|
||||
end
|
||||
|
||||
widget:set_text(' ' .. volume_now.level .. '%')
|
||||
end,
|
||||
})
|
||||
|
||||
local volumebuttons = awful.util.table.join(
|
||||
awful.button({}, 1, function() -- left click
|
||||
os.execute(string.format('%s set %s toggle', volume.cmd, volume.togglechannel or volume.channel))
|
||||
volume.update()
|
||||
end),
|
||||
awful.button({}, 4, function()
|
||||
os.execute(string.format('%s set %s 1%%+', volume.cmd, volume.channel))
|
||||
volume.update()
|
||||
end),
|
||||
awful.button({}, 5, function()
|
||||
os.execute(string.format('%s set %s 1%%-', volume.cmd, volume.channel))
|
||||
volume.update()
|
||||
end)
|
||||
)
|
||||
|
||||
volume.widget:buttons(volumebuttons)
|
||||
volumeicon:buttons(volumebuttons)
|
||||
|
||||
return { {
|
||||
widget = wibox.layout.fixed.horizontal(volumeicon, volume.widget),
|
||||
bg = '#7493d2',
|
||||
} }
|
||||
Reference in New Issue
Block a user