From dcf3a84ba890d22eec8ce4cb88ae6be808ce9633 Mon Sep 17 00:00:00 2001 From: Alexander Gehrke Date: Fri, 27 Oct 2023 11:11:35 +0200 Subject: [PATCH] Bindings and rules --- actions.lua | 15 +++++++++++++++ errors.lua | 27 --------------------------- mpd.lua | 8 ++++++-- mybindings.lua | 27 ++++++++++++--------------- rules.lua | 4 ++++ separable/binder.lua | 11 ----------- signals.lua | 3 +++ 7 files changed, 40 insertions(+), 55 deletions(-) create mode 100644 actions.lua delete mode 100644 errors.lua diff --git a/actions.lua b/actions.lua new file mode 100644 index 0000000..f8954a7 --- /dev/null +++ b/actions.lua @@ -0,0 +1,15 @@ +local naughty = require("naughty") + +actions = {} + +function actions.toggle_naughty() + if naughty.is_suspended() then + naughty.resume() + naughty.notify({ text = "Notifications enabled", timeout = 2 }) + else + naughty.notify({ text = "Notifications disabled", timeout = 2 }) + naughty.suspend() + end +end + +return actions diff --git a/errors.lua b/errors.lua deleted file mode 100644 index 2fc8a1d..0000000 --- a/errors.lua +++ /dev/null @@ -1,27 +0,0 @@ --- Notification library -local naughty = require("naughty") - --- {{{ Error handling --- Check if awesome encountered an error during startup and fell back to --- another config (This code will only ever execute for the fallback config) -if awesome.startup_errors then - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, there were errors during startup!", - text = awesome.startup_errors }) -end - --- Handle runtime errors after startup -do - local in_error = false - awesome.connect_signal("debug::error", function (err) - -- Make sure we don't go into an endless error loop - if in_error then return end - in_error = true - - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, an error happened!", - text = err }) - in_error = false - end) -end --- }}} diff --git a/mpd.lua b/mpd.lua index b4d1f81..5573458 100644 --- a/mpd.lua +++ b/mpd.lua @@ -83,13 +83,17 @@ M.prompt.artist = function() dmenu("-a") end +M.prompt.albumartist = function() + dmenu("-A") +end + M.prompt.album = function() - dmenu("-a -b") + dmenu("-A -b") end M.prompt.title = function() - dmenu("-a -b -t") + dmenu("-A -b -t") end M.prompt.jump = function() diff --git a/mybindings.lua b/mybindings.lua index d8272c4..4fbf924 100644 --- a/mybindings.lua +++ b/mybindings.lua @@ -1,10 +1,11 @@ -- key bindings local awful = require("awful") -local conf = conf +local conf = require("localconf") -local naughty = require("naughty") +local actions = require("actions") local modkey = conf.modkey or "Mod4" +local hyper = {"Ctrl", "Shift", "Mod1", "Mod4"} local binder = binder or require("separable.binder") local mb = binder.modal @@ -27,8 +28,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 .. " " +print("terminal_handy: " .. terminal_handy) +print("terminal_handy_exec: " .. terminal_handy_exec) local mpdhosts = { {"n", mpdserver("nashorn"), "NAS" }, @@ -43,7 +47,8 @@ local mpdmap = { {"S", binder.spawn("mpd --kill"), "kill MPD" }, {"g", binder.spawn(conf.cmd.mpd_client), "Gmpc", stay_in_mode=false }, {"separator", "Search" }, - {"a", mpd.prompt.artist, "artist" }, + {"a", mpd.prompt.albumartist, "albumartist" }, + {"A", mpd.prompt.artist, "artist" }, {"b", mpd.prompt.album, "album" }, {"t", mpd.prompt.title, "title" }, {"j", mpd.prompt.jump, "jump" }, @@ -68,11 +73,11 @@ local mprismap = { {"m", binder.spawn(playerctl .. " play-pause"), "Toggle" }, {"n", binder.spawn(playerctl .. " next"), "Next" }, {"N", binder.spawn(playerctl .. " previous"), "Prev" }, - {"s", binder.spawn(playerctl .. " stop"), "Prev" }, + {"s", binder.spawn(playerctl .. " stop"), "Stop" }, } local messengermap = { - {"e", binder.spawn("launch-elements"), "Element" }, + {"e", binder.spawn("schildichat"), "Element" }, {"i", binder.spawn(conf.cmd.irc_client), "IRC" }, {"m", binder.spawn(conf.cmd.mail_client), "Mail" }, {"r", binder.spawn("rocketchat"), "RocketChat" }, @@ -120,7 +125,7 @@ local notifymap = { local myglobalkeys = awful.util.table.join( awful.key({ }, "Pause", binder.spawn('rofi -show window')), - --awful.key({ }, "Print", binder.spawn('dmscrot')), + awful.key({ modkey }, "w", binder.spawn('rofi -show window')), awful.key({ }, "Print", binder.spawn('flameshot gui')), --{{{ Modal mappings @@ -140,15 +145,7 @@ local myglobalkeys = awful.util.table.join( awful.key({ modkey }, "c", mb.grabf{keymap=progmap, name="Commands"}), awful.key({ modkey }, "d", mb.grabf{keymap=docmap, name="Documents"}), awful.key({ modkey }, "b", mb.grabf{keymap=brightnessmap, name="Brightness"}), - awful.key({ modkey }, "n", function() - if naughty.is_suspended() then - naughty.resume() - naughty.notify({ text = "Notifications enabled", timeout = 2 }) - else - naughty.notify({ text = "Notifications disabled", timeout = 2 }) - naughty.suspend() - end - end), + awful.key({ modkey }, "n", actions.toggle_naughty), --}}} -- {{{ handy console diff --git a/rules.lua b/rules.lua index e50a135..244bfdd 100644 --- a/rules.lua +++ b/rules.lua @@ -101,6 +101,10 @@ awful.rules.rules = { properties = { sticky = true, ontop = true }}, { rule = { class = "adobe dng converter.exe" }, properties = { floating = true, size_hints_honor = true }}, + { rule = { class = "pentablet", type = "normal"}, + properties = { floating = true, size_hints_honor = true}}, + { rule = { class = "pentablet", type = "utility"}, + properties = { floating = true, size_hints_honor = true, focusable = false}}, { rule = { class = "Onboard" }, properties = { sticky = true, ontop = true, focusable = false}}, } diff --git a/separable/binder.lua b/separable/binder.lua index 01d5fdc..2d3cd25 100644 --- a/separable/binder.lua +++ b/separable/binder.lua @@ -135,7 +135,6 @@ awful.key({ modkey, "Shift" }, "l", screen_move_client_wrapdir("right")), awful.key({ modkey, "Control" }, "o", function (c) c.ontop = not c.ontop end), awful.key({ modkey, "Shift" }, "a", function (c) c.sticky = not c.sticky end), awful.key({ modkey, "Shift" }, "r", function (c) c:redraw() end), ---awful.key({ modkey, }, "b", function (c) c.border_width = c.border_width > 0 and 0 or beautiful.border_width end), awful.key({ modkey, }, "Up", function(c) client_opacity_set(c, 1, 1, 0.1) end), awful.key({ modkey, }, "Down", function(c) client_opacity_set(c, 1, 0, -0.1) end), awful.key({ }, "XF86Calculater", awful.client.movetoscreen ), @@ -216,8 +215,6 @@ local default_bindings = awful.util.table.join( awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end), - --awful.key({ modkey, }, "h", screen_focus_wrapdir("left")), - --awful.key({ modkey, }, "l", screen_focus_wrapdir("right")), awful.key({ modkey, }, "h", function() awful.screen.focus_relative(1) end), awful.key({ modkey, }, "l", function() awful.screen.focus_relative(-1) end), --}}} @@ -228,14 +225,6 @@ local default_bindings = awful.util.table.join( awful.key({ modkey, "Control" }, "space", mb.grabf{keymap=layoutsettings, name="Layout settings", stay_in_mode=true}), --}}} - --{{{ Audio control - - --awful.key({ }, "XF86AudioLowerVolume", spawnf("amixer set Master 2%-")), - --awful.key({ }, "XF86AudioRaiseVolume", spawnf("amixer set Master 2%+")), - --awful.key({ }, "XF86AudioMute", spawnf("amixer set Master toggle")), - - --}}} - --{{{ Prompt awful.key({ modkey }, "r", conf.cmd.run), diff --git a/signals.lua b/signals.lua index 04ac055..ddf0f01 100644 --- a/signals.lua +++ b/signals.lua @@ -20,6 +20,9 @@ local fixed_clients = { { rule = { name = "", class = "jetbrains-idea", type = "dialog" } }, -- password inputs { rule = { class = "Pinentry-gtk-2" } }, + { rule = { class = "pinentry-qt" } }, + -- nextcloud closes on focus loss + { rule = { class = "Nextcloud" } }, } local function may_lose_focus(c)