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.lua157
1 files changed, 101 insertions, 56 deletions
diff --git a/.config/awesome/misc/keys.lua b/.config/awesome/misc/keys.lua
index 9d994ce..8d703b8 100644
--- a/.config/awesome/misc/keys.lua
+++ b/.config/awesome/misc/keys.lua
@@ -3,21 +3,22 @@ local backlight = require "services.backlight"
local beautiful = require "beautiful"
local cfg = require "misc.cfg"
local fresnel = require "ui.fresnel"
+local gtable = require "gears.table"
local gtimer = require "gears.timer"
local insightful = require "ui.insightful"
local naughty = require "naughty"
+-- local mpris = (require "services.mpris")
+local mpris = require "ui.statusbar.panel.widgets.mpris"
local playerctl = require "services.playerctl"
local powermenu = require "ui.powermenu"
local qbind = require "quarrel.bind"
-local qstore = require "quarrel.store"
-local qvars = require "quarrel.vars"
local recording = { false, "" }
client.connect_signal("request::default_mousebindings", function()
awful.mouse.append_client_mousebindings {
- qbind:new {
- triggers = qvars.btns.left,
+ qbind {
+ triggers = qbind.btns.left,
press = function(c)
c:activate {
context = "mouse_click",
@@ -26,9 +27,9 @@ client.connect_signal("request::default_mousebindings", function()
group = "client",
desc = "raise client",
},
- qbind:new {
- mods = qvars.mods.M,
- triggers = qvars.btns.left,
+ qbind {
+ mods = qbind.mods.M,
+ triggers = qbind.btns.left,
press = function(c)
c:activate {
context = "mouse_click",
@@ -38,9 +39,9 @@ client.connect_signal("request::default_mousebindings", function()
group = "client",
desc = "move client",
},
- qbind:new {
- mods = qvars.mods.M,
- triggers = qvars.btns.right,
+ qbind {
+ mods = qbind.mods.M,
+ triggers = qbind.btns.right,
press = function(c)
c:activate {
context = "mouse_click",
@@ -55,8 +56,8 @@ end)
client.connect_signal("request::default_keybindings", function()
awful.keyboard.append_client_keybindings {
- qbind:new {
- mods = qvars.mods.MC,
+ qbind {
+ mods = qbind.mods.MC,
triggers = "q",
press = function(c)
c:kill()
@@ -64,8 +65,8 @@ client.connect_signal("request::default_keybindings", function()
group = "client",
desc = "close",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "m",
press = function(c)
c.maximized = not c.maximized
@@ -73,8 +74,8 @@ client.connect_signal("request::default_keybindings", function()
group = "client",
desc = "(un)maximize",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "n",
press = function(c)
gtimer.delayed_call(function()
@@ -84,8 +85,8 @@ client.connect_signal("request::default_keybindings", function()
group = "client",
desc = "minimize",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "f",
press = function(c)
c.fullscreen = not c.fullscreen
@@ -97,15 +98,15 @@ client.connect_signal("request::default_keybindings", function()
end)
awful.keyboard.append_global_keybindings {
- qbind:new {
- mods = qvars.mods.MC,
+ qbind {
+ mods = qbind.mods.MC,
triggers = "r",
press = awesome.restart,
group = "awesome",
desc = "restart awesome",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "F1",
press = function()
insightful:toggle()
@@ -113,8 +114,8 @@ awful.keyboard.append_global_keybindings {
group = "awesome",
desc = "toggle insightful",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "space",
press = function()
fresnel:show()
@@ -122,17 +123,17 @@ awful.keyboard.append_global_keybindings {
group = "awesome",
desc = "toggle fresnel",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "p",
press = function()
- qstore.panel_toggle:press()
+ awful.screen.focused().bar:toggle()
end,
group = "awesome",
desc = "toggle bar panel",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "l",
press = function()
powermenu:toggle()
@@ -141,7 +142,7 @@ awful.keyboard.append_global_keybindings {
desc = "toggle powermenu",
},
- qbind:new {
+ qbind {
triggers = "XF86AudioMute",
press = function()
awful.spawn "wpctl set-mute @DEFAULT_SINK@ toggle"
@@ -149,46 +150,65 @@ awful.keyboard.append_global_keybindings {
group = "audio",
desc = "mute",
},
- qbind:new {
+ qbind {
triggers = {
{ "XF86AudioRaiseVolume", true },
{ "XF86AudioLowerVolume", false },
},
press = function(up)
if up then
- awful.spawn "wpctl set-volume @DEFAULT_SINK@ 5%+"
+ -- awful.spawn "wpctl set-volume @DEFAULT_SINK@ 5%+"
+ print "up"
else
- awful.spawn "wpctl set-volume @DEFAULT_SINK@ 5%-"
+ print "down"
+ -- awful.spawn "wpctl set-volume @DEFAULT_SINK@ 5%-"
end
end,
group = "audio",
desc = "increase/decrease volume",
},
- qbind:new {
+ qbind {
triggers = {
{ "XF86AudioNext", true },
{ "XF86AudioPrev", false },
},
press = function(next)
+ local active_player = playerctl:list()[mpris.active_player_index].instance
if next then
- playerctl:next()
+ playerctl:next(active_player)
else
- playerctl:previous()
+ playerctl:previous(active_player)
end
end,
group = "audio",
desc = "previous/next song",
},
- qbind:new {
+ qbind {
triggers = "XF86AudioPlay",
press = function()
- playerctl:play_pause()
+ playerctl:play_pause(playerctl:list()[mpris.active_player_index].instance)
end,
group = "audio",
desc = "(un)pause song",
},
+ qbind {
+ mods = qbind.mods.M,
+ triggers = {
+ { "Next", true },
+ { "Prior", false },
+ },
+ press = function(next)
+ if next then
+ mpris.next_player()
+ else
+ mpris.previous_player()
+ end
+ end,
+ group = "audio",
+ desc = "previous/next player",
+ },
- qbind:new {
+ qbind {
triggers = {
{ "XF86MonBrightnessUp", true },
{ "XF86MonBrightnessDown", false },
@@ -204,8 +224,8 @@ awful.keyboard.append_global_keybindings {
desc = "increase/decrease brightness",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "Return",
press = function()
awful.spawn(cfg.terminal)
@@ -214,7 +234,7 @@ awful.keyboard.append_global_keybindings {
desc = "launch terminal",
},
- qbind:new {
+ qbind {
triggers = "Print",
press = function()
local date = os.date "%Y%m%d_%H%M%S"
@@ -235,8 +255,8 @@ awful.keyboard.append_global_keybindings {
group = "screenshot",
desc = "take fullscreen screenshot",
},
- qbind:new {
- mods = qvars.mods.S,
+ qbind {
+ mods = qbind.mods.S,
triggers = "Print",
press = function()
local date = os.date "%Y%m%d_%H%M%S"
@@ -256,8 +276,8 @@ awful.keyboard.append_global_keybindings {
desc = "take region screenshot",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "Print",
press = function()
if recording[1] then
@@ -283,8 +303,8 @@ awful.keyboard.append_global_keybindings {
desc = "toggle recording",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "k",
press = function()
awful.spawn "xkblayout-state set +1"
@@ -292,8 +312,8 @@ awful.keyboard.append_global_keybindings {
group = "keyboard",
desc = "next keyboard layout",
},
- qbind:new {
- mods = qvars.mods.MS,
+ qbind {
+ mods = qbind.mods.MS,
triggers = "k",
press = function()
awful.spawn "xkblayout-state set -1"
@@ -302,22 +322,35 @@ awful.keyboard.append_global_keybindings {
desc = "previous keyboard layout",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "Up",
press = awful.tag.viewprev,
group = "tag",
desc = "switch to previous",
},
- qbind:new {
- mods = qvars.mods.M,
+ qbind {
+ mods = qbind.mods.M,
triggers = "Down",
press = awful.tag.viewnext,
group = "tag",
desc = "switch to next",
},
- qbind:new {
- mods = qvars.mods.MC,
+ qbind {
+ mods = qbind.mods.M,
+ triggers = gtable.join(awful.key.keygroups.numrow, awful.key.keygroups.numpad),
+ press = function(idx)
+ local tag = awful.screen.focused().tags[idx]
+ if not tag then
+ return
+ end
+ tag:view_only()
+ end,
+ group = "tag",
+ desc = "switch to the specified tag (if it exists)",
+ },
+ qbind {
+ mods = qbind.mods.MC,
triggers = "x",
press = function()
local tag = awful.screen.focused().selected_tag
@@ -326,4 +359,16 @@ awful.keyboard.append_global_keybindings {
group = "tag",
desc = "reset master width",
},
+ qbind {
+ mods = qbind.mods.M,
+ triggers = {
+ { "XF86AudioRaiseVolume", true }, -- volume roller produces these events
+ { "XF86AudioLowerVolume", false },
+ },
+ press = function(up)
+ awful.spawn("xdotool click " .. (up and "4" or "5"))
+ end,
+ group = "misc",
+ desc = "scroll up/down",
+ },
}