add base setup with dotter

This commit is contained in:
Alexander Navarro 2024-11-08 22:53:56 +00:00 committed by aleidk
parent 6b0da868bb
commit 42e6595b60
177 changed files with 1062 additions and 70 deletions

View file

@ -1,80 +0,0 @@
---@enum Modifiers
local modifiers = {
super = "Super ",
ctrl = "Control ",
shift = "Shift ",
alt = "Alt ",
super_shift = "Super+Shift ",
super_ctrl = "Super+Control ",
super_ctrl_shift = "Super+Control+Shift ",
ctrl_shift = "Control+Shift ",
none = "None ",
}
--- Wrapper around the riverctl cmd
---@class River
local River = {
cmds = {
background = "swaybg -i %s"
},
keys = {
modifiers = modifiers
}
}
River.__index = River
--- River class constructor
---@param new? River to override properties
---@return River
function River:new(new)
local obj = new or {}
setmetatable(obj, self)
self.__index = self
return obj
end
--- Exec an arbitrary system command
---@param cmd string the command to execute
---@private
---@return string?
function River:exec(cmd)
os.execute(cmd)
end
--- Execute the given command with riverctl spawn
---@param cmd string the command to execute
function River:spawn(cmd)
self:exec(string.format([[riverctl spawn "%s"]], cmd))
end
--- Set a new wallpaper with the default cmds.background
---@param path string The path to the image
function River:set_bg(path)
self:spawn(string.format(self.cmds.background, path))
end
---@class MapArgs
---@field [1] Modifiers The modifier to use
---@field [2] string
---@field [3] string
---@field mode? ("normal"|"locked")[], }
--- Create a new mapping
--- @param args MapArgs
function River:map(args)
local modes = args.mode or { "normal" }
for _, mode in ipairs(modes) do
local map = string.format([[riverctl map %s %s %s %s]], mode, args[1], args[2], args[3])
self:exec(map)
end
end
return River