2016-04-04 12:54:30 +00:00
|
|
|
-- key bindings
|
|
|
|
local awful = require("awful")
|
2023-10-27 09:11:35 +00:00
|
|
|
local conf = require("localconf")
|
2016-04-04 12:54:30 +00:00
|
|
|
|
2023-10-27 09:11:35 +00:00
|
|
|
local actions = require("actions")
|
2019-08-10 18:36:17 +00:00
|
|
|
|
2016-04-04 12:54:30 +00:00
|
|
|
local modkey = conf.modkey or "Mod4"
|
2023-10-27 09:11:35 +00:00
|
|
|
local hyper = {"Ctrl", "Shift", "Mod1", "Mod4"}
|
2016-04-04 12:54:30 +00:00
|
|
|
local binder = binder or require("separable.binder")
|
|
|
|
local mb = binder.modal
|
|
|
|
|
2021-07-12 09:44:13 +00:00
|
|
|
local mpd = require("mpd")
|
2017-09-14 12:43:12 +00:00
|
|
|
local handy = require("handy")
|
2016-04-04 12:54:30 +00:00
|
|
|
local myglobalkeys = {}
|
|
|
|
|
2021-03-24 12:45:06 +00:00
|
|
|
local wibars = {}
|
|
|
|
for s in screen do
|
|
|
|
table.insert(wibars, s.leftwibar)
|
|
|
|
table.insert(wibars, s.rightwibar)
|
|
|
|
end
|
|
|
|
local lockhl = require("lockhl")
|
|
|
|
lockhl:setup(wibars, '#F2C740')
|
|
|
|
|
2016-04-04 12:54:30 +00:00
|
|
|
local function mpdserver(host)
|
|
|
|
return function()
|
|
|
|
mpd.set_server(host, "6600")
|
|
|
|
awful.util.spawn("mpd-host set " .. host .. " 6600")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2023-10-27 09:11:35 +00:00
|
|
|
|
2021-07-12 09:44:13 +00:00
|
|
|
local terminal_handy = conf.cmd.terminal .. " " .. conf.cmd.terminal_wmclass .. " handy "
|
|
|
|
local terminal_handy_exec = terminal_handy .. conf.cmd.terminal_exec .. " "
|
2023-10-27 09:11:35 +00:00
|
|
|
print("terminal_handy: " .. terminal_handy)
|
|
|
|
print("terminal_handy_exec: " .. terminal_handy_exec)
|
2021-07-12 09:44:13 +00:00
|
|
|
|
2016-04-04 12:54:30 +00:00
|
|
|
local mpdhosts = {
|
2021-07-12 09:44:13 +00:00
|
|
|
{"n", mpdserver("nashorn"), "NAS" },
|
2017-09-13 13:52:49 +00:00
|
|
|
{"l", mpdserver("127.0.0.1"), "Local" }
|
2016-04-04 12:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
local mpdmap = {
|
2017-09-13 13:52:49 +00:00
|
|
|
{"m", mpd.ctrl.toggle, "Toggle" },
|
|
|
|
{"n", mpd.ctrl.next, "Next" },
|
|
|
|
{"N", mpd.ctrl.prev, "Prev" },
|
|
|
|
{"s", binder.spawn("mpd"), "start MPD" },
|
|
|
|
{"S", binder.spawn("mpd --kill"), "kill MPD" },
|
2020-07-14 12:08:33 +00:00
|
|
|
{"g", binder.spawn(conf.cmd.mpd_client), "Gmpc", stay_in_mode=false },
|
2018-05-04 13:19:55 +00:00
|
|
|
{"separator", "Search" },
|
2023-10-27 09:11:35 +00:00
|
|
|
{"a", mpd.prompt.albumartist, "albumartist" },
|
|
|
|
{"A", mpd.prompt.artist, "artist" },
|
2017-09-13 13:52:49 +00:00
|
|
|
{"b", mpd.prompt.album, "album" },
|
|
|
|
{"t", mpd.prompt.title, "title" },
|
2018-05-04 13:19:55 +00:00
|
|
|
{"j", mpd.prompt.jump, "jump" },
|
2017-09-13 13:52:49 +00:00
|
|
|
{"r", mpd.prompt.toggle_replace_on_search, "toggle replacing" },
|
2020-07-14 12:08:33 +00:00
|
|
|
{"h", mb.grabf{keymap=mpdhosts, name="Select MPD host"},
|
|
|
|
"Change host", stay_in_mode=false }
|
2016-04-04 12:54:30 +00:00
|
|
|
}
|
2020-07-22 12:32:16 +00:00
|
|
|
|
|
|
|
local playerctl = "playerctl"
|
|
|
|
if conf.mprisplayer then
|
|
|
|
playerctl = playerctl .. " -p " .. conf.mprisplayer
|
|
|
|
end
|
|
|
|
|
2021-08-19 10:35:53 +00:00
|
|
|
local displaymap = {
|
|
|
|
{"n", binder.spawn("rotate n"), "normal" },
|
|
|
|
{"i", binder.spawn("rotate i"), "invert" },
|
|
|
|
{"l", binder.spawn("rotate l"), "left" },
|
|
|
|
{"r", binder.spawn("rotate r"), "right" },
|
|
|
|
}
|
|
|
|
|
2019-08-26 14:54:51 +00:00
|
|
|
local mprismap = {
|
2020-07-22 12:32:16 +00:00
|
|
|
{"m", binder.spawn(playerctl .. " play-pause"), "Toggle" },
|
|
|
|
{"n", binder.spawn(playerctl .. " next"), "Next" },
|
|
|
|
{"N", binder.spawn(playerctl .. " previous"), "Prev" },
|
2023-10-27 09:11:35 +00:00
|
|
|
{"s", binder.spawn(playerctl .. " stop"), "Stop" },
|
2019-08-26 14:54:51 +00:00
|
|
|
}
|
2016-04-04 12:54:30 +00:00
|
|
|
|
2019-12-20 13:48:56 +00:00
|
|
|
local messengermap = {
|
2023-10-27 09:11:35 +00:00
|
|
|
{"e", binder.spawn("schildichat"), "Element" },
|
2018-01-15 14:07:17 +00:00
|
|
|
{"i", binder.spawn(conf.cmd.irc_client), "IRC" },
|
2018-11-08 19:27:02 +00:00
|
|
|
{"m", binder.spawn(conf.cmd.mail_client), "Mail" },
|
2019-12-20 13:48:56 +00:00
|
|
|
{"r", binder.spawn("rocketchat"), "RocketChat" },
|
|
|
|
{"s", binder.spawn("signal-desktop"), "Signal" },
|
2021-03-24 12:45:06 +00:00
|
|
|
{"t", binder.spawn("telegram-desktop"), "Telegram" },
|
2018-01-15 14:07:17 +00:00
|
|
|
{"w", binder.spawn("wire"), "Wire" },
|
2019-12-20 13:48:56 +00:00
|
|
|
}
|
|
|
|
|
2020-10-26 14:07:13 +00:00
|
|
|
local function brightnesskey(key)
|
|
|
|
return {key, binder.spawn("xbacklight -set " .. key .. "0"), key .. "0%" }
|
|
|
|
end
|
|
|
|
local brightnessmap = {
|
|
|
|
brightnesskey("1"),
|
|
|
|
brightnesskey("2"),
|
|
|
|
brightnesskey("3"),
|
|
|
|
brightnesskey("4"),
|
|
|
|
brightnesskey("5"),
|
|
|
|
brightnesskey("6"),
|
|
|
|
brightnesskey("7"),
|
|
|
|
brightnesskey("8"),
|
|
|
|
brightnesskey("9"),
|
|
|
|
{"0", binder.spawn("xbacklight -set 100"), "100%" },
|
|
|
|
}
|
|
|
|
|
2019-12-20 13:48:56 +00:00
|
|
|
local progmap = {
|
|
|
|
{"f", binder.spawn("firefox"), "Firefox" },
|
|
|
|
{"q", binder.spawn("qutebrowser"), "Qutebrowser" },
|
|
|
|
--{"b", binder.spawn(conf.cmd.browser), "Browser" },
|
2018-11-08 19:27:02 +00:00
|
|
|
{"s", binder.spawn("steam"), "Steam" },
|
2019-12-20 13:48:56 +00:00
|
|
|
{"n", binder.spawn("netflix"), "Netflix" },
|
|
|
|
{"m", mb.grabf{keymap=messengermap, name="⇒ Messengers"}, "Messengers" },
|
2016-04-04 12:54:30 +00:00
|
|
|
}
|
|
|
|
|
2017-11-20 09:03:14 +00:00
|
|
|
local home = os.getenv("HOME")
|
2016-04-04 12:54:30 +00:00
|
|
|
local docmap = {
|
2020-10-05 08:48:45 +00:00
|
|
|
{"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" },
|
2017-09-13 13:52:49 +00:00
|
|
|
{"t", binder.spawn("dmtexdoc"), "Texdoc" },
|
|
|
|
{"j", binder.spawn("dmjavadoc"), "Javadoc" }
|
2016-07-25 13:07:53 +00:00
|
|
|
}
|
|
|
|
|
2019-01-29 09:52:11 +00:00
|
|
|
local notifymap = {
|
|
|
|
{"m", binder.spawn("newmails -p"), "Show unread mails" },
|
|
|
|
}
|
2016-04-04 12:54:30 +00:00
|
|
|
|
|
|
|
local myglobalkeys = awful.util.table.join(
|
2018-06-15 23:06:23 +00:00
|
|
|
awful.key({ }, "Pause", binder.spawn('rofi -show window')),
|
2023-10-27 09:11:35 +00:00
|
|
|
awful.key({ modkey }, "w", binder.spawn('rofi -show window')),
|
2021-03-24 12:45:06 +00:00
|
|
|
awful.key({ }, "Print", binder.spawn('flameshot gui')),
|
2016-04-04 12:54:30 +00:00
|
|
|
|
|
|
|
--{{{ Modal mappings
|
|
|
|
|
2019-08-26 14:54:51 +00:00
|
|
|
awful.key({ modkey }, "m", function()
|
2020-07-17 12:35:44 +00:00
|
|
|
awful.spawn.easy_async_with_shell(
|
2020-07-22 12:32:16 +00:00
|
|
|
"which playerctl && " .. playerctl .. " status",
|
2020-07-17 12:35:44 +00:00
|
|
|
function(stdout, stderr, reason, exitcode)
|
2019-08-26 14:54:51 +00:00
|
|
|
if exitcode > 0 then
|
2019-08-26 15:21:09 +00:00
|
|
|
mb.grab{keymap=mpdmap, name="MPD", stay_in_mode=true}
|
2019-08-26 14:54:51 +00:00
|
|
|
else
|
2019-08-26 15:21:09 +00:00
|
|
|
mb.grab{keymap=mprismap, name="Spotify", stay_in_mode=true}
|
2019-08-26 14:54:51 +00:00
|
|
|
end
|
|
|
|
end)
|
|
|
|
end),
|
2018-05-04 13:19:55 +00:00
|
|
|
--awful.key({ modkey, "Shift" }, "m", mb.grabf(mpdpromts, "MPD - Search for")),
|
2019-08-10 18:37:10 +00:00
|
|
|
awful.key({ modkey }, "c", mb.grabf{keymap=progmap, name="Commands"}),
|
|
|
|
awful.key({ modkey }, "d", mb.grabf{keymap=docmap, name="Documents"}),
|
2020-10-26 14:07:13 +00:00
|
|
|
awful.key({ modkey }, "b", mb.grabf{keymap=brightnessmap, name="Brightness"}),
|
2023-10-27 09:11:35 +00:00
|
|
|
awful.key({ modkey }, "n", actions.toggle_naughty),
|
2016-04-04 12:54:30 +00:00
|
|
|
--}}}
|
|
|
|
|
2017-09-14 12:43:12 +00:00
|
|
|
-- {{{ handy console
|
2021-07-12 09:44:13 +00:00
|
|
|
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')),
|
2016-04-04 12:54:30 +00:00
|
|
|
-- }}}
|
|
|
|
|
|
|
|
--{{{ dmenu prompts
|
|
|
|
|
|
|
|
awful.key({ modkey }, "s", binder.spawn("dmsearch")),
|
|
|
|
awful.key({ modkey }, "x", binder.spawn("dmxrandr")),
|
2016-04-07 09:19:21 +00:00
|
|
|
awful.key({ modkey, "Shift" }, "x", binder.spawn("xd --dmenu")),
|
2017-11-20 09:03:14 +00:00
|
|
|
awful.key({ modkey }, "z", binder.spawn("dmumount")),
|
2021-03-24 12:45:06 +00:00
|
|
|
awful.key({ modkey }, "p", nil, binder.spawn("passmenu --type")),
|
2021-05-20 18:05:04 +00:00
|
|
|
awful.key({ modkey, "Shift" }, "p", binder.spawn("rofi-pass")),
|
2016-04-04 12:54:30 +00:00
|
|
|
|
|
|
|
--}}}
|
|
|
|
|
|
|
|
--{{{ misc. XF86 Keys
|
|
|
|
|
2016-11-17 13:19:31 +00:00
|
|
|
awful.key({ }, "Scroll_Lock", binder.spawn("xlock")),
|
|
|
|
awful.key({ modkey }, "BackSpace", binder.spawn("xlock")),
|
|
|
|
awful.key({ modkey, "Shift" }, "BackSpace", binder.spawn("feierabend")),
|
|
|
|
|
2016-04-04 12:54:30 +00:00
|
|
|
awful.key({ }, "XF86Explorer", binder.spawn("touchpad")),
|
|
|
|
awful.key({ "Shift" }, "XF86Explorer", binder.spawn("wacomtouch")),
|
|
|
|
|
2023-06-09 15:16:49 +00:00
|
|
|
awful.key({ }, "XF86MonBrightnessUp", binder.spawn("xbacklight -inc 5")),
|
|
|
|
awful.key({ }, "XF86MonBrightnessDown", binder.spawn("xbacklight -dec 5")),
|
|
|
|
|
2016-04-04 12:54:30 +00:00
|
|
|
awful.key({ }, "XF86AudioPlay", mpd.ctrl.toggle),
|
|
|
|
awful.key({ }, "XF86AudioNext", mpd.ctrl.next),
|
2018-02-28 09:02:38 +00:00
|
|
|
awful.key({ }, "XF86AudioPrev", mpd.ctrl.prev),
|
2016-04-04 12:54:30 +00:00
|
|
|
|
2021-08-19 10:35:53 +00:00
|
|
|
awful.key({ }, "XF86Display", mb.grabf{keymap=displaymap, name="Rotate"}),
|
|
|
|
|
2021-03-24 12:45:06 +00:00
|
|
|
awful.key({ modkey }, "e", binder.spawn('rofi -show emoji')),
|
|
|
|
awful.key( {}, "Num_Lock", lockhl("Num")),
|
|
|
|
awful.key( {}, "Caps_Lock", lockhl("Caps"))
|
2016-04-04 12:54:30 +00:00
|
|
|
|
|
|
|
--}}}
|
|
|
|
)
|
|
|
|
|
|
|
|
return myglobalkeys
|
|
|
|
|
|
|
|
-- vim: set fenc=utf-8 tw=80 foldmethod=marker :
|