Added luarocks config and handled warnings

This commit is contained in:
Mutzi 2023-01-21 16:25:32 +01:00
parent 3e7810e664
commit f0a0ff2855
3 changed files with 83 additions and 28 deletions

56
awesome/.luacheckrc Normal file
View File

@ -0,0 +1,56 @@
-- Only allow symbols available in all Lua versions
std = "min"
-- Get rid of "unused argument self"-warnings
self = false
-- The unit tests can use busted
files["spec"].std = "+busted"
-- The default config may set global variables
files["awesomerc.lua"].allow_defined_top = true
files["rc.lua"].allow_defined_top = true
-- This file itself
files[".luacheckrc"].ignore = {"111", "112", "131"}
-- Theme files, ignore max line length
files["themes/*"].ignore = {"631"}
-- Global objects defined by the C code
read_globals = {
"awesome",
"button",
"dbus",
"drawable",
"drawin",
"key",
"keygrabber",
"mousegrabber",
"selection",
"tag",
"window",
"table.unpack",
"math.atan2",
}
-- screen may not be read-only, because newer luacheck versions complain about
-- screen[1].tags[1].selected = true.
-- The same happens with the following code:
-- local tags = mouse.screen.tags
-- tags[7].index = 4
-- client may not be read-only due to client.focus.
globals = {
"screen",
"mouse",
"root",
"client"
}
-- Enable cache (uses .luacheckcache relative to this rc file).
cache = true
-- Do not enable colors to make the CI output more readable.
color = false
-- vim: filetype=lua:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:textwidth=80

View File

@ -78,7 +78,8 @@ awful.spawn.with_shell(
'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' .. 'if (xrdb -query | grep -q "^awesome\\.started:\\s*true$"); then exit; fi;' ..
'xrdb -merge <<< "awesome.started:true";' .. 'xrdb -merge <<< "awesome.started:true";' ..
-- list each of your autostart commands, followed by ; inside single quotes, followed by .. -- list each of your autostart commands, followed by ; inside single quotes, followed by ..
'dex --environment Awesome --autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex 'dex --environment Awesome
--autostart --search-paths "$XDG_CONFIG_DIRS/autostart:$XDG_CONFIG_HOME/autostart"' -- https://github.com/jceb/dex
) )
--]] --]]
@ -89,9 +90,9 @@ local modkey = "Mod4"
local altkey = "Mod1" local altkey = "Mod1"
local terminal = "kitty" local terminal = "kitty"
local vi_focus = false -- vi-like client focus https://github.com/lcpz/awesome-copycats/issues/275 local vi_focus = false -- vi-like client focus https://github.com/lcpz/awesome-copycats/issues/275
local cycle_prev = true -- cycle with only the previously focused client or all https://github.com/lcpz/awesome-copycats/issues/274 -- cycle with only the previously focused client or all https://github.com/lcpz/awesome-copycats/issues/274
local editor = os.getenv("EDITOR") or "nvim" local cycle_prev = true
local browser = "firefox" local editor = "nvim"
awful.util.terminal = terminal awful.util.terminal = terminal
awful.util.tagnames = { "1", "2", "3", "4", "5" } awful.util.tagnames = { "1", "2", "3", "4", "5" }
@ -255,8 +256,10 @@ globalkeys = mytable.join(
{description = "take a screenshot", group = "hotkeys"}), {description = "take a screenshot", group = "hotkeys"}),
-- X screen locker -- X screen locker
awful.key({ modkey, altkey, "Control" }, "l", function () os.execute(os.getenv("HOME") .. "/.config/awesome/scripts/lock.sh") end, awful.key({ modkey, altkey, "Control" }, "l", function ()
{description = "lock screen", group = "hotkeys"}), os.execute(os.getenv("HOME") .. "/.config/awesome/scripts/lock.sh")
end,
{description = "lock screen", group = "hotkeys"}),
-- Show help -- Show help
awful.key({ modkey, }, "s", hotkeys_popup.show_help, awful.key({ modkey, }, "s", hotkeys_popup.show_help,
@ -418,7 +421,7 @@ globalkeys = mytable.join(
awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end, awful.key({ altkey, }, "w", function () if beautiful.weather then beautiful.weather.show(7) end end,
{description = "show weather", group = "widgets"}), {description = "show weather", group = "widgets"}),
]]-- ]]--
-- Screen brightness -- Screen brightness
--awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end, --awful.key({ }, "XF86MonBrightnessUp", function () os.execute("xbacklight -inc 10") end,
-- {description = "+10%", group = "hotkeys"}), -- {description = "+10%", group = "hotkeys"}),
@ -441,7 +444,9 @@ globalkeys = mytable.join(
{description = "volume down", group = "hotkeys"}), {description = "volume down", group = "hotkeys"}),
awful.key({ altkey }, "m", awful.key({ altkey }, "m",
function () function ()
os.execute(string.format("amixer -q set %s toggle", beautiful.volume.togglechannel or beautiful.volume.channel)) os.execute(string.format("amixer -q set %s toggle",
beautiful.volume.togglechannel or beautiful.volume.channel)
)
beautiful.volume.update() beautiful.volume.update()
end, end,
{description = "toggle mute", group = "hotkeys"}), {description = "toggle mute", group = "hotkeys"}),

View File

