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.lua318
1 files changed, 318 insertions, 0 deletions
diff --git a/.config/awesome/misc/keys.lua b/.config/awesome/misc/keys.lua
new file mode 100644
index 0000000..6d83ec4
--- /dev/null
+++ b/.config/awesome/misc/keys.lua
@@ -0,0 +1,318 @@
+local awful = require "awful"
+local gears = require "gears"
+local naughty = require "naughty"
+local cfg = require "misc.cfg"
+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 recording = { false, "" }
+
+client.connect_signal("request::default_mousebindings", function()
+ awful.mouse.append_client_mousebindings {
+ insightful:bind {
+ mods = {},
+ triggers = btn.LEFT,
+ press = function (c)
+ c:activate {
+ context = "mouse_click"
+ }
+ end,
+ group = "client",
+ desc = "raise client"
+ },
+ insightful:bind {
+ mods = vars.mods.M,
+ triggers = btn.LEFT,
+ press = function (c)
+ c:activate {
+ context = "mouse_click",
+ action = "mouse_move"
+ }
+ end,
+ group = "client",
+ desc = "move client"
+ },
+ insightful:bind {
+ mods = vars.mods.M,
+ triggers = btn.RIGHT,
+ press = function (c)
+ c:activate {
+ context = "mouse_click",
+ action = "mouse_resize"
+ }
+ end,
+ group = "client",
+ desc = "resize client"
+ }
+ }
+end)
+
+local globalkeys = gears.table.join(
+ insightful:bind {
+ mods = vars.mods.MC,
+ triggers = "r",
+ press = awesome.restart,
+ group = "awesome",
+ desc = "restart awesome"
+ },
+ insightful:bind {
+ mods = vars.mods.MC,
+ triggers = "s",
+ press = function()
+ insightful:toggle()
+ end,
+ group = "awesome",
+ desc = "toggle insightful"
+ },
+ insightful:bind {
+ mods = vars.mods.MC,
+ triggers = "a",
+ press = function()
+ archaic:toggle()
+ end,
+ group = "awesome",
+ desc = "toggle notification center"
+ },
+ insightful:bind {
+ mods = vars.mods.M,
+ triggers = " ",
+ press = function()
+ fresnel:show()
+ end,
+ group = "awesome",
+ desc = "toggle fresnel"
+ },
+
+ insightful:bind {
+ mods = {},
+ triggers = "XF86AudioMute",
+ press = function()
+ awful.spawn("wpctl set-mute @DEFAULT_SINK@ toggle")
+ end,
+ group = "audio",
+ desc = "mute"
+ },
+ insightful:bind {
+ mods = {},
+ triggers = {
+ { "XF86AudioRaiseVolume", true },
+ { "XF86AudioLowerVolume", false }
+ },
+ press = function(up)
+ if up then
+ awful.spawn("wpctl set-volume @DEFAULT_SINK@ 5%+")
+ else
+ awful.spawn("wpctl set-volume @DEFAULT_SINK@ 5%-")
+ end
+ end,
+ group = "audio",
+ desc = "increase/decrease volume"
+ },
+ insightful:bind {
+ mods = {},
+ triggers = {
+ { "XF86AudioNext", true },
+ { "XF86AudioPrev", false }
+ },
+ press = function(next)
+ if next then
+ archaic.playerctl:next()
+ else
+ archaic.playerctl:previous()
+ end
+ end,
+ group = "audio",
+ desc = "previous/next song"
+ },
+ insightful:bind {
+ mods = {},
+ triggers = "XF86AudioPlay",
+ press = function()
+ archaic.playerctl:play_pause()
+ end,
+ group = "audio",
+ desc = "(un)pause song"
+ },
+
+ insightful:bind {
+ mods = {},
+ triggers = {
+ { "XF86MonBrightnessUp", true },
+ { "XF86MonBrightnessDown", false }
+ },
+ press = function(up)
+ if up then
+ awful.spawn("brightnessctl set +51")
+ else
+ awful.spawn("brightnessctl set 51-")
+ end
+ end,
+ group = "brightness",
+ desc = "increase/decrease brightness"
+ },
+
+ insightful:bind {
+ mods = vars.mods.M,
+ triggers = "Return",
+ press = function()
+ awful.spawn(cfg.terminal)
+ end,
+ group = "launcher",
+ 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 {
+ 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
+ }
+ end,
+ group = "screenshot",
+ desc = "take fullscreen screenshot"
+ },
+ insightful:bind {
+ mods = vars.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,
+ triggers = "Print",
+ press = function()
+ if recording[1] then
+ awful.spawn("giph --stop")
+ naughty.notification {
+ app_name = "Giph",
+ title = "Recording stopped",
+ message = "Saved at " .. recording[2]
+ }
+ recording[1] = false
+ recording[2] = ""
+ else
+ recording[1] = true
+ recording[2] = os.getenv("HOME") .. "/Videos/" .. os.date("%Y%m%d_%H%M%S") .. ".mp4"
+ awful.spawn("giph --format mp4 --framerate 30 " .. recording[2])
+ naughty.notification {
+ app_name = "Giph",
+ title = "Recording started"
+ }
+ end
+ end,
+ group = "video",
+ desc = "toggle recording"
+ },
+
+ insightful:bind {
+ mods = vars.mods.M,
+ triggers = "k",
+ press = function()
+ awful.spawn("xkblayout-state set +1")
+ end,
+ group = "keyboard",
+ desc = "next keyboard layout"
+ },
+ insightful:bind {
+ mods = vars.mods.MS,
+ triggers = "k",
+ press = function()
+ awful.spawn("xkblayout-state set -1")
+ end,
+ group = "keyboard",
+ desc = "previous keyboard layout"
+ },
+
+ insightful:bind {
+ mods = vars.mods.M,
+ triggers = "Up",
+ press = awful.tag.viewprev,
+ group = "tag",
+ desc = "switch to previous"
+ },
+ insightful:bind {
+ mods = vars.mods.M,
+ triggers = "Down",
+ press = awful.tag.viewnext,
+ group = "tag",
+ desc = "switch to next"
+ }
+)
+
+-- gears.debug.dump(insightful:bind.hottriggerss)
+
+root.keys(globalkeys)
+