💄 feat: Working on awesome config
This commit is contained in:
parent
16c14d94f0
commit
1e9a51b398
6 changed files with 86 additions and 71 deletions
4
.config/awesome/.luarc.json
Normal file
4
.config/awesome/.luarc.json
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"$schema": "https://raw.githubusercontent.com/LuaLS/vscode-lua/master/setting/schema.json",
|
||||||
|
"diagnostics.globals": ["awesome", "client"]
|
||||||
|
}
|
7
.config/awesome/main/apps.lua
Normal file
7
.config/awesome/main/apps.lua
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
local apps = {
|
||||||
|
terminal = "wezterm",
|
||||||
|
browser = "firefox",
|
||||||
|
editor = os.getenv("EDITOR") or "nvim",
|
||||||
|
}
|
||||||
|
|
||||||
|
return apps
|
33
.config/awesome/main/error_handling.lua
Normal file
33
.config/awesome/main/error_handling.lua
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
-- Notification library
|
||||||
|
local naughty = require("naughty")
|
||||||
|
|
||||||
|
-- {{{ Error handling
|
||||||
|
-- Check if awesome encountered an error during startup and fell back to
|
||||||
|
-- another config (This code will only ever execute for the fallback config)
|
||||||
|
if awesome.startup_errors then
|
||||||
|
naughty.notify({
|
||||||
|
preset = naughty.config.presets.critical,
|
||||||
|
title = "Oops, there were errors during startup!",
|
||||||
|
text = awesome.startup_errors,
|
||||||
|
})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Handle runtime errors after startup
|
||||||
|
do
|
||||||
|
local in_error = false
|
||||||
|
awesome.connect_signal("debug::error", function(err)
|
||||||
|
-- Make sure we don't go into an endless error loop
|
||||||
|
if in_error then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
in_error = true
|
||||||
|
|
||||||
|
naughty.notify({
|
||||||
|
preset = naughty.config.presets.critical,
|
||||||
|
title = "Oops, an error happened!",
|
||||||
|
text = tostring(err),
|
||||||
|
})
|
||||||
|
in_error = false
|
||||||
|
end)
|
||||||
|
end
|
||||||
|
-- }}}
|
1
.config/awesome/main/init.lua
Normal file
1
.config/awesome/main/init.lua
Normal file
|
@ -0,0 +1 @@
|
||||||
|
require("main.error_handling")
|
32
.config/awesome/main/layout.lua
Normal file
32
.config/awesome/main/layout.lua
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
local awful = require("awful")
|
||||||
|
|
||||||
|
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||||
|
awful.layout.layouts = {
|
||||||
|
awful.layout.suit.floating,
|
||||||
|
awful.layout.suit.tile,
|
||||||
|
awful.layout.suit.tile.left,
|
||||||
|
awful.layout.suit.tile.bottom,
|
||||||
|
awful.layout.suit.tile.top,
|
||||||
|
awful.layout.suit.fair,
|
||||||
|
awful.layout.suit.fair.horizontal,
|
||||||
|
awful.layout.suit.spiral,
|
||||||
|
awful.layout.suit.spiral.dwindle,
|
||||||
|
awful.layout.suit.max,
|
||||||
|
awful.layout.suit.max.fullscreen,
|
||||||
|
awful.layout.suit.magnifier,
|
||||||
|
awful.layout.suit.corner.nw,
|
||||||
|
-- awful.layout.suit.corner.ne,
|
||||||
|
-- awful.layout.suit.corner.sw,
|
||||||
|
-- awful.layout.suit.corner.se,
|
||||||
|
}
|
||||||
|
|
||||||
|
client.connect_signal("manage", function(c)
|
||||||
|
-- Set the windows at the slave,
|
||||||
|
-- i.e. put it at the end of others instead of setting it master.
|
||||||
|
-- if not awesome.startup then awful.client.setslave(c) end
|
||||||
|
|
||||||
|
if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
|
||||||
|
-- Prevent clients from being unreachable after screen count changes.
|
||||||
|
awful.placement.no_offscreen(c)
|
||||||
|
end
|
||||||
|
end)
|
|
@ -10,53 +10,21 @@ require("awful.autofocus")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
-- Theme handling library
|
-- Theme handling library
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
-- Notification library
|
|
||||||
local naughty = require("naughty")
|
|
||||||
local menubar = require("menubar")
|
local menubar = require("menubar")
|
||||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||||
-- Enable hotkeys help widget for VIM and other apps
|
-- Enable hotkeys help widget for VIM and other apps
|
||||||
-- when client with a matching name is opened:
|
-- when client with a matching name is opened:
|
||||||
require("awful.hotkeys_popup.keys")
|
require("awful.hotkeys_popup.keys")
|
||||||
|
|
||||||
-- {{{ Error handling
|
-- Main/Configuration --
|
||||||
-- Check if awesome encountered an error during startup and fell back to
|
require("main")
|
||||||
-- another config (This code will only ever execute for the fallback config)
|
|
||||||
if awesome.startup_errors then
|
|
||||||
naughty.notify({
|
|
||||||
preset = naughty.config.presets.critical,
|
|
||||||
title = "Oops, there were errors during startup!",
|
|
||||||
text = awesome.startup_errors,
|
|
||||||
})
|
|
||||||
end
|
|
||||||
|
|
||||||
-- Handle runtime errors after startup
|
|
||||||
do
|
|
||||||
local in_error = false
|
|
||||||
awesome.connect_signal("debug::error", function(err)
|
|
||||||
-- Make sure we don't go into an endless error loop
|
|
||||||
if in_error then
|
|
||||||
return
|
|
||||||
end
|
|
||||||
in_error = true
|
|
||||||
|
|
||||||
naughty.notify({
|
|
||||||
preset = naughty.config.presets.critical,
|
|
||||||
title = "Oops, an error happened!",
|
|
||||||
text = tostring(err),
|
|
||||||
})
|
|
||||||
in_error = false
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
-- }}}
|
|
||||||
|
|
||||||
-- {{{ Variable definitions
|
-- {{{ Variable definitions
|
||||||
-- Themes define colours, icons, font and wallpapers.
|
-- Themes define colours, icons, font and wallpapers.
|
||||||
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
|
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
|
||||||
|
|
||||||
-- This is used later as the default terminal and editor to run.
|
local vars = require("main.apps")
|
||||||
terminal = "wezterm"
|
|
||||||
editor = os.getenv("EDITOR") or "nvim"
|
|
||||||
editor_cmd = terminal .. " -e " .. editor
|
|
||||||
|
|
||||||
-- Default modkey.
|
-- Default modkey.
|
||||||
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
||||||
|
@ -65,25 +33,6 @@ editor_cmd = terminal .. " -e " .. editor
|
||||||
-- However, you can use another modifier like Mod1, but it may interact with others.
|
-- However, you can use another modifier like Mod1, but it may interact with others.
|
||||||
modkey = "Mod4"
|
modkey = "Mod4"
|
||||||
|
|
||||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
|
||||||
awful.layout.layouts = {
|
|
||||||
awful.layout.suit.floating,
|
|
||||||
awful.layout.suit.tile,
|
|
||||||
awful.layout.suit.tile.left,
|
|
||||||
awful.layout.suit.tile.bottom,
|
|
||||||
awful.layout.suit.tile.top,
|
|
||||||
awful.layout.suit.fair,
|
|
||||||
awful.layout.suit.fair.horizontal,
|
|
||||||
awful.layout.suit.spiral,
|
|
||||||
awful.layout.suit.spiral.dwindle,
|
|
||||||
awful.layout.suit.max,
|
|
||||||
awful.layout.suit.max.fullscreen,
|
|
||||||
awful.layout.suit.magnifier,
|
|
||||||
awful.layout.suit.corner.nw,
|
|
||||||
-- awful.layout.suit.corner.ne,
|
|
||||||
-- awful.layout.suit.corner.sw,
|
|
||||||
-- awful.layout.suit.corner.se,
|
|
||||||
}
|
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- {{{ Menu
|
-- {{{ Menu
|
||||||
|
@ -95,8 +44,7 @@ myawesomemenu = {
|
||||||
hotkeys_popup.show_help(nil, awful.screen.focused())
|
hotkeys_popup.show_help(nil, awful.screen.focused())
|
||||||
end,
|
end,
|
||||||
},
|
},
|
||||||
{ "manual", terminal .. " -e man awesome" },
|
{ "manual", vars.terminal .. " -e man awesome" },
|
||||||
{ "edit config", editor_cmd .. " " .. awesome.conffile },
|
|
||||||
{ "restart", awesome.restart },
|
{ "restart", awesome.restart },
|
||||||
{
|
{
|
||||||
"quit",
|
"quit",
|
||||||
|
@ -109,14 +57,14 @@ myawesomemenu = {
|
||||||
mymainmenu = awful.menu({
|
mymainmenu = awful.menu({
|
||||||
items = {
|
items = {
|
||||||
{ "awesome", myawesomemenu, beautiful.awesome_icon },
|
{ "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||||
{ "open terminal", terminal },
|
{ "open terminal", vars.terminal },
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
|
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, menu = mymainmenu })
|
||||||
|
|
||||||
-- Menubar configuration
|
-- Menubar configuration
|
||||||
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
|
menubar.utils.terminal = vars.terminal -- Set the terminal for applications that require it
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
-- Keyboard map indicator and switcher
|
-- Keyboard map indicator and switcher
|
||||||
|
@ -298,7 +246,7 @@ globalkeys = gears.table.join(
|
||||||
|
|
||||||
-- Standard program
|
-- Standard program
|
||||||
awful.key({ modkey }, "Return", function()
|
awful.key({ modkey }, "Return", function()
|
||||||
awful.spawn(terminal)
|
awful.spawn(vars.terminal)
|
||||||
end, { description = "open a terminal", group = "launcher" }),
|
end, { description = "open a terminal", group = "launcher" }),
|
||||||
awful.key({ modkey, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
|
awful.key({ modkey, "Control" }, "r", awesome.restart, { description = "reload awesome", group = "awesome" }),
|
||||||
awful.key({ modkey, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
|
awful.key({ modkey, "Shift" }, "q", awesome.quit, { description = "quit awesome", group = "awesome" }),
|
||||||
|
@ -522,17 +470,7 @@ awful.rules.rules = {
|
||||||
|
|
||||||
-- {{{ Signals
|
-- {{{ Signals
|
||||||
-- Signal function to execute when a new client appears.
|
-- Signal function to execute when a new client appears.
|
||||||
client.connect_signal("manage", function(c)
|
--
|
||||||
-- Set the windows at the slave,
|
|
||||||
-- i.e. put it at the end of others instead of setting it master.
|
|
||||||
-- if not awesome.startup then awful.client.setslave(c) end
|
|
||||||
|
|
||||||
if awesome.startup and not c.size_hints.user_position and not c.size_hints.program_position then
|
|
||||||
-- Prevent clients from being unreachable after screen count changes.
|
|
||||||
awful.placement.no_offscreen(c)
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
|
|
||||||
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||||
client.connect_signal("request::titlebars", function(c)
|
client.connect_signal("request::titlebars", function(c)
|
||||||
-- buttons for the titlebar
|
-- buttons for the titlebar
|
||||||
|
|
Loading…
Reference in a new issue