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:
Sravan Balaji
2023-03-25 19:16:37 -04:00
parent c9fcff10a8
commit 122669ed6f
2 changed files with 227 additions and 194 deletions

View File

@@ -8,13 +8,35 @@
- [[#libraries][Libraries]] - [[#libraries][Libraries]]
- [[#error-handling][Error Handling]] - [[#error-handling][Error Handling]]
- [[#variable-definitions][Variable Definitions]] - [[#variable-definitions][Variable Definitions]]
- [[#menu][Menu]] - [[#file-paths][File Paths]]
- [[#keyboard-map-indicator-and-switcher][Keyboard Map Indicator and Switcher]] - [[#themes][Themes]]
- [[#wibar][Wibar]] - [[#commands][Commands]]
- [[#mouse-bindings][Mouse Bindings]] - [[#modkey][Modkey]]
- [[#key-bindings][Key Bindings]] - [[#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]] - [[#rules][Rules]]
- [[#signals][Signals]] - [[#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]] - [[#theme][Theme]]
* Welcome * Welcome
@@ -30,43 +52,66 @@ Run the block below with ~C-c C-c~ to tangle code blocks to config file.
* Libraries * 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.
-- 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 #+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 gears = require("gears")
local awful = require("awful") local awful = require("awful")
require("awful.autofocus") require("awful.autofocus")
-- Widget and layout library #+END_SRC
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 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") require("awesomewm-micky")
#+END_SRC #+END_SRC
* Error Handling * 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 #+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 if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!", title = "Oops, there were errors during startup!",
text = awesome.startup_errors }) text = awesome.startup_errors })
end end
#+END_SRC
-- Handle runtime errors after startup Handle runtime errors after startup
#+BEGIN_SRC lua :tangle rc.lua
do do
local in_error = false local in_error = false
awesome.connect_signal("debug::error", function (err) awesome.connect_signal("debug::error", function (err)
@@ -80,26 +125,32 @@ do
in_error = false in_error = false
end) end)
end end
-- }}}
#+END_SRC #+END_SRC
* Variable Definitions * Variable Definitions
** File Paths
#+BEGIN_SRC lua :tangle rc.lua #+BEGIN_SRC lua :tangle rc.lua
-- {{{ Variable definitions
-- Filepaths
home_path = "/home/sravan" home_path = "/home/sravan"
awesome_config_path = home_path .. "/.config/awesome" awesome_config_path = home_path .. "/.config/awesome"
awesome_config_file = awesome_config_path .. "/" .. "README.org" awesome_config_file = awesome_config_path .. "/" .. "README.org"
awesome_theme_file = awesome_config_path .. "/" .. "theme.lua" 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) beautiful.init(awesome_theme_file)
#+END_SRC
-- This is used later as the default terminal and editor to run. ** Commands
terminal = "kitty"
editor = os.getenv("EDITOR") or "emacs"
#+BEGIN_SRC lua :tangle rc.lua
terminal_cmd = "kitty"
editor_cmd = os.getenv("EDITOR") or "emacs"
rofi_cmd = "rofi -show combi" rofi_cmd = "rofi -show combi"
control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi" control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi"
brightness_cmd = "/home/sravan/.scripts/brightness.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" flameshot_cmd = "flameshot gui"
force_close_window_cmd = "xkill" force_close_window_cmd = "xkill"
trackpad_toggle_cmd = "/home/sravan/.scripts/trackpad.sh" trackpad_toggle_cmd = "/home/sravan/.scripts/trackpad.sh"
#+END_SRC
-- Default modkey. ** 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, Default modkey.
-- I suggest you to remap Mod4 to another key using xmodmap or other tools. Usually, Mod4 is the key with a logo between Control and Alt (Super key).
-- However, you can use another modifier like Mod1, but it may interact with others. 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" 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.layouts = {
awful.layout.suit.tile, awful.layout.suit.tile,
awful.layout.suit.tile.left, awful.layout.suit.tile.left,
@@ -146,47 +206,59 @@ awful.layout.layouts = {
-- awful.layout.suit.corner.se, -- awful.layout.suit.corner.se,
awful.layout.suit.floating, awful.layout.suit.floating,
} }
-- }}}
#+END_SRC #+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 #+BEGIN_SRC lua :tangle rc.lua
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = { myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" }, { "manual", terminal_cmd .. " -e man awesome" },
{ "edit config", editor .. " " .. awesome_config_file }, { "edit config", editor_cmd .. " " .. awesome_config_file },
{ "restart", awesome.restart }, { "restart", awesome.restart },
{ "quit", function() awesome.quit() end }, { "quit", function() awesome.quit() end },
} }
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal } { "open terminal", terminal_cmd }
} }
}) })
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu }) menu = mymainmenu })
-- }}}
#+END_SRC #+END_SRC
* Keyboard Map Indicator and Switcher ** Keyboard Map Indicator and Switcher
Keyboard map indicator and switcher
#+BEGIN_SRC lua :tangle rc.lua #+BEGIN_SRC lua :tangle rc.lua
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout() mykeyboardlayout = awful.widget.keyboardlayout()
#+END_SRC #+END_SRC
* Wibar ** Clock
Create a textclock widget
#+BEGIN_SRC lua :tangle rc.lua #+BEGIN_SRC lua :tangle rc.lua
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock() 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( local taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end), awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t) 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({ }, 4, function(t) awful.tag.viewnext(t.screen) end),
awful.button({ }, 5, function(t) awful.tag.viewprev(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( local tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c) awful.button({ }, 1, function (c)
if c == client.focus then if c == client.focus then
@@ -225,28 +301,14 @@ local tasklist_buttons = gears.table.join(
awful.button({ }, 5, function () awful.button({ }, 5, function ()
awful.client.focus.byidx(-1) awful.client.focus.byidx(-1)
end)) end))
#+END_SRC
local function set_wallpaper(s) ** Setup Status Bar per Screen
-- 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)
#+BEGIN_SRC lua :tangle rc.lua
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
-- set_wallpaper(s)
-- Each screen has its own tag table. -- 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 -- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt() s.mypromptbox = awful.widget.prompt()
@@ -294,25 +356,45 @@ awful.screen.connect_for_each_screen(function(s)
}, },
} }
end) end)
-- }}}
#+END_SRC #+END_SRC
* Mouse Bindings * Bindings
** Mouse
*** Global
#+BEGIN_SRC lua :tangle rc.lua #+BEGIN_SRC lua :tangle rc.lua
-- {{{ Mouse bindings
root.buttons(gears.table.join( root.buttons(gears.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) awful.button({ }, 5, awful.tag.viewprev)
)) ))
-- }}}
#+END_SRC #+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 #+BEGIN_SRC lua :tangle rc.lua
-- {{{ Key bindings
globalkeys = gears.table.join( globalkeys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help, awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}), {description="show help", group="awesome"}),
@@ -359,7 +441,7 @@ globalkeys = gears.table.join(
{description = "go back", group = "client"}), {description = "go back", group = "client"}),
-- Standard program -- 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"}), {description = "open a terminal", group = "launcher"}),
awful.key({ modkey, "Control" }, "r", awesome.restart, awful.key({ modkey, "Control" }, "r", awesome.restart,
{description = "reload awesome", group = "awesome"}), {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, awful.key({ modkey, "Shift", "Control" }, "c", function () awful.spawn(force_close_window_cmd) end,
{description = "force close window", group = "misc"}) {description = "force close window", group = "misc"})
) )
#+END_SRC
*** Client
#+BEGIN_SRC lua :tangle rc.lua
clientkeys = gears.table.join( clientkeys = gears.table.join(
awful.key({ modkey, "Shift" }, "f", awful.key({ modkey, "Shift" }, "f",
function (c) function (c)
@@ -498,10 +584,15 @@ clientkeys = gears.table.join(
end , end ,
{description = "(un)maximize horizontally", group = "client"}) {description = "(un)maximize horizontally", group = "client"})
) )
#+END_SRC
-- Bind all key numbers to tags. *** 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. 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 for i = 1, 9 do
globalkeys = gears.table.join(globalkeys, globalkeys = gears.table.join(globalkeys,
-- View tag only. -- View tag only.
@@ -548,31 +639,19 @@ for i = 1, 9 do
{description = "toggle focused client on tag #" .. i, group = "tag"}) {description = "toggle focused client on tag #" .. i, group = "tag"})
) )
end end
#+END_SRC
clientbuttons = gears.table.join( *** Set Keys
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 #+BEGIN_SRC lua :tangle rc.lua
root.keys(globalkeys) root.keys(globalkeys)
-- }}}
#+END_SRC #+END_SRC
* Rules * Rules
Rules to apply to new clients (through the "manage" signal).
#+BEGIN_SRC lua :tangle rc.lua #+BEGIN_SRC lua :tangle rc.lua
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = { awful.rules.rules = {
-- All clients will match this rule. -- All clients will match this rule.
{ rule = { }, { rule = { },
@@ -620,21 +699,22 @@ awful.rules.rules = {
-- Add titlebars to normal clients and dialogs -- Add titlebars to normal clients and dialogs
{ rule_any = {type = { "normal", "dialog" } { 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. -- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" }, -- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } }, -- properties = { screen = 1, tag = "2" } },
} }
-- }}}
#+END_SRC #+END_SRC
* Signals * Signals
** New Client Appears
Signal function to execute when a new client appears.
#+BEGIN_SRC lua :tangle rc.lua #+BEGIN_SRC lua :tangle rc.lua
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c) client.connect_signal("manage", function (c)
-- Set the windows at the slave, -- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master. -- 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) awful.placement.no_offscreen(c)
end end
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) client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar -- buttons for the titlebar
local buttons = gears.table.join( local buttons = gears.table.join(
@@ -687,15 +772,25 @@ client.connect_signal("request::titlebars", function(c)
layout = wibox.layout.align.horizontal layout = wibox.layout.align.horizontal
} }
end) 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) client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:emit_signal("request::activate", "mouse_enter", {raise = false})
end) 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("focus", function(c) c.border_color = beautiful.border_focus end)
client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}
#+END_SRC #+END_SRC
* Theme * Theme