@ -96,7 +96,9 @@ local markup = lain.util.markup
-- Textclock -- Textclock
os.setlocale(os.getenv("LANG")) -- to localize the clock os.setlocale(os.getenv("LANG")) -- to localize the clock
local clockicon = wibox.widget.imagebox(theme.widget_clock) local clockicon = wibox.widget.imagebox(theme.widget_clock)
local mytextclock = wibox.widget.textclock(markup("#7788af", "%A %d %B ") .. markup("#ab7367", ">") .. markup("#de5e1e", " %H:%M ")) local mytextclock = wibox.widget.textclock(
markup("#7788af", "%A %d %B ") .. markup("#ab7367", ">") .. markup("#de5e1e", " %H:%M ")
)
mytextclock.font = theme.font mytextclock.font = theme.font
-- Calendar -- Calendar
@ -114,7 +116,10 @@ local fsicon = wibox.widget.imagebox(theme.widget_fs)
theme.fs = lain.widget.fs({ theme.fs = lain.widget.fs({
notification_preset = { font = "Monospace 10", fg = theme.fg_normal }, notification_preset = { font = "Monospace 10", fg = theme.fg_normal },
settings = function() settings = function()
widget:set_markup(markup.fontfg(theme.font, "#80d9d8", fs_now["/"].percentage .. "% (" .. string.format("%.3f", fs_now["/"].free) .. " " .. fs_now["/"].units .. " left)")) -- luacheck: max line length 150, globals widget fs_now
widget:set_markup(markup.fontfg(theme.font, "#80d9d8",
fs_now["/"].percentage .. "% (" .. string.format("%.3f", fs_now["/"].free) .. " " .. fs_now["/"].units .. " left)")
)
end end
}) })
theme.fs.widget:buttons(gears.table.join( theme.fs.widget:buttons(gears.table.join(
@ -127,6 +132,7 @@ theme.fs.widget:buttons(gears.table.join(
local cpuicon = wibox.widget.imagebox(theme.widget_cpu) local cpuicon = wibox.widget.imagebox(theme.widget_cpu)
local cpu = lain.widget.cpu({ local cpu = lain.widget.cpu({
settings = function() settings = function()
-- luacheck: globals widget cpu_now
widget:set_markup(markup.fontfg(theme.font, "#e33a6e", cpu_now.usage .. "% ")) widget:set_markup(markup.fontfg(theme.font, "#e33a6e", cpu_now.usage .. "% "))
end end
}) })
@ -157,6 +163,7 @@ local bat = lain.widget.bat({
local volicon = wibox.widget.imagebox(theme.widget_vol) local volicon = wibox.widget.imagebox(theme.widget_vol)
theme.volume = lain.widget.alsa({ theme.volume = lain.widget.alsa({
settings = function() settings = function()
-- luacheck: globals widget volume_now
if volume_now.status == "off" then if volume_now.status == "off" then
volume_now.level = volume_now.level .. "M" volume_now.level = volume_now.level .. "M"
end end
@ -181,6 +188,7 @@ local netdowninfo = wibox.widget.textbox()
local netupicon = wibox.widget.imagebox(theme.widget_netup) local netupicon = wibox.widget.imagebox(theme.widget_netup)
local netupinfo = lain.widget.net({ local netupinfo = lain.widget.net({
settings = function() settings = function()
-- luacheck: globals widget net_now
widget:set_markup(markup.fontfg(theme.font, "#e54c62", net_now.sent .. " ")) widget:set_markup(markup.fontfg(theme.font, "#e54c62", net_now.sent .. " "))
netdowninfo:set_markup(markup.fontfg(theme.font, "#87af5f", net_now.received .. " ")) netdowninfo:set_markup(markup.fontfg(theme.font, "#87af5f", net_now.received .. " "))
end end
@ -190,6 +198,7 @@ local netupinfo = lain.widget.net({
local memicon = wibox.widget.imagebox(theme.widget_mem) local memicon = wibox.widget.imagebox(theme.widget_mem)
local memory = lain.widget.mem({ local memory = lain.widget.mem({
settings = function() settings = function()
-- luacheck: globals widget mem_now
widget:set_markup(markup.fontfg(theme.font, "#e0da37", mem_now.used .. "M ")) widget:set_markup(markup.fontfg(theme.font, "#e0da37", mem_now.used .. "M "))
end end
}) })
@ -256,7 +265,9 @@ function theme.at_screen_connect(s)
s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons) s.mytasklist = awful.widget.tasklist(s, awful.widget.tasklist.filter.currenttags, awful.util.tasklist_buttons)
-- Create the wibox -- Create the wibox
s.mywibox = awful.wibar({ position = "top", screen = s, height = dpi(19), bg = theme.bg_normal, fg = theme.fg_normal }) s.mywibox = awful.wibar(
{ position = "top", screen = s, height = dpi(19), bg = theme.bg_normal, fg = theme.fg_normal }
)
-- Add widgets to the wibox -- Add widgets to the wibox
s.mywibox:setup { s.mywibox:setup {
@ -298,23 +309,6 @@ function theme.at_screen_connect(s)
mytextclock, mytextclock,
}, },
} }
--[[
-- Create the bottom wibox
s.mybottomwibox = awful.wibar({ position = "bottom", screen = s, border_width = 0, height = dpi(20), bg = theme.bg_normal, fg = theme.fg_normal })
-- Add widgets to the bottom wibox
s.mybottomwibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
s.mylayoutbox,
},
}
]]--
end end
return theme return theme