aboutsummaryrefslogtreecommitdiff
path: root/.config/awesome/misc/keys.lua
diff options
context:
space:
mode:
Diffstat (limited to '.config/awesome/misc/keys.lua')
-rw-r--r--.config/awesome/misc/keys.lua209
1 files changed, 96 insertions, 113 deletions
diff --git a/.config/awesome/misc/keys.lua b/.config/awesome/misc/keys.lua
index 6d83ec4..94091af 100644
--- a/.config/awesome/misc/keys.lua
+++ b/.config/awesome/misc/keys.lua
@@ -1,20 +1,20 @@
local awful = require "awful"
-local gears = require "gears"
+local gtimer = require "gears.timer"
local naughty = require "naughty"
local cfg = require "misc.cfg"
+local qbind = require "quarrel.bind"
local insightful = require "ui.insightful"
local archaic = require "ui.archaic"
local fresnel = require "ui.fresnel"
-local vars = require "misc.vars"
-local btn = awful.button.names
+local flashy = require "ui.flashy"
+local qvars = require "quarrel.vars"
local recording = { false, "" }
client.connect_signal("request::default_mousebindings", function()
awful.mouse.append_client_mousebindings {
- insightful:bind {
- mods = {},
- triggers = btn.LEFT,
+ qbind:new {
+ triggers = qvars.btns.left,
press = function (c)
c:activate {
context = "mouse_click"
@@ -23,9 +23,9 @@ client.connect_signal("request::default_mousebindings", function()
group = "client",
desc = "raise client"
},
- insightful:bind {
- mods = vars.mods.M,
- triggers = btn.LEFT,
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = qvars.btns.left,
press = function (c)
c:activate {
context = "mouse_click",
@@ -35,9 +35,9 @@ client.connect_signal("request::default_mousebindings", function()
group = "client",
desc = "move client"
},
- insightful:bind {
- mods = vars.mods.M,
- triggers = btn.RIGHT,
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = qvars.btns.right,
press = function (c)
c:activate {
context = "mouse_click",
@@ -50,35 +50,82 @@ client.connect_signal("request::default_mousebindings", function()
}
end)
-local globalkeys = gears.table.join(
- insightful:bind {
- mods = vars.mods.MC,
+client.connect_signal("request::default_keybindings", function()
+ awful.keyboard.append_client_keybindings {
+ qbind:new {
+ mods = qvars.mods.MC,
+ triggers = "q",
+ press = function(c)
+ c:kill()
+ end,
+ group = "client",
+ desc = "close"
+ },
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = "m",
+ press = function(c)
+ c.maximized = not c.maximized
+ end,
+ group = "client",
+ desc = "(un)maximize"
+ },
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = "n",
+ press = function(c)
+ gtimer.delayed_call(function()
+ c.minimized = true
+ end)
+ end,
+ group = "client",
+ desc = "minimize"
+ },
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = "f",
+ press = function(c)
+ c.fullscreen = not c.fullscreen
+ end,
+ group = "client",
+ desc = "toggle fullscreen"
+ }
+ }
+end)
+
+awful.keyboard.append_global_keybindings {
+ qbind:new {
+ mods = qvars.mods.MC,
triggers = "r",
press = awesome.restart,
group = "awesome",
desc = "restart awesome"
},
- insightful:bind {
- mods = vars.mods.MC,
- triggers = "s",
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = "F1",
press = function()
insightful:toggle()
end,
group = "awesome",
desc = "toggle insightful"
},
- insightful:bind {
- mods = vars.mods.MC,
+ qbind:new {
+ mods = qvars.mods.MC,
triggers = "a",
press = function()
- archaic:toggle()
+ if flashy._widget.visible then
+ flashy:hide()
+ else
+ flashy:show()
+ end
end,
group = "awesome",
- desc = "toggle notification center"
+ desc = "toggle flashy"
},
- insightful:bind {
- mods = vars.mods.M,
- triggers = " ",
+ qbind:new {
+ mods = qvars.mods.M,
+ triggers = "space",
press = function()
fresnel:show()
end,
@@ -86,7 +133,7 @@ local globalkeys = gears.table.join(
desc = "toggle fresnel"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = "XF86AudioMute",
press = function()
@@ -95,7 +142,7 @@ local globalkeys = gears.table.join(
group = "audio",
desc = "mute"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = {
{ "XF86AudioRaiseVolume", true },
@@ -111,7 +158,7 @@ local globalkeys = gears.table.join(
group = "audio",
desc = "increase/decrease volume"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = {
{ "XF86AudioNext", true },
@@ -127,7 +174,7 @@ local globalkeys = gears.table.join(
group = "audio",
desc = "previous/next song"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = "XF86AudioPlay",
press = function()
@@ -137,7 +184,7 @@ local globalkeys = gears.table.join(
desc = "(un)pause song"
},
- insightful:bind {
+ qbind:new {
mods = {},
triggers = {
{ "XF86MonBrightnessUp", true },
@@ -154,8 +201,8 @@ local globalkeys = gears.table.join(
desc = "increase/decrease brightness"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Return",
press = function()
awful.spawn(cfg.terminal)
@@ -164,94 +211,35 @@ local globalkeys = gears.table.join(
desc = "launch terminal"
},
- insightful:bind {
- mods = vars.mods.MC,
- triggers = "q",
- press = function()
- local c = client.focus
- if c then
- c:kill()
- end
- end,
- group = "client",
- desc = "close"
- },
- insightful:bind {
- mods = vars.mods.M,
- triggers = "m",
- press = function()
- local c = client.focus
- if c then
- c.maximized = not c.maximized
- end
- end,
- group = "client",
- desc = "(un)maximize"
- },
- insightful:bind {
- mods = vars.mods.M,
- triggers = "n",
- press = function()
- local c = client.focus
- if c then
- gears.timer.delayed_call(function()
- c.minimized = true
- end)
- end
- end,
- group = "client",
- desc = "minimize"
- },
- insightful:bind {
- mods = vars.mods.M,
- triggers = "f",
- press = function()
- local c = client.focus
- if c then
- c.fullscreen = not c.fullscreen
- end
- end,
- group = "client",
- desc = "toggle fullscreen"
- },
-
- insightful:bind {
+ qbind:new {
mods = {},
triggers = "Print",
press = function()
local date = os.date("%Y%m%d_%H%M%S")
local path = os.getenv("HOME") .. "/Pictures/" .. date .. ".png"
- awful.spawn.with_shell("maim --hidecursor " .. path .. " && xclip -selection clipboard -t image/png " .. path)
- naughty.notification {
- app_name = "Maim",
- title = "Screenshot taken",
- message = "Saved at " .. path
- }
+ -- Can't use naughty.notification cause it gets in the screenshot
+ -- Also can't use easy_async_with_shell cause it's buggy
+ awful.spawn.with_shell("maim --hidecursor " .. path .. " && xclip -selection clipboard -t image/png " .. path .. [[ && notify-send -a "Maim" "Screenshot taken" "Saved at ]] .. path .. [["]])
end,
group = "screenshot",
desc = "take fullscreen screenshot"
},
- insightful:bind {
- mods = vars.mods.S,
+ qbind:new {
+ mods = qvars.mods.S,
triggers = "Print",
press = function()
local date = os.date("%Y%m%d_%H%M%S")
local path = os.getenv("HOME") .. "/Pictures/" .. date .. ".png"
awful.spawn.with_shell("maim --hidecursor -s " .. path .. " && xclip -selection clipboard -t image/png " .. path .. [[ && notify-send -a "Maim" "Screenshot taken" "Saved at ]] .. path .. [["]])
- -- naughty.notification {
- -- app_name = "Maim",r
- -- title = "Screenshot taken",
- -- message = "Saved at " .. path
- -- }
end,
group = "screenshot",
desc = "take region screenshot"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Print",
press = function()
if recording[1] then
@@ -277,8 +265,8 @@ local globalkeys = gears.table.join(
desc = "toggle recording"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "k",
press = function()
awful.spawn("xkblayout-state set +1")
@@ -286,8 +274,8 @@ local globalkeys = gears.table.join(
group = "keyboard",
desc = "next keyboard layout"
},
- insightful:bind {
- mods = vars.mods.MS,
+ qbind:new {
+ mods = qvars.mods.MS,
triggers = "k",
press = function()
awful.spawn("xkblayout-state set -1")
@@ -296,23 +284,18 @@ local globalkeys = gears.table.join(
desc = "previous keyboard layout"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Up",
press = awful.tag.viewprev,
group = "tag",
desc = "switch to previous"
},
- insightful:bind {
- mods = vars.mods.M,
+ qbind:new {
+ mods = qvars.mods.M,
triggers = "Down",
press = awful.tag.viewnext,
group = "tag",
desc = "switch to next"
}
-)
-
--- gears.debug.dump(insightful:bind.hottriggerss)
-
-root.keys(globalkeys)
-
+}