Org File Headers
- Organize awesome config into sections in README.org - Replace taglist with a variable - Remove wallpaper setting within awesome
This commit is contained in:
303
README.org
303
README.org
@@ -8,13 +8,35 @@
|
||||
- [[#libraries][Libraries]]
|
||||
- [[#error-handling][Error Handling]]
|
||||
- [[#variable-definitions][Variable Definitions]]
|
||||
- [[#menu][Menu]]
|
||||
- [[#keyboard-map-indicator-and-switcher][Keyboard Map Indicator and Switcher]]
|
||||
- [[#wibar][Wibar]]
|
||||
- [[#mouse-bindings][Mouse Bindings]]
|
||||
- [[#key-bindings][Key Bindings]]
|
||||
- [[#file-paths][File Paths]]
|
||||
- [[#themes][Themes]]
|
||||
- [[#commands][Commands]]
|
||||
- [[#modkey][Modkey]]
|
||||
- [[#layouts][Layouts]]
|
||||
- [[#tags][Tags]]
|
||||
- [[#status-bar][Status Bar]]
|
||||
- [[#launcher-and-main-menu][Launcher and Main Menu]]
|
||||
- [[#keyboard-map-indicator-and-switcher][Keyboard Map Indicator and Switcher]]
|
||||
- [[#clock][Clock]]
|
||||
- [[#tag-list][Tag List]]
|
||||
- [[#task-list][Task List]]
|
||||
- [[#setup-status-bar-per-screen][Setup Status Bar per Screen]]
|
||||
- [[#bindings][Bindings]]
|
||||
- [[#mouse][Mouse]]
|
||||
- [[#global][Global]]
|
||||
- [[#client][Client]]
|
||||
- [[#keyboard][Keyboard]]
|
||||
- [[#global-1][Global]]
|
||||
- [[#client-1][Client]]
|
||||
- [[#numbers-to-tags][Numbers to Tags]]
|
||||
- [[#set-keys][Set Keys]]
|
||||
- [[#rules][Rules]]
|
||||
- [[#signals][Signals]]
|
||||
- [[#new-client-appears][New Client Appears]]
|
||||
- [[#titlebar][Titlebar]]
|
||||
- [[#focus][Focus]]
|
||||
- [[#sloppy-focus-focus-follows-mouse][Sloppy Focus (Focus follows Mouse)]]
|
||||
- [[#border-color][Border Color]]
|
||||
- [[#theme][Theme]]
|
||||
|
||||
* Welcome
|
||||
@@ -30,43 +52,66 @@ Run the block below with ~C-c C-c~ to tangle code blocks to config file.
|
||||
|
||||
* Libraries
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- If LuaRocks is installed, make sure that packages installed through it are
|
||||
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||
pcall(require, "luarocks.loader")
|
||||
If LuaRocks is installed, make sure that packages installed through it are found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||
|
||||
-- Standard awesome library
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
pcall(require, "luarocks.loader")
|
||||
#+END_SRC
|
||||
|
||||
Standard awesome library
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
require("awful.autofocus")
|
||||
-- Widget and layout library
|
||||
local wibox = require("wibox")
|
||||
-- Theme handling library
|
||||
local beautiful = require("beautiful")
|
||||
-- Notification library
|
||||
local naughty = require("naughty")
|
||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||
-- Enable hotkeys help widget for VIM and other apps
|
||||
-- when client with a matching name is opened:
|
||||
require("awful.hotkeys_popup.keys")
|
||||
#+END_SRC
|
||||
|
||||
-- Automatically move and center mouse cursors to the focused window
|
||||
Widget and layout library
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
local wibox = require("wibox")
|
||||
#+END_SRC
|
||||
|
||||
Theme handling library
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
local beautiful = require("beautiful")
|
||||
#+END_SRC
|
||||
|
||||
Notification library
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
local naughty = require("naughty")
|
||||
#+END_SRC
|
||||
|
||||
Enable hotkeys help widget for VIM and other apps when client with a matching name is opened:
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||
require("awful.hotkeys_popup.keys")
|
||||
#+END_SRC
|
||||
|
||||
Automatically move and center mouse cursors to the focused window
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
require("awesomewm-micky")
|
||||
#+END_SRC
|
||||
|
||||
* 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)
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ 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
|
||||
#+END_SRC
|
||||
|
||||
-- Handle runtime errors after startup
|
||||
Handle runtime errors after startup
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
do
|
||||
local in_error = false
|
||||
awesome.connect_signal("debug::error", function (err)
|
||||
@@ -80,26 +125,32 @@ do
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Variable Definitions
|
||||
|
||||
** File Paths
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ Variable definitions
|
||||
-- Filepaths
|
||||
home_path = "/home/sravan"
|
||||
awesome_config_path = home_path .. "/.config/awesome"
|
||||
awesome_config_file = awesome_config_path .. "/" .. "README.org"
|
||||
awesome_theme_file = awesome_config_path .. "/" .. "theme.lua"
|
||||
#+END_SRC
|
||||
|
||||
-- Themes define colours, icons, font and wallpapers.
|
||||
** Themes
|
||||
|
||||
Themes define colours, icons, font and wallpapers.
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
beautiful.init(awesome_theme_file)
|
||||
#+END_SRC
|
||||
|
||||
-- This is used later as the default terminal and editor to run.
|
||||
terminal = "kitty"
|
||||
editor = os.getenv("EDITOR") or "emacs"
|
||||
** Commands
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
terminal_cmd = "kitty"
|
||||
editor_cmd = os.getenv("EDITOR") or "emacs"
|
||||
rofi_cmd = "rofi -show combi"
|
||||
control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi"
|
||||
brightness_cmd = "/home/sravan/.scripts/brightness.sh --rofi"
|
||||
@@ -119,15 +170,24 @@ player_prev_cmd = "/home/sravan/.scripts/playerctl.sh --prev"
|
||||
flameshot_cmd = "flameshot gui"
|
||||
force_close_window_cmd = "xkill"
|
||||
trackpad_toggle_cmd = "/home/sravan/.scripts/trackpad.sh"
|
||||
#+END_SRC
|
||||
|
||||
-- Default modkey.
|
||||
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
||||
-- If you do not like this or do not have such a key,
|
||||
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
|
||||
-- However, you can use another modifier like Mod1, but it may interact with others.
|
||||
** Modkey
|
||||
|
||||
Default modkey.
|
||||
Usually, Mod4 is the key with a logo between Control and Alt (Super key).
|
||||
If you do not like this or do not have such a key, I suggest you to remap Mod4 to another key using xmodmap or other tools.
|
||||
However, you can use another modifier like Mod1, but it may interact with others.
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
modkey = "Mod4"
|
||||
#+END_SRC
|
||||
|
||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
** Layouts
|
||||
|
||||
Table of layouts to cover with awful.layout.inc, order matters.
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
awful.layout.layouts = {
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.left,
|
||||
@@ -146,47 +206,59 @@ awful.layout.layouts = {
|
||||
-- awful.layout.suit.corner.se,
|
||||
awful.layout.suit.floating,
|
||||
}
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Menu
|
||||
** Tags
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
taglist = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" }
|
||||
#+END_SRC
|
||||
|
||||
* Status Bar
|
||||
|
||||
** Launcher and Main Menu
|
||||
|
||||
Create a launcher widget and a main menu
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ Menu
|
||||
-- Create a launcher widget and a main menu
|
||||
myawesomemenu = {
|
||||
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
|
||||
{ "manual", terminal .. " -e man awesome" },
|
||||
{ "edit config", editor .. " " .. awesome_config_file },
|
||||
{ "manual", terminal_cmd .. " -e man awesome" },
|
||||
{ "edit config", editor_cmd .. " " .. awesome_config_file },
|
||||
{ "restart", awesome.restart },
|
||||
{ "quit", function() awesome.quit() end },
|
||||
}
|
||||
|
||||
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
{ "open terminal", terminal }
|
||||
{ "open terminal", terminal_cmd }
|
||||
}
|
||||
})
|
||||
|
||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
||||
menu = mymainmenu })
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Keyboard Map Indicator and Switcher
|
||||
** Keyboard Map Indicator and Switcher
|
||||
|
||||
Keyboard map indicator and switcher
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- Keyboard map indicator and switcher
|
||||
mykeyboardlayout = awful.widget.keyboardlayout()
|
||||
#+END_SRC
|
||||
|
||||
* Wibar
|
||||
** Clock
|
||||
|
||||
Create a textclock widget
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ Wibar
|
||||
-- Create a textclock widget
|
||||
mytextclock = wibox.widget.textclock()
|
||||
#+END_SRC
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
** Tag List
|
||||
|
||||
Create a wibox for each screen and add it
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
local taglist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function(t) t:view_only() end),
|
||||
awful.button({ modkey }, 1, function(t)
|
||||
@@ -203,7 +275,11 @@ local taglist_buttons = gears.table.join(
|
||||
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
|
||||
awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end)
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
** Task List
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
local tasklist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function (c)
|
||||
if c == client.focus then
|
||||
@@ -225,28 +301,14 @@ local tasklist_buttons = gears.table.join(
|
||||
awful.button({ }, 5, function ()
|
||||
awful.client.focus.byidx(-1)
|
||||
end))
|
||||
#+END_SRC
|
||||
|
||||
local function set_wallpaper(s)
|
||||
-- Wallpaper
|
||||
if beautiful.wallpaper then
|
||||
local wallpaper = beautiful.wallpaper
|
||||
-- If wallpaper is a function, call it with the screen
|
||||
if type(wallpaper) == "function" then
|
||||
wallpaper = wallpaper(s)
|
||||
end
|
||||
gears.wallpaper.maximized(wallpaper, s, true)
|
||||
end
|
||||
end
|
||||
|
||||
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
||||
screen.connect_signal("property::geometry", set_wallpaper)
|
||||
** Setup Status Bar per Screen
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
-- Wallpaper
|
||||
-- set_wallpaper(s)
|
||||
|
||||
-- Each screen has its own tag table.
|
||||
awful.tag({ " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" }, s, awful.layout.layouts[1])
|
||||
awful.tag(taglist, s, awful.layout.layouts[1])
|
||||
|
||||
-- Create a promptbox for each screen
|
||||
s.mypromptbox = awful.widget.prompt()
|
||||
@@ -294,25 +356,45 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
},
|
||||
}
|
||||
end)
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Mouse Bindings
|
||||
* Bindings
|
||||
|
||||
** Mouse
|
||||
|
||||
*** Global
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ Mouse bindings
|
||||
root.buttons(gears.table.join(
|
||||
awful.button({ }, 3, function () mymainmenu:toggle() end),
|
||||
awful.button({ }, 4, awful.tag.viewnext),
|
||||
awful.button({ }, 5, awful.tag.viewprev)
|
||||
))
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Key Bindings
|
||||
*** Client
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
clientbuttons = 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)
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
** Keyboard
|
||||
|
||||
*** Global
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ Key bindings
|
||||
globalkeys = gears.table.join(
|
||||
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
||||
{description="show help", group="awesome"}),
|
||||
@@ -359,7 +441,7 @@ globalkeys = gears.table.join(
|
||||
{description = "go back", group = "client"}),
|
||||
|
||||
-- Standard program
|
||||
awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal) end,
|
||||
awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal_cmd) end,
|
||||
{description = "open a terminal", group = "launcher"}),
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
{description = "reload awesome", group = "awesome"}),
|
||||
@@ -454,7 +536,11 @@ globalkeys = gears.table.join(
|
||||
awful.key({ modkey, "Shift", "Control" }, "c", function () awful.spawn(force_close_window_cmd) end,
|
||||
{description = "force close window", group = "misc"})
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
*** Client
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
clientkeys = gears.table.join(
|
||||
awful.key({ modkey, "Shift" }, "f",
|
||||
function (c)
|
||||
@@ -498,10 +584,15 @@ clientkeys = gears.table.join(
|
||||
end ,
|
||||
{description = "(un)maximize horizontally", group = "client"})
|
||||
)
|
||||
#+END_SRC
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it work on any keyboard layout.
|
||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||
*** Numbers to Tags
|
||||
|
||||
Bind all key numbers to tags.
|
||||
Be careful: we use keycodes to make it work on any keyboard layout.
|
||||
This should map on the top row of your keyboard, usually 1 to 9.
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
for i = 1, 9 do
|
||||
globalkeys = gears.table.join(globalkeys,
|
||||
-- View tag only.
|
||||
@@ -548,31 +639,19 @@ for i = 1, 9 do
|
||||
{description = "toggle focused client on tag #" .. i, group = "tag"})
|
||||
)
|
||||
end
|
||||
#+END_SRC
|
||||
|
||||
clientbuttons = 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)
|
||||
)
|
||||
*** Set Keys
|
||||
|
||||
-- Set keys
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
root.keys(globalkeys)
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Rules
|
||||
|
||||
Rules to apply to new clients (through the "manage" signal).
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ Rules
|
||||
-- Rules to apply to new clients (through the "manage" signal).
|
||||
awful.rules.rules = {
|
||||
-- All clients will match this rule.
|
||||
{ rule = { },
|
||||
@@ -620,21 +699,22 @@ awful.rules.rules = {
|
||||
|
||||
-- Add titlebars to normal clients and dialogs
|
||||
{ rule_any = {type = { "normal", "dialog" }
|
||||
}, properties = { titlebars_enabled = false }
|
||||
}, properties = { titlebars_enabled = false } -- Enable/Disable Titlebars here
|
||||
},
|
||||
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
-- { rule = { class = "Firefox" },
|
||||
-- properties = { screen = 1, tag = "2" } },
|
||||
}
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Signals
|
||||
|
||||
** New Client Appears
|
||||
|
||||
Signal function to execute when a new client appears.
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
-- {{{ Signals
|
||||
-- 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.
|
||||
@@ -647,8 +727,13 @@ client.connect_signal("manage", function (c)
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
end)
|
||||
#+END_SRC
|
||||
|
||||
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||
** Titlebar
|
||||
|
||||
Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
client.connect_signal("request::titlebars", function(c)
|
||||
-- buttons for the titlebar
|
||||
local buttons = gears.table.join(
|
||||
@@ -687,15 +772,25 @@ client.connect_signal("request::titlebars", function(c)
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
end)
|
||||
#+END_SRC
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
** Focus
|
||||
|
||||
*** Sloppy Focus (Focus follows Mouse)
|
||||
|
||||
Enable sloppy focus, so that focus follows mouse.
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
client.connect_signal("mouse::enter", function(c)
|
||||
c:emit_signal("request::activate", "mouse_enter", {raise = false})
|
||||
end)
|
||||
#+END_SRC
|
||||
|
||||
*** Border Color
|
||||
|
||||
#+BEGIN_SRC lua :tangle rc.lua
|
||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||
-- }}}
|
||||
#+END_SRC
|
||||
|
||||
* Theme
|
||||
|
118
rc.lua
118
rc.lua
@@ -1,35 +1,26 @@
|
||||
-- If LuaRocks is installed, make sure that packages installed through it are
|
||||
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
|
||||
pcall(require, "luarocks.loader")
|
||||
|
||||
-- Standard awesome library
|
||||
local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
require("awful.autofocus")
|
||||
-- Widget and layout library
|
||||
|
||||
local wibox = require("wibox")
|
||||
-- Theme handling library
|
||||
|
||||
local beautiful = require("beautiful")
|
||||
-- Notification library
|
||||
|
||||
local naughty = require("naughty")
|
||||
|
||||
local hotkeys_popup = require("awful.hotkeys_popup")
|
||||
-- Enable hotkeys help widget for VIM and other apps
|
||||
-- when client with a matching name is opened:
|
||||
require("awful.hotkeys_popup.keys")
|
||||
|
||||
-- Automatically move and center mouse cursors to the focused window
|
||||
require("awesomewm-micky")
|
||||
|
||||
-- {{{ 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)
|
||||
@@ -43,22 +34,16 @@ do
|
||||
in_error = false
|
||||
end)
|
||||
end
|
||||
-- }}}
|
||||
|
||||
-- {{{ Variable definitions
|
||||
-- Filepaths
|
||||
home_path = "/home/sravan"
|
||||
awesome_config_path = home_path .. "/.config/awesome"
|
||||
awesome_config_file = awesome_config_path .. "/" .. "README.org"
|
||||
awesome_theme_file = awesome_config_path .. "/" .. "theme.lua"
|
||||
|
||||
-- Themes define colours, icons, font and wallpapers.
|
||||
beautiful.init(awesome_theme_file)
|
||||
|
||||
-- This is used later as the default terminal and editor to run.
|
||||
terminal = "kitty"
|
||||
editor = os.getenv("EDITOR") or "emacs"
|
||||
|
||||
terminal_cmd = "kitty"
|
||||
editor_cmd = os.getenv("EDITOR") or "emacs"
|
||||
rofi_cmd = "rofi -show combi"
|
||||
control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi"
|
||||
brightness_cmd = "/home/sravan/.scripts/brightness.sh --rofi"
|
||||
@@ -79,14 +64,8 @@ flameshot_cmd = "flameshot gui"
|
||||
force_close_window_cmd = "xkill"
|
||||
trackpad_toggle_cmd = "/home/sravan/.scripts/trackpad.sh"
|
||||
|
||||
-- Default modkey.
|
||||
-- Usually, Mod4 is the key with a logo between Control and Alt.
|
||||
-- If you do not like this or do not have such a key,
|
||||
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
|
||||
-- However, you can use another modifier like Mod1, but it may interact with others.
|
||||
modkey = "Mod4"
|
||||
|
||||
-- Table of layouts to cover with awful.layout.inc, order matters.
|
||||
awful.layout.layouts = {
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.left,
|
||||
@@ -105,35 +84,29 @@ awful.layout.layouts = {
|
||||
-- awful.layout.suit.corner.se,
|
||||
awful.layout.suit.floating,
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ Menu
|
||||
-- Create a launcher widget and a main menu
|
||||
taglist = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" }
|
||||
|
||||
myawesomemenu = {
|
||||
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
|
||||
{ "manual", terminal .. " -e man awesome" },
|
||||
{ "edit config", editor .. " " .. awesome_config_file },
|
||||
{ "manual", terminal_cmd .. " -e man awesome" },
|
||||
{ "edit config", editor_cmd .. " " .. awesome_config_file },
|
||||
{ "restart", awesome.restart },
|
||||
{ "quit", function() awesome.quit() end },
|
||||
}
|
||||
|
||||
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
|
||||
{ "open terminal", terminal }
|
||||
{ "open terminal", terminal_cmd }
|
||||
}
|
||||
})
|
||||
|
||||
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
|
||||
menu = mymainmenu })
|
||||
-- }}}
|
||||
|
||||
-- Keyboard map indicator and switcher
|
||||
mykeyboardlayout = awful.widget.keyboardlayout()
|
||||
|
||||
-- {{{ Wibar
|
||||
-- Create a textclock widget
|
||||
mytextclock = wibox.widget.textclock()
|
||||
|
||||
-- Create a wibox for each screen and add it
|
||||
local taglist_buttons = gears.table.join(
|
||||
awful.button({ }, 1, function(t) t:view_only() end),
|
||||
awful.button({ modkey }, 1, function(t)
|
||||
@@ -173,27 +146,9 @@ local tasklist_buttons = gears.table.join(
|
||||
awful.client.focus.byidx(-1)
|
||||
end))
|
||||
|
||||
local function set_wallpaper(s)
|
||||
-- Wallpaper
|
||||
if beautiful.wallpaper then
|
||||
local wallpaper = beautiful.wallpaper
|
||||
-- If wallpaper is a function, call it with the screen
|
||||
if type(wallpaper) == "function" then
|
||||
wallpaper = wallpaper(s)
|
||||
end
|
||||
gears.wallpaper.maximized(wallpaper, s, true)
|
||||
end
|
||||
end
|
||||
|
||||
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
|
||||
screen.connect_signal("property::geometry", set_wallpaper)
|
||||
|
||||
awful.screen.connect_for_each_screen(function(s)
|
||||
-- Wallpaper
|
||||
-- set_wallpaper(s)
|
||||
|
||||
-- Each screen has its own tag table.
|
||||
awful.tag({ " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" }, s, awful.layout.layouts[1])
|
||||
awful.tag(taglist, s, awful.layout.layouts[1])
|
||||
|
||||
-- Create a promptbox for each screen
|
||||
s.mypromptbox = awful.widget.prompt()
|
||||
@@ -241,17 +196,27 @@ awful.screen.connect_for_each_screen(function(s)
|
||||
},
|
||||
}
|
||||
end)
|
||||
-- }}}
|
||||
|
||||
-- {{{ Mouse bindings
|
||||
root.buttons(gears.table.join(
|
||||
awful.button({ }, 3, function () mymainmenu:toggle() end),
|
||||
awful.button({ }, 4, awful.tag.viewnext),
|
||||
awful.button({ }, 5, awful.tag.viewprev)
|
||||
))
|
||||
-- }}}
|
||||
|
||||
-- {{{ Key bindings
|
||||
clientbuttons = 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)
|
||||
)
|
||||
|
||||
globalkeys = gears.table.join(
|
||||
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
|
||||
{description="show help", group="awesome"}),
|
||||
@@ -298,7 +263,7 @@ globalkeys = gears.table.join(
|
||||
{description = "go back", group = "client"}),
|
||||
|
||||
-- Standard program
|
||||
awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal) end,
|
||||
awful.key({ modkey, "Shift" }, "Return", function () awful.spawn(terminal_cmd) end,
|
||||
{description = "open a terminal", group = "launcher"}),
|
||||
awful.key({ modkey, "Control" }, "r", awesome.restart,
|
||||
{description = "reload awesome", group = "awesome"}),
|
||||
@@ -438,9 +403,6 @@ clientkeys = gears.table.join(
|
||||
{description = "(un)maximize horizontally", group = "client"})
|
||||
)
|
||||
|
||||
-- Bind all key numbers to tags.
|
||||
-- Be careful: we use keycodes to make it work on any keyboard layout.
|
||||
-- This should map on the top row of your keyboard, usually 1 to 9.
|
||||
for i = 1, 9 do
|
||||
globalkeys = gears.table.join(globalkeys,
|
||||
-- View tag only.
|
||||
@@ -488,26 +450,8 @@ for i = 1, 9 do
|
||||
)
|
||||
end
|
||||
|
||||
clientbuttons = 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)
|
||||
)
|
||||
|
||||
-- Set keys
|
||||
root.keys(globalkeys)
|
||||
-- }}}
|
||||
|
||||
-- {{{ Rules
|
||||
-- Rules to apply to new clients (through the "manage" signal).
|
||||
awful.rules.rules = {
|
||||
-- All clients will match this rule.
|
||||
{ rule = { },
|
||||
@@ -555,17 +499,14 @@ awful.rules.rules = {
|
||||
|
||||
-- Add titlebars to normal clients and dialogs
|
||||
{ rule_any = {type = { "normal", "dialog" }
|
||||
}, properties = { titlebars_enabled = false }
|
||||
}, properties = { titlebars_enabled = false } -- Enable/Disable Titlebars here
|
||||
},
|
||||
|
||||
-- Set Firefox to always map on the tag named "2" on screen 1.
|
||||
-- { rule = { class = "Firefox" },
|
||||
-- properties = { screen = 1, tag = "2" } },
|
||||
}
|
||||
-- }}}
|
||||
|
||||
-- {{{ Signals
|
||||
-- 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.
|
||||
@@ -579,7 +520,6 @@ client.connect_signal("manage", function (c)
|
||||
end
|
||||
end)
|
||||
|
||||
-- Add a titlebar if titlebars_enabled is set to true in the rules.
|
||||
client.connect_signal("request::titlebars", function(c)
|
||||
-- buttons for the titlebar
|
||||
local buttons = gears.table.join(
|
||||
@@ -619,11 +559,9 @@ client.connect_signal("request::titlebars", function(c)
|
||||
}
|
||||
end)
|
||||
|
||||
-- Enable sloppy focus, so that focus follows mouse.
|
||||
client.connect_signal("mouse::enter", function(c)
|
||||
c:emit_signal("request::activate", "mouse_enter", {raise = false})
|
||||
end)
|
||||
|
||||
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end)
|
||||
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
|
||||
-- }}}
|
||||
|
Reference in New Issue
Block a user