mirror of
https://github.com/tuxdotrs/nixos-config.git
synced 2025-07-09 03:06:34 +05:30
add awesome-wm config
This commit is contained in:
5
pkgs/awesome/awesome/binds/client/init.lua
Normal file
5
pkgs/awesome/awesome/binds/client/init.lua
Normal file
@ -0,0 +1,5 @@
|
||||
-- Returns all client mouse and keybinds.
|
||||
return {
|
||||
keys = require(... .. ".keys"),
|
||||
mouse = require(... .. ".mouse"),
|
||||
}
|
19
pkgs/awesome/awesome/binds/client/keys.lua
Normal file
19
pkgs/awesome/awesome/binds/client/keys.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local awful = require("awful")
|
||||
|
||||
local mod = require("binds.mod")
|
||||
local modkey = mod.modkey
|
||||
|
||||
--- Client keybindings.
|
||||
client.connect_signal("request::default_keybindings", function()
|
||||
awful.keyboard.append_client_keybindings({
|
||||
-- Client state management.
|
||||
awful.key({ modkey }, "f", function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end, { description = "toggle fullscreen", group = "client" }),
|
||||
awful.key({ modkey }, "q", function(c)
|
||||
c:kill()
|
||||
end, { description = "close", group = "client" }),
|
||||
awful.key({ modkey }, "space", awful.client.floating.toggle, { description = "toggle floating", group = "client" }),
|
||||
})
|
||||
end)
|
19
pkgs/awesome/awesome/binds/client/mouse.lua
Normal file
19
pkgs/awesome/awesome/binds/client/mouse.lua
Normal file
@ -0,0 +1,19 @@
|
||||
local awful = require("awful")
|
||||
|
||||
local mod = require("binds.mod")
|
||||
local modkey = mod.modkey
|
||||
|
||||
--- Client mouse bindings.
|
||||
client.connect_signal("request::default_mousebindings", function()
|
||||
awful.mouse.append_client_mousebindings({
|
||||
awful.button(nil, 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)
|
5
pkgs/awesome/awesome/binds/global/init.lua
Normal file
5
pkgs/awesome/awesome/binds/global/init.lua
Normal file
@ -0,0 +1,5 @@
|
||||
-- Returns all global WM mouse and keybinds.
|
||||
return {
|
||||
keys = require(... .. ".keys"),
|
||||
mouse = require(... .. ".mouse"),
|
||||
}
|
90
pkgs/awesome/awesome/binds/global/keys.lua
Normal file
90
pkgs/awesome/awesome/binds/global/keys.lua
Normal file
@ -0,0 +1,90 @@
|
||||
local awful = require("awful")
|
||||
|
||||
local mod = require("binds.mod")
|
||||
local modkey = mod.modkey
|
||||
|
||||
local apps = require("config.apps")
|
||||
|
||||
--- Global key bindings
|
||||
awful.keyboard.append_global_keybindings({
|
||||
-- General Awesome keys.
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"h",
|
||||
require("awful.hotkeys_popup").show_help,
|
||||
{ description = "show help", group = "awesome" }
|
||||
),
|
||||
awful.key({ modkey, mod.shift }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
|
||||
awful.key({ modkey, mod.shift }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
|
||||
awful.key({ modkey }, "Return", function()
|
||||
awful.spawn(apps.terminal)
|
||||
end, { description = "open a terminal", group = "launcher" }),
|
||||
awful.key({ modkey }, "a", function()
|
||||
awful.spawn("rofi -show drun")
|
||||
end, { description = "run prompt", group = "launcher" }),
|
||||
|
||||
-- Focus related keybindings.
|
||||
awful.key({ modkey }, "Left", function()
|
||||
awful.client.focus.bydirection("left")
|
||||
end, { description = "Focus window to the left", group = "Client" }),
|
||||
awful.key({ modkey }, "Right", function()
|
||||
awful.client.focus.bydirection("right")
|
||||
end, { description = "Focus window to the right", group = "Client" }),
|
||||
awful.key({ modkey }, "Up", function()
|
||||
awful.client.focus.bydirection("up")
|
||||
end, { description = "Focus window above", group = "Client" }),
|
||||
awful.key({ modkey }, "Down", function()
|
||||
awful.client.focus.bydirection("down")
|
||||
end, { description = "Focus window below", group = "Client" }),
|
||||
awful.key({ modkey }, "Escape", awful.tag.history.restore, { description = "go back", group = "tag" }),
|
||||
|
||||
-- Swap related keybindings.
|
||||
awful.key({ modkey, mod.shift }, "Left", function()
|
||||
awful.client.swap.bydirection("left")
|
||||
end, { description = "Swap window to the left", group = "Client" }),
|
||||
awful.key({ modkey, mod.shift }, "Right", function()
|
||||
awful.client.swap.bydirection("right")
|
||||
end, { description = "Swap window to the right", group = "Client" }),
|
||||
awful.key({ modkey, mod.shift }, "Up", function()
|
||||
awful.client.swap.bydirection("up")
|
||||
end, { description = "Swap window above", group = "Client" }),
|
||||
awful.key({ modkey, mod.shift }, "Down", function()
|
||||
awful.client.swap.bydirection("down")
|
||||
end, { description = "Swap window below", group = "Client" }),
|
||||
|
||||
-- Width related keybindings.
|
||||
awful.key({ modkey, mod.ctrl }, "Left", function()
|
||||
awful.tag.incmwfact(-0.05)
|
||||
end, { description = "decrease master width factor", group = "layout" }),
|
||||
awful.key({ modkey, mod.ctrl }, "Right", function()
|
||||
awful.tag.incmwfact(0.05)
|
||||
end, { description = "increase master width factor", group = "layout" }),
|
||||
|
||||
-- Tag related keybindings.
|
||||
awful.key({
|
||||
modifiers = { modkey },
|
||||
keygroup = "numrow",
|
||||
description = "only view tag",
|
||||
group = "tag",
|
||||
on_press = function(index)
|
||||
local tag = awful.screen.focused().tags[index]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
end,
|
||||
}),
|
||||
awful.key({
|
||||
modifiers = { modkey, mod.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,
|
||||
}),
|
||||
})
|
12
pkgs/awesome/awesome/binds/global/mouse.lua
Normal file
12
pkgs/awesome/awesome/binds/global/mouse.lua
Normal file
@ -0,0 +1,12 @@
|
||||
local awful = require("awful")
|
||||
|
||||
local widgets = require("ui")
|
||||
|
||||
--- Global mouse bindings
|
||||
awful.mouse.append_global_mousebindings({
|
||||
awful.button(nil, 3, function()
|
||||
widgets.menu.main:toggle()
|
||||
end),
|
||||
awful.button(nil, 4, awful.tag.viewprev),
|
||||
awful.button(nil, 5, awful.tag.viewnext),
|
||||
})
|
5
pkgs/awesome/awesome/binds/init.lua
Normal file
5
pkgs/awesome/awesome/binds/init.lua
Normal file
@ -0,0 +1,5 @@
|
||||
-- Returns all mouse and keybinds for both clients and the WM.
|
||||
return {
|
||||
global = require(... .. ".global"),
|
||||
client = require(... .. ".client"),
|
||||
}
|
9
pkgs/awesome/awesome/binds/mod.lua
Normal file
9
pkgs/awesome/awesome/binds/mod.lua
Normal file
@ -0,0 +1,9 @@
|
||||
return {
|
||||
alt = "Mod1",
|
||||
super = "Mod4",
|
||||
shift = "Shift",
|
||||
ctrl = "Control",
|
||||
|
||||
-- Set Super as default modkey if none is present.
|
||||
modkey = require("config.user").mod or "Mod4",
|
||||
}
|
Reference in New Issue
Block a user