awesomewm/rc.lua
2024-07-30 01:10:54 +02:00

120 lines
2.9 KiB
Lua

-- If LuaRocks is installed, make sure that packages installed through it are
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, "luarocks.loader")
-- libraries {{{
local awful = require("awful")
local beautiful = require("beautiful")
local gears = require("gears")
---@diagnostic disable-next-line: unused-local
--- for debugging
local inspect = require("inspect")
local wibox = require("wibox")
require("awful.autofocus")
require("util.errors")
-- }}}
beautiful.init(awful.util.getdir("config") .. "/theme.lua")
require("tapestry")
-- {{{ Logging
local log = require("talkative")
log.add_logger(log.loggers.stdio, log.level.DEBUG)
log.add_logger(log.loggers.naughty, log.level.WARNING)
-- }}}
-- {{{ Tags
local tags = require("tags")
tags.setup()
-- }}}
-- {{{ widgets
local widgets = require("widgets")
awful.screen.connect_for_each_screen(function(s)
widgets.dynamic_taskbar(s)
widgets(s).left({
widgets.screennum(s),
widgets.spacer,
widgets.layout(s),
widgets.taglist(s),
layout = wibox.layout.fixed.horizontal,
}, wibox.widget.textclock())
widgets(s).right({
widgets.cpu(),
widgets.ram(),
widgets.battery(s),
widgets.systray(s),
layout = wibox.layout.fixed.horizontal,
}, widgets.mail({ os.getenv("HOME") .. "/.maildir/uber" }, "bottom_right", "uber"))
end)
-- }}}
local audiowheel = require("audiowheel")
local speakerwheel = audiowheel({
volume_control = { cardid = 0 },
})
local micwheel = audiowheel({
image_muted = "notification-microphone-sensitivity-muted.svg",
image_low = "notification-microphone-sensitivity-low.svg",
image_medium = "notification-microphone-sensitivity-medium.svg",
image_high = "notification-microphone-sensitivity-high.svg",
--volume_control = { cardid = 0, tooltip = false, channel = "Dmic0" }
volume_control = { tooltip = false, type = "source" },
})
-- {{{ Key bindings
local binder = require("separable.binder")
binder.modal.set_location("bottom_left")
binder.modal.hide_default_options()
binder.modal.set_opacity(0.8)
--binder.modal.set_x_offset(18)
binder.add_default_bindings()
binder.add_reloadable(tags.create_bindings)
local mybindings = awful.util.getdir("config") .. "/mybindings.lua"
binder.add_reloadable(function()
return dofile(mybindings)
end)
binder.add_bindings(awful.util.table.join(
awful.key({}, "XF86AudioRaiseVolume", function()
speakerwheel:up()
end),
awful.key({}, "XF86AudioLowerVolume", function()
speakerwheel:down()
end),
awful.key({}, "XF86AudioMute", function()
speakerwheel:toggle()
end),
awful.key({ "Shift" }, "XF86AudioRaiseVolume", function()
micwheel:up()
end),
awful.key({ "Shift" }, "XF86AudioLowerVolume", function()
micwheel:down()
end),
awful.key({}, "XF86AudioMicMute", function()
micwheel:toggle()
end)
))
binder.apply()
-- }}}
require("rules")
require("signals")
local autorun_file = awful.util.getdir("config") .. "/autorun"
if gears.filesystem.file_readable(autorun_file) then
awful.spawn(autorun_file)
end
--
-- vim: fdm=marker
--