configuration de base avec awesomeWM minimal et modularise, polybar et rofi
This commit is contained in:
65
awesome/modules/keys.lua
Normal file
65
awesome/modules/keys.lua
Normal file
@@ -0,0 +1,65 @@
|
||||
local awful = require("awful")
|
||||
local gears = require("gears")
|
||||
|
||||
-- Raccourcis globaux
|
||||
local global_keys = gears.table.join(
|
||||
awful.key({ modkey }, "Return", function() awful.spawn(terminal) end,
|
||||
{ description = "ouvrir terminal", group = "launcher" }),
|
||||
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
{ description = "recharger awesome", group = "awesome" }),
|
||||
|
||||
awful.key({ modkey, "Shift" }, "q", awesome.quit,
|
||||
{ description = "quitter", group = "awesome" }),
|
||||
|
||||
awful.key({ modkey }, "j", function() awful.client.focus.byidx(1) end),
|
||||
awful.key({ modkey }, "k", function() awful.client.focus.byidx(-1) end),
|
||||
|
||||
awful.key({ modkey }, "Left", awful.tag.viewprev),
|
||||
awful.key({ modkey }, "Right", awful.tag.viewnext),
|
||||
|
||||
awful.key({ modkey }, "p", function() awful.spawn("rofi -show drun")
|
||||
end, {description = "lancer rofi", group = "launcher"})
|
||||
)
|
||||
|
||||
-- Navigation tags Super+1..9
|
||||
for i = 1, 9 do
|
||||
global_keys = gears.table.join(global_keys,
|
||||
awful.key({ modkey }, "#" .. i + 9, function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then tag:view_only() end
|
||||
end,
|
||||
{ description = "aller au tag " .. i, group = "tag" })
|
||||
)
|
||||
end
|
||||
|
||||
root.keys(global_keys)
|
||||
|
||||
-- Raccourcis sur les fenêtres
|
||||
local client_keys = gears.table.join(
|
||||
awful.key({ modkey }, "q", function(c) c:kill() end,
|
||||
{ description = "fermer", group = "client" }),
|
||||
|
||||
awful.key({ modkey }, "f", function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end),
|
||||
|
||||
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle)
|
||||
)
|
||||
|
||||
-- Boutons souris sur les fenêtres
|
||||
local client_buttons = gears.table.join(
|
||||
awful.button({}, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
end),
|
||||
awful.button({ modkey }, 1, awful.mouse.client.move),
|
||||
awful.button({ modkey }, 3, awful.mouse.client.resize)
|
||||
)
|
||||
|
||||
-- On exporte pour rules.lua
|
||||
return {
|
||||
client_keys = client_keys,
|
||||
client_buttons = client_buttons,
|
||||
}
|
||||
16
awesome/modules/rules.lua
Normal file
16
awesome/modules/rules.lua
Normal file
@@ -0,0 +1,16 @@
|
||||
local awful = require("awful")
|
||||
local keys = require("modules.keys")
|
||||
|
||||
awful.rules.rules = {
|
||||
{
|
||||
rule = {},
|
||||
properties = {
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
||||
keys = keys.client_keys,
|
||||
buttons = keys.client_buttons,
|
||||
}
|
||||
},
|
||||
}
|
||||
13
awesome/modules/signals.lua
Normal file
13
awesome/modules/signals.lua
Normal file
@@ -0,0 +1,13 @@
|
||||
local awful = require("awful")
|
||||
|
||||
awful.rules.rules = {
|
||||
{
|
||||
rule = {},
|
||||
properties = {
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen,
|
||||
}
|
||||
},
|
||||
}
|
||||
19
awesome/modules/tags.lua
Normal file
19
awesome/modules/tags.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local awful = require("awful")
|
||||
|
||||
local M = {}
|
||||
|
||||
function M.setup(layouts)
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
awful.tag({ "1", "2", "3", "4" }, s, layouts[1])
|
||||
|
||||
-- s.name peut être nil selon la version, on utilise s.index comme fallback
|
||||
local monitor = s.name or ("screen" .. s.index)
|
||||
awful.spawn.with_shell("MONITOR=" .. monitor .. " polybar main 2>/dev/null &")
|
||||
end)
|
||||
|
||||
awesome.connect_signal("startup", function()
|
||||
awful.spawn.with_shell("killall -q polybar; sleep 0.5 && ~/.config/polybar/launch.sh")
|
||||
end)
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user