From ae4c7f06c5b7c0b33d847b67e4181f6870cd4428 Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Mon, 12 Jul 2021 11:44:13 +0200 Subject: [PATCH] Update various stuff --- handy | 2 +- localconf.lua.template | 26 +++++++++++++++----------- separable/mpd.lua => mpd.lua | 0 mybindings.lua | 23 +++++++++-------------- separable/binder.lua | 29 ++++++++++++++--------------- 5 files changed, 39 insertions(+), 41 deletions(-) rename separable/mpd.lua => mpd.lua (100%) diff --git a/handy b/handy index 36de22a..6f6d7bf 160000 --- a/handy +++ b/handy @@ -1 +1 @@ -Subproject commit 36de22a1f3a46b0a4f81083a056f1854ad0ab7af +Subproject commit 6f6d7bfdb37c6dbcd9f97a5c2f4347b8c3b1a65d diff --git a/localconf.lua.template b/localconf.lua.template index bbc2fab..7d7100e 100644 --- a/localconf.lua.template +++ b/localconf.lua.template @@ -23,17 +23,21 @@ conf.mpd = { } -- default programs (for keybindings) -conf.cmd = {} -conf.cmd.terminal = "terminal" -- Mod-Enter -conf.cmd.terminal_exec = "terminal -e" -- used by some mappings -conf.cmd.browser = "webbrowser" -- Mod-c f -conf.cmd.im_client = "im-client" -- Mod-c i -conf.cmd.irc_client = "irc-client" -- Mod-c I -conf.cmd.mail_client = "mail-client" -- Mod-c m -conf.cmd.mpd_client = "gmpc" -- Mod-m g -conf.cmd.editor = {} -conf.cmd.editor.terminal = conf.cmd.terminal_exec .. " vim" -conf.cmd.editor.gui = "gvim" +conf.cmd = { + terminal = "terminal" -- Mod-Enter +-- used by some mappings, parameter to terminal for executing a specific program + terminal_exec = "-e" +-- used by some mappings, parameter to terminal for setting the wm class + terminal_wmclass = "--class" + browser = "webbrowser" -- Mod-c f + irc_client = "irc-client" -- Mod-c I + mail_client = "mail-client" -- Mod-c m + mpd_client = "gmpc" -- Mod-m g + editor = { + terminal = conf.cmd.terminal_exec .. " vim" + gui = "gvim" + } +} -- Mod-r binding for running programs conf.cmd.run = function() awful.util.spawn("dmenu_run -l 10 -y 350") end diff --git a/separable/mpd.lua b/mpd.lua similarity index 100% rename from separable/mpd.lua rename to mpd.lua diff --git a/mybindings.lua b/mybindings.lua index 42ee119..4b298c5 100644 --- a/mybindings.lua +++ b/mybindings.lua @@ -8,7 +8,7 @@ local modkey = conf.modkey or "Mod4" local binder = binder or require("separable.binder") local mb = binder.modal -local mpd = require("separable.mpd") +local mpd = require("mpd") local handy = require("handy") local myglobalkeys = {} @@ -27,9 +27,11 @@ local function mpdserver(host) end end +local terminal_handy = conf.cmd.terminal .. " " .. conf.cmd.terminal_wmclass .. " handy " +local terminal_handy_exec = terminal_handy .. conf.cmd.terminal_exec .. " " + local mpdhosts = { - {"n", mpdserver("nas"), "NAS" }, - {"b", mpdserver("berryhorst"), "Berry" }, + {"n", mpdserver("nashorn"), "NAS" }, {"l", mpdserver("127.0.0.1"), "Local" } } @@ -143,15 +145,10 @@ local myglobalkeys = awful.util.table.join( --}}} -- {{{ handy console - awful.key({ }, "F12", nil, function () - handy("alacritty --class handy -e tmux", awful.placement.centered, 0.9, 0.7, nil, "handy") - end ), - awful.key({ modkey }, "x", function () - handy("alacritty --class handy -e ikhal", awful.placement.centered, 0.9, 0.7, 'single', "handy") - end ), - awful.key({ modkey }, "a", function () - handy("pavucontrol", awful.placement.centered, 0.6, 0.8, 'single') - end ), + awful.key({ }, "F12", nil, handy.fun(terminal_handy, awful.placement.centered, 0.9, 0.7, nil, "handy")), + awful.key({ modkey }, "y", handy.fun(terminal_handy_exec .. "ikhal", awful.placement.centered, 0.9, 0.7, 'single', "handy")), + awful.key({ modkey }, "a", handy.fun("pavucontrol", awful.placement.centered, 0.6, 0.8, 'single')), + awful.key({ modkey }, "/", handy.fun("qalculate-gtk", awful.placement.centered, 0.4, 0.5, 'single')), -- }}} --{{{ dmenu prompts @@ -178,8 +175,6 @@ local myglobalkeys = awful.util.table.join( awful.key({ }, "XF86AudioNext", mpd.ctrl.next), awful.key({ }, "XF86AudioPrev", mpd.ctrl.prev), - awful.key({ modkey }, "y", binder.spawn("copyq toggle")), - awful.key({ modkey }, "/", binder.spawn("rofi -show calc -modi calc -no-show-match -no-sort")), awful.key({ modkey }, "e", binder.spawn('rofi -show emoji')), awful.key( {}, "Num_Lock", lockhl("Num")), awful.key( {}, "Caps_Lock", lockhl("Caps")) diff --git a/separable/binder.lua b/separable/binder.lua index b9f4de9..490ef19 100644 --- a/separable/binder.lua +++ b/separable/binder.lua @@ -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 ()