awesomewm/bin/init.lua

87 lines
2.1 KiB
Lua
Executable File

dir = configuration_dir .. "bin/"
local script_dir = dir .. "scripts/"
return {
system = {
shutdown = function(confirm_prompt)
if (string.lower(confirm_prompt) == "y") or (string.lower(confirm_prompt) == "yes") then
awful.spawn("shutdown now", false)
elseif (string.lower(confirm_prompt) == "r") or (string.lower(confirm_prompt) == "reset") then
awful.spawn("shutdown -r now", false)
end
end,
lock = function()
awful.spawn(script_dir .. "lock " .. beautiful.icons.lockicon, false)
end
},
backlight = {
watch = function(timeout, callback, widget)
awful.widget.watch(script_dir .. "backlight get", timeout, callback, widget)
end,
get = function(callback)
awful.spawn.easy_async(script_dir .. "backlight get", callback)
end,
set = function(value)
awful.spawn(script_dir .. "backlight set " .. value, false)
end,
up = function()
awful.spawn(script_dir .. "backlight up", false)
end,
down = function()
awful.spawn(script_dir .. "backlight down", false)
end,
redshift = function(temp)
awful.spawn("redshift -O " .. tostring(temp), false)
end,
redshift_reset = function()
awful.spawn("redshift -x", false)
end,
},
battery = {
watch = function(timeout, callback, widget)
awful.widget.watch(script_dir .. "battery", timeout, callback, widget)
end,
status = function(callback)
awful.spawn.easy_async(script_dir .. "battery", callback)
end,
},
rofi = {
launcher = function()
awful.spawn("rofi -show drun -theme \"" .. dir .. "/rofi/launcher.rasi\"")
end
},
capture = function(source, target)
awful.spawn(script_dir .. "capture " .. source .. " " .. target, false)
end,
flameshot = {
gui = function()
--awful.spawn("flameshot gui -p \"" .. conf.screenshot_dir .. "\"", false)
awful.spawn("flameshot gui", false)
end
},
mpc = {
watch = function(command, timeout, callback, widget)
awful.widget.watch("mpc --host " .. conf.mpd_host .. " " .. command, timeout, callback, widget)
end,
command = function(command, callback)
awful.spawn.easy_async("mpc --host " .. conf.mpd_host .. " " .. command, callback)
end
}
}