Initial commit

This commit is contained in:
Hydroxycarbamide 2022-08-27 21:35:40 +02:00
commit 093dec7f93
143 changed files with 7456 additions and 0 deletions

69
mappings/bind_to_tags.lua Normal file
View file

@ -0,0 +1,69 @@
-- Awesome Libs
local awful = require("awful")
local gears = require("gears")
local globalkeys = require("../mappings/global_keys")
local modkey = user_vars.modkey
for i = 1, 9 do
globalkeys = gears.table.join(globalkeys,
-- View tag only
awful.key(
{ modkey },
"#" .. i + 9,
function()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
end
client.emit_signal("tag::switched")
end,
{ description = "View Tag " .. i, group = "Tag" }
),
-- Brings the window over without chaning the tag, reverts automatically on tag change
awful.key(
{ modkey, "Control" },
"#" .. i + 9,
function()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{ description = "Toggle Tag " .. i, group = "Tag" }
),
-- Brings the window over without chaning the tag, reverts automatically on tag change
awful.key(
{ modkey, "Shift" },
"#" .. i + 9,
function()
local screen = awful.screen.focused()
if client.focus then
local tag = screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
tag:view_only()
client.emit_signal("tag::switched")
end
end
end,
{ description = "Move focused client on tag " .. i, group = "Tag" }
),
-- Brings the window over without chaning the tag, reverts automatically on tag change
awful.key(
{ modkey, "Control", "Shift" },
"#" .. i + 9,
function()
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
end
end,
{ description = "Move focused client on tag " .. i, group = "Tag" }
)
)
end
root.keys(globalkeys)

View file

@ -0,0 +1,19 @@
-- Awesome Libs
local awful = require("awful")
local gears = require("gears")
local modkey = user_vars.modkey
return gears.table.join(
awful.button({}, 1, function(c)
c:emit_signal("request::activate", "mouse_click", { raise = true })
end),
awful.button({ modkey }, 1, function(c)
c:emit_signal("request::activate", "mouse_click", { raise = true })
awful.mouse.client.move(c)
end),
awful.button({ modkey }, 3, function(c)
c:emit_signal("request::activate", "mouse_click", { raise = true })
awful.mouse.client.resize(c)
end)
)

63
mappings/client_keys.lua Normal file
View file

