2020-04-10 17:32:58 +00:00
#+title : AwesomeWM configuration
2021-11-22 16:01:44 +00:00
#+setupfile : ../headers
2020-04-10 17:32:58 +00:00
#+OPTIONS : auto-id:t
#+HTML_HEAD_EXTRA : <meta name="description" content="Phundrak's AwesomeWM config" />
#+HTML_HEAD_EXTRA : <meta property="og:title" content="Phundrak's AwesomeWM config" />
#+HTML_HEAD_EXTRA : <meta property="og:description" content="Description of the AwesomeWM config file of Phundrak" />
2020-06-01 15:53:20 +00:00
#+PROPERTY : header-args :noweb yes :tangle no :exports none
2020-09-28 16:09:45 +00:00
#+PROPERTY : header-args:lua :tangle ~/.config/awesome/rc.lua :exports code :noweb yes :mkdirp yes
2020-04-10 17:32:58 +00:00
* Introduction
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Introduction-4c41360e
:END:
2021-02-04 13:43:09 +00:00
From the Arch Wiki: awesome is a highly configurable, next generation framework
window manager for Xorg. It is very fast and extensible. It is primarily
targeted at power users, developers and any people dealing with every day
computing tasks and who want to have fine-grained control on its graphical
environment.
2020-04-10 17:32:58 +00:00
2021-02-04 13:43:09 +00:00
Personally, what really made me want to try Awesome is the fact its
configuration file is written with an actual programming language and not just a
configuration language like with i3, and by the fact it works with tags and not
workspaces which makes window management much more flexible.
2020-04-10 17:32:58 +00:00
2021-02-04 13:43:09 +00:00
This document was written in Emacs with Org-mode and is both the documentation
and source code of my configuration file which can be extracted to
~$HOME/.config/awesome/rc.lua~ through a call to ~org-babel-tangle~ .
2020-04-10 17:32:58 +00:00
2021-12-17 16:00:52 +00:00
* Launching Awesome
:PROPERTIES:
:CUSTOM_ID: Launching-Awesome-lavgvvz00bj0
:END:
In order to launch Awesome with ~startx~ , I need a ~xinit~ -compatible
script. Here is my ~$HOME/.xinitrc.awesome~ file:
#+begin_src sh :tangle ~/.xinitrc.awesome
xhost +
exec awesome
#+end_src
2020-04-10 17:32:58 +00:00
* Loading libraries
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Loading_libraries-4df76999
:END:
2021-02-04 13:43:09 +00:00
First of all, some initialization is needed, and this initialization is about
math randomness. So, let’ s initialize the ~random~ method of the ~math~ library:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
math.randomseed(os.time())
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
In order to be able to load libraries properly, I first need to make sure
LuaRocks is installed, so I can also make sure the packages our configuration
depends on installed through it can be found. If LuaRocks is not installed, then
do nothing.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
pcall(require, "luarocks.loader")
2020-11-13 14:18:43 +00:00
#+END_SRC
Next, we’ ll also load the following libraries
#+NAME : table-imported-libraries
| Library | Import as | What it is |
|---------------------+---------------+---------------------------|
| gears | gears | Standard Awesome library |
| awful | awful | Standard Awesome library |
| wibox | wibox | Widget and layout library |
| beautiful | beautiful | Theme handling library |
| naughty | naughty | Notification library |
| menubar | menubar | Create menus |
| awful.hotkeys_popup | hotkeys_popup | Help window for hotkeys |
#+NAME : imported-libraries
#+BEGIN_SRC emacs-lisp :var libs=table-imported-libraries :cache yes
2021-10-12 09:31:20 +00:00
(mapconcat (lambda (x) (format "local %s = require(\"%s\")"
(cadr x)
(car x)))
libs
"\n")
2020-11-13 14:18:43 +00:00
#+END_SRC
#+RESULTS[a66d7b66dbd4b4001dc3f649840b66761cc915b5]: imported-libraries
: local gears = require("gears")
: local awful = require("awful")
: local wibox = require("wibox")
: local beautiful = require("beautiful")
: local naughty = require("naughty")
: local menubar = require("menubar")
: local hotkeys_popup = require("awful.hotkeys_popup")
Here is the actual code in the config file:
#+BEGIN_SRC lua
<<imported-libraries() >>
#+END_SRC
I also want to be able to autofocus the first window when I go to another workspace, so let’ s require that:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
require("awful.autofocus")
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
And finally, I want to be able to declare some shortcuts specific to some apps
thanks to the hotkeys help widget.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
require("awful.hotkeys_popup.keys")
2020-11-13 14:18:43 +00:00
#+END_SRC
By the way, let’ s initialize the ~random~ method of the ~math~ library:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
math.randomseed(os.time())
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Error handling
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Error_handling-f6a6668f
:END:
2021-02-04 13:43:09 +00:00
This code checks if Awesome encountered an error during startup and fell back to
another config. This code will only ever execute for the fallback config.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
2020-11-13 14:18:43 +00:00
#+END_SRC
And this code handles runtime errors after startup thanks to signals.
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
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
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Variable definitions
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Variable_definitions-06b2bcbf
:END:
2020-04-10 17:32:58 +00:00
** Themes
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Variable_definitions-Themes-591886b4
:END:
2021-02-04 13:43:09 +00:00
With Awesome, it is possible to load or write custom themes in order to give
Awesome a special look that fits the user. I am currently using a custom theme
that is not yet included in my dotfiles. I will add it later, along with the
images used for the theme.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
beautiful.init("/home/phundrak/ .config/awesome/nord/theme.lua")
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Default terminal and text editor
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Variable_definitions-Default_terminal_and_text_editor-44b84e20
:END:
2021-02-04 13:43:09 +00:00
The two following variables are set so that I don’ t need to go over my whole
config file in order to modify which terminal or text editor I use, not that I
do it often though.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
terminal = "kitty"
editor = os.getenv("EDITOR") or "emacsclient -c -a emacs"
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Keys
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Variable_definitions-Keys-b8def4ac
:END:
2021-02-04 13:43:09 +00:00
The following declares the default Modkey. Usually, ~Mod4~ is the Super key,
situated between the Ctrl key and the Alt key with a logo (usually Windows’ ).
Another usual value for this is ~Mod1~ , which is the Alt key, but it has greater
chances of interfering with other software. I also defined some other obvious
variables in order to make my code cleaner later on.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
modkey = "Mod4"
shift = "Shift"
control = "Control"
meta = "Mod1"
alt = "Mod1" -- Just in case
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Custom functions
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-ed54dbe2
:END:
2020-04-10 17:32:58 +00:00
** Wallpaper-related functions
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-Wallpaper-related_functions-5912f7dd
:END:
2020-04-10 17:32:58 +00:00
*** Set a random wallpaper
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Set_a_random_wallpaper-104bbeec
:END:
2021-02-04 13:43:09 +00:00
This function sets a random wallpaper from the directory
=~/Pictures/Wallpapers= , see [[file:bin.org::#pape-update-bdecbadf ][pape-update ]] in my custom scripts.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function set_random_pape()
awful.spawn.with_shell("pape-update")
naughty.notify({ preset = naughty.config.presets.normal,
title = "Wallpaper change",
text = "Done!"})
end
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
*** Restore previous wallpaper
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c
:END:
2021-02-04 13:43:09 +00:00
I also wrote the following function that will restore the previously set
wallpaper:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function set_wallpaper(_ )
awful.spawn.with_shell("nitrogen --restore")
end
2020-11-13 14:18:43 +00:00
#+END _SRC
2020-04-10 17:32:58 +00:00
** Layout manipulation
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-Layout_manipulation-6bc7db06
:END:
2021-02-04 13:43:09 +00:00
The following function is used by a shortcut described below in
[[#Keybindings-Clients-f9f96d60 ]].
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function client_go_back()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
2020-11-13 14:18:43 +00:00
end
2021-10-12 09:31:20 +00:00
end
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Clients manipulation
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-Clients_manipulation-7e958fed
:END:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function restore_minimized_clients()
local c = awful.client.restore()
-- Focus restored client
if c then
c:emit_signal(
"request::activate", "key.unminimize", {raise = true}
)
2020-11-13 14:18:43 +00:00
end
2021-10-12 09:31:20 +00:00
end
2020-11-13 14:18:43 +00:00
#+END_SRC
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function toggle_fullscreen_client(c)
c.fullscreen = not c.fullscreen
c:raise()
end
2020-11-13 14:18:43 +00:00
#+END_SRC
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function toggle_maximized(c)
c.maximized = not c.maximized
c:raise()
end
2020-11-13 14:18:43 +00:00
#+END_SRC
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function toggle_vertical_maximized(c)
c.maximized_vertical = not c.maximized_vertical
c:raise()
end
2020-11-13 14:18:43 +00:00
#+END_SRC
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function toggle_horizontal_maximized(c)
c.maximized_horizontal = not c.maximized_horizontal
c:raise()
end
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Tag manipulation
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-Tag_manipulation-5fc67669
:END:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function view_tag_n(i)
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
tag:view_only()
2020-11-13 14:18:43 +00:00
end
2021-10-12 09:31:20 +00:00
end
2020-11-13 14:18:43 +00:00
#+END_SRC
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function toggle_tag_n(i)
local screen = awful.screen.focused()
local tag = screen.tags[i]
if tag then
awful.tag.viewtoggle(tag)
2020-11-13 14:18:43 +00:00
end
2021-10-12 09:31:20 +00:00
end
2020-11-13 14:18:43 +00:00
#+END_SRC
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function move_focused_to_tag_n(i)
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
2020-11-13 14:18:43 +00:00
end
end
2021-10-12 09:31:20 +00:00
end
2020-11-13 14:18:43 +00:00
#+END_SRC
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function toggle_focused_client_to_tag_n(i)
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
2020-11-13 14:18:43 +00:00
end
end
2021-10-12 09:31:20 +00:00
end
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Awesome prompt
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Custom_functions-Awesome_prompt-de4fde50
:END:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local function invoke_lua_execute_prompt()
awful.prompt.run {
prompt = "Run Lua code: ",
textbox = awful.screen.focused().promptbox.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. "/history_eval"
}
end
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Layouts
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Layouts-be55a7fd
:END:
2021-02-04 13:43:09 +00:00
The following is a list of available windows layouts. I only enable some of
them, and their order in the table is their order in Awesome.
2020-11-13 14:18:43 +00:00
#+NAME : table-layouts
| Layout | Enabled? |
|-----------------+----------|
| magnifier | yes |
| tile.left | yes |
| tile | yes |
| tile.bottom | yes |
| tile.top | yes |
| max | yes |
| max.fullscreen | yes |
| floating | yes |
| fair | yes |
| fair.horizontal | yes |
| spiral | yes |
| spiral.dwindle | yes |
| corner.nw | no |
| corner.ne | no |
| corner.sw | no |
| corner.se | no |
#+NAME : list-layouts
#+BEGIN_SRC emacs-lisp :var layouts=table-layouts :cache yes
2021-10-12 09:31:20 +00:00
(mapconcat (lambda (layout)
(let ((enabled-p (string= (cadr layout) "yes"))
(layout (car layout)))
(when enabled-p
(format "awful.layout.suit.%s,\n" layout))))
layouts
"")
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-07-30 15:58:52 +00:00
#+RESULTS[bf3bbbd40ecc04ec19d9660abff2080b4f68196a]: list-layouts
2020-11-13 14:18:43 +00:00
#+begin_example
awful.layout.suit.magnifier,
awful.layout.suit.tile.left,
2021-07-30 15:58:52 +00:00
awful.layout.suit.tile,
2020-11-13 14:18:43 +00:00
awful.layout.suit.tile.bottom,
awful.layout.suit.tile.top,
awful.layout.suit.max,
awful.layout.suit.max.fullscreen,
awful.layout.suit.floating,
awful.layout.suit.fair,
awful.layout.suit.fair.horizontal,
awful.layout.suit.spiral,
awful.layout.suit.spiral.dwindle,
#+end_example
Here is the code that activates these layouts:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
awful.layout.layouts = {
<<list-layouts() >>
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Top bar
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Top_bar-d3117294
:END:
2021-02-04 13:43:09 +00:00
The top bar in Awesome is declared thanks to a ~wibar~ widget fro the ~awful~
library. It is comprised of several buttons and widgets that will be declared
below.
2020-04-10 17:32:58 +00:00
** Menus
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Top_bar-Menus-cf468ca8
:END:
2020-11-13 14:18:43 +00:00
#+NAME : make-menu
2021-07-30 15:58:52 +00:00
#+BEGIN_SRC emacs-lisp :var menu=table-main-menu
2021-10-12 09:31:20 +00:00
(mapconcat (lambda (item)
(format "{ \"%s\", %s }"
(car item)
(mapconcat #'identity (cdr item) ", ")))
menu
",\n")
2020-11-13 14:18:43 +00:00
#+END_SRC
#+RESULTS : make-menu
2021-07-30 15:58:52 +00:00
: { "awesome", awesomewm_menu, beautiful.awesome_icon },
: { "open terminal", terminal, nil }
2020-11-13 14:18:43 +00:00
2021-02-04 13:43:09 +00:00
It is possible to create actual menus in Awesome, including the one available at
the top-left corner of the screen. First, let’ s declare a menu related to
Awesome:
2020-11-13 14:18:43 +00:00
#+NAME : table-awesome-menu
| Name | Command |
|-------------+---------------------------------------------------------------------|
| hotkeys | function() hotkeys_popup.show_help(nil, awful.screen.focused()) end |
| edit config | editor .. " " .. awesome.conffile |
| restart | awesome.restart |
| quit | function() awesome.quit() end |
And here is the actual code:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
awesomewm_menu = {
<<make-menu(menu=table-awesome-menu) >>
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Next, let’ s create the main menu that will be used on ~S-w~ and at the top left
of the window:
2020-11-13 14:18:43 +00:00
#+NAME : table-main-menu
| Name | Command | Icon |
|---------------+----------------+------------------------|
| awesome | awesomewm_menu | beautiful.awesome_icon |
| open terminal | terminal | nil |
Here is the actual code:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
mainmenu = awful.menu({ items = {
<<make-menu(menu=table-main-menu) >>
}})
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
For now it only has two entries: the Awesome menu and opening a terminal, I will
add some more later probably. Let’ s specify it as being our main launcher:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
launcher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mainmenu })
2020-11-13 14:18:43 +00:00
#+END_SRC
Finally, let’ s declare the menubar’ s terminal for applications that require it.
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
menubar.utils.terminal = terminal
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
2020-12-10 09:34:34 +00:00
** Widgets
2020-12-10 09:20:21 +00:00
:PROPERTIES:
2020-12-10 09:34:34 +00:00
:CUSTOM_ID: Top_bar-Widgets-0b255378
2020-12-10 09:20:21 +00:00
:END:
2020-11-13 14:18:43 +00:00
Let’ s declare the keyboard map indicator and switcher for the top bar:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
keyboardlayout = awful.widget.keyboardlayout()
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
2020-11-13 14:18:43 +00:00
Let’ s also create a clock widget:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
textclock = wibox.widget.textclock()
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Tag list
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Top_bar-Tag_list-d43dbb62
:END:
2021-02-04 13:43:09 +00:00
In order to create the taglist (an equivalent to workspaces, but better), we
need to create first a local variable that will hold the widget. It will be
declared as you can see below:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
local tasklist_buttons = gears.table.join(
-- configuration goes here
)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
~gears.table.join()~ joins several tables together, as described [[https://awesomewm.org/doc/api/libraries/gears.table.html ][here ]], which
will be useful since all its arguments will be tables generated by the
~awful.button~ method which will be useful in order to manage what clicks on the
tags should do. First, let’ s manage left clicks.
2020-11-13 14:18:43 +00:00
2021-02-04 13:43:09 +00:00
Left clicks in general are dedicated to tag visibility. A simple left click on a
tag should switch this tag as the only visible tag, no matter how many of them
were visible beforehand.
2020-11-13 14:18:43 +00:00
#+NAME : tag-simple-left-click
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 1, function(t) t:view_only() end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
However, left clicks combined with the modkey will add the clicked tag to the
list of visible tags, which allows the user to see windows from several tags at
once.
2020-11-13 14:18:43 +00:00
#+NAME : tag-mod-left-click
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ modkey }, 1, awful.tag.viewtoggle)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Right clicks are dedicated to window tagging. A simple right click will untag
the currently focused window and tag it again with the clicked tag, moving it
effectively from one tag to another.
2020-11-13 14:18:43 +00:00
#+NAME : tag-simple-right-click
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 3, function(t)
if client.focus then
client.focus:move_to_tag(t)
end
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
However, a right click combined with the modkey will add the clicked tag to the
currently focused window, making it visible to both tags.
2020-11-13 14:18:43 +00:00
#+NAME : tag-mod-right-click
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ modkey }, 3, function(t)
if client.focus then
client.focus:toggle_tag(t)
end
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
The scroll wheel is treated as clicks just as any right or left clicks and can
be interpreted by Awesome. They can prove useful when it comes to tags. If a
scroll up is detected over tags, then Awesome will display the previous tag.
2020-11-13 14:18:43 +00:00
#+NAME : tag-simple-scroll-up
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 4, function(t) awful.tag.viewprev(t.screen) end)
2020-11-13 14:18:43 +00:00
#+END_SRC
Otherwise, if a scroll down is detected, the next tag will be displayed.
#+NAME : tag-simple-scroll-down
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 5, function(t) awful.tag.viewnext(t.screen) end)
2020-11-13 14:18:43 +00:00
#+END_SRC
So, here’ s the actual configuration code for the taglist:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local taglist_buttons = gears.table.join(
<<tag-simple-left-click >>,
<<tag-mod-left-click >>,
<<tag-simple-right-click >>,
<<tag-mod-right-click >>,
<<tag-simple-scroll-up >>,
<<tag-simple-scroll-down >>
)
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Tasks list
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Top_bar-Tasks_list-fb7c9b20
:END:
2021-02-04 13:43:09 +00:00
Similarly to the tag list, the task list can display some special behavior
depending on the clicks it receives. These clicks are set like so:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
local tasklist_buttons = gears.table.join(
-- List of clicks
)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
A left click on a task in the taskbar will simply focus and raise the window
linked to it if it is not focused. Otherwise, if the window is focused, the
window will be minimized.
2020-11-13 14:18:43 +00:00
#+NAME : task-simple-left-click
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
If the right click is detected, then a list of all the opened clients is invoked
so we can switch to another (and if needed switch visible tag). The width of
this list will be 250px.
2020-11-13 14:18:43 +00:00
#+NAME : task-simple-right-click
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 3, function()
awful.menu.client_list({ theme = { width = 250 } })
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
If a scroll up is detected, then let’ s select the previous client in the
tasklist.
2020-11-13 14:18:43 +00:00
#+NAME : task-simple-scroll-up
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
If a scroll down is detected, then let’ s select the next client in the tasklist.
#+NAME : task-simple-scroll-down
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
So, here’ s the actual code for the tasklist:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
local tasklist_buttons = gears.table.join(
<<task-simple-left-click >>,
<<task-simple-right-click >>,
<<task-simple-scroll-up >>,
<<task-simple-scroll-down >>
)
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Theme and display
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Theme_and_display-6f94bad4
:END:
2020-04-10 17:32:58 +00:00
** Screen update
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Theme_and_display-Screen_update-e162a27a
:END:
2021-02-04 13:43:09 +00:00
When a screen’ s geometry changes (e.g. when a different resolution is applied),
the signal ~property::geometry~ is sent. When this is the case, the wallpaper
should be redisplayed since it won’ t necessarily fit the new geometry of the
screen. And remember, I have a [[#Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c ][function that does exactly that ]]! Let’ s connect
this function to the geometry change signal:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
screen.connect_signal("property::geometry", set_wallpaper)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
If a new screen gets connected, it will need to get a new wallpaper. A lot needs
to be done, and all the following lines of code will be inside a block like
this:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.screen.connect_for_each_screen(function(s)
-- Code to be executed goes here
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
So, due the code block above, if you see any reference to ~s~ in the code blocks
below, it will refer to the screen being set up by the function.
2020-11-13 14:18:43 +00:00
First, let’ s set its wallpaper:
#+NAME : screen-set-pape
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
set_wallpaper()
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Next, let’ s build a list of tags for the screen. *Be aware that each screen has
its own tag table!* The default layout will be the first refered to in the
layouts list described above.
2020-11-13 14:18:43 +00:00
#+NAME : screen-taglist
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1])
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Next, let’ s create the taglist widget. It will use the ~taglist_buttons~
[[#Top_bar-Tag_list-d43dbb62 ][declared above ]] in order to handle clicks on tags, and due to the filter, all
tags will be displayed in the tagbar ([[https://awesomewm.org/apidoc/widgets/awful.widget.taglist.html#List_filters ][more about tag filters ]]).
2020-11-13 14:18:43 +00:00
#+NAME : screen-taglist-widget
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
s.taglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = taglist_buttons
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
A tasklist widget will also get created thanks with the ~tasklist_button~
[[#Top_bar-Tag_list-d43dbb62 ][declared above ]] that will handle clicks on tasks. Contrarily to the taglist
widget above, the tasklist will only display the screen’ s current tags thanks to
its filter.
2020-11-13 14:18:43 +00:00
#+NAME : screen-tasklist-widget
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
s.tasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = tasklist_buttons
}
2020-11-13 14:18:43 +00:00
#+END_SRC
A promptbox will also be created for the screen:
#+NAME : screen-promptbox
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
s.promptbox = awful.widget.prompt()
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Then, Let’ s create an imagebox widget in which will be contained an icon
indicating which layout is being used. We need one per screen. We will also make
it clickable: if there is a left click or a scroll up detected above it, the
next layout will be loaded; otherwise if a right click or a scroll down is
detected, the previous layout will be loaded.
2020-11-13 14:18:43 +00:00
#+NAME : screen-layout-indicator
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
s.layoutbox = awful.widget.layoutbox(s)
s.layoutbox:buttons(gears.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
2020-11-13 14:18:43 +00:00
#+END_SRC
Now it is time to create the widget, a ~wibox~ that will contain our bar.
#+NAME : screen-wibox-widget
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
s.wibox = awful.wibar({ position = "top", screen = s })
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Finally, let’ s set up our bar. Since it is a horizontal bar, its layout will be
horizontal too. Our launcher, taglist and promptbox will be part of the left
widgets, while the tasklist will be at the center, and the keyboard indicator,
the system tray, the clock and the layout indicator will be on the right.
2020-11-13 14:18:43 +00:00
#+NAME : screen-wibox-setup
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
s.wibox:setup {
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
launcher,
s.taglist,
s.promptbox,
},
s.tasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
keyboardlayout,
wibox.widget.systray(),
textclock,
s.layoutbox,
},
}
2020-11-13 14:18:43 +00:00
#+END_SRC
In the end, our code looks like this:
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
awful.screen.connect_for_each_screen(function(s)
<<screen-set-pape >>
<<screen-taglist >>
<<screen-taglist-widget >>
<<screen-tasklist-widget >>
<<screen-promptbox >>
<<screen-layout-indicator >>
<<screen-wibox-widget >>
<<screen-wibox-setup >>
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Mouse bindings
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Mouse_bindings-eb4a69a8
:END:
2021-02-04 13:43:09 +00:00
It is possible with Awesome to bind some shortcuts to mouse events when the
mouse is above Awesome itself (not above some client). Only one is set: the
right click opens the Awesome menu.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
root.buttons(gears.table.join(
awful.button({}, 3, function() mainmenu:toggle() end)
))
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
I will also set three mouse bindings for when the mouse is above a client:
2020-11-13 14:18:43 +00:00
- A simple click on a client will focus and raise it.
2021-02-04 13:43:09 +00:00
- A click on a client combined with a modkey press will allow the user to move a
client after focusing it and making it floating.
- A middle click on a client combined with a modkey press will toggle the
floating status of the client.
- A right click combined with the modkey will allow the user to resize a after
focusing it and making it a floating client.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
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})
c.floating = true
awful.mouse.client.move(c)
end),
awful.button({ modkey }, 2, function (c)
awful.client.floating.toggle(c)
end),
awful.button({ modkey }, 3, function (c)
c:emit_signal("request::activate", "mouse_click", {raise = true})
c.floating = true
awful.mouse.client.resize(c)
end)
)
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Keybindings
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-a4e415b3
:END:
2021-02-04 13:43:09 +00:00
Keybindings allow the user to execute some Lua code all across Awesome. They all
bear at least a list of modifier keys, the actual key to be pressed, the action
they keybinding should yield, a description, and a group. The latter two will be
useful for the keybindings help window which will display them all, sorted by
group and with the description displayed next to the keybinding itself.
2020-11-13 14:18:43 +00:00
2021-02-04 13:43:09 +00:00
Here are some keybindings related to Awesome itself. Most of them will be
described in tables, but due to some limitations from Org-mode (the Emacs mode
used to write this document and generate my Awesome configuration), a few of
them will be directly written as Lua code.
2020-11-13 14:18:43 +00:00
Here is a description of the tables displayed below:
- Key :: key which toggles the shortcut
- Modifiers :: modifier keys that are required to toggle the shortcut
2021-02-04 13:43:09 +00:00
- Lambda? :: whether or not the ~Action~ should be nested in a lambda function.
Possible values are:
2020-11-13 14:18:43 +00:00
- ~no~ :: The value is a Lua function to be executed as is
- ~yes~ :: The value is to be inserted into a lambda
- ~spawn~ :: The value is to be inserted in an ~awful.spawn~ call in a lambda
2021-02-04 13:43:09 +00:00
- ~shell~ :: The value is to be inserted in an ~awful.spawn.with_shell~ call
in a lambda
2020-11-13 14:18:43 +00:00
- Action :: code to be executed by the shortcut
- What it does :: short description of the shortcut’ s action
- Group :: group in which the shortcut will appear in Awesome’ s help window
2021-02-04 13:43:09 +00:00
- Clientkey? :: whether this should be a global shortcut or a shortcut only
aimed at clients (value is ~yes~ or ~no~ )
2020-11-13 14:18:43 +00:00
#+NAME : gen-sc-text
#+BEGIN_SRC emacs-lisp
2021-10-12 09:31:20 +00:00
(lambda (x)
(let ((key (nth 0 x))
(modifiers (nth 1 x))
(lambda-p (pcase (nth 2 x)
("yes" 'lambda)
("shell" 'shell)
("terminal" 'terminal)
("spawn" 'spawn)
(otherwise nil)))
(action (nth 3 x))
(description (nth 4 x))
(group (nth 5 x))
(clientkey (if (string= (nth 6 x) "yes") "c" "")))
(format "awful.key({%s},\"%s\",%s,\n\t{description=\"%s\",group= \"%s\"})"
modifiers
key
(if (not lambda-p)
action
(format "function(%s) %s end" clientkey
(pcase lambda-p
('lambda action)
('shell
(format "awful.spawn.with_shell(\"%s\")" action))
('terminal
(format "awful.spawn(terminal..\" -e %s\")" action))
('spawn
(format "awful.spawn(\"%s\")" action)))))
description
group)))
2020-11-13 14:18:43 +00:00
#+END_SRC
#+NAME : gen-sc-glob
#+BEGIN_SRC emacs-lisp :var table=sc-client
2021-10-12 09:31:20 +00:00
(mapconcat
<<gen-sc-text >>
(seq-filter (lambda (x)
(let ((clientkey-p (nth 6 x)))
(or (not clientkey-p)
(string= "no" clientkey-p))))
table)
",\n")
2020-11-13 14:18:43 +00:00
#+END_SRC
#+NAME : gen-sc-client
#+BEGIN_SRC emacs-lisp :var table=sc-client :cache yes
2021-10-12 09:31:20 +00:00
(mapconcat
<<gen-sc-text >>
(seq-filter (lambda (keybind)
(string= "yes" (nth 6 keybind)))
table)
",\n")
2020-11-13 14:18:43 +00:00
#+END_SRC
#+NAME : sc-tag-num-gen
2021-07-30 15:58:52 +00:00
#+BEGIN_SRC emacs-lisp :var input=sc-tag-num :results drawer :wrap src lua
2021-10-12 09:31:20 +00:00
(let (result)
(dotimes (i 10 result)
(let* ((j (+ 1 i)))
(setq result
(cons
(mapconcat
(lambda (line)
(format
"awful.key({%s},\"#%d\",function() %s%d) end,
\t{description=\"%s%d\",group= \"%s\"})"
(nth 1 line) (+ j 9) (nth 2 line) j
(nth 3 line) j (nth 4 line)))
input
",\n") result))))
(mapconcat (lambda (x) x)
result
",\n\n"))
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Most of these keybindings are available at root-level of Awesome and will be
declared in the ~globalkeys~ variable, which will be added then to ~root.keys~
(see [[https://awesomewm.org/doc/api/libraries/root.html#keys ]]).
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :cache yes
2021-10-12 09:31:20 +00:00
globalkeys = gears.table.join(
-- Awesome
<<gen-sc-glob(sc-awesome) >>,
-- App
<<gen-sc-glob(sc-app) >>,
<<gen-sc-glob(sc-app-internet) >>,
<<gen-sc-glob(sc-app-screenshot) >>,
<<gen-sc-glob(sc-app-emacs) >>,
<<gen-sc-glob(sc-app-rofi) >>,
-- Client
<<gen-sc-glob(sc-client) >>,
-- Layout
<<gen-sc-glob(sc-layout) >>,
-- Media
<<gen-sc-glob(sc-media) >>,
-- Screen
<<gen-sc-glob(sc-screen) >>,
-- Tags
<<gen-sc-glob(sc-tag) >>,
-- Misc
<<gen-sc-glob(sc-misc) >>,
<<sc-tag-num-gen() >>
)
root.keys(globalkeys)
clientkeys = gears.table.join(
-- Client
<<gen-sc-client(sc-client) >>
)
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Applications
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Applications-8321c6c9
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-app
| Key | Modifiers | Lambda? | Action | What it does | Group |
|--------+-----------+---------+-----------------------+-------------------+-------|
| Return | modkey | yes | awful.spawn(terminal) | open a terminal | app |
| n | modkey | spawn | nemo | open file manager | app |
2021-01-21 13:34:30 +00:00
| g | modkey | spawn | gimp | open GIMP | app |
2020-04-11 10:35:10 +00:00
*** Internet apps
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Applications-Internet_apps-87e80705
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-app-internet
| Key | Modifiers | Lambda? | Action | What it does | Group |
|-----+----------------+---------+-----------------------------------+--------------------+----------|
| b | modkey | yes | awful.spawn(os.getenv("BROWSER")) | invoke web browser | internet |
2021-05-01 13:10:14 +00:00
| d | control, shift | spawn | lightcord | launch Discord | internet |
2020-04-11 10:35:10 +00:00
*** Screenshots
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Applications-Screenshots-fa63a5a5
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-app-screenshot
2021-07-30 16:01:10 +00:00
| Key | Modifiers | Lambda? | Action | What it does | Group |
|-------+-----------+---------+----------------------------------------------+-----------------------------+------------|
| Print | | spawn | scrot -e 'mv $f ~/Pictures/Screenshots' | Screenshot | screenshot |
| Print | control | spawn | scrot -s -e 'mv $f ~/Pictures/Screenshots' | Screenshot (area selection) | screenshot |
| Print | shift | spawn | scrot -d 3 -e 'mv $f ~/Pictures/Screenshots' | Screenshot (3s delay) | screenshot |
2020-04-11 10:35:10 +00:00
*** Emacs
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Applications-Emacs-95f8f6a4
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-app-emacs
2021-07-30 16:01:10 +00:00
| Key | Modifiers | Lambda? | Action | What it does | Group |
|-----+---------------+---------+-------------------+----------------------+-------|
| e | modkey | spawn | emacsclient -c -n | invoke Spacemacs | emacs |
| e | modkey, shift | spawn | emacs | invoke Vanilla Emacs | emacs |
2020-04-11 10:35:10 +00:00
*** Rofi
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Applications-Rofi-ca998c87
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-app-rofi
2020-11-28 17:13:07 +00:00
| Key | Modifiers | Lambda? | Action | What it does | Group |
|-----+------------------------+---------+------------------------------------------+---------------------------------+-------|
| a | modkey | shell | awiki | find and open an ArchWiki page | rofi |
| d | modkey | spawn | rofi -combi-modi drun,window -show combi | rofi for drun and windows | rofi |
2020-11-29 12:46:19 +00:00
| d | modkey, meta | spawn | rofi -show ssh | rofi for SSH | rofi |
2021-10-02 12:20:21 +00:00
| p | modkey, shift | shell | rofi-pass -t | types password from ~pass~ | rofi |
| p | modkey, control, shift | shell | rofi-pass | copy password from ~pass~ | rofi |
2020-11-28 17:13:07 +00:00
| e | modkey, meta | shell | rofi-emoji | select and copy emoji from list | rofi |
| m | modkey, meta | shell | rofi-mount | volume mounting helper | rofi |
| u | modkey, meta | shell | rofi-umount | volume unmounting helper | rofi |
| w | modkey, control | shell | wacom-setup | set up my wacom tablet | rofi |
2020-12-28 20:06:18 +00:00
| y | modkey | shell | ytplay | play web video in mpv | rofi |
| y | modkey, shift | shell | rofi-ytdl | download video from web | rofi |
2020-04-10 17:32:58 +00:00
** Awesome
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Awesome-7b691e10
:END:
2020-11-13 14:18:43 +00:00
Here will be declared some shortcuts directly related to Awesome itself.
#+NAME : sc-awesome
| Key | Modifiers | Lambda? | Action | What it does | Group |
|-----+------------------------+---------+---------------------------+-------------------------+---------|
| h | modkey | no | hotkeys_popup.show_help | show help | awesome |
| h | modkey, shift | yes | mainmenu:show() | show main menu | awesome |
2020-11-27 15:45:05 +00:00
| l | modkey | spawn | plock | lock screen | awesome |
2020-11-13 14:18:43 +00:00
| q | modkey, shift | no | awesome.quit | quit awesome | awesome |
| r | modkey, shift, control | no | awesome.restart | reload awesome | awesome |
| w | modkey | no | set_random_pape | set random wallpaper | awesome |
2021-01-02 12:52:18 +00:00
| w | modkey, shift | spawn | select-pape | set wallpaper | awesome |
2020-11-13 14:18:43 +00:00
| x | modkey | no | invoke_lua_execute_prompt | lua execute prompt | awesome |
| F4 | modkey, control | spawn | systemctl hibernate | hibernate computer | awesome |
| F4 | modkey, shift | spawn | systemctl suspend | suspend to RAM computer | awesome |
| F4 | modkey, shift, control | spawn | poweroff | power off computer | awesome |
2020-04-10 17:32:58 +00:00
** Clients
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Clients-f9f96d60
:END:
2021-02-04 13:43:09 +00:00
These shortcuts are related to clients (aka windows) management.
2020-11-13 14:18:43 +00:00
#+NAME : sc-client
| Key | Modifiers | Lambda? | Action | What it does | Group | Clientkey? |
|-----+------------------------+---------+----------------------------------+-------------------------------+--------+------------|
| c | modkey, meta | yes | awful.placement.centered(c) | center client | client | yes |
| f | modkey | yes | toggle_fullscreen_client(c) | toggle fullscreen | client | yes |
| m | modkey | yes | toggle_maximized(c) | toggle maximized | client | yes |
| m | modkey, shift | yes | toggle_horizontal_maximized(c) | toggle horizontally maximized | client | yes |
| m | modkey, control | yes | toggle_vertical_maximized(c) | toggle vertically maximized | client | yes |
| n | modkey, shift | yes | c.minimized = true | minimize | client | yes |
| n | modkey, control | no | restore_minimized_clients | restore minimized | client | no |
| o | modkey, shift | yes | c:move_to_screen() | move to screen | client | yes |
| q | modkey | yes | c:kill() | close client | client | yes |
| s | modkey | yes | awful.client.focus.byidx(-1) | focus previous client | client | no |
| t | modkey | yes | awful.client.focus.byidx(1) | focus next client | client | no |
| s | modkey, shift | yes | awful.client.swap.byidx(-1) | swap with previous client | client | no |
| t | modkey, shift | yes | awful.client.swap.byidx(1) | swap with next client | client | no |
| m | modkey, shift, control | yes | c:swap(awful.client.getmaster()) | swap with master client | client | yes |
| u | modkey | no | awful.client.urgent.jumpto | jump to urgent client | client | no |
| v | modkey | yes | c.ontop = not c.ontop | toggle keep on top | client | yes |
| f | modkey, control | no | awful.client.floating.toggle | toggle floating | client | yes |
| Tab | modkey | no | client_go_back | go back | client | no |
2020-04-10 17:32:58 +00:00
** Layout manipulation
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Layout_manipulation-648b4581
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-layout
| Key | Modifiers | Lambda? | Action | What it does | Group |
|-------+-----------------+---------+-------------------------------------+-----------------------------------+--------|
| r | modkey | yes | awful.tag.incmwfact(0.05) | increase master width factor | layout |
| c | modkey | yes | awful.tag.incmwfact(-0.05) | decrease master width factor | layout |
| r | modkey, shift | yes | awful.tag.incnmaster(1, nil, true) | increase number of master clients | layout |
| c | modkey, shift | yes | awful.tag.incnmaster(-1, nil, true) | decrease number of master clients | layout |
| r | modkey, control | yes | awful.tag.incncol(1, nil, true) | increase number of colums | layout |
| c | modkey, control | yes | awful.tag.incncol(-1, nil, true) | decrease number of colums | layout |
| space | modkey | yes | awful.layout.inc(1) | next layout | layout |
| space | modkey, meta | yes | awful.layout.inc(-1) | previous layout | layout |
2020-04-10 17:32:58 +00:00
** Media
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Media-f2cc1324
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-media
| Key | Modifiers | Lambda? | Action | What it does | Group |
|----------------------+-----------------+----------+---------------------------------+--------------------------+-------|
| + | modkey, meta | shell | mpc volume +2 | increase mpd volume | media |
| - | modkey, meta | shell | mpc volume -2 | decrease mpd volume | media |
| n | modkey, meta | terminal | ncmpcpp -q | spawn ncmpcpp | media |
| v | modkey, meta | terminal | ncmpcpp -qs visualizer | spawn ncmpcpp visualizer | media |
| XF86AudioLowerVolume | | shell | amixer -q set Master 2%- unmute | lower volume | media |
| Prior | modkey, control | shell | amixer -q set Master 2%- unmute | lower volume | media |
| XF86AudioRaiseVolume | | shell | amixer -q set Master 2%+ unmute | raise volume | media |
| Next | modkey, control | shell | amixer -q set Master 2%+ unmute | lower volume | media |
| XF86AudioMute | | shell | amixer -q set master 1+ toggle | toggle mute audio | media |
| Prior | modkey, control | shell | amixer -q set master 1+ toggle | toggle mute audio | media |
| XF86AudioPrev | | shell | mpc prev | previous mpd track | media |
| XF86AudioLowerVolume | meta | shell | mpc prev | prevous mpd track | media |
| Prior | modkey | shell | mpc prev | previous mpd track | media |
| XF86AudioNext | | shell | mpc next | next mpd track | media |
| XF86AudioRaiseVolume | meta | shell | mpc next | next mpd track | media |
| Next | modkey | shell | mpc next | next mpd track | media |
| XF86AudioPlay | | shell | mpc toggle | toggle mpd playback | media |
| p | modkey | shell | mpc toggle | toggle mpd playback | media |
| XF86AudioStop | | shell | mpc stop | stop playback | media |
| XF86AudioPlay | meta | shell | mpc stop | stop playback | media |
| p | modkey, meta | shell | mpc stop | stop playback | media |
2020-04-10 17:32:58 +00:00
** Screen
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Screen-b73991f0
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-screen
| Key | Modifiers | Lambda? | Action | What it does | Group |
|-----------------------+--------------+---------+---------------------------------+----------------------------+--------|
| t | modkey, meta | yes | awful.screen.focus_relative(1) | focus next screen | screen |
| s | modkey, meta | yes | awful.screen.focus_relative(-1) | focus previous screen | screen |
2021-02-04 08:13:37 +00:00
| XF86MonBrightnessDown | | shell | xbacklight -dec 1 | decrease screen brightness | screen |
| Next | modkey, meta | shell | xbacklight -dec 1 | decrease screen brightness | screen |
| XF86MonBrightnessUp | | shell | xbacklight -inc 1 | increase screen brightness | screen |
| Prev | modkey, meta | shell | xbacklight -inc 1 | increase screen brightness | screen |
2020-11-13 14:18:43 +00:00
| F3 | modkey | spawn | arandr | randr graphical frontend | screen |
| o | modkey | yes | awful.screen.focus_relative(1) | focus next screen | screen |
2020-04-10 17:32:58 +00:00
** Tags
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Tags-3424b757
:END:
2020-11-13 14:18:43 +00:00
#+NAME : sc-tag
| Key | Modifiers | Lambda? | Action | What it does | Group |
|--------+-----------------+---------+---------------------------+--------------+-------|
| Escape | modkey | no | awful.tag.history.restore | go back | tag |
| t | modkey, control | no | awful.tag.viewprev | view prev | tag |
| s | modkey, control | no | awful.tag.viewnext | view next | tag |
2021-02-04 13:43:09 +00:00
Another set of shortcuts is linked to the number row on the keyboard that allow
the manipulation of the default tags that range from ~1~ to ~10~ (the latter is
displayed as ~0~ ). Here is what the possible actions are:
2020-11-13 14:18:43 +00:00
#+NAME : sc-tag-num
| Key | Modifiers | Action | What it does | Group |
|--------+------------------------+---------------------------------+--------------------------------+-------|
| Number | modkey | view_tag_n( | view tag # | tag |
| Number | modkey, control | toggle_tag_n( | toggle tag # | tag |
| Number | modkey, shift | move_focused_to_tag_n( | move focused client to tag # | tag |
| Number | modkey, control, shift | toggle_focused_client_to_tag_n( | Toggle focused client on tag # | tag |
2020-04-10 17:32:58 +00:00
2020-10-14 16:34:30 +00:00
** Misc
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Keybindings-Misc-0b45ce02
:END:
2021-02-04 13:43:09 +00:00
In this category you will find other keybindings that do not fit in other
categories. For now, the only keybinding that is in this category is for
toggling the touchpad’ s tapping ability. This is linked to a special script I
wrote [[file:bin.org::#Toggle_touchpad_tapping-23348b00 ][here ]].
2020-11-13 14:18:43 +00:00
#+NAME : sc-misc
| Key | Modifiers | Lambda? | Action | What it does | Group |
|--------------------+-----------+---------+-----------+-------------------------+-------|
| XF86TouchpadToggle | | shell | tttapping | toggle touchpad tapping | misc |
2020-10-14 16:34:30 +00:00
2020-04-10 17:32:58 +00:00
* Rules
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Rules-c6142cdf
:END:
2021-02-04 13:43:09 +00:00
With ~awful.rules~ , users are able to describe some rules for window clients
when the latter spawn, such as their placement, their properties or even execute
a script. A rule can be applied through the ~manage~ signal, and they are all
stored in ~awful.rules.rules~ , the global rules table, as follows:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.rules.rules = {
-- Rules here
}
2020-11-13 14:18:43 +00:00
#+END_SRC
# Block for exporting rules from below
#+BEGIN_SRC lua :exports none
2021-10-12 09:31:20 +00:00
awful.rules.rules = {
<<rules-universal >>,
<<rules-floating >>,
<<rules-titlebars >>,
<<rules-default-tags >>
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
For more documentation on rules and their syntax, you can read the [[https://awesomewm.org/doc/api/libraries/awful.rules.html][official
documentation]].
2020-04-10 17:32:58 +00:00
** Universal rules
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Rules-Universal_rules-50aad2ce
:END:
2021-02-04 13:43:09 +00:00
The first rule is a universal rule which will match all clients, as you can see
with its syntax below:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
{ rule = {},
properties = {
-- List of properties
2020-11-13 14:18:43 +00:00
}
2021-10-12 09:31:20 +00:00
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Here is the list of properties with their value to apply to all clients, and a
short explanation as to what they do.
2020-11-13 14:18:43 +00:00
#+NAME : rules-universal-properties-table
| Property | Value | What it does |
|---------------+---------------------------------------------------------+-------------------------------------------------------------------------|
| border_width | beautiful.border_width | Set the width of the window’ s border |
| border_color | beautiful.border_normal | Set the color of the window’ s border |
| focus | awful.client.focus.filter | Set focus on the new window, except filtered out windows |
| raise | true | Set it as raised window |
| keys | clientkeys | Set the client’ s shortcuts set in [[*Clients][Shortcuts/Clients]] |
| buttons | clientbuttons | Set the client’ s mouse shortcuts from [[#Mouse_bindings-eb4a69a8][Mouse bindings]] |
| screen | awful.screen.preferred | Spawn the client on the main screen |
| placement | awful.placement.no_overlap+awful.placement.no_offscreen | Avoid the client to appear off the screen and overlaping another client |
| round_corners | true | Enable rounded corners for client |
#+NAME : rules-universal-properties
#+BEGIN_SRC emacs-lisp :tangle no :exports none :var properties=rules-universal-properties-table :cache yes
2021-10-12 09:31:20 +00:00
(mapconcat (lambda (x)
(format "%s = %s"
(car x)
(cadr x)))
properties
",\n")
2020-11-13 14:18:43 +00:00
#+END_SRC
#+RESULTS[5ddcb42f901ac56237de5ed102800b588f462100]: rules-universal-properties
: border_width = beautiful.border_width,
: border_color = beautiful.border_normal,
: focus = awful.client.focus.filter,
: raise = true,
: keys = clientkeys,
: buttons = clientbuttons,
: screen = awful.screen.preferred,
: placement = awful.placement.no_overlap+awful.placement.no_offscreen,
: round_corners = true
This is what my universal rules look like:
#+NAME : rules-universal
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
{ rule = {},
properties = {
<<rules-universal-properties() >>
2020-11-13 14:18:43 +00:00
}
2021-10-12 09:31:20 +00:00
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Floating clients
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Rules-Floating_clients-49ab582e
:END:
2021-02-04 13:43:09 +00:00
Some clients will be declared by default as floating windows. For this, we will
declare a rule that will match any of the provided conditions:
2020-11-13 14:18:43 +00:00
#+NAME : rules-floating-conditions-table
| Property | Matches | Comment |
|----------+--------------+----------------------------------------------------------------|
| instance | pinentry | Matches any Polkit |
| class | Arandr | Visual frontend for Randr |
| class | Sxiv | Simple X Image Viewer |
| class | Tor Browser | Needs a fixed window size to avoid fingerprinting |
| name | Event Tester | xev |
| role | pop-up | Any pop-up window, such as Chromium’ s detached Developer Tools |
#+NAME : rules-floating-conditions
#+BEGIN_SRC emacs-lisp :exports none :tangle no :var conditions=rules-floating-conditions-table :cache yes
2021-10-12 09:31:20 +00:00
(mapconcat (lambda (x)
(format "%s = { \"%s\" }" (car x) (cadr x)))
conditions
",\n")
2020-11-13 14:18:43 +00:00
#+END_SRC
#+RESULTS[1fbe7dc1e85b5170957c9583e39c4cbec9a7d7ca]: rules-floating-conditions
: instance = { "pinentry" },
: class = { "Arandr" },
: class = { "Sxiv" },
: class = { "Tor Browser" },
: name = { "Event Tester" },
: role = { "pop-up" }
2021-02-04 13:43:09 +00:00
If any of these conditions is matched, then the client will be set as floating,
as you can see below:
2020-11-13 14:18:43 +00:00
#+NAME : rules-floating
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
{ rule_any = {
<<rules-floating-conditions() >>
}, properties = { floating = true }}
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Titlebars
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Rules-Titlebars-b532fdba
:END:
2020-11-13 14:18:43 +00:00
Any normal or dialog client will get a titlebar. This is enabled like so:
#+NAME : rules-titlebars
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
{ rule_any = {type = { "normal", "dialog" }
}, properties = { titlebars_enabled = true }
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Default tag for clients
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Rules-Default_tag_for_clients-6ded2a47
:END:
2021-02-04 13:43:09 +00:00
With the use of some rules, it is possible to define which client are assigned
to which tag by default.
2020-11-13 14:18:43 +00:00
#+NAME : rules-default-tags-table
| Client Property | Value | Tag |
|-----------------+------------+-----|
| class | Emacs | 2 |
| class | firefox | 3 |
| class | Nemo | 4 |
| class | Gimp* | 5 |
2021-07-09 22:16:54 +00:00
| class | Signal | 8 |
2021-05-21 12:03:34 +00:00
| class | Steam | 9 |
| class | Mattermost | 0 |
2020-11-13 14:18:43 +00:00
| class | discord | 0 |
2021-05-01 13:10:14 +00:00
| class | lightcord | 0 |
2020-11-13 14:18:43 +00:00
#+NAME : rules-default-tags-generate
#+BEGIN_SRC emacs-lisp :tangle no :exports none :cache yes :var tags=rules-default-tags-table
2021-10-12 09:31:20 +00:00
(mapconcat (lambda (x)
(format "{rule = {%s = \"%s\"}, properties = {screen = 1, tag = \"%d\"} }"
(nth 0 x) (nth 1 x) (nth 2 x)))
tags
",\n")
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-07-09 22:16:54 +00:00
#+RESULTS[b1e188e8810460c2f84b6d9cb819430af300d9d0]: rules-default-tags-generate
2020-11-13 14:18:43 +00:00
: {rule = {class = "Emacs"}, properties = {screen = 1, tag = "2"} },
: {rule = {class = "firefox"}, properties = {screen = 1, tag = "3"} },
: {rule = {class = "Nemo"}, properties = {screen = 1, tag = "4"} },
: {rule = {class = "Gimp*"}, properties = {screen = 1, tag = "5"} },
2021-07-09 22:16:54 +00:00
: {rule = {class = "Signal"}, properties = {screen = 1, tag = "8"} },
: {rule = {class = "Steam"}, properties = {screen = 1, tag = "9"} },
: {rule = {class = "Mattermost"}, properties = {screen = 1, tag = "0"} },
2020-11-13 14:18:43 +00:00
: {rule = {class = "discord"}, properties = {screen = 1, tag = "0"} },
2021-07-09 22:16:54 +00:00
: {rule = {class = "lightcord"}, properties = {screen = 1, tag = "0"} }
2020-11-13 14:18:43 +00:00
This is what these rules look like:
#+NAME : rules-default-tags
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
<<rules-default-tags-generate() >>
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
* Signals
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Signals-e32971d6
:END:
2021-02-04 13:43:09 +00:00
Signals are a way for Awesome to handle events, such as client creation or
deletion.
2020-04-10 17:32:58 +00:00
** Client creation
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Signals-Client_creation-8048ac12
:END:
2021-02-04 13:43:09 +00:00
When a new client is created, the ~manage~ signal is emited. When so, the
following snippet ensures this new client is not off the screen, unless its
position was deliberately set by a program or by the user. It will also spawn
the new client where the mouse currently is.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
client.connect_signal("manage", function (c)
awful.client.movetoscreen(c, mouse.screen)
if awesome.startup
and not c.size_hints.user_position
and not c.size_hints.program_position then
awful.placement.no_offscreen(c)
end
end)
2021-02-04 13:43:09 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Titlebar creation
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Signals-Titlebar_creation-3b1aaa14
:END:
2021-02-04 13:43:09 +00:00
It is possible for Awesome to send request signals, such as the request to
create titlebar (generally for new clients). The following snippet handles this
titlebar creation if titlebar creation was set to ~true~ in the [[#Rules-c6142cdf ][rules ]]. For a
detailed explanation of the code, see below.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
client.connect_signal("request::titlebars", function(c)
local buttons = gears.table.join(
<<signal-titlebar-button1 >>,
<<signal-titlebar-button3 >>
)
<<signal-titlebar-create >>
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
The function has two main parts: the creation of the titlebar buttons (mouse
handling on the titlebar), and the creation of the titlebar itself. The creation
of the button is done by creating a local variable ~buttons~ which will be a
table created by the library ~gears~ , in which will be buttons created by the
user.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
local buttons = gears.table.join(
-- Buttons declared here
)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
You can see a left click will enable the user to raise the window, but also it
will enable the user to move the window (if it is floating of course).
2020-11-13 14:18:43 +00:00
#+NAME : signal-titlebar-button1
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 1, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.move(c)
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
A right click on the titlebar will also raise the window, but will instead allow
the user to resize the client.
2020-11-13 14:18:43 +00:00
#+NAME : signal-titlebar-button3
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.button({ }, 3, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.resize(c)
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
Next comes the actual creation of the titlebar for the client ~c~ . For that, we
call ~awful.titlebar()~ , tell it where the titlebar should be relative to the
client and what its setup should be. The full call should look like so:
2020-11-13 14:18:43 +00:00
#+NAME : signal-titlebar-create
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
awful.titlebar(c, {position="left", size = 22}) : setup {
<<signal-titlebar-setup >>
}
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
In the setup, I need to repeat to Awesome the titlebar should be on the left of
the client, and I also tell it the layout alignment of the titlebar will be
vertical, because I like vertial titlebars. I also first send it three tables:
2020-11-13 14:18:43 +00:00
- The top or left elements of the titlebar (here the top)
- The middle elements of the titlebar
- The bottom or right elements of the titlebar (here the bottom)
2021-02-04 13:43:09 +00:00
You can notice in the setup’ s code below that I haven’ t included anything in the
middle elements, the only elements I am interested in are the top and bottom
elements. In the top elements, I have (top to bottom):
2020-11-13 14:18:43 +00:00
- A close button
- A maximize button
- A minimize button
- And an indication to Awesome these elements should be vertically aligned
2021-02-04 13:43:09 +00:00
To make Awesome happy, I also must indicate that the middle elements are
vertically aligned, and then I can declare my bottom elements:
2020-11-13 14:18:43 +00:00
- A button for toggling client floating
2021-02-04 13:43:09 +00:00
- And again the indication to Awesome these elements should be vertically
aligned
2020-11-13 14:18:43 +00:00
#+NAME : signal-titlebar-setup
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
{ -- Top
awful.titlebar.widget.closebutton(c),
awful.titlebar.widget.minimizebutton(c),
awful.titlebar.widget.maximizedbutton(c),
layout = wibox.layout.fixed.vertical()
},
{
layout = wibox.layout.fixed.vertical()
}, -- Middle
{ -- Bottom
awful.titlebar.widget.floatingbutton(c),
layout = wibox.layout.fixed.vertical()
},
layout = wibox.layout.align.vertical,
position = "left"
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-10 17:32:58 +00:00
** Changes of focus
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Signals-Changes_of_focus-1b73902c
:END:
2021-02-04 13:43:09 +00:00
The default Awesome configuration enables the following snippet of code that
makes windows hovered by the user’ s mouse focused. Just for completeness’ sake,
I included it in this document, but be aware this won’ t be tangled into my
configuration file and focus will not follow my mouse.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua :tangle no
2021-10-12 09:31:20 +00:00
client.connect_signal("mouse::enter", function(c)
c:emit_signal("request::activate", "mouse_enter", {raise = false})
end)
2020-11-13 14:18:43 +00:00
#+END_SRC
2021-02-04 13:43:09 +00:00
It is also possible to change the color of the borders based on client focus.
While my clients don’ t have any border, they do have a titlebar which color
changes based on the client’ s focus. This is handled by the following code
snippet:
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
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)
2020-11-13 14:18:43 +00:00
#+end_SRC
2020-04-10 17:32:58 +00:00
* Autostart
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: Autostart-f2cf42fe
:END:
2021-02-04 13:43:09 +00:00
By simply adding a line requesting to spawn a command, it is possible to create
some autolaunch. All of my autolaunched apps are launch through a custom script
which you can [[file:~/org/config/bin.org::#Autostart-a99e99e7 ][find here ]]. The command gets called with
~awful.spawn.with_shell()~ , as you can see below.
2020-11-13 14:18:43 +00:00
#+BEGIN_SRC lua
2021-10-12 09:31:20 +00:00
awful.spawn.with_shell("autostart")
2020-11-13 14:18:43 +00:00
#+END_SRC
2020-04-11 18:33:40 +00:00
* What to do now :noexport:
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: What_to_do_now-bce61fe1
:END:
2020-04-12 13:46:40 +00:00
** DONE Error on S-q
CLOSED: [2020-04-12 dim. 15:47]
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: What_to_do_now-Error_on_S-q-beea9b99
:END:
2020-11-13 14:18:43 +00:00
~attempt to index a nil value (global 'c')~
2020-05-17 13:04:07 +00:00
** TODO Make custom theme
2020-12-10 09:20:21 +00:00
:PROPERTIES:
:CUSTOM_ID: What_to_do_now-Make_custom_theme-5837307e
:END: