[Org files] Formatted org files to look better with new org config

This commit is contained in:
Lucien Cartier-Tilet 2020-11-13 15:18:43 +01:00
parent e3880c48b1
commit 3a1015b9e7
Signed by: phundrak
GPG Key ID: BD7789E705CB8DCA
14 changed files with 5326 additions and 6531 deletions

View File

@ -11,36 +11,22 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Introduction-4c41360e :CUSTOM_ID: Introduction-4c41360e
:END: :END:
From the Arch Wiki: awesome is a highly configurable, next generation 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.
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.
Personally, what really made me want to try Awesome is the fact its 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.
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.
This document was written in Emacs with Org-mode and is both the documentation 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~.
and source code of my configuration file which can be extracted to
~$HOME/.config/awesome/rc.lua~ through a call to ~org-babel-tangle~.
* Loading libraries * Loading libraries
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Loading_libraries-4df76999 :CUSTOM_ID: Loading_libraries-4df76999
:END: :END:
First of all, some initialization is needed, and this initialization is about First of all, some initialization is needed, and this initialization is about math randomness. So, lets initialize the ~random~ method of the ~math~ library:
math randomness. So, lets initialize the ~random~ method of the ~math~
library:
#+BEGIN_SRC lua #+BEGIN_SRC lua
math.randomseed(os.time()) math.randomseed(os.time())
#+END_SRC #+END_SRC
In order to be able to load libraries properly, I first need to make sure 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.
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.
#+BEGIN_SRC lua #+BEGIN_SRC lua
pcall(require, "luarocks.loader") pcall(require, "luarocks.loader")
#+END_SRC #+END_SRC
@ -80,18 +66,15 @@
<<imported-libraries()>> <<imported-libraries()>>
#+END_SRC #+END_SRC
I also want to be able to autofocus the first window when I go to another I also want to be able to autofocus the first window when I go to another workspace, so lets require that:
workspace, so lets require that:
#+BEGIN_SRC lua #+BEGIN_SRC lua
require("awful.autofocus") require("awful.autofocus")
#+END_SRC #+END_SRC
And finally, I want to be able to declare some shortcuts specific to some And finally, I want to be able to declare some shortcuts specific to some apps thanks to the hotkeys help widget.
appls thanks to the hotkeys help widget.
#+BEGIN_SRC lua #+BEGIN_SRC lua
require("awful.hotkeys_popup.keys") require("awful.hotkeys_popup.keys")
#+END_SRC #+END_SRC
By the way, lets initialize the ~random~ method of the ~math~ library: By the way, lets initialize the ~random~ method of the ~math~ library:
#+BEGIN_SRC lua #+BEGIN_SRC lua
math.randomseed(os.time()) math.randomseed(os.time())
@ -101,8 +84,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Error_handling-f6a6668f :CUSTOM_ID: Error_handling-f6a6668f
:END: :END:
This code checks if Awesome encountered an error during startup and fell back 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.
to another config. This code will only ever execute for the fallback config.
#+BEGIN_SRC lua #+BEGIN_SRC lua
if awesome.startup_errors then if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical, naughty.notify({ preset = naughty.config.presets.critical,
@ -136,10 +118,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Variable_definitions-Themes-591886b4 :CUSTOM_ID: Variable_definitions-Themes-591886b4
:END: :END:
With Awesome, it is possible to load or write custom themes in order to give 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.
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.
#+BEGIN_SRC lua #+BEGIN_SRC lua
beautiful.init("/home/phundrak/.config/awesome/nord/theme.lua") beautiful.init("/home/phundrak/.config/awesome/nord/theme.lua")
#+END_SRC #+END_SRC
@ -148,9 +127,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Variable_definitions-Default_terminal_and_text_editor-44b84e20 :CUSTOM_ID: Variable_definitions-Default_terminal_and_text_editor-44b84e20
:END: :END:
The two following variables are set so that I dont need to go over my whole The two following variables are set so that I dont 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.
config file in order to modify which terminal or text editor I use, not that
I do it often though.
#+BEGIN_SRC lua #+BEGIN_SRC lua
terminal = "st" terminal = "st"
editor = os.getenv("EDITOR") or "emacsclient -c" editor = os.getenv("EDITOR") or "emacsclient -c"
@ -160,11 +137,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Variable_definitions-Keys-b8def4ac :CUSTOM_ID: Variable_definitions-Keys-b8def4ac
:END: :END:
The following declares the default Modkey. Usually, ~Mod4~ is the Super key, 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.
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.
#+BEGIN_SRC lua #+BEGIN_SRC lua
modkey = "Mod4" modkey = "Mod4"
shift = "Shift" shift = "Shift"
@ -185,9 +158,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Set_a_random_wallpaper-104bbeec :CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Set_a_random_wallpaper-104bbeec
:END: :END:
This function sets a random wallpaper from the directory This function sets a random wallpaper from the directory =~/Pictures/Wallpapers=, see [[file:bin.org::#pape-update-bdecbadf][pape-update]] in my custom scripts. This depends on [[https://github.com/l3ib/nitrogen/][Nitrogen]].
=~/Pictures/Wallpapers=, see [[file:bin.org::#pape-update-bdecbadf][pape-update]] in my custom scripts. This depends
on [[https://github.com/l3ib/nitrogen/][Nitrogen]].
#+BEGIN_SRC lua #+BEGIN_SRC lua
local function set_random_pape() local function set_random_pape()
awful.spawn.with_shell("pape-update") awful.spawn.with_shell("pape-update")
@ -201,8 +172,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c :CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c
:END: :END:
I also wrote the following function that will restore the previously set I also wrote the following function that will restore the previously set wallpaper:
wallpaper:
#+BEGIN_SRC lua #+BEGIN_SRC lua
local function set_wallpaper(_) local function set_wallpaper(_)
awful.spawn.with_shell("nitrogen --restore") awful.spawn.with_shell("nitrogen --restore")
@ -213,8 +183,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Custom_functions-Layout_manipulation-6bc7db06 :CUSTOM_ID: Custom_functions-Layout_manipulation-6bc7db06
:END: :END:
The following function is used by a shortcut described below in The following function is used by a shortcut described below in [[#Keybindings-Clients-f9f96d60]].
[[#Keybindings-Clients-f9f96d60]].
#+BEGIN_SRC lua #+BEGIN_SRC lua
local function client_go_back() local function client_go_back()
awful.client.focus.history.previous() awful.client.focus.history.previous()
@ -333,8 +302,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Layouts-be55a7fd :CUSTOM_ID: Layouts-be55a7fd
:END: :END:
The following is a list of available windows layouts. I only enable some of 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.
them, and their order in the table is their order in Awesome.
#+NAME: table-layouts #+NAME: table-layouts
| Layout | Enabled? | | Layout | Enabled? |
|-----------------+----------| |-----------------+----------|
@ -390,9 +358,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Top_bar-d3117294 :CUSTOM_ID: Top_bar-d3117294
:END: :END:
The top bar in Awesome is declared thanks to a ~wibar~ widget fro the ~awful~ 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.
library. It is comprised of several buttons and widgets that will be declared
below.
** Menus ** Menus
:PROPERTIES: :PROPERTIES:
@ -416,9 +382,7 @@
: { "restart", awesome.restart } : { "restart", awesome.restart }
: { "quit", function() awesome.quit() end } : { "quit", function() awesome.quit() end }
It is possible to create actual menus in Awesome, including the one available It is possible to create actual menus in Awesome, including the one available at the top-left corner of the screen. First, lets declare a menu related to Awesome:
at the top-left corner of the screen. First, lets declare a menu related to
Awesome:
#+NAME: table-awesome-menu #+NAME: table-awesome-menu
| Name | Command | | Name | Command |
|-------------+---------------------------------------------------------------------| |-------------+---------------------------------------------------------------------|
@ -434,8 +398,7 @@
} }
#+END_SRC #+END_SRC
Next, lets create the main menu that will be used on ~S-w~ and at the top Next, lets create the main menu that will be used on ~S-w~ and at the top left of the window:
left of the window:
#+NAME: table-main-menu #+NAME: table-main-menu
| Name | Command | Icon | | Name | Command | Icon |
|---------------+----------------+------------------------| |---------------+----------------+------------------------|
@ -449,16 +412,13 @@
}}) }})
#+END_SRC #+END_SRC
For now it only has two entries: the Awesome menu and opening a terminal, I For now it only has two entries: the Awesome menu and opening a terminal, I will add some more later probably. Lets specify it as being our main launcher:
will add some more later probably. Lets specify it as being our main
launcher:
#+BEGIN_SRC lua #+BEGIN_SRC lua
launcher = awful.widget.launcher({ image = beautiful.awesome_icon, launcher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mainmenu }) menu = mainmenu })
#+END_SRC #+END_SRC
Finally, lets declare the menubars terminal for applications that require Finally, lets declare the menubars terminal for applications that require it.
it.
#+BEGIN_SRC lua #+BEGIN_SRC lua
menubar.utils.terminal = terminal menubar.utils.terminal = terminal
#+END_SRC #+END_SRC
@ -481,39 +441,28 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Top_bar-Tag_list-d43dbb62 :CUSTOM_ID: Top_bar-Tag_list-d43dbb62
:END: :END:
In order to create the taglist (an equivalent to workspaces, but better), we 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:
need to create first a local variable that will hold the widget. It will be
declared as you can see below:
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
local tasklist_buttons = gears.table.join( local tasklist_buttons = gears.table.join(
-- configuration goes here -- configuration goes here
) )
#+END_SRC #+END_SRC
~gears.table.join()~ joins several tables together, as described [[https://awesomewm.org/doc/api/libraries/gears.table.html][here]], which ~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, lets manage left clicks.
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, lets manage left clicks.
Left clicks in general are dedicated to tag visibility. A simple left click 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.
on a tag should switch this tag as the only visible tag, no matter how many
of them were visible beforehand.
#+NAME: tag-simple-left-click #+NAME: tag-simple-left-click
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 1, function(t) t:view_only() end) awful.button({ }, 1, function(t) t:view_only() end)
#+END_SRC #+END_SRC
However, left clicks combined with the modkey will add the clicked tag to the 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.
list of visible tags, which allows the user to see windows from several tags
at once.
#+NAME: tag-mod-left-click #+NAME: tag-mod-left-click
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ modkey }, 1, awful.tag.viewtoggle) awful.button({ modkey }, 1, awful.tag.viewtoggle)
#+END_SRC #+END_SRC
Right clicks are dedicated to window tagging. A simple right click will untag 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.
the currently focused window and tag it again with the clicked tag, moving it
effectively from one tag to another.
#+NAME: tag-simple-right-click #+NAME: tag-simple-right-click
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 3, function(t) awful.button({ }, 3, function(t)
@ -523,8 +472,7 @@
end) end)
#+END_SRC #+END_SRC
However, a right click combined with the modkey will add the clicked tag to However, a right click combined with the modkey will add the clicked tag to the currently focused window, making it visible to both tags.
the currently focused window, making it visible to both tags.
#+NAME: tag-mod-right-click #+NAME: tag-mod-right-click
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ modkey }, 3, function(t) awful.button({ modkey }, 3, function(t)
@ -534,10 +482,7 @@
end) end)
#+END_SRC #+END_SRC
The scroll wheel is treated as clicks just as any right or left clicks and 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.
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.
#+NAME: tag-simple-scroll-up #+NAME: tag-simple-scroll-up
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end) awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end)
@ -565,17 +510,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Top_bar-Tasks_list-fb7c9b20 :CUSTOM_ID: Top_bar-Tasks_list-fb7c9b20
:END: :END:
Similarly to the tag list, the task list can display some special behavior 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:
depending on the clicks it receives. These clicks are set like so:
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
local tasklist_buttons = gears.table.join( local tasklist_buttons = gears.table.join(
-- List of clicks -- List of clicks
) )
#+END_SRC #+END_SRC
A left click on a task in the taskbar will simply focus and raise the window 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.
linked to it if it is not focused. Otherwise, if the window is focused, the
window will be minimized.
#+NAME: task-simple-left-click #+NAME: task-simple-left-click
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 1, function (c) awful.button({ }, 1, function (c)
@ -591,9 +533,7 @@
end) end)
#+END_SRC #+END_SRC
If the right click is detected, then a list of all the opened clients is 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.
invoked so we can switch to another (and if needed switch visible tag). The
width of this list will be 250px.
#+NAME: task-simple-right-click #+NAME: task-simple-right-click
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 3, function() awful.button({ }, 3, function()
@ -601,8 +541,7 @@
end) end)
#+END_SRC #+END_SRC
If a scroll up is detected, then lets select the previous client in the If a scroll up is detected, then lets select the previous client in the tasklist.
tasklist.
#+NAME: task-simple-scroll-up #+NAME: task-simple-scroll-up
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 4, function () awful.button({ }, 4, function ()
@ -610,8 +549,7 @@
end) end)
#+END_SRC #+END_SRC
If a scroll down is detected, then lets select the next client in the If a scroll down is detected, then lets select the next client in the tasklist.
tasklist.
#+NAME: task-simple-scroll-down #+NAME: task-simple-scroll-down
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 5, function () awful.button({ }, 5, function ()
@ -637,26 +575,19 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Theme_and_display-Screen_update-e162a27a :CUSTOM_ID: Theme_and_display-Screen_update-e162a27a
:END: :END:
When a screens geometry changes (e.g. when a different resolution is When a screens 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 wont 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]]! Lets connect this function to the geometry change signal:
applied), the signal ~property::geometry~ is sent. When this is the case, the
wallpaper should be redisplayed since it wont 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]]! Lets connect this function to the geometry change signal:
#+BEGIN_SRC lua #+BEGIN_SRC lua
screen.connect_signal("property::geometry", set_wallpaper) screen.connect_signal("property::geometry", set_wallpaper)
#+END_SRC #+END_SRC
If a new screen gets connected, it will need to get a new wallpaper. A lot 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:
needs to be done, and all the following lines of code will be inside a block
like this:
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.screen.connect_for_each_screen(function(s) awful.screen.connect_for_each_screen(function(s)
-- Code to be executed goes here -- Code to be executed goes here
end) end)
#+END_SRC #+END_SRC
So, due the code block above, if you see any reference to ~s~ in the code 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.
blocks below, it will refer to the screen being set up by the function.
First, lets set its wallpaper: First, lets set its wallpaper:
#+NAME: screen-set-pape #+NAME: screen-set-pape
@ -664,17 +595,14 @@
set_wallpaper() set_wallpaper()
#+END_SRC #+END_SRC
Next, lets build a list of tags for the screen. *Be aware that each screen Next, lets 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
has its own tag table!* The default layout will be the first refered to in the layouts list described above]].
[[#Layouts-be55a7fd][the layouts list described above]].
#+NAME: screen-taglist #+NAME: screen-taglist
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1]) awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1])
#+END_SRC #+END_SRC
Next, lets create the taglist widget. It will use the ~taglist_buttons~ Next, lets 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]]).
[[#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]]).
#+NAME: screen-taglist-widget #+NAME: screen-taglist-widget
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
s.taglist = awful.widget.taglist { s.taglist = awful.widget.taglist {
@ -684,10 +612,7 @@
} }
#+END_SRC #+END_SRC
A tasklist widget will also get created thanks with the ~tasklist_button~ 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 screens current tags thanks to its filter.
[[#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 screens current tags thanks
to its filter.
#+NAME: screen-tasklist-widget #+NAME: screen-tasklist-widget
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
s.tasklist = awful.widget.tasklist { s.tasklist = awful.widget.tasklist {
@ -703,11 +628,7 @@
s.promptbox = awful.widget.prompt() s.promptbox = awful.widget.prompt()
#+END_SRC #+END_SRC
Then, Lets create an imagebox widget in which will be contained an icon Then, Lets 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.
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.
#+NAME: screen-layout-indicator #+NAME: screen-layout-indicator
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
s.layoutbox = awful.widget.layoutbox(s) s.layoutbox = awful.widget.layoutbox(s)
@ -724,11 +645,7 @@
s.wibox = awful.wibar({ position = "top", screen = s }) s.wibox = awful.wibar({ position = "top", screen = s })
#+END_SRC #+END_SRC
Finally, lets set up our bar. Since it is a horizontal bar, its layout will Finally, lets 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.
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.
#+NAME: screen-wibox-setup #+NAME: screen-wibox-setup
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
s.wibox:setup { s.wibox:setup {
@ -768,9 +685,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Mouse_bindings-eb4a69a8 :CUSTOM_ID: Mouse_bindings-eb4a69a8
:END: :END:
It is possible with Awesome to bind some shortcuts to mouse events when the 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.
mouse is above Awesome itself (not above some client). Only one is set: the
right click opens the Awesome menu.
#+BEGIN_SRC lua #+BEGIN_SRC lua
root.buttons(gears.table.join( root.buttons(gears.table.join(
awful.button({}, 3, function() mainmenu:toggle() end) awful.button({}, 3, function() mainmenu:toggle() end)
@ -779,12 +694,9 @@
I will also set three mouse bindings for when the mouse is above a client: I will also set three mouse bindings for when the mouse is above a client:
- A simple click on a client will focus and raise it. - A simple click on a client will focus and raise it.
- A click on a client combined with a modkey press will allow the user to move - 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 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 middle click on a client combined with a modkey press will toggle the - A right click combined with the modkey will allow the user to resize a after focusing it and making it a floating client.
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.
#+BEGIN_SRC lua #+BEGIN_SRC lua
clientbuttons = gears.table.join( clientbuttons = gears.table.join(
@ -811,34 +723,22 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Keybindings-a4e415b3 :CUSTOM_ID: Keybindings-a4e415b3
:END: :END:
Keybindings allow the user to execute some Lua code all across Awesome. They 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.
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.
Here are some keybindings related to Awesome itself. Most of them will be 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.
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.
Here is a description of the tables displayed below: Here is a description of the tables displayed below:
- Key :: key which toggles the shortcut - Key :: key which toggles the shortcut
- Modifiers :: modifier keys that are required to toggle the shortcut - Modifiers :: modifier keys that are required to toggle the shortcut
- Lambda? :: whether or not the ~Action~ should be nested in a lambda - Lambda? :: whether or not the ~Action~ should be nested in a lambda function. Possible values are:
function. Possible values are:
- ~no~ :: The value is a Lua function to be executed as is - ~no~ :: The value is a Lua function to be executed as is
- ~yes~ :: The value is to be inserted into a lambda - ~yes~ :: The value is to be inserted into a lambda
- ~spawn~ :: The value is to be inserted in an ~awful.spawn~ call in a - ~spawn~ :: The value is to be inserted in an ~awful.spawn~ call in a lambda
lambda - ~shell~ :: The value is to be inserted in an ~awful.spawn.with_shell~ call in a lambda
- ~shell~ :: The value is to be inserted in an ~awful.spawn.with_shell~ call
in a lambda
- Action :: code to be executed by the shortcut - Action :: code to be executed by the shortcut
- What it does :: short description of the shortcuts action - What it does :: short description of the shortcuts action
- Group :: group in which the shortcut will appear in Awesomes help window - Group :: group in which the shortcut will appear in Awesomes help window
- Clientkey? :: whether this should be a global shortcut or a shortcut only - Clientkey? :: whether this should be a global shortcut or a shortcut only aimed at clients (value is ~yes~ or ~no~)
aimed at clients (value is ~yes~ or ~no~)
#+NAME: gen-sc-text #+NAME: gen-sc-text
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
@ -932,10 +832,7 @@
",\n\n")) ",\n\n"))
#+END_SRC #+END_SRC
Most of these keybindings are available at root-level of Awesome and will be 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]]).
declared in the ~globalkeys~ variable, which will be added then to ~root.keys~
(see [[https://awesomewm.org/doc/api/libraries/root.html#keys]]).
#+BEGIN_SRC lua :cache yes #+BEGIN_SRC lua :cache yes
globalkeys = gears.table.join( globalkeys = gears.table.join(
-- Awesome -- Awesome
@ -1145,9 +1042,7 @@
| t | modkey, control | no | awful.tag.viewprev | view prev | tag | | t | modkey, control | no | awful.tag.viewprev | view prev | tag |
| s | modkey, control | no | awful.tag.viewnext | view next | tag | | s | modkey, control | no | awful.tag.viewnext | view next | tag |
Another set of shortcuts is linked to the number row on the keyboard that 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:
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:
#+NAME: sc-tag-num #+NAME: sc-tag-num
| Key | Modifiers | Action | What it does | Group | | Key | Modifiers | Action | What it does | Group |
|--------+------------------------+---------------------------------+--------------------------------+-------| |--------+------------------------+---------------------------------+--------------------------------+-------|
@ -1160,10 +1055,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Keybindings-Misc-0b45ce02 :CUSTOM_ID: Keybindings-Misc-0b45ce02
:END: :END:
In this category you will find other keybindings that do not fit in other 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 touchpads tapping ability. This is linked to a special script I wrote [[file:bin.org::#Toggle_touchpad_tapping-23348b00][here]].
categories. For now, the only keybinding that is in this category is for
toggling the touchpads tapping ability. This is linked to a special script I
wrote [[file:bin.org::#Toggle_touchpad_tapping-23348b00][here]].
#+NAME: sc-misc #+NAME: sc-misc
| Key | Modifiers | Lambda? | Action | What it does | Group | | Key | Modifiers | Lambda? | Action | What it does | Group |
|--------------------+-----------+---------+-----------+-------------------------+-------| |--------------------+-----------+---------+-----------+-------------------------+-------|
@ -1173,10 +1065,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rules-c6142cdf :CUSTOM_ID: Rules-c6142cdf
:END: :END:
With ~awful.rules~, users are able to describe some rules for window clients 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:
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:
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.rules.rules = { awful.rules.rules = {
-- Rules here -- Rules here
@ -1193,15 +1082,13 @@
} }
#+END_SRC #+END_SRC
For more documentation on rules and their syntax, you can read the [[https://awesomewm.org/doc/api/libraries/awful.rules.html][official For more documentation on rules and their syntax, you can read the [[https://awesomewm.org/doc/api/libraries/awful.rules.html][official documentation]].
documentation]].
** Universal rules ** Universal rules
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rules-Universal_rules-50aad2ce :CUSTOM_ID: Rules-Universal_rules-50aad2ce
:END: :END:
The first rule is a universal rule which will match all clients, as you can The first rule is a universal rule which will match all clients, as you can see with its syntax below:
see with its syntax below:
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
{ rule = {}, { rule = {},
properties = { properties = {
@ -1210,8 +1097,7 @@
} }
#+END_SRC #+END_SRC
Here is the list of properties with their value to apply to all clients, and Here is the list of properties with their value to apply to all clients, and a short explanation as to what they do.
a short explanation as to what they do.
#+NAME: rules-universal-properties-table #+NAME: rules-universal-properties-table
| Property | Value | What it does | | Property | Value | What it does |
|---------------+---------------------------------------------------------+-------------------------------------------------------------------------| |---------------+---------------------------------------------------------+-------------------------------------------------------------------------|
@ -1260,8 +1146,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rules-Floating_clients-49ab582e :CUSTOM_ID: Rules-Floating_clients-49ab582e
:END: :END:
Some clients will be declared by default as floating windows. For this, we 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:
will declare a rule that will match any of the provided conditions:
#+NAME: rules-floating-conditions-table #+NAME: rules-floating-conditions-table
| Property | Matches | Comment | | Property | Matches | Comment |
|----------+--------------+----------------------------------------------------------------| |----------+--------------+----------------------------------------------------------------|
@ -1280,7 +1165,7 @@
",\n") ",\n")
#+END_SRC #+END_SRC
#+RESULTS: rules-floating-conditions #+RESULTS[1fbe7dc1e85b5170957c9583e39c4cbec9a7d7ca]: rules-floating-conditions
: instance = { "pinentry" }, : instance = { "pinentry" },
: class = { "Arandr" }, : class = { "Arandr" },
: class = { "Sxiv" }, : class = { "Sxiv" },
@ -1288,8 +1173,7 @@
: name = { "Event Tester" }, : name = { "Event Tester" },
: role = { "pop-up" } : role = { "pop-up" }
If any of these conditions is matched, then the client will be set as If any of these conditions is matched, then the client will be set as floating, as you can see below:
floating, as you can see below:
#+NAME: rules-floating #+NAME: rules-floating
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
{ rule_any = { { rule_any = {
@ -1313,8 +1197,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rules-Default_tag_for_clients-6ded2a47 :CUSTOM_ID: Rules-Default_tag_for_clients-6ded2a47
:END: :END:
With the use of some rules, it is possible to define which client are With the use of some rules, it is possible to define which client are assigned to which tag by default.
assigned to which tag by default.
#+NAME: rules-default-tags-table #+NAME: rules-default-tags-table
| Client Property | Value | Tag | | Client Property | Value | Tag |
|-----------------+------------+-----| |-----------------+------------+-----|
@ -1354,17 +1237,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Signals-e32971d6 :CUSTOM_ID: Signals-e32971d6
:END: :END:
Signals are a way for Awesome to handle events, such as client creation or Signals are a way for Awesome to handle events, such as client creation or deletion.
deletion.
** Client creation ** Client creation
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Signals-Client_creation-8048ac12 :CUSTOM_ID: Signals-Client_creation-8048ac12
:END: :END:
When a new client is created, the ~manage~ signal is emited. When so, the 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.
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.
#+BEGIN_SRC lua #+BEGIN_SRC lua
client.connect_signal("manage", function (c) client.connect_signal("manage", function (c)
awful.client.movetoscreen(c, mouse.screen) awful.client.movetoscreen(c, mouse.screen)
@ -1380,10 +1259,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Signals-Titlebar_creation-3b1aaa14 :CUSTOM_ID: Signals-Titlebar_creation-3b1aaa14
:END: :END:
It is possible for Awesome to send request signals, such as the request to 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.
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.
#+BEGIN_SRC lua #+BEGIN_SRC lua
client.connect_signal("request::titlebars", function(c) client.connect_signal("request::titlebars", function(c)
local buttons = gears.table.join( local buttons = gears.table.join(
@ -1394,19 +1270,14 @@
end) end)
#+END_SRC #+END_SRC
The function has two main parts: the creation of the titlebar buttons (mouse 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.
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.
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
local buttons = gears.table.join( local buttons = gears.table.join(
-- Buttons declared here -- Buttons declared here
) )
#+END_SRC #+END_SRC
You can see a left click will enable the user to raise the window, but also 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).
it will enable the user to move the window (if it is floating of course).
#+NAME: signal-titlebar-button1 #+NAME: signal-titlebar-button1
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 1, function() awful.button({ }, 1, function()
@ -1415,8 +1286,7 @@
end) end)
#+END_SRC #+END_SRC
A right click on the titlebar will also raise the window, but will instead A right click on the titlebar will also raise the window, but will instead allow the user to resize the client.
allow the user to resize the client.
#+NAME: signal-titlebar-button3 #+NAME: signal-titlebar-button3
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.button({ }, 3, function() awful.button({ }, 3, function()
@ -1425,9 +1295,7 @@
end) end)
#+END_SRC #+END_SRC
Next comes the actual creation of the titlebar for the client ~c~. For that, 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:
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:
#+NAME: signal-titlebar-create #+NAME: signal-titlebar-create
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
awful.titlebar(c, {position="left"}) : setup { awful.titlebar(c, {position="left"}) : setup {
@ -1435,25 +1303,18 @@
} }
#+END_SRC #+END_SRC
In the setup, I need to repeat to Awesome the titlebar should be on the left 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:
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:
- The top or left elements of the titlebar (here the top) - The top or left elements of the titlebar (here the top)
- The middle elements of the titlebar - The middle elements of the titlebar
- The bottom or right elements of the titlebar (here the bottom) - The bottom or right elements of the titlebar (here the bottom)
You can notice in the setups code below that I havent included anything in You can notice in the setups code below that I havent 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):
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):
- A close button - A close button
- A maximize button - A maximize button
- A minimize button - A minimize button
- And an indication to Awesome these elements should be vertically aligned - And an indication to Awesome these elements should be vertically aligned
To make Awesome happy, I also must indicate that the middle elements are To make Awesome happy, I also must indicate that the middle elements are vertically aligned, and then I can declare my bottom elements:
vertically aligned, and then I can declare my bottom elements:
- A button for toggling client floating - A button for toggling client floating
- And again the indication to Awesome these elements should be vertically - And again the indication to Awesome these elements should be vertically aligned
aligned
#+NAME: signal-titlebar-setup #+NAME: signal-titlebar-setup
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
{ -- Top { -- Top
@ -1477,20 +1338,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Signals-Changes_of_focus-1b73902c :CUSTOM_ID: Signals-Changes_of_focus-1b73902c
:END: :END:
The default Awesome configuration enables the following snippet of code that The default Awesome configuration enables the following snippet of code that makes windows hovered by the users mouse focused. Just for completeness sake, I included it in this document, but be aware this wont be tangled into my configuration file and focus will not follow my mouse.
makes windows hovered by the users mouse focused. Just for completeness
sake, I included it in this document, but be aware this wont be tangled into
my configuration file and focus will not follow my mouse.
#+BEGIN_SRC lua :tangle no #+BEGIN_SRC lua :tangle no
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 #+END_SRC
It is also possible to change the color of the borders based on client focus. It is also possible to change the color of the borders based on client focus. While my clients dont have any border, they do have a titlebar which color changes based on the clients focus. This is handled by the following code snippet:
While my clients dont have any border, they do have a titlebar which color
changes based on the clients focus. This is handled by the following code
snippet:
#+BEGIN_SRC lua #+BEGIN_SRC 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)
@ -1500,10 +1355,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Autostart-f2cf42fe :CUSTOM_ID: Autostart-f2cf42fe
:END: :END:
By simply adding a line requesting to spawn a command, it is possible to 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.
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.
#+BEGIN_SRC lua #+BEGIN_SRC lua
awful.spawn.with_shell("autostart") awful.spawn.with_shell("autostart")
#+END_SRC #+END_SRC
@ -1512,7 +1364,6 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: What_to_do_now-bce61fe1 :CUSTOM_ID: What_to_do_now-bce61fe1
:END: :END:
** DONE Error on S-q ** DONE Error on S-q
CLOSED: [2020-04-12 dim. 15:47] CLOSED: [2020-04-12 dim. 15:47]
:PROPERTIES: :PROPERTIES:

View File

@ -11,86 +11,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Presentation-721f3cc4 :CUSTOM_ID: Presentation-721f3cc4
:END: :END:
This file will present all the executable scripts I wrote. It is also their This file will present all the executable scripts I wrote. It is also their original source code, all the following code snippets are exported and tangled from this file to the actual executables.
original source code, all the following code snippets are exported and tangled
from this file to the actual executables.
* 4chandl
:PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/4chandl
:CUSTOM_ID: 4chandl-21ff428f
:END:
Usage: =4chandl [ URL TO THREAD ]=
I made this small script to download the attached files of 4chan threads.
Lets check if any arguments were passed to the executable. If none were
passed, the script should be aborted.
#+BEGIN_SRC fish
if ! count $argv > /dev/null
echo 'No URL specified! Give the URL to thread as the only argument.'
exit 1
end
#+END_SRC
Now, lets store the regex we use to get the link to the attached files.
#+BEGIN_SRC fish
set regex_4cdn '\/\/is2\.4chan\.org\/[a-z]+\/[A-Za-z0-9]+\.[A-Za-z]{3,4}'
#+END_SRC
Well use a thread counter to get a visual indication on how the download is
going.
#+BEGIN_SRC fish
set thread_counter 1
#+END_SRC
Now, we will use each of the arguments passed as a URL to download the files
from.
#+BEGIN_SRC fish
for url in $argv
#+END_SRC
As a visual indicator, lets get the amount of elements we are going to
download from the current thread and print it.
#+BEGIN_SRC fish
set file_total (curl -ks $url | grep -oE $regex_4cdn | uniq | wc -l)
echo total files to download in current thread: $file_total
#+END_SRC
Lets set a file counter so we can visualize the download progress.
#+BEGIN_SRC fish
set file_counter 1
#+END_SRC
Now, lets download each file from the current thread.
#+BEGIN_SRC fish
for image_url in (curl -k -s $url | grep -Eo $regex_4cdn | uniq | sed 's/^/https:/')
echo -n Downloading image $counter of $total...
wget --no-check-certificate -q -nc $image_url
echo ' Done (thread: $thread_counter/thread_total\tfile: $file_counter/file_total)'
set file_counter (math $file_counter + 1)
end
#+END_SRC
Lets increment the thread counter.
#+BEGIN_SRC fish
set thread_counter (math $thread_counter + 1)
#+END_SRC
Lets now close the for loop.
#+BEGIN_SRC fish
end
#+END_SRC
* Autostart * Autostart
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/autostart :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/autostart
:CUSTOM_ID: Autostart-a99e99e7 :CUSTOM_ID: Autostart-a99e99e7
:END: :END:
Because I sometimes switch from window manager to window manager, creating a Because I sometimes switch from window manager to window manager, creating a script that handles by itself autostarting things for me is way easier than rewriting every time the autostart part of my configuration. As you can every instance will be launched asynchronously, and only if there is no other instance of said command running.
script that handles by itself autostarting things for me is way easier than
rewriting every time the autostart part of my configuration. As you can every
instance will be launched asynchronously, and only if there is no other
instance of said command running.
~set-screens~ is a custom script declared [[*set-screens][below]]. ~set-screens~ is a custom script declared [[*set-screens][below]].
#+NAME: autostart-table #+NAME: autostart-table
@ -173,20 +101,9 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/awiki :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/awiki
:CUSTOM_ID: awiki-7ac5e1d5 :CUSTOM_ID: awiki-7ac5e1d5
:END: :END:
~awiki~ is a simple script used with ~rofi~ that relies on the ~awiki~ is a simple script used with ~rofi~ that relies on the ~arch-wiki-docs~ package in order to provide the user a way to quickly find and display any English page from the Arch Wiki in a browser. The advantage of using this over the ~wiki-search~ utility from the ~arch-wiki-lite~ package is you get instant suggestion in rofi using fuzzy-search. The downside is rofi will only help you find pages by their title, and it will not help you find keywords in the content of said pages.
~arch-wiki-docs~ package in order to provide the user a way to quickly find
and display any English page from the Arch Wiki in a browser. The advantage of
using this over the ~wiki-search~ utility from the ~arch-wiki-lite~ package is
you get instant suggestion in rofi using fuzzy-search. The downside is rofi
will only help you find pages by their title, and it will not help you find
keywords in the content of said pages.
The first step is to create the list of all the pages that are currently The first step is to create the list of all the pages that are currently stored on disk. ~arch-wiki-docs~ stores them in ~/usr/share/doc/arch-wiki/html/en~. A simple ~ls~ piped in three ~sed~ will give us a list of page titles. We then pipe that into rofi in dmenu mode in order to choose the page we want to display. By the way, setting the location of the HTML files will come in handy later.
stored on disk. ~arch-wiki-docs~ stores them in
~/usr/share/doc/arch-wiki/html/en~. A simple ~ls~ piped in three ~sed~ will
give us a list of page titles. We then pipe that into rofi in dmenu mode in
order to choose the page we want to display. By the way, setting the location
of the HTML files will come in handy later.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set WLOCATION /usr/share/doc/arch-wiki/html/en/ set WLOCATION /usr/share/doc/arch-wiki/html/en/
set WPAGE (/bin/ls $WLOCATION | \ set WPAGE (/bin/ls $WLOCATION | \
@ -194,8 +111,7 @@
rofi -dmenu -p "Arch Wiki" -i | sed 's/ +/_/g') rofi -dmenu -p "Arch Wiki" -i | sed 's/ +/_/g')
#+END_SRC #+END_SRC
Now, all I need to do is to send this list into rofi and tell it to open the Now, all I need to do is to send this list into rofi and tell it to open the result with our favorite browser with ~xdg-open~.
result with our favorite browser with ~xdg-open~.
#+BEGIN_SRC fish #+BEGIN_SRC fish
xdg-open $WLOCATION$WPAGE.html xdg-open $WLOCATION$WPAGE.html
#+END_SRC #+END_SRC
@ -205,10 +121,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/askpass :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/askpass
:CUSTOM_ID: Askpass-d0d7a8c0 :CUSTOM_ID: Askpass-d0d7a8c0
:END: :END:
Askpass is a simple script that invokes ~rofi~ as a way to get from a GUI the Askpass is a simple script that invokes ~rofi~ as a way to get from a GUI the users sudo password. It is inspired by [[https://github.com/ODEX-TOS/tools/blob/master/rofi/askpass][this original tool]], rewritten in fish and with [[https://wiki.archlinux.org/index.php/Rofi][rofi]] support instead of [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]]. As you can see, this is a oneliner if we ignore the initial shebang. This executable is pointed at by the
users sudo password. It is inspired by [[https://github.com/ODEX-TOS/tools/blob/master/rofi/askpass][this original tool]], rewritten in fish
and with [[https://wiki.archlinux.org/index.php/Rofi][rofi]] support instead of [[https://wiki.archlinux.org/index.php/Dmenu][dmenu]]. As you can see, this is a oneliner if
we ignore the initial shebang. This executable is pointed at by the
#+BEGIN_SRC fish #+BEGIN_SRC fish
rofi -dmenu -password -no-fixed-num-lines -p (printf $argv[1] | sed s/://) rofi -dmenu -password -no-fixed-num-lines -p (printf $argv[1] | sed s/://)
#+END_SRC #+END_SRC
@ -218,22 +131,17 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/backup :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/backup
:CUSTOM_ID: Backup-68c7c63e :CUSTOM_ID: Backup-68c7c63e
:END: :END:
~backup~ is a very simple, oneliner script that will create a local copy of a ~backup~ is a very simple, oneliner script that will create a local copy of a file and add the date at which it was copied in the filename. You can see its source code here:
file and add the date at which it was copied in the filename. You can see its
source code here:
#+BEGIN_SRC fish #+BEGIN_SRC fish
cp -r $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S") cp -r $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S")
#+END_SRC #+END_SRC
* ConnectWifi * ConnectWifi :noexport:
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/connect-wifi :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/connect-wifi
:CUSTOM_ID: ConnectWifi-16e5e24a :CUSTOM_ID: ConnectWifi-16e5e24a
:END: :END:
~connect-wifi~ is a small utility tool that allows the user to connect to ~connect-wifi~ is a small utility tool that allows the user to connect to available WiFi networks. The first thing to do is to select the WiFi we want to connect to. Well use the ~nmcli c s~ command to get the list of the available networks, and well chose one with ~rofi~.
available WiFi networks. The first thing to do is to select the WiFi we want
to connect to. Well use the ~nmcli c s~ command to get the list of the
available networks, and well chose one with ~rofi~.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set SELECTEDWIFI (nmcli d w l | \ set SELECTEDWIFI (nmcli d w l | \
egrep -o '([0-9A-F]{2}:){5}[0-9A-F]{2}\s*(.*)Infra' | \ egrep -o '([0-9A-F]{2}:){5}[0-9A-F]{2}\s*(.*)Infra' | \
@ -259,18 +167,13 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :tangle no :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :tangle no
:CUSTOM_ID: Cppnew-964e697b :CUSTOM_ID: Cppnew-964e697b
:END: :END:
=cppnew= is a small utility that helps you create a new C++ project. Several =cppnew= is a small utility that helps you create a new C++ project. Several templates are available, the default one using CMake, and three others that are a bit more advances, based on:
templates are available, the default one using CMake, and three others that
are a bit more advances, based on:
- CMake + [[https://conan.io/][Conan]] - CMake + [[https://conan.io/][Conan]]
- [[https://mesonbuild.com/][Meson]] + [[https://ninja-build.org/][Ninja]] - [[https://mesonbuild.com/][Meson]] + [[https://ninja-build.org/][Ninja]]
- Meson + Ninja + Conan - Meson + Ninja + Conan
There is also a default [[http://doxygen.nl/][Doxygen]] file included for your documentation, ready to There is also a default [[http://doxygen.nl/][Doxygen]] file included for your documentation, ready to go. I even made it so that you can execute it as an executable file, like =./doc/Doxyfile= from the project root.
go. I even made it so that you can execute it as an executable file, like
=./doc/Doxyfile= from the project root.
The choice is given to the user which of them to use with options that will be The choice is given to the user which of them to use with options that will be given to =cppnew=.
given to =cppnew=.
First of all, if no arguments were passed, return an error. First of all, if no arguments were passed, return an error.
#+begin_src fish #+begin_src fish
@ -279,17 +182,14 @@
end end
#+end_src #+end_src
Now, lets set a couple of variables which will prove useful later on when Now, lets set a couple of variables which will prove useful later on when trying to set up our project.
trying to set up our project.
* Cnew * Cnew
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/cnew :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/cnew
:CUSTOM_ID: Cnew-d9ec9cc4 :CUSTOM_ID: Cnew-d9ec9cc4
:END: :END:
=cnew= is a small utility script similar to but simpler than cppnew that =cnew= is a small utility script similar to but simpler than cppnew that creates a CMake template C project from the template that already exists in [[file:~/dev/templateC][~/dev/templateC]]. If no argument was passed, display an error message and exit.
creates a CMake template C project from the template that already exists in
[[file:~/dev/templateC][~/dev/templateC]]. If no argument was passed, display an error message and exit.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if ! count $argv > /dev/null if ! count $argv > /dev/null
echo "Missing argument: PROJECT" && return -1 echo "Missing argument: PROJECT" && return -1
@ -301,8 +201,7 @@
switch "$argv[1]" switch "$argv[1]"
#+END_SRC #+END_SRC
If the argument is =-h= or =--help=, then display the help message and exit If the argument is =-h= or =--help=, then display the help message and exit the script normally.
the script normally.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case -h --help case -h --help
man ~/dev/fishfunctions/cnew.man man ~/dev/fishfunctions/cnew.man
@ -320,15 +219,13 @@
end end
#+END_SRC #+END_SRC
Now, lets copy the template where the user is executing =cnew= from, give it Now, lets copy the template where the user is executing =cnew= from, give it the name of the project and move to the project.
the name of the project and move to the project.
#+BEGIN_SRC fish #+BEGIN_SRC fish
cp -r ~/dev/templateC $argv[1] cp -r ~/dev/templateC $argv[1]
cd $argv[1] cd $argv[1]
#+END_SRC #+END_SRC
The default files have a placeholder for the name of the project. Lets The default files have a placeholder for the name of the project. Lets replace these placeholders with the projects name.
replace these placeholders with the projects name.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sed -i "s/PROJECTNAME/$argv[1]/g" CMakeLists.txt sed -i "s/PROJECTNAME/$argv[1]/g" CMakeLists.txt
sed -i "s/PROJECTNAME/$argv[1]/g" README.org sed -i "s/PROJECTNAME/$argv[1]/g" README.org
@ -349,23 +246,19 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dart_language_server :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dart_language_server
:CUSTOM_ID: Dart_Language_Server-18c256b1 :CUSTOM_ID: Dart_Language_Server-18c256b1
:END: :END:
Spacemacs' recommendations on how to use Dart with LSP is outdated, since Spacemacs' recommendations on how to use Dart with LSP is outdated, since [[https://github.com/natebosch/dart_language_server][=dart_language_server=]] is obsolete. As recommended by the repo owner, we should launch instead the following code:
[[https://github.com/natebosch/dart_language_server][=dart_language_server=]] is obsolete. As recommended by the repo owner, we
should launch instead the following code:
#+BEGIN_SRC fish #+BEGIN_SRC fish
/usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp /usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp
#+END_SRC #+END_SRC
So, instead of using the obsolete executable, instead we will be calling the
analysis server as requested. So, instead of using the obsolete executable, instead we will be calling the analysis server as requested.
* Dmenu * Dmenu
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dmenu :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dmenu
:CUSTOM_ID: Dmenu-527edf04 :CUSTOM_ID: Dmenu-527edf04
:END: :END:
I wrote this very simple script in order to replace =dmenu= with rofis I wrote this very simple script in order to replace =dmenu= with rofis emulation of dmenu, since I prefer rofis appearance. It basically calls rofis dmenu emulation with the arguments initially passed to dmenu.
emulation of dmenu, since I prefer rofis appearance. It basically calls
rofis dmenu emulation with the arguments initially passed to dmenu.
#+BEGIN_SRC fish #+BEGIN_SRC fish
rofi -dmenu $argv rofi -dmenu $argv
#+END_SRC #+END_SRC
@ -375,8 +268,7 @@
:HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/.local/bin/emacsmail :HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/.local/bin/emacsmail
:CUSTOM_ID: Emacsmail-afffb7cd :CUSTOM_ID: Emacsmail-afffb7cd
:END: :END:
This short script is used in my =~/.local/share/applications/mu4e.desktop= This short script is used in my =~/.local/share/applications/mu4e.desktop= file in order to send to Emacs any ~mailto:~ requests made in my system.
file in order to send to Emacs any ~mailto:~ requests made in my system.
#+BEGIN_SRC bash #+BEGIN_SRC bash
emacsclient -c --eval "(browse-url-mail \"$@\")" emacsclient -c --eval "(browse-url-mail \"$@\")"
#+END_SRC #+END_SRC
@ -386,9 +278,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-emoji :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-emoji
:CUSTOM_ID: Emoji_picker-a1c374ec :CUSTOM_ID: Emoji_picker-a1c374ec
:END: :END:
The emoji picker is a simple fish script that uses rofi and The emoji picker is a simple fish script that uses rofi and [[file:~/.config/emoji.txt][~/.config/emoji.txt]] to provide a small, local search for emojis. Once the emoji is selected, it is copied to the clipboard using =xclipboard=.
[[file:~/.config/emoji.txt][~/.config/emoji.txt]] to provide a small, local search for emojis. Once the
emoji is selected, it is copied to the clipboard using =xclipboard=.
#+BEGIN_SRC fish #+BEGIN_SRC fish
grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | \ grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | \
awk '{print $1}' | tr -d '\n' | xclip -selection clipboard awk '{print $1}' | tr -d '\n' | xclip -selection clipboard
@ -409,8 +299,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/mp42webm :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/mp42webm
:CUSTOM_ID: mp42webm-aeacca58 :CUSTOM_ID: mp42webm-aeacca58
:END: :END:
This function allows me to convert easily an mp4 video to the webm format. This function allows me to convert easily an mp4 video to the webm format. Nothing too fancy here.
Nothing too fancy here.
#+BEGIN_SRC fish #+BEGIN_SRC fish
ffmpeg -i $argv[1] -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $argv[1].webm ffmpeg -i $argv[1] -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $argv[1].webm
#+END_SRC #+END_SRC
@ -442,9 +331,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/plock :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/plock
:CUSTOM_ID: Lock-635fcb38 :CUSTOM_ID: Lock-635fcb38
:END: :END:
~plock~ is a simple script that locks the screen with ~i3lock~ while setting ~plock~ is a simple script that locks the screen with ~i3lock~ while setting as the background image of the locked screen a corrupted screenshot of the screen before it was locked.
as the background image of the locked screen a corrupted screenshot of the
screen before it was locked.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set TMPBG /tmp/screen.png set TMPBG /tmp/screen.png
scrot $TMPBG scrot $TMPBG
@ -458,9 +345,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/polybar-launch :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/polybar-launch
:CUSTOM_ID: Polybar-launch-36789edc :CUSTOM_ID: Polybar-launch-36789edc
:END: :END:
This scripts allows the user to kill polybar and relaunch it, or to simply This scripts allows the user to kill polybar and relaunch it, or to simply launch it if polybar isnt launched yet. First thing to do is kill all polybar processes.
launch it if polybar isnt launched yet. First thing to do is kill all polybar
processes.
#+BEGIN_SRC bash #+BEGIN_SRC bash
killall -q polybar killall -q polybar
#+END_SRC #+END_SRC
@ -470,9 +355,7 @@
while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done
#+END_SRC #+END_SRC
Now that our system isnt running polybar anymore, well launch it again on Now that our system isnt running polybar anymore, well launch it again on all of our screens. By the way, I have two bars, so Ill have to lauch them both.
all of our screens. By the way, I have two bars, so Ill have to lauch them
both.
#+BEGIN_SRC bash #+BEGIN_SRC bash
if type "xrandr"; then if type "xrandr"; then
for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do
@ -495,10 +378,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-mount :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-mount
:CUSTOM_ID: Rofi-mount-ebbebf68 :CUSTOM_ID: Rofi-mount-ebbebf68
:END: :END:
=rofimount= is a script inspired by [[https://github.com/ihebchagra/dotfiles/blob/master/.local/bin/dmount][this one]], based on dmenu, which =rofimount= is a script inspired by [[https://github.com/ihebchagra/dotfiles/blob/master/.local/bin/dmount][this one]], based on dmenu, which interactively asks the user what to mount, and where to mount it. What I did was replace dmenu with rofi, and fix a couple of bugs I encountered in the original script.
interactively asks the user what to mount, and where to mount it. What I did
was replace dmenu with rofi, and fix a couple of bugs I encountered in the
original script.
** Get the mountable elements ** Get the mountable elements
:PROPERTIES: :PROPERTIES:
@ -507,22 +387,19 @@
#+BEGIN_SRC fish #+BEGIN_SRC fish
begin begin
#+END_SRC #+END_SRC
What the script does first is detect everything that can be mounted. Between
a =begin= and =end=, lets set =LFS= as a local variable. This si in order to What the script does first is detect everything that can be mounted. Between a =begin= and =end=, lets set =LFS= as a local variable. This si in order to get sane variables in the current block.
get sane variables in the current block.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -l LFS set -l LFS
#+END_SRC #+END_SRC
Now, lets detect the amount of mountable Android filesystems, and if any are Now, lets detect the amount of mountable Android filesystems, and if any are detected, lets read them into a global variable.
detected, lets read them into a global variable.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -l a (math (jmtpfs -l | wc -l) - 2) set -l a (math (jmtpfs -l | wc -l) - 2)
test $a -ge 0 && jmtpfs -l 2> /dev/null | tail -n $a | read -zg anddrives test $a -ge 0 && jmtpfs -l 2> /dev/null | tail -n $a | read -zg anddrives
#+END_SRC #+END_SRC
Well do the same for external and internal drives and partitions that can be Well do the same for external and internal drives and partitions that can be mounted here.
mounted here.
#+BEGIN_SRC fish #+BEGIN_SRC fish
lsblk -rpo "name,type,size,mountpoint" | \ lsblk -rpo "name,type,size,mountpoint" | \
awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}' | \ awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}' | \
@ -539,10 +416,7 @@
end end
#+END_SRC #+END_SRC
Alright, well save what kind on drives we can mount in a temporary file Alright, well save what kind on drives we can mount in a temporary file called =/tmp/drives=. Well make sure its blank by erasing it then creating it again with =touch=, like so. The =-f= flag on =rm= is here so we get no error if we try to delete a file that doesnt exist (yet).
called =/tmp/drives=. Well make sure its blank by erasing it then creating
it again with =touch=, like so. The =-f= flag on =rm= is here so we get no
error if we try to delete a file that doesnt exist (yet).
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -g TMPDRIVES /tmp/drives set -g TMPDRIVES /tmp/drives
rm -f $TMPDRIVES rm -f $TMPDRIVES
@ -556,8 +430,7 @@
test -n "$anddrives" && echo "Android" >> $TMPDRIVES test -n "$anddrives" && echo "Android" >> $TMPDRIVES
#+END_SRC #+END_SRC
Now, we want to declare where to look for mount directories. For now, well Now, we want to declare where to look for mount directories. For now, well only look in =/media=, but you can add more if you wish.
only look in =/media=, but you can add more if you wish.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -g basemount /media set -g basemount /media
#+END_SRC #+END_SRC
@ -566,34 +439,26 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-mount-Get_the_mount_point-6c4bac06 :CUSTOM_ID: Rofi-mount-Get_the_mount_point-6c4bac06
:END: :END:
Now, lets declare a function that will allow us to chose the drive we want Now, lets declare a function that will allow us to chose the drive we want to mount.
to mount.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function getmount function getmount
#+END_SRC #+END_SRC
First, we want to get our mount point. Well run a =find= command on each of First, we want to get our mount point. Well run a =find= command on each of the directories listed in =$basemount= to look for folders on which our drive could be mounted. This list will be passed to rofi from which we will chose our mount point.
the directories listed in =$basemount= to look for folders on which our drive
could be mounted. This list will be passed to rofi from which we will chose
our mount point.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -g mp (for d in $basemount set -g mp (for d in $basemount
find $d -maxdepth 5 -type d find $d -maxdepth 5 -type d
end | rofi -dmenu -i -p 'Type in mount point.') end | rofi -dmenu -i -p 'Type in mount point.')
#+END_SRC #+END_SRC
We should verify that something has been actually selected, otherwise we We should verify that something has been actually selected, otherwise we should abort the script.
should abort the script.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test -z $mp || test $mp = "" if test -z $mp || test $mp = ""
return 1 return 1
end end
#+END_SRC #+END_SRC
Now, if the selected mount point does not exist, well ask the user whether Now, if the selected mount point does not exist, well ask the user whether the directory should be created. If no, the script will abort. If yes, an attempt will be made at creating the directory as the user; if that fails, a new attempt will be made as sudo.
the directory should be created. If no, the script will abort. If yes, an
attempt will be made at creating the directory as the user; if that fails, a
new attempt will be made as sudo.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test ! -d $mp if test ! -d $mp
switch (printf "No\\nYes" | rofi -dmenu -i -p "$mp does not exist. Create it?") switch (printf "No\\nYes" | rofi -dmenu -i -p "$mp does not exist. Create it?")
@ -614,42 +479,34 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-mount-Mount_a_USB_drive,_hard_drive_or_partition-f5431dbe :CUSTOM_ID: Rofi-mount-Mount_a_USB_drive,_hard_drive_or_partition-f5431dbe
:END: :END:
Alright, we want to mount a partition that answers by the name of Alright, we want to mount a partition that answers by the name of =/dev/sdXX=, how do we do that? Lets create first the function =mountusb= that will take care of it for us.
=/dev/sdXX=, how do we do that? Lets create first the function =mountusb=
that will take care of it for us.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function mountusb function mountusb
#+END_SRC #+END_SRC
Now, the first thing we want to do is select the partition we want to mount. Now, the first thing we want to do is select the partition we want to mount. Remember, we stored those in =$usbdrives= earlier, so lets pipe them into rofi so we can chose from it. Also, =awk= will get their path in =/dev=.
Remember, we stored those in =$usbdrives= earlier, so lets pipe them into
rofi so we can chose from it. Also, =awk= will get their path in =/dev=.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -g chosen (echo $usbdrives | \ set -g chosen (echo $usbdrives | \
rofi -dmenu -i -p "Mount which drive?" | \ rofi -dmenu -i -p "Mount which drive?" | \
awk '{print $1}') awk '{print $1}')
#+END_SRC #+END_SRC
As usual after a user selection, lets verify something has actually been As usual after a user selection, lets verify something has actually been selected. If not, lets abort the script.
selected. If not, lets abort the script.
#+BEGIN_SRC fish #+BEGIN_SRC fish
test -z $chosen && return 1 test -z $chosen && return 1
#+END_SRC #+END_SRC
Now, lets select the mount point of our partition. Well call the function Now, lets select the mount point of our partition. Well call the function =getmount= described in [[#Rofi-mount-Get_the_mount_point-6c4bac06][Get the mount point]] to select it.
=getmount= described in [[#Rofi-mount-Get_the_mount_point-6c4bac06][Get the mount point]] to select it.
#+BEGIN_SRC fish #+BEGIN_SRC fish
getmount getmount
#+END_SRC #+END_SRC
Lets verify the variable =mp= set in =getmount= is not empty, otherwise Lets verify the variable =mp= set in =getmount= is not empty, otherwise abort the script.
abort the script.
#+BEGIN_SRC fish #+BEGIN_SRC fish
test -z $mp && return 1 test -z $mp && return 1
#+END_SRC #+END_SRC
Now, lets mount it! Well use a switch which will detect the filesystem used Now, lets mount it! Well use a switch which will detect the filesystem used so we know how to mount the partition.
so we know how to mount the partition.
#+BEGIN_SRC fish #+BEGIN_SRC fish
switch (lsblk -no "fstype" $chosen) switch (lsblk -no "fstype" $chosen)
#+END_SRC #+END_SRC
@ -666,21 +523,18 @@
sudo -A mount -t ntfs $chosen $mp -o rw,umask=0000 sudo -A mount -t ntfs $chosen $mp -o rw,umask=0000
#+END_SRC #+END_SRC
Else, well let =mount= determine which filesystem is used by the partition Else, well let =mount= determine which filesystem is used by the partition (generally =ext4=).
(generally =ext4=).
#+BEGIN_SRC fish #+BEGIN_SRC fish
case '*' case '*'
sudo -A mount $chosen $mp sudo -A mount $chosen $mp
#+END_SRC #+END_SRC
Well also run a =chown= on this newly mounted filesystem so the user can Well also run a =chown= on this newly mounted filesystem so the user can access it without any issues.
access it without any issues.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo -A chown -R $USER:(id -g $USER) $mp sudo -A chown -R $USER:(id -g $USER) $mp
#+END_SRC #+END_SRC
Lets close the switch block and send a notification the partition has been Lets close the switch block and send a notification the partition has been mounted.
mounted.
#+BEGIN_SRC fish #+BEGIN_SRC fish
end && notify-send -a "dmount" "💻 USB mounting" "$chosen mounted to $mp." end && notify-send -a "dmount" "💻 USB mounting" "$chosen mounted to $mp."
#+END_SRC #+END_SRC
@ -694,8 +548,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-mount-Mount_an_Android_device-5321f9cd :CUSTOM_ID: Rofi-mount-Mount_an_Android_device-5321f9cd
:END: :END:
The function that manages to mount Android filesystems is =mountandroid=. The function that manages to mount Android filesystems is =mountandroid=. Lets declare it.
Lets declare it.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function mountandroid -d "Mount an Android device" function mountandroid -d "Mount an Android device"
#+END_SRC #+END_SRC
@ -705,9 +558,7 @@
set chosen (echo $anddrives | rofi -dmenu -i -p "Which Android device?" | awk '{print $1 $2}' | sed 's/,$//') set chosen (echo $anddrives | rofi -dmenu -i -p "Which Android device?" | awk '{print $1 $2}' | sed 's/,$//')
#+END_SRC #+END_SRC
Now, we need to get the bus of the Android device we want to mount. It will Now, we need to get the bus of the Android device we want to mount. It will be useful later, after we authorized mounting from our device, to get the path to our partition.
be useful later, after we authorized mounting from our device, to get the
path to our partition.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set bus (echo $chosen | sed 's/,.*//') set bus (echo $chosen | sed 's/,.*//')
#+END_SRC #+END_SRC
@ -717,24 +568,19 @@
jmtpfs -device=$chosen $mp jmtpfs -device=$chosen $mp
#+END_SRC #+END_SRC
Now, we need to allow our computer to mount our Android device. Depending on Now, we need to allow our computer to mount our Android device. Depending on the Android version it is running on, we either need to specify our device is USB connected in order to exchange files, or Android will explicitely ask us if it is OK for our computer to access it. Lets inform the user of that.
the Android version it is running on, we either need to specify our device is
USB connected in order to exchange files, or Android will explicitely ask us
if it is OK for our computer to access it. Lets inform the user of that.
#+BEGIN_SRC fish #+BEGIN_SRC fish
echo "OK" | \ echo "OK" | \
rofi -dmenu -i -p "Press (Allow) on your phone screen, or set your USB settings to allow file transfert" rofi -dmenu -i -p "Press (Allow) on your phone screen, or set your USB settings to allow file transfert"
#+END_SRC #+END_SRC
Now, lets get the actual path of our Android filesystem we wish to mount, Now, lets get the actual path of our Android filesystem we wish to mount, and lets unmount the previous temporary filesystem.
and lets unmount the previous temporary filesystem.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set newchosen (jmtpfs -l | grep $bus | awk '{print $1 $2}' | sed 's/,$//') set newchosen (jmtpfs -l | grep $bus | awk '{print $1 $2}' | sed 's/,$//')
sudo -A umount $mp sudo -A umount $mp
#+END_SRC #+END_SRC
Now we cam mount the new filesystem and send a notification if everything Now we cam mount the new filesystem and send a notification if everything went well.
went well.
#+BEGIN_SRC fish #+BEGIN_SRC fish
jmtpfs -device=$newchosen $mp && \ jmtpfs -device=$newchosen $mp && \
notify-send -a "dmount" "🤖 Android Mounting" "Android device mounted to $mp." notify-send -a "dmount" "🤖 Android Mounting" "Android device mounted to $mp."
@ -749,9 +595,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-mount-Mount_a_CD_drive-27278199 :CUSTOM_ID: Rofi-mount-Mount_a_CD_drive-27278199
:END: :END:
This part is way easier than the previous functions. As we will see, the This part is way easier than the previous functions. As we will see, the function =mountcd='s body is only three lines long. First, lets declare the function.
function =mountcd='s body is only three lines long. First, lets declare the
function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function mountcd function mountcd
#+END_SRC #+END_SRC
@ -761,8 +605,7 @@
set chosen (echo $cddrives | rofi -dmenu -i -p "Which CD drive?") set chosen (echo $cddrives | rofi -dmenu -i -p "Which CD drive?")
#+END_SRC #+END_SRC
Well also get the mountpoint thanks to the =getmount= function described Well also get the mountpoint thanks to the =getmount= function described earlier.
earlier.
#+BEGIN_SRC fish #+BEGIN_SRC fish
getmount getmount
#+END_SRC #+END_SRC
@ -782,21 +625,17 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-mount-Ask_what_type_of_drive_we_want_to_mount-0c15cffa :CUSTOM_ID: Rofi-mount-Ask_what_type_of_drive_we_want_to_mount-0c15cffa
:END: :END:
The first thing we will be asked if different types of drives are detected is The first thing we will be asked if different types of drives are detected is which of these types the user wishes to mount. This is done with the function =asktype= which is declared below.
which of these types the user wishes to mount. This is done with the function
=asktype= which is declared below.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function asktype function asktype
#+END_SRC #+END_SRC
We will use a switch statement which will use our anwser to rofi about what We will use a switch statement which will use our anwser to rofi about what we wish to mount.
we wish to mount.
#+BEGIN_SRC fish #+BEGIN_SRC fish
switch (cat $TMPDRIVES | rofi -dmenu -i -p "Mount which drive?") switch (cat $TMPDRIVES | rofi -dmenu -i -p "Mount which drive?")
#+END_SRC #+END_SRC
If we chose the option "USB", well mount a hard drive, partition or USB If we chose the option "USB", well mount a hard drive, partition or USB drive. In which case well call the =mountusb= function.
drive. In which case well call the =mountusb= function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case "USB" case "USB"
mountusb mountusb
@ -813,8 +652,8 @@
case "CD" case "CD"
mountcd mountcd
#+END_SRC #+END_SRC
If nothing is selected, the function will naturally exit. Now, lets close
our switch statement and our function. If nothing is selected, the function will naturally exit. Now, lets close our switch statement and our function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
end end
end end
@ -824,28 +663,23 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-mount-Launch_the_mounting_functions-218ad001 :CUSTOM_ID: Rofi-mount-Launch_the_mounting_functions-218ad001
:END: :END:
Now that we have declared our functions and set our variables, well read the Now that we have declared our functions and set our variables, well read the temporary file described in [[#Rofi-mount-Get_the_mountable_elements-24db7834][Get the mountable elements]]. The amount of lines is passed in a switch statement.
temporary file described in [[#Rofi-mount-Get_the_mountable_elements-24db7834][Get the mountable elements]]. The amount of lines
is passed in a switch statement.
#+BEGIN_SRC fish #+BEGIN_SRC fish
switch (wc -l < $TMPDRIVES) switch (wc -l < $TMPDRIVES)
#+END_SRC #+END_SRC
If the file has no lines, i.e. it is empty, we have no mountable media. Lets If the file has no lines, i.e. it is empty, we have no mountable media. Lets inform our user this is the case.
inform our user this is the case.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case 0 case 0
notify-send "No USB drive or Android device or CD detected" -a "dmount" notify-send "No USB drive or Android device or CD detected" -a "dmount"
#+END_SRC #+END_SRC
If we only have one line, we have only one type of mountable media. Well If we only have one line, we have only one type of mountable media. Well pass this line to a second switch statement.
pass this line to a second switch statement.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case 1 case 1
switch (cat $TMPDRIVES) switch (cat $TMPDRIVES)
#+END_SRC #+END_SRC
This will allow the script to automatically detect what type of media it is, This will allow the script to automatically detect what type of media it is, and mount the corresponding function.
and mount the corresponding function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case "USB" case "USB"
mountusb mountusb
@ -859,8 +693,7 @@
end end
#+END_SRC #+END_SRC
If we have more than one line, well have to ask the user what type of media If we have more than one line, well have to ask the user what type of media they want to mount.
they want to mount.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case '*' case '*'
asktype asktype
@ -883,13 +716,9 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-pass :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-pass
:CUSTOM_ID: Rofi-pass-8335357f :CUSTOM_ID: Rofi-pass-8335357f
:END: :END:
=rofi-pass= is a simple utility that gets a password stored in the [[https://www.passwordstore.org/][=pass=]] =rofi-pass= is a simple utility that gets a password stored in the [[https://www.passwordstore.org/][=pass=]] password manager with rofi as its interface, and then stores the password in the clipboard.
password manager with rofi as its interface, and then stores the password in
the clipboard.
Lets parse all the arguments passed to the script. If one of them is Lets parse all the arguments passed to the script. If one of them is =--type=, =-t= or =type=, the script will attempt to type the password to the text area already selected without pasting the password to the clipboard.
=--type=, =-t= or =type=, the script will attempt to type the password to the
text area already selected without pasting the password to the clipboard.
#+BEGIN_SRC fish #+BEGIN_SRC fish
for arg in $argv for arg in $argv
switch $arg switch $arg
@ -916,16 +745,14 @@
end | rofi -dmenu -i -p "Select your password") end | rofi -dmenu -i -p "Select your password")
#+END_SRC #+END_SRC
Lets verify we actually selected a password and not just exited. If no Lets verify we actually selected a password and not just exited. If no password was selected, lets simply exit the script.
password was selected, lets simply exit the script.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test -z $password if test -z $password
exit exit
end end
#+END_SRC #+END_SRC
Depending on the arguments passed earlier, we might want some different Depending on the arguments passed earlier, we might want some different behavior.
behavior.
#+BEGIN_SRC fish :noweb yes #+BEGIN_SRC fish :noweb yes
if test $TYPE = "yes" if test $TYPE = "yes"
<<rofi-pass-type>> <<rofi-pass-type>>
@ -934,16 +761,13 @@
end end
#+END_SRC #+END_SRC
The default behavior is to copy the password to the clipboard for 45 seconds, The default behavior is to copy the password to the clipboard for 45 seconds, so lets do that.
so lets do that.
#+NAME: rofi-pass-copy #+NAME: rofi-pass-copy
#+BEGIN_SRC fish :noweb yes :tangle no #+BEGIN_SRC fish :noweb yes :tangle no
pass show -c $password 2> /dev/null pass show -c $password 2> /dev/null
#+END_SRC #+END_SRC
Else, if we passed =--type=, =-t= or =type= as an argument of the script, we Else, if we passed =--type=, =-t= or =type= as an argument of the script, we want it to attempt to type our password in the currently selected text input. Lets do that.
want it to attempt to type our password in the currently selected text input.
Lets do that.
#+NAME: rofi-pass-type #+NAME: rofi-pass-type
#+BEGIN_SRC fish :noweb yes :tangle no #+BEGIN_SRC fish :noweb yes :tangle no
set -l IFS set -l IFS
@ -951,8 +775,7 @@
printf %s $pass | xvkbd -file - printf %s $pass | xvkbd -file -
#+END_SRC #+END_SRC
To correctly get the password from =pass=, we need to parse the output and To correctly get the password from ~pass~, we need to parse the output and only get the first line, hence the following command.
only get the first line, hence the following command.
#+NAME: rofi-pass-type-get-password #+NAME: rofi-pass-type-get-password
#+BEGIN_SRC fish :tangle no #+BEGIN_SRC fish :tangle no
set pass (pass show $password | string split -n \n)[1] set pass (pass show $password | string split -n \n)[1]
@ -963,15 +786,13 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-umount :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-umount
:CUSTOM_ID: Rofi-umount-ddde1667 :CUSTOM_ID: Rofi-umount-ddde1667
:END: :END:
=rofiumount= is the counterpart of =rofimount= for unmounting our mounted ~rofiumount~ is the counterpart of ~rofimount~ for unmounting our mounted partitions.
partitions.
** Get the unmountable drives ** Get the unmountable drives
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-umount-Get_the_unmountable_drives-89c71040 :CUSTOM_ID: Rofi-umount-Get_the_unmountable_drives-89c71040
:END: :END:
First, we will need to list all the drives that can be safely unmounted. First, we will need to list all the drives that can be safely unmounted. Lets run this.
Lets run this.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -g drives (lsblk -nrpo "name,type,size,mountpoint" | \ set -g drives (lsblk -nrpo "name,type,size,mountpoint" | \
awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}') awk '$2=="part"&&$4!~/\/boot|\/home$|SWAP/&&length($4)>1{printf "%s (%s)\n",$4,$3}')
@ -998,8 +819,7 @@
touch $undrivefile touch $undrivefile
#+END_SRC #+END_SRC
Depending on if the related variables are set, write the different types of Depending on if the related variables are set, write the different types of mounted drives in the temporary file.
mounted drives in the temporary file.
#+BEGIN_SRC fish #+BEGIN_SRC fish
test -n "$drives" && echo "USB" >> $undrivefile test -n "$drives" && echo "USB" >> $undrivefile
test -n "$cds" && echo "CD" >> $undrivefile test -n "$cds" && echo "CD" >> $undrivefile
@ -1010,8 +830,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-umount-Unmount_disk_partitions-0d425a47 :CUSTOM_ID: Rofi-umount-Unmount_disk_partitions-0d425a47
:END: :END:
The function =unmountusb= will take care of unmounting any drive we can The function =unmountusb= will take care of unmounting any drive we can safely unmount. First, lets declare the function.
safely unmount. First, lets declare the function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function unmountusb function unmountusb
#+END_SRC #+END_SRC
@ -1023,14 +842,12 @@
awk '{print $1}') awk '{print $1}')
#+END_SRC #+END_SRC
Lets verify if the user actually selected any drive. If no, lets abort the Lets verify if the user actually selected any drive. If no, lets abort the script.
script.
#+BEGIN_SRC fish #+BEGIN_SRC fish
test -z "$chosen" && exit 0 test -z "$chosen" && exit 0
#+END_SRC #+END_SRC
Now, lets unmount the chosen drive and send a notification if it has been Now, lets unmount the chosen drive and send a notification if it has been done.
done.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo -A umount $chosen && \ sudo -A umount $chosen && \
notify-send "💻 USB unmounting" "$chosen unmounted." -a "dumount" notify-send "💻 USB unmounting" "$chosen unmounted." -a "dumount"
@ -1045,8 +862,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-umount-Unmount_Android_device-ae1d5904 :CUSTOM_ID: Rofi-umount-Unmount_Android_device-ae1d5904
:END: :END:
The function =unmountandroid= will take care of unmounting any mounted The function =unmountandroid= will take care of unmounting any mounted Android device. First, lets declare our function.
Android device. First, lets declare our function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function unmountandroid function unmountandroid
#+END_SRC #+END_SRC
@ -1061,8 +877,7 @@
test -z "$chosen" && exit 0 test -z "$chosen" && exit 0
#+END_SRC #+END_SRC
If a device has been chosen, lets unmount it and send a notification it has If a device has been chosen, lets unmount it and send a notification it has been successfuly unmounted.
been successfuly unmounted.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo -A umount -l $chosen && \ sudo -A umount -l $chosen && \
notify-send "🤖 Android unmounting" "$chosen unmounted." -a "dumount" notify-send "🤖 Android unmounting" "$chosen unmounted." -a "dumount"
@ -1077,8 +892,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-umount-Unmount_CD_drive-369a2f61 :CUSTOM_ID: Rofi-umount-Unmount_CD_drive-369a2f61
:END: :END:
=unmountcd= will take care of unmounting any mounted CD drive. Lets declare =unmountcd= will take care of unmounting any mounted CD drive. Lets declare this function.
this function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function unmountcd function unmountcd
#+END_SRC #+END_SRC
@ -1093,8 +907,7 @@
test -z "$chosen" && exit 0 test -z "$chosen" && exit 0
#+END_SRC #+END_SRC
If a drive has been chosen, lets unmount it and send a notification it has If a drive has been chosen, lets unmount it and send a notification it has been successfuly unmounted.
been successfuly unmounted.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo -A umount -l $chosen && \ sudo -A umount -l $chosen && \
notify-send "💿 CD unmounting" "$chosen unmounted." -a "dumount" notify-send "💿 CD unmounting" "$chosen unmounted." -a "dumount"
@ -1109,21 +922,17 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-umount-Ask_what_type_of_drive_to_unmount-6287af48 :CUSTOM_ID: Rofi-umount-Ask_what_type_of_drive_to_unmount-6287af48
:END: :END:
If several types of unmountable drives are available, lets ask the user If several types of unmountable drives are available, lets ask the user which type to unmount based on the content of the temporary file declared in [[#Rofi-umount-Get_the_unmountable_drives-89c71040][Get the unmountable drives]]. First, lets declare the function.
which type to unmount based on the content of the temporary file declared in
[[#Rofi-umount-Get_the_unmountable_drives-89c71040][Get the unmountable drives]]. First, lets declare the function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function asktype function asktype
#+END_SRC #+END_SRC
Lets create a switch statement to which will be passed the selection of the Lets create a switch statement to which will be passed the selection of the user from rofi.
user from rofi.
#+BEGIN_SRC fish #+BEGIN_SRC fish
switch (cat $undrivefile | rofi -dmenu -i -p "Unmount which type of device?") switch (cat $undrivefile | rofi -dmenu -i -p "Unmount which type of device?")
#+END_SRC #+END_SRC
Three types of values can be returned: "USB", "CD", or "Android". These Three types of values can be returned: "USB", "CD", or "Android". These values will be used to launch their corresponding function.
values will be used to launch their corresponding function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case 'USB' case 'USB'
unmountusb unmountusb
@ -1147,21 +956,18 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rofi-umount-Launch_the_unmounting_functions-7c48a928 :CUSTOM_ID: Rofi-umount-Launch_the_unmounting_functions-7c48a928
:END: :END:
Now back to the body of our script, lets input in a switch case the number Now back to the body of our script, lets input in a switch case the number of lines contained in our temporary file.
of lines contained in our temporary file.
#+BEGIN_SRC fish #+BEGIN_SRC fish
switch (wc -l < $undrivefile) switch (wc -l < $undrivefile)
#+END_SRC #+END_SRC
If the file containes no lines. i.e. it is empty, nothing is to be unmounted. If the file containes no lines. i.e. it is empty, nothing is to be unmounted. Lets inform the user of that.
Lets inform the user of that.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case 0 case 0
notify-send "No USB drive or Android device or CD to unmount" -a "dumount" notify-send "No USB drive or Android device or CD to unmount" -a "dumount"
#+END_SRC #+END_SRC
Else, if there is only one type of drive, well automatically let our script Else, if there is only one type of drive, well automatically let our script choose based on the content of this sole line.
choose based on the content of this sole line.
#+BEGIN_SRC fish #+BEGIN_SRC fish
case 1 case 1
switch (cat $undrivefile) switch (cat $undrivefile)
@ -1195,22 +1001,13 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/set-screens :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/set-screens
:CUSTOM_ID: set-screens-01bd989a :CUSTOM_ID: set-screens-01bd989a
:END: :END:
~set-screens~ is a small script that allows the user to automatically set up ~set-screens~ is a small script that allows the user to automatically set up an external monitor. First, lets set some variables so we dont have to type in hidden places some values that should be easily modifiable.
an external monitor. First, lets set some variables so we dont have to type
in hidden places some values that should be easily modifiable.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set internal "eDP1" set internal "eDP1"
set external "HDMI1" set external "HDMI1"
#+END_SRC #+END_SRC
Now, lets set the ~DETECTEDSCREEN~ variable with a simple ~grep~. If the Now, lets set the ~DETECTEDSCREEN~ variable with a simple ~grep~. If the variable turns out to be empty, this means the display was not detected. However, if its not, then it will be an array with its second value that holds the maximum resolution the display can handle. It needs to be passed through ~awk~ in order to get only the resolution itself and not the refresh rate, but once weve got that, we can set our external monitor as the main monitor with its maximum resolution. i3 is also restarted in order to properly display the wallpaper and Polybar on the new screen.
variable turns out to be empty, this means the display was not detected.
However, if its not, then it will be an array with its second value that
holds the maximum resolution the display can handle. It needs to be passed
through ~awk~ in order to get only the resolution itself and not the refresh
rate, but once weve got that, we can set our external monitor as the main
monitor with its maximum resolution. i3 is also restarted in order to properly
display the wallpaper and Polybar on the new screen.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set externaldisplay (xrandr -q --current | grep -A 1 -i "$external connected") set externaldisplay (xrandr -q --current | grep -A 1 -i "$external connected")
if test -n "$externaldisplay" if test -n "$externaldisplay"
@ -1224,10 +1021,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/sshbind :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/sshbind
:CUSTOM_ID: sshbind-756fabb1 :CUSTOM_ID: sshbind-756fabb1
:END: :END:
Something that I did not know for quite some time but that is actually crazy Something that I did not know for quite some time but that is actually crazy useful about SSH is its ability to bind locally the port of a remote machine, and vice versa. The syntax is actually very simple, but I prefer a more intuitive way of writing it. Its usage is ~sshbind PORT FROMHOST TOHOST~.
useful about SSH is its ability to bind locally the port of a remote machine,
and vice versa. The syntax is actually very simple, but I prefer a more
intuitive way of writing it. Its usage is ~sshbind PORT FROMHOST TOHOST~.
#+BEGIN_SRC fish #+BEGIN_SRC fish
ssh -L $argv[1]:$argv[3]:$argv[1] $argv[2] -N ssh -L $argv[1]:$argv[3]:$argv[1] $argv[2] -N
#+END_SRC #+END_SRC
@ -1237,8 +1031,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/starwars :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/starwars
:CUSTOM_ID: Starwars-654f8637 :CUSTOM_ID: Starwars-654f8637
:END: :END:
This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art in your terminal. Here is the code:
in your terminal. Here is the code:
#+BEGIN_SRC fish #+BEGIN_SRC fish
telnet towel.blinkenlights.nl telnet towel.blinkenlights.nl
#+END_SRC #+END_SRC
@ -1248,16 +1041,9 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/tttapping :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/tttapping
:CUSTOM_ID: Toggle_touchpad_tapping-23348b00 :CUSTOM_ID: Toggle_touchpad_tapping-23348b00
:END: :END:
For some reasons, my firmware does not recognize the function key for toggling For some reasons, my firmware does not recognize the function key for toggling the touchpad. Im not going to really complain about it since it lets me program it like I want. Since I often dont need to completely deactivate the touchpad, Ill instead toggle whether tapping is enabled or not when pressing ~XF86TouchpadToggle~. And for that, I need this small script that will actually toggle it, and it will be used in my window manager configuration.
the touchpad. Im not going to really complain about it since it lets me
program it like I want. Since I often dont need to completely deactivate the
touchpad, Ill instead toggle whether tapping is enabled or not when pressing
~XF86TouchpadToggle~. And for that, I need this small script that will
actually toggle it, and it will be used in my window manager configuration.
First lets declare some variables to make this script more personal. With my First lets declare some variables to make this script more personal. With my current computer (a Gazelle by System76), the name of my touchpad is the following:
current computer (a Gazelle by System76), the name of my touchpad is the
following:
#+BEGIN_SRC fish #+BEGIN_SRC fish
set TPNAME "ELAN0412:00 04F3:3162 Touchpad" set TPNAME "ELAN0412:00 04F3:3162 Touchpad"
#+END_SRC #+END_SRC
@ -1273,8 +1059,7 @@
grep -v "Default" | awk '{print $5}') grep -v "Default" | awk '{print $5}')
#+END_SRC #+END_SRC
This will set ~TPSTATUS~ either to ~0~, meaning tapping is disabled, or to This will set ~TPSTATUS~ either to ~0~, meaning tapping is disabled, or to ~1~, meaning its enabled. I will consider any other value as being disabled.
~1~, meaning its enabled. I will consider any other value as being disabled.
#+BEGIN_SRC fish #+BEGIN_SRC fish
test [[ $TPSTATUS = "1" ]] && set NEWTPSTATUS 0 || set NEWTPSTATUS 1 test [[ $TPSTATUS = "1" ]] && set NEWTPSTATUS 0 || set NEWTPSTATUS 1
#+END_SRC #+END_SRC
@ -1302,8 +1087,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/wacom-setup :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/wacom-setup
:CUSTOM_ID: Wacom_setup-331fb024 :CUSTOM_ID: Wacom_setup-331fb024
:END: :END:
I made a small and quick utility to set up my Wacom tablet so it is only bound I made a small and quick utility to set up my Wacom tablet so it is only bound to one screen.
to one screen.
** Set our variables ** Set our variables
:PROPERTIES: :PROPERTIES:
@ -1314,22 +1098,19 @@
function set_device function set_device
#+END_SRC #+END_SRC
We need some variables in order to correctly set our tablet. First, lets get We need some variables in order to correctly set our tablet. First, lets get declare what the name of our tablet is, and what the name of its touchpad is.
declare what the name of our tablet is, and what the name of its touchpad is.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -g DEVICE "Wacom USB Bamboo PAD Pen stylus" set -g DEVICE "Wacom USB Bamboo PAD Pen stylus"
set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch" set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch"
#+END_SRC #+END_SRC
We will also modify two settings: the speed of the cursor on the touchpad, We will also modify two settings: the speed of the cursor on the touchpad, and the scroll speed. Lets declare the name of these two settings.
and the scroll speed. Lets declare the name of these two settings.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling" set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling"
set -g WACOMPROPSCROLLPSEED "ScrollDistance" set -g WACOMPROPSCROLLPSEED "ScrollDistance"
#+END_SRC #+END_SRC
To get the correct values for the area it can cover, well need to reset our To get the correct values for the area it can cover, well need to reset our tablet.
tablet.
#+BEGIN_SRC fish #+BEGIN_SRC fish
xsetwacom set "$DEVICE" ResetArea xsetwacom set "$DEVICE" ResetArea
#+END_SRC #+END_SRC
@ -1350,9 +1131,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Wacom_setup-Select_our_screen-7822c0c3 :CUSTOM_ID: Wacom_setup-Select_our_screen-7822c0c3
:END: :END:
This function will allow us to select the screen on which the tablet will be This function will allow us to select the screen on which the tablet will be active. We can also select the option “desktop” so that all screens are selected. Lets declare our function.
active. We can also select the option “desktop” so that all screens are
selected. Lets declare our function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function set_screen function set_screen
#+END_SRC #+END_SRC
@ -1384,7 +1163,7 @@
echo $LINE | read -g WIDTH HEIGHT echo $LINE | read -g WIDTH HEIGHT
#+END_SRC #+END_SRC
If any of our =WIDTH= ou =HEIGHT= it empty, well have to abort the script. If any of our ~WIDTH~ ou ~HEIGHT~ it empty, well have to abort the script.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test -z $WIDTH || test -z $HEIGHT if test -z $WIDTH || test -z $HEIGHT
exit 1 exit 1
@ -1400,25 +1179,18 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Wacom_setup-Adjust_the_tablet-342acaf3 :CUSTOM_ID: Wacom_setup-Adjust_the_tablet-342acaf3
:END: :END:
This function will take care of adjusting our tablet to our screen. Lets This function will take care of adjusting our tablet to our screen. Lets declare our function.
declare our function.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function adjust_device function adjust_device
#+END_SRC #+END_SRC
If our screen is too high or too wide for our tablet, we will have to adjust If our screen is too high or too wide for our tablet, we will have to adjust the height or width of the area used by the tablet. So lets get the theoretical new height and width of the area.
the height or width of the area used by the tablet. So lets get the
theoretical new height and width of the area.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\)) set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\))
set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\)) set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\))
#+END_SRC #+END_SRC
Now, if the current height of the tablets area is greater than the Now, if the current height of the tablets area is greater than the theoretical new area, it means the current area is too high. Otherwise, it should be the other way around. Lets set =NEWAREAX= and =NEWAREAY= that will be used to set the new area for the tablet.
theoretical new area, it means the current area is too high. Otherwise, it
should be the other way around. Lets set =NEWAREAX= and =NEWAREAY= that will
be used to set the new area for the tablet.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test $AREAY -gt $RATIOAREAY if test $AREAY -gt $RATIOAREAY
set -g NEWAREAX $AREAX set -g NEWAREAX $AREAX
@ -1454,8 +1226,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Wacom_setup-Lauch_the_functions-2ab8b4d9 :CUSTOM_ID: Wacom_setup-Lauch_the_functions-2ab8b4d9
:END: :END:
Back to the main body of the script, we can now launch the functions Back to the main body of the script, we can now launch the functions sequencially.
sequencially.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set_device set_device
set_screen set_screen
@ -1467,10 +1238,7 @@
:HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/we :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/we
:CUSTOM_ID: Weather-4ed00bb0 :CUSTOM_ID: Weather-4ed00bb0
:END: :END:
A quick and useful script I often use is a ~curl~ request to [[http://v2.wttr.in/][v2.wttr.in]] to get A quick and useful script I often use is a ~curl~ request to [[http://v2.wttr.in/][v2.wttr.in]] to get a weather forecast in the terminal. By default, I want the request to be about the city I live in, but it is also possible for the script to accept as its arguments a search inquiry.
a weather forecast in the terminal. By default, I want the request to be about
the city I live in, but it is also possible for the script to accept as its
arguments a search inquiry.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if count $argv > /dev/null if count $argv > /dev/null
set -l SEARCH (string join '+' $argv) set -l SEARCH (string join '+' $argv)

View File

@ -1794,7 +1794,6 @@ One of the amazing features of org-mode is its literary programming capacities b
| sass | | sass |
| scheme | | scheme |
| shell | | shell |
| swift |
#+NAME: org-babel-languages-gen #+NAME: org-babel-languages-gen
#+BEGIN_SRC emacs-lisp :exports none :tangle no :var languages=org-babel-languages-table[,0] :cache yes :results replace #+BEGIN_SRC emacs-lisp :exports none :tangle no :var languages=org-babel-languages-table[,0] :cache yes :results replace
@ -1803,7 +1802,7 @@ One of the amazing features of org-mode is its literary programming capacities b
"\n") "\n")
#+END_SRC #+END_SRC
#+RESULTS[d8ef67cfac36191c43e0f20b9c0a024cb1e9413e]: org-babel-languages-gen #+RESULTS[cf8b81f0da6306f8131e34be6d3742248fdb057b]: org-babel-languages-gen
#+begin_example #+begin_example
(C . t) (C . t)
(dot . t) (dot . t)
@ -1815,7 +1814,6 @@ One of the amazing features of org-mode is its literary programming capacities b
(sass . t) (sass . t)
(scheme . t) (scheme . t)
(shell . t) (shell . t)
(swift . t)
#+end_example #+end_example
The corresponding code is as follows: The corresponding code is as follows:
@ -2604,7 +2602,6 @@ I also want to always be in ~visual-line-mode~ so Emacs soft-wraps lines that ar
I also want for some non-programming modes to enable a hard-limit in terms of how many characters can fit on one line. The modes that benefit are ~message-mode~, ~org-mode~, ~text-mode~ and ~markdown-mode~. I also want for some non-programming modes to enable a hard-limit in terms of how many characters can fit on one line. The modes that benefit are ~message-mode~, ~org-mode~, ~text-mode~ and ~markdown-mode~.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(mapc (lambda (x) (mapc (lambda (x)
(add-hook x 'auto-fill-mode)
(add-hook x 'visual-line-mode)) (add-hook x 'visual-line-mode))
'(message-mode-hook '(message-mode-hook
text-mode-hook text-mode-hook
@ -3005,16 +3002,15 @@ I want to see by default how much battery my computer has, so lets enable it:
:END: :END:
As I will always say, orgmode is an amazing piece of software that deserves particular care and love. That is why I want to give it a unique look and feel compared to the rest of my Emacs configuration, in order to make it feel much more comfortable. As I will always say, orgmode is an amazing piece of software that deserves particular care and love. That is why I want to give it a unique look and feel compared to the rest of my Emacs configuration, in order to make it feel much more comfortable.
In order to make org-mode even sexier, lets enable ~variable-pitch-mode~ for org-mode so we can get some proportional font: In order to make org-mode even sexier, lets enable ~variable-pitch-mode~ for org-mode so we can get some proportional font. Ill also remove ~auto-fill-mode~ which seems to stick to Orgmode like hell and I dont know why.
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(add-hook 'org-mode-hook 'variable-pitch-mode) (add-hook 'org-mode-hook 'variable-pitch-mode)
(add-hook 'org-mode-hook 'visual-line-mode) (add-hook 'org-mode-hook 'visual-line-mode)
(message "coucou") (remove-hook 'org-mode-hook 'auto-fill-mode)
#+END_SRC #+END_SRC
Fonts will play an important part in this, but so will colors and font size. The following code is largely based on the one found [[https://zzamboni.org/post/beautifying-org-mode-in-emacs/][on this blog post]]. Fonts will play an important part in this, but so will colors and font size. The following code is largely based on the one found [[https://zzamboni.org/post/beautifying-org-mode-in-emacs/][on this blog post]].
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(message "Setting up some beautiful org-mode")
(let* ((font `(:font "Charis SIL")) (let* ((font `(:font "Charis SIL"))
(head `(:inherit default :weight bold)) (head `(:inherit default :weight bold))
(fixed `(:inherit fixed-pitch :height 0.8))) (fixed `(:inherit fixed-pitch :height 0.8)))
@ -3044,7 +3040,6 @@ Fonts will play an important part in this, but so will colors and font size. The
`(org-link ((t (:foreground ,phundrak/nord8 :underline t)))) `(org-link ((t (:foreground ,phundrak/nord8 :underline t))))
'(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.8)))) '(org-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.8))))
'(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))))) '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch)))))))
(message "Org-mode is now beautiful")
#+END_SRC #+END_SRC
Finally, lets limit the width of images inlined in org buffers to 400px: Finally, lets limit the width of images inlined in org buffers to 400px:

View File

@ -11,12 +11,9 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Presentation-340195eb :CUSTOM_ID: Presentation-340195eb
:END: :END:
The file present in =~/.config/fish/config.fish= is the configuration file for The file present in =~/.config/fish/config.fish= is the configuration file for the [[https://fishshell.com/][fish shell]]. It contains custom functions, environment variables and abbreviations.
the [[https://fishshell.com/][fish shell]]. It contains custom functions, environment variables and
abbreviations.
Just in case, we might need sometimes to declare the fish function Just in case, we might need sometimes to declare the fish function =fish_title= as =true=, so lets do so.
=fish_title= as =true=, so lets do so.
#+BEGIN_SRC fish #+BEGIN_SRC fish
function fish_title function fish_title
true true
@ -27,8 +24,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Fish_from_within_Emacs-360c0a74 :CUSTOM_ID: Fish_from_within_Emacs-360c0a74
:END: :END:
I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, I sometimes call fish from within emacs, with =M-x ansi-term=. In this case, the variable =TERM= needs to have the value =eterm-color=.
the variable =TERM= needs to have the value =eterm-color=.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test -n "$EMACS" if test -n "$EMACS"
set -x TERM eterm-color set -x TERM eterm-color
@ -39,11 +35,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Tramp_remote_access-72aedec2 :CUSTOM_ID: Tramp_remote_access-72aedec2
:END: :END:
When accessing from a remote machine our computer from Emacs, tramp needs a When accessing from a remote machine our computer from Emacs, tramp needs a precise shell appearance: a simple =$= followed by a space after which to put the commands it needs to execute, and nothing else. Due to this, lets deactivate and redefine some of the functions defining the appearance of fish.
precise shell appearance: a simple =$= followed by a space after which to put
the commands it needs to execute, and nothing else. Due to this, lets
deactivate and redefine some of the functions defining the appearance of
fish.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test "$TERM" = "dumb" if test "$TERM" = "dumb"
function fish_prompt function fish_prompt
@ -59,10 +51,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Regular_fish_shell_appearance-c3e532e1 :CUSTOM_ID: Regular_fish_shell_appearance-c3e532e1
:END: :END:
Now, there is only one function I modify when it comes to the appearance of Now, there is only one function I modify when it comes to the appearance of fish when Im the one using it: the ~fish_greeting~ function. I use it to give me an overview of my computers status, including its hostname, uptime, disks usage, ram usage, swap usage, and networking.
fish when Im the one using it: the ~fish_greeting~ function. I use it to give
me an overview of my computers status, including its hostname, uptime, disks
usage, ram usage, swap usage, and networking.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set RED '\033[0;31m' set RED '\033[0;31m'
set GREEN '\033[0;32m' set GREEN '\033[0;32m'
@ -135,15 +124,12 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Global_variables-1c84df8b :CUSTOM_ID: Global_variables-1c84df8b
:END: :END:
In order to keep some other code clean, I set the ~$BROWSER~ variable so I dont have to call my web browser directly but rather with this variable.
In order to keep some other code clean, I set the ~$BROWSER~ variable so I
dont have to call my web browser directly but rather with this variable.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -gx BROWSER firefox set -gx BROWSER firefox
#+END_SRC #+END_SRC
Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it can get the sudo password. So, lets declare it.
can get the sudo password. So, lets declare it.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -gx SUDO_ASKPASS ~/.local/bin/askpass set -gx SUDO_ASKPASS ~/.local/bin/askpass
#+END_SRC #+END_SRC
@ -152,10 +138,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Global_variables-Development-76b3ff13 :CUSTOM_ID: Global_variables-Development-76b3ff13
:END: :END:
Now, lets declare our editor of choice, EmacsClient; not Emacs itself since Now, lets declare our editor of choice, EmacsClient; not Emacs itself since it will most often be just quick edits, nothing too heavy, if it is called from the ~EDITOR~ variable (from Git, for example), or from the ~VISUAL~ variable.
it will most often be just quick edits, nothing too heavy, if it is called
from the ~EDITOR~ variable (from Git, for example), or from the ~VISUAL~
variable.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -gx EDITOR emacsclient -c set -gx EDITOR emacsclient -c
set -gx VISUAL emacsclient -c set -gx VISUAL emacsclient -c
@ -176,28 +159,22 @@
set -gx CHROME_EXECUTABLE /usr/bin/chromium set -gx CHROME_EXECUTABLE /usr/bin/chromium
#+END_SRC #+END_SRC
Next, we have two variables from Deno, the Node.js destroyer. Its base Next, we have two variables from Deno, the Node.js destroyer. Its base directory will be set in my XDG config directory, and its binaries will be located in my local binaries directory (see below).
directory will be set in my XDG config directory, and its binaries will be
located in my local binaries directory (see below).
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -gx DENO_DIR $HOME/.config/deno set -gx DENO_DIR $HOME/.config/deno
set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno
#+END_SRC #+END_SRC
Finally, some development packages require the =PKG_CONFIG_PATH= to be set, Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so lets do so.
so lets do so.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH
#+END_SRC #+END_SRC
** $PATH ** ~$PATH~
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Global_variables-$PATH-e1320303 :CUSTOM_ID: Global_variables-$PATH-e1320303
:END: :END:
Some global variables might sometimes be needed and need to be modified. This Some global variables might sometimes be needed and need to be modified. This is for example the case with my ~PATH~ variable in which I add Rusts Cargos binaries, Gos binaries and my own executables. And of course, dont forget to add the already existing ~PATH~.
is for example the case with my ~PATH~ variable in which I add Rusts Cargos
binaries, Gos binaries and my own executables. And of course, dont forget
to add the already existing ~PATH~.
#+NAME: extra-paths #+NAME: extra-paths
| additional path | what it leads to | | additional path | what it leads to |
@ -218,8 +195,7 @@
#+RESULTS[f1fff053cb9e2239f35571249763683a4a62e643]: generate-extra-paths #+RESULTS[f1fff053cb9e2239f35571249763683a4a62e643]: generate-extra-paths
: $HOME/.pub-cache/bin $HOME/.local/bin $HOME/go/bin $HOME/.cargo/bin $HOME/.gem/ruby/2.6.0/bin $HOME/.cabal/bin : $HOME/.pub-cache/bin $HOME/.local/bin $HOME/go/bin $HOME/.cargo/bin $HOME/.gem/ruby/2.6.0/bin $HOME/.cabal/bin
The code below ensures the ~PATH~ is updated only at login, and every The code below ensures the ~PATH~ is updated only at login, and every location is addded only once.
location is addded only once.
#+BEGIN_SRC fish :noweb yes #+BEGIN_SRC fish :noweb yes
for p in <<generate-extra-paths()>> for p in <<generate-extra-paths()>>
if status is-login if status is-login
@ -246,17 +222,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-System_monitoring-bd909755 :CUSTOM_ID: Abbreviations-System_monitoring-bd909755
:END: :END:
Here I have some abbreviations which are quite useful when performing some Here I have some abbreviations which are quite useful when performing some system monitoring. With =df=, we can get an overview of our filesystem usage, while with =diskspace= we get some more precise information. =meminfo= is a call to =free= with sane defaults, and similar to =meminfo=, we also have =gpumeminfo= so we can get a quick look at the memory-related logs of our X session. I also declared =cpuinfo= an alias of =lscpu= in order to keep consistent with =meminfo=. =pscpu= gives us information on what the CPU is running right now, and =pscpu10= limits that to the top 10 threads. Similarly, =psmem= gives us information on the memory usage of the current threads, and =psmem10= only the ten most important threads in terms of memory usage.
system monitoring. With =df=, we can get an overview of our filesystem usage,
while with =diskspace= we get some more precise information. =meminfo= is a
call to =free= with sane defaults, and similar to =meminfo=, we also have
=gpumeminfo= so we can get a quick look at the memory-related logs of our X
session. I also declared =cpuinfo= an alias of =lscpu= in order to keep
consistent with =meminfo=. =pscpu= gives us information on what the CPU is
running right now, and =pscpu10= limits that to the top 10 threads.
Similarly, =psmem= gives us information on the memory usage of the current
threads, and =psmem10= only the ten most important threads in terms of memory
usage.
#+NAME: mgmt-abbr #+NAME: mgmt-abbr
| abbreviation | command | | abbreviation | command |
|--------------+---------------------------------------------------| |--------------+---------------------------------------------------|
@ -279,18 +245,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-7249fbb7 :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-7249fbb7
:END: :END:
I added some of these abbreviations due to how often I have to write the I added some of these abbreviations due to how often I have to write the whole thing.
whole thing.
*** Package management *** Package management
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f
:END: :END:
The first command is =remove= which removes a package from my system, as The first command is =remove= which removes a package from my system, as well as its dependencies no longer needed. =p=. =pacman='s or =yay='s. This is why I simply type =purge=. And if I want to simply seach among the =pacman= repos, I can type =search=. Otherwise, if I want to include AUR results, Ill use =yay=.
well as its dependencies no longer needed. =p=. =pacman='s or =yay='s. This
is why I simply type =purge=. And if I want to simply seach among the
=pacman= repos, I can type =search=. Otherwise, if I want to include AUR
results, Ill use =yay=.
#+NAME: pm-abbr #+NAME: pm-abbr
| abbreviation | command | | abbreviation | command |
@ -308,10 +269,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Service_management-8c5ae482 :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Service_management-8c5ae482
:END: :END:
I dont have the muscle memory of =systemctl=. So instead, I simply type I dont have the muscle memory of =systemctl=. So instead, I simply type =c= when I want to do something user service related. And if I want to manipulate system services, I can instead type a simple capital =S=.
=c= when I want to do something user service related.
And if I want to manipulate system services, I can instead type a simple
capital =S=.
#+NAME: service-abbr #+NAME: service-abbr
| abbreviation | command | | abbreviation | command |
|--------------+-----------| |--------------+-----------|
@ -325,15 +283,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-d6050ca4 :CUSTOM_ID: Abbreviations-Development-d6050ca4
:END: :END:
A good amount of these commands are development related, especially when it A good amount of these commands are development related, especially when it comes to compilation or Docker.
comes to compilation or Docker.
*** CMake *** CMake
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-CMake-f2951675 :CUSTOM_ID: Abbreviations-Development-CMake-f2951675
:END: :END:
I have the following abbreviations so I can quickly run CMake and create a I have the following abbreviations so I can quickly run CMake and create a configuration for debug or release profiles.
configuration for debug or release profiles.
#+NAME: abbr-cmake #+NAME: abbr-cmake
| abbreviation | command | | abbreviation | command |
|--------------+----------------------------------| |--------------+----------------------------------|
@ -349,8 +305,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-Docker-2d0a1288 :CUSTOM_ID: Abbreviations-Development-Docker-2d0a1288
:END: :END:
And of course, when it comes to Docker Compose, I don't have time to write And of course, when it comes to Docker Compose, I don't have time to write the full command, so I use these instead.
the full command, so I use these instead.
#+NAME: abbr-docker #+NAME: abbr-docker
| abbreviation | command | | abbreviation | command |
|--------------+------------------------------| |--------------+------------------------------|
@ -374,13 +329,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-Text_editors-5a23df47 :CUSTOM_ID: Abbreviations-Development-Text_editors-5a23df47
:END: :END:
I greatly prefer to use Emacsclient as my main text editor; Emacs has I greatly prefer to use Emacsclient as my main text editor; Emacs has basically all I need. So, it's only normal I have an abbreviation to launch a new instance of it. However, in a graphical environment, this will launch a new graphical window of Emacs. To launch a terminal instance, I'll use ~enw~ (~nw~ stands for the option “nowindow” ~-nw~ of Emacs). I also wish to completely stop using other text editors, such as ~vi~, ~vim~, ~nano~ and ~ed~, so let's all add their command as an abbreviation for Emacs.
basically all I need. So, it's only normal I have an abbreviation to launch
a new instance of it. However, in a graphical environment, this will launch
a new graphical window of Emacs. To launch a terminal instance, I'll use
~enw~ (~nw~ stands for the option “nowindow” ~-nw~ of Emacs). I also wish to
completely stop using other text editors, such as ~vi~, ~vim~, ~nano~ and
~ed~, so let's all add their command as an abbreviation for Emacs.
#+NAME: abbr-text-ed #+NAME: abbr-text-ed
| abbreviation | command | | abbreviation | command |
@ -401,8 +350,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-Compilation-dd066050 :CUSTOM_ID: Abbreviations-Development-Compilation-dd066050
:END: :END:
By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest standard and with the ~-Wall~ flag activated.
standard and with the ~-Wall~ flag activated.
#+NAME: abbr-comp #+NAME: abbr-comp
| abbreviation | command | | abbreviation | command |
|--------------+----------------------| |--------------+----------------------|
@ -420,9 +368,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Development-Git-5e5055c1 :CUSTOM_ID: Abbreviations-Development-Git-5e5055c1
:END: :END:
And let's face it: we all at one point just wanted to commit our code And let's face it: we all at one point just wanted to commit our code without thinking about the message, to just get over with it. Don't worry, I got you covered.
without thinking about the message, to just get over with it. Don't worry,
I got you covered.
#+NAME: abbr-git #+NAME: abbr-git
| abbreviation | command | | abbreviation | command |
|--------------+-----------------------------------------------------| |--------------+-----------------------------------------------------|
@ -437,11 +383,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-LaTeX-76865eb9 :CUSTOM_ID: Abbreviations-LaTeX-76865eb9
:END: :END:
Yes, although I use org-mode, I still have some use for LaTeX, especially Yes, although I use org-mode, I still have some use for LaTeX, especially when it comes to PDF exports of my org files. Hence why I use the LaTeX package manager. It is recommended to use ~tllocalmgr~ instead of ~tlmgr~, but I can never remember the command, and the latter is faster to type, so time for an abbreviation. Same goes for ~texhash~ which must be run as sudo.
when it comes to PDF exports of my org files. Hence why I use the LaTeX
package manager. It is recommended to use ~tllocalmgr~ instead of ~tlmgr~,
but I can never remember the command, and the latter is faster to type, so
time for an abbreviation. Same goes for ~texhash~ which must be run as sudo.
#+NAME: latex-abbr #+NAME: latex-abbr
| abbreviation | command | | abbreviation | command |
|--------------+--------------| |--------------+--------------|
@ -457,14 +399,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Some_security_measures-489cb521 :CUSTOM_ID: Abbreviations-Some_security_measures-489cb521
:END: :END:
Some commands can be quite dangerous when not used properly, which is why I Some commands can be quite dangerous when not used properly, which is why I added default flags and options so I can get warnings before things get ugly. The =-i= and =-I= add prompts in case we might not want to do what we asked the shell to do. Notice =lns= which creates symlinks, =rmd= which removes directories, =rmf= which forces deletion, and =rmdf= which forces the delition of a directory. Notice also the =--preserve-root= which will prevent me from accidentally removing the root folder. I added the same option to =chgrp=, =chmod=, and =chown=.
added default flags and options so I can get warnings before things get ugly.
The =-i= and =-I= add prompts in case we might not want to do what we asked
the shell to do. Notice =lns= which creates symlinks, =rmd= which removes
directories, =rmf= which forces deletion, and =rmdf= which forces the
delition of a directory. Notice also the =--preserve-root= which will prevent
me from accidentally removing the root folder. I added the same option to
=chgrp=, =chmod=, and =chown=.
#+NAME: sec-abbr #+NAME: sec-abbr
| abbreviation | command | | abbreviation | command |
|--------------+--------------------------| |--------------+--------------------------|
@ -489,13 +424,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Typos-370bbb27 :CUSTOM_ID: Abbreviations-Typos-370bbb27
:END: :END:
Let's admit it, we all make typos from time to time in the shell, and some Let's admit it, we all make typos from time to time in the shell, and some are recurrent enough we make abbreviations or aliases of the correct command. Well, I have some of my abbreviations which were make exactly because of this. Sometimes for some reasons, my brain makes me write ~clean~ instead of ~clear~. So, let's just replace the former by the latter. I'm also very bad at typing ~exit~. And sometimes I suck at typing ~htop~. ~q~ isn't a typo per se, instead just a habit I have.
are recurrent enough we make abbreviations or aliases of the correct command.
Well, I have some of my abbreviations which were make exactly because of
this. Sometimes for some reasons, my brain makes me write ~clean~ instead of
~clear~. So, let's just replace the former by the latter. I'm also very bad
at typing ~exit~. And sometimes I suck at typing ~htop~. ~q~ isn't a typo per
se, instead just a habit I have.
#+NAME: typo-abbr #+NAME: typo-abbr
| abbreviation | command | | abbreviation | command |
|--------------+---------| |--------------+---------|
@ -514,53 +443,39 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-c2631eb6 :CUSTOM_ID: Abbreviations-Misc-c2631eb6
:END: :END:
Finally, some miscellaneous abbreviations that don't really fit into any of Finally, some miscellaneous abbreviations that don't really fit into any of the above categories.
the above categories.
*** Media *** Media
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-Media-e4b85d56 :CUSTOM_ID: Abbreviations-Misc-Media-e4b85d56
:END: :END:
Here you will find various commands related to media in general. the first Here you will find various commands related to media in general. the first one is a command to play some chillhop from the [[https://www.youtube.com/user/Chillhopdotcom][Chillhop YouTube channel]]'s livestream.
one is a command to play some chillhop from the [[https://www.youtube.com/user/Chillhopdotcom][Chillhop YouTube channel]]'s
livestream.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr chill 'mpv --force-window=no --no-video "https://www.youtube.com/user/Chillhopdotcom/live" &' abbr chill 'mpv --force-window=no --no-video "https://www.youtube.com/user/Chillhopdotcom/live" &'
#+END_SRC #+END_SRC
When it comes to mpv, I do not want to force it to open a graphical window When it comes to mpv, I do not want to force it to open a graphical window if for example I want to listen to an audio file. I also do not want any border on that window. So, I declared this abbreviation.
if for example I want to listen to an audio file. I also do not want any
border on that window. So, I declared this abbreviation.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr mpv 'mpv --no-border --force-window=no' abbr mpv 'mpv --no-border --force-window=no'
#+END_SRC #+END_SRC
When I want to download a song from YouTube, I'll just use the command ~flac When I want to download a song from YouTube, I'll just use the command ~flac videoIdentifier~ to get it through ~youtube-dl~.
videoIdentifier~ to get it through ~youtube-dl~.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"' abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"'
#+END_SRC #+END_SRC
I download a LOT of videos from YouTube, generally educative videos that I I download a LOT of videos from YouTube, generally educative videos that I do not want to lose to YouTube one day who will decide that such channel is unworthy of their platform, or if the original author decides to delete their videos or whatever. So, I use the abbreviation ~ytdl~ to download either one video, or a whole YouTube channel.
do not want to lose to YouTube one day who will decide that such channel is
unworthy of their platform, or if the original author decides to delete
their videos or whatever. So, I use the abbreviation ~ytdl~ to download
either one video, or a whole YouTube channel.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr ytdl 'youtube-dl -f best -ciw -o "~/Videos/YouTube/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"' abbr ytdl 'youtube-dl -f best -ciw -o "~/Videos/YouTube/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"'
#+END_SRC #+END_SRC
Some sane default options for ~sxiv~, a simple X image Viewer. This includes Some sane default options for ~sxiv~, a simple X image Viewer. This includes playing GIFs and not displaying the filename below. Sxiv will also open in fullscreen and will fit the displayed image to the frame. I also abbreviated ~feh~ to sxiv, old habits die hard.
playing GIFs and not displaying the filename below. Sxiv will also open in
fullscreen and will fit the displayed image to the frame. I also abbreviated
~feh~ to sxiv, old habits die hard.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr sxiv 'sxiv -abfs f' abbr sxiv 'sxiv -abfs f'
abbr feh 'sxiv -abfs f' abbr feh 'sxiv -abfs f'
#+END_SRC #+END_SRC
Finally, let's declare the following abbreviation that will launch an mpv Finally, let's declare the following abbreviation that will launch an mpv instance displaying my webcam:
instance displaying my webcam:
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr webcam 'mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0' abbr webcam 'mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0'
#+END_SRC #+END_SRC
@ -569,9 +484,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-Sudo-aef0214a :CUSTOM_ID: Abbreviations-Misc-Sudo-aef0214a
:END: :END:
First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call First, I make it so that ~sudo~ comes with the ~-A~ switch in order to call my custom graphical script for getting my password (see [[file:bin.org::#Askpass-d0d7a8c0][askpass]]). I also made it so ~please~ is an equivalent to ~sudo -A~ as a joke.
my custom graphical script for getting my password (see [[file:bin.org::#Askpass-d0d7a8c0][askpass]]). I also
made it so ~please~ is an equivalent to ~sudo -A~ as a joke.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr please 'sudo -A' abbr please 'sudo -A'
#+END_SRC #+END_SRC
@ -580,8 +493,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-History-a2124b23 :CUSTOM_ID: Abbreviations-Misc-History-a2124b23
:END: :END:
I also find it more intuitive and faster to just write ~hist~ instead of I also find it more intuitive and faster to just write ~hist~ instead of ~history~, so let's declare that.
~history~, so let's declare that.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr hist history abbr hist history
#+END_SRC #+END_SRC
@ -590,11 +502,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-Compression-4fd4ffef :CUSTOM_ID: Abbreviations-Misc-Compression-4fd4ffef
:END: :END:
It seems it's just like many other people, but I cannot for the life of me It seems it's just like many other people, but I cannot for the life of me remember the syntax of ~tar~. So, I made the following abbreviations, and one day hopefully, after seeing the abbreviations' expansion over and over I'll remember the command like I did for the abbreviation of ~remove~ (see [[#Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f][Package management]]).
remember the syntax of ~tar~. So, I made the following abbreviations, and
one day hopefully, after seeing the abbreviations' expansion over and over
I'll remember the command like I did for the abbreviation of ~remove~ (see
[[#Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f][Package management]]).
#+NAME: tar-abbr #+NAME: tar-abbr
| abbreviation | command | | abbreviation | command |
|--------------+-----------| |--------------+-----------|
@ -624,8 +532,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-Network_Management-0b7fc91d :CUSTOM_ID: Abbreviations-Misc-Network_Management-0b7fc91d
:END: :END:
First, we have just =nmcli= with sane default options, that is a pretty output First, we have just =nmcli= with sane default options, that is a pretty output with colors.
with colors.
#+BEGIN_SRC fish #+BEGIN_SRC fish
abbr nmcli 'nmcli -p -c auto' abbr nmcli 'nmcli -p -c auto'
#+END_SRC #+END_SRC
@ -634,11 +541,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Abbreviations-Misc-NordVPN-09438638 :CUSTOM_ID: Abbreviations-Misc-NordVPN-09438638
:END: :END:
Next, we have some NordVPN-related shortcuts. The first one is a simple Next, we have some NordVPN-related shortcuts. The first one is a simple abbreviation to =nordvpn=. The second one is a shortcut to connect to a server, and to disconnect from the current server. I also have a couple of shortcuts to quickly connect to some preselected countries, mainly France, Germany, Japan and the US.
abbreviation to =nordvpn=. The second one is a shortcut to connect to a
server, and to disconnect from the current server. I also have a couple of
shortcuts to quickly connect to some preselected countries, mainly France,
Germany, Japan and the US.
#+NAME: nordvpn-abbr #+NAME: nordvpn-abbr
| abbreviation | command | | abbreviation | command |
|--------------+-------------------------| |--------------+-------------------------|

View File

@ -11,17 +11,11 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Presentation-9c7a53bf :CUSTOM_ID: Presentation-9c7a53bf
:END: :END:
*Before proceeding, be aware that I deprecated this i3 config on August 22nd, *Before proceeding, be aware that I deprecated this i3 config on August 22nd, 2020, meaning I wont update it anymore unless I use it again some day in the future. I will keep it on my website though.*
2020, meaning I wont update it anymore unless I use it again some day in the
future. I will keep it on my website though.*
=i3= is a window manager for GNU/Linux which automatically tiles windows in =i3= is a window manager for GNU/Linux which automatically tiles windows in workspaces. This configuration was ade to automatically handle some tasks such as which software allowed where, autostart, and launching software with shortcuts.
workspaces. This configuration was ade to automatically handle some tasks such
as which software allowed where, autostart, and launching software with
shortcuts.
It is to be noted I am using [[https://github.com/Airblader/i3][Airbladers fork of i3]], =i3-gaps=. Some It is to be noted I am using [[https://github.com/Airblader/i3][Airbladers fork of i3]], =i3-gaps=. Some configuration will not work with =i3=.
configuration will not work with =i3=.
#+BEGIN_SRC conf :exports none #+BEGIN_SRC conf :exports none
# -*- mode: conf -*- # -*- mode: conf -*-
@ -35,22 +29,11 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Variables_declaration-Global-1cf1bfe4 :CUSTOM_ID: Variables_declaration-Global-1cf1bfe4
:END: :END:
The first I do is declaring the modifier key and the alt key —I dont find The first I do is declaring the modifier key and the alt key —I dont find the names =Mod1= and =Mod4= to be explicit enough. This will map =$mod= to the Super key (or as some people unfortunately call it, the /Windows/ key) and =$alt= to the Alt key.
the names =Mod1= and =Mod4= to be explicit enough. This will map =$mod= to
the Super key (or as some people unfortunately call it, the /Windows/ key)
and =$alt= to the Alt key.
Lets also bind the =$up=, =$down=, =$left= and =$right= variables to Lets also bind the =$up=, =$down=, =$left= and =$right= variables to respectively the up, down, left, and right arrows on the keyboard. Why bind them to variables? If I ever want to modify the arrow keys to some other keys, like =é=, =a=, =u=, and =i= (the equivalent of =wqsd= on the bépo layout) or =c=, =t=, =s=, and =r= (the equivalent of =hjkl= on the bépo layout), I will just have to modify these four lines.
respectively the up, down, left, and right arrows on the keyboard. Why bind
them to variables? If I ever want to modify the arrow keys to some other
keys, like =é=, =a=, =u=, and =i= (the equivalent of =wqsd= on the bépo
layout) or =c=, =t=, =s=, and =r= (the equivalent of =hjkl= on the bépo
layout), I will just have to modify these four lines.
Ill also set the =$term= variable. A lot of shortcuts in my i3 config rely Ill also set the =$term= variable. A lot of shortcuts in my i3 config rely on the terminal emulator itself to launch commands in the terminal, and thus call the terminal itself. If I ever need to move from my current terminal, I will just have to change the name of the executable here.
on the terminal emulator itself to launch commands in the terminal, and thus
call the terminal itself. If I ever need to move from my current terminal, I
will just have to change the name of the executable here.
#+NAME: variable-table #+NAME: variable-table
| variable | value | | variable | value |
@ -94,8 +77,7 @@
: set $right Right : set $right Right
: set $term st : set $term st
Finally, some variables hold some long strings for commands I dont want to Finally, some variables hold some long strings for commands I dont want to have to type multiple times.
have to type multiple times.
#+NAME: generate-variables2 #+NAME: generate-variables2
#+BEGIN_SRC emacs-lisp :var variables=variable-sh :cache yes #+BEGIN_SRC emacs-lisp :var variables=variable-sh :cache yes
(mapconcat (lambda (x) (format "set %s \"%s\"" (car x) (cadr x))) (mapconcat (lambda (x) (format "set %s \"%s\"" (car x) (cadr x)))
@ -117,8 +99,7 @@
<<generate-variables2()>> <<generate-variables2()>>
#+END_SRC #+END_SRC
Now comes the font for the window tiles. Honestly, this setting is useless Now comes the font for the window tiles. Honestly, this setting is useless since we do not see it, but lets set it anyway.
since we do not see it, but lets set it anyway.
#+BEGIN_SRC conf #+BEGIN_SRC conf
font Fira Sans Book:style=Book:pixelsize=10 font Fira Sans Book:style=Book:pixelsize=10
#+END_SRC #+END_SRC
@ -127,15 +108,9 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Variables_declaration-Floating_windows-897d0c3b :CUSTOM_ID: Variables_declaration-Floating_windows-897d0c3b
:END: :END:
Floating windows are windows that are not tiled with other windows, but Floating windows are windows that are not tiled with other windows, but rather are free to go anywhere on your screen, with any size. A bit like what you would get with any other non-tiling window manager or desktop environment (though most of them support minimal tiling features).
rather are free to go anywhere on your screen, with any size. A bit like what
you would get with any other non-tiling window manager or desktop environment
(though most of them support minimal tiling features).
Lets declare our floading modyfier. With floating windows, you can move them Lets declare our floading modyfier. With floating windows, you can move them around by clicking on the windows borders; but since we dont have any with this config, we will have instead to press the floating modifier while clicking on the window (anywhere on the window is fine) to move them around.
around by clicking on the windows borders; but since we dont have any with
this config, we will have instead to press the floating modifier while
clicking on the window (anywhere on the window is fine) to move them around.
Here is the configuration: Here is the configuration:
#+BEGIN_SRC conf #+BEGIN_SRC conf
@ -146,22 +121,18 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: i3_global_settings-1b863d93 :CUSTOM_ID: i3_global_settings-1b863d93
:END: :END:
Some settings affect i3 globally, such as its aspect or how it handles the Some settings affect i3 globally, such as its aspect or how it handles the mouse. Hence, here are some settings I set in my configuration.
mouse. Hence, here are some settings I set in my configuration.
** Mouse settings ** Mouse settings
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: i3_global_settings-Mouse_settings-4630241d :CUSTOM_ID: i3_global_settings-Mouse_settings-4630241d
:END: :END:
First of all, I do not want i3 to warp my mouse each time I change windows; First of all, I do not want i3 to warp my mouse each time I change windows; my mouse stays where it is.
my mouse stays where it is.
#+BEGIN_SRC conf #+BEGIN_SRC conf
mouse_warping none mouse_warping none
#+END_SRC #+END_SRC
I also to not want the window focus to follow my mouse, because sometimes I
will just knock my physical mouse out of the way of my hand, and when I do I also to not want the window focus to follow my mouse, because sometimes I will just knock my physical mouse out of the way of my hand, and when I do that the software mouse will most likely end up in another window I do not want to focus.
that the software mouse will most likely end up in another window I do not
want to focus.
#+BEGIN_SRC conf #+BEGIN_SRC conf
focus_follows_mouse no focus_follows_mouse no
#+END_SRC #+END_SRC
@ -170,9 +141,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: i3_global_settings-Popup_handling-51b6ed8d :CUSTOM_ID: i3_global_settings-Popup_handling-51b6ed8d
:END: :END:
While in fullscreen, some software might generate a popup. In that case, I While in fullscreen, some software might generate a popup. In that case, I want to be aware of that, and any popup will make me leave fullscreen in order to be presented with said popup.
want to be aware of that, and any popup will make me leave fullscreen in
order to be presented with said popup.
#+BEGIN_SRC conf #+BEGIN_SRC conf
popup_during_fullscreen leave_fullscreen popup_during_fullscreen leave_fullscreen
#+END_SRC #+END_SRC
@ -181,12 +150,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: i3_global_settings-Behavior_of_workspace_changes-00202985 :CUSTOM_ID: i3_global_settings-Behavior_of_workspace_changes-00202985
:END: :END:
When changing workspace as described below, we often want to go back to the When changing workspace as described below, we often want to go back to the previous workspace we were working on, but we might not remember immediately which one it was, or we might still have our fingers ready to fire the shortcut which made us make the first workspace change. Hence, if we type the same workspace change shortcut, instead of doing nothing it will bring us back to the previous workspace we were on.
previous workspace we were working on, but we might not remember immediately
which one it was, or we might still have our fingers ready to fire the
shortcut which made us make the first workspace change. Hence, if we type the
same workspace change shortcut, instead of doing nothing it will bring us
back to the previous workspace we were on.
#+BEGIN_SRC conf #+BEGIN_SRC conf
workspace_auto_back_and_forth yes workspace_auto_back_and_forth yes
#+END_SRC #+END_SRC
@ -195,17 +159,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: i3_global_settings-Gaps_and_window_appearance-749e9f7b :CUSTOM_ID: i3_global_settings-Gaps_and_window_appearance-749e9f7b
:END: :END:
As mentioned in at the beginning of this document, I am using i3-gaps, which As mentioned in at the beginning of this document, I am using i3-gaps, which brings spacing (gaps) between windows to i3.
brings spacing (gaps) between windows to i3.
First, I want space around my windows only when there are several containers First, I want space around my windows only when there are several containers on the same screen, otherwise they will be maximized.
on the same screen, otherwise they will be maximized.
#+BEGIN_SRC conf #+BEGIN_SRC conf
smart_gaps on smart_gaps on
#+END_SRC #+END_SRC
I also do not want to see any window border, so I will be turning this I also do not want to see any window border, so I will be turning this setting off.
setting off.
#+BEGIN_SRC conf #+BEGIN_SRC conf
smart_borders on smart_borders on
#+END_SRC #+END_SRC
@ -215,17 +176,13 @@
default_border pixel 0 default_border pixel 0
#+END_SRC #+END_SRC
Then comes the size of these gaps. I made the outer gap negative so the space Then comes the size of these gaps. I made the outer gap negative so the space between my windows and the border of my screens is smaller than the gap between my containers.
between my windows and the border of my screens is smaller than the gap
between my containers.
#+BEGIN_SRC conf #+BEGIN_SRC conf
gaps inner 20 gaps inner 20
gaps outer -10 gaps outer -10
#+END_SRC #+END_SRC
Some parameters are also available when it comes to the colors i3 uses. Some parameters are also available when it comes to the colors i3 uses. Honestly, we wont see these colors much, so lets simply keep the default values.
Honestly, we wont see these colors much, so lets simply keep the default
values.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set_from_resource $fg i3wm.color7 #f0f0f0 set_from_resource $fg i3wm.color7 #f0f0f0
set_from_resource $bg i3wm.color2 #f0f0f0 set_from_resource $bg i3wm.color2 #f0f0f0
@ -242,9 +199,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Assigning_windows_to_workspaces-e59f61e5 :CUSTOM_ID: Assigning_windows_to_workspaces-e59f61e5
:END: :END:
I decided to bind some windows to some workspaces in order to have a better I decided to bind some windows to some workspaces in order to have a better organization of my desktop.
organization of my desktop.
#+NAME: assignment-table #+NAME: assignment-table
| Application | Class | Workspace | | Application | Class | Workspace |
|-------------+-------------+-----------| |-------------+-------------+-----------|
@ -258,8 +213,7 @@
| Steam | Steam | 9 | | Steam | Steam | 9 |
| Discord | discord | 10 | | Discord | discord | 10 |
The class table is used in the assignment in the i3 config file. For instance, The class table is used in the assignment in the i3 config file. For instance, Gimps assignment will look like this:
Gimps assignment will look like this:
#+BEGIN_SRC conf :tangle no #+BEGIN_SRC conf :tangle no
assign [class="Gimp*"] 6 assign [class="Gimp*"] 6
#+END_SRC #+END_SRC
@ -287,12 +241,7 @@
<<generate-workspaces()>> <<generate-workspaces()>>
#+END_SRC #+END_SRC
And although this is not specifically assigning a window to a workspace, I And although this is not specifically assigning a window to a workspace, I also want to have the tenth workspace assigned to a specific output in case I have two screens — and since this is the case when I am using only one computer, Marpa, I will be using some EmacsLisp in order to generate a different configuration file from this org file depending on the name of the machine.
also want to have the tenth workspace assigned to a specific output in case I
have two screens — and since this is the case when I am using only one
computer, Marpa, I will be using some EmacsLisp in order to generate a
different configuration file from this org file depending on the name of the
machine.
#+NAME: ws10-output-edp1 #+NAME: ws10-output-edp1
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(if (string= system-name "Marpa") (if (string= system-name "Marpa")
@ -309,9 +258,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-9c7074d3 :CUSTOM_ID: Shortcuts-9c7074d3
:END: :END:
I use *A LOT* of shortcuts when it comes to my workflow. Like, all the time. I use *A LOT* of shortcuts when it comes to my workflow. Like, all the time. So, expect this chapter to be a bit long, and Ill try to make it readable still.
So, expect this chapter to be a bit long, and Ill try to make it readable
still.
Shortcuts are set like so: Shortcuts are set like so:
#+BEGIN_SRC conf :tangle no #+BEGIN_SRC conf :tangle no
@ -329,9 +276,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Terminal_shortcuts-514ecdbe :CUSTOM_ID: Shortcuts-Terminal_shortcuts-514ecdbe
:END: :END:
I have a couple of shortcuts which are related to my terminal. For instance, I have a couple of shortcuts which are related to my terminal. For instance, ~$mod+Return~ opens a regular terminal instance while ~$mod+$alt+M~ opens an SSH instance on my Mila host.
~$mod+Return~ opens a regular terminal instance while ~$mod+$alt+M~ opens an
SSH instance on my Mila host.
#+NAME: terminal-shortcuts #+NAME: terminal-shortcuts
| shortcut | command | What it does | | shortcut | command | What it does |
|-------------------+----------------------+--------------------------------------------------| |-------------------+----------------------+--------------------------------------------------|
@ -359,16 +304,13 @@
| $mod+Shift+r | exec yadm alt && i3-msg restart | Restart i3 inplace | | $mod+Shift+r | exec yadm alt && i3-msg restart | Restart i3 inplace |
| $mod+Shift+e | exec $exiti3 | Quit i3 | | $mod+Shift+e | exec $exiti3 | Quit i3 |
And although this is not really an i3 shortcut per se, I add here the And although this is not really an i3 shortcut per se, I add here the shortcut for launching pywal, which will set one of my wallpapers as the wallpaper and will generate my systems color configuration from it.
shortcut for launching pywal, which will set one of my wallpapers as the
wallpaper and will generate my systems color configuration from it.
#+NAME: wal-sh #+NAME: wal-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|----------+--------------+--------------------------------------------------------------| |----------+--------------+--------------------------------------------------------------|
| $mod+w | exec $walset | Set a random wallpaper and generates a color profile from it | | $mod+w | exec $walset | Set a random wallpaper and generates a color profile from it |
We also have some shortcuts to lock our screen, sleep, hibernate and shut We also have some shortcuts to lock our screen, sleep, hibernate and shut down our computer.
down our computer.
#+NAME: computer-sh #+NAME: computer-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|---------------+----------------------------+------------------------| |---------------+----------------------------+------------------------|
@ -392,9 +334,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Managing_how_windows_will_split-5a22ae31 :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Managing_how_windows_will_split-5a22ae31
:END: :END:
It is possible to indicate to i3 how windows interact with one another, and It is possible to indicate to i3 how windows interact with one another, and especially how they are organized by spawning new windows either to the right or below the current window.
especially how they are organized by spawning new windows either to the
right or below the current window.
#+NAME: split-win-sh #+NAME: split-win-sh
| shortcuts | command | what it does | | shortcuts | command | what it does |
|-----------+---------+--------------------------------------------------------| |-----------+---------+--------------------------------------------------------|
@ -428,9 +368,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Focus_workspaces-9f4bee74 :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Focus_workspaces-9f4bee74
:END: :END:
Just like windows, it is also possible to change focus between workspaces, Just like windows, it is also possible to change focus between workspaces, because lets be honest, most people wont have ten screens to display all ten workspaces at the same time, and frankly that would be impractical.
because lets be honest, most people wont have ten screens to display all
ten workspaces at the same time, and frankly that would be impractical.
#+NAME: ws-focus-sh #+NAME: ws-focus-sh
| shortcut | window | what it does | | shortcut | window | what it does |
|----------+--------------+-------------------------| |----------+--------------+-------------------------|
@ -472,8 +410,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Moving_containers-b97cf4ae :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Moving_containers-b97cf4ae
:END: :END:
To move containers between the available screens, you have the following To move containers between the available screens, you have the following shortcuts:
shortcuts:
#+NAME: containers-move-sh #+NAME: containers-move-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|------------------+--------------------------------+------------------------------------------------------------| |------------------+--------------------------------+------------------------------------------------------------|
@ -508,8 +445,7 @@
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Moving_workspaces-a71d7b54 :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Moving_workspaces-a71d7b54
:END: :END:
It is also possible to move workspaces. The related shortcuts available are It is also possible to move workspaces. The related shortcuts available are the following:
the following:
#+NAME: workspace-move-sh #+NAME: workspace-move-sh
| shortcut | command | what it does | | shortcut | command | what it does |
@ -528,10 +464,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Close_windows-5e521a48 :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Close_windows-5e521a48
:END: :END:
To close windows, we have two main shortcuts: Alt+F4 and mod+q. The first To close windows, we have two main shortcuts: Alt+F4 and mod+q. The first one is here due to habits, but I dont really use it anymore due to my main keyboard which doesnt have any easy access to the functions keys, hence mod+q.
one is here due to habits, but I dont really use it anymore due to my main
keyboard which doesnt have any easy access to the functions keys, hence
mod+q.
#+NAME: close-win-sh #+NAME: close-win-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|----------+---------+-------------------------| |----------+---------+-------------------------|
@ -547,10 +480,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Manage_the_size_of_the_current_window-11afa914 :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Manage_the_size_of_the_current_window-11afa914
:END: :END:
It is possible to change the size of the current window, even if it is a It is possible to change the size of the current window, even if it is a floating one. The first shortcut that might interest you is $mod+f which switches your current window to fullscreen. But to resize a window, you will need to enter the ~resize~ mode.
floating one. The first shortcut that might interest you is $mod+f which
switches your current window to fullscreen. But to resize a window, you will
need to enter the ~resize~ mode.
#+NAME: size-win-sh #+NAME: size-win-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|----------+-------------------+---------------------------------------------------| |----------+-------------------+---------------------------------------------------|
@ -564,9 +494,7 @@
} }
#+END_SRC #+END_SRC
So, all the following shortcuts will be inserted in a mode called ~resize~. So, all the following shortcuts will be inserted in a mode called ~resize~. Note that not only are the resizing shortcuts bound to the arrow keys, they are also bound to ~ctsr~, which is the bépo equivalent of ~hjkl~.
Note that not only are the resizing shortcuts bound to the arrow keys, they
are also bound to ~ctsr~, which is the bépo equivalent of ~hjkl~.
#+NAME: resize-win-sh #+NAME: resize-win-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|----------+-------------------------------------+-------------------------------------------| |----------+-------------------------------------+-------------------------------------------|
@ -580,10 +508,7 @@
| s | resize shrink height 10 px or 5 ppt | Decrease the height of the current window | | s | resize shrink height 10 px or 5 ppt | Decrease the height of the current window |
| Return | mode "default" | Return to the default mode | | Return | mode "default" | Return to the default mode |
| Escape | mode "default" | Return to the default mode | | Escape | mode "default" | Return to the default mode |
If you prefer, you can think of these shortcuts not as increasing or If you prefer, you can think of these shortcuts not as increasing or decreasing the width or height of the current window, but rather as how the bottom or right limit of the windows will be moved relative to the top left corner.
decreasing the width or height of the current window, but rather as how the
bottom or right limit of the windows will be moved relative to the top left
corner.
Here is the configuration: Here is the configuration:
#+BEGIN_SRC conf #+BEGIN_SRC conf
@ -597,16 +522,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Manage_floating_windows-9206f4da :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Manage_floating_windows-9206f4da
:END: :END:
As said above, your windows can be floating windows instead of being tiled As said above, your windows can be floating windows instead of being tiled like they are by default. For this too we have a couple of shortcuts:
like they are by default. For this too we have a couple of shortcuts:
#+NAME: float-win-sh #+NAME: float-win-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|------------------+----------------------+------------------------------------------------------| |------------------+----------------------+------------------------------------------------------|
| $mod+Shift+space | floating toggle | Toggles the window between tiled and floating mode | | $mod+Shift+space | floating toggle | Toggles the window between tiled and floating mode |
| $mod+space | focus mode_toggle | Toggles the focus between tiled and floating windows | | $mod+space | focus mode_toggle | Toggles the focus between tiled and floating windows |
| $mod+Ctrl+c | move position center | Centers the focused floating window | | $mod+Ctrl+c | move position center | Centers the focused floating window |
If you want to move around your floating window, you can do it with your If you want to move around your floating window, you can do it with your mouse while holding down the floating modifier declared [[#Variables_declaration-Floating_windows-897d0c3b][here]].
mouse while holding down the floating modifier declared [[#Variables_declaration-Floating_windows-897d0c3b][here]].
Here is the configuration: Here is the configuration:
#+BEGIN_SRC conf #+BEGIN_SRC conf
@ -617,19 +540,9 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Scratchpad_and_window_display-10d8d1f4 :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Scratchpad_and_window_display-10d8d1f4
:END: :END:
You can think of i3s scratchpad as some sort of extra workspace in which You can think of i3s scratchpad as some sort of extra workspace in which you can hide your windows you are not using, or as if you want to reduce a window to the taskbar of other window managers or desktop environments. You have basically two shortcuts for the scratchpad: one that sends the current window to the scratchpad, and one that cicles through the windows sent to the scratchpad and shows them to you sequencially. If you go through all of them, they will be hidden again. You can get a window out of the scratchpad by tiling it to the current workspace with the shortcut described above.
you can hide your windows you are not using, or as if you want to reduce a
window to the taskbar of other window managers or desktop environments. You
have basically two shortcuts for the scratchpad: one that sends the current
window to the scratchpad, and one that cicles through the windows sent to
the scratchpad and shows them to you sequencially. If you go through all of
them, they will be hidden again. You can get a window out of the scratchpad
by tiling it to the current workspace with the shortcut described above.
You also have the possibility of making a floating window a sticky window. You also have the possibility of making a floating window a sticky window. This means not only will it show on all workspaces, it will also be on top of every other window. It can be useful if you have some notes you want to keep an eye on for instance.
This means not only will it show on all workspaces, it will also be on top
of every other window. It can be useful if you have some notes you want to
keep an eye on for instance.
#+NAME: scratchpad-sh #+NAME: scratchpad-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|--------------+-----------------+------------------------------------------------------| |--------------+-----------------+------------------------------------------------------|
@ -646,9 +559,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Window_and_workspace_management-Gaps_management-33979213 :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Gaps_management-33979213
:END: :END:
It is possible to dynamically change the gaps between containers if we want It is possible to dynamically change the gaps between containers if we want to change a bit the appearance of i3. For that, we obviously have some shortcuts.
to change a bit the appearance of i3. For that, we obviously have some
shortcuts.
#+NAME: gaps-resize-sh #+NAME: gaps-resize-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|-------------------+-----------------------------------------------+-----------------------------| |-------------------+-----------------------------------------------+-----------------------------|
@ -667,18 +578,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Launching_software-0e088e69 :CUSTOM_ID: Shortcuts-Launching_software-0e088e69
:END: :END:
A big part of my i3 shortcuts though are related to launching various A big part of my i3 shortcuts though are related to launching various software. Ill try to sort them by category here, but do take a look even at categories which you might not be interested in, they might actually have something useful for you.
software. Ill try to sort them by category here, but do take a look even at
categories which you might not be interested in, they might actually have
something useful for you.
*** Software and command launcher *** Software and command launcher
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Launching_software-Software_and_command_launcher-a3f5863e :CUSTOM_ID: Shortcuts-Launching_software-Software_and_command_launcher-a3f5863e
:END: :END:
These commands will allow the user to launch applications which provide These commands will allow the user to launch applications which provide ~.desktop~ files or user-defined ~.desktop~ files, as well as commands with the help of rofi.
~.desktop~ files or user-defined ~.desktop~ files, as well as commands with
the help of rofi.
#+NAME: launcher-sh #+NAME: launcher-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|--------------+---------------------------------------+-------------------------------------------------------| |--------------+---------------------------------------+-------------------------------------------------------|
@ -728,10 +634,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Launching_software-Screen_brightness-6855d53f :CUSTOM_ID: Shortcuts-Launching_software-Screen_brightness-6855d53f
:END: :END:
Here we have four commands for managing our screens brightness (this is Here we have four commands for managing our screens brightness (this is useful for laptops, not so much with desktops), and two of them are actually duplicates of the other two in case a laptop doesnt have dedicated keys or we are using a keyboard which doesnt provide them.
useful for laptops, not so much with desktops), and two of them are actually
duplicates of the other two in case a laptop doesnt have dedicated keys or
we are using a keyboard which doesnt provide them.
#+NAME: brightness-sh #+NAME: brightness-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|-----------------------+------------------------+---------------------------------------| |-----------------------+------------------------+---------------------------------------|
@ -749,10 +652,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Launching_software-Media_control-18ad2815 :CUSTOM_ID: Shortcuts-Launching_software-Media_control-18ad2815
:END: :END:
Some shortcuts are dedicated to media control, especially when it comes to Some shortcuts are dedicated to media control, especially when it comes to controlling music. All of these media control shortcuts will be calls to ~mpc~ which will in turn send commands to ~mpd~, which is the music server I use on my computers.
controlling music. All of these media control shortcuts will be calls to
~mpc~ which will in turn send commands to ~mpd~, which is the music server I
use on my computers.
#+NAME: media-sh #+NAME: media-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|---------------------------+--------------------+--------------------------------| |---------------------------+--------------------+--------------------------------|
@ -770,16 +670,14 @@
| $mod+$alt+7 | exec mpc volume +5 | Increase the volume from mpd | | $mod+$alt+7 | exec mpc volume +5 | Increase the volume from mpd |
| $mod+$alt+8 | exec mpc volume -5 | Decrease the volume from mpd | | $mod+$alt+8 | exec mpc volume -5 | Decrease the volume from mpd |
We also have two shortcuts for launching ncmpcpp, my mpd frontend, either We also have two shortcuts for launching ncmpcpp, my mpd frontend, either with the playlist open by default, or the visualizes open.
with the playlist open by default, or the visualizes open.
#+NAME: ncmpcpp-sh #+NAME: ncmpcpp-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|--------------+-----------------------------------+----------------------------------| |--------------+-----------------------------------+----------------------------------|
| $mod+Shift+n | exec $term ncmpcpp -q | Launch ncmpcpps playlist editor | | $mod+Shift+n | exec $term ncmpcpp -q | Launch ncmpcpps playlist editor |
| $mod+Shift+v | exec $term ncmpcpp -qs visualizer | Launch ncmpcpps visualizer | | $mod+Shift+v | exec $term ncmpcpp -qs visualizer | Launch ncmpcpps visualizer |
We also have more general shortcuts, like how to manipulate the general We also have more general shortcuts, like how to manipulate the general volume level.
volume level.
#+NAME: volume-sh #+NAME: volume-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|----------------------+----------------------------------------+----------------------| |----------------------+----------------------------------------+----------------------|
@ -800,8 +698,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Launching_software-Rofi_utilities-b8eb5b95 :CUSTOM_ID: Shortcuts-Launching_software-Rofi_utilities-b8eb5b95
:END: :END:
We also have some utilities Ive written and which are interfaced with rofi. We also have some utilities Ive written and which are interfaced with rofi. Here are said shortcuts.
Here are said shortcuts.
#+NAME: rofi-sh #+NAME: rofi-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|-------------------+-----------------------+-----------------------------------------------------------------------| |-------------------+-----------------------+-----------------------------------------------------------------------|
@ -822,8 +719,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Launching_software-Miscellaneous-7ec80fea :CUSTOM_ID: Shortcuts-Launching_software-Miscellaneous-7ec80fea
:END: :END:
And last but not least, I have some other shortcuts for various software, And last but not least, I have some other shortcuts for various software, some of them which I use quite a lot like the shortcut for launching Emacs.
some of them which I use quite a lot like the shortcut for launching Emacs.
#+NAME: misc-sh #+NAME: misc-sh
| shortcut | command | what it does | | shortcut | command | what it does |
|-------------+------------------+---------------------------------| |-------------+------------------+---------------------------------|
@ -841,19 +737,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shortcuts-Launching_software-Screen_management-f9b35bf2 :CUSTOM_ID: Shortcuts-Launching_software-Screen_management-f9b35bf2
:END: :END:
Additionally, we have a shortcut for entering presentation mode on the Additionally, we have a shortcut for entering presentation mode on the additional screen of the computer; on my main computer, Mila, the additional screen is HDMI-1, while it is VGA1 on my travel laptop. Well use some Emacs Lisp to determine on the configuration file export which screens names to use.
additional screen of the computer; on my main computer, Mila, the additional
screen is HDMI-1, while it is VGA1 on my travel laptop. Well use some
Emacs Lisp to determine on the configuration file export which screens names
to use.
#+NAME: hostname-screen-management #+NAME: hostname-screen-management
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(cond ((string= system-name "Marpa") "bindsym $mod+Ctrl+p xrandr --output HDMI-1 --mode 1024x768 --right-of eDP-1") (cond ((string= system-name "Marpa") "bindsym $mod+Ctrl+p xrandr --output HDMI-1 --mode 1024x768 --right-of eDP-1")
((string= system-name "gampo") "bindsym $mod+Ctrl+p xrandr --output VGA1 --mode 1024x768 --right-of LVDS1")) ((string= system-name "gampo") "bindsym $mod+Ctrl+p xrandr --output VGA1 --mode 1024x768 --right-of LVDS1"))
#+END_SRC #+END_SRC
Now, we just have to call this Emacs Lisp code as a noweb reference and Now, we just have to call this Emacs Lisp code as a noweb reference and execute it.
execute it.
#+BEGIN_SRC conf :noweb yes #+BEGIN_SRC conf :noweb yes
<<hostname-screen-management()>> <<hostname-screen-management()>>
#+END_SRC #+END_SRC
@ -862,8 +753,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Software_autolaunch-ccee82f6 :CUSTOM_ID: Software_autolaunch-ccee82f6
:END: :END:
When i3 is launched, I want it to also launch some software automatically. When i3 is launched, I want it to also launch some software automatically. Here is what we will launch:
Here is what we will launch:
#+NAME: autolaunch #+NAME: autolaunch
| always execute it? | command | what it is | | always execute it? | command | what it is |
|--------------------+-------------------------------------------+----------------------------------------| |--------------------+-------------------------------------------+----------------------------------------|
@ -908,9 +798,7 @@
exec --no-startup-id numlockx on exec --no-startup-id numlockx on
#+end_example #+end_example
My travel laptop has a fingerprint reader which can be used as an My travel laptop has a fingerprint reader which can be used as an authentification method when the root password is asked. Lets launch our policy kit manager if that is the case:
authentification method when the root password is asked. Lets launch our
policy kit manager if that is the case:
#+NAME: fingerprint-thinkpad #+NAME: fingerprint-thinkpad
#+BEGIN_SRC emacs-lisp #+BEGIN_SRC emacs-lisp
(if (string= system-name "gampo") (if (string= system-name "gampo")

View File

@ -9,12 +9,9 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Presentation-981f2f04 :CUSTOM_ID: Presentation-981f2f04
:END: :END:
This is my collection of dotfiles for my daily GNU/Linux environment, tweaked This is my collection of dotfiles for my daily GNU/Linux environment, tweaked to my liking. If you wish to get the same setup as mine, follow the instructions below.
to my liking. If you wish to get the same setup as mine, follow the
instructions below.
For starters, here is the link to all the pages on my website that you might For starters, here is the link to all the pages on my website that you might find interesting. Ill describe them in more details below.
find interesting. Ill describe them in more details below.
- [[file:installation.org][Arch Linux bootstrap script]] - [[file:installation.org][Arch Linux bootstrap script]]
- [[file:awesome.org][AwesomeWM configuration]] - [[file:awesome.org][AwesomeWM configuration]]
- [[file:bin.org][Custom scripts]] - [[file:bin.org][Custom scripts]]
@ -29,25 +26,16 @@
- [[file:rustfmt.org][Rustfmt configuration]] - [[file:rustfmt.org][Rustfmt configuration]]
- [[file:tmux.org][Tmux configuration]] - [[file:tmux.org][Tmux configuration]]
As you can see, I personally use [[https://fishshell.com/][fish]] as my shell of choice, and [[https://www.gnu.org/software/emacs/][Emacs]] 28.0 As you can see, I personally use [[https://fishshell.com/][fish]] as my shell of choice, and [[https://www.gnu.org/software/emacs/][Emacs]] 28.0 (using the ~native-comp~ branch) using [[http://spacemacs.org][Spacemacs]] (still with Emacs keybinding in Insert mode but with Evil in Normal mode) as my main text editor.
(using the ~native-comp~ branch) using [[http://spacemacs.org][Spacemacs]] (still with Emacs keybinding
in Insert mode but with Evil in Normal mode) as my main text editor.
When it comes to my graphical UI, I do not have any desktop environment. When it comes to my graphical UI, I do not have any desktop environment. Instead, I have a tiling window manager, AwesomeWM. The historical first on my configuration is [[https://github.com/Airblader/i3][i3-gaps]], an [[https://i3wm.org/][i3]] fork by [[https://github.com/Airblader/i3][Airblader]] with which I use two bars generated by [[https://polybar.github.io/][Polybar]]. It used [[https://github.com/dylanaraps/pywal][pywal]] to define their color scheme, as well as [[https://github.com/davatorium/rofi][rofi]]s color scheme. My other TWM and the one I currently use is [[https://awesomewm.org/][AwesomeWM]].
Instead, I have a tiling window manager, AwesomeWM. The historical first on my
configuration is [[https://github.com/Airblader/i3][i3-gaps]], an [[https://i3wm.org/][i3]] fork by [[https://github.com/Airblader/i3][Airblader]] with which I use two bars
generated by [[https://polybar.github.io/][Polybar]]. It used [[https://github.com/dylanaraps/pywal][pywal]] to define their color scheme, as well as
[[https://github.com/davatorium/rofi][rofi]]s color scheme. My other TWM and the one I currently use is [[https://awesomewm.org/][AwesomeWM]].
Finally, you can find my configuration for my ErgodoxEZ keyboard [[https://configure.ergodox-ez.com/ergodox-ez/layouts/5WrVw/latest/0][here]]. It is Finally, you can find my configuration for my ErgodoxEZ keyboard [[https://configure.ergodox-ez.com/ergodox-ez/layouts/5WrVw/latest/0][here]]. It is optimized for usage with the Bépo layout set as a software layout, and for shortcuts from i3.
optimized for usage with the Bépo layout set as a software layout, and for
shortcuts from i3.
* Screenshots * Screenshots
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Screenshots-51f1cef3 :CUSTOM_ID: Screenshots-51f1cef3
:END: :END:
#+CAPTION: Desktop with Neofetch in the terminal #+CAPTION: Desktop with Neofetch in the terminal
[[./img/neofetch.png.webp]] [[./img/neofetch.png.webp]]
@ -63,15 +51,9 @@
:END: :END:
- Emacs configuration perfectly tailored for my own use - Emacs configuration perfectly tailored for my own use
- Beautiful and comfy i3 and polybar configuration - Beautiful and comfy i3 and polybar configuration
- And enough information below to get basically the same distro install as I - And enough information below to get basically the same distro install as I have on my main computer and my travel laptop.
have on my main computer and my travel laptop.
Most of the org files you will find in this repos are the actual source code Most of the org files you will find in this repos are the actual source code of much of my config files. For instance, the bootstrap found in [[file:installation.org][installation.org]] exports almost all of its code snippets to [[file:.config/yadm/bootstrap][.config/yadm/bootstrap]] thanks to =M-x org-babel-tangle= from within Emacs. Below I will also present and comment some of my short config files which do not deserve to have a full org file dedicated to them.
of much of my config files. For instance, the bootstrap found in
[[file:installation.org][installation.org]] exports almost all of its code snippets to
[[file:.config/yadm/bootstrap][.config/yadm/bootstrap]] thanks to =M-x org-babel-tangle= from within Emacs.
Below I will also present and comment some of my short config files which do
not deserve to have a full org file dedicated to them.
** Tiling Window Managers ** Tiling Window Managers
:PROPERTIES: :PROPERTIES:
@ -81,25 +63,19 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Tiling_Window_Managers-AwesomeWM-2eac61a9 :CUSTOM_ID: Features-Tiling_Window_Managers-AwesomeWM-2eac61a9
:END: :END:
AwesomeWM is the TWM I use the most on my computer between itself and i3. My AwesomeWM is the TWM I use the most on my computer between itself and i3. My configuration for it is documented in detail in its corresponding document, which you can find [[file:awesome.org][here]].
configuration for it is documented in detail in its corresponding document,
which you can find [[file:awesome.org][here]].
*** i3 configuration (Deprecated) *** i3 configuration (Deprecated)
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Tiling_Window_Managers-i3_configuration-9c92e43c :CUSTOM_ID: Features-Tiling_Window_Managers-i3_configuration-9c92e43c
:END: :END:
The i3 configuration is detailed in its corresponding README which you can The i3 configuration is detailed in its corresponding README which you can find [[file:i3.org][here]]. Be aware I do not use i3 anymore, and I will not update it until I may someday use it again. This was deprecated on August 22nd, 2020.
find [[file:i3.org][here]]. Be aware I do not use i3 anymore, and I will not update it until
I may someday use it again. This was deprecated on August 22nd, 2020.
** Polybar config (Deprecated) ** Polybar config (Deprecated)
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Polybar_config_(Deprecated)-c8f95774 :CUSTOM_ID: Features-Polybar_config_(Deprecated)-c8f95774
:END: :END:
My annotated polybar config can be found [[file:polybar.org][here]], if you wish to use it. Be My annotated polybar config can be found [[file:polybar.org][here]], if you wish to use it. Be aware I do not use polybar anymore, and I will not update it until I may someday use it again. This was deprecated on August 22nd, 2020.
aware I do not use polybar anymore, and I will not update it until I may
someday use it again. This was deprecated on August 22nd, 2020.
** Graphical tweaks ** Graphical tweaks
:PROPERTIES: :PROPERTIES:
@ -118,10 +94,7 @@
:HEADER-ARGS: :mkdirp yes :tangle ~/.gtkrc-2.0 :HEADER-ARGS: :mkdirp yes :tangle ~/.gtkrc-2.0
:CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK2-General_configuration-eb1f1f3c :CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK2-General_configuration-eb1f1f3c
:END: :END:
This file is tangled at ~$HOME/.gtkrc-2.0~. This is an equivalent for the This file is tangled at ~$HOME/.gtkrc-2.0~. This is an equivalent for the GTK3 configuration file you will see below, and it shares most of its settings. First, lets select the Nordic theme for GTK2. Lets also set the icon theme.
GTK3 configuration file you will see below, and it shares most of its
settings. First, lets select the Nordic theme for GTK2. Lets also set
the icon theme.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
# -*- mode: unix-config -*- # -*- mode: unix-config -*-
gtk-theme-name="Nordic" gtk-theme-name="Nordic"
@ -151,14 +124,12 @@
[Filechooser Settings] [Filechooser Settings]
#+END_SRC #+END_SRC
The first option alows me to open the file chooser in the current working The first option alows me to open the file chooser in the current working directory:
directory:
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
StartupMode=cwd StartupMode=cwd
#+END_SRC #+END_SRC
Next, setting the location mode to ~path-bar~ will show the path as buttons Next, setting the location mode to ~path-bar~ will show the path as buttons that can be clicked rather than the full path.
that can be clicked rather than the full path.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
LocationMode=path-bar LocationMode=path-bar
#+END_SRC #+END_SRC
@ -173,8 +144,7 @@
ShowSizeColumn=true ShowSizeColumn=true
#+END_SRC #+END_SRC
Now, lets choose the geometry of our file picker. These two first lines Now, lets choose the geometry of our file picker. These two first lines set where the file picker appears:
set where the file picker appears:
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
GeometryX=566 GeometryX=566
GeometryY=202 GeometryY=202
@ -186,8 +156,7 @@
GeometryHeight=400 GeometryHeight=400
#+END_SRC #+END_SRC
With these two lines, we set how our files are sorted: by name, and in the With these two lines, we set how our files are sorted: by name, and in the ascending order.
ascending order.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
SortColumn=name SortColumn=name
SortOrder=ascending SortOrder=ascending
@ -198,8 +167,7 @@
ViewMode=list-view ViewMode=list-view
#+END_SRC #+END_SRC
And finally, setting our icon view scale to ~-1~ sets the icon view to the And finally, setting our icon view scale to ~-1~ sets the icon view to the max size.
max size.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
IconViewScale=-1 IconViewScale=-1
#+END_SRC #+END_SRC
@ -209,15 +177,12 @@
:HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-3.0/settings.ini :HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-3.0/settings.ini
:CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK3-3d6cba86 :CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK3-3d6cba86
:END: :END:
The following file helps me choosing the aspect of various GTK+ 3 software, The following file helps me choosing the aspect of various GTK+ 3 software, including their theme and icons. First, lets declare the header:
including their theme and icons. First, lets declare the header:
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
[Settings] [Settings]
#+END_SRC #+END_SRC
Now, lets hint to GTK that I prefer dark themes. This can have an Now, lets hint to GTK that I prefer dark themes. This can have an influence also on some websites that can detect this preference and therefore set their own theme to dark by themselves.
influence also on some websites that can detect this preference and
therefore set their own theme to dark by themselves.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
gtk-application-prefer-dark-theme = true gtk-application-prefer-dark-theme = true
#+END_SRC #+END_SRC
@ -246,8 +211,7 @@
# gtk-xft-rgba=rgb # gtk-xft-rgba=rgb
#+END_SRC #+END_SRC
Since window decorations are handled by my WMs, I will leave this variable Since window decorations are handled by my WMs, I will leave this variable empty.
empty.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
gtk-decoration-layout= gtk-decoration-layout=
#+END_SRC #+END_SRC
@ -256,28 +220,24 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Graphical_tweaks-Picom-b5b9a4dd :CUSTOM_ID: Features-Graphical_tweaks-Picom-b5b9a4dd
:END: :END:
Picom is a standalone compositor for Xorg, and the successor to Compton, Picom is a standalone compositor for Xorg, and the successor to Compton, itself successor to xcompmgr-dana, itself a fork of xcompmgr. You can find my Picom configuration [[file:picom.org][here]].
itself successor to xcompmgr-dana, itself a fork of xcompmgr. You can find
my Picom configuration [[file:picom.org][here]].
*** Xresources *** Xresources
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS: :mkdirp yes :tangle ~/.Xresources :exports code :HEADER-ARGS: :mkdirp yes :tangle ~/.Xresources :exports code
:CUSTOM_ID: Features-Graphical_tweaks-Xresources-8b622de1 :CUSTOM_ID: Features-Graphical_tweaks-Xresources-8b622de1
:END: :END:
My Xresources file is very short. Indeed, it only contains two lines which My Xresources file is very short. Indeed, it only contains two lines which are dedicated to my =st= terminal to set its font and shell. The font is set as follows.
are dedicated to my =st= terminal to set its font and shell. The font is set
as follows.
#+BEGIN_SRC conf #+BEGIN_SRC conf
st.font: Fantasque Sans Mono:size=10:antialias=true st.font: Fantasque Sans Mono:size=10:antialias=true
#+END_SRC #+END_SRC
I can also set the transparency of st (my terminal emulator) like so: I can also set the transparency of st (my terminal emulator) like so:
#+BEGIN_SRC conf #+BEGIN_SRC conf
st.alpha: 0.85 st.alpha: 0.85
#+END_SRC #+END_SRC
Next is the declaration of my color theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, Next is the declaration of my color theme. It is based on the [[https://www.nordtheme.com/][Nord]] theme, from their [[https://github.com/arcticicestudio/nord-xresources/][Git repository]].
from their [[https://github.com/arcticicestudio/nord-xresources/][Git repository]].
#+BEGIN_SRC conf #+BEGIN_SRC conf
#define nord0 #2E3440 #define nord0 #2E3440
#define nord1 #3B4252 #define nord1 #3B4252
@ -328,23 +288,18 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Text_and_source_code_editing-Emacs_configuration-ef937102 :CUSTOM_ID: Features-Text_and_source_code_editing-Emacs_configuration-ef937102
:END: :END:
Emacs is my main text editor, which I use for almost everything. Because, Emacs is my main text editor, which I use for almost everything. Because, you know…
you know…
#+begin_quote #+begin_quote
Emacs is a great operating system, it just lacks a good text editor. Emacs is a great operating system, it just lacks a good text editor.
#+end_quote #+end_quote
You can find my Emacs config, based on Spacemacs, in my [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/.spacemacs][.spacemacs]] file, and You can find my Emacs config, based on Spacemacs, in my [[https://labs.phundrak.com/phundrak/dotfiles/src/branch/master/.spacemacs][.spacemacs]] file, and my user configuration in my [[file:emacs.org][emacs.org]] file.
my user configuration in my [[file:emacs.org][emacs.org]] file.
*** Nano (deprecated) *** Nano (deprecated)
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Text_and_source_code_editing-Nano-a9d4839f :CUSTOM_ID: Features-Text_and_source_code_editing-Nano-a9d4839f
:END: :END:
Although it is a very simple piece of software, nano does offer some Although it is a very simple piece of software, nano does offer some customization. Mine can be found in my [[file:~/org/config-website/nano.org][nano.org]] file. Be aware I do not use nano anymore, and I will not update it until I may someday use it again. This was deprecated on August 28th, 2020.
customization. Mine can be found in my [[file:~/org/config-website/nano.org][nano.org]] file. Be aware I do not use
nano anymore, and I will not update it until I may someday use it again.
This was deprecated on August 28th, 2020.
*** Rustfmt *** Rustfmt
:PROPERTIES: :PROPERTIES:
@ -356,19 +311,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Custom_scripts_in_=PATH=-043e8c8e :CUSTOM_ID: Features-Custom_scripts_in_=PATH=-043e8c8e
:END: :END:
I have written some scripts that help me daily accomplish some simple tasks, I have written some scripts that help me daily accomplish some simple tasks, like mounting and unmounting a drive or Android device, an emoji picker, a utility to set up my Wacom tablet, and so on. You can find them stored in my [[file:bin.org][bin.org]] file along with their detailed explanation in the README placed in the same folder —which is actually their source code once the org-mode file gets tangled.
like mounting and unmounting a drive or Android device, an emoji picker, a
utility to set up my Wacom tablet, and so on. You can find them stored in my
[[file:bin.org][bin.org]] file along with their detailed explanation in the README placed in
the same folder —which is actually their source code once the org-mode file
gets tangled.
** Fish configuration with useful abbreviations ** Fish configuration with useful abbreviations
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Fish_configuration_with_useful_abbreviations-c71ffba0 :CUSTOM_ID: Features-Fish_configuration_with_useful_abbreviations-c71ffba0
:END: :END:
You can also find in my Fish shell configuration in my [[file:~/org/config-website/fish.org][fish.org]] file, which You can also find in my Fish shell configuration in my [[file:~/org/config-website/fish.org][fish.org]] file, which contains my usual abbreviations.
contains my usual abbreviations.
** And some minor configuration files ** And some minor configuration files
:PROPERTIES: :PROPERTIES:
@ -394,16 +343,12 @@
:HEADER-ARGS: :mkdirp yes :tangle ~/.gitignore_global :HEADER-ARGS: :mkdirp yes :tangle ~/.gitignore_global
:CUSTOM_ID: Features-And_some_minor_configuration_files-Global_gitignore-42467108 :CUSTOM_ID: Features-And_some_minor_configuration_files-Global_gitignore-42467108
:END: :END:
Sometimes, there are some lines that always reappear in gitignores. So, Sometimes, there are some lines that always reappear in gitignores. So, instead of always adding them, let git now that some elements are to be ignored by default, hence the [[file:.gitignore_global][~/.gitignore_global]] file. First, we dont want nanos backup files.
instead of always adding them, let git now that some elements are to be
ignored by default, hence the [[file:.gitignore_global][~/.gitignore_global]] file. First, we dont want
nanos backup files.
#+BEGIN_SRC text #+BEGIN_SRC text
~* ~*
#+END_SRC #+END_SRC
And object files and output binaries generated by =gcc= and the likes arent And object files and output binaries generated by =gcc= and the likes arent welcome either.
welcome either.
#+BEGIN_SRC text #+BEGIN_SRC text
,*.out ,*.out
,*.o ,*.o
@ -413,24 +358,19 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Features-Tmux_configuration-ce76e030 :CUSTOM_ID: Features-Tmux_configuration-ce76e030
:END: :END:
You can find my tmux configuration in [[file:tmux.org][tmux.org]]. It depends on the submodule You can find my tmux configuration in [[file:tmux.org][tmux.org]]. It depends on the submodule [[https://github.com/gpakosz/.tmux.git][.tmux]] by [[https://pempek.net/][Gregory Pakosz]].
[[https://github.com/gpakosz/.tmux.git][.tmux]] by [[https://pempek.net/][Gregory Pakosz]].
* Dependencies * Dependencies
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Dependencies-ef5057dd :CUSTOM_ID: Dependencies-ef5057dd
:END: :END:
Of course, some dependencies are needed for my dotfiles to work well. Here is Of course, some dependencies are needed for my dotfiles to work well. Here is a non-exhaustive list of software needed by these configuration files:
a non-exhaustive list of software needed by these configuration files:
- [[https://www.gnu.org/software/emacs/][GNU/Emacs]] >= 26.2 - [[https://www.gnu.org/software/emacs/][GNU/Emacs]] >= 26.2
- [[http://spacemacs.org][Spacemacs]] (develop branch) - [[http://spacemacs.org][Spacemacs]] (develop branch)
- My [[https://labs.phundrak.com/phundrak/conlang-layer][conlanging layer]] - My [[https://labs.phundrak.com/phundrak/conlang-layer][conlanging layer]]
- [[https://github.com/venmos/w3m-layer][Venmos]] [[https://github.com/venmos/w3m-layer][w3m layer]] - [[https://github.com/venmos/w3m-layer][Venmos]] [[https://github.com/venmos/w3m-layer][w3m layer]]
- The [[https://fishshell.com/][Fish shell]], using [[https://github.com/jorgebucaran/fisher][fisher]] - The [[https://fishshell.com/][Fish shell]], using [[https://github.com/jorgebucaran/fisher][fisher]]
- [[https://lukesmith.xyz/][Luke Smith]]s [[https://github.com/LukeSmithxyz/st][fork]] of [[https://st.suckless.org/][st]] - [[https://lukesmith.xyz/][Luke Smith]]s [[https://github.com/LukeSmithxyz/st][fork]] of [[https://st.suckless.org/][st]]
- [[https://resloved.info/][Resloved]]s [[https://github.com/resloved/i3][i3-gaps-rounded]] fork of [[https://github.com/Airblader/i3][Airblader]]s [[https://github.com/Airblader/i3][i3-gaps]], itself a fork of [[https://i3wm.org/][i3]]
- [[https://github.com/yshui/compton][Compton]], more specificaly [[https://github.com/tryone144/compton][Tryone]]s [[https://github.com/tryone144/compton][fork]]
- [[https://github.com/dylanaraps/pywal/][pywal]]
- [[https://tools.suckless.org/dmenu/][dmenu]] - [[https://tools.suckless.org/dmenu/][dmenu]]
- [[https://github.com/enkore/j4-dmenu-desktop][j4-dmenu-desktop]] - [[https://github.com/enkore/j4-dmenu-desktop][j4-dmenu-desktop]]
- [[https://github.com/davatorium/rofi][Rofi]] - [[https://github.com/davatorium/rofi][Rofi]]
@ -447,17 +387,10 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Installation-9ec2ae86 :CUSTOM_ID: Installation-9ec2ae86
:END: :END:
For an installation walkthrough of my Arch Linux installation, check out my For an installation walkthrough of my Arch Linux installation, check out my [[file:installation.org][installation.org]] file where I walk you through the first manual steps and through the bootstrap you can execute to automatically take care of a lot of elements.
[[file:installation.org][installation.org]] file where I walk you through the first manual steps and
through the bootstrap you can execute to automatically take care of a lot of
elements.
* Licence * Licence
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Licence-48911096 :CUSTOM_ID: Licence-48911096
:END: :END:
All of my dotfiles (and my dotfiles only) are available under the GNU GPLv3 All of my dotfiles (and my dotfiles only) are available under the GNU GPLv3 Licence. Please consult [[file:LICENCE.md]] for more information. In short: you are free to access, edit and redistribute all of my dotfiles under the same licence and as allowed by the licence, and if you fuck up something, its your own responsibility.
Licence. Please consult [[file:LICENCE.md]] for more information. In short: you
are free to access, edit and redistribute all of my dotfiles under the same
licence and as allowed by the licence, and if you fuck up something, its your
own responsibility.

View File

@ -13,33 +13,17 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Introduction-cd5792cd :CUSTOM_ID: Introduction-cd5792cd
:END: :END:
Here will be presented what I do to get my system up and running on a fresh Here will be presented what I do to get my system up and running on a fresh Arch Linux install. These installation instructions were written in order to get an Arch Linux distribution up and running with the same configuration as my main computers and my travelling laptops configuration.
Arch Linux install. These installation instructions were written in order to
get an Arch Linux distribution up and running with the same configuration as
my main computers and my travelling laptops configuration.
* Install Arch Linux * Install Arch Linux
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Install_Arch_Linux-ac7ad3b2 :CUSTOM_ID: Install_Arch_Linux-ac7ad3b2
:END: :END:
I usually install Arch from the [[https://www.archlinux.org/download/][vanilla ISO]], however I began using [[https://github.com/MatMoul/archfi][archfi]] to I usually install Arch from the [[https://www.archlinux.org/download/][vanilla ISO]], however I began using [[https://github.com/MatMoul/archfi][archfi]] to install easily the distro (Ive done it so many times, I know how it works now). Usually, my distros will be installed on two partitions: ~/home~ and ~/~ (root).
install easily the distro (Ive done it so many times, I know how it works
now). Usually, my distros will be installed on two partitions: ~/home~ and ~/~
(root).
If the computer supports EFI bootloaders, the EFI partition will be mounted on If the computer supports EFI bootloaders, the EFI partition will be mounted on ~/boot/efi~. I generally use ~systemd-boot~ as my boot manager, but if you are more comfortable with another one, just install what you want. Be aware that if you format your ~/boot~ partition, you will delete all boot managers that already exist; so, if you are dual-booting, *DO NOT FORMAT IT*. Yes, I made the mistake of wiping the Windows boot manager when I used to dual-boot.
~/boot/efi~. I generally use ~systemd-boot~ as my boot manager, but if you are
more comfortable with another one, just install what you want. Be aware that
if you format your ~/boot~ partition, you will delete all boot managers that
already exist; so, if you are dual-booting, *DO NOT FORMAT IT*. Yes, I made
the mistake of wiping the Windows boot manager when I used to dual-boot.
In order to use the ~suspend-then-hibernate~ systemd command, it is necessary In order to use the ~suspend-then-hibernate~ systemd command, it is necessary to have a swap partition at least twice the size of your installed RAM. That is because when this command will be run, the system will try to save the current state of your machine, stored in your RAM, to the swap filesystem. If there is not enough space, the command will fail, and you wont be able to use this command. For instance, my current computer has 32GB of RAM, hence my SWAP partition is 16GB large.
to have a swap partition at least twice the size of your installed RAM. That
is because when this command will be run, the system will try to save the
current state of your machine, stored in your RAM, to the swap filesystem. If
there is not enough space, the command will fail, and you wont be able to use
this command.
** Get the latest, fastest mirrors ** Get the latest, fastest mirrors
:PROPERTIES: :PROPERTIES:
@ -52,20 +36,13 @@
--save /etc/pacman.d/mirrorlist --verbose --save /etc/pacman.d/mirrorlist --verbose
#+END_SRC #+END_SRC
This will update the packages from your live ISO, and you will get the best This will update the packages from your live ISO, and you will get the best mirrors for your installation. Of course, change the countries accordingly to your location. In my case, I am only interested in French, German, and Belgian mirrors.
mirrors for your installation. Of course, change the countries accordingly to
your location. In my case, I am only interested in French, German, and
Belgian mirrors.
** Install the system ** Install the system
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Install_Arch_Linux-Install_the_system-3ff49aa6 :CUSTOM_ID: Install_Arch_Linux-Install_the_system-3ff49aa6
:END: :END:
Then you can use a custom script to ease your installation of Arch if you do Then you can use a custom script to ease your installation of Arch if you do not wish to do it manually. Personally, Ive done it several times already, I know how the distro works, I just want to be able to install my distro quickly now. Ill need to download the script with ~wget~, but apparently it isnt installed by default on Arch ISOs anymore, so Ill need to install it.
not wish to do it manually. Personally, Ive done it several times already, I
know how the distro works, I just want to be able to install my distro
quickly now. Ill need to download the script with ~wget~, but apparently it
isnt installed by default on Arch ISOs anymore, so Ill need to install it.
#+BEGIN_SRC sh #+BEGIN_SRC sh
pacman -S wget pacman -S wget
#+END_SRC #+END_SRC
@ -77,29 +54,21 @@
sh archfi sh archfi
#+END_SRC #+END_SRC
Then, follow the instructions and install Arch Linux. Take the opportunity to Then, follow the instructions and install Arch Linux. Take the opportunity to install as many packages as you need, mainly ~yay~ which I use as my package manager (it is just a wrapper for ~pacman~) and AUR helper, and ~pacman-contrib~ which will help us installing some packages later.
install as many packages as you need, mainly ~yay~ which I use as my package
manager (it is just a wrapper for ~pacman~) and AUR helper, and
~pacman-contrib~ which will help us installing some packages later.
Once your system is installed, reboot and remove your installation media from Once your system is installed, reboot and remove your installation media from your computer.
your computer.
* Execute bootstrap * Execute bootstrap
:PROPERTIES: :PROPERTIES:
:HEADER-ARGS:fish: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish" :exports code :mkdirp yes :HEADER-ARGS:fish: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish" :exports code :mkdirp yes
:CUSTOM_ID: Execute_bootstrap-e37054ef :CUSTOM_ID: Execute_bootstrap-e37054ef
:END: :END:
With the installation of Arch with ~archfi~, I will have [[https://github.com/Jguer/yay][yay]], an AUR helper, With the installation of Arch with ~archfi~, I will have [[https://github.com/Jguer/yay][yay]], an AUR helper, installed. This will allow me to have some basic packages installed in order to run the bootstrap described below. So, lets install ~fish~ (our shell running the script), ~git~, and my dotfiles manager ~yadm~.
installed. This will allow me to have some basic packages installed in order
to run the bootstrap described below. So, lets install ~fish~ (our shell
running the script), ~git~, and my dotfiles manager ~yadm~.
#+BEGIN_SRC sh #+BEGIN_SRC sh
yay -Sy fish git yadm yay -Sy fish git yadm
#+END_SRC #+END_SRC
~yadm~ comes with a very handy feature: its bootstrap script. It can be ~yadm~ comes with a very handy feature: its bootstrap script. It can be executed automatically once the dotfiles are cloned with yadm:
executed automatically once the dotfiles are cloned with yadm:
#+BEGIN_SRC sh #+BEGIN_SRC sh
yadm clone https://labs.phundrak.com/phundrak/dotfiles yadm clone https://labs.phundrak.com/phundrak/dotfiles
# or if labs.phundrak.com is down or too slow for you # or if labs.phundrak.com is down or too slow for you
@ -112,8 +81,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Decrypt_private_yadm_files-68af7157 :CUSTOM_ID: Execute_bootstrap-Decrypt_private_yadm_files-68af7157
:END: :END:
Some private files are stored encrypted in the repository of my yadm Some private files are stored encrypted in the repository of my yadm dotfiles. I will need them later on during the bootstrap execution.
dotfiles. I will need them later on during the bootstrap execution.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test "$USER" = 'phundrak' if test "$USER" = 'phundrak'
yadm decrypt yadm decrypt
@ -126,11 +94,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Get_a_correct_keyboard_layout-77d24b30 :CUSTOM_ID: Execute_bootstrap-Get_a_correct_keyboard_layout-77d24b30
:END: :END:
I use mainly the [[https://bepo.fr/wiki/Accueil][bépo]] layout, a French keyboard layout inspired by Dvorak I use mainly the [[https://bepo.fr/wiki/Accueil][bépo]] layout, a French keyboard layout inspired by Dvorak layouts, however I sometimes need to switch back to the standard French AZERTY or the American QWERTY layout, so I make it so the Menu key switches for me my layout between these three. This makes it so my xorg configuration of my keyboard looks like this:
layouts, however I sometimes need to switch back to the standard French
AZERTY or the American QWERTY layout, so I make it so the Menu key switches
for me my layout between these three. This makes it so my xorg configuration
of my keyboard looks like this:
#+BEGIN_SRC fish #+BEGIN_SRC fish
set keyboardconf \ set keyboardconf \
'Section "InputClass" 'Section "InputClass"
@ -143,8 +107,7 @@
EndSection' EndSection'
#+END_SRC #+END_SRC
So, lets ask the user if they want to set it as their keyboard So, lets ask the user if they want to set it as their keyboard configuration.
configuration.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Set keyboard layout #########################################################\n\n" printf "\n# Set keyboard layout #########################################################\n\n"
whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55 whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55
@ -157,8 +120,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_our_locale-e74d772a :CUSTOM_ID: Execute_bootstrap-Set_our_locale-e74d772a
:END: :END:
I use two main locales, the French and US UTF-8 locales, and I like to keep I use two main locales, the French and US UTF-8 locales, and I like to keep the Japanese locale activated just in case.
the Japanese locale activated just in case.
#+BEGIN_SRC fish #+BEGIN_SRC fish
set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8" set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8"
#+END_SRC #+END_SRC
@ -208,8 +170,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Create_some_folders-bf701387 :CUSTOM_ID: Execute_bootstrap-Create_some_folders-bf701387
:END: :END:
Lets create some folders we might need for mounting our drives, Android Lets create some folders we might need for mounting our drives, Android devices and CDs.
devices and CDs.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Create directories for mounting #############################################\n\n" printf "\n# Create directories for mounting #############################################\n\n"
sudo mkdir -p /mnt/{USB,CD,Android} sudo mkdir -p /mnt/{USB,CD,Android}
@ -270,8 +231,7 @@
zeal zeal
#+END_SRC #+END_SRC
These are the minimum I would have in my own installation. You can edit it These are the minimum I would have in my own installation. You can edit it however you want. Lets install those.
however you want. Lets install those.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Installing needed packages ##################################################\n\n" printf "\n# Installing needed packages ##################################################\n\n"
sudo pacman -Syu sudo pacman -Syu
@ -284,9 +244,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Tangle_configuration_files_from_Org_files-cc524361 :CUSTOM_ID: Execute_bootstrap-Tangle_configuration_files_from_Org_files-cc524361
:END: :END:
Before tangling our configuration files, we need to create some directories Before tangling our configuration files, we need to create some directories first so our files can be properly tangled. Heres the list of directories we need to create:
first so our files can be properly tangled. Heres the list of directories we
need to create:
#+NAME: dirs-tangled-files #+NAME: dirs-tangled-files
| $HOME/.config/awesome | | $HOME/.config/awesome |
| $HOME/.config/awesome/theme | | $HOME/.config/awesome/theme |
@ -329,8 +287,7 @@
<<gen-dirs-tangle()>> <<gen-dirs-tangle()>>
#+END_SRC #+END_SRC
The next step is to tangle all the Org files. Here is the list of files that The next step is to tangle all the Org files. Here is the list of files that are to be tangled:
are to be tangled:
#+NAME: tangled-files #+NAME: tangled-files
| filename | | filename |
|-------------| |-------------|
@ -406,13 +363,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Setting_up_Emacs:_Installing_Spacemacs-0b3d44b2 :CUSTOM_ID: Execute_bootstrap-Setting_up_Emacs:_Installing_Spacemacs-0b3d44b2
:END: :END:
Now, the first thing we want to do with Emacs is install its Spacemacs Now, the first thing we want to do with Emacs is install its Spacemacs distribution. Well clone its =develop= branch into =~/.config/emacs=. We need to do this prior to our dotfiles cloning because of some submodules that are cloned within our =~/.config/emacs= directory, and git wont let us clone Spacemacs in an already existing and non-empty directory. To make sure it isnt one, lets delete any potentially existing =~/.config/emacs= directory:
distribution. Well clone its =develop= branch into =~/.config/emacs=. We
need to do this prior to our dotfiles cloning because of some submodules
that are cloned within our =~/.config/emacs= directory, and git wont let us
clone Spacemacs in an already existing and non-empty directory. To make sure
it isnt one, lets delete any potentially existing =~/.config/emacs=
directory:
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Installing Spacemacs ########################################################\n\n" printf "\n# Installing Spacemacs ########################################################\n\n"
rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs
@ -423,8 +374,7 @@
git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs
#+END_SRC #+END_SRC
And we can restore what might have been deleted in our =~/.emacs.d/private= And we can restore what might have been deleted in our =~/.emacs.d/private= directory:
directory:
#+BEGIN_SRC fish #+BEGIN_SRC fish
yadm checkout -- ~/.config/emacs/private/ yadm checkout -- ~/.config/emacs/private/
#+END_SRC #+END_SRC
@ -437,14 +387,12 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_dotfiles_remotes-5a0fe6f7 :CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_dotfiles_remotes-5a0fe6f7
:END: :END:
This line in the bootstrap script will test if the current user is using my This line in the bootstrap script will test if the current user is using my username. If yes, its probably me.
username. If yes, its probably me.
#+BEGIN_SRC fish #+BEGIN_SRC fish
if test "$USER" = 'phundrak' if test "$USER" = 'phundrak'
#+END_SRC #+END_SRC
If it is me installing and using these dotfiles, I want the remotes of my If it is me installing and using these dotfiles, I want the remotes of my dotfiles to be set to ssh remotes using my ssh keys.
dotfiles to be set to ssh remotes using my ssh keys.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Update yadms remotes #######################################################\n\n" printf "\n# Update yadms remotes #######################################################\n\n"
yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git
@ -466,8 +414,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_submodules-3e921579 :CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_submodules-3e921579
:END: :END:
Now we can download the various dependencies of our dotfiles. To do so, Now we can download the various dependencies of our dotfiles. To do so, lets run the following command:
lets run the following command:
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Getting yadm susbmodules ####################################################\n\n" printf "\n# Getting yadm susbmodules ####################################################\n\n"
yadm submodule update --init --recursive yadm submodule update --init --recursive
@ -477,22 +424,19 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-3d38d98e :CUSTOM_ID: Execute_bootstrap-Enable_some_services-3d38d98e
:END: :END:
We have installed some packages which require some services to run. Lets We have installed some packages which require some services to run. Lets enable them.
enable them.
*** Systemd-timesyncd *** Systemd-timesyncd
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Systemd-timesyncd-d887e45b :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Systemd-timesyncd-d887e45b
:END: :END:
This service enables time syncing with the NTP protocol, so I can be sure my This service enables time syncing with the NTP protocol, so I can be sure my computers time is correct. The service first needs to be enabled:
computers time is correct. The service first needs to be enabled:
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Enabling timesync ###########################################################\n\n" printf "\n# Enabling timesync ###########################################################\n\n"
sudo systemctl enable --now systemd-timesyncd sudo systemctl enable --now systemd-timesyncd
#+END_SRC #+END_SRC
Now, let systemd know I want to use the NTP protocol to keep my computers Now, let systemd know I want to use the NTP protocol to keep my computers time synced.
time synced.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo timedatectl set-ntp true sudo timedatectl set-ntp true
#+END_SRC #+END_SRC
@ -501,14 +445,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Docker-305e8309 :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Docker-305e8309
:END: :END:
First, lets activate Docker. First, lets activate Docker on startup.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Enabling and starting Docker ################################################\n\n" printf "\n# Enabling and starting Docker ################################################\n\n"
sudo systemctl enable --now docker sudo systemctl enable --now docker
#+END_SRC #+END_SRC
Now, if we wish it, we can be added to the =docker= group so we wont have Now, if we wish it, we can be added to the =docker= group so we wont have to type =sudo= each time we call Docker or Docker Compose.
to type =sudo= each time we call Docker or Docker Compose.
#+BEGIN_SRC fish #+BEGIN_SRC fish
read --prompt "echo 'Do you wish to be added to the `docker` group? (Y/n): ' " -l adddockergroup read --prompt "echo 'Do you wish to be added to the `docker` group? (Y/n): ' " -l adddockergroup
if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergroup = '' if test $adddockergroup = 'y' || test $adddockergroup = "Y" || test $adddockergroup = ''
@ -520,11 +463,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Emacs-c7785c21 :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Emacs-c7785c21
:END: :END:
Emacs will run as a user service, which means it wont be launched until we Emacs will run as a user service, which means it wont be launched until we log in. However, the service wont be started immediately, I personally prefer to start a standalone instance in which installing and compiling the Emacs packages will happen, and then once that is done I will start the service.
log in. However, the service wont be started immediately, I personally
prefer to start a standalone instance in which installing and compiling the
Emacs packages will happen, and then once that is done I will start the
service.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Enabling Emacs as user service ##############################################\n\n" printf "\n# Enabling Emacs as user service ##############################################\n\n"
systemctl --user enable emacs systemctl --user enable emacs
@ -534,8 +473,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Mpd-f0f5b9b7 :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Mpd-f0f5b9b7
:END: :END:
Mpd will also use as a user service in order to get rid of some lines of Mpd will also use as a user service in order to get rid of some lines of code in my configuration.
code in my configuration.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Enabling Mpd as a user service ##############################################\n\n" printf "\n# Enabling Mpd as a user service ##############################################\n\n"
mkdir -p ~/.config/mpd/playlists mkdir -p ~/.config/mpd/playlists
@ -546,8 +484,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-SSH_server-204f5997 :CUSTOM_ID: Execute_bootstrap-Enable_some_services-SSH_server-204f5997
:END: :END:
Maybe we want to activate an SSH server on our machine. If so, we can enable Maybe we want to activate an SSH server on our machine. If so, we can enable it. Lets ask the question.
it. Lets ask the question.
#+BEGIN_SRC fish #+BEGIN_SRC fish
whiptail --yesno 'Do you want to activate the ssh server?' 8 50 whiptail --yesno 'Do you want to activate the ssh server?' 8 50
if test $status -eq 0 if test $status -eq 0
@ -560,9 +497,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Ly-f4b161c0 :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Ly-f4b161c0
:END: :END:
Ly is a display manager based on ncurses which I find nice enough for me to Ly is a display manager based on ncurses which I find nice enough for me to use (I generally dont like using display managers). Lets enable it, and lets disable tty2 while were at it (Ly uses it to run X).
use (I generally dont like using display managers). Lets enable it, and
lets disable tty2 while were at it (Ly uses it to run X).
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo systemctl disable getty@tty2 sudo systemctl disable getty@tty2
sudo systemctl enable --now ly sudo systemctl enable --now ly
@ -572,10 +507,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-Acpilight-39152794 :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Acpilight-39152794
:END: :END:
~acpilight~ is our utility managing the brightness of our screen. There is ~acpilight~ is our utility managing the brightness of our screen. There is actually no service to enable here, but we must ensure the user is part of the ~video~ group so we can modify the brightness of our screen without using ~sudo~.
actually no service to enable here, but we must ensure the user is part of
the ~video~ group so we can modify the brightness of our screen without
using ~sudo~.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo usermod -aG video $USER sudo usermod -aG video $USER
#+END_SRC #+END_SRC
@ -584,20 +516,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Enable_some_services-NordVPN-75c1bd88 :CUSTOM_ID: Execute_bootstrap-Enable_some_services-NordVPN-75c1bd88
:END: :END:
Thanks to the AUR package ~nordvpn-bin~, I no longer have to manually Thanks to the AUR package ~nordvpn-bin~, I no longer have to manually maintain my VPN connections with OpenVPN. However, it requires a service that we should activate:
maintain my VPN connections with OpenVPN. However, it requires a service
that we should activate:
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo systemctl enable --now nordvpnd sudo systemctl enable --now nordvpnd
#+END_SRC #+END_SRC
Lets also set its default protocol to UDP. This will allow me to use any Lets also set its default protocol to UDP. This will allow me to use any port while connected to any WiFi as long as the 443 port is available. Because yes, I do connect to a WiFi that blocks some important ports, such as the IMAP and SMTP ports. Thanks University of Paris 8 for being SO paranoid.
port while connected to any WiFi as long as the 443 port is available.
Because yes, I do connect to a WiFi that blocks some important ports, such
as the IMAP and SMTP ports. Thanks University of Paris 8 for being SO
paranoid.
#+BEGIN_SRC fish #+BEGIN_SRC fish
nordvpn s protocol udp nordvpn s protocol tcp
#+END_SRC #+END_SRC
** Symlink some system config files ** Symlink some system config files
@ -612,13 +538,11 @@
end end
#+END_SRC #+END_SRC
Lets also symlink the ~plock~ script ([[file:bin.org::#Lock-635fcb38][source here]]) to ~/usr/bin~ so Lets also symlink the ~plock~ script ([[file:bin.org::#Lock-635fcb38][source here]]) to ~/usr/bin~ so ~xss-lock~ can find it.
~xss-lock~ can find it.
#+BEGIN_SRC fish #+BEGIN_SRC fish
sudo ln -s (which plock) /usr/bin/plock sudo ln -s (which plock) /usr/bin/plock
#+END_SRC #+END_SRC
** Install packages from git ** Install packages from git
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-7c6a6ea4 :CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-7c6a6ea4
@ -632,8 +556,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-Reveal.JS-bb4da0bf :CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-Reveal.JS-bb4da0bf
:END: :END:
I sometimes use Reveal.JS to make presentations, and I set its location in I sometimes use Reveal.JS to make presentations, and I set its location in my [[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so lets clone it there.
my [[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so lets clone it there.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Install Reveal.JS ###########################################################\n\n" printf "\n# Install Reveal.JS ###########################################################\n\n"
cd ~/fromGIT cd ~/fromGIT
@ -648,17 +571,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_the_toolchains-3480764a :CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_the_toolchains-3480764a
:END: :END:
When using Rust, I bounce between two toolchains, the ~stable~ toolchain and When using Rust, I bounce between two toolchains, the ~stable~ toolchain and the ~nightly~ toolchain, although I try to stick with Rust Stable. To install them, I will use ~rustup~ which has already been installed previously.
the ~nightly~ toolchain, although I try to stick with Rust Stable. To
install them, I will use ~rustup~ which has already been installed
previously.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n" printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n"
rustup default stable rustup default stable
#+END_SRC #+END_SRC
This will both download the stable toolchain and set it as the default one. This will both download the stable toolchain and set it as the default one. Now to install the nightly toolchain, lets run this:
Now to install the nightly toolchain, lets run this:
#+BEGIN_SRC fish #+BEGIN_SRC fish
rustup toolchain install nightly rustup toolchain install nightly
#+END_SRC #+END_SRC
@ -667,8 +586,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_some_utilities-c4a7c785 :CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_some_utilities-c4a7c785
:END: :END:
Well need some utilities when developing Rust from Emacs, namely ~rustfmt~ Well need some utilities when developing Rust from Emacs, namely ~rustfmt~ and ~racer~. Lets install them with ~cargo~.
and ~racer~. Lets install them with ~cargo~.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Add rust utilities ##########################################################\n\n" printf "\n# Add rust utilities ##########################################################\n\n"
cargo install rustfmt racer cargo install rustfmt racer
@ -703,8 +621,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Install_some_python_packages-a4447a6f :CUSTOM_ID: Execute_bootstrap-Install_some_python_packages-a4447a6f
:END: :END:
Some packages will be needed from pip in order to get our Emacs setup Some packages will be needed from pip in order to get our Emacs setup correctly working.
correctly working.
#+NAME: python-packages-table #+NAME: python-packages-table
| Package | Why | | Package | Why |
|-----------------------------+-------------------------| |-----------------------------+-------------------------|
@ -732,8 +649,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_Chicken_(Scheme_interpreter-compiler)-3c1a3c4a :CUSTOM_ID: Execute_bootstrap-Set_up_Chicken_(Scheme_interpreter-compiler)-3c1a3c4a
:END: :END:
Chicken needs to be set up before being used. First, we need to install its Chicken needs to be set up before being used. First, we need to install its documentation.
documentation.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Setting up Chicken ##########################################################\n\n" printf "\n# Setting up Chicken ##########################################################\n\n"
chicken-install -s apropos chicken-doc chicken-install -s apropos chicken-doc
@ -749,15 +665,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-f0741c22 :CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-f0741c22
:END: :END:
The last thing we want to do is to set up our fish shell with some extensions The last thing we want to do is to set up our fish shell with some extensions in order to improve the user experience.
in order to improve the user experience.
*** Install ~fisher~ *** Install ~fisher~
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-Install_=fisher=-3a44531b :CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-Install_=fisher=-3a44531b
:END: :END:
We will be using ~fisher~ as our extensions manager for Fish. Lets install We will be using ~fisher~ as our extensions manager for Fish. Lets install it.
it.
#+BEGIN_SRC fish #+BEGIN_SRC fish
printf "\n# Installing fisher ###########################################################\n\n" printf "\n# Installing fisher ###########################################################\n\n"
curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish

View File

@ -10,33 +10,21 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Introduction-7e535842 :CUSTOM_ID: Introduction-7e535842
:END: :END:
*Before proceeding, be aware that I deprecated this nano config on August *Before proceeding, be aware that I deprecated this nano config on August 28th, 2020, meaning I wont update it anymore unless I use it again some day in the future. I will keep it on my website though.*
28th, 2020, meaning I wont update it anymore unless I use it again some day
in the future. I will keep it on my website though.*
I nowadays rarely use Nano as a text editor, since I mainly rely on Emacs for I nowadays rarely use Nano as a text editor, since I mainly rely on Emacs for all sorts of tasks, including quick file editing. However, at times, Emacs wont work or wont be available, and I therefore need a lightweight, fast and reliable text editor: Nano. And despite Nano being a simple piece of software, it does offer some customization I cannot refuse. Here is how I configured it:
all sorts of tasks, including quick file editing. However, at times, Emacs
wont work or wont be available, and I therefore need a lightweight, fast and
reliable text editor: Nano. And despite Nano being a simple piece of software,
it does offer some customization I cannot refuse. Here is how I configured it:
* Configuration * Configuration
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Configuration-b55668a7 :CUSTOM_ID: Configuration-b55668a7
:END: :END:
When saving a file, create a backup file by adding a tilde (=~=) to the file's When saving a file, create a backup file by adding a tilde (=~=) to the file's name. And make and keep not just one backup file, but make and keep a uniquely numbered one every time a file is saved — when backups are enabled with =set backup= or =--backup= or =-B=. The uniquely numbered files are stored in the directory =~/.cache/nano/backups/=.
name. And make and keep not just one backup file, but make and keep a uniquely
numbered one every time a file is saved — when backups are enabled with =set
backup= or =--backup= or =-B=. The uniquely numbered files are stored in the
directory =~/.cache/nano/backups/=.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set backup set backup
set backupdir /home/phundrak/.cache/nano/backups/ set backupdir /home/phundrak/.cache/nano/backups/
#+END_SRC #+END_SRC
Save a file by default in Unix format. This overrides nano's default behavior Save a file by default in Unix format. This overrides nano's default behavior of saving a file in the format that it had. (This option has no effect when you also use =set noconvert=.)
of saving a file in the format that it had. (This option has no effect when
you also use =set noconvert=.)
#+BEGIN_SRC conf #+BEGIN_SRC conf
set unix set unix
#+END_SRC #+END_SRC
@ -45,10 +33,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Configuration-Keys_behavior-c665fa36 :CUSTOM_ID: Configuration-Keys_behavior-c665fa36
:END: :END:
Make the Home key smarter. When Home is pressed anywhere but at the very Make the Home key smarter. When Home is pressed anywhere but at the very beginning of non-whitespace characters on a line, the cursor will jump to that beginning (either forwards or backwards). If the cursor is already at that position, it will jump to the true beginning of the line.
beginning of non-whitespace characters on a line, the cursor will jump to
that beginning (either forwards or backwards). If the cursor is already at
that position, it will jump to the true beginning of the line.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set smarthome set smarthome
#+END_SRC #+END_SRC
@ -62,8 +47,7 @@
unset casesensitive unset casesensitive
#+END_SRC #+END_SRC
Do regular-expression searches by default. Regular expressions in =nano= are Do regular-expression searches by default. Regular expressions in =nano= are of the extended type (ERE).
of the extended type (ERE).
#+BEGIN_SRC conf #+BEGIN_SRC conf
set regexp set regexp
#+END_SRC #+END_SRC
@ -72,10 +56,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Configuration-Visual_settings-9952f2ae :CUSTOM_ID: Configuration-Visual_settings-9952f2ae
:END: :END:
Use bold instead of reverse video for the title bar, status bar, key combos, Use bold instead of reverse video for the title bar, status bar, key combos, function tags, line numbers, and selected text. This can be overridden by setting the options =titlecolor=, =statuscolor=, =keycolor=, =functioncolor=, =numbercolor=, and =selectedcolor=.
function tags, line numbers, and selected text. This can be overridden by
setting the options =titlecolor=, =statuscolor=, =keycolor=, =functioncolor=,
=numbercolor=, and =selectedcolor=.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set boldtext set boldtext
#+END_SRC #+END_SRC
@ -85,8 +66,7 @@
set softwrap set softwrap
#+END_SRC #+END_SRC
When soft line wrapping is enabled, make it wrap lines at blank characters When soft line wrapping is enabled, make it wrap lines at blank characters (tabs and spaces) instead of always at the edge of the screen.
(tabs and spaces) instead of always at the edge of the screen.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set atblanks set atblanks
#+END_SRC #+END_SRC
@ -96,8 +76,7 @@
set linenumbers set linenumbers
#+END_SRC #+END_SRC
Constantly display the cursor position in the status bar. This overrides the Constantly display the cursor position in the status bar. This overrides the option =quickblank=.
option =quickblank=.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set constantshow set constantshow
#+END_SRC #+END_SRC
@ -111,21 +90,17 @@
set tabstospaces set tabstospaces
#+END_SRC #+END_SRC
Use a tab size of a certain amount of columns. The value of number must be Use a tab size of a certain amount of columns. The value of number must be greater than 0. The default value is 8.
greater than 0. The default value is 8.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set tabsize 2 set tabsize 2
#+END_SRC #+END_SRC
Automatically indent a newly created line to the same number of tabs and/or Automatically indent a newly created line to the same number of tabs and/or spaces as the previous line (or as the next line if the previous line is the beginning of a paragraph).
spaces as the previous line (or as the next line if the previous line is the
beginning of a paragraph).
#+BEGIN_SRC conf #+BEGIN_SRC conf
set autoindent set autoindent
#+END_SRC #+END_SRC
Remove trailing whitespace from wrapped lines when automatic hard-wrapping Remove trailing whitespace from wrapped lines when automatic hard-wrapping occurs or when text is justified.
occurs or when text is justified.
#+BEGIN_SRC conf #+BEGIN_SRC conf
set trimblanks set trimblanks
#+END_SRC #+END_SRC
@ -134,10 +109,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Configuration-Included_configuration_file-70b0f35b :CUSTOM_ID: Configuration-Included_configuration_file-70b0f35b
:END: :END:
Nano gives the opportunity to include some files located elsewhere. This is Nano gives the opportunity to include some files located elsewhere. This is why I added [[https://github.com/scopatz/nanorc][this repo]] as a submodule of my dotfiles so I can access a lot of them at the same time. Since the submodule is cloned in =~/.config/nanorc=, we can add only one line to include all of the =.nanorc= files.
why I added [[https://github.com/scopatz/nanorc][this repo]] as a submodule of my dotfiles so I can access a lot of
them at the same time. Since the submodule is cloned in =~/.config/nanorc=,
we can add only one line to include all of the =.nanorc= files.
#+BEGIN_SRC conf #+BEGIN_SRC conf
include ~/.config/nano/nano-syntax/*.nanorc include ~/.config/nano/nano-syntax/*.nanorc
#+END_SRC #+END_SRC

View File

@ -32,15 +32,12 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Core_Ncmpcpp_settings-Directories-28092c92 :CUSTOM_ID: Core_Ncmpcpp_settings-Directories-28092c92
:END: :END:
Ncmpcpp has two vital directories: the lyrics directory, and its own Ncmpcpp has two vital directories: the lyrics directory, and its own configuration directory. The configuration for ncmpcpp is generally either in ~$HOME/.ncmpcpp/~ or in ~$XDG_CONFIG_HOME/ncmpcpp/~.
configuration directory. The configuration for ncmpcpp is generally either in
~$HOME/.ncmpcpp/~ or in ~$XDG_CONFIG_HOME/ncmpcpp/~.
#+BEGIN_SRC conf #+BEGIN_SRC conf
ncmpcpp_directory = ~/.config/ncmpcpp ncmpcpp_directory = ~/.config/ncmpcpp
#+END_SRC #+END_SRC
When it comes to the lyrics, be sure to set the directory to the same When it comes to the lyrics, be sure to set the directory to the same directory pointed at by Mpd.
directory pointed at by Mpd.
#+BEGIN_SRC conf #+BEGIN_SRC conf
lyrics_directory = ~/.lyrics lyrics_directory = ~/.lyrics
#+END_SRC #+END_SRC
@ -49,12 +46,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Core_Ncmpcpp_settings-MPD-a2a7452e :CUSTOM_ID: Core_Ncmpcpp_settings-MPD-a2a7452e
:END: :END:
These settings tell ncmpcpp how to communicate with Mpd. Once again, be sure These settings tell ncmpcpp how to communicate with Mpd. Once again, be sure to follow your own MPD settings. In my case, I am connecting to my local MPD server, hence the ~localhost~ value of the variable below, and I did not change the default port of MPD. My music is located at =~/Music=, and ncmpcpp should connect pretty much immediately, although I allow a five seconds timeout before ncmpcpp treats it as an error. Also, no crossfade please.
to follow your own MPD settings. In my case, I am connecting to my local MPD
server, hence the ~localhost~ value of the variable below, and I did not
change the default port of MPD. My music is located at =~/Music=, and ncmpcpp
should connect pretty much immediately, although I allow a five seconds
timeout before ncmpcpp treats it as an error. Also, no crossfade please.
#+BEGIN_SRC conf #+BEGIN_SRC conf
mpd_host = localhost mpd_host = localhost
mpd_port = 6600 mpd_port = 6600

View File

@ -11,36 +11,23 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Introduction-5942aea3 :CUSTOM_ID: Introduction-5942aea3
:END: :END:
[[https://github.com/dylanaraps/neofetch][Neofetch]] is a CLI utility used to display system information. It was written [[https://github.com/dylanaraps/neofetch][Neofetch]] is a CLI utility used to display system information. It was written in Bash, and thus its configuration file is written as a Bash script too. This document was written with org-mode, and my configuration file is tangled from the source blocks you will see below to ~~/.config/neofetch/config.conf~. This configuration will only contain what I need. For any further information, please refer to the [[https://github.com/dylanaraps/neofetch][original repository]] and [[https://github.com/dylanaraps/neofetch/wiki/Customizing-Info][its documentation]].
in Bash, and thus its configuration file is written as a Bash script too. This
document was written with org-mode, and my configuration file is tangled from
the source blocks you will see below to ~~/.config/neofetch/config.conf~.
This configuration will only contain what I need. For any further information,
please refer to the [[https://github.com/dylanaraps/neofetch][original repository]] and [[https://github.com/dylanaraps/neofetch/wiki/Customizing-Info][its documentation]].
* The ~print_info~ functions * The ~print_info~ functions
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: The_print_info_functions-bb30763f :CUSTOM_ID: The_print_info_functions-bb30763f
:END: :END:
The ~print_info~ function is the function called by Neofetch in order to print The ~print_info~ function is the function called by Neofetch in order to print the system information it could fetch. In this function, well choose what to display, and how. This function looks like this:
the system information it could fetch. In this function, well choose what to
display, and how. This function looks like this:
#+BEGIN_SRC sh :tangle no #+BEGIN_SRC sh :tangle no
print_info() { print_info() {
# Print information here… # Print information here…
} }
#+END_SRC #+END_SRC
Generally, what we will display will be shown through the ~info~ function, Generally, what we will display will be shown through the ~info~ function, redefined inside Neofetch (this is not ~info(1)~). This ~info~ function accepts one or two arguments. With one argument, such as with ~info memory~, we can get a result that looks like ~5136MiB / 15873MiB~, while calling it with two arguments will treat the first one as a prefix and the second one as the interesting information; ~info "Memory" memory~ will look like ~Memory: 5136MiB / 15873MiB~. Here is what we want to display:
redefined inside Neofetch (this is not ~info(1)~). This ~info~ function
accepts one or two arguments. With one argument, such as with ~info memory~,
we can get a result that looks like ~5136MiB / 15873MiB~, while calling it
with two arguments will treat the first one as a prefix and the second one as
the interesting information; ~info "Memory" memory~ will look like
~Memory: 5136MiB / 15873MiB~. Here is what we want to display:
#+NAME: info-elements-table #+NAME: info-elements-table
| Prefix | Information | What it does | | Prefix | Information | What it does |
|----------+-------------+-----------------------------------| |----------+-------------+------------------------------|
| | title | Username and hostname | | | title | Username and hostname |
| | line_break | Insert a blank line | | | line_break | Insert a blank line |
| | cols | System theme | | | cols | System theme |
@ -101,11 +88,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-9d4cfe88 :CUSTOM_ID: Information_settings-9d4cfe88
:END: :END:
Each of the following variable tunes a function that can be called in Each of the following variable tunes a function that can be called in ~print_info~ described above. It is possible to tune them by modifying this document or the configuration file itself, and they can be overridden by the command line with flags passed to ~neofetch~. I will divide these variables in two main categories: hardware and software-related properties.
~print_info~ described above. It is possible to tune them by modifying this
document or the configuration file itself, and they can be overridden by the
command line with flags passed to ~neofetch~. I will divide these variables in
two main categories: hardware and software-related properties.
** Software ** Software
:PROPERTIES: :PROPERTIES:
@ -175,7 +158,6 @@
:CUSTOM_ID: Information_settings-Software-OS-Packages-f836a58d :CUSTOM_ID: Information_settings-Software-OS-Packages-f836a58d
:END: :END:
It is possible to show or hide Package Manager names. It is possible to show or hide Package Manager names.
- Default :: ~'tiny'~ - Default :: ~'tiny'~
- Values :: ~'on'~ / ~'tiny'~ / ~'off'~ - Values :: ~'on'~ / ~'tiny'~ / ~'off'~
- Flag :: ~--package_managers~ - Flag :: ~--package_managers~
@ -195,8 +177,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Software-Shell-Shell_path-9eda636d :CUSTOM_ID: Information_settings-Software-Shell-Shell_path-9eda636d
:END: :END:
This allows to show either the path of the users shell, or simply its This allows to show either the path of the users shell, or simply its name.
name.
- Default value :: ~"off"~ - Default value :: ~"off"~
- Values :: - Values ::
- ~"on"~ - ~"on"~
@ -205,9 +186,9 @@
- Examples :: - Examples ::
- on :: ~/bin/bash~ - on :: ~/bin/bash~
- off :: ~bash~ - off :: ~bash~
#+begin_src sh +begin_src sh
shell_path="off" shell_path="off"
#+end_src +end_src
***** Shell version ***** Shell version
:PROPERTIES: :PROPERTIES:
@ -250,9 +231,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Software-IP_address-26df5e1d :CUSTOM_ID: Information_settings-Software-IP_address-26df5e1d
:END: :END:
It is possible to display the machines public IP address with the function It is possible to display the machines public IP address with the function ~ip~. The value below allows the user to change the website used to fetch it.
~ip~. The value below allows the user to change the website used to fetch
it.
- Default value :: ~"http://ident.me"~ - Default value :: ~"http://ident.me"~
- Value :: ~"url"~ - Value :: ~"url"~
- Flag :: ~--ip_host~ - Flag :: ~--ip_host~
@ -276,16 +255,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Software-Theming-ba7f1ccd :CUSTOM_ID: Information_settings-Software-Theming-ba7f1ccd
:END: :END:
This section will allow the user to modify what Neofetch can and cannot This section will allow the user to modify what Neofetch can and cannot display about the machines theming —by this, I mean its GTK theme, its icons and its default font.
display about the machines theming —by this, I mean its GTK theme, its
icons and its default font.
**** Shorten output **** Shorten output
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Software-Theming-Shorten_output-cbef1fa4 :CUSTOM_ID: Information_settings-Software-Theming-Shorten_output-cbef1fa4
:END: :END:
With this value, it is possible to shorten the output of the computers With this value, it is possible to shorten the output of the computers theming.
theming.
- Default value :: ~"off"~ - Default value :: ~"off"~
- Values :: - Values ::
- ~"on"~ - ~"on"~
@ -302,8 +278,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Software-Theming-Enable_or_disable_theming_display_for_GTK2-f4398571 :CUSTOM_ID: Information_settings-Software-Theming-Enable_or_disable_theming_display_for_GTK2-f4398571
:END: :END:
It is possible to explicitely show or hide the computers theming with GTK2 It is possible to explicitely show or hide the computers theming with GTK2 with this variable.
with this variable.
- Default value :: ~"on"~ - Default value :: ~"on"~
- Values :: - Values ::
- ~"on"~ - ~"on"~
@ -330,6 +305,7 @@
- on :: ~Numix [GTK2], Adwaita [GTK3]~ - on :: ~Numix [GTK2], Adwaita [GTK3]~
- off :: ~Numix [GTK2]~ - off :: ~Numix [GTK2]~
#+begin_src sh #+begin_src sh
gtk3="off"
#+end_src #+end_src
** Hardware ** Hardware
@ -340,7 +316,6 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-CPU-eb0bcd7d :CUSTOM_ID: Information_settings-Hardware-CPU-eb0bcd7d
:END: :END:
**** CPU brand **** CPU brand
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-CPU-CPU_brand-5b25776b :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_brand-5b25776b
@ -380,9 +355,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-CPU-CPU_speed_type-a24de48f :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_speed_type-a24de48f
:END: :END:
This allows Neofetch to know what type of speed it has to fetch regarding This allows Neofetch to know what type of speed it has to fetch regarding the machines CPU. Any file in ~/sys/devices/system/cpu/cpu0/cpufreq~ can be used as a value.
the machines CPU. Any file in ~/sys/devices/system/cpu/cpu0/cpufreq~ can
be used as a value.
- Default value :: ~"bios_limit"~ - Default value :: ~"bios_limit"~
- Values :: - Values ::
- ~"scaling_cur_freq"~ - ~"scaling_cur_freq"~
@ -399,8 +372,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-CPU-CPU_speed_shorthand-0d15fe08 :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_speed_shorthand-0d15fe08
:END: :END:
This value allows to show sorter CPU speed with less digits. This flag is This value allows to show sorter CPU speed with less digits. This flag is not supported in systems with CPU speed below 1GHz.
not supported in systems with CPU speed below 1GHz.
- Default value :: ~"off"~ - Default value :: ~"off"~
- Values :: - Values ::
- ~"on"~ - ~"on"~
@ -417,8 +389,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-CPU-CPU_cores-30177354 :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_cores-30177354
:END: :END:
With this variable, it is possible to display the number of cores that are With this variable, it is possible to display the number of cores that are available in the CPU.
available in the CPU.
- Default value :: ~"logical"~ - Default value :: ~"logical"~
- Values :: - Values ::
- ~"logical"~ - ~"logical"~
@ -438,10 +409,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-CPU-CPU_temperature-a22e522c :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_temperature-a22e522c
:END: :END:
This variable allows the user to hide or show the CPUs temperature, and if This variable allows the user to hide or show the CPUs temperature, and if shown, the user can display it in Celcius or Farenheit degrees. For FreeBSD and NetBSD-based systems, youll need to enable the ~coretemp~ kernel module. This only supports newer Intel processors.
shown, the user can display it in Celcius or Farenheit degrees. For FreeBSD
and NetBSD-based systems, youll need to enable the ~coretemp~ kernel
module. This only supports newer Intel processors.
- Default value :: ~"off"~ - Default value :: ~"off"~
- Values :: - Values ::
- ~"C"~ - ~"C"~
@ -461,16 +429,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-GPU-2c842575 :CUSTOM_ID: Information_settings-Hardware-GPU-2c842575
:END: :END:
The function responsible for displaying information regarding the GPUs is The function responsible for displaying information regarding the GPUs is ~gpu~. It will try to list all available GPUs and display what it knows about them.
~gpu~. It will try to list all available GPUs and display what it knows
about them.
**** GPU brand **** GPU brand
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-GPU-GPU_brand-6e2da615 :CUSTOM_ID: Information_settings-Hardware-GPU-GPU_brand-6e2da615
:END: :END:
This value allows the user to hide or show the brand of their GPU in the This value allows the user to hide or show the brand of their GPU in the output of ~gpu~.
output of ~gpu~.
- Default value :: ~"on"~ - Default value :: ~"on"~
- Values :: - Values ::
- ~"on"~ - ~"on"~
@ -488,8 +453,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-GPU-Which_GPU_to_display-f40d3aac :CUSTOM_ID: Information_settings-Hardware-GPU-Which_GPU_to_display-f40d3aac
:END: :END:
This allows the user to choose which GPU appears in the output of the This allows the user to choose which GPU appears in the output of the function ~gpu~.
function ~gpu~.
- Default value :: ~"all"~ - Default value :: ~"all"~
- Values :: - Values ::
- ~"all"~ - ~"all"~
@ -513,8 +477,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Information_settings-Hardware-Resolution-b768f865 :CUSTOM_ID: Information_settings-Hardware-Resolution-b768f865
:END: :END:
This will try to list all the connected screens and display their resolution This will try to list all the connected screens and display their resolution individually. It is possible to display the refresh rate or to hide it.
individually. It is possible to display the refresh rate or to hide it.
- Default value :: ~"off"~ - Default value :: ~"off"~
- Values :: - Values ::
- ~"on"~ - ~"on"~

View File

@ -9,25 +9,18 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Introduction-a5320326 :CUSTOM_ID: Introduction-a5320326
:END: :END:
Picom is the successor to Compton, a standalone compositor for Xorg. It Picom is the successor to Compton, a standalone compositor for Xorg. It provides compositing for WM that do not provide any, such as i3. I am currently using [[https://github.com/ibhagwan/picom][ibhagwans fork of compton]] which provides the ~dual-kawase~ blur from [[https://github.com/tryone144/compton][tryones compton]] and rounded corners from [[https://github.com/sdhand/picom][sdhands compton]].
provides compositing for WM that do not provide any, such as i3. I am
currently using [[https://github.com/ibhagwan/picom][ibhagwans fork of compton]] which provides the ~dual-kawase~
blur from [[https://github.com/tryone144/compton][tryones compton]] and rounded corners from [[https://github.com/sdhand/picom][sdhands compton]].
* Shadows * Shadows
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Shadows-f4ffbb27 :CUSTOM_ID: Shadows-f4ffbb27
:END: :END:
The following enables client-side shadows on windows. Note desktop windows The following enables client-side shadows on windows. Note desktop windows (windows with ~_NET_WM_WINDOW_TYPE_DESKTOP~) never get shadow, unless explicitly requested using the wintypes option. I personally deactivated shadows because they dont work out too well with rounded corners.
(windows with ~_NET_WM_WINDOW_TYPE_DESKTOP~) never get shadow, unless
explicitly requested using the wintypes option. I personally deactivated
shadows because they dont work out too well with rounded corners.
#+BEGIN_SRC conf #+BEGIN_SRC conf
shadow = false; shadow = false;
#+END_SRC #+END_SRC
The blur radius radius for shadows is measured in pixels, and it defaults to The blur radius radius for shadows is measured in pixels, and it defaults to 12px.
12px.
#+BEGIN_SRC conf #+BEGIN_SRC conf
shadow-radius = 7; shadow-radius = 7;
#+END_SRC #+END_SRC
@ -97,26 +90,19 @@
:END: :END:
Options in this subheader *will not* be exported to my configuration file. Options in this subheader *will not* be exported to my configuration file.
Thanks to this value, Picom can avoid drawing shadows on dock or panel Thanks to this value, Picom can avoid drawing shadows on dock or panel windows. This option is deprecated, and users should use the ~wintypes~ option in their config file instead.
windows. This option is deprecated, and users should use the ~wintypes~
option in their config file instead.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
no-dock-shadow = false; no-dock-shadow = false;
#+END_SRC #+END_SRC
This option allows Picom not to draw on drag-and-drop windows. This option is This option allows Picom not to draw on drag-and-drop windows. This option is deprecated, and users should use the ~wintypes~ option in their config file instead.
deprecated, and users should use the ~wintypes~ option in their config file
instead.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
no-dnd-shadow = false; no-dnd-shadow = false;
#+END_SRC #+END_SRC
~shadow-ignore-shaped~ is also deprecated. It used to indicate Picom not to ~shadow-ignore-shaped~ is also deprecated. It used to indicate Picom not to paint shadows on shaped windows. Note shaped windows here means windows setting their shape through X Shape extension. Those using ARGB background are beyond Picoms control. Since it is deprecated, you could instead use
paint shadows on shaped windows. Note shaped windows here means windows
setting their shape through X Shape extension. Those using ARGB background
are beyond Picoms control. Since it is deprecated, you could instead use
#+BEGIN_SRC conf :tangle no #+BEGIN_SRC conf :tangle no
shadow-exclude = 'bounding_shaped' shadow-exclude = 'bounding_shaped'
#+END_SRC #+END_SRC
@ -133,15 +119,12 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Rounded_corners-33bfcd20 :CUSTOM_ID: Rounded_corners-33bfcd20
:END: :END:
A great feature added by ibhagwans fork of compton is the addition of rounded A great feature added by ibhagwans fork of picom is the addition of rounded corners from sdhands fork, and the Kawase blur (described [[#Background_blurring-55835066][here]]) from tryone144s fork. Here we can see the declaration of the corners radius:
corners from sdhands fork, and the Kawase blur (described [[#Background_blurring-55835066][here]]) from
tryone144s fork. Here we can see the declaration of the corners radius:
#+BEGIN_SRC conf #+BEGIN_SRC conf
corner-radius = 9.0; corner-radius = 9.0;
#+END_SRC #+END_SRC
It is also possible to exclude some windows from getting their corners It is also possible to exclude some windows from getting their corners rounded. I personally excluded any window generated by AwesomeWM.
rounded. I personally excluded any window generated by AwesomeWM.
#+BEGIN_SRC conf #+BEGIN_SRC conf
rounded-corners-exclude = [ rounded-corners-exclude = [
"_NET_WM_WINDOW_TYPE@[0]:a = '_NET_WM_WINDOW_TYPE_DOCK'" "_NET_WM_WINDOW_TYPE@[0]:a = '_NET_WM_WINDOW_TYPE_DOCK'"
@ -152,17 +135,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Fading-419d8047 :CUSTOM_ID: Fading-419d8047
:END: :END:
Picom has the ability to create some fading effects on windows when opening or Picom has the ability to create some fading effects on windows when opening or closing or when the opacity changes. The following parameter toggles this feature on or off. However, its behavior can be changed with ~no-fading-openclose~.
closing or when the opacity changes. The following parameter toggles this
feature on or off. However, its behavior can be changed with
~no-fading-openclose~.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
fading = true fading = true
#+END_SRC #+END_SRC
These values controls the opacity change between steps while fading in and These values controls the opacity change between steps while fading in and out.
out.
| Default value | ~0.028~ (fade-in), ~0.03~ (fade-out) | | Default value | ~0.028~ (fade-in), ~0.03~ (fade-out) |
| Min value | ~0.01~ | | Min value | ~0.01~ |
| Max value | ~1.0~ | | Max value | ~1.0~ |
@ -178,8 +157,7 @@
fade-delta = 20; fade-delta = 20;
#+END_SRC #+END_SRC
It is possible to exclude some windows that should not be faded with a It is possible to exclude some windows that should not be faded with a specified list of conditions.
specified list of conditions.
| Default value | ~[]~ | | Default value | ~[]~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
fade-exclude = [ "class_g = 'mpv'" ]; fade-exclude = [ "class_g = 'mpv'" ];
@ -191,8 +169,7 @@
no-fading-openclose = true; no-fading-openclose = true;
#+END_SRC #+END_SRC
Finally, this option is a workaround for Openbox, Fluxbox and others by not Finally, this option is a workaround for Openbox, Fluxbox and others by not fading destroyed ARGB windows with WM frame.
fading destroyed ARGB windows with WM frame.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
no-fading-destroyed-argb = false no-fading-destroyed-argb = false
@ -202,9 +179,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Transparency_and_opacity-6c6b36d2 :CUSTOM_ID: Transparency_and_opacity-6c6b36d2
:END: :END:
Picom is also able to create some opacity or transparency for windows, Picom is also able to create some opacity or transparency for windows, depending on their state or on some user-defined rules. For instance, the following value describes the opacity of inactive windows.
depending on their state or on some user-defined rules. For instance, the
following value describes the opacity of inactive windows.
| Default value | ~1.0~ | | Default value | ~1.0~ |
| Min value | ~0.1~ | | Min value | ~0.1~ |
| Max value | ~1.0~ | | Max value | ~1.0~ |
@ -212,8 +187,7 @@
inactive-opacity = 0.6; inactive-opacity = 0.6;
#+END_SRC #+END_SRC
On the other hand, it is possible to declare a default opacity for active On the other hand, it is possible to declare a default opacity for active windows.
windows.
| Default value | ~1.0~ | | Default value | ~1.0~ |
| Min value | ~0.1~ | | Min value | ~0.1~ |
| Max value | ~1.0~ | | Max value | ~1.0~ |
@ -237,15 +211,13 @@
# menu-opacity = 0.9; # menu-opacity = 0.9;
#+END_SRC #+END_SRC
~inactive-opacity-override~ allows the user to let inactive opacity set by ~inactive-opacity-override~ allows the user to let inactive opacity set by ~-i~ override the ~_NET_WM_OPACITY_ values of windows.
~-i~ override the ~_NET_WM_OPACITY_ values of windows.
| Default value | ~true~ | | Default value | ~true~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
inactive-opacity-override = true; inactive-opacity-override = true;
#+END_SRC #+END_SRC
While it is possible to alter opacity on inactive windows, it is also possible While it is possible to alter opacity on inactive windows, it is also possible to dim them.
to dim them.
| Default value | ~1.0~ | | Default value | ~1.0~ |
| Min value | ~0.1~ | | Min value | ~0.1~ |
| Max value | ~1.0~ | | Max value | ~1.0~ |
@ -253,8 +225,7 @@
# inactive-dim = 1.0 # inactive-dim = 1.0
#+END_SRC #+END_SRC
It is also possible to use a fixed inactive dim value, instead of adjusting It is also possible to use a fixed inactive dim value, instead of adjusting according to window opacity.
according to window opacity.
| Default value | ~1.0~ | | Default value | ~1.0~ |
| Min value | ~0.1~ | | Min value | ~0.1~ |
| Max value | ~1.0~ | | Max value | ~1.0~ |
@ -262,31 +233,23 @@
# inactive-dim-fixed = 1.0 # inactive-dim-fixed = 1.0
#+END_SRC #+END_SRC
It is also possible to specify a list of conditions of windows that should It is also possible to specify a list of conditions of windows that should always be considered focused.
always be considered focused.
| Default value | ~[]~ | | Default value | ~[]~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
focus-exclude = [ "class_g = 'mpv'" ]; focus-exclude = [ "class_g = 'mpv'" ];
#+END_SRC #+END_SRC
The user can also specify a list of opacity rules, in the format The user can also specify a list of opacity rules, in the format ~PERCENT:PATTERN~, like ~50:name *= "Firefox"~ . ~picom-trans~ is recommended over this. Note we don't make any guarantee about possible conflicts with other programs that set ~_NET_WM_WINDOW_OPACITY~ on frame or client windows.
~PERCENT:PATTERN~, like ~50:name *= "Firefox"~. picom-trans is recommended
over this. Note we don't make any guarantee about possible conflicts with
other programs that set ~_NET_WM_WINDOW_OPACITY~ on frame or client windows.
| Default value | ~[]~ | | Default value | ~[]~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
opacity-rule = [ opacity-rule = [];
"85:class_g = 'Polybar'",
# "55:class_g *?= 'Rofi'",
];
#+END_SRC #+END_SRC
* Background blurring * Background blurring
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Background_blurring-55835066 :CUSTOM_ID: Background_blurring-55835066
:END: :END:
The following are the parameters for background blurring, see the \*BLUR\* The following are the parameters for background blurring, see the \*BLUR\* section for more information.
section for more information.
#+BEGIN_SRC conf #+BEGIN_SRC conf
blur: { blur: {
method = "dual_kawase"; method = "dual_kawase";
@ -297,30 +260,25 @@
} }
#+END_SRC #+END_SRC
This value enables or disables the blur for the background of semi-transparent This value enables or disables the blur for the background of semi-transparent or ARGB windows. It has bad performances though, with driver-dependent behavior. The name of the switch may change without prior notifications.
or ARGB windows. It has bad performances though, with driver-dependent
behavior. The name of the switch may change without prior notifications.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
blur-background = true; blur-background = true;
#+END_SRC #+END_SRC
Blur background of windows when the window frame is not opaque. If true, this Blur background of windows when the window frame is not opaque. If true, this implies the value ~true~ for ~blur-background~.
implies the value ~true~ for ~blur-background~.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
blur-background-frame = true; blur-background-frame = true;
#+END_SRC #+END_SRC
The following determines whether to use fixed blur strength rather than The following determines whether to use fixed blur strength rather than adjusting according to window opacity.
adjusting according to window opacity.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
blur-background-fixed = false; blur-background-fixed = false;
#+END_SRC #+END_SRC
Specify the blur convolution kernel, with the format Specify the blur convolution kernel, with the format ~"5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"~.
~"5,5,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1"~.
| Default value | ~""~ | | Default value | ~""~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
# blur-kern = "3x3box"; # blur-kern = "3x3box";
@ -341,15 +299,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: General_settings-41398de7 :CUSTOM_ID: General_settings-41398de7
:END: :END:
Daemonize process. Fork to background after initialization. Causes issues Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers.
with certain (badly-written) drivers.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
daemon = true; daemon = true;
#+END_SRC #+END_SRC
Picom has three backends it can use: ~xrender~, ~glx~, and ~xr_glx_hybrid~. Picom has three backends it can use: ~xrender~, ~glx~, and ~xr_glx_hybrid~. GLX backend is typically much faster but depends on a sane driver.
GLX backend is typically much faster but depends on a sane driver.
| Default value | ~xrender~ | | Default value | ~xrender~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
backend = "glx"; backend = "glx";
@ -361,73 +317,60 @@
vsync = true; vsync = true;
#+END_SRC #+END_SRC
Enable remote control via D-Bus. See the *D-BUS API* section below for more Enable remote control via D-Bus. See the *D-BUS API* section below for more details.
details.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
dbus = false; dbus = false;
#+END_SRC #+END_SRC
Try to detect WM windows (a non-override-redirect window with no child that Try to detect WM windows (a non-override-redirect window with no child that has ~WM_STATE~) and markz them as active.
has ~WM_STATE~) and markz them as active.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
mark-wmwin-focused = true; mark-wmwin-focused = true;
#+END_SRC #+END_SRC
Mark override-redirect windows that doesn't have a child window with Mark override-redirect windows that doesn't have a child window with ~WM_STATE~ focused.
~WM_STATE~ focused.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
mark-ovredir-focused = true; mark-ovredir-focused = true;
#+END_SRC #+END_SRC
Try to detect windows with rounded corners and don't consider them shaped Try to detect windows with rounded corners and don't consider them shaped windows. The accuracy is not very high, unfortunately.
windows. The accuracy is not very high, unfortunately.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
detect-rounded-corners = true; detect-rounded-corners = true;
#+END_SRC #+END_SRC
Detect ~_NET_WM_OPACITY~ on client windows, useful for window managers not Detect ~_NET_WM_OPACITY~ on client windows, useful for window managers not passing ~_NET_WM_OPACITY~ of client windows to frame windows.
passing ~_NET_WM_OPACITY~ of client windows to frame windows.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
detect-client-opacity = true; detect-client-opacity = true;
#+END_SRC #+END_SRC
Specify refresh rate of the screen. If not specified or 0, picom will try Specify refresh rate of the screen. If not specified or 0, picom will try detecting this with X RandR extension.
detecting this with X RandR extension.
| Default value | ~60~ | | Default value | ~60~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
refresh-rate = 60; refresh-rate = 120;
#+END_SRC #+END_SRC
Limit picom to repaint at most once every 1 / ~refresh_rate~ second to boost Limit picom to repaint at most once every 1 / ~refresh_rate~ second to boost performance. This should not be used with
performance. This should not be used with
#+BEGIN_SRC text :tangle no #+BEGIN_SRC text :tangle no
vsync drm/opengl/opengl-oml vsync drm/opengl/opengl-oml
#+END_SRC #+END_SRC
as they essentially does sw-opti's job already, unless you wish to specify a as they essentially does sw-opti's job already, unless you wish to specify a lower refresh rate than the actual value.
lower refresh rate than the actual value.
| Default value | ~""~ | | Default value | ~""~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
# sw-opti =; # sw-opti =;
#+END_SRC #+END_SRC
Use EWMH ~_NET_ACTIVE_WINDOW~ to determine currently focused window, rather Use EWMH ~_NET_ACTIVE_WINDOW~ to determine currently focused window, rather than listening to ~FocusIn~/~FocusOut~ event. Might have more accuracy, provided that the WM supports it.
than listening to ~FocusIn~/~FocusOut~ event. Might have more accuracy,
provided that the WM supports it.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
# use-ewmh-active-win = false; # use-ewmh-active-win = false;
#+END_SRC #+END_SRC
Unredirect all windows if a full-screen opaque window is detected, to maximize Unredirect all windows if a full-screen opaque window is detected, to maximize performance for full-screen windows. Known to cause flickering when redirecting/unredirecting windows. paint-on-overlay may make the flickering less obvious.
performance for full-screen windows. Known to cause flickering when
redirecting/unredirecting windows. paint-on-overlay may make the flickering
less obvious.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
unredir-if-possible = false; unredir-if-possible = false;
@ -439,91 +382,67 @@
unredir-if-possible-delay = 0; unredir-if-possible-delay = 0;
#+END_SRC #+END_SRC
Conditions of windows that shouldn't be considered full-screen for Conditions of windows that shouldn't be considered full-screen for unredirecting screen.
unredirecting screen.
| Default value | ~[]~ | | Default value | ~[]~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
unredir-if-possible-exclude = []; unredir-if-possible-exclude = [];
#+END_SRC #+END_SRC
Use ~WM_TRANSIENT_FOR~ to group windows, and consider windows in the same Use ~WM_TRANSIENT_FOR~ to group windows, and consider windows in the same group focused at the same time.
group focused at the same time.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
detect-transient = true; detect-transient = true;
#+END_SRC #+END_SRC
Use ~WM_CLIENT_LEADER~ to group windows, and consider windows in the same Use ~WM_CLIENT_LEADER~ to group windows, and consider windows in the same group focused at the same time. ~WM_TRANSIENT_FOR~ has higher priority if detect-transient is enabled, too.
group focused at the same time. ~WM_TRANSIENT_FOR~ has higher priority if
detect-transient is enabled, too.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
detect-client-leader = true; detect-client-leader = true;
#+END_SRC #+END_SRC
Resize damaged region by a specific number of pixels. A positive value Resize damaged region by a specific number of pixels. A positive value enlarges it while a negative one shrinks it. If the value is positive, those additional pixels will not be actually painted to screen, only used in blur calculation, and such. (Due to technical limitations, with use-damage, those pixels will still be incorrectly painted to screen.) Primarily used to fix the line corruption issues of blur, in which case you should use the blur radius value here (e.g. with a 3x3 kernel, you should use ~--resize-damage 1~, with a 5x5 one you use ~--resize-damage 2~, and so on). May or may not work with ~--glx-no-stencil~. Shrinking doesn't function correctly.
enlarges it while a negative one shrinks it. If the value is positive, those
additional pixels will not be actually painted to screen, only used in blur
calculation, and such. (Due to technical limitations, with use-damage, those
pixels will still be incorrectly painted to screen.) Primarily used to fix the
line corruption issues of blur, in which case you should use the blur radius
value here (e.g. with a 3x3 kernel, you should use ~--resize-damage 1~, with a
5x5 one you use ~--resize-damage 2~, and so on). May or may not work with
*--glx-no-stencil*. Shrinking doesn't function correctly.
| Default value | ~1~ | | Default value | ~1~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
resize-damage = 1; resize-damage = 1;
#+END_SRC #+END_SRC
Specify a list of conditions of windows that should be painted with inverted Specify a list of conditions of windows that should be painted with inverted color. Resource-hogging, and is not well tested.
color. Resource-hogging, and is not well tested.
| Default value | ~[]~ | | Default value | ~[]~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
invert-color-include = []; invert-color-include = [];
#+END_SRC #+END_SRC
Disable the use of damage information. This cause the whole screen to be Disable the use of damage information. This cause the whole screen to be redrawn everytime, instead of the part of the screen has actually changed. Potentially degrades the performance, but might fix some artifacts. The opposing option is use-damage
redrawn everytime, instead of the part of the screen has actually changed.
Potentially degrades the performance, but might fix some artifacts. The
opposing option is use-damage
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
use-damage = false; use-damage = false;
#+END_SRC #+END_SRC
Use X Sync fence to sync clients' draw calls, to make sure all draw calls are Use X Sync fence to sync clients' draw calls, to make sure all draw calls are finished before picom starts drawing. Needed on nvidia-drivers with GLX backend for some users.
finished before picom starts drawing. Needed on nvidia-drivers with GLX
backend for some users.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
xrender-sync-fence = false; xrender-sync-fence = false;
#+END_SRC #+END_SRC
Force all windows to be painted with blending. Useful if you have a Force all windows to be painted with blending. Useful if you have a glx-fshader-win that could turn opaque pixels transparent.
glx-fshader-win that could turn opaque pixels transparent.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
force-win-blend = false; force-win-blend = false;
#+END_SRC #+END_SRC
Do not use EWMH to detect fullscreen windows. Reverts to checking if a window Do not use EWMH to detect fullscreen windows. Reverts to checking if a window is fullscreen based only on its size and coordinates.
is fullscreen based only on its size and coordinates.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
no-ewmh-fullscreen = false; no-ewmh-fullscreen = false;
#+END_SRC #+END_SRC
Dimming bright windows so their brightness doesn't exceed this set value. Dimming bright windows so their brightness doesn't exceed this set value. Brightness of a window is estimated by averaging all pixels in the window, so this could comes with a performance hit. Setting this to 1.0 disables this behaviour. Requires ~--use-damage~ to be disabled.
Brightness of a window is estimated by averaging all pixels in the window, so
this could comes with a performance hit. Setting this to 1.0 disables this
behaviour. Requires ~--use-damage~ to be disabled.
| Default value | ~1.0~ | | Default value | ~1.0~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
max-brightness = 1.0; max-brightness = 1.0;
#+END_SRC #+END_SRC
Make transparent windows clip other windows like non-transparent windows do, Make transparent windows clip other windows like non-transparent windows do, instead of blending on top of them.
instead of blending on top of them.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
transparent-clipping = false; transparent-clipping = false;
@ -535,18 +454,13 @@
- ~info~ - ~info~
- ~warn~ - ~warn~
- ~error~ - ~error~
in increasing level of importance. Case doesn't matter. If using the "TRACE" in increasing level of importance. Case doesn't matter. If using the "TRACE" log level, it's better to log into a file using ~--log-file~, since it can generate a huge stream of logs.
log level, it's better to log into a file using ~--log-file~, since it can
generate a huge stream of logs.
| Default value | ~"debug"~ | | Default value | ~"debug"~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
log-level = "warn"; log-level = "warn";
#+END_SRC #+END_SRC
Set the log file. If ~--log-file~ is never specified, logs will be written to Set the log file. If ~--log-file~ is never specified, logs will be written to stderr. Otherwise, logs will to written to the given file, though some of the early logs might still be written to the stderr. When setting this option from the config file, it is recommended to use an absolute path.
stderr. Otherwise, logs will to written to the given file, though some of the
early logs might still be written to the stderr. When setting this option from
the config file, it is recommended to use an absolute path.
| Default value | ~''~ | | Default value | ~''~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
# log-file = '/path/to/your/log/file'; # log-file = '/path/to/your/log/file';
@ -564,8 +478,7 @@
# write-pid-path = '/path/to/your/log/file'; # write-pid-path = '/path/to/your/log/file';
#+END_SRC #+END_SRC
Window type settings. ~WINDOW_TYPE~ is one of the 15 window types defined in Window type settings. ~WINDOW_TYPE~ is one of the 15 window types defined in EWMH standard:
EWMH standard:
- ~"unknown"~ - ~"unknown"~
- ~"desktop"~ - ~"desktop"~
- ~"dock"~ - ~"dock"~
@ -584,16 +497,9 @@
Following per window-type options are available: Following per window-type options are available:
- fade, shadow :: Controls window-type-specific shadow and fade settings. - fade, shadow :: Controls window-type-specific shadow and fade settings.
- opacity :: Controls default opacity of the window type. - opacity :: Controls default opacity of the window type.
- focus :: Controls whether the window of this type is to be always considered - focus :: Controls whether the window of this type is to be always considered focused. (By default, all window types except "normal" and "dialog" has this on.)
focused. (By default, all window types except "normal" and "dialog" has this - full-shadow :: Controls whether shadow is drawn under the parts of the window that you normally won't be able to see. Useful when the window has parts of it transparent, and you want shadows in those areas.
on.) - redir-ignore :: Controls whether this type of windows should cause screen to become redirected again after been unredirected. If you have unredir-if-possible set, and doesn't want certain window to cause unnecessary screen redirection, you can set this to `true`.
- full-shadow :: Controls whether shadow is drawn under the parts of the
window that you normally won't be able to see. Useful when the window has
parts of it transparent, and you want shadows in those areas.
- redir-ignore :: Controls whether this type of windows should cause screen to
become redirected again after been unredirected. If you have
unredir-if-possible set, and doesn't want certain window to cause
unnecessary screen redirection, you can set this to `true`.
#+BEGIN_SRC conf #+BEGIN_SRC conf
wintypes: wintypes:
{ {
@ -609,26 +515,19 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: General_settings-GLX_backend-specific_options-43892981 :CUSTOM_ID: General_settings-GLX_backend-specific_options-43892981
:END: :END:
Avoid using stencil buffer, useful if you don't have a stencil buffer. Might Avoid using stencil buffer, useful if you don't have a stencil buffer. Might cause incorrect opacity when rendering transparent content (but never practically happened) and may not work with blur-background. Tests show a 15% performance boost. Recommended.
cause incorrect opacity when rendering transparent content (but never
practically happened) and may not work with blur-background. Tests show a 15%
performance boost. Recommended.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
glx-no-stencil = true; glx-no-stencil = true;
#+END_SRC #+END_SRC
Avoid rebinding pixmap on window damage. Probably could improve performance Avoid rebinding pixmap on window damage. Probably could improve performance on rapid window content changes, but is known to break things on some drivers (LLVMpipe, xf86-video-intel, etc.). Recommended if it works.
on rapid window content changes, but is known to break things on some drivers
(LLVMpipe, xf86-video-intel, etc.). Recommended if it works.
| Default value | ~false~ | | Default value | ~false~ |
#+BEGIN_SRC conf #+BEGIN_SRC conf
glx-no-rebind-pixmap = false; glx-no-rebind-pixmap = false;
#+END_SRC #+END_SRC
Use specified GLSL fragment shader for rendering window contents. See Use specified GLSL fragment shader for rendering window contents. See ~compton-default-fshader-win.glsl~ and ~compton-fake-transparency-fshader-win.glsl~ in the source tree for examples.
~compton-default-fshader-win.glsl~ and
~compton-fake-transparency-fshader-win.glsl~ in the source tree for examples.
| Default value | ~''~ | | Default value | ~''~ |
#+BEGIN_SRC conf :tangle no #+BEGIN_SRC conf :tangle no
glx-fshader-win = ''; glx-fshader-win = '';

View File

@ -12,24 +12,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Presentation-4e723f32 :CUSTOM_ID: Presentation-4e723f32
:END: :END:
*Before proceeding, be aware that I deprecated this polybar config on August *Before proceeding, be aware that I deprecated this polybar config on August 22nd, 2020, meaning I wont update it anymore unless I use it again some day in the future. I will keep it on my website though.*
22nd, 2020, meaning I wont update it anymore unless I use it again some day
in the future. I will keep it on my website though.*
Polybar is a desktop utility for displaying various information in form of Polybar is a desktop utility for displaying various information in form of bars for GNU/Linux systems. It is often used as a replacement for native bars available in window managers, such as i3. In my case, I use two instances of polybar in order to get two bars displayed on each screen. The information displayed is either related to i3 itself, or it is system information, such as CPU or disk usage. More information will be given and explained below.
bars for GNU/Linux systems. It is often used as a replacement for native bars
available in window managers, such as i3. In my case, I use two instances of
polybar in order to get two bars displayed on each screen. The information
displayed is either related to i3 itself, or it is system information, such as
CPU or disk usage. More information will be given and explained below.
If you want to learn more about how to configure Polybar, you can go to its If you want to learn more about how to configure Polybar, you can go to its [[https://github.com/jaagr/polybar][official repository on Github]].
[[https://github.com/jaagr/polybar][official repository on Github]].
#+BEGIN_EXPORT latex #+BEGIN_EXPORT latex
Be aware that this PDF documents suffers from a couple of issues with some Be aware that this PDF documents suffers from a couple of issues with some characters such as emojis. If you wish to see everything correctly, I would suggest you to take a look at the online HTML version of this document.
characters such as emojis. If you wish to see everything correctly, I would
suggest you to take a look at the online HTML version of this document.
#+END_EXPORT #+END_EXPORT
* General settings * General settings
@ -62,34 +52,23 @@
#+BEGIN_SRC conf-windows :exports none #+BEGIN_SRC conf-windows :exports none
; -*- mode: conf-windows -*- ; -*- mode: conf-windows -*-
#+END_SRC #+END_SRC
Like most status bars available, we can declare custom colors to be used in Like most status bars available, we can declare custom colors to be used in polybar. This part of the configuration file is declared with the following header:
polybar. This part of the configuration file is declared with the following
header:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[colors] [colors]
#+END_SRC #+END_SRC
As I use pywal as a color scheme generator based on the color of my wallpaper, I need to tell polybar to fetch the colors it will use from xrdb. If such color cannot be used, other colors will be used as fallback colors. First, lets declare our default background and foreground colors with their alternative option.
As I use pywal as a color scheme generator based on the color of my wallpaper,
I need to tell polybar to fetch the colors it will use from xrdb. If such
color cannot be used, other colors will be used as fallback colors. First,
lets declare our default background and foreground colors with their
alternative option.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
background = ${xrdb:color1:#50000000} background = ${xrdb:color1:#50000000}
background-alt = ${xrdb:color2:#444} background-alt = ${xrdb:color2:#444}
foreground = ${xrdb:color7:#dfdfdf} foreground = ${xrdb:color7:#dfdfdf}
foreground-alt = ${xrdb:color6:#555} foreground-alt = ${xrdb:color6:#555}
#+END_SRC #+END_SRC
Now, we can also declare our primary and secondary colors. Now, we can also declare our primary and secondary colors.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
primary = #ffb52a primary = #ffb52a
secondary = #e60053 secondary = #e60053
#+END_SRC #+END_SRC
Polybar is also aware of alerts sent by window managers such as i3 when a window opens in an unfocused workspace. For that, lets declare an alert color.
Polybar is also aware of alerts sent by window managers such as i3 when a
window opens in an unfocused workspace. For that, lets declare an alert
color.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
alert = #bd2c40 alert = #bd2c40
#+END_SRC #+END_SRC
@ -98,20 +77,17 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-a95135a3 :CUSTOM_ID: Declaration_of_the_bars-a95135a3
:END: :END:
It is possible in i3 to declare as many bars as we wish, and each of these It is possible in i3 to declare as many bars as we wish, and each of these bars will be named. Naming the bar is done in its module declaration like so:
bars will be named. Naming the bar is done in its module declaration like so:
#+BEGIN_SRC conf-windows :tangle no #+BEGIN_SRC conf-windows :tangle no
[bar/nameofthebar] [bar/nameofthebar]
#+END_SRC #+END_SRC
In my configuration, I use two of such bars, one atop of my screen, and one at In my configuration, I use two of such bars, one atop of my screen, and one at the bottom.
the bottom.
** Top bar declaration ** Top bar declaration
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-fc0cd977 :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-fc0cd977
:END: :END:
As unimaginative as it might seem, I went for a rather explicit name for my As unimaginative as it might seem, I went for a rather explicit name for my bars. The top one is simply named ~top~, as shown below.
bars. The top one is simply named ~top~, as shown below.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[bar/top] [bar/top]
#+END_SRC #+END_SRC
@ -120,31 +96,17 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Positioning-2505760c :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Positioning-2505760c
:END: :END:
We need to set on which screen the bar is to be displayed. Indeed, it is We need to set on which screen the bar is to be displayed. Indeed, it is possible to display a bar on only one specific screen if we wish to. Actually, it is even the default behavior of polybar, but as we will see later with the launching script, it is possible to launch bars on multiple outputs at the same time. Here, we simply get the value of the variable ~monitor~ from the launch environment.
possible to display a bar on only one specific screen if we wish to.
Actually, it is even the default behavior of polybar, but as we will see
later with the launching script, it is possible to launch bars on multiple
outputs at the same time. Here, we simply get the value of the variable
~monitor~ from the launch environment.
#+NAME: monitor-bar #+NAME: monitor-bar
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
monitor = ${env:MONITOR} monitor = ${env:MONITOR}
#+END_SRC #+END_SRC
We have a few position-related variables that need to be set. We can specify whether or not we want our bar at the bottom of the screen —which is the default behavior of polybar—, its width, its height, the radius for the rounding of its corners and whether the bar should be centered or not. In my case, my bars are rather small height-wise, and it occupies most of the width of my screens. There is some gaps between this bar and the border of the screen, but this is due to a border around the bar itself which acts not only on the width of the bar itself, but also on its height.
We have a few position-related variables that need to be set. We can specify
whether or not we want our bar at the bottom of the screen —which is the
default behavior of polybar—, its width, its height, the radius for the
rounding of its corners and whether the bar should be centered or not. In my
case, my bars are rather small height-wise, and it occupies most of the
width of my screens. There is some gaps between this bar and the border of
the screen, but this is due to a border around the bar itself which acts not
only on the width of the bar itself, but also on its height.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
bottom = false bottom = false
border-size = 5 border-size = 5
<<position-bar-top>> <<position-bar-top>>
#+END_SRC #+END_SRC
#+NAME: position-bar-top #+NAME: position-bar-top
#+BEGIN_SRC conf-windows :exports none :tangle no #+BEGIN_SRC conf-windows :exports none :tangle no
width = 100% width = 100%
@ -152,23 +114,18 @@
radius = 10.0 radius = 10.0
fixed-center = true fixed-center = true
#+END_SRC #+END_SRC
We also want to add some padding to our bar so our modules are not too close We also want to add some padding to our bar so our modules are not too close to its edges, especially due to the rounding of the top bar.
to its edges, especially due to the rounding of the top bar.
#+NAME: padding-bar #+NAME: padding-bar
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
padding-left = 2 padding-left = 2
padding-right = 4 padding-right = 4
#+END_SRC #+END_SRC
Each module will have some padding around it, so that modules arent glued together and instead have some room to breathe. The padding on the left is a bit less than the padding on the right for aesthetic reasons.
Each module will have some padding around it, so that modules arent glued
together and instead have some room to breathe. The padding on the left is a
bit less than the padding on the right for aesthetic reasons.
#+NAME: module-margin-bar #+NAME: module-margin-bar
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
module-margin-left = 1 module-margin-left = 1
module-margin-right = 2 module-margin-right = 2
#+END_SRC #+END_SRC
The top bar doesnt include any system tray, so lets disable that. The top bar doesnt include any system tray, so lets disable that.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
tray-position = none tray-position = none
@ -178,32 +135,21 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Colors_and_display-30f12652 :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Colors_and_display-30f12652
:END: :END:
As explained above, we declared some global variables when it comes to As explained above, we declared some global variables when it comes to colors, and this is where they will be used. The bars background will be of the same color as the main background color declared earlier, and the same goes for the foreground.
colors, and this is where they will be used. The bars background will be of
the same color as the main background color declared earlier, and the same
goes for the foreground.
#+NAME: bar-colors #+NAME: bar-colors
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
background = ${colors.background} background = ${colors.background}
foreground = ${colors.foreground} foreground = ${colors.foreground}
#+END_SRC #+END_SRC
If we wanted, we could also declare a default color for the underlines under If we wanted, we could also declare a default color for the underlines under the various modules that will be included in the bar, but in our case this variable is unused. So we will simply add this commented line as a memento this is possible, but it wont have any effect with this current configuration of polybar. Same goes for the border around the bar, it is a useless variable in this configuration since we want the border to be transparent.
the various modules that will be included in the bar, but in our case this
variable is unused. So we will simply add this commented line as a memento
this is possible, but it wont have any effect with this current
configuration of polybar. Same goes for the border around the bar, it is a
useless variable in this configuration since we want the border to be
transparent.
#+NAME: line-border-color #+NAME: line-border-color
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
line-color = #f00 line-color = #f00
; border-color = #00000000 ; border-color = #00000000
#+END_SRC #+END_SRC
Although the variable for the default line color is not used, we still have Although the variable for the default line color is not used, we still have to set the default width of the underline of our modules. By default, their underline will be three pixels thick.
to set the default width of the underline of our modules. By default, their
underline will be three pixels thick.
#+NAME: line-size-bar #+NAME: line-size-bar
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
line-size = 3 line-size = 3
@ -213,20 +159,12 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466 :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466
:END: :END:
Now we can chose which font fill be used in order to display text in this Now we can chose which font fill be used in order to display text in this bar, as well as the locale we want. The locale will be useful for displaying information such as date and time, which is a module we will have in this top bar. First, the declaration of the locale is done like so:
bar, as well as the locale we want. The locale will be useful for displaying
information such as date and time, which is a module we will have in this
top bar. First, the declaration of the locale is done like so:
#+NAME: locale-bar #+NAME: locale-bar
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
locale = ja_JP.UTF-8 locale = ja_JP.UTF-8
#+END_SRC #+END_SRC
Now, we can declare the fonts we want to use in Polybar. It is possible to declare several of them, the first one is the one which gets the absolute priority, and the next ones with a larger index are fallback fonts. Font declaration accepts the fontconfig format as well as possible offset[fn:1]. Five fonts are used in my polybar config:
Now, we can declare the fonts we want to use in Polybar. It is possible to
declare several of them, the first one is the one which gets the absolute
priority, and the next ones with a larger index are fallback fonts. Font
declaration accepts the fontconfig format as well as possible offset[fn:1].
Five fonts are used in my polybar config:
#+NAME: fonts-polybar #+NAME: fonts-polybar
| Font | fontconfig | Vertical offset | Why its used | | Font | fontconfig | Vertical offset | Why its used |
|--------------+----------------------------------------------------+-----------------+-----------------------| |--------------+----------------------------------------------------+-----------------+-----------------------|
@ -236,7 +174,6 @@
| NotoEmoji | NotoEmoji:style=Book:scale=16 | 0 | Emoji display | | NotoEmoji | NotoEmoji:style=Book:scale=16 | 0 | Emoji display |
| Siji | Siji:pixelsize=8 | 0 | Symbol display | | Siji | Siji:pixelsize=8 | 0 | Symbol display |
| Default font | fixed:pixelsize=8 | 0 | Fallback font | | Default font | fixed:pixelsize=8 | 0 | Fallback font |
#+NAME: font-ws-config #+NAME: font-ws-config
#+HEADER: :var text="font" #+HEADER: :var text="font"
#+BEGIN_SRC emacs-lisp :var table=fonts-polybar[,1:2] :cache yes #+BEGIN_SRC emacs-lisp :var table=fonts-polybar[,1:2] :cache yes
@ -264,19 +201,13 @@
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
<<font-ws-config(text="font",table=fonts-polybar)>> <<font-ws-config(text="font",table=fonts-polybar)>>
#+END_SRC #+END_SRC
Note that only Fira Sans get a small offset due to the size of the font and the height of the bar itself.
Note that only Fira Sans get a small offset due to the size of the font and
the height of the bar itself.
*** Modules *** Modules
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Modules-18979638 :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Modules-18979638
:END: :END:
Finally, arguably one of the most important parts of our bar configuration: Finally, arguably one of the most important parts of our bar configuration: the module selection. Modules can be positioned in three different parts of our bar: to the right, in middle or to the left. On the left, we want our workspace indicator for i3. In the middle, well get the title of the focused window, and to the left well have the date and time.
the module selection. Modules can be positioned in three different parts of
our bar: to the right, in middle or to the left. On the left, we want our
workspace indicator for i3. In the middle, well get the title of the
focused window, and to the left well have the date and time.
#+NAME: modules-generate #+NAME: modules-generate
#+BEGIN_SRC emacs-lisp :var table=top-modules :results value :cache yes #+BEGIN_SRC emacs-lisp :var table=top-modules :results value :cache yes
(setq right '() (setq right '()
@ -325,8 +256,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-8504b5ec :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-8504b5ec
:END: :END:
As described above, we will once again have to declare our bar with an As described above, we will once again have to declare our bar with an equally unimaginative but explicit name.
equally unimaginative but explicit name.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[bar/bottom] [bar/bottom]
#+END_SRC #+END_SRC
@ -335,8 +265,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Positioning-b1883756 :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Positioning-b1883756
:END: :END:
The variables are the same as above, but two of them will be slightly The variables are the same as above, but two of them will be slightly modified:
modified:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
bottom = true bottom = true
border-size = 0 border-size = 0
@ -350,21 +279,13 @@
radius = 0.0 radius = 0.0
fixed-center = true fixed-center = true
#+END_SRC #+END_SRC
When it comes to the bottom bar, I prefer to have it fit my outputs, without any margin around it. And of course, I have to declare it as being at the bottom of the screen, hence these modifications. As regards the padding of our modules, their own margins, and the screen output, they arent modified.
When it comes to the bottom bar, I prefer to have it fit my outputs, without
any margin around it. And of course, I have to declare it as being at the
bottom of the screen, hence these modifications. As regards the padding of
our modules, their own margins, and the screen output, they arent modified.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
<<padding-bar>> <<padding-bar>>
<<module-margin-bar>> <<module-margin-bar>>
<<monitor-bar>> <<monitor-bar>>
#+END_SRC #+END_SRC
However, we do display the system tray on this bottom bar at its right. It has no padding and it is not detached from the bar (this allows the bar to be displayed under the icons of the system tray), and their maximum size was chosen so they are well visible without being too big.
However, we do display the system tray on this bottom bar at its right. It
has no padding and it is not detached from the bar (this allows the bar to
be displayed under the icons of the system tray), and their maximum size was
chosen so they are well visible without being too big.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
tray-position = right tray-position = right
tray-padding = 0 tray-padding = 0
@ -376,8 +297,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Colors_and_display-854aae82 :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Colors_and_display-854aae82
:END: :END:
Nothing changes from the top bar, all the variables stay with the same Nothing changes from the top bar, all the variables stay with the same values. See [[#Declaration_of_the_bars-Bottom_bar_declaration-Colors_and_display-854aae82][Colors and display]] of the top bar for more information.
values. See [[#Declaration_of_the_bars-Bottom_bar_declaration-Colors_and_display-854aae82][Colors and display]] of the top bar for more information.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
<<bar-colors>> <<bar-colors>>
<<line-border-color>> <<line-border-color>>
@ -388,8 +308,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Fonts_and_locale-67459d62 :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Fonts_and_locale-67459d62
:END: :END:
Again, nothing changes from the top bar, so for more info on whats going Again, nothing changes from the top bar, so for more info on whats going on, see [[#Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466][Fonts and locale]] of the top bar.
on, see [[#Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466][Fonts and locale]] of the top bar.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
<<locale-bar>> <<locale-bar>>
<<font-ws-config(text="font",table=fonts-polybar)>> <<font-ws-config(text="font",table=fonts-polybar)>>
@ -399,9 +318,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Modules-702b21fc :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Modules-702b21fc
:END: :END:
Now, we can get to something interesting again: modules. This bar has a lot Now, we can get to something interesting again: modules. This bar has a lot more modules than the top bar. Here is the list of the modules we have on the bottom bar:
more modules than the top bar. Here is the list of the modules we have on
the bottom bar:
#+NAME: table-modules-bottom #+NAME: table-modules-bottom
| Module name | Position | Brief description | | Module name | Position | Brief description |
|----------------+----------+---------------------------------| |----------------+----------+---------------------------------|
@ -415,7 +332,6 @@
| memory | right | RAM usage | | memory | right | RAM usage |
| temperature | right | CPU temperature | | temperature | right | CPU temperature |
| custom-battery | right | Battery usage | | custom-battery | right | Battery usage |
Heres the corresponding configuration: Heres the corresponding configuration:
#+ATTR_LATEX: :options breaklines #+ATTR_LATEX: :options breaklines
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
@ -423,20 +339,13 @@
#+END_SRC #+END_SRC
All these modules will be explained below. All these modules will be explained below.
As you may have noticed, no modules will be displayed in the middle of this As you may have noticed, no modules will be displayed in the middle of this bar.
bar.
* Modules * Modules
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-2e1a51bc :CUSTOM_ID: Modules-2e1a51bc
:END: :END:
Before we begin to describe the different modules, I would like to point out Before we begin to describe the different modules, I would like to point out something that will be repeated multiple times if I dont talk about it right now: for each module, it is possible to declare the foreground and background color of the prefix of the modules, as well as the underline color and the padding of the module. I like these parameters to be rather consistent, so the code block you will see below will often be reused. The colors refer to the colors declared earlier, and the padding is minimal.
something that will be repeated multiple times if I dont talk about it right
now: for each module, it is possible to declare the foreground and background
color of the prefix of the modules, as well as the underline color and the
padding of the module. I like these parameters to be rather consistent, so the
code block you will see below will often be reused. The colors refer to the
colors declared earlier, and the padding is minimal.
#+NAME: mod-prefix-col #+NAME: mod-prefix-col
#+BEGIN_SRC conf-windows :tangle no #+BEGIN_SRC conf-windows :tangle no
format-prefix-foreground = ${colors.foreground-alt} format-prefix-foreground = ${colors.foreground-alt}
@ -453,62 +362,39 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Battery-299f2e42 :CUSTOM_ID: Modules-Hardware-Battery-299f2e42
:END: :END:
This module allows the user to get a battery widget among the polybar This module allows the user to get a battery widget among the polybar modules that will also send a notification to the user if the battery level drops below a certain value. This module relies on ~polybar-another-battery~ ([[https://github.com/drdeimos/polybar_another_battery][link]]) and its generated binary ~polybar-ab~ which should be in the ~$PATH~.
modules that will also send a notification to the user if the battery level
drops below a certain value. This module relies on ~polybar-another-battery~
([[https://github.com/drdeimos/polybar_another_battery][link]]) and its generated binary ~polybar-ab~ which should be in the ~$PATH~.
The first line of the module declaration lets the user name the module The first line of the module declaration lets the user name the module however they want. In this case, the name is ~custom-battery~.
however they want. In this case, the name is ~custom-battery~.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/custom-battery] [module/custom-battery]
#+END_SRC #+END_SRC
Since it is not a core module, we have to declare it as a custom script so polybar knows what to do with it.
Since it is not a core module, we have to declare it as a custom script so
polybar knows what to do with it.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
type = custom/script type = custom/script
#+END_SRC #+END_SRC
We now can specify the script execution, and whether or not the script will be continuously outputting something. In our case, the answer to this last question is yes.
We now can specify the script execution, and whether or not the script will
be continuously outputting something. In our case, the answer to this last
question is yes.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
exec = polybar-ab -polybar -thr 10 exec = polybar-ab -polybar -thr 10
tail = true tail = true
#+END_SRC #+END_SRC
The ~-thr 10~ specifies the threshold for polybar-ab at which it should warn The ~-thr 10~ specifies the threshold for polybar-ab at which it should warn the user about the battery level of the computer.
the user about the battery level of the computer.
Of course, users on desktop computers wont need this module which is aimed Of course, users on desktop computers wont need this module which is aimed at laptop users. Feel free to remove it if you do not need it.
at laptop users. Feel free to remove it if you do not need it.
*** Filesystem *** Filesystem
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Filesystem-26f0a3c6 :CUSTOM_ID: Modules-Hardware-Filesystem-26f0a3c6
:END: :END:
This module allows to display information about our filesystem, including This module allows to display information about our filesystem, including (and this is what I use this module for) displaying the used space and remaining space on different mount points. This module is an internal module to polybar, so lets declare it as such:
(and this is what I use this module for) displaying the used space and
remaining space on different mount points. This module is an internal module
to polybar, so lets declare it as such:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/filesystem] [module/filesystem]
type = internal/fs type = internal/fs
#+END_SRC #+END_SRC
We can specify how often the filesystem is to be checked with the variable We can specify how often the filesystem is to be checked with the variable ~interval~. I prefer it not to check it too often in order to not ping too often my drives, but I want it to be often enough so it is somewhat responsive. This is why I settled on a 20 seconds interval.
~interval~. I prefer it not to check it too often in order to not ping too
often my drives, but I want it to be often enough so it is somewhat
responsive. This is why I settled on a 20 seconds interval.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
interval = 20 interval = 20
#+END_SRC #+END_SRC
We now have to indicate where our different filesystems are mounted. In the case of my main computer /Marpa/, I have two partitions, the root partition and the home partition. But on my travel laptop, I only have the root partition, hence the usage of the below Elisp code that determines based on the computer it is running whether or not the second mount point to my home partition should be included.
We now have to indicate where our different filesystems are mounted. In the
case of my main computer /Marpa/, I have two partitions, the root partition
and the home partition. But on my travel laptop, I only have the root
partition, hence the usage of the below Elisp code that determines based on
the computer it is running whether or not the second mount point to my home
partition should be included.
#+NAME: include-home-partition #+NAME: include-home-partition
#+BEGIN_SRC emacs-lisp :tangle no :exports code #+BEGIN_SRC emacs-lisp :tangle no :exports code
(if (string= system-name "Marpa") (if (string= system-name "Marpa")
@ -519,26 +405,18 @@
mount-0 = / mount-0 = /
<<include-home-partition()>> <<include-home-partition()>>
#+END_SRC #+END_SRC
Now we can set the format of our module. There are two mains formats, one for mounted and one for unmounted mountpoints. For both, well simply use their label.
Now we can set the format of our module. There are two mains formats, one
for mounted and one for unmounted mountpoints. For both, well simply use
their label.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format-mounted = <label-mounted> format-mounted = <label-mounted>
format-unmounted = <label-unmounted> format-unmounted = <label-unmounted>
#+END_SRC #+END_SRC
When it comes to the mounted partition, we want to display the name of the When it comes to the mounted partition, we want to display the name of the mountpoint and how used it is, both in terms of gigabytes and percentage.
mountpoint and how used it is, both in terms of gigabytes and percentage.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
label-mounted = 💽 %mountpoint%: %used%/%total% (%percentage_used%%) label-mounted = 💽 %mountpoint%: %used%/%total% (%percentage_used%%)
label-mounted-foreground = ${colors.foreground} label-mounted-foreground = ${colors.foreground}
label-mounted-underline = ${colors.secondary} label-mounted-underline = ${colors.secondary}
#+END_SRC #+END_SRC
If the volume is unmounted (which should be worrying considering the mountpoints chosen), then well simply have a message telling us about that, and the foreground color will use the alternative foreground color described earlier.
If the volume is unmounted (which should be worrying considering the
mountpoints chosen), then well simply have a message telling us about that,
and the foreground color will use the alternative foreground color described
earlier.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
label-unmounted = %mountpoint% not mounted label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.foreground-alt} label-unmounted-foreground = ${colors.foreground-alt}
@ -548,11 +426,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Xbacklight-2901c504 :CUSTOM_ID: Modules-Hardware-Xbacklight-2901c504
:END: :END:
This module is used in order to display the level of brightness of a screen. This module is used in order to display the level of brightness of a screen. It is not used by itself, but rather by other modules, such as [[#Modules-Hardware-ACPI_backlight-9eaeaa79][ACPI backlight]]. First of all, this module is an internal module for xbacklight. It will also display the brightness percentage, prefixed by a sun emoji. Lastly, it will be underlined by a green line.
It is not used by itself, but rather by other modules, such as [[#Modules-Hardware-ACPI_backlight-9eaeaa79][ACPI
backlight]]. First of all, this module is an internal module for xbacklight.
It will also display the brightness percentage, prefixed by a sun emoji.
Lastly, it will be underlined by a green line.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/xbacklight] [module/xbacklight]
type = internal/xbacklight type = internal/xbacklight
@ -566,10 +440,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-ACPI_backlight-9eaeaa79 :CUSTOM_ID: Modules-Hardware-ACPI_backlight-9eaeaa79
:END: :END:
This module indicates the backlight level of a screen thanks to the ACPI This module indicates the backlight level of a screen thanks to the ACPI Linux module. There isnt much to tell about the module itself other than it inherits the module described above, [[#Modules-Hardware-Xbacklight-2901c504][xbacklight]]. It also sets which driver should be used, in this case the ~intel_backlight~ driver.
Linux module. There isnt much to tell about the module itself other than it
inherits the module described above, [[#Modules-Hardware-Xbacklight-2901c504][xbacklight]]. It also sets which driver
should be used, in this case the ~intel_backlight~ driver.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/backlight-acpi] [module/backlight-acpi]
inherit = module/xbacklight inherit = module/xbacklight
@ -581,22 +452,18 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-CPU-365dcb98 :CUSTOM_ID: Modules-Hardware-CPU-365dcb98
:END: :END:
This module indicates how much of the CPU is being used. As shown below, I This module indicates how much of the CPU is being used. As shown below, I made it so we can see the load on each core. The first thing to do is to declare the module as an internal module dedicated to the CPU.
made it so we can see the load on each core. The first thing to do is to
declare the module as an internal module dedicated to the CPU.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/cpu] [module/cpu]
type = internal/cpu type = internal/cpu
#+END_SRC #+END_SRC
Now, we can set the refresh rate in seconds of the module. I like it at two Now, we can set the refresh rate in seconds of the module. I like it at two seconds:
seconds:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
interval = 2 interval = 2
#+END_SRC #+END_SRC
Now, lets declare what will be displayed. The format will be a computer Now, lets declare what will be displayed. The format will be a computer emoji followed by ramp characters.
emoji followed by ramp characters.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format = <label> <ramp-coreload> format = <label> <ramp-coreload>
format-prefix = "💻 " format-prefix = "💻 "
@ -620,9 +487,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Memory-2f2f9475 :CUSTOM_ID: Modules-Hardware-Memory-2f2f9475
:END: :END:
Similarly to the CPU module, it is possible for Polybar to display the RAM Similarly to the CPU module, it is possible for Polybar to display the RAM load of the computer. As above, lets declare this module as an internal module to Polybar:
load of the computer. As above, lets declare this module as an internal
module to Polybar:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/memory] [module/memory]
type = internal/memory type = internal/memory
@ -649,17 +514,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Wlan-3457f36b :CUSTOM_ID: Modules-Hardware-Wlan-3457f36b
:END: :END:
It is possible for Polybar to display the name of the current WiFi network It is possible for Polybar to display the name of the current WiFi network the computer is connected to. For that, we first need to declare the Wlan module as an internal module of Polybar.
the computer is connected to. For that, we first need to declare the Wlan
module as an internal module of Polybar.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/wlan] [module/wlan]
type = internal/network type = internal/network
#+END_SRC #+END_SRC
Now, we should set the name of the interface. As this depends on the Now, we should set the name of the interface. As this depends on the hardware I am using, I am going to rely on the machines hostname and on some Elisp code to get this setting right.
hardware I am using, I am going to rely on the machines hostname and on
some Elisp code to get this setting right.
#+NAME: name-wlan-interface #+NAME: name-wlan-interface
#+BEGIN_SRC emacs-lisp :exports code :tangle no #+BEGIN_SRC emacs-lisp :exports code :tangle no
(cond ((string= system-name "Marpa") "wlp8s0") (cond ((string= system-name "Marpa") "wlp8s0")
@ -675,9 +536,7 @@
interval = 3.0 interval = 3.0
#+END_SRC #+END_SRC
The format of the module when connected to a network will the the display of The format of the module when connected to a network will the the display of the antenna emoji, followed by the name of the network. When disconnected, the module will simply be empty.
the antenna emoji, followed by the name of the network. When disconnected,
the module will simply be empty.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format-connected = <label-connected> format-connected = <label-connected>
format-connected-prefix = "📶 " format-connected-prefix = "📶 "
@ -688,15 +547,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Ethernet-dc749304 :CUSTOM_ID: Modules-Hardware-Ethernet-dc749304
:END: :END:
Just like any other module, the ethernet module has to be declared as an Just like any other module, the ethernet module has to be declared as an internal module.
internal module.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/eth] [module/eth]
type = internal/network type = internal/network
#+END_SRC #+END_SRC
And just like the Wlan module, it requires an interface which can vary And just like the Wlan module, it requires an interface which can vary depending on the machine I am using, hence this piece of Elisp:
depending on the machine I am using, hence this piece of Elisp:
#+NAME: name-eth-interface #+NAME: name-eth-interface
#+BEGIN_SRC emacs-lisp :exports code :tangle no #+BEGIN_SRC emacs-lisp :exports code :tangle no
(cond ((string= system-name "Marpa") "enp9s0") (cond ((string= system-name "Marpa") "enp9s0")
@ -707,9 +564,7 @@
interface = <<name-eth-interface()>> interface = <<name-eth-interface()>>
#+END_SRC #+END_SRC
The format of this module will be the local address of the computer on the The format of this module will be the local address of the computer on the network, and it will be prefixed by a desktop computer emoji. Meanwhile, when disconnected, the module wont be visible.
network, and it will be prefixed by a desktop computer emoji. Meanwhile,
when disconnected, the module wont be visible.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format-connected = <<label-connected>> format-connected = <<label-connected>>
format-connected-prefix = "🖥 " format-connected-prefix = "🖥 "
@ -726,23 +581,20 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Volume-ebf9f7a4 :CUSTOM_ID: Modules-Hardware-Volume-ebf9f7a4
:END: :END:
The volume module in Polybar is linked to its internal bindings to ALSA. The volume module in Polybar is linked to its internal bindings to ALSA. Lets declare it accordingly.
Lets declare it accordingly.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/volume] [module/volume]
type = internal/alsa type = internal/alsa
#+END_SRC #+END_SRC
Its format is quite simple: if the audio is not muted, it is then prefixed Its format is quite simple: if the audio is not muted, it is then prefixed with a speaker emoji, followed by the volume percentage.
with a speaker emoji, followed by the volume percentage.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format-volume = <label-volume> format-volume = <label-volume>
format-volume-prefix = "🔈 " format-volume-prefix = "🔈 "
label-volume = %percentage%% label-volume = %percentage%%
#+END_SRC #+END_SRC
If the audio is muted, then the only thing the user will see is the muted If the audio is muted, then the only thing the user will see is the muted speaker emoji followed by the text “muted”.
speaker emoji followed by the text “muted”.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format-muted-prefix = "🔇 " format-muted-prefix = "🔇 "
label-muted = muted label-muted = muted
@ -757,8 +609,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Hardware-Temperature-a9f08cde :CUSTOM_ID: Modules-Hardware-Temperature-a9f08cde
:END: :END:
The temperature module checks the temperature of the CPU, and warns the user The temperature module checks the temperature of the CPU, and warns the user above a certain threshold of heat, in my case if my CPU is above 60°C.
above a certain threshold of heat, in my case if my CPU is above 60°C.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/temperature] [module/temperature]
type = internal/temperature type = internal/temperature
@ -766,9 +617,7 @@
warn-temperature = 60 warn-temperature = 60
#+END_SRC #+END_SRC
The format of the module is the thermometer emoji followed by the The format of the module is the thermometer emoji followed by the temperature of the CPU. If the CPU becomes too hot, the text will change color for the secondary foreground color.
temperature of the CPU. If the CPU becomes too hot, the text will change
color for the secondary foreground color.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format = <label> format = <label>
format-underline = #f50a4d format-underline = #f50a4d
@ -790,21 +639,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-Window_title-3f931641 :CUSTOM_ID: Modules-Software-Window_title-3f931641
:END: :END:
This modules aim is to simply provide the name of the currently focused This modules aim is to simply provide the name of the currently focused window given by Xorg. This module is an internal module to polybar, that is to say it is built-in, and is of the type ~xwindow~. So, lets declare the module accordingly, including the piece of common code declared at the beginning of the chapter:
window given by Xorg. This module is an internal module to polybar, that is
to say it is built-in, and is of the type ~xwindow~. So, lets declare the
module accordingly, including the piece of common code declared at the
beginning of the chapter:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/xwindow] [module/xwindow]
type = internal/xwindow type = internal/xwindow
<<mod-prefix-col>> <<mod-prefix-col>>
#+END_SRC #+END_SRC
Now we can take care of the label, which is the actual text that will be Now we can take care of the label, which is the actual text that will be displayed. In our case, we want the label to be the title of the current X window, hence the value of ~label~, and we dont want it to be too long, though Im not sure Ive often seen window titles longer than 70 characters.
displayed. In our case, we want the label to be the title of the current X
window, hence the value of ~label~, and we dont want it to be too long,
though Im not sure Ive often seen window titles longer than 70 characters.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
label = %title% label = %title%
label-maxlen = 70 label-maxlen = 70
@ -814,18 +656,13 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-i3-db36ddfb :CUSTOM_ID: Modules-Software-i3-db36ddfb
:END: :END:
Now comes the module for i3 interaction. Thanks to this module, it is Now comes the module for i3 interaction. Thanks to this module, it is possible to show which workspaces are active and focused, and it is possible to change workspaces by clicking on the ones displayed in the bar. First, lets declare it; it is an internal module by the way.
possible to show which workspaces are active and focused, and it is possible
to change workspaces by clicking on the ones displayed in the bar. First,
lets declare it; it is an internal module by the way.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/i3] [module/i3]
type = internal/i3 type = internal/i3
#+END_SRC #+END_SRC
Now, lets display only the workspaces that are on the current output. This Now, lets display only the workspaces that are on the current output. This means if a workspace is either inactive or on another screen or output, it wont be displayed.
means if a workspace is either inactive or on another screen or output, it
wont be displayed.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
pin-workspaces = true pin-workspaces = true
#+END_SRC #+END_SRC
@ -835,10 +672,7 @@
index-sort = true index-sort = true
#+END_SRC #+END_SRC
I dont want to be able to scroll through the workspaces when my mouse is I dont want to be able to scroll through the workspaces when my mouse is hovering the module: when it happens, most of the time it was done accidentally. So lets deactivate that. However, I sometimes like to click on them to switch from one another, so well keep that activated.
hovering the module: when it happens, most of the time it was done
accidentally. So lets deactivate that. However, I sometimes like to click
on them to switch from one another, so well keep that activated.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
enable-scroll = false enable-scroll = false
wrapping-scroll = false wrapping-scroll = false
@ -851,24 +685,17 @@
strip-wsnumbers = false strip-wsnumbers = false
#+END_SRC #+END_SRC
An on the topic of workspaces name, ~fuzzy-match~ allows the user to use An on the topic of workspaces name, ~fuzzy-match~ allows the user to use fuzzy search for workspaces name when we will be applying custom names below. Not really useful since I only use the default workspaces name, but its good to have it enabled by default.
fuzzy search for workspaces name when we will be applying custom names
below. Not really useful since I only use the default workspaces name, but
its good to have it enabled by default.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
fuzzy-match = true fuzzy-match = true
#+END_SRC #+END_SRC
The label format is described first by its label, but also by one of its The label format is described first by its label, but also by one of its three possible modes: focused, visible or unfocused. These will be discussed later, but for now lets simply set our format.
three possible modes: focused, visible or unfocused. These will be discussed
later, but for now lets simply set our format.
#+begin_src conf-windows #+begin_src conf-windows
format = <label-state> <label-mode> format = <label-state> <label-mode>
#+end_src #+end_src
We also wand to set the label mode to be whichever mode the workspace We also wand to set the label mode to be whichever mode the workspace described by polybar is in. This label will also have a padding of 2 pixels, and the text will be written in white.
described by polybar is in. This label will also have a padding of 2 pixels,
and the text will be written in white.
#+begin_src conf-windows #+begin_src conf-windows
label-mode = %mode% label-mode = %mode%
label-mode-padding = 2 label-mode-padding = 2
@ -879,9 +706,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-i3-Workspace_icons-89237191 :CUSTOM_ID: Modules-Software-i3-Workspace_icons-89237191
:END: :END:
Now, lets name our workspaces. We can give them whatever name we want them Now, lets name our workspaces. We can give them whatever name we want them to have, but I just like the aesthetics of Japanese characters, so lets go with the kanji equivalent of the number of the workspaces.
to have, but I just like the aesthetics of Japanese characters, so lets go
with the kanji equivalent of the number of the workspaces.
#+NAME: ws-names #+NAME: ws-names
| workspace number | name | | workspace number | name |
|------------------+------| |------------------+------|
@ -901,8 +726,7 @@
<<font-ws-config(text="ws",table=ws-names)>> <<font-ws-config(text="ws",table=ws-names)>>
#+END_SRC #+END_SRC
In case we create a workspace which isnt named from ~0~ to ~9~, I want it In case we create a workspace which isnt named from ~0~ to ~9~, I want it to appear as is.
to appear as is.
#+begin_src conf-windows #+begin_src conf-windows
ws-icon-default = %index% ws-icon-default = %index%
#+end_src #+end_src
@ -911,11 +735,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-i3-Focused_workspaces-0ca3b93d :CUSTOM_ID: Modules-Software-i3-Focused_workspaces-0ca3b93d
:END: :END:
Now we can define the label itself. First, we will need to define the label Now we can define the label itself. First, we will need to define the label when the workspace is focused. Well simply take the alternative background for the focused label, and the underline will be defined from Xrdbs 8th color, with yellow as the fallback color. It will also have a two pixels padding. The text itself will be the dynamic icons declared above.
when the workspace is focused. Well simply take the alternative background
for the focused label, and the underline will be defined from Xrdbs 8th
color, with yellow as the fallback color. It will also have a two pixels
padding. The text itself will be the dynamic icons declared above.
#+begin_src conf-windows #+begin_src conf-windows
label-focused = %icon% label-focused = %icon%
label-focused-background = ${colors.background-alt} label-focused-background = ${colors.background-alt}
@ -927,13 +747,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-i3-Visible_workspaces-4be78e50 :CUSTOM_ID: Modules-Software-i3-Visible_workspaces-4be78e50
:END: :END:
The ~visible~ label is related to the ~focused~ labels since it is The ~visible~ label is related to the ~focused~ labels since it is describing workspaces that can be seen, but are not currently focused, i.e. a workspace that appears on another screen than the one currently used so it is visible, but it isnt focused. The difference with the ~unfocused~ workspaces is that the latter are neither focused nor visible. As you can see, we are simply using all of the declarations from above for the focused labels so we can ensure they appear the same way the focused labels do.
describing workspaces that can be seen, but are not currently focused, i.e.
a workspace that appears on another screen than the one currently used so
it is visible, but it isnt focused. The difference with the ~unfocused~
workspaces is that the latter are neither focused nor visible. As you can
see, we are simply using all of the declarations from above for the focused
labels so we can ensure they appear the same way the focused labels do.
#+begin_src conf-windows #+begin_src conf-windows
label-visible = ${self.label-focused} label-visible = ${self.label-focused}
label-visible-background = ${self.label-focused-background} label-visible-background = ${self.label-focused-background}
@ -945,9 +759,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-i3-Unfocused_workspaces-13063042 :CUSTOM_ID: Modules-Software-i3-Unfocused_workspaces-13063042
:END: :END:
When it comes to the unfocused label, there wont be any custom background When it comes to the unfocused label, there wont be any custom background or underline, so well just copy the two remaining lines from the focused labels for unfocused labels.
or underline, so well just copy the two remaining lines from the focused
labels for unfocused labels.
#+begin_src conf-windows #+begin_src conf-windows
label-unfocused = %icon% label-unfocused = %icon%
label-unfocused-padding = 2 label-unfocused-padding = 2
@ -957,12 +769,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-i3-Urgent_workspaces-ed2bd93c :CUSTOM_ID: Modules-Software-i3-Urgent_workspaces-ed2bd93c
:END: :END:
Lastly, we get our urgent workspaces: workspaces in which most of the time Lastly, we get our urgent workspaces: workspaces in which most of the time its just a popup that appeared or a software that finally launched itself while working on something else on another workspace. To make it a bit more unique, lets declare its background as being the color 0 from xrdb, with some dark red as the fallback color. And as the other labels, the text will be the icon and it will have a two pixels padding.
its just a popup that appeared or a software that finally launched itself
while working on something else on another workspace. To make it a bit more
unique, lets declare its background as being the color 0 from xrdb, with
some dark red as the fallback color. And as the other labels, the text will
be the icon and it will have a two pixels padding.
#+begin_src conf-windows #+begin_src conf-windows
label-urgent = %icon% label-urgent = %icon%
label-urgent-background = ${xrdb:color0:#bd2c40} label-urgent-background = ${xrdb:color0:#bd2c40}
@ -973,9 +780,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-Mpd-4b1ec78e :CUSTOM_ID: Modules-Software-Mpd-4b1ec78e
:END: :END:
Mpd is a music server for GNU/Linux systems that interfaces will several Mpd is a music server for GNU/Linux systems that interfaces will several front-ends, including ncmpcpp (the main one I use), ncmpcpp and mpc. It also interfaces with polybar thanks to some built in commands.
front-ends, including ncmpcpp (the main one I use), ncmpcpp and mpc. It also
interfaces with polybar thanks to some built in commands.
First, lets declare our module as an internal module. First, lets declare our module as an internal module.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
@ -983,17 +788,14 @@
type = internal/mpd type = internal/mpd
#+END_SRC #+END_SRC
The next thing we want to do is set the label for the module: we will The next thing we want to do is set the label for the module: we will display both the title and the name of the artist of the song playing. The maximum length will be 70 characters.
display both the title and the name of the artist of the song playing. The
maximum length will be 70 characters.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
label-song = %title% - %artist% label-song = %title% - %artist%
label-song-maxlen = 70 label-song-maxlen = 70
label-song-ellipsis = true label-song-ellipsis = true
#+END_SRC #+END_SRC
While Mpd is online, the format of the module should be the control icons While Mpd is online, the format of the module should be the control icons and then the song label.
and then the song label.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format-online = <icon-prev> <toggle> <icon-next> <label-song> format-online = <icon-prev> <toggle> <icon-next> <label-song>
icon-prev = ⏭ icon-prev = ⏭
@ -1003,8 +805,7 @@
icon-next = ⏭ icon-next = ⏭
#+END_SRC #+END_SRC
If Mpd is offline, then I would like to display a short messages that tells If Mpd is offline, then I would like to display a short messages that tells the user so.
the user so.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
format-offline = <label-offline> format-offline = <label-offline>
label-offline = 🎵 mpd is offline label-offline = 🎵 mpd is offline
@ -1014,23 +815,20 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Modules-Software-Date-f7338626 :CUSTOM_ID: Modules-Software-Date-f7338626
:END: :END:
This module is really simple: it gives the current date. It is an internal This module is really simple: it gives the current date. It is an internal module, and as declared below, it updates every second:
module, and as declared below, it updates every second:
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
[module/date] [module/date]
type = internal/date type = internal/date
interval = 1 interval = 1
#+END_SRC #+END_SRC
The main date and time format is the standard one, following the ISO-8601 The main date and time format is the standard one, following the ISO-8601 standard.
standard.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
date = %Y-%m-%d date = %Y-%m-%d
time = %H-%M-%S time = %H-%M-%S
#+END_SRC #+END_SRC
It also has an alternative format which I occasionally use, which displays It also has an alternative format which I occasionally use, which displays the date and time in the Japanese format.
the date and time in the Japanese format.
#+BEGIN_SRC conf-windows #+BEGIN_SRC conf-windows
date-alt = %A %d, %B date-alt = %A %d, %B
time-alt = %H:%M:%S time-alt = %H:%M:%S
@ -1054,6 +852,5 @@
[fn:1] [[https://github.com/polybar/polybar/wiki/Fonts][https://github.com/polybar/polybar/wiki/Fonts]] [fn:1] [[https://github.com/polybar/polybar/wiki/Fonts][https://github.com/polybar/polybar/wiki/Fonts]]
# LocalWords: Siji pixelsize Fira Mincho IPAMincho Unifont unifont fontformat # LocalWords: Siji pixelsize Fira Mincho IPAMincho Unifont unifont fontformat
# LocalWords: truetype antialias xwindow wlan eth acpi cpu # LocalWords: truetype antialias xwindow wlan eth acpi cpu

View File

@ -10,9 +10,7 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Introduction-465e99fe :CUSTOM_ID: Introduction-465e99fe
:END: :END:
The ~.rustfmt.toml~ file located in the ~$HOME~ directory is a global The ~.rustfmt.toml~ file located in the ~$HOME~ directory is a global configuration file for Rusts code formatters, such as ~rustfmt~. In this file, you can find how my Rust code is always formatted.
configuration file for Rusts code formatters, such as ~rustfmt~. In this
file, you can find how my Rust code is always formatted.
* General settings * General settings
:PROPERTIES: :PROPERTIES:
@ -22,22 +20,18 @@
#+BEGIN_SRC toml #+BEGIN_SRC toml
edition = "2018" edition = "2018"
#+END_SRC #+END_SRC
Put single-expression functions on a single line. Put single-expression functions on a single line.
#+BEGIN_SRC toml #+BEGIN_SRC toml
fn_single_line = true fn_single_line = true
#+END_SRC #+END_SRC
Format string literals where necessary. Format string literals where necessary.
#+BEGIN_SRC toml #+BEGIN_SRC toml
format_strings = true format_strings = true
#+END_SRC #+END_SRC
Maximum width of each line Maximum width of each line
#+BEGIN_SRC toml #+BEGIN_SRC toml
max_width = 80 max_width = 80
#+END_SRC #+END_SRC
Merge multiple imports into a single nested import. Merge multiple imports into a single nested import.
#+BEGIN_SRC toml #+BEGIN_SRC toml
merge_imports = true merge_imports = true
@ -47,21 +41,16 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Structs_and_Enums-6a2a856d :CUSTOM_ID: Structs_and_Enums-6a2a856d
:END: :END:
The maximum length of enum variant having discriminant, that gets vertically The maximum length of enum variant having discriminant, that gets vertically aligned with others. Variants without discriminants would be ignored for the purpose of alignment.
aligned with others. Variants without discriminants would be ignored for the
purpose of alignment.
Note that this is not how much whitespace is inserted, but instead the longest Note that this is not how much whitespace is inserted, but instead the longest variant name that doesn't get ignored when aligning.
variant name that doesn't get ignored when aligning.
#+BEGIN_SRC toml #+BEGIN_SRC toml
enum_discrim_align_threshold = 20 enum_discrim_align_threshold = 20
#+END_SRC #+END_SRC
The maximum diff of width between struct fields to be aligned with each other. The maximum diff of width between struct fields to be aligned with each other.
#+BEGIN_SRC toml #+BEGIN_SRC toml
struct_field_align_threshold = 20 struct_field_align_threshold = 20
#+END_SRC #+END_SRC
Reorder impl items. ~type~ and ~const~ are put first, then macros and methods. Reorder impl items. ~type~ and ~const~ are put first, then macros and methods.
#+BEGIN_SRC toml #+BEGIN_SRC toml
reorder_impl_items = true reorder_impl_items = true
@ -75,17 +64,14 @@
#+BEGIN_SRC toml #+BEGIN_SRC toml
normalize_comments = true normalize_comments = true
#+END_SRC #+END_SRC
Break comments to fit on the line. Break comments to fit on the line.
#+BEGIN_SRC toml #+BEGIN_SRC toml
wrap_comments = true wrap_comments = true
#+END_SRC #+END_SRC
Report ~FIXME~ items in comments. Report ~FIXME~ items in comments.
#+BEGIN_SRC toml #+BEGIN_SRC toml
report_fixme = "Always" report_fixme = "Always"
#+END_SRC #+END_SRC
Report ~TODO~ items in comments. Report ~TODO~ items in comments.
#+BEGIN_SRC toml #+BEGIN_SRC toml
todo = "Always" todo = "Always"
@ -99,7 +85,6 @@
#+BEGIN_SRC toml #+BEGIN_SRC toml
format_code_in_doc_comments = true format_code_in_doc_comments = true
#+END_SRC #+END_SRC
Convert ~#![doc]~ and ~#[doc]~ attributes to ~//!~ and ~///~ doc comments. Convert ~#![doc]~ and ~#[doc]~ attributes to ~//!~ and ~///~ doc comments.
#+BEGIN_SRC toml #+BEGIN_SRC toml
normalize_doc_attributes = true normalize_doc_attributes = true
@ -109,17 +94,14 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Whitespace-e8792b44 :CUSTOM_ID: Whitespace-e8792b44
:END: :END:
Use tab characters for indentation, spaces for alignment. Use tab characters for indentation, spaces for alignment.
#+BEGIN_SRC toml #+BEGIN_SRC toml
hard_tabs = false hard_tabs = false
#+END_SRC #+END_SRC
Number of spaces per tab. Number of spaces per tab.
#+BEGIN_SRC toml #+BEGIN_SRC toml
tab_spaces = 4 tab_spaces = 4
#+END_SRC #+END_SRC
I want newlines to always be Unix style. I want newlines to always be Unix style.
#+BEGIN_SRC toml #+BEGIN_SRC toml
newline_style = "Unix" newline_style = "Unix"

View File

@ -10,40 +10,33 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Presentation-0b37c6c0 :CUSTOM_ID: Presentation-0b37c6c0
:END: :END:
I dont really use tmux often, but I certainly do like a nice presentation and I dont really use tmux often, but I certainly do like a nice presentation and useful features, hence this configuration. This config file is inspired by gpakoszs tmux configuration repo you can find [[https://github.com/gpakosz/.tmux][here]].
useful features, hence this configuration. This config file is inspired by
gpakoszs tmux configuration repo you can find [[https://github.com/gpakosz/.tmux][here]].
* Windows and pane creation * Windows and pane creation
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Windows_and_pane_creation-66275518 :CUSTOM_ID: Windows_and_pane_creation-66275518
:END: :END:
Whether if a new *window* will retain the current path. Possible values are: Whether if a new *window* will retain the current path. Possible values are:
- true - ~true~
- false (default) - ~false~ (default)
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_new_window_retain_current_path=true tmux_conf_new_window_retain_current_path=true
#+END_SRC #+END_SRC
Whether if a new *pane* should retain the current path. Possible values are: Whether if a new *pane* should retain the current path. Possible values are:
- true (default) - ~true~ (default)
- false - ~false~
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_new_window_retain_current_path=true tmux_conf_new_window_retain_current_path=true
#+END_SRC #+END_SRC
Whether or not tmux should attempt to reconnect to the current ssh session. This is still experimental. Possible values are:
Whether or not tmux should attempt to reconnect to the current ssh session. - ~true~
This is still experimental. Possible values are: - ~false~ (default)
- true
- false (default)
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_new_pane_reconnect_ssh=true tmux_conf_new_pane_reconnect_ssh=true
#+END_SRC #+END_SRC
Whether tmux should prompt for new session name when creating a new one. Possible values are:
Whether tmux should prompt for new session name when creating a new one. - ~true~
Possible values are: - ~false~ (default)
- true
- false (default)
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_new_session_prompt=false tmux_conf_new_session_prompt=false
#+END_SRC #+END_SRC
@ -52,28 +45,23 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Display-d5ae1908 :CUSTOM_ID: Display-d5ae1908
:END: :END:
Whether to activate RGB 24-bit color support (only available in tmux >= 2.2). Whether to activate RGB 24-bit color support (only available in tmux >= 2.2). Possible values are:
Possible values are: - ~true~
- true - ~false~ (default)
- false (default)
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_24b_colour=false tmux_conf_theme_24b_colour=false
#+END_SRC #+END_SRC
These variables are for chosing the window style. I use the default one. These variables are for chosing the window style. I use the default one.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_window_fg='default' tmux_conf_theme_window_fg='default'
tmux_conf_theme_window_bg='default' tmux_conf_theme_window_bg='default'
#+END_SRC #+END_SRC
Whether the focused pane should be highlighted (only available in tmux >= 2.1). Possible values are:
Whether the focused pane should be highlighted (only available in tmux >= - ~true~
2.1). Possible values are: - ~false~ (default)
- true
- false (default)
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_highlight_focused_pane=false tmux_conf_theme_highlight_focused_pane=false
#+END_SRC #+END_SRC
Set the terminal title. Built-in variables are: Set the terminal title. Built-in variables are:
- =#{circled_window_index}= - =#{circled_window_index}=
- =#{circled_session_name}= - =#{circled_session_name}=
@ -84,10 +72,7 @@
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_terminal_title='#h ❐ #S ● #I #W' tmux_conf_theme_terminal_title='#h ❐ #S ● #I #W'
#+END_SRC #+END_SRC
These variables set the left/right separators between sections. With the current values, you dont need to install Powerline, but only fonts patched with Powerline symbols or the standalone PowerlineSymbols.otf font.
These variables set the left/right separators between sections. With the
current values, you dont need to install Powerline, but only fonts patched
with Powerline symbols or the standalone PowerlineSymbols.otf font.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_left_separator_main='\uE0B0' tmux_conf_theme_left_separator_main='\uE0B0'
tmux_conf_theme_left_separator_sub='\uE0B1' tmux_conf_theme_left_separator_sub='\uE0B1'
@ -99,58 +84,47 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Display-Colors_and_style-0994a014 :CUSTOM_ID: Display-Colors_and_style-0994a014
:END: :END:
Colors displayed in tmux can be chosen thanks to the following variables. Any Colors displayed in tmux can be chosen thanks to the following variables. Any color should be formatted as a hexadecimal RGB value preceded by a pound sign =#= (e.g. =#00afff= for light blue) or =default= to let our terminal set it for us.
color should be formatted as a hexadecimal RGB value preceded by a pound sign
=#= (e.g. =#00afff= for light blue) or =default= to let our terminal set it
for us.
Choose the style of the pane borders. Possible values are: Choose the style of the pane borders. Possible values are:
- thin (default) - ~thin~ (default)
- fat - ~fat~
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_pane_border_style=thin tmux_conf_theme_pane_border_style=thin
#+END_SRC #+END_SRC
Declare what the colors of the focused pane should be. The first variable specifies the foreground color, the other the background color.
Declare what the colors of the focused pane should be. The first variable
specifies the foreground color, the other the background color.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_focused_pane_fg='default' tmux_conf_theme_focused_pane_fg='default'
tmux_conf_theme_focused_pane_bg='#0087d7' tmux_conf_theme_focused_pane_bg='#0087d7'
#+END_SRC #+END_SRC
Here you can set the colors of the pane borders. Here you can set the colors of the pane borders.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_pane_border='#444444' tmux_conf_theme_pane_border='#444444'
tmux_conf_theme_pane_active_border='#00afff' tmux_conf_theme_pane_active_border='#00afff'
#+END_SRC #+END_SRC
With these variables, you can set the colors for the pane indicators. With these variables, you can set the colors for the pane indicators.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_pane_indicator='#00afff' tmux_conf_theme_pane_indicator='#00afff'
tmux_conf_theme_pane_active_indicator='#00afff' tmux_conf_theme_pane_active_indicator='#00afff'
#+END_SRC #+END_SRC
These variables set the colors and the style of the status line. These variables set the colors and the style of the status line.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_message_fg='#000000' tmux_conf_theme_message_fg='#000000'
tmux_conf_theme_message_bg='#ffff00' tmux_conf_theme_message_bg='#ffff00'
tmux_conf_theme_message_attr='bold' tmux_conf_theme_message_attr='bold'
#+END_SRC #+END_SRC
Same as above for the status line command style. Same as above for the status line command style.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_message_command_fg='#ffff00' tmux_conf_theme_message_command_fg='#ffff00'
tmux_conf_theme_message_command_bg='#000000' tmux_conf_theme_message_command_bg='#000000'
tmux_conf_theme_message_command_attr='bold' tmux_conf_theme_message_command_attr='bold'
#+END_SRC #+END_SRC
These variables set the style of the window modes. These variables set the style of the window modes.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_mode_fg='#000000' tmux_conf_theme_mode_fg='#000000'
tmux_conf_theme_mode_bg='#ffff00' tmux_conf_theme_mode_bg='#ffff00'
tmux_conf_theme_mode_attr='bold' tmux_conf_theme_mode_attr='bold'
#+END_SRC #+END_SRC
Set the style of the status line. Set the style of the status line.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_status_fg='#8a8a8a' tmux_conf_theme_status_fg='#8a8a8a'
@ -170,7 +144,6 @@
tmux_conf_theme_window_status_bg='#080808' tmux_conf_theme_window_status_bg='#080808'
tmux_conf_theme_window_status_attr='none' tmux_conf_theme_window_status_attr='none'
#+END_SRC #+END_SRC
Sets the format of the window status. Built-in variables are: Sets the format of the window status. Built-in variables are:
- =#{circled_window_index}= - =#{circled_window_index}=
- =#{circled_session_name}= - =#{circled_session_name}=
@ -181,14 +154,12 @@
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_window_status_format='#I #W' tmux_conf_theme_window_status_format='#I #W'
#+END_SRC #+END_SRC
Sets the colors and style of the current window status. Sets the colors and style of the current window status.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_window_status_current_fg='#000000' tmux_conf_theme_window_status_current_fg='#000000'
tmux_conf_theme_window_status_current_bg='#00afff' tmux_conf_theme_window_status_current_bg='#00afff'
tmux_conf_theme_window_status_current_attr='bold' tmux_conf_theme_window_status_current_attr='bold'
#+END_SRC #+END_SRC
Sets the format of the currentwindow status. Built-in variables are: Sets the format of the currentwindow status. Built-in variables are:
- =#{circled_window_index}= - =#{circled_window_index}=
- =#{circled_session_name}= - =#{circled_session_name}=
@ -199,30 +170,25 @@
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_window_status_current_format='#I #W' tmux_conf_theme_window_status_current_format='#I #W'
#+END_SRC #+END_SRC
Sets the window activity status style. Sets the window activity status style.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_window_status_activity_fg='default' tmux_conf_theme_window_status_activity_fg='default'
tmux_conf_theme_window_status_activity_bg='default' tmux_conf_theme_window_status_activity_bg='default'
tmux_conf_theme_window_status_activity_attr='underscore' tmux_conf_theme_window_status_activity_attr='underscore'
#+END_SRC #+END_SRC
Sets the window bell status style. Sets the window bell status style.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_window_status_bell_fg='#ffff00' tmux_conf_theme_window_status_bell_fg='#ffff00'
tmux_conf_theme_window_status_bell_bg='default' tmux_conf_theme_window_status_bell_bg='default'
tmux_conf_theme_window_status_bell_attr='blink,bold' tmux_conf_theme_window_status_bell_attr='blink,bold'
#+END_SRC #+END_SRC
Sets the window last status style. Sets the window last status style.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_window_status_last_fg='#00afff' tmux_conf_theme_window_status_last_fg='#00afff'
tmux_conf_theme_window_status_last_bg='default' tmux_conf_theme_window_status_last_bg='default'
tmux_conf_theme_window_status_last_attr='none' tmux_conf_theme_window_status_last_attr='none'
#+END_SRC #+END_SRC
Sets the left and right content of the status bar of tmux. Sections should be separated with =|=, subsections with =,=. The built-in values are:
Sets the left and right content of the status bar of tmux. Sections should be
separated with =|=, subsections with =,=. The built-in values are:
- =#{battery_bar}= - =#{battery_bar}=
- =#{battery_hbar}= - =#{battery_hbar}=
- =#{battery_percentage}= - =#{battery_percentage}=
@ -247,21 +213,18 @@
tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} ' tmux_conf_theme_status_left=' ❐ #S | ↑#{?uptime_y, #{uptime_y}y,}#{?uptime_d, #{uptime_d}d,}#{?uptime_h, #{uptime_h}h,}#{?uptime_m, #{uptime_m}m,} '
tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} ' tmux_conf_theme_status_right='#{prefix}#{pairing}#{synchronized} #{?battery_status, #{battery_status},}#{?battery_bar, #{battery_bar},}#{?battery_percentage, #{battery_percentage},} , %R , %d %b | #{username}#{root} | #{hostname} '
#+END_SRC #+END_SRC
Sets the left status style and colors. Sets the left status style and colors.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4' tmux_conf_theme_status_left_fg='#000000,#e4e4e4,#e4e4e4'
tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff' tmux_conf_theme_status_left_bg='#ffff00,#ff00af,#00afff'
tmux_conf_theme_status_left_attr='bold,none,none' tmux_conf_theme_status_left_attr='bold,none,none'
#+END_SRC #+END_SRC
Sets the right status style and colors. Sets the right status style and colors.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000' tmux_conf_theme_status_right_fg='#8a8a8a,#e4e4e4,#000000'
tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4' tmux_conf_theme_status_right_bg='#080808,#d70000,#e4e4e4'
tmux_conf_theme_status_right_attr='none,none,bold' tmux_conf_theme_status_right_attr='none,none,bold'
#+END_SRC #+END_SRC
Set the pairing indicator, its style and its attribute. Set the pairing indicator, its style and its attribute.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_pairing='👓 ' # U+1F453 tmux_conf_theme_pairing='👓 ' # U+1F453
@ -269,7 +232,6 @@
tmux_conf_theme_pairing_bg='none' tmux_conf_theme_pairing_bg='none'
tmux_conf_theme_pairing_attr='none' tmux_conf_theme_pairing_attr='none'
#+END_SRC #+END_SRC
Set the pairing indicator, its style and its attribute. Set the pairing indicator, its style and its attribute.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
# prefix indicator # prefix indicator
@ -278,7 +240,6 @@
tmux_conf_theme_prefix_bg='none' tmux_conf_theme_prefix_bg='none'
tmux_conf_theme_prefix_attr='none' tmux_conf_theme_prefix_attr='none'
#+END_SRC #+END_SRC
Set the root indicator, its style and its attribute. Set the root indicator, its style and its attribute.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_root='!' tmux_conf_theme_root='!'
@ -286,7 +247,6 @@
tmux_conf_theme_root_bg='none' tmux_conf_theme_root_bg='none'
tmux_conf_theme_root_attr='bold,blink' tmux_conf_theme_root_attr='bold,blink'
#+END_SRC #+END_SRC
Set the synchronized indicator, its style and its attribute. Set the synchronized indicator, its style and its attribute.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_synchronized='🔒' # U+1F512 tmux_conf_theme_synchronized='🔒' # U+1F512
@ -294,49 +254,39 @@
tmux_conf_theme_synchronized_bg='none' tmux_conf_theme_synchronized_bg='none'
tmux_conf_theme_synchronized_attr='none' tmux_conf_theme_synchronized_attr='none'
#+END_SRC #+END_SRC
Set the battery bar symbols. Set the battery bar symbols.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_battery_bar_symbol_full='◼' tmux_conf_battery_bar_symbol_full='◼'
tmux_conf_battery_bar_symbol_empty='◻' tmux_conf_battery_bar_symbol_empty='◻'
#+END_SRC #+END_SRC
Set the battery bar length in terms of amount of symbols. Possible values are:
Set the battery bar length in terms of amount of symbols. Possible values
are:
- =auto= - =auto=
- an integer number, e.g. 5 - an integer number, e.g. 5
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_battery_bar_length='auto' tmux_conf_battery_bar_length='auto'
#+END_SRC #+END_SRC
Set the battery bar palette. Possible values are: Set the battery bar palette. Possible values are:
- =gradient= (default) - =gradient= (default)
- =heat= - =heat=
- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB - =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB value preceded by a pound symbol =#=.
value preceded by a pound symbol =#=.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_battery_bar_palette='gradient' tmux_conf_battery_bar_palette='gradient'
#tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000' #tmux_conf_battery_bar_palette='#d70000,#e4e4e4,#000000'
#+END_SRC #+END_SRC
Set the hbar palette. Possible values are: Set the hbar palette. Possible values are:
- =gradient= (default) - =gradient= (default)
- =heat= - =heat=
- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB - =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB value preceded by a pound symbol =#=.
value preceded by a pound symbol =#=.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_battery_hbar_palette='gradient' tmux_conf_battery_hbar_palette='gradient'
#+END_SRC #+END_SRC
Set the vbar palette. Possible values are: Set the vbar palette. Possible values are:
- =gradient= (default) - =gradient= (default)
- =heat= - =heat=
- =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB - =color_full_fg,color_empty_fg,color_bg= with each being an hexadecimal RGB value preceded by a pound symbol =#=.
value preceded by a pound symbol =#=.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_battery_vbar_palette='gradient' tmux_conf_battery_vbar_palette='gradient'
#+END_SRC #+END_SRC
Set symbols used to indicate whether the battery is charging or discharging. Set symbols used to indicate whether the battery is charging or discharging.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_battery_status_charging='⚡ ' # U+26A1 tmux_conf_battery_status_charging='⚡ ' # U+26A1
@ -345,10 +295,7 @@
# tmux_conf_battery_status_discharging='↓' # U+2193 # tmux_conf_battery_status_discharging='↓' # U+2193
#tmux_conf_battery_status_charging='🔌 ' # U+1F50C #tmux_conf_battery_status_charging='🔌 ' # U+1F50C
#+END_SRC #+END_SRC
Set the clock style. If it is displayed on the right side of the status bar, it might be better to use =%I:%M %p= rather than =%R= in =tmux_conf_theme_status_right=.
Set the clock style. If it is displayed on the right side of the status bar,
it might be better to use =%I:%M %p= rather than =%R= in
=tmux_conf_theme_status_right=.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_theme_clock_colour='#00afff' tmux_conf_theme_clock_colour='#00afff'
tmux_conf_theme_clock_style='24' tmux_conf_theme_clock_style='24'
@ -358,10 +305,9 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: Clipboard-66d0d03a :CUSTOM_ID: Clipboard-66d0d03a
:END: :END:
Whether if in copy mode, copying the selection also copies to the OS Whether if in copy mode, copying the selection also copies to the OS clipboard. Possible values are:
clipboard. Possible values are: - ~true~
- true - ~false~ (default)
- false (default)
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
tmux_conf_copy_to_os_clipboard=false tmux_conf_copy_to_os_clipboard=false
#+END_SRC #+END_SRC
@ -370,27 +316,20 @@
:PROPERTIES: :PROPERTIES:
:CUSTOM_ID: User_customizations-c913b5d7 :CUSTOM_ID: User_customizations-c913b5d7
:END: :END:
Here we can override or undo some setting from settings from tmux. First, we Here we can override or undo some setting from settings from tmux. First, we can increase the history size.
can increase the history size.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
set -g history-limit 10000 set -g history-limit 10000
#+END_SRC #+END_SRC
We can also start with mouse mode enabled. But I dont. We can also start with mouse mode enabled. But I dont.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
#set -g mouse on #set -g mouse on
#+END_SRC #+END_SRC
Whether or not Vi mode should be enabled. But really, we should rather export the =VISUAL= or =EDITOR= environment variables, see the tmux manual. Although I dont, as said in my dotfish, I prefer to use Emacs.
Whether or not Vi mode should be enabled. But really, we should rather export
the =VISUAL= or =EDITOR= environment variables, see the tmux manual. Although
I dont, as said in my dotfish, I prefer to use Emacs.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
#set -g status-keys vi #set -g status-keys vi
#set -g mode-keys vi #set -g mode-keys vi
#+END_SRC #+END_SRC
Replace =C-b= by =C-a= instead of using both prefixes. I personally prefer to just use =C-b=, hence why the lines are commented.
Replace =C-b= by =C-a= instead of using both prefixes. I personally prefer to
just use =C-b=, hence why the lines are commented.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
# set -gu prefix2 # set -gu prefix2
# unbind C-a # unbind C-a
@ -398,7 +337,6 @@
# set -g prefix C-a # set -g prefix C-a
# bind C-a send-prefix # bind C-a send-prefix
#+END_SRC #+END_SRC
Move the status line to the top. Move the status line to the top.
#+BEGIN_SRC conf-unix #+BEGIN_SRC conf-unix
#set -g status-position top #set -g status-position top