@ -0,0 +1,63 @@
-- Awesome Libs
local awful = require("awful")
local gears = require("gears")
local modkey = user_vars.modkey
return gears.table.join(
awful.key(
{ modkey },
"#41",
function(c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{ description = "Toggle fullscreen", group = "Client" }
),
awful.key(
{ modkey },
"#54",
function(c)
c:kill()
end,
{ description = "Close focused client", group = "Client" }
),
awful.key(
{ modkey },
"#65",
awful.client.floating.toggle,
{ description = "Toggle floating window", group = "Client" }
),
awful.key(
{ modkey, "Control" },
"#23",
awful.client.movetoscreen,
{ description = "Move focused client to other screen", group = "Screen" }
),
awful.key(
{ modkey },
"#58",
function(c)
c.maximized = not c.maximized
c:raise()
end,
{ description = "(un)maximize", group = "Client" }
),
awful.key(
{ modkey },
"#57",
function(c)
if c == client.focus then
c.minimized = true
else
c.minimized = false
if not c:isvisible() and c.first_tag then
c.first_tag:view_only()
end
c:emit_signal('request::activate')
c:raise()
end
end,
{ description = "(un)hide", group = "Client" }
)
)

View file

@ -0,0 +1,8 @@
-- Awesome Libs
local gears = require("gears")
local awful = require("awful")
root.buttons = gears.table.join(
awful.button({}, 4, awful.tag.viewnext),
awful.button({}, 5, awful.tag.viewprev)
)

405
mappings/global_keys.lua Normal file
View file

@ -0,0 +1,405 @@
-- Awesome Libs
local gears = require("gears")
local awful = require("awful")
local hotkeys_popup = require("awful.hotkeys_popup")
local ruled = require("ruled")
local modkey = user_vars.modkey
return gears.table.join(
awful.key(
{ modkey },
"#39",
hotkeys_popup.show_help,
{ description = "Cheat sheet", group = "Awesome" }
),
-- Tag browsing
awful.key(
{ modkey },
"#113",
awful.tag.viewprev,
{ description = "View previous tag", group = "Tag" }
),
awful.key(
{ modkey },
"#114",
awful.tag.viewnext,
{ description = "View next tag", group = "Tag" }
),
awful.key(
{ modkey },
"#66",
awful.tag.history.restore,
{ description = "Go back to last tag", group = "Tag" }
),
awful.key(
{ modkey },
"#44",
function()
awful.client.focus.byidx(1)
end,
{ description = "Focus next client by index", group = "Client" }
),
awful.key(
{ modkey },
"#45",
function()
awful.client.focus.byidx(-1)
end,
{ description = "Focus previous client by index", group = "Client" }
),
awful.key(
{ "Mod1" },
"#23",
function()
awful.client.focus.byidx(1)
end,
{ description = "Focus next client by index", group = "Client" }
),
awful.key(
{ "Mod1", "Shift" },
"#23",
function()
awful.client.focus.byidx(-1)
end,
{ description = "Focus previous client by index", group = "Client" }
),
awful.key(
{ modkey, "Shift" },
"#44",
function()
awful.client.swap.byidx(1)
end,
{ description = "Swap with next client by index", group = "Client" }
),
awful.key(
{ modkey, "Shift" },
"#45",
function()
awful.client.swap.byidx(-1)
end,
{ description = "Swap with previous client by index", group = "Client" }
),
awful.key(
{ modkey, "Control" },
"#44",
function()
awful.screen.focus_relative(1)
end,
{ description = "Focus the next screen", group = "Screen" }
),
awful.key(
{ modkey, "Control" },
"#45",
function()
awful.screen.focus_relative(-1)
end,
{ description = "Focus the previous screen", group = "Screen" }
),
awful.key(
{ modkey },
"#30",
awful.client.urgent.jumpto,
{ description = "Jump to urgent client", group = "Client" }
),
awful.key(
{ modkey },
"#36",
function()
awful.spawn(user_vars.terminal)
end,
{ description = "Open terminal", group = "Applications" }
),
awful.key(
{ modkey, "Shift" },
"#27",
awesome.restart,
{ description = "Reload awesome", group = "Awesome" }
),
awful.key(
{ modkey },
"#46",
function()
awful.tag.incmwfact(0.05)
end,
{ description = "Increase client width", group = "Layout" }
),
awful.key(
{ modkey },
"#43",
function()
awful.tag.incmwfact(-0.05)
end,
{ description = "Decrease client width", group = "Layout" }
),
awful.key(
{ modkey, "Control" },
"#43",
function()
awful.tag.incncol(1, nil, true)
end,
{ description = "Increase the number of columns", group = "Layout" }
),
awful.key(
{ modkey, "Control" },
"#46",
function()
awful.tag.incncol(-1, nil, true)
end,
{ description = "Decrease the number of columns", group = "Layout" }
),
awful.key(
{ modkey, "Shift" },
"#23",
function()
awful.layout.inc(1)
end,
{ description = "Select previous layout", group = "Layout" }
),
awful.key(
{ modkey },
"#23",
function()
awful.layout.inc(-1)
end,
{ description = "Select next layout", group = "Layout" }
),
awful.key(
{ modkey },
"#40",
function()
awful.spawn("rofi -show drun -theme ~/.config/rofi/rofi.rasi")
end,
{ descripton = "Application launcher", group = "Application" }
),
awful.key(
{ modkey },
"#53",
function()
awesome.emit_signal("module::powermenu:show")
end,
{ description = "Powermenu", group = "Application"}
),
-- awful.key(
-- { "Mod1" },
-- "#23",
-- function()
-- awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
-- end,
-- { descripton = "Client switcher (alt+tab)", group = "Application" }
-- ),
-- awful.key(
-- { modkey },
-- "#23",
-- function()
-- awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
-- end,
-- { descripton = "Client switcher (alt+tab)", group = "Application" }
-- ),
awful.key(
{ modkey },
"#25",
function()
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
end,
{ descripton = "Client switcher (alt+tab)", group = "Application" }
),
awful.key(
{ modkey },
"#26",
function()
awful.spawn(user_vars.file_manager)
end,
{ descripton = "Open file manager", group = "System" }
),
awful.key(
{ modkey, "Shift" },
"#26",
function()
awesome.emit_signal("module::powermenu:show")
end,
{ descripton = "Session options", group = "System" }
),
awful.key(
{ modkey, "Shift"},
"#39",
function()
awful.spawn(user_vars.screenshot_program)
end,
{ description = "Screenshot", group = "Applications" }
),
awful.key(
{},
"XF86AudioLowerVolume",
function(c)
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ -2%", function()
awesome.emit_signal("module::volume_osd:show", true)
awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun")
end)
end,
{ description = "Lower volume", group = "System" }
),
awful.key(
{},
"XF86AudioRaiseVolume",
function(c)
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ +2%", function()
awesome.emit_signal("module::volume_osd:show", true)
awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun")
end)
end,
{ description = "Increase volume", group = "System" }
),
awful.key(
{},
"XF86AudioMute",
function(c)
awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")
awesome.emit_signal("module::volume_osd:show", true)
awesome.emit_signal("module::slider:update")
awesome.emit_signal("widget::volume_osd:rerun")
end,
{ description = "Mute volume", group = "System" }
),
awful.key(
{},
"XF86MonBrightnessUp",
function(c)
--awful.spawn("xbacklight -time 100 -inc 10%+")
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(stdout)
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) + BACKLIGHT_SEPS), function(stdou2)
end)
awesome.emit_signal("module::brightness_osd:show", true)
awesome.emit_signal("module::brightness_slider:update")
awesome.emit_signal("widget::brightness_osd:rerun")
end
)
end,
{ description = "Raise backlight brightness", group = "System" }
),
awful.key(
{},
"XF86MonBrightnessDown",
function(c)
awful.spawn.easy_async_with_shell(
"pkexec xfpm-power-backlight-helper --get-brightness",
function(stdout)
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) - BACKLIGHT_SEPS), function(stdout2)
end)
awesome.emit_signal("module::brightness_osd:show", true)
awesome.emit_signal("module::brightness_slider:update")
awesome.emit_signal("widget::brightness_osd:rerun")
end
)
end,
{ description = "Lower backlight brightness", group = "System" }
),
awful.key(
{},
"XF86AudioPlay",
function(c)
awful.spawn("playerctl play-pause")
end,
{ description = "Play / Pause audio", group = "System" }
),
awful.key(
{},
"XF86AudioNext",
function(c)
awful.spawn("playerctl next")
end,
{ description = "Play / Pause audio", group = "System" }
),
awful.key(
{},
"XF86AudioPrev",
function(c)
awful.spawn("playerctl previous")
end,
{ description = "Play / Pause audio", group = "System" }
),
-- awful.key(
-- { "Mod1" },
-- "#50",
-- function()
-- awesome.emit_signal("kblayout::toggle")
-- end,
-- { description = "Toggle keyboard layout", group = "System" }
-- ),
awful.key(
{ modkey },
"#22",
function()
awful.spawn.easy_async_with_shell(
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
function(stdout)
if stdout then
ruled.client.append_rule {
rule = { class = stdout:gsub("\n", "") },
properties = {
floating = true
},
}
awful.spawn.easy_async_with_shell(
"cat ~/.config/awesome/src/assets/rules.txt",
function(stdout2)
for class in stdout2:gmatch("%a+") do
if class:match(stdout:gsub("\n", "")) then
return
end
end
awful.spawn.with_shell("echo -n '" .. stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
local c = mouse.screen.selected_tag:clients()
for j, client in ipairs(c) do
if client.class:match(stdout:gsub("\n", "")) then
client.floating = true
end
end
end
)
end
end
)
end
),
awful.key(
{ modkey, "Shift" },
"#22",
function()
awful.spawn.easy_async_with_shell(
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
function(stdout)
if stdout then
ruled.client.append_rule {
rule = { class = stdout:gsub("\n", "") },
properties = {
floating = false
},
}
awful.spawn.easy_async_with_shell(
[[
REMOVE="]] .. stdout:gsub("\n", "") .. [[;"
STR=$(cat ~/.config/awesome/src/assets/rules.txt)
echo -n ${STR//$REMOVE/} > ~/.config/awesome/src/assets/rules.txt
]],
function(stdout2)
local c = mouse.screen.selected_tag:clients()
for j, client in ipairs(c) do
if client.class:match(stdout:gsub("\n", "")) then
client.floating = false
end
end
end
)
end
end
)
end
)
)