118
rc.lua
View File

@@ -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") pcall(require, "luarocks.loader")
-- Standard awesome library
local gears = require("gears") local gears = require("gears")
local awful = require("awful") local awful = require("awful")
require("awful.autofocus") require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox") local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful") local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty") local naughty = require("naughty")
local hotkeys_popup = require("awful.hotkeys_popup") 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") require("awful.hotkeys_popup.keys")
-- Automatically move and center mouse cursors to the focused window
require("awesomewm-micky") 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 if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!", title = "Oops, there were errors during startup!",
text = awesome.startup_errors }) text = awesome.startup_errors })
end end
-- Handle runtime errors after startup
do do
local in_error = false local in_error = false
awesome.connect_signal("debug::error", function (err) awesome.connect_signal("debug::error", function (err)
@@ -43,22 +34,16 @@ do
in_error = false in_error = false
end) end)
end end
-- }}}
-- {{{ Variable definitions
-- Filepaths
home_path = "/home/sravan" home_path = "/home/sravan"
awesome_config_path = home_path .. "/.config/awesome" awesome_config_path = home_path .. "/.config/awesome"
awesome_config_file = awesome_config_path .. "/" .. "README.org" awesome_config_file = awesome_config_path .. "/" .. "README.org"
awesome_theme_file = awesome_config_path .. "/" .. "theme.lua" awesome_theme_file = awesome_config_path .. "/" .. "theme.lua"
-- Themes define colours, icons, font and wallpapers.
beautiful.init(awesome_theme_file) beautiful.init(awesome_theme_file)
-- This is used later as the default terminal and editor to run. terminal_cmd = "kitty"
terminal = "kitty" editor_cmd = os.getenv("EDITOR") or "emacs"
editor = os.getenv("EDITOR") or "emacs"
rofi_cmd = "rofi -show combi" rofi_cmd = "rofi -show combi"
control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi" control_center_cmd = "/home/sravan/.scripts/control-center.sh --rofi"
brightness_cmd = "/home/sravan/.scripts/brightness.sh --rofi" brightness_cmd = "/home/sravan/.scripts/brightness.sh --rofi"
@@ -79,14 +64,8 @@ flameshot_cmd = "flameshot gui"
force_close_window_cmd = "xkill" force_close_window_cmd = "xkill"
trackpad_toggle_cmd = "/home/sravan/.scripts/trackpad.sh" 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" modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = { awful.layout.layouts = {
awful.layout.suit.tile, awful.layout.suit.tile,
awful.layout.suit.tile.left, awful.layout.suit.tile.left,
@@ -105,35 +84,29 @@ awful.layout.layouts = {
-- awful.layout.suit.corner.se, -- awful.layout.suit.corner.se,
awful.layout.suit.floating, awful.layout.suit.floating,
} }
-- }}}
-- {{{ Menu taglist = { " ₁", "龎 ₂", " ₃", " ₄", "爵 ₅", " ₆", " ₇", " ₈", " ₉" }
-- Create a launcher widget and a main menu
myawesomemenu = { myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end }, { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" }, { "manual", terminal_cmd .. " -e man awesome" },
{ "edit config", editor .. " " .. awesome_config_file }, { "edit config", editor_cmd .. " " .. awesome_config_file },
{ "restart", awesome.restart }, { "restart", awesome.restart },
{ "quit", function() awesome.quit() end }, { "quit", function() awesome.quit() end },
} }
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon }, mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal } { "open terminal", terminal_cmd }
} }
}) })
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon, mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu }) menu = mymainmenu })
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout() mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock() mytextclock = wibox.widget.textclock()
-- Create a wibox for each screen and add it
local taglist_buttons = gears.table.join( local taglist_buttons = gears.table.join(
awful.button({ }, 1, function(t) t:view_only() end), awful.button({ }, 1, function(t) t:view_only() end),
awful.button({ modkey }, 1, function(t) awful.button({ modkey }, 1, function(t)
@@ -173,27 +146,9 @@ local tasklist_buttons = gears.table.join(
awful.client.focus.byidx(-1) awful.client.focus.byidx(-1)
end)) 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) awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
-- set_wallpaper(s)
-- Each screen has its own tag table. -- 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 -- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt() s.mypromptbox = awful.widget.prompt()
@@ -241,17 +196,27 @@ awful.screen.connect_for_each_screen(function(s)
}, },
} }
end) end)
-- }}}
-- {{{ Mouse bindings
root.buttons(gears.table.join( root.buttons(gears.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end), awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext), awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev) 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( globalkeys = gears.table.join(
awful.key({ modkey, }, "s", hotkeys_popup.show_help, awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description="show help", group="awesome"}), {description="show help", group="awesome"}),
@@ -298,7 +263,7 @@ globalkeys = gears.table.join(
{description = "go back", group = "client"}), {description = "go back", group = "client"}),
-- Standard program -- 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"}), {description = "open a terminal", group = "launcher"}),
awful.key({ modkey, "Control" }, "r", awesome.restart, awful.key({ modkey, "Control" }, "r", awesome.restart,
{description = "reload awesome", group = "awesome"}), {description = "reload awesome", group = "awesome"}),
@@ -438,9 +403,6 @@ clientkeys = gears.table.join(
{description = "(un)maximize horizontally", group = "client"}) {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 for i = 1, 9 do
globalkeys = gears.table.join(globalkeys, globalkeys = gears.table.join(globalkeys,
-- View tag only. -- View tag only.
@@ -488,26 +450,8 @@ for i = 1, 9 do
) )
end 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) root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = { awful.rules.rules = {
-- All clients will match this rule. -- All clients will match this rule.
{ rule = { }, { rule = { },
@@ -555,17 +499,14 @@ awful.rules.rules = {
-- Add titlebars to normal clients and dialogs -- Add titlebars to normal clients and dialogs
{ rule_any = {type = { "normal", "dialog" } { 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. -- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" }, -- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } }, -- properties = { screen = 1, tag = "2" } },
} }
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c) client.connect_signal("manage", function (c)
-- Set the windows at the slave, -- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master. -- 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
end) end)
-- 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
local buttons = gears.table.join( local buttons = gears.table.join(
@@ -619,11 +559,9 @@ client.connect_signal("request::titlebars", function(c)
} }
end) end)
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c) client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false}) c:emit_signal("request::activate", "mouse_enter", {raise = false})
end) end)
client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus 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) client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end)
-- }}}