Broke everything up into smaller files

This commit is contained in:
2023-01-30 16:23:16 +01:00
parent ded5fa47f9
commit d4e9f9b1d6
193 changed files with 873 additions and 898 deletions

View 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',
} }

View 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',
} }

View 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
View 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',
} }

View 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')
)

View 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',
},
}

View 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',
},
}

View 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',
} }