Update various stuff

This commit is contained in:
Alexander Gehrke 2021-07-12 11:44:13 +02:00
parent 8d61745f9c
commit ae4c7f06c5
5 changed files with 39 additions and 41 deletions

View file

@ -1,6 +1,6 @@
-- key bindings
local awful = require("awful")
local beautiful = beautiful
local beautiful = require("beautiful")
local modkey = conf.modkey or "Mod4"
local mb = require("modalbind")
@ -102,19 +102,17 @@ function binder.clear()
globalkeyfuncs = {}
end
function binder.apply()
local allkeys = awful.util.table.clone(globalkeys)
inspect=require("lib/inspect")
print(inspect(globalkeyfuncs))
for k,v in pairs(globalkeyfuncs) do
print("k:" .. k)
local loadedkeys = v()
print(inspect(loadedkeys))
allkeys = awful.util.table.join(allkeys, loadedkeys)
end
print(inspect(allkeys))
root.keys(allkeys)
naughty.notify { text="Reloading key bindings" }
local allkeys = awful.util.table.clone(globalkeys)
for k,v in pairs(globalkeyfuncs) do
print("k:" .. k)
local loadedkeys = v()
print(inspect(loadedkeys))
allkeys = awful.util.table.join(allkeys, loadedkeys)
end
print(inspect(allkeys))
root.keys(allkeys)
end
local function client_opacity_set(c, default, max, step)
@ -147,8 +145,8 @@ awful.key({ }, "XF86Calculater", awful.client.movetoscreen
awful.key({ modkey }, "i", function(c)
require("naughty").notify({ text =
string.format(
"name: %s\nclass: %s\ninstance: %s\ntype: %s",
c["name"], c["class"], c["instance"], c["type"])
"name: %s\nclass: %s\ninstance: %s\ntype: %s\npid: %d",
c["name"], c["class"], c["instance"], c["type"], c["pid"])
})
end)
)
@ -190,6 +188,7 @@ local default_bindings = awful.util.table.join(
awful.key({ modkey, "Control" }, "r", awesome.restart),
awful.key({ modkey, "Shift" }, "q", awesome.quit),
awful.key({ modkey, }, "Return", spawnf(conf.cmd.terminal)),
awful.key({ modkey, "Shift" }, "Return", spawnf("kitty-session")),
--{{{ Layout manipulation and client position
awful.key({ modkey }, "j", function ()

View file

@ -1,117 +0,0 @@
-- MPD control and playlist editing
-- prompts require dmpc script
local M = {}
local conf = conf
local awful = awful
local log = log
-- local functions
local dmenu, notify, mpc
local defaults = {}
local settings = {}
defaults.replace_on_search = true
defaults.host = "127.0.0.1"
defaults.port = "6600"
for key, value in pairs(defaults) do
settings[key] = value
end
for key, value in pairs(conf.mpd) do
settings[key] = value
end
-- {{{ local helpers
local function mpc(command)
log.spawn("mpc -h " .. settings.host .. " -p " .. settings.port .. " " .. command)
end
local function dmenu(opts)
log.spawn("dmpc -h " .. settings.host .. " -p " .. settings.port .. " " ..
(settings.replace_on_search and "-r" or "-R") .. " " .. opts)
end
local function notify(stext)
if not (naughty == nil) then
naughty.notify({
text= stext
})
end
end
--}}}
M.set_server = function(host, port)
settings.host = host
settings.port = port
notify("Using mpd server " .. settings.host .. ":" .. settings.port)
end
-- {{{ mpd.ctrl submodule
M.ctrl = {}
M.ctrl.toggle = function ()
mpc("toggle")
end
M.ctrl.play = function ()
mpc("play")
end
M.ctrl.pause = function ()
mpc("pause")
end
M.ctrl.next = function ()
mpc("next")
end
M.ctrl.prev = function ()
mpc("prev")
end
-- }}}
-- {{{ mpd.prompt submodule
M.prompt = {}
M.prompt.artist = function()
dmenu("-a")
end
M.prompt.album = function()
dmenu("-a -b")
end
M.prompt.title = function()
dmenu("-a -b -t")
end
M.prompt.jump = function()
dmenu("-j")
end
M.prompt.title = title
M.prompt.replace_on_search = function(bool)
settings.replace_on_search = bool
end
M.prompt.toggle_replace_on_search = function()
settings.replace_on_search = not settings.replace_on_search
notify("MPD prompts now " ..(
settings.replace_on_search and "replace" or "add to"
).. " the playlist")
end
-- }}}
return M
-- vim: set fenc=utf-8 tw=80 foldmethod=marker :