Update and add bling task_preview, tag_preview and window_switcher Add catppuccin-macchiato Use my weather key Update keybindings Update autorun Fix sliders
309 lines
14 KiB
Lua
309 lines
14 KiB
Lua
-- ## Keybindings ##
|
|
-- ~~~~~~~~~~~~~~~~~
|
|
|
|
-- Requirements :
|
|
-- ~~~~~~~~~~~~~~
|
|
local awful = require("awful")
|
|
local hotkeys_popup = require("awful.hotkeys_popup")
|
|
local revelation = require("libs.revelation")
|
|
local switcher = require("libs.awesome_switcher")
|
|
local gfs = require "gears".filesystem.get_configuration_dir()
|
|
|
|
-- vars
|
|
-- ~~~~~~~~~
|
|
|
|
-- modkey
|
|
local modkey = "Mod4"
|
|
-- modifer keys
|
|
local shift = "Shift"
|
|
local ctrl = "Control"
|
|
local alt = "Mod1"
|
|
|
|
-- Default Applications :
|
|
--terminal = "alacritty"
|
|
terminal = "kitty"
|
|
web_browser = "librewolf"
|
|
editor = os.getenv("EDITOR") or "nano"
|
|
editor_cmd = terminal .. " -e " .. editor
|
|
|
|
-- Configurations
|
|
-- ~~~~~~~~~~~~~~
|
|
|
|
-- # Mouse bindings :
|
|
awful.mouse.append_global_mousebindings({
|
|
awful.button({}, 3, function() mymainmenu:toggle() end)
|
|
})
|
|
|
|
client.connect_signal("request::default_mousebindings", function()
|
|
awful.mouse.append_client_mousebindings({ awful.button({}, 1, function(c)
|
|
c:activate { context = "mouse_click" }
|
|
end),
|
|
awful.button({ modkey }, 1, function(c)
|
|
c:activate { context = "mouse_click", action = "mouse_move" }
|
|
end),
|
|
awful.button({ modkey }, 3, function(c)
|
|
c:activate { context = "mouse_click", action = "mouse_resize" }
|
|
end),
|
|
})
|
|
end)
|
|
|
|
-- Sloppy focus :
|
|
client.connect_signal("mouse::enter", function(c)
|
|
c:activate { context = "mouse_enter", raise = false }
|
|
end)
|
|
|
|
-- # Key bindings :
|
|
-- General Awesome keys
|
|
awful.keyboard.append_global_keybindings({
|
|
awful.key({ modkey, }, "s", hotkeys_popup.show_help, { description = "show help", group = "awesome" }),
|
|
--awful.key({ modkey, }, "w", function() mymainmenu:show() end, { description = "show main menu", group = "awesome" }),
|
|
awful.key({ modkey, shift }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
|
|
awful.key({ modkey, shift }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
|
|
awful.key({ modkey, }, "Return", function() awful.spawn(terminal) end, { description = "open a terminal", group = "launcher" }),
|
|
awful.key({ modkey, }, "b", function() awful.spawn(web_browser) end, { description = "Open Web Browser", group = "launcher" }),
|
|
awful.key({ modkey, shift }, "Return", function() awful.spawn("xterm") end, { description = "open a terminal", group = "launcher" }),
|
|
-- awful.key({ modkey }, "p", function() menubar.show() end,
|
|
-- {description = "show the menubar", group = "launcher"}),
|
|
})
|
|
|
|
-- Tags related keybindings
|
|
awful.keyboard.append_global_keybindings({
|
|
awful.key({ modkey, }, "Left", awful.tag.viewprev, { description = "view previous", group = "tag" }),
|
|
awful.key({ modkey, }, "Right", awful.tag.viewnext, { description = "view next", group = "tag" }),
|
|
-- awful.key({ modkey, }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }),
|
|
})
|
|
|
|
-- Focus related keybindings
|
|
awful.keyboard.append_global_keybindings({
|
|
awful.key({ modkey, }, "j", function() awful.client.focus.byidx(1) end, { description = "focus next by index", group = "client" }),
|
|
awful.key({ modkey, }, "k", function() awful.client.focus.byidx( -1) end, { description = "focus previous by index", group = "client" }),
|
|
awful.key({ alt, }, "Tab", function()
|
|
awesome.emit_signal("bling::window_switcher::turn_on")
|
|
end, { description = "Switch tab", group = "client" }),
|
|
--awful.key({ alt, }, "Tab", function()
|
|
-- awful.client.focus.history.previous()
|
|
-- if client.focus then
|
|
-- client.focus:raise()
|
|
-- end
|
|
--end, { description = "go back", group = "client" }),
|
|
--awful.key(
|
|
-- { alt },
|
|
-- 'Tab',
|
|
-- function()
|
|
-- switcher.switch(1, "Mod1", "Alt_L", "Shift", "Tab")
|
|
-- end
|
|
--),
|
|
awful.key(
|
|
{ alt, shift },
|
|
'Tab',
|
|
function()
|
|
switcher.switch(1, "Mod1", "Alt_L", "Shift", "Tab")
|
|
end
|
|
),
|
|
awful.key({ modkey, ctrl }, "j", function() awful.screen.focus_relative(1) end, { description = "focus the next screen", group = "screen" }),
|
|
awful.key({ modkey, ctrl }, "k", function() awful.screen.focus_relative( -1) end, { description = "focus the previous screen", group = "screen" }),
|
|
awful.key({ modkey, ctrl }, "n",
|
|
function()
|
|
local c = awful.client.restore()
|
|
-- Focus restored client
|
|
if c then
|
|
c:activate { raise = true, context = "key.unminimize" }
|
|
end
|
|
end, { description = "restore minimized", group = "client" }),
|
|
awful.key(
|
|
{ modkey, "Control" },
|
|
"Tab",
|
|
awful.client.movetoscreen,
|
|
{ description = "Move focused client to other screen", group = "client" }
|
|
),
|
|
})
|
|
|
|
-- Layout related keybindings
|
|
awful.keyboard.append_global_keybindings({
|
|
awful.key({ modkey, shift }, "j", function() awful.client.swap.byidx(1) end, { description = "swap with next client by index", group = "client" }),
|
|
awful.key({ modkey, shift }, "k", function() awful.client.swap.byidx( -1) end, { description = "swap with previous client by index", group = "client" }),
|
|
awful.key({ modkey, }, "u", awful.client.urgent.jumpto, { description = "jump to urgent client", group = "client" }),
|
|
awful.key({ modkey, }, "l", function() awful.tag.incmwfact(0.05) end, { description = "increase master width factor", group = "layout" }),
|
|
awful.key({ modkey, }, "h", function() awful.tag.incmwfact( -0.05) end, { description = "decrease master width factor", group = "layout" }),
|
|
awful.key({ modkey, shift }, "h", function() awful.tag.incnmaster(1, nil, true) end, { description = "increase the number of master clients", group = "layout" }),
|
|
awful.key({ modkey, shift }, "l", function() awful.tag.incnmaster( -1, nil, true) end, { description = "decrease the number of master clients", group = "layout" }),
|
|
awful.key({ modkey, ctrl }, "h", function() awful.tag.incncol(1, nil, true) end, { description = "increase the number of columns", group = "layout" }),
|
|
awful.key({ modkey, ctrl }, "l", function() awful.tag.incncol( -1, nil, true) end, { description = "decrease the number of columns", group = "layout" }),
|
|
awful.key({ modkey, }, "Tab", function() awful.layout.inc(1) end, { description = "select next", group = "layout" }),
|
|
awful.key(
|
|
{ modkey, 'Shift' },
|
|
'w',
|
|
revelation,
|
|
{ description = "Overview", group = "layout" }
|
|
),
|
|
awful.key({ modkey, shift }, "Tab", function() awful.layout.inc( -1) end, { description = "select previous", group = "layout" }),
|
|
})
|
|
|
|
-- Tags related keybindings
|
|
awful.keyboard.append_global_keybindings({
|
|
awful.key {
|
|
modifiers = { modkey },
|
|
keygroup = "numrow",
|
|
description = "only view tag",
|
|
group = "tag",
|
|
on_press = function(index)
|
|
local screen = awful.screen.focused()
|
|
local tag = screen.tags[index]
|
|
if tag then
|
|
tag:view_only()
|
|
end
|
|
end,
|
|
},
|
|
awful.key {
|
|
modifiers = { modkey, ctrl },
|
|
keygroup = "numrow",
|
|
description = "toggle tag",
|
|
group = "tag",
|
|
on_press = function(index)
|
|
local screen = awful.screen.focused()
|
|
local tag = screen.tags[index]
|
|
if tag then
|
|
awful.tag.viewtoggle(tag)
|
|
end
|
|
end,
|
|
},
|
|
awful.key {
|
|
modifiers = { modkey, shift },
|
|
keygroup = "numrow",
|
|
description = "move focused client to tag",
|
|
group = "tag",
|
|
on_press = function(index)
|
|
if client.focus then
|
|
local tag = client.focus.screen.tags[index]
|
|
if tag then
|
|
client.focus:move_to_tag(tag)
|
|
end
|
|
end
|
|
end,
|
|
},
|
|
awful.key {
|
|
modifiers = { modkey, ctrl, shift },
|
|
keygroup = "numrow",
|
|
description = "toggle focused client on tag",
|
|
group = "tag",
|
|
on_press = function(index)
|
|
if client.focus then
|
|
local tag = client.focus.screen.tags[index]
|
|
if tag then
|
|
client.focus:toggle_tag(tag)
|
|
end
|
|
end
|
|
end,
|
|
},
|
|
awful.key {
|
|
modifiers = { modkey },
|
|
keygroup = "numpad",
|
|
description = "select layout directly",
|
|
group = "layout",
|
|
on_press = function(index)
|
|
local t = awful.screen.focused().selected_tag
|
|
if t then
|
|
t.layout = t.layouts[index] or t.layout
|
|
end
|
|
end,
|
|
}
|
|
})
|
|
|
|
-- Media Control :
|
|
awful.keyboard.append_global_keybindings({
|
|
-- Volume Keys :
|
|
awful.key({}, "XF86AudioLowerVolume", function() awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ -2%", false) end),
|
|
awful.key({}, "XF86AudioRaiseVolume", function() awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ +2%", false) end),
|
|
awful.key({}, "XF86AudioMute", function() awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle", false) end),
|
|
|
|
-- Media Keys :
|
|
awful.key({}, "XF86AudioPlay", function() awful.spawn("playerctl play-pause", false) end),
|
|
awful.key({}, "XF86AudioNext", function() awful.spawn("playerctl next", false) end),
|
|
awful.key({}, "XF86AudioPrev", function() awful.spawn("playerctl previous", false) end),
|
|
|
|
-- Brightness Keys :
|
|
awful.key({}, "XF86MonBrightnessUp", function() awful.spawn("brightnessctl set 5%+", false) end),
|
|
awful.key({}, "XF86MonBrightnessDown", function() awful.spawn("brightnessctl set 5%-", false) end),
|
|
})
|
|
|
|
-- Standard program :
|
|
awful.keyboard.append_global_keybindings({
|
|
-- File Manager :
|
|
awful.key({ modkey }, "e", function() awful.spawn(string.format("xdg-open .")) end, { description = "file manager", group = "file manager" }),
|
|
|
|
-- Screenshots Keys :
|
|
awful.key({}, "Print", function() awful.spawn("screenshot") end, { description = "Maim", group = "screenshot" }),
|
|
awful.key({ modkey }, "Print", function() awful.spawn("screenshot-select") end, { description = "Maim", group = "screenshot" }),
|
|
|
|
-- Rofi :
|
|
--awful.key({ modkey }, "d", function() awful.spawn("rofi -show drun -theme ~/.config/rofi/rofi.rasi") end, { description = "rofi launcher", group = "launcher" }),
|
|
--awful.key({ modkey }, "w", function() awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi") end, { description = "rofi launcher", group = "launcher" }),
|
|
awful.key({ modkey }, "d", function() awful.spawn("rofi -show drun -theme " .. gfs .. "/libs/misc/rofi/config.rasi") end, { description = "rofi launcher", group = "launcher" }),
|
|
awful.key({ modkey }, "w", function() awful.spawn("rofi -show window -theme " .. gfs .. "/libs/misc/rofi/config.rasi") end, { description = "rofi launcher", group = "launcher" }),
|
|
|
|
-- Main Menu :
|
|
-- awful.key({ modkey }, "r", function () awful.spawn("rofi -show drun -show-icons -theme ~/.config/awesome/libs/misc/rofi/config.rasi &>> /tmp/rofi.log") end, {description = "rofi launcher", group = "launcher"}),
|
|
|
|
-- ClipMenu :
|
|
awful.key({ modkey }, "Insert", function() awful.spawn("clipmenu") end, { description = "clipboard history by rofi/clipmenud", group = "awesome" }),
|
|
|
|
-- Center Window :
|
|
awful.key({ modkey }, "y", awful.placement.centered),
|
|
awful.key({ modkey }, "l", function() awful.spawn("betterlockscreen -l") end, { description = "lockscreen", group = "lockscreen" }),
|
|
|
|
})
|
|
|
|
-- Systray :
|
|
--awful.keyboard.append_global_keybindings({
|
|
-- awful.key({ modkey }, "=", function () awful.screen.focused().systray.visible = not awful.screen.focused().systray.visible end, {description = "Toggle systray visibility", group = "custom"})
|
|
--})
|
|
|
|
-- Bar :
|
|
awful.keyboard.append_global_keybindings({
|
|
awful.key({ modkey }, "=", function()
|
|
for s in screen do
|
|
s.mywibar.visible = not s.mywibar.visible
|
|
end
|
|
end,
|
|
{ description = "toggle wibox", group = "awesome" }),
|
|
})
|
|
|
|
awful.keyboard.append_global_keybindings({
|
|
awful.key({ modkey }, "Escape", function() awesome.emit_signal("sidebar::toggle") end), -- Sidebar
|
|
awful.key({ modkey }, "t", function() awesome.emit_signal("notifications_list::toggle") end), -- Sidebar
|
|
awful.key({ alt }, "t", function() awful.titlebar.toggle(client.focus) end),
|
|
})
|
|
|
|
-- Client :
|
|
client.connect_signal("request::default_keybindings", function()
|
|
awful.keyboard.append_client_keybindings({
|
|
awful.key({ modkey, }, "f", function(c)
|
|
c.fullscreen = not c.fullscreen
|
|
c:raise()
|
|
end, { description = "toggle fullscreen", group = "client" }),
|
|
awful.key({ modkey, shift }, "f", function(c)
|
|
c.maximized = not c.maximized
|
|
c:raise()
|
|
end, { description = "toggle maximized", group = "client" }),
|
|
awful.key({ modkey }, "c", function(c) c:kill() end, { description = "close", group = "client" }),
|
|
awful.key({ modkey }, "space", awful.client.floating.toggle, { description = "toggle floating", group = "client" }),
|
|
awful.key({ modkey, "Control" }, "Return", function(c) c:swap(awful.client.getmaster()) end, { description = "move to master", group = "client" }),
|
|
awful.key({ modkey, }, "o", function(c) c:move_to_screen() end, { description = "move to screen", group = "client" }),
|
|
awful.key({ modkey, }, "t", function(c) c.ontop = not c.ontop end, { description = "toggle keep on top", group = "client" }),
|
|
-- The client currently has the input focus, so it cannot be
|
|
-- minimized, since minimized clients can't have the focus.
|
|
awful.key({ modkey, }, "n", function(c) c.minimized = true end, { description = "minimize", group = "client" }),
|
|
awful.key({ modkey, }, "m", function(c)
|
|
c.maximized = not c.maximized
|
|
c:raise()
|
|
end, { description = "(un)maximize", group = "client" }),
|
|
awful.key({ modkey, "Control" }, "m", function(c)
|
|
c.maximized_vertical = not c.maximized_vertical
|
|
c:raise()
|
|
end, { description = "(un)maximize vertically", group = "client" }),
|
|
awful.key({ modkey, shift }, "m", function(c)
|
|
c.maximized_horizontal = not c.maximized_horizontal
|
|
c:raise()
|
|
end, { description = "(un)maximize horizontally", group = "client" }),
|
|
})
|
|
end)
|