This commit is contained in:
Alexander Gehrke 2024-06-27 15:03:01 +02:00
parent 60677a2615
commit f21a6535ec
2 changed files with 88 additions and 79 deletions

View file

@ -5,7 +5,7 @@ local conf = require("localconf")
local actions = require("actions") local actions = require("actions")
local modkey = conf.modkey or "Mod4" local modkey = conf.modkey or "Mod4"
local hyper = {"Ctrl", "Shift", "Mod1", "Mod4"} local hyper = { "Ctrl", "Shift", "Mod1", "Mod4" }
local binder = require("separable.binder") local binder = require("separable.binder")
local mb = binder.modal local mb = binder.modal
@ -18,7 +18,7 @@ for s in screen do
table.insert(wibars, s.rightwibar) table.insert(wibars, s.rightwibar)
end end
local lockhl = require("lockhl") local lockhl = require("lockhl")
lockhl:setup(wibars, '#F2C740') lockhl:setup(wibars, "#F2C740")
local function mpdserver(host) local function mpdserver(host)
return function() return function()
@ -27,33 +27,31 @@ local function mpdserver(host)
end end
end end
local terminal_handy = conf.cmd.terminal .. " " .. conf.cmd.terminal_wmclass .. " handy " local terminal_handy = conf.cmd.terminal .. " " .. conf.cmd.terminal_wmclass .. " handy "
local terminal_handy_exec = terminal_handy .. conf.cmd.terminal_exec .. " " local terminal_handy_exec = terminal_handy .. conf.cmd.terminal_exec .. " "
print("terminal_handy: " .. terminal_handy) print("terminal_handy: " .. terminal_handy)
print("terminal_handy_exec: " .. terminal_handy_exec) print("terminal_handy_exec: " .. terminal_handy_exec)
local mpdhosts = { local mpdhosts = {
{"n", mpdserver("nashorn"), "NAS" }, { "n", mpdserver("nashorn"), "NAS" },
{"l", mpdserver("127.0.0.1"), "Local" } { "l", mpdserver("127.0.0.1"), "Local" },
} }
local mpdmap = { local mpdmap = {
{"m", mpd.ctrl.toggle, "Toggle" }, { "m", mpd.ctrl.toggle, "Toggle" },
{"n", mpd.ctrl.next, "Next" }, { "n", mpd.ctrl.next, "Next" },
{"N", mpd.ctrl.prev, "Prev" }, { "N", mpd.ctrl.prev, "Prev" },
{"s", binder.spawn("mpd"), "start MPD" }, { "s", binder.spawn("mpd"), "start MPD" },
{"S", binder.spawn("mpd --kill"), "kill MPD" }, { "S", binder.spawn("mpd --kill"), "kill MPD" },
{"g", binder.spawn(conf.cmd.mpd_client), "Gmpc", stay_in_mode=false }, { "g", binder.spawn(conf.cmd.mpd_client), "Gmpc", stay_in_mode = false },
{"separator", "Search" }, { "separator", "Search" },
{"a", mpd.prompt.albumartist, "albumartist" }, { "a", mpd.prompt.albumartist, "albumartist" },
{"A", mpd.prompt.artist, "artist" }, { "A", mpd.prompt.artist, "artist" },
{"b", mpd.prompt.album, "album" }, { "b", mpd.prompt.album, "album" },
{"t", mpd.prompt.title, "title" }, { "t", mpd.prompt.title, "title" },
{"j", mpd.prompt.jump, "jump" }, { "j", mpd.prompt.jump, "jump" },
{"r", mpd.prompt.toggle_replace_on_search, "toggle replacing" }, { "r", mpd.prompt.toggle_replace_on_search, "toggle replacing" },
{"h", mb.grabf{keymap=mpdhosts, name="Select MPD host"}, { "h", mb.grabf({ keymap = mpdhosts, name = "Select MPD host" }), "Change host", stay_in_mode = false },
"Change host", stay_in_mode=false }
} }
local playerctl = "playerctl" local playerctl = "playerctl"
@ -62,31 +60,31 @@ if conf.mprisplayer then
end end
local displaymap = { local displaymap = {
{"n", binder.spawn("rotate n"), "normal" }, { "n", binder.spawn("rotate n"), "normal" },
{"i", binder.spawn("rotate i"), "invert" }, { "i", binder.spawn("rotate i"), "invert" },
{"l", binder.spawn("rotate l"), "left" }, { "l", binder.spawn("rotate l"), "left" },
{"r", binder.spawn("rotate r"), "right" }, { "r", binder.spawn("rotate r"), "right" },
} }
local mprismap = { local mprismap = {
{"m", binder.spawn(playerctl .. " play-pause"), "Toggle" }, { "m", binder.spawn(playerctl .. " play-pause"), "Toggle" },
{"n", binder.spawn(playerctl .. " next"), "Next" }, { "n", binder.spawn(playerctl .. " next"), "Next" },
{"N", binder.spawn(playerctl .. " previous"), "Prev" }, { "N", binder.spawn(playerctl .. " previous"), "Prev" },
{"s", binder.spawn(playerctl .. " stop"), "Stop" }, { "s", binder.spawn(playerctl .. " stop"), "Stop" },
} }
local messengermap = { local messengermap = {
{"e", binder.spawn("schildichat"), "Element" }, { "e", binder.spawn("schildichat"), "Element" },
{"i", binder.spawn(conf.cmd.irc_client), "IRC" }, { "i", binder.spawn(conf.cmd.irc_client), "IRC" },
{"m", binder.spawn(conf.cmd.mail_client), "Mail" }, { "m", binder.spawn(conf.cmd.mail_client), "Mail" },
{"r", binder.spawn("rocketchat"), "RocketChat" }, { "r", binder.spawn("rocketchat"), "RocketChat" },
{"s", binder.spawn("signal-desktop"), "Signal" }, { "s", binder.spawn("signal-desktop"), "Signal" },
{"t", binder.spawn("telegram-desktop"), "Telegram" }, { "t", binder.spawn("telegram-desktop"), "Telegram" },
{"w", binder.spawn("wire"), "Wire" }, { "w", binder.spawn("wire"), "Wire" },
} }
local function brightnesskey(key) local function brightnesskey(key)
return {key, binder.spawn("xbacklight -set " .. key .. "0"), key .. "0%" } return { key, binder.spawn("xbacklight -set " .. key .. "0"), key .. "0%" }
end end
local brightnessmap = { local brightnessmap = {
brightnesskey("1"), brightnesskey("1"),
@ -98,65 +96,72 @@ local brightnessmap = {
brightnesskey("7"), brightnesskey("7"),
brightnesskey("8"), brightnesskey("8"),
brightnesskey("9"), brightnesskey("9"),
{"0", binder.spawn("xbacklight -set 100"), "100%" }, { "0", binder.spawn("xbacklight -set 100"), "100%" },
} }
local progmap = { local progmap = {
{"f", binder.spawn("firefox"), "Firefox" }, { "f", binder.spawn("firefox"), "Firefox" },
{"q", binder.spawn("qutebrowser"), "Qutebrowser" }, { "q", binder.spawn("qutebrowser"), "Qutebrowser" },
--{"b", binder.spawn(conf.cmd.browser), "Browser" }, --{"b", binder.spawn(conf.cmd.browser), "Browser" },
{"s", binder.spawn("steam"), "Steam" }, { "s", binder.spawn("steam"), "Steam" },
{"n", binder.spawn("netflix"), "Netflix" }, { "n", binder.spawn("netflix"), "Netflix" },
{"m", mb.grabf{keymap=messengermap, name="⇒ Messengers"}, "Messengers" }, { "m", mb.grabf({ keymap = messengermap, name = "⇒ Messengers" }), "Messengers" },
} }
local home = os.getenv("HOME") local home = os.getenv("HOME")
local docmap = { local docmap = {
{"p", binder.spawn("docopen -e pdf " .. home), "Alle PDF-Dokumente" }, { "p", binder.spawn("docopen -e pdf " .. home), "Alle PDF-Dokumente" },
{"b", binder.spawn("docopen -e pdf -e epub -e mobi -e txt -e lit -e html -e htm " .. home .. "/doc/books "), "Bücher" }, {
{"t", binder.spawn("dmtexdoc"), "Texdoc" }, "b",
{"j", binder.spawn("dmjavadoc"), "Javadoc" } binder.spawn("docopen -e pdf -e epub -e mobi -e txt -e lit -e html -e htm " .. home .. "/doc/books "),
"Bücher",
},
{ "t", binder.spawn("dmtexdoc"), "Texdoc" },
{ "j", binder.spawn("dmjavadoc"), "Javadoc" },
} }
local notifymap = { local notifymap = {
{"m", binder.spawn("newmails -p"), "Show unread mails" }, { "m", binder.spawn("newmails -p"), "Show unread mails" },
} }
local myglobalkeys = awful.util.table.join( local myglobalkeys = awful.util.table.join(
awful.key({ }, "Pause", binder.spawn('rofi -show window')), awful.key({}, "Pause", binder.spawn("rofi -show window")),
awful.key({ modkey }, "w", binder.spawn('rofi -show window')), awful.key({ modkey }, "w", binder.spawn("rofi -show window")),
awful.key({ }, "Print", binder.spawn('flameshot gui')), awful.key({}, "Print", binder.spawn("flameshot gui")),
--{{{ Modal mappings --{{{ Modal mappings
awful.key({ modkey }, "m", function() awful.key({ modkey }, "m", function()
awful.spawn.easy_async_with_shell( awful.spawn.easy_async_with_shell("which playerctl && " .. playerctl .. " status", function(_, _, _, exitcode)
"which playerctl && " .. playerctl .. " status",
function(_, _, _, exitcode)
if exitcode > 0 then if exitcode > 0 then
mb.grab{keymap=mpdmap, name="MPD", stay_in_mode=true} mb.grab({ keymap = mpdmap, name = "MPD", stay_in_mode = true })
else else
mb.grab{keymap=mprismap, name="MPRIS", stay_in_mode=true} mb.grab({ keymap = mprismap, name = "MPRIS", stay_in_mode = true })
end end
end) end)
end), end),
--awful.key({ modkey, "Shift" }, "m", mb.grabf(mpdpromts, "MPD - Search for")), --awful.key({ modkey, "Shift" }, "m", mb.grabf(mpdpromts, "MPD - Search for")),
awful.key({ modkey }, "c", mb.grabf{keymap=progmap, name="Commands"}), awful.key({ modkey }, "c", mb.grabf({ keymap = progmap, name = "Commands" })),
awful.key({ modkey }, "d", mb.grabf{keymap=docmap, name="Documents"}), awful.key({ modkey }, "d", mb.grabf({ keymap = docmap, name = "Documents" })),
awful.key({ modkey }, "b", mb.grabf{keymap=brightnessmap, name="Brightness"}), awful.key({ modkey }, "b", mb.grabf({ keymap = brightnessmap, name = "Brightness" })),
awful.key({ modkey }, "n", actions.toggle_naughty), awful.key({ modkey }, "n", actions.toggle_naughty),
--}}} --}}}
-- {{{ handy console -- {{{ handy console
awful.key({ }, "F12", nil, handy.fun(terminal_handy, awful.placement.centered, 0.9, 0.7, nil, "handy")), 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(
awful.key({ modkey }, "a", handy.fun("pavucontrol", awful.placement.centered, 0.6, 0.8, 'single')), { modkey },
awful.key({ modkey }, "/", handy.fun("qalculate-gtk", awful.placement.centered, 0.4, 0.5, 'single')), "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 --{{{ dmenu prompts
awful.key({ modkey }, "s", binder.spawn("dmsearch")), awful.key({ modkey }, "s", binder.spawn("dmsearch")),
awful.key({ modkey }, "q", binder.spawn("qrread")),
awful.key({ modkey }, "x", binder.spawn("dmxrandr")), awful.key({ modkey }, "x", binder.spawn("dmxrandr")),
awful.key({ modkey, "Shift" }, "x", binder.spawn("xd --dmenu")), awful.key({ modkey, "Shift" }, "x", binder.spawn("xd --dmenu")),
awful.key({ modkey }, "z", binder.spawn("dmumount")), awful.key({ modkey }, "z", binder.spawn("dmumount")),
@ -167,25 +172,25 @@ local myglobalkeys = awful.util.table.join(
--{{{ misc. XF86 Keys --{{{ misc. XF86 Keys
awful.key({ }, "Scroll_Lock", binder.spawn("xlock")), awful.key({}, "Scroll_Lock", binder.spawn("xlock")),
awful.key({ modkey }, "BackSpace", binder.spawn("xlock")), awful.key({ modkey }, "BackSpace", binder.spawn("xlock")),
awful.key({ modkey, "Shift" }, "BackSpace", binder.spawn("feierabend")), awful.key({ modkey, "Shift" }, "BackSpace", binder.spawn("feierabend")),
awful.key({ }, "XF86Explorer", binder.spawn("touchpad")), awful.key({}, "XF86Explorer", binder.spawn("touchpad")),
awful.key({ "Shift" }, "XF86Explorer", binder.spawn("wacomtouch")), awful.key({ "Shift" }, "XF86Explorer", binder.spawn("wacomtouch")),
awful.key({ }, "XF86MonBrightnessUp", binder.spawn("xbacklight -inc 5")), awful.key({}, "XF86MonBrightnessUp", binder.spawn("xbacklight -inc 5")),
awful.key({ }, "XF86MonBrightnessDown", binder.spawn("xbacklight -dec 5")), awful.key({}, "XF86MonBrightnessDown", binder.spawn("xbacklight -dec 5")),
awful.key({ }, "XF86AudioPlay", mpd.ctrl.toggle), awful.key({}, "XF86AudioPlay", mpd.ctrl.toggle),
awful.key({ }, "XF86AudioNext", mpd.ctrl.next), awful.key({}, "XF86AudioNext", mpd.ctrl.next),
awful.key({ }, "XF86AudioPrev", mpd.ctrl.prev), awful.key({}, "XF86AudioPrev", mpd.ctrl.prev),
awful.key({ }, "XF86Display", mb.grabf{keymap=displaymap, name="Rotate"}), awful.key({}, "XF86Display", mb.grabf({ keymap = displaymap, name = "Rotate" })),
awful.key({ modkey }, "e", binder.spawn('rofi -show emoji')), awful.key({ modkey }, "e", binder.spawn("rofi -show emoji")),
awful.key( {}, "Num_Lock", lockhl("Num")), awful.key({}, "Num_Lock", lockhl("Num")),
awful.key( {}, "Caps_Lock", lockhl("Caps")) awful.key({}, "Caps_Lock", lockhl("Caps"))
--}}} --}}}
) )

View file

@ -88,7 +88,7 @@ awful.rules.rules = {
properties = { screen = screen_chat, tag = "5" }, properties = { screen = screen_chat, tag = "5" },
}, },
{ {
rule_any = { class = { "Element" }, instance = { "element" } }, rule_any = { class = { "Element", "SchildiChat" }, instance = { "element", "schildichat" } },
properties = { screen = screen_chat, tag = "1" }, properties = { screen = screen_chat, tag = "1" },
}, },
{ {
@ -123,4 +123,8 @@ awful.rules.rules = {
properties = { floating = true, size_hints_honor = true, focusable = false }, properties = { floating = true, size_hints_honor = true, focusable = false },
}, },
{ rule = { class = "Onboard" }, properties = { sticky = true, ontop = true, focusable = false } }, { rule = { class = "Onboard" }, properties = { sticky = true, ontop = true, focusable = false } },
{
rule = { class = "zenity" },
properties = { ontop = true, floating = true, placement = awful.placement.centered },
},
} }