diff --git a/org/config/awesome.org b/org/config/awesome.org index 9156970..bc8c65b 100644 --- a/org/config/awesome.org +++ b/org/config/awesome.org @@ -11,122 +11,104 @@ :PROPERTIES: :CUSTOM_ID: Introduction-4c41360e :END: - 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. +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. - 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. +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. - 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~. +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~. * Loading libraries :PROPERTIES: :CUSTOM_ID: Loading_libraries-4df76999 :END: - First of all, some initialization is needed, and this initialization is about - math randomness. So, let’s initialize the ~random~ method of the ~math~ - library: - #+BEGIN_SRC lua - math.randomseed(os.time()) - #+END_SRC +First of all, some initialization is needed, and this initialization is about math randomness. So, let’s initialize the ~random~ method of the ~math~ library: +#+BEGIN_SRC lua + math.randomseed(os.time()) +#+END_SRC - 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. - #+BEGIN_SRC lua - pcall(require, "luarocks.loader") - #+END_SRC +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. +#+BEGIN_SRC lua + pcall(require, "luarocks.loader") +#+END_SRC - Next, we’ll also load the following libraries - #+NAME: table-imported-libraries - | Library | Import as | What it is | - |---------------------+---------------+---------------------------| - | gears | gears | Standard Awesome library | - | awful | awful | Standard Awesome library | - | wibox | wibox | Widget and layout library | - | beautiful | beautiful | Theme handling library | - | naughty | naughty | Notification library | - | menubar | menubar | Create menus | - | awful.hotkeys_popup | hotkeys_popup | Help window for hotkeys | +Next, we’ll also load the following libraries +#+NAME: table-imported-libraries +| Library | Import as | What it is | +|---------------------+---------------+---------------------------| +| gears | gears | Standard Awesome library | +| awful | awful | Standard Awesome library | +| wibox | wibox | Widget and layout library | +| beautiful | beautiful | Theme handling library | +| naughty | naughty | Notification library | +| menubar | menubar | Create menus | +| awful.hotkeys_popup | hotkeys_popup | Help window for hotkeys | - #+NAME: imported-libraries - #+BEGIN_SRC emacs-lisp :var libs=table-imported-libraries :cache yes - (mapconcat (lambda (x) (format "local %s = require(\"%s\")" - (cadr x) - (car x))) - libs - "\n") - #+END_SRC +#+NAME: imported-libraries +#+BEGIN_SRC emacs-lisp :var libs=table-imported-libraries :cache yes + (mapconcat (lambda (x) (format "local %s = require(\"%s\")" + (cadr x) + (car x))) + libs + "\n") +#+END_SRC - #+RESULTS[a66d7b66dbd4b4001dc3f649840b66761cc915b5]: imported-libraries - : local gears = require("gears") - : local awful = require("awful") - : local wibox = require("wibox") - : local beautiful = require("beautiful") - : local naughty = require("naughty") - : local menubar = require("menubar") - : local hotkeys_popup = require("awful.hotkeys_popup") +#+RESULTS[a66d7b66dbd4b4001dc3f649840b66761cc915b5]: imported-libraries +: local gears = require("gears") +: local awful = require("awful") +: local wibox = require("wibox") +: local beautiful = require("beautiful") +: local naughty = require("naughty") +: local menubar = require("menubar") +: local hotkeys_popup = require("awful.hotkeys_popup") - Here is the actual code in the config file: - #+BEGIN_SRC lua - <> - #+END_SRC +Here is the actual code in the config file: +#+BEGIN_SRC lua +<> +#+END_SRC - I also want to be able to autofocus the first window when I go to another - workspace, so let’s require that: - #+BEGIN_SRC lua - require("awful.autofocus") - #+END_SRC +I also want to be able to autofocus the first window when I go to another workspace, so let’s require that: +#+BEGIN_SRC lua + require("awful.autofocus") +#+END_SRC - And finally, I want to be able to declare some shortcuts specific to some - appls thanks to the hotkeys help widget. - #+BEGIN_SRC lua - require("awful.hotkeys_popup.keys") - #+END_SRC - - By the way, let’s initialize the ~random~ method of the ~math~ library: - #+BEGIN_SRC lua - math.randomseed(os.time()) - #+END_SRC +And finally, I want to be able to declare some shortcuts specific to some apps thanks to the hotkeys help widget. +#+BEGIN_SRC lua + require("awful.hotkeys_popup.keys") +#+END_SRC +By the way, let’s initialize the ~random~ method of the ~math~ library: +#+BEGIN_SRC lua + math.randomseed(os.time()) +#+END_SRC * Error handling :PROPERTIES: :CUSTOM_ID: Error_handling-f6a6668f :END: - 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. - #+BEGIN_SRC lua - if awesome.startup_errors then - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, there were errors during startup!", - text = awesome.startup_errors }) - end - #+END_SRC +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. +#+BEGIN_SRC lua + if awesome.startup_errors then + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, there were errors during startup!", + text = awesome.startup_errors }) + end +#+END_SRC - And this code handles runtime errors after startup thanks to signals. - #+BEGIN_SRC lua - do - local in_error = false - awesome.connect_signal("debug::error", function (err) - -- Make sure we don't go into an endless error loop - if in_error then return end - in_error = true +And this code handles runtime errors after startup thanks to signals. +#+BEGIN_SRC lua + do + local in_error = false + awesome.connect_signal("debug::error", function (err) + -- Make sure we don't go into an endless error loop + if in_error then return end + in_error = true - naughty.notify({ preset = naughty.config.presets.critical, - title = "Oops, an error happened!", - text = tostring(err) }) - in_error = false - end) - end - #+END_SRC + naughty.notify({ preset = naughty.config.presets.critical, + title = "Oops, an error happened!", + text = tostring(err) }) + in_error = false + end) + end +#+END_SRC * Variable definitions :PROPERTIES: @@ -136,42 +118,33 @@ :PROPERTIES: :CUSTOM_ID: Variable_definitions-Themes-591886b4 :END: - 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. - #+BEGIN_SRC lua - beautiful.init("/home/phundrak/.config/awesome/nord/theme.lua") - #+END_SRC +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. +#+BEGIN_SRC lua + beautiful.init("/home/phundrak/.config/awesome/nord/theme.lua") +#+END_SRC ** Default terminal and text editor :PROPERTIES: :CUSTOM_ID: Variable_definitions-Default_terminal_and_text_editor-44b84e20 :END: - The two following variables are set so that I don’t need to go over my whole - config file in order to modify which terminal or text editor I use, not that - I do it often though. - #+BEGIN_SRC lua - terminal = "st" - editor = os.getenv("EDITOR") or "emacsclient -c" - #+END_SRC +The two following variables are set so that I don’t need to go over my whole config file in order to modify which terminal or text editor I use, not that I do it often though. +#+BEGIN_SRC lua + terminal = "st" + editor = os.getenv("EDITOR") or "emacsclient -c" +#+END_SRC ** Keys :PROPERTIES: :CUSTOM_ID: Variable_definitions-Keys-b8def4ac :END: - 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. - #+BEGIN_SRC lua - modkey = "Mod4" - shift = "Shift" - control = "Control" - meta = "Mod1" - alt = "Mod1" -- Just in case - #+END_SRC +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. +#+BEGIN_SRC lua + modkey = "Mod4" + shift = "Shift" + control = "Control" + meta = "Mod1" + alt = "Mod1" -- Just in case +#+END_SRC * Custom functions :PROPERTIES: @@ -185,449 +158,414 @@ :PROPERTIES: :CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Set_a_random_wallpaper-104bbeec :END: - 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]]. - #+BEGIN_SRC lua - local function set_random_pape() - awful.spawn.with_shell("pape-update") - naughty.notify({ preset = naughty.config.presets.normal, - title = "Wallpaper change", - text = "Done!"}) - end - #+END_SRC +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]]. +#+BEGIN_SRC lua + local function set_random_pape() + awful.spawn.with_shell("pape-update") + naughty.notify({ preset = naughty.config.presets.normal, + title = "Wallpaper change", + text = "Done!"}) + end +#+END_SRC *** Restore previous wallpaper :PROPERTIES: :CUSTOM_ID: Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c :END: - I also wrote the following function that will restore the previously set - wallpaper: - #+BEGIN_SRC lua - local function set_wallpaper(_) - awful.spawn.with_shell("nitrogen --restore") - end - #+END_SRC +I also wrote the following function that will restore the previously set wallpaper: +#+BEGIN_SRC lua + local function set_wallpaper(_) + awful.spawn.with_shell("nitrogen --restore") + end +#+END_SRC ** Layout manipulation :PROPERTIES: :CUSTOM_ID: Custom_functions-Layout_manipulation-6bc7db06 :END: - The following function is used by a shortcut described below in - [[#Keybindings-Clients-f9f96d60]]. - #+BEGIN_SRC lua - local function client_go_back() - awful.client.focus.history.previous() - if client.focus then - client.focus:raise() - end - end - #+END_SRC +The following function is used by a shortcut described below in [[#Keybindings-Clients-f9f96d60]]. +#+BEGIN_SRC lua + local function client_go_back() + awful.client.focus.history.previous() + if client.focus then + client.focus:raise() + end + end +#+END_SRC ** Clients manipulation :PROPERTIES: :CUSTOM_ID: Custom_functions-Clients_manipulation-7e958fed :END: - #+BEGIN_SRC lua - local function restore_minimized_clients() - local c = awful.client.restore() - -- Focus restored client - if c then - c:emit_signal( - "request::activate", "key.unminimize", {raise = true} - ) - end - end - #+END_SRC - - #+BEGIN_SRC lua - local function toggle_fullscreen_client(c) - c.fullscreen = not c.fullscreen - c:raise() +#+BEGIN_SRC lua + local function restore_minimized_clients() + local c = awful.client.restore() + -- Focus restored client + if c then + c:emit_signal( + "request::activate", "key.unminimize", {raise = true} + ) end - #+END_SRC + end +#+END_SRC - #+BEGIN_SRC lua - local function toggle_maximized(c) - c.maximized = not c.maximized - c:raise() - end - #+END_SRC +#+BEGIN_SRC lua + local function toggle_fullscreen_client(c) + c.fullscreen = not c.fullscreen + c:raise() + end +#+END_SRC - #+BEGIN_SRC lua - local function toggle_vertical_maximized(c) - c.maximized_vertical = not c.maximized_vertical - c:raise() - end - #+END_SRC +#+BEGIN_SRC lua + local function toggle_maximized(c) + c.maximized = not c.maximized + c:raise() + end +#+END_SRC - #+BEGIN_SRC lua - local function toggle_horizontal_maximized(c) - c.maximized_horizontal = not c.maximized_horizontal - c:raise() - end - #+END_SRC +#+BEGIN_SRC lua + local function toggle_vertical_maximized(c) + c.maximized_vertical = not c.maximized_vertical + c:raise() + end +#+END_SRC + +#+BEGIN_SRC lua + local function toggle_horizontal_maximized(c) + c.maximized_horizontal = not c.maximized_horizontal + c:raise() + end +#+END_SRC ** Tag manipulation :PROPERTIES: :CUSTOM_ID: Custom_functions-Tag_manipulation-5fc67669 :END: - #+BEGIN_SRC lua - local function view_tag_n(i) - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - tag:view_only() - end - end - #+END_SRC +#+BEGIN_SRC lua + local function view_tag_n(i) + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + tag:view_only() + end + end +#+END_SRC - #+BEGIN_SRC lua - local function toggle_tag_n(i) - local screen = awful.screen.focused() - local tag = screen.tags[i] - if tag then - awful.tag.viewtoggle(tag) - end - end - #+END_SRC +#+BEGIN_SRC lua + local function toggle_tag_n(i) + local screen = awful.screen.focused() + local tag = screen.tags[i] + if tag then + awful.tag.viewtoggle(tag) + end + end +#+END_SRC - #+BEGIN_SRC lua - local function move_focused_to_tag_n(i) - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:move_to_tag(tag) - end - end - end - #+END_SRC +#+BEGIN_SRC lua + local function move_focused_to_tag_n(i) + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:move_to_tag(tag) + end + end + end +#+END_SRC - #+BEGIN_SRC lua - local function toggle_focused_client_to_tag_n(i) - if client.focus then - local tag = client.focus.screen.tags[i] - if tag then - client.focus:toggle_tag(tag) - end - end - end - #+END_SRC +#+BEGIN_SRC lua + local function toggle_focused_client_to_tag_n(i) + if client.focus then + local tag = client.focus.screen.tags[i] + if tag then + client.focus:toggle_tag(tag) + end + end + end +#+END_SRC ** Awesome prompt :PROPERTIES: :CUSTOM_ID: Custom_functions-Awesome_prompt-de4fde50 :END: - #+BEGIN_SRC lua - local function invoke_lua_execute_prompt() - awful.prompt.run { - prompt = "Run Lua code: ", - textbox = awful.screen.focused().promptbox.widget, - exe_callback = awful.util.eval, - history_path = awful.util.get_cache_dir() .. "/history_eval" - } - end - #+END_SRC +#+BEGIN_SRC lua + local function invoke_lua_execute_prompt() + awful.prompt.run { + prompt = "Run Lua code: ", + textbox = awful.screen.focused().promptbox.widget, + exe_callback = awful.util.eval, + history_path = awful.util.get_cache_dir() .. "/history_eval" + } + end +#+END_SRC * Layouts :PROPERTIES: :CUSTOM_ID: Layouts-be55a7fd :END: - 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. - #+NAME: table-layouts - | Layout | Enabled? | - |-----------------+----------| - | magnifier | yes | - | tile.left | yes | - | tile | yes | - | tile.bottom | yes | - | tile.top | yes | - | max | yes | - | max.fullscreen | yes | - | floating | yes | - | fair | yes | - | fair.horizontal | yes | - | spiral | yes | - | spiral.dwindle | yes | - | corner.nw | no | - | corner.ne | no | - | corner.sw | no | - | corner.se | no | +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. +#+NAME: table-layouts +| Layout | Enabled? | +|-----------------+----------| +| magnifier | yes | +| tile.left | yes | +| tile | yes | +| tile.bottom | yes | +| tile.top | yes | +| max | yes | +| max.fullscreen | yes | +| floating | yes | +| fair | yes | +| fair.horizontal | yes | +| spiral | yes | +| spiral.dwindle | yes | +| corner.nw | no | +| corner.ne | no | +| corner.sw | no | +| corner.se | no | - #+NAME: list-layouts - #+BEGIN_SRC emacs-lisp :var layouts=table-layouts :cache yes - (mapconcat (lambda (x) (if (string= (cadr x) "yes") - (format "awful.layout.suit.%s,\n" (car x)))) - layouts - "") - #+END_SRC +#+NAME: list-layouts +#+BEGIN_SRC emacs-lisp :var layouts=table-layouts :cache yes + (mapconcat (lambda (x) (if (string= (cadr x) "yes") + (format "awful.layout.suit.%s,\n" (car x)))) + layouts + "") +#+END_SRC - #+RESULTS[0bd0312ff10526c8b24199453ff235cf71425fb5]: list-layouts - #+begin_example - awful.layout.suit.magnifier, - awful.layout.suit.tile, - awful.layout.suit.tile.left, - awful.layout.suit.tile.bottom, - awful.layout.suit.tile.top, - awful.layout.suit.max, - awful.layout.suit.max.fullscreen, - awful.layout.suit.floating, - awful.layout.suit.fair, - awful.layout.suit.fair.horizontal, - awful.layout.suit.spiral, - awful.layout.suit.spiral.dwindle, - #+end_example +#+RESULTS[0bd0312ff10526c8b24199453ff235cf71425fb5]: list-layouts +#+begin_example +awful.layout.suit.magnifier, +awful.layout.suit.tile, +awful.layout.suit.tile.left, +awful.layout.suit.tile.bottom, +awful.layout.suit.tile.top, +awful.layout.suit.max, +awful.layout.suit.max.fullscreen, +awful.layout.suit.floating, +awful.layout.suit.fair, +awful.layout.suit.fair.horizontal, +awful.layout.suit.spiral, +awful.layout.suit.spiral.dwindle, +#+end_example - Here is the code that activates these layouts: - #+BEGIN_SRC lua - awful.layout.layouts = { - <> - } - #+END_SRC +Here is the code that activates these layouts: +#+BEGIN_SRC lua + awful.layout.layouts = { + <> + } +#+END_SRC * Top bar :PROPERTIES: :CUSTOM_ID: Top_bar-d3117294 :END: - 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. +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. ** Menus :PROPERTIES: :CUSTOM_ID: Top_bar-Menus-cf468ca8 :END: - #+NAME: make-menu - #+BEGIN_SRC emacs-lisp :var menu=table-awesome-menu - (mapconcat (lambda (x) - (format "{ \"%s\", %s }" - (car x) - (mapconcat (lambda (y) (format "%s" y)) - (cdr x) - ","))) - menu - ",\n") - #+END_SRC +#+NAME: make-menu +#+BEGIN_SRC emacs-lisp :var menu=table-awesome-menu + (mapconcat (lambda (x) + (format "{ \"%s\", %s }" + (car x) + (mapconcat (lambda (y) (format "%s" y)) + (cdr x) + ","))) + menu + ",\n") +#+END_SRC - #+RESULTS: make-menu - : { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end } - : { "edit config", editor .. " " .. awesome.conffile } - : { "restart", awesome.restart } - : { "quit", function() awesome.quit() end } +#+RESULTS: make-menu +: { "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end } +: { "edit config", editor .. " " .. awesome.conffile } +: { "restart", awesome.restart } +: { "quit", function() awesome.quit() end } - It is possible to create actual menus in Awesome, including the one available - at the top-left corner of the screen. First, let’s declare a menu related to - Awesome: - #+NAME: table-awesome-menu - | Name | Command | - |-------------+---------------------------------------------------------------------| - | hotkeys | function() hotkeys_popup.show_help(nil, awful.screen.focused()) end | - | edit config | editor .. " " .. awesome.conffile | - | restart | awesome.restart | - | quit | function() awesome.quit() end | +It is possible to create actual menus in Awesome, including the one available at the top-left corner of the screen. First, let’s declare a menu related to Awesome: +#+NAME: table-awesome-menu +| Name | Command | +|-------------+---------------------------------------------------------------------| +| hotkeys | function() hotkeys_popup.show_help(nil, awful.screen.focused()) end | +| edit config | editor .. " " .. awesome.conffile | +| restart | awesome.restart | +| quit | function() awesome.quit() end | - And here is the actual code: - #+BEGIN_SRC lua - awesomewm_menu = { - <> - } - #+END_SRC +And here is the actual code: +#+BEGIN_SRC lua + awesomewm_menu = { + <> + } +#+END_SRC - Next, let’s create the main menu that will be used on ~S-w~ and at the top - left of the window: - #+NAME: table-main-menu - | Name | Command | Icon | - |---------------+----------------+------------------------| - | awesome | awesomewm_menu | beautiful.awesome_icon | - | open terminal | terminal | nil | +Next, let’s create the main menu that will be used on ~S-w~ and at the top left of the window: +#+NAME: table-main-menu +| Name | Command | Icon | +|---------------+----------------+------------------------| +| awesome | awesomewm_menu | beautiful.awesome_icon | +| open terminal | terminal | nil | - Here is the actual code: - #+BEGIN_SRC lua - mainmenu = awful.menu({ items = { - <> - }}) - #+END_SRC +Here is the actual code: +#+BEGIN_SRC lua + mainmenu = awful.menu({ items = { + <> + }}) +#+END_SRC - For now it only has two entries: the Awesome menu and opening a terminal, I - will add some more later probably. Let’s specify it as being our main - launcher: - #+BEGIN_SRC lua - launcher = awful.widget.launcher({ image = beautiful.awesome_icon, - menu = mainmenu }) - #+END_SRC +For now it only has two entries: the Awesome menu and opening a terminal, I will add some more later probably. Let’s specify it as being our main launcher: +#+BEGIN_SRC lua + launcher = awful.widget.launcher({ image = beautiful.awesome_icon, + menu = mainmenu }) +#+END_SRC - Finally, let’s declare the menubar’s terminal for applications that require - it. - #+BEGIN_SRC lua - menubar.utils.terminal = terminal - #+END_SRC +Finally, let’s declare the menubar’s terminal for applications that require it. +#+BEGIN_SRC lua + menubar.utils.terminal = terminal +#+END_SRC ** Other widgets :PROPERTIES: :CUSTOM_ID: Top_bar-Other_widgets-0b255378 :END: - Let’s declare the keyboard map indicator and switcher for the top bar: - #+BEGIN_SRC lua - keyboardlayout = awful.widget.keyboardlayout() - #+END_SRC +Let’s declare the keyboard map indicator and switcher for the top bar: +#+BEGIN_SRC lua + keyboardlayout = awful.widget.keyboardlayout() +#+END_SRC - Let’s also create a clock widget: - #+BEGIN_SRC lua - textclock = wibox.widget.textclock() - #+END_SRC +Let’s also create a clock widget: +#+BEGIN_SRC lua + textclock = wibox.widget.textclock() +#+END_SRC ** Tag list :PROPERTIES: :CUSTOM_ID: Top_bar-Tag_list-d43dbb62 :END: - 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: - #+BEGIN_SRC lua :tangle no - local tasklist_buttons = gears.table.join( - -- configuration goes here - ) - #+END_SRC +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: +#+BEGIN_SRC lua :tangle no + local tasklist_buttons = gears.table.join( + -- configuration goes here + ) +#+END_SRC - ~gears.table.join()~ joins several tables together, as described [[https://awesomewm.org/doc/api/libraries/gears.table.html][here]], which - will be useful since all its arguments will be tables generated by the - ~awful.button~ method which will be useful in order to manage what clicks on - the tags should do. First, let’s manage left clicks. +~gears.table.join()~ joins several tables together, as described [[https://awesomewm.org/doc/api/libraries/gears.table.html][here]], which will be useful since all its arguments will be tables generated by the ~awful.button~ method which will be useful in order to manage what clicks on the tags should do. First, let’s manage left clicks. - 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. - #+NAME: tag-simple-left-click - #+BEGIN_SRC lua :tangle no - awful.button({ }, 1, function(t) t:view_only() end) - #+END_SRC +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. +#+NAME: tag-simple-left-click +#+BEGIN_SRC lua :tangle no + awful.button({ }, 1, function(t) t:view_only() end) +#+END_SRC - 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. - #+NAME: tag-mod-left-click - #+BEGIN_SRC lua :tangle no - awful.button({ modkey }, 1, awful.tag.viewtoggle) - #+END_SRC +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. +#+NAME: tag-mod-left-click +#+BEGIN_SRC lua :tangle no + awful.button({ modkey }, 1, awful.tag.viewtoggle) +#+END_SRC - 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. - #+NAME: tag-simple-right-click - #+BEGIN_SRC lua :tangle no - awful.button({ }, 3, function(t) - if client.focus then - client.focus:move_to_tag(t) - end - end) - #+END_SRC +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. +#+NAME: tag-simple-right-click +#+BEGIN_SRC lua :tangle no + awful.button({ }, 3, function(t) + if client.focus then + client.focus:move_to_tag(t) + end + end) +#+END_SRC - However, a right click combined with the modkey will add the clicked tag to - the currently focused window, making it visible to both tags. - #+NAME: tag-mod-right-click - #+BEGIN_SRC lua :tangle no - awful.button({ modkey }, 3, function(t) - if client.focus then - client.focus:toggle_tag(t) - end - end) - #+END_SRC +However, a right click combined with the modkey will add the clicked tag to the currently focused window, making it visible to both tags. +#+NAME: tag-mod-right-click +#+BEGIN_SRC lua :tangle no + awful.button({ modkey }, 3, function(t) + if client.focus then + client.focus:toggle_tag(t) + end + end) +#+END_SRC - 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. - #+NAME: tag-simple-scroll-up - #+BEGIN_SRC lua :tangle no - awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end) - #+END_SRC +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. +#+NAME: tag-simple-scroll-up +#+BEGIN_SRC lua :tangle no + awful.button({ }, 4, function(t) awful.tag.viewnext(t.screen) end) +#+END_SRC - Otherwise, if a scroll down is detected, the next tag will be displayed. - #+NAME: tag-simple-scroll-down - #+BEGIN_SRC lua :tangle no - awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) - #+END_SRC +Otherwise, if a scroll down is detected, the next tag will be displayed. +#+NAME: tag-simple-scroll-down +#+BEGIN_SRC lua :tangle no + awful.button({ }, 5, function(t) awful.tag.viewprev(t.screen) end) +#+END_SRC - So, here’s the actual configuration code for the taglist: - #+BEGIN_SRC lua - local taglist_buttons = gears.table.join( - <>, - <>, - <>, - <>, - <>, - <> - ) - #+END_SRC +So, here’s the actual configuration code for the taglist: +#+BEGIN_SRC lua + local taglist_buttons = gears.table.join( + <>, + <>, + <>, + <>, + <>, + <> + ) +#+END_SRC ** Tasks list :PROPERTIES: :CUSTOM_ID: Top_bar-Tasks_list-fb7c9b20 :END: - 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: - #+BEGIN_SRC lua :tangle no - local tasklist_buttons = gears.table.join( - -- List of clicks - ) - #+END_SRC +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: +#+BEGIN_SRC lua :tangle no + local tasklist_buttons = gears.table.join( + -- List of clicks + ) +#+END_SRC - 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. - #+NAME: task-simple-left-click - #+BEGIN_SRC lua :tangle no - awful.button({ }, 1, function (c) - if c == client.focus then - c.minimized = true - else - c:emit_signal( - "request::activate", - "tasklist", - {raise = true} - ) - end - end) - #+END_SRC +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. +#+NAME: task-simple-left-click +#+BEGIN_SRC lua :tangle no + awful.button({ }, 1, function (c) + if c == client.focus then + c.minimized = true + else + c:emit_signal( + "request::activate", + "tasklist", + {raise = true} + ) + end + end) +#+END_SRC - 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. - #+NAME: task-simple-right-click - #+BEGIN_SRC lua :tangle no - awful.button({ }, 3, function() - awful.menu.client_list({ theme = { width = 250 } }) - end) - #+END_SRC +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. +#+NAME: task-simple-right-click +#+BEGIN_SRC lua :tangle no + awful.button({ }, 3, function() + awful.menu.client_list({ theme = { width = 250 } }) + end) +#+END_SRC - If a scroll up is detected, then let’s select the previous client in the - tasklist. - #+NAME: task-simple-scroll-up - #+BEGIN_SRC lua :tangle no - awful.button({ }, 4, function () - awful.client.focus.byidx(1) - end) - #+END_SRC +If a scroll up is detected, then let’s select the previous client in the tasklist. +#+NAME: task-simple-scroll-up +#+BEGIN_SRC lua :tangle no + awful.button({ }, 4, function () + awful.client.focus.byidx(1) + end) +#+END_SRC - If a scroll down is detected, then let’s select the next client in the - tasklist. - #+NAME: task-simple-scroll-down - #+BEGIN_SRC lua :tangle no - awful.button({ }, 5, function () - awful.client.focus.byidx(-1) - end) - #+END_SRC +If a scroll down is detected, then let’s select the next client in the tasklist. +#+NAME: task-simple-scroll-down +#+BEGIN_SRC lua :tangle no + awful.button({ }, 5, function () + awful.client.focus.byidx(-1) + end) +#+END_SRC - So, here’s the actual code for the tasklist: - #+BEGIN_SRC lua - local tasklist_buttons = gears.table.join( - <>, - <>, - <>, - <> - ) - #+END_SRC +So, here’s the actual code for the tasklist: +#+BEGIN_SRC lua + local tasklist_buttons = gears.table.join( + <>, + <>, + <>, + <> + ) +#+END_SRC * Theme and display :PROPERTIES: @@ -637,735 +575,676 @@ :PROPERTIES: :CUSTOM_ID: Theme_and_display-Screen_update-e162a27a :END: - When a screen’s geometry changes (e.g. when a different resolution is - applied), the signal ~property::geometry~ is sent. When this is the case, the - wallpaper should be redisplayed since it won’t necessarily fit the new - geometry of the screen. And remember, I have a [[#Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c][function that does exactly - that]]! Let’s connect this function to the geometry change signal: - #+BEGIN_SRC lua - screen.connect_signal("property::geometry", set_wallpaper) - #+END_SRC +When a screen’s geometry changes (e.g. when a different resolution is applied), the signal ~property::geometry~ is sent. When this is the case, the wallpaper should be redisplayed since it won’t necessarily fit the new geometry of the screen. And remember, I have a [[#Custom_functions-Wallpaper-related_functions-Restore_previous_wallpaper-8b5bc08c][function that does exactly that]]! Let’s connect this function to the geometry change signal: +#+BEGIN_SRC lua + screen.connect_signal("property::geometry", set_wallpaper) +#+END_SRC - 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: - #+BEGIN_SRC lua :tangle no - awful.screen.connect_for_each_screen(function(s) - -- Code to be executed goes here - end) - #+END_SRC +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: +#+BEGIN_SRC lua :tangle no + awful.screen.connect_for_each_screen(function(s) + -- Code to be executed goes here + end) +#+END_SRC - 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. +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. - First, let’s set its wallpaper: - #+NAME: screen-set-pape - #+BEGIN_SRC lua :tangle no - set_wallpaper() - #+END_SRC +First, let’s set its wallpaper: +#+NAME: screen-set-pape +#+BEGIN_SRC lua :tangle no + set_wallpaper() +#+END_SRC - Next, let’s build a list of tags for the screen. *Be aware that each screen - has its own tag table!* The default layout will be the first refered to in - [[#Layouts-be55a7fd][the layouts list described above]]. - #+NAME: screen-taglist - #+BEGIN_SRC lua :tangle no - awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1]) - #+END_SRC +Next, let’s build a list of tags for the screen. *Be aware that each screen has its own tag table!* The default layout will be the first refered to in +the layouts list described above]]. +#+NAME: screen-taglist +#+BEGIN_SRC lua :tangle no + awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1]) +#+END_SRC - Next, let’s create the taglist widget. It will use the ~taglist_buttons~ - [[#Top_bar-Tag_list-d43dbb62][declared above]] in order to handle clicks on tags, and due to the filter, all - tags will be displayed in the tagbar ([[https://awesomewm.org/apidoc/widgets/awful.widget.taglist.html#List_filters][more about tag filters]]). - #+NAME: screen-taglist-widget - #+BEGIN_SRC lua :tangle no - s.taglist = awful.widget.taglist { - screen = s, - filter = awful.widget.taglist.filter.all, - buttons = taglist_buttons - } - #+END_SRC +Next, let’s create the taglist widget. It will use the ~taglist_buttons~ [[#Top_bar-Tag_list-d43dbb62][declared above]] in order to handle clicks on tags, and due to the filter, all tags will be displayed in the tagbar ([[https://awesomewm.org/apidoc/widgets/awful.widget.taglist.html#List_filters][more about tag filters]]). +#+NAME: screen-taglist-widget +#+BEGIN_SRC lua :tangle no + s.taglist = awful.widget.taglist { + screen = s, + filter = awful.widget.taglist.filter.all, + buttons = taglist_buttons + } +#+END_SRC - A tasklist widget will also get created thanks with the ~tasklist_button~ - [[#Top_bar-Tag_list-d43dbb62][declared above]] that will handle clicks on tasks. Contrarily to the taglist - widget above, the tasklist will only display the screen’s current tags thanks - to its filter. - #+NAME: screen-tasklist-widget - #+BEGIN_SRC lua :tangle no - s.tasklist = awful.widget.tasklist { - screen = s, - filter = awful.widget.tasklist.filter.currenttags, - buttons = tasklist_buttons - } - #+END_SRC +A tasklist widget will also get created thanks with the ~tasklist_button~ [[#Top_bar-Tag_list-d43dbb62][declared above]] that will handle clicks on tasks. Contrarily to the taglist widget above, the tasklist will only display the screen’s current tags thanks to its filter. +#+NAME: screen-tasklist-widget +#+BEGIN_SRC lua :tangle no + s.tasklist = awful.widget.tasklist { + screen = s, + filter = awful.widget.tasklist.filter.currenttags, + buttons = tasklist_buttons + } +#+END_SRC - A promptbox will also be created for the screen: - #+NAME: screen-promptbox - #+BEGIN_SRC lua :tangle no - s.promptbox = awful.widget.prompt() - #+END_SRC +A promptbox will also be created for the screen: +#+NAME: screen-promptbox +#+BEGIN_SRC lua :tangle no + s.promptbox = awful.widget.prompt() +#+END_SRC - Then, Let’s create an imagebox widget in which will be contained an icon - indicating which layout is being used. We need one per screen. We will also - make it clickable: if there is a left click or a scroll up detected above it, - the next layout will be loaded; otherwise if a right click or a scroll down - is detected, the previous layout will be loaded. - #+NAME: screen-layout-indicator - #+BEGIN_SRC lua :tangle no - s.layoutbox = awful.widget.layoutbox(s) - s.layoutbox:buttons(gears.table.join( - awful.button({ }, 1, function () awful.layout.inc( 1) end), - awful.button({ }, 3, function () awful.layout.inc(-1) end), - awful.button({ }, 4, function () awful.layout.inc( 1) end), - awful.button({ }, 5, function () awful.layout.inc(-1) end))) - #+END_SRC +Then, Let’s create an imagebox widget in which will be contained an icon indicating which layout is being used. We need one per screen. We will also make it clickable: if there is a left click or a scroll up detected above it, the next layout will be loaded; otherwise if a right click or a scroll down is detected, the previous layout will be loaded. +#+NAME: screen-layout-indicator +#+BEGIN_SRC lua :tangle no + s.layoutbox = awful.widget.layoutbox(s) + s.layoutbox:buttons(gears.table.join( + awful.button({ }, 1, function () awful.layout.inc( 1) end), + awful.button({ }, 3, function () awful.layout.inc(-1) end), + awful.button({ }, 4, function () awful.layout.inc( 1) end), + awful.button({ }, 5, function () awful.layout.inc(-1) end))) +#+END_SRC - Now it is time to create the widget, a ~wibox~ that will contain our bar. - #+NAME: screen-wibox-widget - #+BEGIN_SRC lua :tangle no - s.wibox = awful.wibar({ position = "top", screen = s }) - #+END_SRC +Now it is time to create the widget, a ~wibox~ that will contain our bar. +#+NAME: screen-wibox-widget +#+BEGIN_SRC lua :tangle no + s.wibox = awful.wibar({ position = "top", screen = s }) +#+END_SRC - Finally, let’s set up our bar. Since it is a horizontal bar, its layout will - be horizontal too. Our launcher, taglist and promptbox will be part of the - left widgets, while the tasklist will be at the center, and the keyboard - indicator, the system tray, the clock and the layout indicator will be on the - right. - #+NAME: screen-wibox-setup - #+BEGIN_SRC lua :tangle no - s.wibox:setup { - layout = wibox.layout.align.horizontal, - { -- Left widgets - layout = wibox.layout.fixed.horizontal, - launcher, - s.taglist, - s.promptbox, - }, - s.tasklist, -- Middle widget - { -- Right widgets - layout = wibox.layout.fixed.horizontal, - keyboardlayout, - wibox.widget.systray(), - textclock, - s.layoutbox, - }, - } - #+END_SRC +Finally, let’s set up our bar. Since it is a horizontal bar, its layout will be horizontal too. Our launcher, taglist and promptbox will be part of the left widgets, while the tasklist will be at the center, and the keyboard indicator, the system tray, the clock and the layout indicator will be on the right. +#+NAME: screen-wibox-setup +#+BEGIN_SRC lua :tangle no + s.wibox:setup { + layout = wibox.layout.align.horizontal, + { -- Left widgets + layout = wibox.layout.fixed.horizontal, + launcher, + s.taglist, + s.promptbox, + }, + s.tasklist, -- Middle widget + { -- Right widgets + layout = wibox.layout.fixed.horizontal, + keyboardlayout, + wibox.widget.systray(), + textclock, + s.layoutbox, + }, + } +#+END_SRC - In the end, our code looks like this: - #+BEGIN_SRC lua - awful.screen.connect_for_each_screen(function(s) - <> - <> - <> - <> - <> - <> - <> - <> - end) - #+END_SRC +In the end, our code looks like this: +#+BEGIN_SRC lua + awful.screen.connect_for_each_screen(function(s) + <> + <> + <> + <> + <> + <> + <> + <> + end) +#+END_SRC * Mouse bindings :PROPERTIES: :CUSTOM_ID: Mouse_bindings-eb4a69a8 :END: - 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. - #+BEGIN_SRC lua - root.buttons(gears.table.join( - awful.button({}, 3, function() mainmenu:toggle() end) - )) - #+END_SRC +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. +#+BEGIN_SRC lua + root.buttons(gears.table.join( + awful.button({}, 3, function() mainmenu:toggle() end) + )) +#+END_SRC - 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 click on a client combined with a modkey press will allow the user to move - a client after focusing it and making it floating. - - A middle click on a client combined with a modkey press will toggle the - floating status of the client. - - A right click combined with the modkey will allow the user to resize a - after focusing it and making it a floating client. +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 click on a client combined with a modkey press will allow the user to move a client after focusing it and making it floating. +- A middle click on a client combined with a modkey press will toggle the floating status of the client. +- A right click combined with the modkey will allow the user to resize a after focusing it and making it a floating client. - #+BEGIN_SRC lua - clientbuttons = gears.table.join( - awful.button({ }, 1, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - end), - awful.button({ modkey }, 1, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - c.floating = true - awful.mouse.client.move(c) - end), - awful.button({ modkey }, 2, function (c) - awful.client.floating.toggle(c) - end), - awful.button({ modkey }, 3, function (c) - c:emit_signal("request::activate", "mouse_click", {raise = true}) - c.floating = true - awful.mouse.client.resize(c) - end) - ) - #+END_SRC +#+BEGIN_SRC lua + clientbuttons = gears.table.join( + awful.button({ }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + end), + awful.button({ modkey }, 1, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + c.floating = true + awful.mouse.client.move(c) + end), + awful.button({ modkey }, 2, function (c) + awful.client.floating.toggle(c) + end), + awful.button({ modkey }, 3, function (c) + c:emit_signal("request::activate", "mouse_click", {raise = true}) + c.floating = true + awful.mouse.client.resize(c) + end) + ) +#+END_SRC * Keybindings :PROPERTIES: :CUSTOM_ID: Keybindings-a4e415b3 :END: - 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. +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. - 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. +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. - Here is a description of the tables displayed below: - - Key :: key which toggles the shortcut - - Modifiers :: modifier keys that are required to toggle the shortcut - - Lambda? :: whether or not the ~Action~ should be nested in a lambda - function. Possible values are: - - ~no~ :: The value is a Lua function to be executed as is - - ~yes~ :: The value is to be inserted into a lambda - - ~spawn~ :: The value is to be inserted in an ~awful.spawn~ call in a - lambda - - ~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 - - What it does :: short description of the shortcut’s action - - Group :: group in which the shortcut will appear in Awesome’s help window - - Clientkey? :: whether this should be a global shortcut or a shortcut only - aimed at clients (value is ~yes~ or ~no~) +Here is a description of the tables displayed below: +- Key :: key which toggles the shortcut +- Modifiers :: modifier keys that are required to toggle the shortcut +- Lambda? :: whether or not the ~Action~ should be nested in a lambda function. Possible values are: + - ~no~ :: The value is a Lua function to be executed as is + - ~yes~ :: The value is to be inserted into a lambda + - ~spawn~ :: The value is to be inserted in an ~awful.spawn~ call in a lambda + - ~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 +- What it does :: short description of the shortcut’s action +- Group :: group in which the shortcut will appear in Awesome’s help window +- Clientkey? :: whether this should be a global shortcut or a shortcut only aimed at clients (value is ~yes~ or ~no~) - #+NAME: gen-sc-text - #+BEGIN_SRC emacs-lisp - (lambda (x) - (format "awful.key({%s},\"%s\",%s,\n\t{description=\"%s\",group=\"%s\"})" - (nth 1 x) (nth 0 x) - (cond - ((string= "yes" (nth 2 x)) - (format "function(%s) %s end" - (if (string= (nth 6 x) "yes") "c" "") - (nth 3 x))) - ((string= "shell" (nth 2 x)) - (format "function(%s) awful.spawn.with_shell(\"%s\") end" - (if (string= (nth 6 x) "yes") "c" "") - (nth 3 x))) - ((string= "terminal" (nth 2 x)) - (format "function(%s) awful.spawn(terminal..\" -e %s\") end" - (if (string= (nth 6 x) "yes") "c" "") - (nth 3 x))) - ((string= "spawn" (nth 2 x)) - (format "function(%s) awful.spawn(\"%s\") end" - (if (string= (nth 6 x) "yes") "c" "") - (nth 3 x))) - (t (nth 3 x))) - (nth 4 x) (nth 5 x))) - #+END_SRC +#+NAME: gen-sc-text +#+BEGIN_SRC emacs-lisp + (lambda (x) + (format "awful.key({%s},\"%s\",%s,\n\t{description=\"%s\",group=\"%s\"})" + (nth 1 x) (nth 0 x) + (cond + ((string= "yes" (nth 2 x)) + (format "function(%s) %s end" + (if (string= (nth 6 x) "yes") "c" "") + (nth 3 x))) + ((string= "shell" (nth 2 x)) + (format "function(%s) awful.spawn.with_shell(\"%s\") end" + (if (string= (nth 6 x) "yes") "c" "") + (nth 3 x))) + ((string= "terminal" (nth 2 x)) + (format "function(%s) awful.spawn(terminal..\" -e %s\") end" + (if (string= (nth 6 x) "yes") "c" "") + (nth 3 x))) + ((string= "spawn" (nth 2 x)) + (format "function(%s) awful.spawn(\"%s\") end" + (if (string= (nth 6 x) "yes") "c" "") + (nth 3 x))) + (t (nth 3 x))) + (nth 4 x) (nth 5 x))) +#+END_SRC - #+NAME: gen-sc-glob - #+BEGIN_SRC emacs-lisp :var table=sc-client - (mapconcat - <> - (seq-filter (lambda (x) - (or (not (nth 6 x)) - (string= "no" (nth 6 x)))) - table) - ",\n") - #+END_SRC +#+NAME: gen-sc-glob +#+BEGIN_SRC emacs-lisp :var table=sc-client + (mapconcat + <> + (seq-filter (lambda (x) + (or (not (nth 6 x)) + (string= "no" (nth 6 x)))) + table) + ",\n") +#+END_SRC - #+NAME: gen-sc-client - #+BEGIN_SRC emacs-lisp :var table=sc-client :cache yes - (mapconcat - <> - (seq-filter (lambda (x) - (string= "yes" (nth 6 x))) - table) - ",\n") - #+END_SRC +#+NAME: gen-sc-client +#+BEGIN_SRC emacs-lisp :var table=sc-client :cache yes + (mapconcat + <> + (seq-filter (lambda (x) + (string= "yes" (nth 6 x))) + table) + ",\n") +#+END_SRC - #+RESULTS[5a0293b89fe106cb2b71ba10d9548b29aa2f9543]: gen-sc-client - #+begin_example - awful.key({modkey},"f",function(c) toggle_fullscreen_client(c) end, - {description="toggle fullscreen",group="client"}), - awful.key({modkey},"m",function(c) toggle_maximized(c) end, - {description="toggle maximized",group="client"}), - awful.key({modkey, control},"m",function(c) toggle_vertical_maximized(c) end, - {description="toggle vertically maximized",group="client"}), - awful.key({modkey, shift},"m",function(c) toggle_horizontal_maximized(c) end, - {description="toggle horizontally maximized",group="client"}), - awful.key({modkey, shift},"n",function(c) c.minimized = true end, - {description="minimize",group="client"}), - awful.key({modkey},"o",function(c) c:move_to_screen() end, - {description="move to screen",group="client"}), - awful.key({modkey},"q",function(c) c:kill() end, - {description="close client",group="client"}), - awful.key({modkey},"v",function(c) c.ontop = not c.ontop end, - {description="toggle keep on top",group="client"}), - awful.key({modkey, control},"space",awful.client.floating.toggle, - {description="toggle floating",group="client"}), - awful.key({modkey, control},"Return",function(c) c:swap(awful.client.getmaster()) end, - {description="move to master",group="client"}) - #+end_example +#+RESULTS[5a0293b89fe106cb2b71ba10d9548b29aa2f9543]: gen-sc-client +#+begin_example +awful.key({modkey},"f",function(c) toggle_fullscreen_client(c) end, + {description="toggle fullscreen",group="client"}), +awful.key({modkey},"m",function(c) toggle_maximized(c) end, + {description="toggle maximized",group="client"}), +awful.key({modkey, control},"m",function(c) toggle_vertical_maximized(c) end, + {description="toggle vertically maximized",group="client"}), +awful.key({modkey, shift},"m",function(c) toggle_horizontal_maximized(c) end, + {description="toggle horizontally maximized",group="client"}), +awful.key({modkey, shift},"n",function(c) c.minimized = true end, + {description="minimize",group="client"}), +awful.key({modkey},"o",function(c) c:move_to_screen() end, + {description="move to screen",group="client"}), +awful.key({modkey},"q",function(c) c:kill() end, + {description="close client",group="client"}), +awful.key({modkey},"v",function(c) c.ontop = not c.ontop end, + {description="toggle keep on top",group="client"}), +awful.key({modkey, control},"space",awful.client.floating.toggle, + {description="toggle floating",group="client"}), +awful.key({modkey, control},"Return",function(c) c:swap(awful.client.getmaster()) end, + {description="move to master",group="client"}) +#+end_example - #+NAME: sc-tag-num-gen - #+BEGIN_SRC emacs-lisp :var input=sc-tag-num :results drawer - (let (result) - (dotimes (i 10 result) - (let* ((j (+ 1 i))) - (setq result - (cons - (mapconcat - (lambda (line) - (format - "awful.key({%s},\"#%d\",function() %s%d) end, - \t{description=\"%s%d\",group=\"%s\"})" - (nth 1 line) (+ j 9) (nth 2 line) j - (nth 3 line) j (nth 4 line))) - input - ",\n") result)))) - (mapconcat (lambda (x) x) - result - ",\n\n")) - #+END_SRC +#+NAME: sc-tag-num-gen +#+BEGIN_SRC emacs-lisp :var input=sc-tag-num :results drawer + (let (result) + (dotimes (i 10 result) + (let* ((j (+ 1 i))) + (setq result + (cons + (mapconcat + (lambda (line) + (format + "awful.key({%s},\"#%d\",function() %s%d) end, + \t{description=\"%s%d\",group=\"%s\"})" + (nth 1 line) (+ j 9) (nth 2 line) j + (nth 3 line) j (nth 4 line))) + input + ",\n") result)))) + (mapconcat (lambda (x) x) + result + ",\n\n")) +#+END_SRC - 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]]). +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]]). +#+BEGIN_SRC lua :cache yes + globalkeys = gears.table.join( + -- Awesome + <>, + -- App + <>, + <>, + <>, + <>, + <>, + -- Client + <>, + -- Layout + <>, + -- Media + <>, + -- Screen + <>, + -- Tags + <>, + -- Misc + <>, + <> + ) + root.keys(globalkeys) - #+BEGIN_SRC lua :cache yes - globalkeys = gears.table.join( - -- Awesome - <>, - -- App - <>, - <>, - <>, - <>, - <>, - -- Client - <>, - -- Layout - <>, - -- Media - <>, - -- Screen - <>, - -- Tags - <>, - -- Misc - <>, - <> - ) - root.keys(globalkeys) - - clientkeys = gears.table.join( - -- Client - <> - ) - #+END_SRC + clientkeys = gears.table.join( + -- Client + <> + ) +#+END_SRC ** Applications :PROPERTIES: :CUSTOM_ID: Keybindings-Applications-8321c6c9 :END: - #+NAME: sc-app - | Key | Modifiers | Lambda? | Action | What it does | Group | - |--------+-----------+---------+-----------------------+-------------------+-------| - | Return | modkey | yes | awful.spawn(terminal) | open a terminal | app | - | n | modkey | spawn | nemo | open file manager | app | +#+NAME: sc-app +| Key | Modifiers | Lambda? | Action | What it does | Group | +|--------+-----------+---------+-----------------------+-------------------+-------| +| Return | modkey | yes | awful.spawn(terminal) | open a terminal | app | +| n | modkey | spawn | nemo | open file manager | app | *** Internet apps :PROPERTIES: :CUSTOM_ID: Keybindings-Applications-Internet_apps-87e80705 :END: - #+NAME: sc-app-internet - | Key | Modifiers | Lambda? | Action | What it does | Group | - |-----+----------------+---------+-----------------------------------+--------------------+----------| - | b | modkey | yes | awful.spawn(os.getenv("BROWSER")) | invoke web browser | internet | - | d | control, shift | spawn | discord-canary | launch Discord | internet | +#+NAME: sc-app-internet +| Key | Modifiers | Lambda? | Action | What it does | Group | +|-----+----------------+---------+-----------------------------------+--------------------+----------| +| b | modkey | yes | awful.spawn(os.getenv("BROWSER")) | invoke web browser | internet | +| d | control, shift | spawn | discord-canary | launch Discord | internet | *** Screenshots :PROPERTIES: :CUSTOM_ID: Keybindings-Applications-Screenshots-fa63a5a5 :END: - #+NAME: sc-app-screenshot - | Key | Modifiers | Lambda? | Action | What it does | Group | - |-------+-----------+---------+------------+-----------------------------+------------| - | Print | | spawn | scrot | Screenshot | screenshot | - | Print | control | spawn | scrot -s | Screenshot (area selection) | screenshot | - | Print | shift | spawn | scrot -d 3 | Screenshot (3s delay) | screenshot | +#+NAME: sc-app-screenshot +| Key | Modifiers | Lambda? | Action | What it does | Group | +|-------+-----------+---------+------------+-----------------------------+------------| +| Print | | spawn | scrot | Screenshot | screenshot | +| Print | control | spawn | scrot -s | Screenshot (area selection) | screenshot | +| Print | shift | spawn | scrot -d 3 | Screenshot (3s delay) | screenshot | *** Emacs :PROPERTIES: :CUSTOM_ID: Keybindings-Applications-Emacs-95f8f6a4 :END: - #+NAME: sc-app-emacs - | Key | Modifiers | Lambda? | Action | What it does | Group | - |-----+---------------+---------+-------------------------------+--------------------------+-------| - | e | modkey | spawn | emacsclient -c -n | invoke Emacs | emacs | - | e | modkey, shift | spawn | emacsclient -c -n -e '(mu4e)' | invoke Emacs mail client | emacs | +#+NAME: sc-app-emacs +| Key | Modifiers | Lambda? | Action | What it does | Group | +|-----+---------------+---------+-------------------------------+--------------------------+-------| +| e | modkey | spawn | emacsclient -c -n | invoke Emacs | emacs | +| e | modkey, shift | spawn | emacsclient -c -n -e '(mu4e)' | invoke Emacs mail client | emacs | *** Rofi :PROPERTIES: :CUSTOM_ID: Keybindings-Applications-Rofi-ca998c87 :END: - #+NAME: sc-app-rofi - | Key | Modifiers | Lambda? | Action | What it does | Group | - |-----+------------------------+---------+---------------------------------------+---------------------------------+-------| - | a | modkey | shell | awiki | find and open an ArchWiki page | rofi | - | d | modkey | spawn | rofi -show combi | invoke rofi | rofi | - | d | modkey, shift | spawn | rofi -combi-modi drun,run -show combi | invoke j4-dmenu-desktop | rofi | - | p | modkey, shift | shell | rofi-pass -t | types password from ~pass~ | rofi | - | p | modkey, control, shift | shell | rofi-pass | copy password from ~pass~ | rofi | - | e | modkey, meta | shell | rofi-emoji | select and copy emoji from list | rofi | - | m | modkey, meta | shell | rofi-mount | volume mounting helper | rofi | - | u | modkey, meta | shell | rofi-umount | volume unmounting helper | rofi | - | w | modkey, control | shell | wacom-setup | set up my wacom tablet | rofi | - | w | modkey, shift | shell | rofi-wifi-menu | connect to available wifi | rofi | +#+NAME: sc-app-rofi +| Key | Modifiers | Lambda? | Action | What it does | Group | +|-----+------------------------+---------+---------------------------------------+---------------------------------+-------| +| a | modkey | shell | awiki | find and open an ArchWiki page | rofi | +| d | modkey | spawn | rofi -show combi | invoke rofi | rofi | +| d | modkey, shift | spawn | rofi -combi-modi drun,run -show combi | invoke j4-dmenu-desktop | rofi | +| p | modkey, shift | shell | rofi-pass -t | types password from ~pass~ | rofi | +| p | modkey, control, shift | shell | rofi-pass | copy password from ~pass~ | rofi | +| e | modkey, meta | shell | rofi-emoji | select and copy emoji from list | rofi | +| m | modkey, meta | shell | rofi-mount | volume mounting helper | rofi | +| u | modkey, meta | shell | rofi-umount | volume unmounting helper | rofi | +| w | modkey, control | shell | wacom-setup | set up my wacom tablet | rofi | +| w | modkey, shift | shell | rofi-wifi-menu | connect to available wifi | rofi | ** Awesome :PROPERTIES: :CUSTOM_ID: Keybindings-Awesome-7b691e10 :END: - Here will be declared some shortcuts directly related to Awesome itself. - #+NAME: sc-awesome - | Key | Modifiers | Lambda? | Action | What it does | Group | - |-----+------------------------+---------+---------------------------+-------------------------+---------| - | h | modkey | no | hotkeys_popup.show_help | show help | awesome | - | h | modkey, shift | yes | mainmenu:show() | show main menu | awesome | - | l | modkey | spawn | lock | lock screen | awesome | - | q | modkey, shift | no | awesome.quit | quit awesome | awesome | - | r | modkey, shift, control | no | awesome.restart | reload awesome | awesome | - | w | modkey | no | set_random_pape | set random wallpaper | awesome | - | x | modkey | no | invoke_lua_execute_prompt | lua execute prompt | awesome | - | F4 | modkey, control | spawn | systemctl hibernate | hibernate computer | awesome | - | F4 | modkey, shift | spawn | systemctl suspend | suspend to RAM computer | awesome | - | F4 | modkey, shift, control | spawn | poweroff | power off computer | awesome | +Here will be declared some shortcuts directly related to Awesome itself. +#+NAME: sc-awesome +| Key | Modifiers | Lambda? | Action | What it does | Group | +|-----+------------------------+---------+---------------------------+-------------------------+---------| +| h | modkey | no | hotkeys_popup.show_help | show help | awesome | +| h | modkey, shift | yes | mainmenu:show() | show main menu | awesome | +| l | modkey | spawn | lock | lock screen | awesome | +| q | modkey, shift | no | awesome.quit | quit awesome | awesome | +| r | modkey, shift, control | no | awesome.restart | reload awesome | awesome | +| w | modkey | no | set_random_pape | set random wallpaper | awesome | +| x | modkey | no | invoke_lua_execute_prompt | lua execute prompt | awesome | +| F4 | modkey, control | spawn | systemctl hibernate | hibernate computer | awesome | +| F4 | modkey, shift | spawn | systemctl suspend | suspend to RAM computer | awesome | +| F4 | modkey, shift, control | spawn | poweroff | power off computer | awesome | ** Clients :PROPERTIES: :CUSTOM_ID: Keybindings-Clients-f9f96d60 :END: These shortcuts are related to clients (aka windows) management. - #+NAME: sc-client - | Key | Modifiers | Lambda? | Action | What it does | Group | Clientkey? | - |-----+------------------------+---------+----------------------------------+-------------------------------+--------+------------| - | c | modkey, meta | yes | awful.placement.centered(c) | center client | client | yes | - | f | modkey | yes | toggle_fullscreen_client(c) | toggle fullscreen | client | yes | - | m | modkey | yes | toggle_maximized(c) | toggle maximized | client | yes | - | m | modkey, shift | yes | toggle_horizontal_maximized(c) | toggle horizontally maximized | client | yes | - | m | modkey, control | yes | toggle_vertical_maximized(c) | toggle vertically maximized | client | yes | - | n | modkey, shift | yes | c.minimized = true | minimize | client | yes | - | n | modkey, control | no | restore_minimized_clients | restore minimized | client | no | - | o | modkey, shift | yes | c:move_to_screen() | move to screen | client | yes | - | q | modkey | yes | c:kill() | close client | client | yes | - | s | modkey | yes | awful.client.focus.byidx(-1) | focus previous client | client | no | - | t | modkey | yes | awful.client.focus.byidx(1) | focus next client | client | no | - | s | modkey, shift | yes | awful.client.swap.byidx(-1) | swap with previous client | client | no | - | t | modkey, shift | yes | awful.client.swap.byidx(1) | swap with next client | client | no | - | m | modkey, shift, control | yes | c:swap(awful.client.getmaster()) | swap with master client | client | yes | - | u | modkey | no | awful.client.urgent.jumpto | jump to urgent client | client | no | - | v | modkey | yes | c.ontop = not c.ontop | toggle keep on top | client | yes | - | f | modkey, control | no | awful.client.floating.toggle | toggle floating | client | yes | - | Tab | modkey | no | client_go_back | go back | client | no | +#+NAME: sc-client +| Key | Modifiers | Lambda? | Action | What it does | Group | Clientkey? | +|-----+------------------------+---------+----------------------------------+-------------------------------+--------+------------| +| c | modkey, meta | yes | awful.placement.centered(c) | center client | client | yes | +| f | modkey | yes | toggle_fullscreen_client(c) | toggle fullscreen | client | yes | +| m | modkey | yes | toggle_maximized(c) | toggle maximized | client | yes | +| m | modkey, shift | yes | toggle_horizontal_maximized(c) | toggle horizontally maximized | client | yes | +| m | modkey, control | yes | toggle_vertical_maximized(c) | toggle vertically maximized | client | yes | +| n | modkey, shift | yes | c.minimized = true | minimize | client | yes | +| n | modkey, control | no | restore_minimized_clients | restore minimized | client | no | +| o | modkey, shift | yes | c:move_to_screen() | move to screen | client | yes | +| q | modkey | yes | c:kill() | close client | client | yes | +| s | modkey | yes | awful.client.focus.byidx(-1) | focus previous client | client | no | +| t | modkey | yes | awful.client.focus.byidx(1) | focus next client | client | no | +| s | modkey, shift | yes | awful.client.swap.byidx(-1) | swap with previous client | client | no | +| t | modkey, shift | yes | awful.client.swap.byidx(1) | swap with next client | client | no | +| m | modkey, shift, control | yes | c:swap(awful.client.getmaster()) | swap with master client | client | yes | +| u | modkey | no | awful.client.urgent.jumpto | jump to urgent client | client | no | +| v | modkey | yes | c.ontop = not c.ontop | toggle keep on top | client | yes | +| f | modkey, control | no | awful.client.floating.toggle | toggle floating | client | yes | +| Tab | modkey | no | client_go_back | go back | client | no | ** Layout manipulation :PROPERTIES: :CUSTOM_ID: Keybindings-Layout_manipulation-648b4581 :END: - #+NAME: sc-layout - | Key | Modifiers | Lambda? | Action | What it does | Group | - |-------+-----------------+---------+-------------------------------------+-----------------------------------+--------| - | r | modkey | yes | awful.tag.incmwfact(0.05) | increase master width factor | layout | - | c | modkey | yes | awful.tag.incmwfact(-0.05) | decrease master width factor | layout | - | r | modkey, shift | yes | awful.tag.incnmaster(1, nil, true) | increase number of master clients | layout | - | c | modkey, shift | yes | awful.tag.incnmaster(-1, nil, true) | decrease number of master clients | layout | - | r | modkey, control | yes | awful.tag.incncol(1, nil, true) | increase number of colums | layout | - | c | modkey, control | yes | awful.tag.incncol(-1, nil, true) | decrease number of colums | layout | - | space | modkey | yes | awful.layout.inc(1) | next layout | layout | - | space | modkey, meta | yes | awful.layout.inc(-1) | previous layout | layout | +#+NAME: sc-layout +| Key | Modifiers | Lambda? | Action | What it does | Group | +|-------+-----------------+---------+-------------------------------------+-----------------------------------+--------| +| r | modkey | yes | awful.tag.incmwfact(0.05) | increase master width factor | layout | +| c | modkey | yes | awful.tag.incmwfact(-0.05) | decrease master width factor | layout | +| r | modkey, shift | yes | awful.tag.incnmaster(1, nil, true) | increase number of master clients | layout | +| c | modkey, shift | yes | awful.tag.incnmaster(-1, nil, true) | decrease number of master clients | layout | +| r | modkey, control | yes | awful.tag.incncol(1, nil, true) | increase number of colums | layout | +| c | modkey, control | yes | awful.tag.incncol(-1, nil, true) | decrease number of colums | layout | +| space | modkey | yes | awful.layout.inc(1) | next layout | layout | +| space | modkey, meta | yes | awful.layout.inc(-1) | previous layout | layout | ** Media :PROPERTIES: :CUSTOM_ID: Keybindings-Media-f2cc1324 :END: - #+NAME: sc-media - | Key | Modifiers | Lambda? | Action | What it does | Group | - |----------------------+-----------------+----------+---------------------------------+--------------------------+-------| - | + | modkey, meta | shell | mpc volume +2 | increase mpd volume | media | - | - | modkey, meta | shell | mpc volume -2 | decrease mpd volume | media | - | n | modkey, meta | terminal | ncmpcpp -q | spawn ncmpcpp | media | - | v | modkey, meta | terminal | ncmpcpp -qs visualizer | spawn ncmpcpp visualizer | media | - | XF86AudioLowerVolume | | shell | amixer -q set Master 2%- unmute | lower volume | media | - | Prior | modkey, control | shell | amixer -q set Master 2%- unmute | lower volume | media | - | XF86AudioRaiseVolume | | shell | amixer -q set Master 2%+ unmute | raise volume | media | - | Next | modkey, control | shell | amixer -q set Master 2%+ unmute | lower volume | media | - | XF86AudioMute | | shell | amixer -q set master 1+ toggle | toggle mute audio | media | - | Prior | modkey, control | shell | amixer -q set master 1+ toggle | toggle mute audio | media | - | XF86AudioPrev | | shell | mpc prev | previous mpd track | media | - | XF86AudioLowerVolume | meta | shell | mpc prev | prevous mpd track | media | - | Prior | modkey | shell | mpc prev | previous mpd track | media | - | XF86AudioNext | | shell | mpc next | next mpd track | media | - | XF86AudioRaiseVolume | meta | shell | mpc next | next mpd track | media | - | Next | modkey | shell | mpc next | next mpd track | media | - | XF86AudioPlay | | shell | mpc toggle | toggle mpd playback | media | - | p | modkey | shell | mpc toggle | toggle mpd playback | media | - | XF86AudioStop | | shell | mpc stop | stop playback | media | - | XF86AudioPlay | meta | shell | mpc stop | stop playback | media | - | p | modkey, meta | shell | mpc stop | stop playback | media | +#+NAME: sc-media +| Key | Modifiers | Lambda? | Action | What it does | Group | +|----------------------+-----------------+----------+---------------------------------+--------------------------+-------| +| + | modkey, meta | shell | mpc volume +2 | increase mpd volume | media | +| - | modkey, meta | shell | mpc volume -2 | decrease mpd volume | media | +| n | modkey, meta | terminal | ncmpcpp -q | spawn ncmpcpp | media | +| v | modkey, meta | terminal | ncmpcpp -qs visualizer | spawn ncmpcpp visualizer | media | +| XF86AudioLowerVolume | | shell | amixer -q set Master 2%- unmute | lower volume | media | +| Prior | modkey, control | shell | amixer -q set Master 2%- unmute | lower volume | media | +| XF86AudioRaiseVolume | | shell | amixer -q set Master 2%+ unmute | raise volume | media | +| Next | modkey, control | shell | amixer -q set Master 2%+ unmute | lower volume | media | +| XF86AudioMute | | shell | amixer -q set master 1+ toggle | toggle mute audio | media | +| Prior | modkey, control | shell | amixer -q set master 1+ toggle | toggle mute audio | media | +| XF86AudioPrev | | shell | mpc prev | previous mpd track | media | +| XF86AudioLowerVolume | meta | shell | mpc prev | prevous mpd track | media | +| Prior | modkey | shell | mpc prev | previous mpd track | media | +| XF86AudioNext | | shell | mpc next | next mpd track | media | +| XF86AudioRaiseVolume | meta | shell | mpc next | next mpd track | media | +| Next | modkey | shell | mpc next | next mpd track | media | +| XF86AudioPlay | | shell | mpc toggle | toggle mpd playback | media | +| p | modkey | shell | mpc toggle | toggle mpd playback | media | +| XF86AudioStop | | shell | mpc stop | stop playback | media | +| XF86AudioPlay | meta | shell | mpc stop | stop playback | media | +| p | modkey, meta | shell | mpc stop | stop playback | media | ** Screen :PROPERTIES: :CUSTOM_ID: Keybindings-Screen-b73991f0 :END: - #+NAME: sc-screen - | Key | Modifiers | Lambda? | Action | What it does | Group | - |-----------------------+--------------+---------+---------------------------------+----------------------------+--------| - | t | modkey, meta | yes | awful.screen.focus_relative(1) | focus next screen | screen | - | s | modkey, meta | yes | awful.screen.focus_relative(-1) | focus previous screen | screen | - | XF86MonBrightnessDown | | shell | xbacklight -dec 5 | decrease screen brightness | screen | - | Next | modkey, meta | shell | xbacklight -dec 5 | decrease screen brightness | screen | - | XF86MonBrightnessUp | | shell | xbacklight -inc 5 | increase screen brightness | screen | - | Prev | modkey, meta | shell | xbacklight -inc 5 | increase screen brightness | screen | - | F3 | modkey | spawn | arandr | randr graphical frontend | screen | - | o | modkey | yes | awful.screen.focus_relative(1) | focus next screen | screen | +#+NAME: sc-screen +| Key | Modifiers | Lambda? | Action | What it does | Group | +|-----------------------+--------------+---------+---------------------------------+----------------------------+--------| +| t | modkey, meta | yes | awful.screen.focus_relative(1) | focus next screen | screen | +| s | modkey, meta | yes | awful.screen.focus_relative(-1) | focus previous screen | screen | +| XF86MonBrightnessDown | | shell | xbacklight -dec 5 | decrease screen brightness | screen | +| Next | modkey, meta | shell | xbacklight -dec 5 | decrease screen brightness | screen | +| XF86MonBrightnessUp | | shell | xbacklight -inc 5 | increase screen brightness | screen | +| Prev | modkey, meta | shell | xbacklight -inc 5 | increase screen brightness | screen | +| F3 | modkey | spawn | arandr | randr graphical frontend | screen | +| o | modkey | yes | awful.screen.focus_relative(1) | focus next screen | screen | ** Tags :PROPERTIES: :CUSTOM_ID: Keybindings-Tags-3424b757 :END: - #+NAME: sc-tag - | Key | Modifiers | Lambda? | Action | What it does | Group | - |--------+-----------------+---------+---------------------------+--------------+-------| - | Escape | modkey | no | awful.tag.history.restore | go back | tag | - | t | modkey, control | no | awful.tag.viewprev | view prev | tag | - | s | modkey, control | no | awful.tag.viewnext | view next | tag | +#+NAME: sc-tag +| Key | Modifiers | Lambda? | Action | What it does | Group | +|--------+-----------------+---------+---------------------------+--------------+-------| +| Escape | modkey | no | awful.tag.history.restore | go back | tag | +| t | modkey, control | no | awful.tag.viewprev | view prev | tag | +| s | modkey, control | no | awful.tag.viewnext | view next | tag | - 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: - #+NAME: sc-tag-num - | Key | Modifiers | Action | What it does | Group | - |--------+------------------------+---------------------------------+--------------------------------+-------| - | Number | modkey | view_tag_n( | view tag # | tag | - | Number | modkey, control | toggle_tag_n( | toggle tag # | tag | - | Number | modkey, shift | move_focused_to_tag_n( | move focused client to tag # | tag | - | Number | modkey, control, shift | toggle_focused_client_to_tag_n( | Toggle focused client on tag # | tag | +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: +#+NAME: sc-tag-num +| Key | Modifiers | Action | What it does | Group | +|--------+------------------------+---------------------------------+--------------------------------+-------| +| Number | modkey | view_tag_n( | view tag # | tag | +| Number | modkey, control | toggle_tag_n( | toggle tag # | tag | +| Number | modkey, shift | move_focused_to_tag_n( | move focused client to tag # | tag | +| Number | modkey, control, shift | toggle_focused_client_to_tag_n( | Toggle focused client on tag # | tag | ** Misc :PROPERTIES: :CUSTOM_ID: Keybindings-Misc-0b45ce02 :END: - In this category you will find other keybindings that do not fit in other - categories. For now, the only keybinding that is in this category is for - toggling the touchpad’s tapping ability. This is linked to a special script I - wrote [[file:bin.org::#Toggle_touchpad_tapping-23348b00][here]]. - #+NAME: sc-misc - | Key | Modifiers | Lambda? | Action | What it does | Group | - |--------------------+-----------+---------+-----------+-------------------------+-------| - | XF86TouchpadToggle | | shell | tttapping | toggle touchpad tapping | misc | +In this category you will find other keybindings that do not fit in other categories. For now, the only keybinding that is in this category is for toggling the touchpad’s tapping ability. This is linked to a special script I wrote [[file:bin.org::#Toggle_touchpad_tapping-23348b00][here]]. +#+NAME: sc-misc +| Key | Modifiers | Lambda? | Action | What it does | Group | +|--------------------+-----------+---------+-----------+-------------------------+-------| +| XF86TouchpadToggle | | shell | tttapping | toggle touchpad tapping | misc | * Rules :PROPERTIES: :CUSTOM_ID: Rules-c6142cdf :END: - 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: - #+BEGIN_SRC lua :tangle no - awful.rules.rules = { - -- Rules here - } - #+END_SRC +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: +#+BEGIN_SRC lua :tangle no + awful.rules.rules = { + -- Rules here + } +#+END_SRC - # Block for exporting rules from below - #+BEGIN_SRC lua :exports none - awful.rules.rules = { - <>, - <>, - <>, - <> - } - #+END_SRC +# Block for exporting rules from below +#+BEGIN_SRC lua :exports none + awful.rules.rules = { + <>, + <>, + <>, + <> + } +#+END_SRC - For more documentation on rules and their syntax, you can read the [[https://awesomewm.org/doc/api/libraries/awful.rules.html][official - documentation]]. +For more documentation on rules and their syntax, you can read the [[https://awesomewm.org/doc/api/libraries/awful.rules.html][official documentation]]. ** Universal rules :PROPERTIES: :CUSTOM_ID: Rules-Universal_rules-50aad2ce :END: - The first rule is a universal rule which will match all clients, as you can - see with its syntax below: - #+BEGIN_SRC lua :tangle no - { rule = {}, - properties = { - -- List of properties - } +The first rule is a universal rule which will match all clients, as you can see with its syntax below: +#+BEGIN_SRC lua :tangle no + { rule = {}, + properties = { + -- List of properties + } + } +#+END_SRC + +Here is the list of properties with their value to apply to all clients, and a short explanation as to what they do. +#+NAME: rules-universal-properties-table +| Property | Value | What it does | +|---------------+---------------------------------------------------------+-------------------------------------------------------------------------| +| border_width | beautiful.border_width | Set the width of the window’s border | +| border_color | beautiful.border_normal | Set the color of the window’s border | +| focus | awful.client.focus.filter | Set focus on the new window, except filtered out windows | +| raise | true | Set it as raised window | +| keys | clientkeys | Set the client’s shortcuts set in [[*Clients][Shortcuts/Clients]] | +| buttons | clientbuttons | Set the client’s mouse shortcuts from [[#Mouse_bindings-eb4a69a8][Mouse bindings]] | +| screen | awful.screen.preferred | Spawn the client on the main screen | +| placement | awful.placement.no_overlap+awful.placement.no_offscreen | Avoid the client to appear off the screen and overlaping another client | +| round_corners | true | Enable rounded corners for client | + +#+NAME: rules-universal-properties +#+BEGIN_SRC emacs-lisp :tangle no :exports none :var properties=rules-universal-properties-table :cache yes + (mapconcat (lambda (x) + (format "%s = %s" + (car x) + (cadr x))) + properties + ",\n") +#+END_SRC + +#+RESULTS[5ddcb42f901ac56237de5ed102800b588f462100]: rules-universal-properties +: border_width = beautiful.border_width, +: border_color = beautiful.border_normal, +: focus = awful.client.focus.filter, +: raise = true, +: keys = clientkeys, +: buttons = clientbuttons, +: screen = awful.screen.preferred, +: placement = awful.placement.no_overlap+awful.placement.no_offscreen, +: round_corners = true + +This is what my universal rules look like: +#+NAME: rules-universal +#+BEGIN_SRC lua :tangle no + { rule = {}, + properties = { + <> } - #+END_SRC - - Here is the list of properties with their value to apply to all clients, and - a short explanation as to what they do. - #+NAME: rules-universal-properties-table - | Property | Value | What it does | - |---------------+---------------------------------------------------------+-------------------------------------------------------------------------| - | border_width | beautiful.border_width | Set the width of the window’s border | - | border_color | beautiful.border_normal | Set the color of the window’s border | - | focus | awful.client.focus.filter | Set focus on the new window, except filtered out windows | - | raise | true | Set it as raised window | - | keys | clientkeys | Set the client’s shortcuts set in [[*Clients][Shortcuts/Clients]] | - | buttons | clientbuttons | Set the client’s mouse shortcuts from [[#Mouse_bindings-eb4a69a8][Mouse bindings]] | - | screen | awful.screen.preferred | Spawn the client on the main screen | - | placement | awful.placement.no_overlap+awful.placement.no_offscreen | Avoid the client to appear off the screen and overlaping another client | - | round_corners | true | Enable rounded corners for client | - - #+NAME: rules-universal-properties - #+BEGIN_SRC emacs-lisp :tangle no :exports none :var properties=rules-universal-properties-table :cache yes - (mapconcat (lambda (x) - (format "%s = %s" - (car x) - (cadr x))) - properties - ",\n") - #+END_SRC - - #+RESULTS[5ddcb42f901ac56237de5ed102800b588f462100]: rules-universal-properties - : border_width = beautiful.border_width, - : border_color = beautiful.border_normal, - : focus = awful.client.focus.filter, - : raise = true, - : keys = clientkeys, - : buttons = clientbuttons, - : screen = awful.screen.preferred, - : placement = awful.placement.no_overlap+awful.placement.no_offscreen, - : round_corners = true - - This is what my universal rules look like: - #+NAME: rules-universal - #+BEGIN_SRC lua :tangle no - { rule = {}, - properties = { - <> - } - } - #+END_SRC + } +#+END_SRC ** Floating clients :PROPERTIES: :CUSTOM_ID: Rules-Floating_clients-49ab582e :END: - 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: - #+NAME: rules-floating-conditions-table - | Property | Matches | Comment | - |----------+--------------+----------------------------------------------------------------| - | instance | pinentry | Matches any Polkit | - | class | Arandr | Visual frontend for Randr | - | class | Sxiv | Simple X Image Viewer | - | class | Tor Browser | Needs a fixed window size to avoid fingerprinting | - | name | Event Tester | xev | - | role | pop-up | Any pop-up window, such as Chromium’s detached Developer Tools | +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: +#+NAME: rules-floating-conditions-table +| Property | Matches | Comment | +|----------+--------------+----------------------------------------------------------------| +| instance | pinentry | Matches any Polkit | +| class | Arandr | Visual frontend for Randr | +| class | Sxiv | Simple X Image Viewer | +| class | Tor Browser | Needs a fixed window size to avoid fingerprinting | +| name | Event Tester | xev | +| role | pop-up | Any pop-up window, such as Chromium’s detached Developer Tools | - #+NAME: rules-floating-conditions - #+BEGIN_SRC emacs-lisp :exports none :tangle no :var conditions=rules-floating-conditions-table :cache yes - (mapconcat (lambda (x) - (format "%s = { \"%s\" }" (car x) (cadr x))) - conditions - ",\n") - #+END_SRC +#+NAME: rules-floating-conditions +#+BEGIN_SRC emacs-lisp :exports none :tangle no :var conditions=rules-floating-conditions-table :cache yes + (mapconcat (lambda (x) + (format "%s = { \"%s\" }" (car x) (cadr x))) + conditions + ",\n") +#+END_SRC - #+RESULTS: rules-floating-conditions - : instance = { "pinentry" }, - : class = { "Arandr" }, - : class = { "Sxiv" }, - : class = { "Tor Browser" }, - : name = { "Event Tester" }, - : role = { "pop-up" } +#+RESULTS[1fbe7dc1e85b5170957c9583e39c4cbec9a7d7ca]: rules-floating-conditions +: instance = { "pinentry" }, +: class = { "Arandr" }, +: class = { "Sxiv" }, +: class = { "Tor Browser" }, +: name = { "Event Tester" }, +: role = { "pop-up" } - If any of these conditions is matched, then the client will be set as - floating, as you can see below: - #+NAME: rules-floating - #+BEGIN_SRC lua :tangle no - { rule_any = { - <> - }, properties = { floating = true }} - #+END_SRC +If any of these conditions is matched, then the client will be set as floating, as you can see below: +#+NAME: rules-floating +#+BEGIN_SRC lua :tangle no + { rule_any = { + <> + }, properties = { floating = true }} +#+END_SRC ** Titlebars :PROPERTIES: :CUSTOM_ID: Rules-Titlebars-b532fdba :END: - Any normal or dialog client will get a titlebar. This is enabled like so: - #+NAME: rules-titlebars - #+BEGIN_SRC lua :tangle no - { rule_any = {type = { "normal", "dialog" } - }, properties = { titlebars_enabled = true } - } - #+END_SRC +Any normal or dialog client will get a titlebar. This is enabled like so: +#+NAME: rules-titlebars +#+BEGIN_SRC lua :tangle no + { rule_any = {type = { "normal", "dialog" } + }, properties = { titlebars_enabled = true } + } +#+END_SRC ** Default tag for clients :PROPERTIES: :CUSTOM_ID: Rules-Default_tag_for_clients-6ded2a47 :END: - With the use of some rules, it is possible to define which client are - assigned to which tag by default. - #+NAME: rules-default-tags-table - | Client Property | Value | Tag | - |-----------------+------------+-----| - | class | Emacs | 2 | - | class | firefox | 3 | - | class | Nemo | 4 | - | class | Gimp* | 5 | - | class | discord | 0 | - | class | mattermost | 0 | - | class | Steam | 9 | +With the use of some rules, it is possible to define which client are assigned to which tag by default. +#+NAME: rules-default-tags-table +| Client Property | Value | Tag | +|-----------------+------------+-----| +| class | Emacs | 2 | +| class | firefox | 3 | +| class | Nemo | 4 | +| class | Gimp* | 5 | +| class | discord | 0 | +| class | mattermost | 0 | +| class | Steam | 9 | - #+NAME: rules-default-tags-generate - #+BEGIN_SRC emacs-lisp :tangle no :exports none :cache yes :var tags=rules-default-tags-table - (mapconcat (lambda (x) - (format "{rule = {%s = \"%s\"}, properties = {screen = 1, tag = \"%d\"} }" - (nth 0 x) (nth 1 x) (nth 2 x))) - tags - ",\n") - #+END_SRC +#+NAME: rules-default-tags-generate +#+BEGIN_SRC emacs-lisp :tangle no :exports none :cache yes :var tags=rules-default-tags-table + (mapconcat (lambda (x) + (format "{rule = {%s = \"%s\"}, properties = {screen = 1, tag = \"%d\"} }" + (nth 0 x) (nth 1 x) (nth 2 x))) + tags + ",\n") +#+END_SRC - #+RESULTS[ec74b9e45bd477d22e2865de30a9c64973cf0927]: rules-default-tags-generate - : {rule = {class = "Emacs"}, properties = {screen = 1, tag = "2"} }, - : {rule = {class = "firefox"}, properties = {screen = 1, tag = "3"} }, - : {rule = {class = "Nemo"}, properties = {screen = 1, tag = "4"} }, - : {rule = {class = "Gimp*"}, properties = {screen = 1, tag = "5"} }, - : {rule = {class = "discord"}, properties = {screen = 1, tag = "0"} }, - : {rule = {class = "mattermost"}, properties = {screen = 1, tag = "0"} }, - : {rule = {class = "Steam"}, properties = {screen = 1, tag = "9"} } +#+RESULTS[ec74b9e45bd477d22e2865de30a9c64973cf0927]: rules-default-tags-generate +: {rule = {class = "Emacs"}, properties = {screen = 1, tag = "2"} }, +: {rule = {class = "firefox"}, properties = {screen = 1, tag = "3"} }, +: {rule = {class = "Nemo"}, properties = {screen = 1, tag = "4"} }, +: {rule = {class = "Gimp*"}, properties = {screen = 1, tag = "5"} }, +: {rule = {class = "discord"}, properties = {screen = 1, tag = "0"} }, +: {rule = {class = "mattermost"}, properties = {screen = 1, tag = "0"} }, +: {rule = {class = "Steam"}, properties = {screen = 1, tag = "9"} } - This is what these rules look like: - #+NAME: rules-default-tags - #+BEGIN_SRC lua :tangle no - <> - #+END_SRC +This is what these rules look like: +#+NAME: rules-default-tags +#+BEGIN_SRC lua :tangle no + <> +#+END_SRC * Signals :PROPERTIES: :CUSTOM_ID: Signals-e32971d6 :END: - Signals are a way for Awesome to handle events, such as client creation or - deletion. +Signals are a way for Awesome to handle events, such as client creation or deletion. ** Client creation :PROPERTIES: :CUSTOM_ID: Signals-Client_creation-8048ac12 :END: - 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. - #+BEGIN_SRC lua +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. +#+BEGIN_SRC lua client.connect_signal("manage", function (c) awful.client.movetoscreen(c, mouse.screen) if awesome.startup @@ -1380,145 +1259,117 @@ :PROPERTIES: :CUSTOM_ID: Signals-Titlebar_creation-3b1aaa14 :END: - 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. - #+BEGIN_SRC lua - client.connect_signal("request::titlebars", function(c) - local buttons = gears.table.join( - <>, - <> - ) - <> - end) - #+END_SRC +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. +#+BEGIN_SRC lua + client.connect_signal("request::titlebars", function(c) + local buttons = gears.table.join( + <>, + <> + ) + <> + end) +#+END_SRC - 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. - #+BEGIN_SRC lua :tangle no - local buttons = gears.table.join( - -- Buttons declared here - ) - #+END_SRC +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. +#+BEGIN_SRC lua :tangle no + local buttons = gears.table.join( + -- Buttons declared here + ) +#+END_SRC - 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). - #+NAME: signal-titlebar-button1 - #+BEGIN_SRC lua :tangle no - awful.button({ }, 1, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.move(c) - end) - #+END_SRC +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). +#+NAME: signal-titlebar-button1 +#+BEGIN_SRC lua :tangle no + awful.button({ }, 1, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.move(c) + end) +#+END_SRC - A right click on the titlebar will also raise the window, but will instead - allow the user to resize the client. - #+NAME: signal-titlebar-button3 - #+BEGIN_SRC lua :tangle no - awful.button({ }, 3, function() - c:emit_signal("request::activate", "titlebar", {raise = true}) - awful.mouse.client.resize(c) - end) - #+END_SRC +A right click on the titlebar will also raise the window, but will instead allow the user to resize the client. +#+NAME: signal-titlebar-button3 +#+BEGIN_SRC lua :tangle no + awful.button({ }, 3, function() + c:emit_signal("request::activate", "titlebar", {raise = true}) + awful.mouse.client.resize(c) + end) +#+END_SRC - 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: - #+NAME: signal-titlebar-create - #+BEGIN_SRC lua :tangle no - awful.titlebar(c, {position="left"}) : setup { - <> - } - #+END_SRC +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: +#+NAME: signal-titlebar-create +#+BEGIN_SRC lua :tangle no + awful.titlebar(c, {position="left"}) : setup { + <> + } +#+END_SRC - 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: - - The top or left elements of the titlebar (here the top) - - The middle elements of the titlebar - - The bottom or right elements of the titlebar (here the bottom) - You can notice in the setup’s code below that I haven’t included anything in - the middle elements, the only elements I am interested in are the top and - bottom elements. In the top elements, I have (top to bottom): - - A close button - - A maximize button - - A minimize button - - And an indication to Awesome these elements should be vertically aligned - To make Awesome happy, I also must indicate that the middle elements are - vertically aligned, and then I can declare my bottom elements: - - A button for toggling client floating - - And again the indication to Awesome these elements should be vertically - aligned - #+NAME: signal-titlebar-setup - #+BEGIN_SRC lua :tangle no - { -- Top - awful.titlebar.widget.closebutton(c), - awful.titlebar.widget.maximizedbutton(c), - awful.titlebar.widget.minimizebutton(c), - layout = wibox.layout.fixed.vertical() - }, - { - layout = wibox.layout.fixed.vertical() - }, -- Middle - { -- Bottom - awful.titlebar.widget.floatingbutton(c), - layout = wibox.layout.fixed.vertical() - }, - layout = wibox.layout.align.vertical, - position = "left" - #+END_SRC +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: +- The top or left elements of the titlebar (here the top) +- The middle elements of the titlebar +- The bottom or right elements of the titlebar (here the bottom) +You can notice in the setup’s code below that I haven’t included anything in the middle elements, the only elements I am interested in are the top and bottom elements. In the top elements, I have (top to bottom): +- A close button +- A maximize button +- A minimize button +- And an indication to Awesome these elements should be vertically aligned +To make Awesome happy, I also must indicate that the middle elements are vertically aligned, and then I can declare my bottom elements: +- A button for toggling client floating +- And again the indication to Awesome these elements should be vertically aligned +#+NAME: signal-titlebar-setup +#+BEGIN_SRC lua :tangle no + { -- Top + awful.titlebar.widget.closebutton(c), + awful.titlebar.widget.maximizedbutton(c), + awful.titlebar.widget.minimizebutton(c), + layout = wibox.layout.fixed.vertical() + }, + { + layout = wibox.layout.fixed.vertical() + }, -- Middle + { -- Bottom + awful.titlebar.widget.floatingbutton(c), + layout = wibox.layout.fixed.vertical() + }, + layout = wibox.layout.align.vertical, + position = "left" +#+END_SRC ** Changes of focus :PROPERTIES: :CUSTOM_ID: Signals-Changes_of_focus-1b73902c :END: - The default Awesome configuration enables the following snippet of code that - makes windows hovered by the user’s mouse focused. Just for completeness’ - sake, I included it in this document, but be aware this won’t be tangled into - my configuration file and focus will not follow my mouse. - #+BEGIN_SRC lua :tangle no - client.connect_signal("mouse::enter", function(c) - c:emit_signal("request::activate", "mouse_enter", {raise = false}) - end) - #+END_SRC +The default Awesome configuration enables the following snippet of code that makes windows hovered by the user’s mouse focused. Just for completeness’ sake, I included it in this document, but be aware this won’t be tangled into my configuration file and focus will not follow my mouse. +#+BEGIN_SRC lua :tangle no + client.connect_signal("mouse::enter", function(c) + c:emit_signal("request::activate", "mouse_enter", {raise = false}) + end) +#+END_SRC - It is also possible to change the color of the borders based on client focus. - While my clients don’t have any border, they do have a titlebar which color - changes based on the client’s focus. This is handled by the following code - snippet: - #+BEGIN_SRC lua - client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) - client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) - #+end_SRC +It is also possible to change the color of the borders based on client focus. While my clients don’t have any border, they do have a titlebar which color changes based on the client’s focus. This is handled by the following code snippet: +#+BEGIN_SRC lua + client.connect_signal("focus", function(c) c.border_color = beautiful.border_focus end) + client.connect_signal("unfocus", function(c) c.border_color = beautiful.border_normal end) +#+end_SRC * Autostart :PROPERTIES: :CUSTOM_ID: Autostart-f2cf42fe :END: - 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. - #+BEGIN_SRC lua - awful.spawn.with_shell("autostart") - #+END_SRC +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. +#+BEGIN_SRC lua + awful.spawn.with_shell("autostart") +#+END_SRC * What to do now :noexport: :PROPERTIES: :CUSTOM_ID: What_to_do_now-bce61fe1 :END: - ** DONE Error on S-q CLOSED: [2020-04-12 dim. 15:47] :PROPERTIES: :CUSTOM_ID: What_to_do_now-Error_on_S-q-beea9b99 :END: - ~attempt to index a nil value (global 'c')~ +~attempt to index a nil value (global 'c')~ ** TODO Make custom theme :PROPERTIES: diff --git a/org/config/bin.org b/org/config/bin.org index 8226d8a..32fbb3d 100644 --- a/org/config/bin.org +++ b/org/config/bin.org @@ -11,243 +11,151 @@ :PROPERTIES: :CUSTOM_ID: Presentation-721f3cc4 :END: - 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. - -* 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. - Let’s 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, let’s 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 - - We’ll 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, let’s 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 - - Let’s set a file counter so we can visualize the download progress. - #+BEGIN_SRC fish - set file_counter 1 - #+END_SRC - - Now, let’s 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 - - Let’s increment the thread counter. - #+BEGIN_SRC fish - set thread_counter (math $thread_counter + 1) - #+END_SRC - - Let’s now close the for loop. - #+BEGIN_SRC fish - end - #+END_SRC +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. * Autostart :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/autostart :CUSTOM_ID: Autostart-a99e99e7 :END: - 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. +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. - ~set-screens~ is a custom script declared [[*set-screens][below]]. - #+NAME: autostart-table - | Command | Arguments | Run once? | - |---------------+---------------------------------------------------------------+-----------| - | ~set-screens~ | | | - | ~pumopm~ | | yes | - | ~xfce-polkit~ | | yes | - | ~xss-lock~ | ~plock~ | yes | - | ~picom~ | ~--experimental-backends~ | yes | - | ~xidlehook~ | ~--not-when-audio --not-when-fullscreen --timer 3600 lock ''~ | yes | - | ~nm-applet~ | | yes | - | ~numlockx~ | ~on~ | yes | - | ~nitrogen~ | ~--restore~ | no | - | ~mpc~ | ~stop~ | no | - | ~emacsclient~ | ~-c -e "(delete-frame)"~ | no | +~set-screens~ is a custom script declared [[*set-screens][below]]. +#+NAME: autostart-table +| Command | Arguments | Run once? | +|---------------+---------------------------------------------------------------+-----------| +| ~set-screens~ | | | +| ~pumopm~ | | yes | +| ~xfce-polkit~ | | yes | +| ~xss-lock~ | ~plock~ | yes | +| ~picom~ | ~--experimental-backends~ | yes | +| ~xidlehook~ | ~--not-when-audio --not-when-fullscreen --timer 3600 lock ''~ | yes | +| ~nm-applet~ | | yes | +| ~numlockx~ | ~on~ | yes | +| ~nitrogen~ | ~--restore~ | no | +| ~mpc~ | ~stop~ | no | +| ~emacsclient~ | ~-c -e "(delete-frame)"~ | no | - #+NAME: autostart-gen - #+BEGIN_SRC emacs-lisp :var table=autostart-table :cache yes - (mapconcat (lambda ($start-command) - (let* (($command (s-replace "~" "" (nth 0 $start-command))) - ($arguments (s-replace "~" "" (nth 1 $start-command))) - ($once? (string= "yes" (nth 2 $start-command)))) - (if $once? - (concat (format "if ! test (pgrep %s 2&> /dev/null)\n\t" $command) - (s-collapse-whitespace (format "%s %s & && disown" $command $arguments)) - "\nend\n") - (format "%s %s &\n" $command $arguments)))) - table - "\n") - #+END_SRC +#+NAME: autostart-gen +#+BEGIN_SRC emacs-lisp :var table=autostart-table :cache yes + (mapconcat (lambda ($start-command) + (let* (($command (s-replace "~" "" (nth 0 $start-command))) + ($arguments (s-replace "~" "" (nth 1 $start-command))) + ($once? (string= "yes" (nth 2 $start-command)))) + (if $once? + (concat (format "if ! test (pgrep %s 2&> /dev/null)\n\t" $command) + (s-collapse-whitespace (format "%s %s & && disown" $command $arguments)) + "\nend\n") + (format "%s %s &\n" $command $arguments)))) + table + "\n") +#+END_SRC - #+RESULTS[2dc7d381730eee5658caea010f3f0db75749107a]: autostart-gen - #+begin_example - set-screens & +#+RESULTS[2dc7d381730eee5658caea010f3f0db75749107a]: autostart-gen +#+begin_example +set-screens & - if ! test (pgrep pumopm 2&> /dev/null) - pumopm & && disown - end +if ! test (pgrep pumopm 2&> /dev/null) + pumopm & && disown +end - if ! test (pgrep xfce-polkit 2&> /dev/null) - xfce-polkit & && disown - end +if ! test (pgrep xfce-polkit 2&> /dev/null) + xfce-polkit & && disown +end - if ! test (pgrep xss-lock 2&> /dev/null) - xss-lock plock & && disown - end +if ! test (pgrep xss-lock 2&> /dev/null) + xss-lock plock & && disown +end - if ! test (pgrep picom 2&> /dev/null) - picom --experimental-backends & && disown - end +if ! test (pgrep picom 2&> /dev/null) + picom --experimental-backends & && disown +end - if ! test (pgrep xidlehook 2&> /dev/null) - xidlehook --not-when-audio --not-when-fullscreen --timer 3600 lock '' & && disown - end +if ! test (pgrep xidlehook 2&> /dev/null) + xidlehook --not-when-audio --not-when-fullscreen --timer 3600 lock '' & && disown +end - if ! test (pgrep nm-applet 2&> /dev/null) - nm-applet & && disown - end +if ! test (pgrep nm-applet 2&> /dev/null) + nm-applet & && disown +end - if ! test (pgrep numlockx 2&> /dev/null) - numlockx on & && disown - end +if ! test (pgrep numlockx 2&> /dev/null) + numlockx on & && disown +end - nitrogen --restore & +nitrogen --restore & - mpc stop & +mpc stop & - emacsclient -c -e "(delete-frame)" & - #+end_example +emacsclient -c -e "(delete-frame)" & +#+end_example - #+BEGIN_SRC fish :noweb yes - set -l PATH $PATH /usr/lib/xfce-polkit +#+BEGIN_SRC fish :noweb yes + set -l PATH $PATH /usr/lib/xfce-polkit - <> - #+END_SRC + <> +#+END_SRC * awiki :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/awiki :CUSTOM_ID: awiki-7ac5e1d5 :END: - ~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. +~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. - 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. - #+BEGIN_SRC fish - set WLOCATION /usr/share/doc/arch-wiki/html/en/ - set WPAGE (/bin/ls $WLOCATION | \ - sed -e 's/_/ /g' -e 's/\.html$//' -e 's|.*/\(.*\)|\1|' | \ - rofi -dmenu -p "Arch Wiki" -i | sed 's/ +/_/g') - #+END_SRC +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. +#+BEGIN_SRC fish + set WLOCATION /usr/share/doc/arch-wiki/html/en/ + set WPAGE (/bin/ls $WLOCATION | \ + sed -e 's/_/ /g' -e 's/\.html$//' -e 's|.*/\(.*\)|\1|' | \ + rofi -dmenu -p "Arch Wiki" -i | sed 's/ +/_/g') +#+END_SRC - 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~. - #+BEGIN_SRC fish - xdg-open $WLOCATION$WPAGE.html - #+END_SRC +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~. +#+BEGIN_SRC fish + xdg-open $WLOCATION$WPAGE.html +#+END_SRC * Askpass :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/askpass :CUSTOM_ID: Askpass-d0d7a8c0 :END: - Askpass is a simple script that invokes ~rofi~ as a way to get from a GUI the - user’s 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 - rofi -dmenu -password -no-fixed-num-lines -p (printf $argv[1] | sed s/://) - #+END_SRC +Askpass is a simple script that invokes ~rofi~ as a way to get from a GUI the user’s 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 + rofi -dmenu -password -no-fixed-num-lines -p (printf $argv[1] | sed s/://) +#+END_SRC * Backup :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/backup :CUSTOM_ID: Backup-68c7c63e :END: - ~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: - #+BEGIN_SRC fish - cp -r $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S") - #+END_SRC +~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: +#+BEGIN_SRC fish + cp -r $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S") +#+END_SRC -* ConnectWifi +* ConnectWifi :noexport: :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/connect-wifi :CUSTOM_ID: ConnectWifi-16e5e24a :END: - ~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. We’ll use the ~nmcli c s~ command to get the list of the - available networks, and we’ll chose one with ~rofi~. - #+BEGIN_SRC fish - set SELECTEDWIFI (nmcli d w l | \ - egrep -o '([0-9A-F]{2}:){5}[0-9A-F]{2}\s*(.*)Infra' | \ - egrep -o '\s+(.*)\s+' | awk '{$1=$1}1' | \ - rofi -dmenu -p "Select your WiFi network") - #+END_SRC - Now, if a network was selected, let’s attempt to connect to it. Otherwise, - let’s just send a notification no network was selected. - #+BEGIN_SRC fish - if test -z $SELECTEDWIFI - notify-send "No WiFi network selected" -u low && exit - end - nmcli c u $SELECTEDWIFI - #+END_SRC +~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. We’ll use the ~nmcli c s~ command to get the list of the available networks, and we’ll chose one with ~rofi~. +#+BEGIN_SRC fish + set SELECTEDWIFI (nmcli d w l | \ + egrep -o '([0-9A-F]{2}:){5}[0-9A-F]{2}\s*(.*)Infra' | \ + egrep -o '\s+(.*)\s+' | awk '{$1=$1}1' | \ + rofi -dmenu -p "Select your WiFi network") +#+END_SRC +Now, if a network was selected, let’s attempt to connect to it. Otherwise, +let’s just send a notification no network was selected. +#+BEGIN_SRC fish + if test -z $SELECTEDWIFI + notify-send "No WiFi network selected" -u low && exit + end + nmcli c u $SELECTEDWIFI +#+END_SRC ** TODO fix it :PROPERTIES: @@ -259,148 +167,130 @@ :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :tangle no :CUSTOM_ID: Cppnew-964e697b :END: - =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: - - CMake + [[https://conan.io/][Conan]] - - [[https://mesonbuild.com/][Meson]] + [[https://ninja-build.org/][Ninja]] - - Meson + Ninja + Conan - 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. +=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: +- CMake + [[https://conan.io/][Conan]] +- [[https://mesonbuild.com/][Meson]] + [[https://ninja-build.org/][Ninja]] +- Meson + Ninja + Conan +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. - The choice is given to the user which of them to use with options that will be - given to =cppnew=. +The choice is given to the user which of them to use with options that will be given to =cppnew=. - First of all, if no arguments were passed, return an error. - #+begin_src fish - if ! count $argv >/dev/null - echo "Missing argument: PROJECT" && return -1 - end - #+end_src +First of all, if no arguments were passed, return an error. +#+begin_src fish + if ! count $argv >/dev/null + echo "Missing argument: PROJECT" && return -1 + end +#+end_src - Now, let’s set a couple of variables which will prove useful later on when - trying to set up our project. +Now, let’s set a couple of variables which will prove useful later on when trying to set up our project. * Cnew :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/cnew :CUSTOM_ID: Cnew-d9ec9cc4 :END: - =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. - #+BEGIN_SRC fish - if ! count $argv > /dev/null - echo "Missing argument: PROJECT" && return -1 - end - #+END_SRC - - Pass the first argument to a switch statement. - #+BEGIN_SRC fish - switch "$argv[1]" - #+END_SRC - - If the argument is =-h= or =--help=, then display the help message and exit - the script normally. - #+BEGIN_SRC fish - case -h --help - man ~/dev/fishfunctions/cnew.man - exit 0 - #+END_SRC - - Else, the argument is the name of the project the user wants to create. - #+BEGIN_SRC fish - case '*' - set -g project_name $argv[1] - #+END_SRC - - Let’s close the switch statement. - #+BEGIN_SRC fish +=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. +#+BEGIN_SRC fish + if ! count $argv > /dev/null + echo "Missing argument: PROJECT" && return -1 end - #+END_SRC +#+END_SRC - Now, let’s copy the template where the user is executing =cnew= from, give it - the name of the project and move to the project. - #+BEGIN_SRC fish - cp -r ~/dev/templateC $argv[1] - cd $argv[1] - #+END_SRC +Pass the first argument to a switch statement. +#+BEGIN_SRC fish +switch "$argv[1]" +#+END_SRC - The default files have a placeholder for the name of the project. Let’s - replace these placeholders with the project’s name. - #+BEGIN_SRC fish - sed -i "s/PROJECTNAME/$argv[1]/g" CMakeLists.txt - sed -i "s/PROJECTNAME/$argv[1]/g" README.org - sed -i "s/CPROJECTNAME/$argv[1]/g" doc/Doxyfile - #+END_SRC +If the argument is =-h= or =--help=, then display the help message and exit the script normally. +#+BEGIN_SRC fish + case -h --help + man ~/dev/fishfunctions/cnew.man + exit 0 +#+END_SRC - Now, let’s create a git repository and initialize it. - #+BEGIN_SRC fish - git init - git add . - git commit -m "initial commit" - #+END_SRC +Else, the argument is the name of the project the user wants to create. +#+BEGIN_SRC fish + case '*' + set -g project_name $argv[1] +#+END_SRC - And we’re done! +Let’s close the switch statement. +#+BEGIN_SRC fish +end +#+END_SRC + +Now, let’s copy the template where the user is executing =cnew= from, give it the name of the project and move to the project. +#+BEGIN_SRC fish + cp -r ~/dev/templateC $argv[1] + cd $argv[1] +#+END_SRC + +The default files have a placeholder for the name of the project. Let’s replace these placeholders with the project’s name. +#+BEGIN_SRC fish + sed -i "s/PROJECTNAME/$argv[1]/g" CMakeLists.txt + sed -i "s/PROJECTNAME/$argv[1]/g" README.org + sed -i "s/CPROJECTNAME/$argv[1]/g" doc/Doxyfile +#+END_SRC + +Now, let’s create a git repository and initialize it. +#+BEGIN_SRC fish + git init + git add . + git commit -m "initial commit" +#+END_SRC + +And we’re done! * Dart Language Server :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dart_language_server :CUSTOM_ID: Dart_Language_Server-18c256b1 :END: - 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: - #+BEGIN_SRC fish - /usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp - #+END_SRC - So, instead of using the obsolete executable, instead we will be calling the - analysis server as requested. +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: +#+BEGIN_SRC fish + /usr/bin/dart $DART_SDK/snapshots/analysis_server.dart.snapshot --lsp +#+END_SRC + +So, instead of using the obsolete executable, instead we will be calling the analysis server as requested. * Dmenu :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/dmenu :CUSTOM_ID: Dmenu-527edf04 :END: - I wrote this very simple script in order to replace =dmenu= with rofi’s - emulation of dmenu, since I prefer rofi’s appearance. It basically calls - rofi’s dmenu emulation with the arguments initially passed to dmenu. - #+BEGIN_SRC fish - rofi -dmenu $argv - #+END_SRC +I wrote this very simple script in order to replace =dmenu= with rofi’s emulation of dmenu, since I prefer rofi’s appearance. It basically calls rofi’s dmenu emulation with the arguments initially passed to dmenu. +#+BEGIN_SRC fish + rofi -dmenu $argv +#+END_SRC * Emacsmail :PROPERTIES: :HEADER-ARGS: :shebang "#!/bin/bash" :mkdirp yes :tangle ~/.local/bin/emacsmail :CUSTOM_ID: Emacsmail-afffb7cd :END: - 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. - #+BEGIN_SRC bash - emacsclient -c --eval "(browse-url-mail \"$@\")" - #+END_SRC +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. +#+BEGIN_SRC bash + emacsclient -c --eval "(browse-url-mail \"$@\")" +#+END_SRC * Emoji picker :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-emoji :CUSTOM_ID: Emoji_picker-a1c374ec :END: - 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=. - #+BEGIN_SRC fish - grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | \ - awk '{print $1}' | tr -d '\n' | xclip -selection clipboard - #+END_SRC +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=. +#+BEGIN_SRC fish + grep -v "#" ~/.config/emoji.txt | rofi -dmenu -p "Select emoji" -i | \ + awk '{print $1}' | tr -d '\n' | xclip -selection clipboard +#+END_SRC - Also, let’s send a notification telling the user the emoji has been copied! - #+BEGIN_SRC fish - set emoji (xclip -o -selection clipboard | tr -d '\n') - test -z "$emoji" && notify-send "No emoji copied" -u low && exit - set -a emoji "copied to clipboard" - notify-send -u low $emoji - #+END_SRC +Also, let’s send a notification telling the user the emoji has been copied! +#+BEGIN_SRC fish + set emoji (xclip -o -selection clipboard | tr -d '\n') + test -z "$emoji" && notify-send "No emoji copied" -u low && exit + set -a emoji "copied to clipboard" + notify-send -u low $emoji +#+END_SRC It is inspired from [[https://www.youtube.com/watch?v=UCEXY46t3OA][this video]] from [[https://lukesmith.xyz/][Luke Smith]], rewritten in Fish. @@ -409,1073 +299,951 @@ :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/mp42webm :CUSTOM_ID: mp42webm-aeacca58 :END: - This function allows me to convert easily an mp4 video to the webm format. - Nothing too fancy here. - #+BEGIN_SRC fish - ffmpeg -i $argv[1] -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $argv[1].webm - #+END_SRC +This function allows me to convert easily an mp4 video to the webm format. Nothing too fancy here. +#+BEGIN_SRC fish + ffmpeg -i $argv[1] -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis $argv[1].webm +#+END_SRC * pape-update :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/pape-update :CUSTOM_ID: pape-update-bdecbadf :END: - This little tool sets a random wallpaper using nitrogen. - #+BEGIN_SRC fish - set -l PAPESDIR ~/Pictures/Wallpapers - set -l PAPES (ls $PAPESDIR) - set -l PAPE $PAPESDIR/$PAPES[(random 1 (count $PAPES))] - for i in (seq (xrandr --current | grep ' connected' | wc -l)) - nitrogen --set-zoom-fill $PAPE --head=(math "$i - 1") --save - end - #+END_SRC +This little tool sets a random wallpaper using nitrogen. +#+BEGIN_SRC fish + set -l PAPESDIR ~/Pictures/Wallpapers + set -l PAPES (ls $PAPESDIR) + set -l PAPE $PAPESDIR/$PAPES[(random 1 (count $PAPES))] + for i in (seq (xrandr --current | grep ' connected' | wc -l)) + nitrogen --set-zoom-fill $PAPE --head=(math "$i - 1") --save + end +#+END_SRC * Pinfo :noexport: :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :tangle no :CUSTOM_ID: Pinfo-f3644596 :END: - ~pinfo~ is a utility that shows system information +~pinfo~ is a utility that shows system information * Plock :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/plock :CUSTOM_ID: Lock-635fcb38 :END: - ~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. - #+BEGIN_SRC fish - set TMPBG /tmp/screen.png - scrot $TMPBG - corrupter -add 0 $TMPBG $TMPBG - i3lock -t -e -f -i $TMPBG - rm $TMPBG - #+END_SRC +~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. +#+BEGIN_SRC fish + set TMPBG /tmp/screen.png + scrot $TMPBG + corrupter -add 0 $TMPBG $TMPBG + i3lock -t -e -f -i $TMPBG + rm $TMPBG +#+END_SRC * Polybar-launch (Deprecated) :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/polybar-launch :CUSTOM_ID: Polybar-launch-36789edc :END: - This scripts allows the user to kill polybar and relaunch it, or to simply - launch it if polybar isn’t launched yet. First thing to do is kill all polybar - processes. - #+BEGIN_SRC bash - killall -q polybar - #+END_SRC +This scripts allows the user to kill polybar and relaunch it, or to simply launch it if polybar isn’t launched yet. First thing to do is kill all polybar processes. +#+BEGIN_SRC bash +killall -q polybar +#+END_SRC - Now we have to wait untill all polybar processes have been shut down. - #+BEGIN_SRC bash - while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done - #+END_SRC +Now we have to wait untill all polybar processes have been shut down. +#+BEGIN_SRC bash +while pgrep -u $UID -x polybar >/dev/null; do sleep 1; done +#+END_SRC - Now that our system isn’t running polybar anymore, we’ll launch it again on - all of our screens. By the way, I have two bars, so I’ll have to lauch them - both. - #+BEGIN_SRC bash - if type "xrandr"; then - for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do - MONITOR=$m polybar --reload top & - MONITOR=$m polybar --reload bottom & - done - else - polybar --reload top & - polybar --reload bottom & - fi - #+END_SRC +Now that our system isn’t running polybar anymore, we’ll launch it again on all of our screens. By the way, I have two bars, so I’ll have to lauch them both. +#+BEGIN_SRC bash + if type "xrandr"; then + for m in $(xrandr --query | grep " connected" | cut -d" " -f1); do + MONITOR=$m polybar --reload top & + MONITOR=$m polybar --reload bottom & + done + else + polybar --reload top & + polybar --reload bottom & + fi +#+END_SRC - And we’re done! Let’s just launch a notification polybar has been relaunched. - #+BEGIN_SRC bash - notify-send "Polybar restarted!" -a "polybar-launch" - #+END_SRC +And we’re done! Let’s just launch a notification polybar has been relaunched. +#+BEGIN_SRC bash + notify-send "Polybar restarted!" -a "polybar-launch" +#+END_SRC * Rofi-mount :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-mount :CUSTOM_ID: Rofi-mount-ebbebf68 :END: - =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. +=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. ** Get the mountable elements :PROPERTIES: :CUSTOM_ID: Rofi-mount-Get_the_mountable_elements-24db7834 :END: - #+BEGIN_SRC fish - begin - #+END_SRC - What the script does first is detect everything that can be mounted. Between - a =begin= and =end=, let’s set =LFS= as a local variable. This si in order to - get sane variables in the current block. - #+BEGIN_SRC fish - set -l LFS - #+END_SRC +#+BEGIN_SRC fish + begin +#+END_SRC - Now, let’s detect the amount of mountable Android filesystems, and if any are - detected, let’s read them into a global variable. - #+BEGIN_SRC fish - set -l a (math (jmtpfs -l | wc -l) - 2) - test $a -ge 0 && jmtpfs -l 2> /dev/null | tail -n $a | read -zg anddrives - #+END_SRC +What the script does first is detect everything that can be mounted. Between a =begin= and =end=, let’s set =LFS= as a local variable. This si in order to get sane variables in the current block. +#+BEGIN_SRC fish +set -l LFS +#+END_SRC - We’ll do the same for external and internal drives and partitions that can be - mounted here. - #+BEGIN_SRC fish - lsblk -rpo "name,type,size,mountpoint" | \ - awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}' | \ - read -zg usbdrives - #+END_SRC +Now, let’s detect the amount of mountable Android filesystems, and if any are detected, let’s read them into a global variable. +#+BEGIN_SRC fish + set -l a (math (jmtpfs -l | wc -l) - 2) + test $a -ge 0 && jmtpfs -l 2> /dev/null | tail -n $a | read -zg anddrives +#+END_SRC - Finally, we look for any CD drive that could be mounted on our device. - #+BEGIN_SRC fish - blkid /dev/sr0 | awk '{print $1}' | sed 's/://' | read -z cddrives - #+END_SRC +We’ll do the same for external and internal drives and partitions that can be mounted here. +#+BEGIN_SRC fish + lsblk -rpo "name,type,size,mountpoint" | \ + awk '$2=="part"&&$4==""{printf "%s (%s)\n",$1,$3}' | \ + read -zg usbdrives +#+END_SRC - And that’s the end of our first block! - #+BEGIN_SRC fish - end - #+END_SRC +Finally, we look for any CD drive that could be mounted on our device. +#+BEGIN_SRC fish + blkid /dev/sr0 | awk '{print $1}' | sed 's/://' | read -z cddrives +#+END_SRC - Alright, we’ll save what kind on drives we can mount in a temporary file - called =/tmp/drives=. We’ll make sure it’s 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 doesn’t exist (yet). - #+BEGIN_SRC fish - set -g TMPDRIVES /tmp/drives - rm -f $TMPDRIVES - touch $TMPDRIVES - #+END_SRC +And that’s the end of our first block! +#+BEGIN_SRC fish + end +#+END_SRC - Now, let’s write what type of drives we can mount in this temporary file. - #+BEGIN_SRC fish - test -n "$usbdrives" && echo "USB" >> $TMPDRIVES - test -n "$cddrives" && echo "CD" >> $TMPDRIVES - test -n "$anddrives" && echo "Android" >> $TMPDRIVES - #+END_SRC +Alright, we’ll save what kind on drives we can mount in a temporary file called =/tmp/drives=. We’ll make sure it’s 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 doesn’t exist (yet). +#+BEGIN_SRC fish + set -g TMPDRIVES /tmp/drives + rm -f $TMPDRIVES + touch $TMPDRIVES +#+END_SRC - Now, we want to declare where to look for mount directories. For now, we’ll - only look in =/media=, but you can add more if you wish. - #+BEGIN_SRC fish - set -g basemount /media - #+END_SRC +Now, let’s write what type of drives we can mount in this temporary file. +#+BEGIN_SRC fish + test -n "$usbdrives" && echo "USB" >> $TMPDRIVES + test -n "$cddrives" && echo "CD" >> $TMPDRIVES + test -n "$anddrives" && echo "Android" >> $TMPDRIVES +#+END_SRC + +Now, we want to declare where to look for mount directories. For now, we’ll only look in =/media=, but you can add more if you wish. +#+BEGIN_SRC fish + set -g basemount /media +#+END_SRC ** Get the mount point :PROPERTIES: :CUSTOM_ID: Rofi-mount-Get_the_mount_point-6c4bac06 :END: - Now, let’s declare a function that will allow us to chose the drive we want - to mount. - #+BEGIN_SRC fish - function getmount - #+END_SRC +Now, let’s declare a function that will allow us to chose the drive we want to mount. +#+BEGIN_SRC fish + function getmount +#+END_SRC - First, we want to get our mount point. We’ll 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. - #+BEGIN_SRC fish - set -g mp (for d in $basemount - find $d -maxdepth 5 -type d - end | rofi -dmenu -i -p 'Type in mount point.') - #+END_SRC +First, we want to get our mount point. We’ll 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. +#+BEGIN_SRC fish + set -g mp (for d in $basemount + find $d -maxdepth 5 -type d + end | rofi -dmenu -i -p 'Type in mount point.') +#+END_SRC - We should verify that something has been actually selected, otherwise we - should abort the script. - #+BEGIN_SRC fish - if test -z $mp || test $mp = "" - return 1 - end - #+END_SRC +We should verify that something has been actually selected, otherwise we should abort the script. +#+BEGIN_SRC fish + if test -z $mp || test $mp = "" + return 1 + end +#+END_SRC - Now, if the selected mount point does not exist, we’ll 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. - #+BEGIN_SRC fish - if test ! -d $mp - switch (printf "No\\nYes" | rofi -dmenu -i -p "$mp does not exist. Create it?") - case 'Yes' - mkdir -p $mp || sudo -A mkdir -p $mp - case '*' - return 1 - end - end - #+END_SRC +Now, if the selected mount point does not exist, we’ll 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. +#+BEGIN_SRC fish + if test ! -d $mp + switch (printf "No\\nYes" | rofi -dmenu -i -p "$mp does not exist. Create it?") + case 'Yes' + mkdir -p $mp || sudo -A mkdir -p $mp + case '*' + return 1 + end + end +#+END_SRC - Finally, let’s close the function - #+BEGIN_SRC fish - end - #+END_SRC +Finally, let’s close the function +#+BEGIN_SRC fish + end +#+END_SRC ** Mount a USB drive, hard drive or partition :PROPERTIES: :CUSTOM_ID: Rofi-mount-Mount_a_USB_drive,_hard_drive_or_partition-f5431dbe :END: - Alright, we want to mount a partition that answers by the name of - =/dev/sdXX=, how do we do that? Let’s create first the function =mountusb= - that will take care of it for us. - #+BEGIN_SRC fish - function mountusb - #+END_SRC +Alright, we want to mount a partition that answers by the name of =/dev/sdXX=, how do we do that? Let’s create first the function =mountusb= that will take care of it for us. +#+BEGIN_SRC fish +function mountusb +#+END_SRC - Now, the first thing we want to do is select the partition we want to mount. - Remember, we stored those in =$usbdrives= earlier, so let’s pipe them into - rofi so we can chose from it. Also, =awk= will get their path in =/dev=. - #+BEGIN_SRC fish - set -g chosen (echo $usbdrives | \ - rofi -dmenu -i -p "Mount which drive?" | \ - awk '{print $1}') - #+END_SRC +Now, the first thing we want to do is select the partition we want to mount. Remember, we stored those in =$usbdrives= earlier, so let’s pipe them into rofi so we can chose from it. Also, =awk= will get their path in =/dev=. +#+BEGIN_SRC fish + set -g chosen (echo $usbdrives | \ + rofi -dmenu -i -p "Mount which drive?" | \ + awk '{print $1}') +#+END_SRC - As usual after a user selection, let’s verify something has actually been - selected. If not, let’s abort the script. - #+BEGIN_SRC fish - test -z $chosen && return 1 - #+END_SRC +As usual after a user selection, let’s verify something has actually been selected. If not, let’s abort the script. +#+BEGIN_SRC fish +test -z $chosen && return 1 +#+END_SRC - Now, let’s select the mount point of our partition. We’ll call the function - =getmount= described in [[#Rofi-mount-Get_the_mount_point-6c4bac06][Get the mount point]] to select it. - #+BEGIN_SRC fish - getmount - #+END_SRC +Now, let’s select the mount point of our partition. We’ll call the function =getmount= described in [[#Rofi-mount-Get_the_mount_point-6c4bac06][Get the mount point]] to select it. +#+BEGIN_SRC fish +getmount +#+END_SRC - Let’s verify the variable =mp= set in =getmount= is not empty, otherwise - abort the script. - #+BEGIN_SRC fish - test -z $mp && return 1 - #+END_SRC +Let’s verify the variable =mp= set in =getmount= is not empty, otherwise abort the script. +#+BEGIN_SRC fish +test -z $mp && return 1 +#+END_SRC - Now, let’s mount it! We’ll use a switch which will detect the filesystem used - so we know how to mount the partition. - #+BEGIN_SRC fish - switch (lsblk -no "fstype" $chosen) - #+END_SRC +Now, let’s mount it! We’ll use a switch which will detect the filesystem used so we know how to mount the partition. +#+BEGIN_SRC fish +switch (lsblk -no "fstype" $chosen) +#+END_SRC - We have two named case: =vfat= filesystems. - #+BEGIN_SRC fish - case "vfat" - sudo -A mount -t vfat $chosen $mp -o rw,umask=0000 - #+END_SRC +We have two named case: =vfat= filesystems. +#+BEGIN_SRC fish + case "vfat" + sudo -A mount -t vfat $chosen $mp -o rw,umask=0000 +#+END_SRC - And =ntfs= filesystems. - #+BEGIN_SRC fish - case "ntfs" - sudo -A mount -t ntfs $chosen $mp -o rw,umask=0000 - #+END_SRC +And =ntfs= filesystems. +#+BEGIN_SRC fish + case "ntfs" + sudo -A mount -t ntfs $chosen $mp -o rw,umask=0000 +#+END_SRC - Else, we’ll let =mount= determine which filesystem is used by the partition - (generally =ext4=). - #+BEGIN_SRC fish - case '*' - sudo -A mount $chosen $mp - #+END_SRC +Else, we’ll let =mount= determine which filesystem is used by the partition (generally =ext4=). +#+BEGIN_SRC fish + case '*' + sudo -A mount $chosen $mp +#+END_SRC - We’ll also run a =chown= on this newly mounted filesystem so the user can - access it without any issues. - #+BEGIN_SRC fish - sudo -A chown -R $USER:(id -g $USER) $mp - #+END_SRC +We’ll also run a =chown= on this newly mounted filesystem so the user can access it without any issues. +#+BEGIN_SRC fish + sudo -A chown -R $USER:(id -g $USER) $mp +#+END_SRC - Let’s close the switch block and send a notification the partition has been - mounted. - #+BEGIN_SRC fish - end && notify-send -a "dmount" "💻 USB mounting" "$chosen mounted to $mp." - #+END_SRC +Let’s close the switch block and send a notification the partition has been mounted. +#+BEGIN_SRC fish +end && notify-send -a "dmount" "💻 USB mounting" "$chosen mounted to $mp." +#+END_SRC - And let’s close the function. - #+BEGIN_SRC fish - end - #+END_SRC +And let’s close the function. +#+BEGIN_SRC fish +end +#+END_SRC ** Mount an Android device :PROPERTIES: :CUSTOM_ID: Rofi-mount-Mount_an_Android_device-5321f9cd :END: - The function that manages to mount Android filesystems is =mountandroid=. - Let’s declare it. - #+BEGIN_SRC fish - function mountandroid -d "Mount an Android device" - #+END_SRC +The function that manages to mount Android filesystems is =mountandroid=. Let’s declare it. +#+BEGIN_SRC fish +function mountandroid -d "Mount an Android device" +#+END_SRC - We’ll select which Android we want to mount. We will be asked through rofi. - #+BEGIN_SRC fish - set chosen (echo $anddrives | rofi -dmenu -i -p "Which Android device?" | awk '{print $1 $2}' | sed 's/,$//') - #+END_SRC +We’ll select which Android we want to mount. We will be asked through rofi. +#+BEGIN_SRC fish +set chosen (echo $anddrives | rofi -dmenu -i -p "Which Android device?" | awk '{print $1 $2}' | sed 's/,$//') +#+END_SRC - 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. - #+BEGIN_SRC fish - set bus (echo $chosen | sed 's/,.*//') - #+END_SRC +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. +#+BEGIN_SRC fish +set bus (echo $chosen | sed 's/,.*//') +#+END_SRC - Let’s temporarily mount our device. - #+BEGIN_SRC fish - jmtpfs -device=$chosen $mp - #+END_SRC +Let’s temporarily mount our device. +#+BEGIN_SRC fish +jmtpfs -device=$chosen $mp +#+END_SRC - 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. Let’s inform the user of that. - #+BEGIN_SRC fish - echo "OK" | \ - rofi -dmenu -i -p "Press (Allow) on your phone screen, or set your USB settings to allow file transfert" - #+END_SRC +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. Let’s inform the user of that. +#+BEGIN_SRC fish + echo "OK" | \ + rofi -dmenu -i -p "Press (Allow) on your phone screen, or set your USB settings to allow file transfert" +#+END_SRC - Now, let’s get the actual path of our Android filesystem we wish to mount, - and let’s unmount the previous temporary filesystem. - #+BEGIN_SRC fish - set newchosen (jmtpfs -l | grep $bus | awk '{print $1 $2}' | sed 's/,$//') - sudo -A umount $mp - #+END_SRC +Now, let’s get the actual path of our Android filesystem we wish to mount, and let’s unmount the previous temporary filesystem. +#+BEGIN_SRC fish + set newchosen (jmtpfs -l | grep $bus | awk '{print $1 $2}' | sed 's/,$//') + sudo -A umount $mp +#+END_SRC - Now we cam mount the new filesystem and send a notification if everything - went well. - #+BEGIN_SRC fish - jmtpfs -device=$newchosen $mp && \ - notify-send -a "dmount" "🤖 Android Mounting" "Android device mounted to $mp." - #+END_SRC +Now we cam mount the new filesystem and send a notification if everything went well. +#+BEGIN_SRC fish + jmtpfs -device=$newchosen $mp && \ + notify-send -a "dmount" "🤖 Android Mounting" "Android device mounted to $mp." +#+END_SRC - And now, we can close our function. - #+BEGIN_SRC fish - end - #+END_SRC +And now, we can close our function. +#+BEGIN_SRC fish +end +#+END_SRC ** Mount a CD drive :PROPERTIES: :CUSTOM_ID: Rofi-mount-Mount_a_CD_drive-27278199 :END: - This part is way easier than the previous functions. As we will see, the - function =mountcd='s body is only three lines long. First, let’s declare the - function. - #+BEGIN_SRC fish - function mountcd - #+END_SRC +This part is way easier than the previous functions. As we will see, the function =mountcd='s body is only three lines long. First, let’s declare the function. +#+BEGIN_SRC fish +function mountcd +#+END_SRC - Now, let’s chose the CD drive we want to mount using =rofi=. - #+BEGIN_SRC fish - set chosen (echo $cddrives | rofi -dmenu -i -p "Which CD drive?") - #+END_SRC +Now, let’s chose the CD drive we want to mount using =rofi=. +#+BEGIN_SRC fish + set chosen (echo $cddrives | rofi -dmenu -i -p "Which CD drive?") +#+END_SRC - We’ll also get the mountpoint thanks to the =getmount= function described - earlier. - #+BEGIN_SRC fish - getmount - #+END_SRC +We’ll also get the mountpoint thanks to the =getmount= function described earlier. +#+BEGIN_SRC fish +getmount +#+END_SRC - And finally, let’s mount it and send the notification everything went well. - #+BEGIN_SRC fish - sudo -A mount $chosen $mp && \ - notify-send -a "dmount" "💿 CD mounting" "$chosen mounted." - #+END_SRC +And finally, let’s mount it and send the notification everything went well. +#+BEGIN_SRC fish + sudo -A mount $chosen $mp && \ + notify-send -a "dmount" "💿 CD mounting" "$chosen mounted." +#+END_SRC - Finally, let’s close our function. - #+BEGIN_SRC fish - end - #+END_SRC +Finally, let’s close our function. +#+BEGIN_SRC fish +end +#+END_SRC ** Ask what type of drive we want to mount :PROPERTIES: :CUSTOM_ID: Rofi-mount-Ask_what_type_of_drive_we_want_to_mount-0c15cffa :END: - 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. - #+BEGIN_SRC fish - function asktype - #+END_SRC +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. +#+BEGIN_SRC fish +function asktype +#+END_SRC - We will use a switch statement which will use our anwser to rofi about what - we wish to mount. - #+BEGIN_SRC fish - switch (cat $TMPDRIVES | rofi -dmenu -i -p "Mount which drive?") - #+END_SRC +We will use a switch statement which will use our anwser to rofi about what we wish to mount. +#+BEGIN_SRC fish +switch (cat $TMPDRIVES | rofi -dmenu -i -p "Mount which drive?") +#+END_SRC - If we chose the option "USB", we’ll mount a hard drive, partition or USB - drive. In which case we’ll call the =mountusb= function. - #+BEGIN_SRC fish - case "USB" - mountusb - #+END_SRC +If we chose the option "USB", we’ll mount a hard drive, partition or USB drive. In which case we’ll call the =mountusb= function. +#+BEGIN_SRC fish + case "USB" + mountusb +#+END_SRC - If we chose the "Android" option, the =mountandroid= function is called. - #+BEGIN_SRC fish - case "Android" - mountandroid - #+END_SRC +If we chose the "Android" option, the =mountandroid= function is called. +#+BEGIN_SRC fish + case "Android" + mountandroid +#+END_SRC - Else if we chose the "CD" option, we’ll call the =mountcd= function. - #+BEGIN_SRC fish - case "CD" - mountcd - #+END_SRC - If nothing is selected, the function will naturally exit. Now, let’s close - our switch statement and our function. - #+BEGIN_SRC fish - end - end - #+END_SRC +Else if we chose the "CD" option, we’ll call the =mountcd= function. +#+BEGIN_SRC fish + case "CD" + mountcd +#+END_SRC + +If nothing is selected, the function will naturally exit. Now, let’s close our switch statement and our function. +#+BEGIN_SRC fish +end +end +#+END_SRC ** Launch the mounting functions :PROPERTIES: :CUSTOM_ID: Rofi-mount-Launch_the_mounting_functions-218ad001 :END: - Now that we have declared our functions and set our variables, we’ll 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. - #+BEGIN_SRC fish - switch (wc -l < $TMPDRIVES) - #+END_SRC +Now that we have declared our functions and set our variables, we’ll 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. +#+BEGIN_SRC fish +switch (wc -l < $TMPDRIVES) +#+END_SRC - If the file has no lines, i.e. it is empty, we have no mountable media. Let’s - inform our user this is the case. - #+BEGIN_SRC fish - case 0 - notify-send "No USB drive or Android device or CD detected" -a "dmount" - #+END_SRC +If the file has no lines, i.e. it is empty, we have no mountable media. Let’s inform our user this is the case. +#+BEGIN_SRC fish + case 0 + notify-send "No USB drive or Android device or CD detected" -a "dmount" +#+END_SRC - If we only have one line, we have only one type of mountable media. We’ll - pass this line to a second switch statement. - #+BEGIN_SRC fish - case 1 - switch (cat $TMPDRIVES) - #+END_SRC - This will allow the script to automatically detect what type of media it is, - and mount the corresponding function. - #+BEGIN_SRC fish - case "USB" - mountusb - case "Android" - mountandroid - case "CD" - mountCD - #+END_SRC - Let’s close this nested switch case. - #+BEGIN_SRC fish - end - #+END_SRC +If we only have one line, we have only one type of mountable media. We’ll pass this line to a second switch statement. +#+BEGIN_SRC fish + case 1 + switch (cat $TMPDRIVES) +#+END_SRC +This will allow the script to automatically detect what type of media it is, and mount the corresponding function. +#+BEGIN_SRC fish + case "USB" + mountusb + case "Android" + mountandroid + case "CD" + mountCD +#+END_SRC +Let’s close this nested switch case. +#+BEGIN_SRC fish +end +#+END_SRC - If we have more than one line, we’ll have to ask the user what type of media - they want to mount. - #+BEGIN_SRC fish - case '*' - asktype - #+END_SRC +If we have more than one line, we’ll have to ask the user what type of media they want to mount. +#+BEGIN_SRC fish + case '*' + asktype +#+END_SRC - Now, let’s end our switch statement! - #+BEGIN_SRC fish - end - #+END_SRC +Now, let’s end our switch statement! +#+BEGIN_SRC fish +end +#+END_SRC - Finally, we’ll delete our temporary file. - #+BEGIN_SRC fish - rm -f $TMPDRIVES - #+END_SRC +Finally, we’ll delete our temporary file. +#+BEGIN_SRC fish +rm -f $TMPDRIVES +#+END_SRC - And with that, this is the end of our script! +And with that, this is the end of our script! * Rofi-pass :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-pass :CUSTOM_ID: Rofi-pass-8335357f :END: - =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. +=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. - Let’s 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. - #+BEGIN_SRC fish - for arg in $argv - switch $arg - case '--type' '-t' 'type' - set -g TYPE "yes" - case '*' - printf 'Unknown argument: %s\n.' $arg - exit 1 - end - end - #+END_SRC +Let’s 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. +#+BEGIN_SRC fish + for arg in $argv + switch $arg + case '--type' '-t' 'type' + set -g TYPE "yes" + case '*' + printf 'Unknown argument: %s\n.' $arg + exit 1 + end + end +#+END_SRC - Now, let’s get the list of the passwords that exist in our =pass= repository. - #+BEGIN_SRC fish - set passwords (find $HOME/.password-store -type f -name "*.gpg" | \ - string replace -r ".*.password-store/" "" | \ - string replace -r ".gpg" "" | sort) - #+END_SRC +Now, let’s get the list of the passwords that exist in our =pass= repository. +#+BEGIN_SRC fish + set passwords (find $HOME/.password-store -type f -name "*.gpg" | \ + string replace -r ".*.password-store/" "" | \ + string replace -r ".gpg" "" | sort) +#+END_SRC - Let the user choose which password they wish to select. - #+BEGIN_SRC fish - set password (for elem in $passwords - echo $elem - end | rofi -dmenu -i -p "Select your password") - #+END_SRC +Let the user choose which password they wish to select. +#+BEGIN_SRC fish + set password (for elem in $passwords + echo $elem + end | rofi -dmenu -i -p "Select your password") +#+END_SRC - Let’s verify we actually selected a password and not just exited. If no - password was selected, let’s simply exit the script. - #+BEGIN_SRC fish - if test -z $password - exit - end - #+END_SRC +Let’s verify we actually selected a password and not just exited. If no password was selected, let’s simply exit the script. +#+BEGIN_SRC fish + if test -z $password + exit + end +#+END_SRC - Depending on the arguments passed earlier, we might want some different - behavior. - #+BEGIN_SRC fish :noweb yes - if test $TYPE = "yes" - <> - else - <> - end - #+END_SRC +Depending on the arguments passed earlier, we might want some different behavior. +#+BEGIN_SRC fish :noweb yes + if test $TYPE = "yes" + <> + else + <> + end +#+END_SRC - The default behavior is to copy the password to the clipboard for 45 seconds, - so let’s do that. - #+NAME: rofi-pass-copy - #+BEGIN_SRC fish :noweb yes :tangle no - pass show -c $password 2> /dev/null - #+END_SRC +The default behavior is to copy the password to the clipboard for 45 seconds, so let’s do that. +#+NAME: rofi-pass-copy +#+BEGIN_SRC fish :noweb yes :tangle no + pass show -c $password 2> /dev/null +#+END_SRC - 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. - Let’s do that. - #+NAME: rofi-pass-type - #+BEGIN_SRC fish :noweb yes :tangle no - set -l IFS - <> - printf %s $pass | xvkbd -file - - #+END_SRC +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. Let’s do that. +#+NAME: rofi-pass-type +#+BEGIN_SRC fish :noweb yes :tangle no + set -l IFS + <> + printf %s $pass | xvkbd -file - +#+END_SRC - To correctly get the password from =pass=, we need to parse the output and - only get the first line, hence the following command. - #+NAME: rofi-pass-type-get-password - #+BEGIN_SRC fish :tangle no - set pass (pass show $password | string split -n \n)[1] - #+END_SRC +To correctly get the password from ~pass~, we need to parse the output and only get the first line, hence the following command. +#+NAME: rofi-pass-type-get-password +#+BEGIN_SRC fish :tangle no +set pass (pass show $password | string split -n \n)[1] +#+END_SRC * Rofi-umount :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/rofi-umount :CUSTOM_ID: Rofi-umount-ddde1667 :END: - =rofiumount= is the counterpart of =rofimount= for unmounting our mounted - partitions. +~rofiumount~ is the counterpart of ~rofimount~ for unmounting our mounted partitions. ** Get the unmountable drives :PROPERTIES: :CUSTOM_ID: Rofi-umount-Get_the_unmountable_drives-89c71040 :END: - First, we will need to list all the drives that can be safely unmounted. - Let’s run this. - #+BEGIN_SRC fish - 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}') - #+END_SRC +First, we will need to list all the drives that can be safely unmounted. Let’s run this. +#+BEGIN_SRC fish + 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}') +#+END_SRC - Now, let’s get the android devices that are mounted. - #+BEGIN_SRC fish - set -g androids (awk '/jmtpfs/ {print $2}' /etc/mtab) - #+END_SRC +Now, let’s get the android devices that are mounted. +#+BEGIN_SRC fish +set -g androids (awk '/jmtpfs/ {print $2}' /etc/mtab) +#+END_SRC - And let’s get the CD drives that are mounted. - #+BEGIN_SRC fish - set -g cds (awk '/sr0/ {print $2}' /etc/mtab) - #+END_SRC +And let’s get the CD drives that are mounted. +#+BEGIN_SRC fish +set -g cds (awk '/sr0/ {print $2}' /etc/mtab) +#+END_SRC - We’ll store all of our information in a temporary file, =/tmp/undrives=. - #+BEGIN_SRC fish - set -g undrivefile /tmp/undrives - #+END_SRC +We’ll store all of our information in a temporary file, =/tmp/undrives=. +#+BEGIN_SRC fish +set -g undrivefile /tmp/undrives +#+END_SRC - Let’s make sure we begin with a clean, empty file. - #+BEGIN_SRC fish - rm -f $undrivefile - touch $undrivefile - #+END_SRC +Let’s make sure we begin with a clean, empty file. +#+BEGIN_SRC fish + rm -f $undrivefile + touch $undrivefile +#+END_SRC - Depending on if the related variables are set, write the different types of - mounted drives in the temporary file. - #+BEGIN_SRC fish - test -n "$drives" && echo "USB" >> $undrivefile - test -n "$cds" && echo "CD" >> $undrivefile - test -n "$androids" && echo "Android" >> $undrivefile - #+END_SRC +Depending on if the related variables are set, write the different types of mounted drives in the temporary file. +#+BEGIN_SRC fish + test -n "$drives" && echo "USB" >> $undrivefile + test -n "$cds" && echo "CD" >> $undrivefile + test -n "$androids" && echo "Android" >> $undrivefile +#+END_SRC ** Unmount disk partitions :PROPERTIES: :CUSTOM_ID: Rofi-umount-Unmount_disk_partitions-0d425a47 :END: - The function =unmountusb= will take care of unmounting any drive we can - safely unmount. First, let’s declare the function. - #+BEGIN_SRC fish - function unmountusb - #+END_SRC +The function =unmountusb= will take care of unmounting any drive we can safely unmount. First, let’s declare the function. +#+BEGIN_SRC fish +function unmountusb +#+END_SRC - Let’s chose the drive to unmount with rofi. - #+BEGIN_SRC fish - set chosen (echo $drives | \ - rofi -dmenu -i -p "Unmount which drive?" | \ - awk '{print $1}') - #+END_SRC +Let’s chose the drive to unmount with rofi. +#+BEGIN_SRC fish + set chosen (echo $drives | \ + rofi -dmenu -i -p "Unmount which drive?" | \ + awk '{print $1}') +#+END_SRC - Let’s verify if the user actually selected any drive. If no, let’s abort the - script. - #+BEGIN_SRC fish - test -z "$chosen" && exit 0 - #+END_SRC +Let’s verify if the user actually selected any drive. If no, let’s abort the script. +#+BEGIN_SRC fish +test -z "$chosen" && exit 0 +#+END_SRC - Now, let’s unmount the chosen drive and send a notification if it has been - done. - #+BEGIN_SRC fish - sudo -A umount $chosen && \ - notify-send "💻 USB unmounting" "$chosen unmounted." -a "dumount" - #+END_SRC +Now, let’s unmount the chosen drive and send a notification if it has been done. +#+BEGIN_SRC fish + sudo -A umount $chosen && \ + notify-send "💻 USB unmounting" "$chosen unmounted." -a "dumount" +#+END_SRC - Now, let’s close the function. - #+BEGIN_SRC fish - end - #+END_SRC +Now, let’s close the function. +#+BEGIN_SRC fish +end +#+END_SRC ** Unmount Android device :PROPERTIES: :CUSTOM_ID: Rofi-umount-Unmount_Android_device-ae1d5904 :END: - The function =unmountandroid= will take care of unmounting any mounted - Android device. First, let’s declare our function. - #+BEGIN_SRC fish - function unmountandroid - #+END_SRC +The function =unmountandroid= will take care of unmounting any mounted Android device. First, let’s declare our function. +#+BEGIN_SRC fish +function unmountandroid +#+END_SRC - Let the user choose which Android device to unmount. - #+BEGIN_SRC fish - set chosen (echo $androids | rofi -dmenu -i -p "Unmount which device?") - #+END_SRC +Let the user choose which Android device to unmount. +#+BEGIN_SRC fish +set chosen (echo $androids | rofi -dmenu -i -p "Unmount which device?") +#+END_SRC - We’ll verify the user chose any device. - #+BEGIN_SRC fish - test -z "$chosen" && exit 0 - #+END_SRC +We’ll verify the user chose any device. +#+BEGIN_SRC fish + test -z "$chosen" && exit 0 +#+END_SRC - If a device has been chosen, let’s unmount it and send a notification it has - been successfuly unmounted. - #+BEGIN_SRC fish - sudo -A umount -l $chosen && \ - notify-send "🤖 Android unmounting" "$chosen unmounted." -a "dumount" - #+END_SRC +If a device has been chosen, let’s unmount it and send a notification it has been successfuly unmounted. +#+BEGIN_SRC fish + sudo -A umount -l $chosen && \ + notify-send "🤖 Android unmounting" "$chosen unmounted." -a "dumount" +#+END_SRC - Finally, let’s close the function. - #+BEGIN_SRC fish - end - #+END_SRC +Finally, let’s close the function. +#+BEGIN_SRC fish +end +#+END_SRC ** Unmount CD drive :PROPERTIES: :CUSTOM_ID: Rofi-umount-Unmount_CD_drive-369a2f61 :END: - =unmountcd= will take care of unmounting any mounted CD drive. Let’s declare - this function. - #+BEGIN_SRC fish - function unmountcd - #+END_SRC +=unmountcd= will take care of unmounting any mounted CD drive. Let’s declare this function. +#+BEGIN_SRC fish +function unmountcd +#+END_SRC - As before, let the user chose which CD drive to unmount. - #+BEGIN_SRC fish - set chosen (echo "$cds" | rofi -dmenu -i -p "Unmount which CD?") - #+END_SRC +As before, let the user chose which CD drive to unmount. +#+BEGIN_SRC fish +set chosen (echo "$cds" | rofi -dmenu -i -p "Unmount which CD?") +#+END_SRC - We’ll verify the user chose any device. - #+BEGIN_SRC fish - test -z "$chosen" && exit 0 - #+END_SRC +We’ll verify the user chose any device. +#+BEGIN_SRC fish + test -z "$chosen" && exit 0 +#+END_SRC - If a drive has been chosen, let’s unmount it and send a notification it has - been successfuly unmounted. - #+BEGIN_SRC fish - sudo -A umount -l $chosen && \ - notify-send "💿 CD unmounting" "$chosen unmounted." -a "dumount" - #+END_SRC +If a drive has been chosen, let’s unmount it and send a notification it has been successfuly unmounted. +#+BEGIN_SRC fish + sudo -A umount -l $chosen && \ + notify-send "💿 CD unmounting" "$chosen unmounted." -a "dumount" +#+END_SRC - Now, let’s close the function. - #+BEGIN_SRC fish - end - #+END_SRC +Now, let’s close the function. +#+BEGIN_SRC fish +end +#+END_SRC ** Ask what type of drive to unmount :PROPERTIES: :CUSTOM_ID: Rofi-umount-Ask_what_type_of_drive_to_unmount-6287af48 :END: - If several types of unmountable drives are available, let’s 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, let’s declare the function. - #+BEGIN_SRC fish - function asktype - #+END_SRC +If several types of unmountable drives are available, let’s 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, let’s declare the function. +#+BEGIN_SRC fish +function asktype +#+END_SRC - Let’s create a switch statement to which will be passed the selection of the - user from rofi. - #+BEGIN_SRC fish - switch (cat $undrivefile | rofi -dmenu -i -p "Unmount which type of device?") - #+END_SRC +Let’s create a switch statement to which will be passed the selection of the user from rofi. +#+BEGIN_SRC fish + switch (cat $undrivefile | rofi -dmenu -i -p "Unmount which type of device?") +#+END_SRC - Three types of values can be returned: "USB", "CD", or "Android". These - values will be used to launch their corresponding function. - #+BEGIN_SRC fish - case 'USB' - unmountusb - case 'CD' - unmountcd - case 'Android' - unmountandroid - #+END_SRC +Three types of values can be returned: "USB", "CD", or "Android". These values will be used to launch their corresponding function. +#+BEGIN_SRC fish + case 'USB' + unmountusb + case 'CD' + unmountcd + case 'Android' + unmountandroid +#+END_SRC - Let’s close the switch statement. - #+BEGIN_SRC fish - end - #+END_SRC +Let’s close the switch statement. +#+BEGIN_SRC fish +end +#+END_SRC - Let’s now close the function. - #+BEGIN_SRC fish - end - #+END_SRC +Let’s now close the function. +#+BEGIN_SRC fish +end +#+END_SRC ** Launch the unmounting functions :PROPERTIES: :CUSTOM_ID: Rofi-umount-Launch_the_unmounting_functions-7c48a928 :END: - Now back to the body of our script, let’s input in a switch case the number - of lines contained in our temporary file. - #+BEGIN_SRC fish - switch (wc -l < $undrivefile) - #+END_SRC +Now back to the body of our script, let’s input in a switch case the number of lines contained in our temporary file. +#+BEGIN_SRC fish +switch (wc -l < $undrivefile) +#+END_SRC - If the file containes no lines. i.e. it is empty, nothing is to be unmounted. - Let’s inform the user of that. - #+BEGIN_SRC fish - case 0 - notify-send "No USB drive or Android device or CD to unmount" -a "dumount" - #+END_SRC +If the file containes no lines. i.e. it is empty, nothing is to be unmounted. Let’s inform the user of that. +#+BEGIN_SRC fish + case 0 + notify-send "No USB drive or Android device or CD to unmount" -a "dumount" +#+END_SRC - Else, if there is only one type of drive, we’ll automatically let our script - choose based on the content of this sole line. - #+BEGIN_SRC fish - case 1 - switch (cat $undrivefile) - case 'USB' - unmountusb - case 'CD' - unmountcd - case 'Android' - unmountandroid - end - #+END_SRC +Else, if there is only one type of drive, we’ll automatically let our script choose based on the content of this sole line. +#+BEGIN_SRC fish + case 1 + switch (cat $undrivefile) + case 'USB' + unmountusb + case 'CD' + unmountcd + case 'Android' + unmountandroid + end +#+END_SRC - And if there are more types than one, let’s ask the user. - #+BEGIN_SRC fish - case '*' - asktype - #+END_SRC +And if there are more types than one, let’s ask the user. +#+BEGIN_SRC fish +case '*' + asktype +#+END_SRC - Let’s close our main switch statement. - #+BEGIN_SRC fish - end - #+END_SRC +Let’s close our main switch statement. +#+BEGIN_SRC fish +end +#+END_SRC - And finally, let’s delete our temporary file. - #+BEGIN_SRC fish - rm -f $undrivefile - #+END_SRC +And finally, let’s delete our temporary file. +#+BEGIN_SRC fish +rm -f $undrivefile +#+END_SRC * set-screens :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/set-screens :CUSTOM_ID: set-screens-01bd989a :END: - ~set-screens~ is a small script that allows the user to automatically set up - an external monitor. First, let’s set some variables so we don’t have to type - in hidden places some values that should be easily modifiable. - #+BEGIN_SRC fish - set internal "eDP1" - set external "HDMI1" - #+END_SRC +~set-screens~ is a small script that allows the user to automatically set up an external monitor. First, let’s set some variables so we don’t have to type in hidden places some values that should be easily modifiable. +#+BEGIN_SRC fish + set internal "eDP1" + set external "HDMI1" +#+END_SRC - Now, let’s 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 it’s 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 we’ve 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 - set externaldisplay (xrandr -q --current | grep -A 1 -i "$external connected") - if test -n "$externaldisplay" - set resolution (echo $externaldisplay[2] | awk '{$1=$1;print $1}') - xrandr --output "$external" --primary --auto --mode "$resolution" --right-of "$internal" - end - #+END_SRC +Now, let’s 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 it’s 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 we’ve 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 + set externaldisplay (xrandr -q --current | grep -A 1 -i "$external connected") + if test -n "$externaldisplay" + set resolution (echo $externaldisplay[2] | awk '{$1=$1;print $1}') + xrandr --output "$external" --primary --auto --mode "$resolution" --right-of "$internal" + end +#+END_SRC * sshbind :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/sshbind :CUSTOM_ID: sshbind-756fabb1 :END: - 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~. - #+BEGIN_SRC fish - ssh -L $argv[1]:$argv[3]:$argv[1] $argv[2] -N - #+END_SRC +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~. +#+BEGIN_SRC fish + ssh -L $argv[1]:$argv[3]:$argv[1] $argv[2] -N +#+END_SRC * Starwars :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/starwars :CUSTOM_ID: Starwars-654f8637 :END: - This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art - in your terminal. Here is the code: - #+BEGIN_SRC fish - telnet towel.blinkenlights.nl - #+END_SRC +This is a one-liner that allows you to watch Star Wars episode 4 in ASCII art in your terminal. Here is the code: +#+BEGIN_SRC fish + telnet towel.blinkenlights.nl +#+END_SRC * Toggle touchpad tapping :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/tttapping :CUSTOM_ID: Toggle_touchpad_tapping-23348b00 :END: - For some reasons, my firmware does not recognize the function key for toggling - the touchpad. I’m not going to really complain about it since it lets me - program it like I want. Since I often don’t need to completely deactivate the - touchpad, I’ll 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. +For some reasons, my firmware does not recognize the function key for toggling the touchpad. I’m not going to really complain about it since it lets me program it like I want. Since I often don’t need to completely deactivate the touchpad, I’ll 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 let’s 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: - #+BEGIN_SRC fish - set TPNAME "ELAN0412:00 04F3:3162 Touchpad" - #+END_SRC +First let’s 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: +#+BEGIN_SRC fish + set TPNAME "ELAN0412:00 04F3:3162 Touchpad" +#+END_SRC - Let’s now get the identifier of the touchpad for ~xinput~: - #+BEGIN_SRC fish - set TPID (xinput list | grep $TPNAME | awk '{print $6}' | sed 's|id=\(.*\)|\1|g') - #+END_SRC +Let’s now get the identifier of the touchpad for ~xinput~: +#+BEGIN_SRC fish + set TPID (xinput list | grep $TPNAME | awk '{print $6}' | sed 's|id=\(.*\)|\1|g') +#+END_SRC - Now, let’s detect the current status of the touchpad: - #+BEGIN_SRC fish - set TPSTATUS (xinput list-props $TPID | grep "Tapping Enabled" | \ - grep -v "Default" | awk '{print $5}') - #+END_SRC +Now, let’s detect the current status of the touchpad: +#+BEGIN_SRC fish + set TPSTATUS (xinput list-props $TPID | grep "Tapping Enabled" | \ + grep -v "Default" | awk '{print $5}') +#+END_SRC - This will set ~TPSTATUS~ either to ~0~, meaning tapping is disabled, or to - ~1~, meaning it’s enabled. I will consider any other value as being disabled. - #+BEGIN_SRC fish - test [[ $TPSTATUS = "1" ]] && set NEWTPSTATUS 0 || set NEWTPSTATUS 1 - #+END_SRC +This will set ~TPSTATUS~ either to ~0~, meaning tapping is disabled, or to ~1~, meaning it’s enabled. I will consider any other value as being disabled. +#+BEGIN_SRC fish + test [[ $TPSTATUS = "1" ]] && set NEWTPSTATUS 0 || set NEWTPSTATUS 1 +#+END_SRC - Finally, let’s update the touchpad’s options: - #+BEGIN_SRC fish - xinput set-prop $TPNAME "libinput Tapping Enabled" $NEWTPSTATUS - #+END_SRC +Finally, let’s update the touchpad’s options: +#+BEGIN_SRC fish + xinput set-prop $TPNAME "libinput Tapping Enabled" $NEWTPSTATUS +#+END_SRC * UpdateFlutter :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/UpdateFlutter :CUSTOM_ID: UpdateFlutter-1e8fbeb7 :END: - This is a simple utility to be ran when the ~flutter~ package is updated. - #+BEGIN_SRC fish - sudo chown -R :flutterusers /opt/flutter - sudo chmod -R g+w /opt/flutter - sudo chmod a+rw /opt/flutter/version - sudo chown $USER:(id -g $USER) /opt/flutter/bin/cache - #+END_SRC +This is a simple utility to be ran when the ~flutter~ package is updated. +#+BEGIN_SRC fish + sudo chown -R :flutterusers /opt/flutter + sudo chmod -R g+w /opt/flutter + sudo chmod a+rw /opt/flutter/version + sudo chown $USER:(id -g $USER) /opt/flutter/bin/cache +#+END_SRC * Wacom setup :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/wacom-setup :CUSTOM_ID: Wacom_setup-331fb024 :END: - I made a small and quick utility to set up my Wacom tablet so it is only bound - to one screen. +I made a small and quick utility to set up my Wacom tablet so it is only bound to one screen. ** Set our variables :PROPERTIES: :CUSTOM_ID: Wacom_setup-Set_our_variables-3cb6d58e :END: - Let’s first declare our function that will be called to set our variables. - #+BEGIN_SRC fish - function set_device - #+END_SRC +Let’s first declare our function that will be called to set our variables. +#+BEGIN_SRC fish +function set_device +#+END_SRC - We need some variables in order to correctly set our tablet. First, let’s get - declare what the name of our tablet is, and what the name of its touchpad is. - #+BEGIN_SRC fish - set -g DEVICE "Wacom USB Bamboo PAD Pen stylus" - set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch" - #+END_SRC +We need some variables in order to correctly set our tablet. First, let’s get declare what the name of our tablet is, and what the name of its touchpad is. +#+BEGIN_SRC fish + set -g DEVICE "Wacom USB Bamboo PAD Pen stylus" + set -g DEVICETOUCH "Wacom USB Bamboo PAD Finger touch" +#+END_SRC - We will also modify two settings: the speed of the cursor on the touchpad, - and the scroll speed. Let’s declare the name of these two settings. - #+BEGIN_SRC fish - set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling" - set -g WACOMPROPSCROLLPSEED "ScrollDistance" - #+END_SRC +We will also modify two settings: the speed of the cursor on the touchpad, and the scroll speed. Let’s declare the name of these two settings. +#+BEGIN_SRC fish + set -g WACOMPROPTOUCHSPEED "Device Accel Velocity Scaling" + set -g WACOMPROPSCROLLPSEED "ScrollDistance" +#+END_SRC - To get the correct values for the area it can cover, we’ll need to reset our - tablet. - #+BEGIN_SRC fish - xsetwacom set "$DEVICE" ResetArea - #+END_SRC +To get the correct values for the area it can cover, we’ll need to reset our tablet. +#+BEGIN_SRC fish +xsetwacom set "$DEVICE" ResetArea +#+END_SRC - Now we can get the X and Y areas. - #+BEGIN_SRC fish - set -l AREATOT (xsetwacom get "$DEVICE" Area) - set -g AREAX (echo $AREATOT | awk '{print $3}') - set -g AREAY (echo $AREATOT | awk '{print $4}') - #+END_SRC +Now we can get the X and Y areas. +#+BEGIN_SRC fish + set -l AREATOT (xsetwacom get "$DEVICE" Area) + set -g AREAX (echo $AREATOT | awk '{print $3}') + set -g AREAY (echo $AREATOT | awk '{print $4}') +#+END_SRC - Now let’s close our function. - #+BEGIN_SRC fish - end - #+END_SRC +Now let’s close our function. +#+BEGIN_SRC fish +end +#+END_SRC ** Select our screen :PROPERTIES: :CUSTOM_ID: Wacom_setup-Select_our_screen-7822c0c3 :END: - 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. Let’s declare our function. - #+BEGIN_SRC fish - function set_screen - #+END_SRC +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. Let’s declare our function. +#+BEGIN_SRC fish +function set_screen +#+END_SRC - First, let’s set what screens are available, including the desktop option. - #+BEGIN_SRC fish - set CONNECTED_DISPLAYS (xrandr -q --current | \ - sed -n 's/^\([^ ]\+\) connected .*/\1/p') desktop - #+END_SRC +First, let’s set what screens are available, including the desktop option. +#+BEGIN_SRC fish + set CONNECTED_DISPLAYS (xrandr -q --current | \ + sed -n 's/^\([^ ]\+\) connected .*/\1/p') desktop +#+END_SRC - Now, let’s select the one we wish to use using rofi. - #+BEGIN_SRC fish - set -g SCREEN (for d in $CONNECTED_DISPLAYS - echo $d - end | rofi -dmenu -i -p "Select your dispaly" | tr -d '\n') - #+END_SRC +Now, let’s select the one we wish to use using rofi. +#+BEGIN_SRC fish + set -g SCREEN (for d in $CONNECTED_DISPLAYS + echo $d + end | rofi -dmenu -i -p "Select your dispaly" | tr -d '\n') +#+END_SRC - Now, let’s get the resolution of our selected screen. - #+BEGIN_SRC fish - set -l LINE (xrandr -q --current | if [ "$SCREEN" = "desktop" ] - sed -n 's/^Screen 0:.*, current \([0-9]\+\) x \([0-9]\+\),.*/\1 \2/p' - else - sed -n "s/^$SCREEN"' connected \(primary \)\{0,1\}\([0-9]\+\)x\([0-9]\+\)+.*/\2 \3/p' - end) - #+END_SRC +Now, let’s get the resolution of our selected screen. +#+BEGIN_SRC fish + set -l LINE (xrandr -q --current | if [ "$SCREEN" = "desktop" ] + sed -n 's/^Screen 0:.*, current \([0-9]\+\) x \([0-9]\+\),.*/\1 \2/p' + else + sed -n "s/^$SCREEN"' connected \(primary \)\{0,1\}\([0-9]\+\)x\([0-9]\+\)+.*/\2 \3/p' + end) +#+END_SRC - From that, let’s get the vertical and horizontal resolution of our screen. - #+BEGIN_SRC fish - echo $LINE | read -g WIDTH HEIGHT - #+END_SRC +From that, let’s get the vertical and horizontal resolution of our screen. +#+BEGIN_SRC fish +echo $LINE | read -g WIDTH HEIGHT +#+END_SRC - If any of our =WIDTH= ou =HEIGHT= it empty, we’ll have to abort the script. - #+BEGIN_SRC fish - if test -z $WIDTH || test -z $HEIGHT - exit 1 - end - #+END_SRC +If any of our ~WIDTH~ ou ~HEIGHT~ it empty, we’ll have to abort the script. +#+BEGIN_SRC fish + if test -z $WIDTH || test -z $HEIGHT + exit 1 + end +#+END_SRC - Let’s close our function now. - #+BEGIN_SRC fish - end - #+END_SRC +Let’s close our function now. +#+BEGIN_SRC fish +end +#+END_SRC ** Adjust the tablet :PROPERTIES: :CUSTOM_ID: Wacom_setup-Adjust_the_tablet-342acaf3 :END: - This function will take care of adjusting our tablet to our screen. Let’s - declare our function. - #+BEGIN_SRC fish - function adjust_device - #+END_SRC +This function will take care of adjusting our tablet to our screen. Let’s declare our function. +#+BEGIN_SRC fish +function adjust_device +#+END_SRC - 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 let’s get the - theoretical new height and width of the area. - #+BEGIN_SRC fish - set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\)) - set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\)) - #+END_SRC +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 let’s get the theoretical new height and width of the area. +#+BEGIN_SRC fish + set RATIOAREAY (math ceil \($AREAX \* $HEIGHT \/ $WIDTH\)) + set RATIOAREAX (math ceil \($AREAY \* $WIDTH \/ $HEIGHT\)) +#+END_SRC - Now, if the current height of the tablet’s area is greater than the - theoretical new area, it means the current area is too high. Otherwise, it - should be the other way around. Let’s set =NEWAREAX= and =NEWAREAY= that will - be used to set the new area for the tablet. +Now, if the current height of the tablet’s area is greater than the theoretical new area, it means the current area is too high. Otherwise, it should be the other way around. Let’s set =NEWAREAX= and =NEWAREAY= that will be used to set the new area for the tablet. +#+BEGIN_SRC fish + if test $AREAY -gt $RATIOAREAY + set -g NEWAREAX $AREAX + set -g NEWAREAY $RATIOAREAY + else + set -g NEWAREAX $RATIOAREAX + set -g NEWAREAY $AREAY + end +#+END_SRC - #+BEGIN_SRC fish - if test $AREAY -gt $RATIOAREAY - set -g NEWAREAX $AREAX - set -g NEWAREAY $RATIOAREAY - else - set -g NEWAREAX $RATIOAREAX - set -g NEWAREAY $AREAY - end - #+END_SRC +Alright, now let’s set the new area with these new variables. +#+BEGIN_SRC fish + xsetwacom set "$DEVICE" Area 0 0 $NEWAREAX $NEWAREAY + xsetwacom set "$DEVICE" MapToOutput "$SCREEN" +#+END_SRC - Alright, now let’s set the new area with these new variables. - #+BEGIN_SRC fish - xsetwacom set "$DEVICE" Area 0 0 $NEWAREAX $NEWAREAY - xsetwacom set "$DEVICE" MapToOutput "$SCREEN" - #+END_SRC +Let’s slow down the cursor’s speed on the touchpad. +#+BEGIN_SRC fish +xinput set-float-prop $DEVICETOUCH $WACOMPROPTOUCHSPEED 0.5 +#+END_SRC - Let’s slow down the cursor’s speed on the touchpad. - #+BEGIN_SRC fish - xinput set-float-prop $DEVICETOUCH $WACOMPROPTOUCHSPEED 0.5 - #+END_SRC +Let’s also slow down the scroll speed of the touchpad. +#+BEGIN_SRC fish + xsetwacom set $DEVICETOUCH $WACOMPROPSCROLLPSEED "90" +#+END_SRC - Let’s also slow down the scroll speed of the touchpad. - #+BEGIN_SRC fish - xsetwacom set $DEVICETOUCH $WACOMPROPSCROLLPSEED "90" - #+END_SRC - - Now, let’s close the function. - #+BEGIN_SRC fish - end - #+END_SRC +Now, let’s close the function. +#+BEGIN_SRC fish +end +#+END_SRC ** Lauch the functions :PROPERTIES: :CUSTOM_ID: Wacom_setup-Lauch_the_functions-2ab8b4d9 :END: - Back to the main body of the script, we can now launch the functions - sequencially. - #+BEGIN_SRC fish - set_device - set_screen - adjust_device - #+END_SRC +Back to the main body of the script, we can now launch the functions sequencially. +#+BEGIN_SRC fish + set_device + set_screen + adjust_device +#+END_SRC * Weather :PROPERTIES: :HEADER-ARGS: :shebang "#!/usr/bin/env fish" :mkdirp yes :tangle ~/.local/bin/we :CUSTOM_ID: Weather-4ed00bb0 :END: - 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. - #+BEGIN_SRC fish - if count $argv > /dev/null - set -l SEARCH (string join '+' $argv) - curl http://v2.wttr.in/~$SEARCH - else - curl http://v2.wttr.in/Aubervilliers - end - #+END_SRC +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. +#+BEGIN_SRC fish + if count $argv > /dev/null + set -l SEARCH (string join '+' $argv) + curl http://v2.wttr.in/~$SEARCH + else + curl http://v2.wttr.in/Aubervilliers + end +#+END_SRC diff --git a/org/config/emacs.org b/org/config/emacs.org index de22563..1744e60 100644 --- a/org/config/emacs.org +++ b/org/config/emacs.org @@ -1794,7 +1794,6 @@ One of the amazing features of org-mode is its literary programming capacities b | sass | | scheme | | shell | -| swift | #+NAME: org-babel-languages-gen #+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") #+END_SRC -#+RESULTS[d8ef67cfac36191c43e0f20b9c0a024cb1e9413e]: org-babel-languages-gen +#+RESULTS[cf8b81f0da6306f8131e34be6d3742248fdb057b]: org-babel-languages-gen #+begin_example (C . t) (dot . t) @@ -1815,7 +1814,6 @@ One of the amazing features of org-mode is its literary programming capacities b (sass . t) (scheme . t) (shell . t) -(swift . t) #+end_example 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~. #+BEGIN_SRC emacs-lisp (mapc (lambda (x) - (add-hook x 'auto-fill-mode) (add-hook x 'visual-line-mode)) '(message-mode-hook text-mode-hook @@ -3005,16 +3002,15 @@ I want to see by default how much battery my computer has, so let’s enable it: :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. -In order to make org-mode even sexier, let’s enable ~variable-pitch-mode~ for org-mode so we can get some proportional font: +In order to make org-mode even sexier, let’s enable ~variable-pitch-mode~ for org-mode so we can get some proportional font. I’ll also remove ~auto-fill-mode~ which seems to stick to Orgmode like hell and I don’t know why. #+BEGIN_SRC emacs-lisp (add-hook 'org-mode-hook 'variable-pitch-mode) (add-hook 'org-mode-hook 'visual-line-mode) - (message "coucou") + (remove-hook 'org-mode-hook 'auto-fill-mode) #+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]]. #+BEGIN_SRC emacs-lisp - (message "Setting up some beautiful org-mode") (let* ((font `(:font "Charis SIL")) (head `(:inherit default :weight bold)) (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-meta-line ((t (:inherit (font-lock-comment-face fixed-pitch) :height 0.8)))) '(org-special-keyword ((t (:inherit (font-lock-comment-face fixed-pitch))))))) - (message "Org-mode is now beautiful") #+END_SRC Finally, let’s limit the width of images inlined in org buffers to 400px: diff --git a/org/config/fish.org b/org/config/fish.org index 629c589..99ef593 100644 --- a/org/config/fish.org +++ b/org/config/fish.org @@ -11,654 +11,557 @@ :PROPERTIES: :CUSTOM_ID: Presentation-340195eb :END: - 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 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. - Just in case, we might need sometimes to declare the fish function - =fish_title= as =true=, so let’s do so. - #+BEGIN_SRC fish - function fish_title - true - end - #+END_SRC +Just in case, we might need sometimes to declare the fish function =fish_title= as =true=, so let’s do so. +#+BEGIN_SRC fish + function fish_title + true + end +#+END_SRC * Fish from within Emacs :PROPERTIES: :CUSTOM_ID: Fish_from_within_Emacs-360c0a74 :END: - 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=. - #+BEGIN_SRC fish - if test -n "$EMACS" - set -x TERM eterm-color - end - #+END_SRC +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=. +#+BEGIN_SRC fish + if test -n "$EMACS" + set -x TERM eterm-color + end +#+END_SRC * Tramp remote access :PROPERTIES: :CUSTOM_ID: Tramp_remote_access-72aedec2 :END: - 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, let’s - deactivate and redefine some of the functions defining the appearance of - fish. - #+BEGIN_SRC fish - if test "$TERM" = "dumb" - function fish_prompt - echo "\$ " - end - function fish_right_prompt; end - function fish_greeting; end - function fish_title; end - end - #+END_SRC +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, let’s deactivate and redefine some of the functions defining the appearance of fish. +#+BEGIN_SRC fish + if test "$TERM" = "dumb" + function fish_prompt + echo "\$ " + end + function fish_right_prompt; end + function fish_greeting; end + function fish_title; end + end +#+END_SRC * Regular fish shell appearance :PROPERTIES: :CUSTOM_ID: Regular_fish_shell_appearance-c3e532e1 :END: - Now, there is only one function I modify when it comes to the appearance of - fish when I’m the one using it: the ~fish_greeting~ function. I use it to give - me an overview of my computer’s status, including its hostname, uptime, disks - usage, ram usage, swap usage, and networking. - #+BEGIN_SRC fish - set RED '\033[0;31m' - set GREEN '\033[0;32m' - set NC '\033[0m' +Now, there is only one function I modify when it comes to the appearance of fish when I’m the one using it: the ~fish_greeting~ function. I use it to give me an overview of my computer’s status, including its hostname, uptime, disks usage, ram usage, swap usage, and networking. +#+BEGIN_SRC fish + set RED '\033[0;31m' + set GREEN '\033[0;32m' + set NC '\033[0m' - function display_slider # used total - set -l slider_length 38 - set -l used $argv[1] - set -l total $argv[2] - set -l used_slider (math -s0 "($used * $slider_length) / $total") - set -l unused_slider (math -s0 "$slider_length - $used_slider") - echo -en "[" - echo -en $RED - echo -en (string repeat -n $used_slider '=') - echo -en $GREEN - echo -en (string repeat -n $unused_slider '=') - echo -en $NC - echo -en "]" - end + function display_slider # used total + set -l slider_length 38 + set -l used $argv[1] + set -l total $argv[2] + set -l used_slider (math -s0 "($used * $slider_length) / $total") + set -l unused_slider (math -s0 "$slider_length - $used_slider") + echo -en "[" + echo -en $RED + echo -en (string repeat -n $used_slider '=') + echo -en $GREEN + echo -en (string repeat -n $unused_slider '=') + echo -en $NC + echo -en "]" + end - function fish_greeting - set -l ruler_length 79 - set -l ruler (string repeat -n $ruler_length "=") + function fish_greeting + set -l ruler_length 79 + set -l ruler (string repeat -n $ruler_length "=") - set -l osname (cat /etc/os-release | grep -i pretty_name | sed 's/.*"\(.*\)".*/\1/') - set -l uptime (uptime -p | sed 's/up //') + set -l osname (cat /etc/os-release | grep -i pretty_name | sed 's/.*"\(.*\)".*/\1/') + set -l uptime (uptime -p | sed 's/up //') - set -l root (df -Ph | grep -E "/\$") - set -l root_p (echo $root | awk '{print $5}' | tr -d '%') - set -l root_used (echo $root | awk '{print $3}') - set -l root_total (echo $root | awk '{print $2}') + set -l root (df -Ph | grep -E "/\$") + set -l root_p (echo $root | awk '{print $5}' | tr -d '%') + set -l root_used (echo $root | awk '{print $3}') + set -l root_total (echo $root | awk '{print $2}') - set -l ram (free -tm | grep Mem) - set -l ram_total (echo $ram | awk '{print $2}') - set -l ram_used (echo $ram | awk '{print $3}') - set -l ram_p (math -s0 "$ram_used / $ram_total * 100") + set -l ram (free -tm | grep Mem) + set -l ram_total (echo $ram | awk '{print $2}') + set -l ram_used (echo $ram | awk '{print $3}') + set -l ram_p (math -s0 "$ram_used / $ram_total * 100") - set -l swap (free -tm | grep Swap) - set -l swap_total (echo $swap | awk '{print $2}') - set -l swap_used (echo $swap | awk '{print $3}') - set -l swap_p (math -s0 "$swap_used / $swap_total * 100") + set -l swap (free -tm | grep Swap) + set -l swap_total (echo $swap | awk '{print $2}') + set -l swap_used (echo $swap | awk '{print $3}') + set -l swap_p (math -s0 "$swap_used / $swap_total * 100") - set -l connections (nmcli c s | grep -E "wifi|ethernet" | grep -v '\-\-') - set -l wifi (echo $connections | grep "wifi" | awk '{print $1}') - set -l ethernet (test "$connections" = "*ethernet*" && echo -e $GREEN"UP"$NC || echo -e $RED"DOWN"$NC) - set -l wifi (test -n wifi && echo -e $GREEN$wifi$NC || echo - $RED"DOWN"$NC) + set -l connections (nmcli c s | grep -E "wifi|ethernet" | grep -v '\-\-') + set -l wifi (echo $connections | grep "wifi" | awk '{print $1}') + set -l ethernet (test "$connections" = "*ethernet*" && echo -e $GREEN"UP"$NC || echo -e $RED"DOWN"$NC) + set -l wifi (test -n wifi && echo -e $GREEN$wifi$NC || echo - $RED"DOWN"$NC) - echo $ruler - printf "OS......: %-30sKernel: %s %s\n" $osname (uname -s) (uname -r) - printf "Hostname: %-30sUptime: %s\n" (hostname) $uptime - printf "Ethernet: %-41sWifi..: %s\n" $ethernet $wifi - printf "Disks...: %-6s %s %6s / %6s (%2d%%)\n" "/" (display_slider $root_p 100) $root_used $root_total $root_p + echo $ruler + printf "OS......: %-30sKernel: %s %s\n" $osname (uname -s) (uname -r) + printf "Hostname: %-30sUptime: %s\n" (hostname) $uptime + printf "Ethernet: %-41sWifi..: %s\n" $ethernet $wifi + printf "Disks...: %-6s %s %6s / %6s (%2d%%)\n" "/" (display_slider $root_p 100) $root_used $root_total $root_p - # loop other mountpoints - for mp in (df -Ph 2> /dev/null | egrep "sd|tank|nvme" | egrep -v "boot|/\$") - set -l mp_p (echo $mp | awk '{print $5}' | tr -d '%') - set -l mp_used (echo $mp | awk '{print $3}') - set -l mp_total (echo $mp | awk '{print $2}') - set -l mp_name (echo $mp | awk '{print $6}') - printf " %-6s %s %6s / %6s (%2d%%)\n" $mp_name (display_slider $mp_p 100) $mp_used $mp_total $mp_p - end + # loop other mountpoints + for mp in (df -Ph 2> /dev/null | egrep "sd|tank|nvme" | egrep -v "boot|/\$") + set -l mp_p (echo $mp | awk '{print $5}' | tr -d '%') + set -l mp_used (echo $mp | awk '{print $3}') + set -l mp_total (echo $mp | awk '{print $2}') + set -l mp_name (echo $mp | awk '{print $6}') + printf " %-6s %s %6s / %6s (%2d%%)\n" $mp_name (display_slider $mp_p 100) $mp_used $mp_total $mp_p + end - printf "Ram.....: %s %5dM / %5dM (%2d%%)\n" (display_slider $ram_used $ram_total) $ram_used $ram_total $ram_p - printf "Swap....: %s %5dM / %5dM (%2d%%)\n" (display_slider $swap_used $swap_total) $swap_used $swap_total $swap_p - echo $ruler - end - #+END_SRC + printf "Ram.....: %s %5dM / %5dM (%2d%%)\n" (display_slider $ram_used $ram_total) $ram_used $ram_total $ram_p + printf "Swap....: %s %5dM / %5dM (%2d%%)\n" (display_slider $swap_used $swap_total) $swap_used $swap_total $swap_p + echo $ruler + end +#+END_SRC * Global variables :PROPERTIES: :CUSTOM_ID: Global_variables-1c84df8b :END: +In order to keep some other code clean, I set the ~$BROWSER~ variable so I don’t have to call my web browser directly but rather with this variable. +#+BEGIN_SRC fish + set -gx BROWSER firefox +#+END_SRC - In order to keep some other code clean, I set the ~$BROWSER~ variable so I - don’t have to call my web browser directly but rather with this variable. - #+BEGIN_SRC fish - set -gx BROWSER firefox - #+END_SRC - - Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it - can get the sudo password. So, let’s declare it. - #+BEGIN_SRC fish - set -gx SUDO_ASKPASS ~/.local/bin/askpass - #+END_SRC +Sometimes, software will rely on =SUDO_ASKPASS= to get a GUI from which it can get the sudo password. So, let’s declare it. +#+BEGIN_SRC fish + set -gx SUDO_ASKPASS ~/.local/bin/askpass +#+END_SRC ** Development :PROPERTIES: :CUSTOM_ID: Global_variables-Development-76b3ff13 :END: - Now, let’s 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. - #+BEGIN_SRC fish - set -gx EDITOR emacsclient -c - set -gx VISUAL emacsclient -c - #+END_SRC +Now, let’s 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. +#+BEGIN_SRC fish + set -gx EDITOR emacsclient -c + set -gx VISUAL emacsclient -c +#+END_SRC - We also need to set the path to the Dart SDK. - #+BEGIN_SRC fish - set -gx DART_SDK /opt/dart-sdk/bin - #+END_SRC +We also need to set the path to the Dart SDK. +#+BEGIN_SRC fish +set -gx DART_SDK /opt/dart-sdk/bin +#+END_SRC - And we also need to specify where the Android SDK it located. - #+BEGIN_SRC fish - set -gx ANDROID_HOME $HOME/Android/Sdk - #+END_SRC +And we also need to specify where the Android SDK it located. +#+BEGIN_SRC fish +set -gx ANDROID_HOME $HOME/Android/Sdk +#+END_SRC - Still related to Dart and Flutter development, - #+BEGIN_SRC fish - set -gx CHROME_EXECUTABLE /usr/bin/chromium - #+END_SRC +Still related to Dart and Flutter development, +#+BEGIN_SRC fish + set -gx CHROME_EXECUTABLE /usr/bin/chromium +#+END_SRC - 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). - #+BEGIN_SRC fish - set -gx DENO_DIR $HOME/.config/deno - set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno - #+END_SRC +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). +#+BEGIN_SRC fish + set -gx DENO_DIR $HOME/.config/deno + set -gx DENO_INSTALL_ROOT $HOME/.local/bin/deno +#+END_SRC - Finally, some development packages require the =PKG_CONFIG_PATH= to be set, - so let’s do so. - #+BEGIN_SRC fish - set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH - #+END_SRC +Finally, some development packages require the =PKG_CONFIG_PATH= to be set, so let’s do so. +#+BEGIN_SRC fish + set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH +#+END_SRC -** $PATH +** ~$PATH~ :PROPERTIES: :CUSTOM_ID: Global_variables-$PATH-e1320303 :END: - 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 Rust’s Cargo’s - binaries, Go’s binaries and my own executables. And of course, don’t forget - to add the already existing ~PATH~. +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 Rust’s Cargo’s binaries, Go’s binaries and my own executables. And of course, don’t forget to add the already existing ~PATH~. - #+NAME: extra-paths - | additional path | what it leads to | - |---------------------------+--------------------------------------| - | $HOME/.pub-cache/bin | Dart binaries and executables | - | $HOME/.local/bin | Custom executables, see [[file:bin.org]] | - | $HOME/go/bin | Go binaries and executables | - | $HOME/.cargo/bin | Rust binaries and executables | - | $HOME/.gem/ruby/2.6.0/bin | Ruby binaries and executables | - | $HOME/.cabal/bin | Haskel binaries | +#+NAME: extra-paths +| additional path | what it leads to | +|---------------------------+--------------------------------------| +| $HOME/.pub-cache/bin | Dart binaries and executables | +| $HOME/.local/bin | Custom executables, see [[file:bin.org]] | +| $HOME/go/bin | Go binaries and executables | +| $HOME/.cargo/bin | Rust binaries and executables | +| $HOME/.gem/ruby/2.6.0/bin | Ruby binaries and executables | +| $HOME/.cabal/bin | Haskel binaries | - #+NAME: generate-extra-paths - #+BEGIN_SRC emacs-lisp :var paths=extra-paths[,0] :exports none :cache yes - (mapconcat (lambda (x) x) - paths " ") - #+END_SRC +#+NAME: generate-extra-paths +#+BEGIN_SRC emacs-lisp :var paths=extra-paths[,0] :exports none :cache yes + (mapconcat (lambda (x) x) + paths " ") +#+END_SRC - #+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 +#+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 - The code below ensures the ~PATH~ is updated only at login, and every - location is addded only once. - #+BEGIN_SRC fish :noweb yes - for p in <> - if status is-login - contains $p $PATH || set PATH $p $PATH - end - end - #+END_SRC +The code below ensures the ~PATH~ is updated only at login, and every location is addded only once. +#+BEGIN_SRC fish :noweb yes + for p in <> + if status is-login + contains $p $PATH || set PATH $p $PATH + end + end +#+END_SRC * Abbreviations :PROPERTIES: :CUSTOM_ID: Abbreviations-97537716 :END: - #+NAME: generate-abbr - #+BEGIN_SRC emacs-lisp :var table=[] :exports none :tangle no - (replace-regexp-in-string "\\\\vert[{}]*" - "|" - (mapconcat (lambda (x) (format "abbr %s '%s'" (car x) (cadr x))) - table - "\n") - t t) - #+END_SRC +#+NAME: generate-abbr +#+BEGIN_SRC emacs-lisp :var table=[] :exports none :tangle no + (replace-regexp-in-string "\\\\vert[{}]*" + "|" + (mapconcat (lambda (x) (format "abbr %s '%s'" (car x) (cadr x))) + table + "\n") + t t) +#+END_SRC ** System monitoring :PROPERTIES: :CUSTOM_ID: Abbreviations-System_monitoring-bd909755 :END: - 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. - #+NAME: mgmt-abbr - | abbreviation | command | - |--------------+---------------------------------------------------| - | df | df -H | - | diskspace | sudo df -h \vert grep -E "sd\vert{}lv\vert{}Size" | - | du | du -ch | - | meminfo | free -m -l -t | - | gpumeminfo | grep -i --color memory /var/log/Xorg.0.log | - | cpuinfo | lscpu | - | pscpu | ps auxf \vert sort -nr -k 3 | - | pscpu10 | ps auxf \vert sort -nr -k 3 \vert head -10 | - | psmem | ps auxf \vert sort -nr -k 4 | - | psmem10 | ps auxf \vert sort -nr -k 4 \vert head -10 | +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. +#+NAME: mgmt-abbr +| abbreviation | command | +|--------------+---------------------------------------------------| +| df | df -H | +| diskspace | sudo df -h \vert grep -E "sd\vert{}lv\vert{}Size" | +| du | du -ch | +| meminfo | free -m -l -t | +| gpumeminfo | grep -i --color memory /var/log/Xorg.0.log | +| cpuinfo | lscpu | +| pscpu | ps auxf \vert sort -nr -k 3 | +| pscpu10 | ps auxf \vert sort -nr -k 3 \vert head -10 | +| psmem | ps auxf \vert sort -nr -k 4 | +| psmem10 | ps auxf \vert sort -nr -k 4 \vert head -10 | - #+begin_SRC fish - <> - #+END_SRC +#+begin_SRC fish + <> +#+END_SRC ** System management (packages and services) :PROPERTIES: :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-7249fbb7 :END: - I added some of these abbreviations due to how often I have to write the - whole thing. +I added some of these abbreviations due to how often I have to write the whole thing. *** Package management :PROPERTIES: :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Package_management-efbcdf0f :END: - 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, I’ll use =yay=. +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, I’ll use =yay=. - #+NAME: pm-abbr - | abbreviation | command | - |--------------+--------------------| - | remove | sudo pacman -Rscnd | - | p | sudo pacman | - | purge | yay -Sc | - | search | yay -Ss | +#+NAME: pm-abbr +| abbreviation | command | +|--------------+--------------------| +| remove | sudo pacman -Rscnd | +| p | sudo pacman | +| purge | yay -Sc | +| search | yay -Ss | - #+BEGIN_SRC fish - <> - #+END_SRC +#+BEGIN_SRC fish + <> +#+END_SRC *** Service management :PROPERTIES: :CUSTOM_ID: Abbreviations-System_management_(packages_and_services)-Service_management-8c5ae482 :END: - I don’t 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=. - #+NAME: service-abbr - | abbreviation | command | - |--------------+-----------| - | s | systemctl | +I don’t 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=. +#+NAME: service-abbr +| abbreviation | command | +|--------------+-----------| +| s | systemctl | - #+BEGIN_SRC fish - <> - #+END_SRC +#+BEGIN_SRC fish + <> +#+END_SRC ** Development :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-d6050ca4 :END: - A good amount of these commands are development related, especially when it - comes to compilation or Docker. +A good amount of these commands are development related, especially when it comes to compilation or Docker. *** CMake :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-CMake-f2951675 :END: - I have the following abbreviations so I can quickly run CMake and create a - configuration for debug or release profiles. - #+NAME: abbr-cmake - | abbreviation | command | - |--------------+----------------------------------| - | cdebug | cmake -DCMAKE_BUILD_TYPE=Debug | - | crelease | cmake -DCMAKE_BUILD_TYPE=Release | +I have the following abbreviations so I can quickly run CMake and create a configuration for debug or release profiles. +#+NAME: abbr-cmake +| abbreviation | command | +|--------------+----------------------------------| +| cdebug | cmake -DCMAKE_BUILD_TYPE=Debug | +| crelease | cmake -DCMAKE_BUILD_TYPE=Release | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish + <> +#+END_SRC *** Docker :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Docker-2d0a1288 :END: - And of course, when it comes to Docker Compose, I don't have time to write - the full command, so I use these instead. - #+NAME: abbr-docker - | abbreviation | command | - |--------------+------------------------------| - | dc | docker-compose | - | dcb | docker-compose build | - | dcd | docker-compose down | - | dcl | docker-compose logs | - | dcp | docker-compose pull | - | dcr | docker-compose run --rm | - | dcu | docker-compose up | - | dcub | docker-compose up --build | - | dcud | docker-compose up -d | - | dcudb | docker-compose up -d --build | +And of course, when it comes to Docker Compose, I don't have time to write the full command, so I use these instead. +#+NAME: abbr-docker +| abbreviation | command | +|--------------+------------------------------| +| dc | docker-compose | +| dcb | docker-compose build | +| dcd | docker-compose down | +| dcl | docker-compose logs | +| dcp | docker-compose pull | +| dcr | docker-compose run --rm | +| dcu | docker-compose up | +| dcub | docker-compose up --build | +| dcud | docker-compose up -d | +| dcudb | docker-compose up -d --build | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish + <> +#+END_SRC *** Text editors :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Text_editors-5a23df47 :END: - 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. +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. - #+NAME: abbr-text-ed - | abbreviation | command | - |--------------+--------------------| - | e | emacsclient -c | - | enw | emacsclient -c -nw | - | vi | emacsclient -c | - | vim | emacsclient -c | - | nano | emacsclient -c | - | ed | emacsclient -c | +#+NAME: abbr-text-ed +| abbreviation | command | +|--------------+--------------------| +| e | emacsclient -c | +| enw | emacsclient -c -nw | +| vi | emacsclient -c | +| vim | emacsclient -c | +| nano | emacsclient -c | +| ed | emacsclient -c | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish :noweb yes - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish :noweb yes + <> +#+END_SRC *** Compilation :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Compilation-dd066050 :END: - By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest - standard and with the ~-Wall~ flag activated. - #+NAME: abbr-comp - | abbreviation | command | - |--------------+----------------------| - | clang | clang -Wall | - | clang++ | clang++ -Wall | - | g++ | g++ -Wall -std=c++20 | - | gcc | gcc -Wall -std=c18 | +By default, I set ~clang~, ~clang++~, ~gcc~ and ~g++~ to the latest standard and with the ~-Wall~ flag activated. +#+NAME: abbr-comp +| abbreviation | command | +|--------------+----------------------| +| clang | clang -Wall | +| clang++ | clang++ -Wall | +| g++ | g++ -Wall -std=c++20 | +| gcc | gcc -Wall -std=c18 | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish + <> +#+END_SRC *** Git :PROPERTIES: :CUSTOM_ID: Abbreviations-Development-Git-5e5055c1 :END: - 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. - #+NAME: abbr-git - | abbreviation | command | - |--------------+-----------------------------------------------------| - | randcommit | git commit -m (curl -s whatthecommit.com/index.txt) | +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. +#+NAME: abbr-git +| abbreviation | command | +|--------------+-----------------------------------------------------| +| randcommit | git commit -m (curl -s whatthecommit.com/index.txt) | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish + <> +#+END_SRC ** LaTeX :PROPERTIES: :CUSTOM_ID: Abbreviations-LaTeX-76865eb9 :END: - 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. - #+NAME: latex-abbr - | abbreviation | command | - |--------------+--------------| - | tlmgr | tllocalmgr | - | texhash | sudo texhash | +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. +#+NAME: latex-abbr +| abbreviation | command | +|--------------+--------------| +| tlmgr | tllocalmgr | +| texhash | sudo texhash | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish + <> +#+END_SRC ** Some security measures :PROPERTIES: :CUSTOM_ID: Abbreviations-Some_security_measures-489cb521 :END: - 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=. - #+NAME: sec-abbr - | abbreviation | command | - |--------------+--------------------------| - | cp | cp -i | - | ln | ln -i | - | lns | ln -si | - | mv | mv -i | - | rm | rm -Iv | - | rmd | rm --preserve-root -Irv | - | rmdf | rm --preserve-root -Irfv | - | rmf | rm --preserve-root -Ifv | - | chgrp | chgrp --preserve-root -v | - | chmod | chmod --preserve-root -v | - | chown | chown --preserve-root -v | +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=. +#+NAME: sec-abbr +| abbreviation | command | +|--------------+--------------------------| +| cp | cp -i | +| ln | ln -i | +| lns | ln -si | +| mv | mv -i | +| rm | rm -Iv | +| rmd | rm --preserve-root -Irv | +| rmdf | rm --preserve-root -Irfv | +| rmf | rm --preserve-root -Ifv | +| chgrp | chgrp --preserve-root -v | +| chmod | chmod --preserve-root -v | +| chown | chown --preserve-root -v | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish + <> +#+END_SRC ** Typos :PROPERTIES: :CUSTOM_ID: Abbreviations-Typos-370bbb27 :END: - 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. - #+NAME: typo-abbr - | abbreviation | command | - |--------------+---------| - | clean | clear | - | exi | exit | - | exti | exit | - | q | exit | - | hotp | htop | +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. +#+NAME: typo-abbr +| abbreviation | command | +|--------------+---------| +| clean | clear | +| exi | exit | +| exti | exit | +| q | exit | +| hotp | htop | - Here is the corresponding fish configuration: - #+BEGIN_SRC fish - <> - #+END_SRC +Here is the corresponding fish configuration: +#+BEGIN_SRC fish + <> +#+END_SRC ** Misc :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-c2631eb6 :END: - Finally, some miscellaneous abbreviations that don't really fit into any of - the above categories. +Finally, some miscellaneous abbreviations that don't really fit into any of the above categories. *** Media :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Media-e4b85d56 :END: - 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. - #+BEGIN_SRC fish - abbr chill 'mpv --force-window=no --no-video "https://www.youtube.com/user/Chillhopdotcom/live" &' - #+END_SRC +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. +#+BEGIN_SRC fish + abbr chill 'mpv --force-window=no --no-video "https://www.youtube.com/user/Chillhopdotcom/live" &' +#+END_SRC - 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. - #+BEGIN_SRC fish - abbr mpv 'mpv --no-border --force-window=no' - #+END_SRC +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. +#+BEGIN_SRC fish + abbr mpv 'mpv --no-border --force-window=no' +#+END_SRC - When I want to download a song from YouTube, I'll just use the command ~flac - videoIdentifier~ to get it through ~youtube-dl~. - #+BEGIN_SRC fish - abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"' - #+END_SRC +When I want to download a song from YouTube, I'll just use the command ~flac videoIdentifier~ to get it through ~youtube-dl~. +#+BEGIN_SRC fish + abbr flac 'youtube-dl -x --audio-format flac --audio-quality 0 -o "~/Music/%(uploader)s/%(title)s.%(ext)s"' +#+END_SRC - 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. - #+BEGIN_SRC fish - abbr ytdl 'youtube-dl -f best -ciw -o "~/Videos/YouTube/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"' - #+END_SRC +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. +#+BEGIN_SRC fish + abbr ytdl 'youtube-dl -f best -ciw -o "~/Videos/YouTube/%(uploader)s/%(upload_date)s - %(title)s.%(ext)s"' +#+END_SRC - 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. - #+BEGIN_SRC fish - abbr sxiv 'sxiv -abfs f' - abbr feh 'sxiv -abfs f' - #+END_SRC +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. +#+BEGIN_SRC fish + abbr sxiv 'sxiv -abfs f' + abbr feh 'sxiv -abfs f' +#+END_SRC - Finally, let's declare the following abbreviation that will launch an mpv - instance displaying my webcam: - #+BEGIN_SRC fish - abbr webcam 'mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0' - #+END_SRC +Finally, let's declare the following abbreviation that will launch an mpv instance displaying my webcam: +#+BEGIN_SRC fish + abbr webcam 'mpv --demuxer-lavf-format=video4linux2 --demuxer-lavf-o-set=input_format=mjpeg av://v4l2:/dev/video0' +#+END_SRC *** Sudo :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Sudo-aef0214a :END: - 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. - #+BEGIN_SRC fish - abbr please 'sudo -A' - #+END_SRC +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. +#+BEGIN_SRC fish + abbr please 'sudo -A' +#+END_SRC *** History :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-History-a2124b23 :END: - I also find it more intuitive and faster to just write ~hist~ instead of - ~history~, so let's declare that. - #+BEGIN_SRC fish - abbr hist history - #+END_SRC +I also find it more intuitive and faster to just write ~hist~ instead of ~history~, so let's declare that. +#+BEGIN_SRC fish + abbr hist history +#+END_SRC *** Compression :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Compression-4fd4ffef :END: - 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]]). - #+NAME: tar-abbr - | abbreviation | command | - |--------------+-----------| - | compress | tar -czf | - | untar | tar -xvzf | +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]]). +#+NAME: tar-abbr +| abbreviation | command | +|--------------+-----------| +| compress | tar -czf | +| untar | tar -xvzf | - #+BEGIN_SRC fish - <> - #+END_SRC +#+BEGIN_SRC fish + <> +#+END_SRC *** exa :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-exa-e1b528b9 :END: - #+NAME: exa-abbr - | abbreviation | command | - |--------------+--------------------------------------------| - | exa | exa -halg@ --group-directories-first --git | - | ls | exa -halg@ --group-directories-first --git | - | lsl | exa -halg@ --group-directories-first --git | +#+NAME: exa-abbr +| abbreviation | command | +|--------------+--------------------------------------------| +| exa | exa -halg@ --group-directories-first --git | +| ls | exa -halg@ --group-directories-first --git | +| lsl | exa -halg@ --group-directories-first --git | - #+BEGIN_SRC fish - <> - #+END_SRC +#+BEGIN_SRC fish + <> +#+END_SRC *** Network Management :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Network_Management-0b7fc91d :END: - First, we have just =nmcli= with sane default options, that is a pretty output - with colors. - #+BEGIN_SRC fish - abbr nmcli 'nmcli -p -c auto' - #+END_SRC +First, we have just =nmcli= with sane default options, that is a pretty output with colors. +#+BEGIN_SRC fish + abbr nmcli 'nmcli -p -c auto' +#+END_SRC *** NordVPN :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-NordVPN-09438638 :END: - 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. - #+NAME: nordvpn-abbr - | abbreviation | command | - |--------------+-------------------------| - | n | nordvpn | - | nc | nordvpn c | - | nd | nordvpn d | - | ncf | nordvpn c France | - | ncg | nordvpn c Germany | - | ncj | nordvpn c Japan | - | ncu | nordvpn c United_States | +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. +#+NAME: nordvpn-abbr +| abbreviation | command | +|--------------+-------------------------| +| n | nordvpn | +| nc | nordvpn c | +| nd | nordvpn d | +| ncf | nordvpn c France | +| ncg | nordvpn c Germany | +| ncj | nordvpn c Japan | +| ncu | nordvpn c United_States | - #+BEGIN_SRC fish - <> - #+END_SRC +#+BEGIN_SRC fish + <> +#+END_SRC *** Wget :PROPERTIES: :CUSTOM_ID: Abbreviations-Misc-Wget-27f4bebf :END: - By default, continue a download that was interupted. - #+BEGIN_SRC fish - abbr wget 'wget -c' - #+END_SRC +By default, continue a download that was interupted. +#+BEGIN_SRC fish + abbr wget 'wget -c' +#+END_SRC diff --git a/org/config/i3.org b/org/config/i3.org index 8a1a713..0396fd3 100644 --- a/org/config/i3.org +++ b/org/config/i3.org @@ -11,21 +11,15 @@ :PROPERTIES: :CUSTOM_ID: Presentation-9c7a53bf :END: - *Before proceeding, be aware that I deprecated this i3 config on August 22nd, - 2020, meaning I won’t update it anymore unless I use it again some day in the - future. I will keep it on my website though.* +*Before proceeding, be aware that I deprecated this i3 config on August 22nd, 2020, meaning I won’t 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 - workspaces. This configuration was ade to automatically handle some tasks such - as which software allowed where, autostart, and launching software with - shortcuts. +=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. - It is to be noted I am using [[https://github.com/Airblader/i3][Airblader’s fork of i3]], =i3-gaps=. Some - configuration will not work with =i3=. +It is to be noted I am using [[https://github.com/Airblader/i3][Airblader’s fork of i3]], =i3-gaps=. Some configuration will not work with =i3=. - #+BEGIN_SRC conf :exports none - # -*- mode: conf -*- - #+END_SRC +#+BEGIN_SRC conf :exports none + # -*- mode: conf -*- +#+END_SRC * Variables declaration :PROPERTIES: @@ -35,354 +29,302 @@ :PROPERTIES: :CUSTOM_ID: Variables_declaration-Global-1cf1bfe4 :END: - The first I do is declaring the modifier key and the alt key —I don’t 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 first I do is declaring the modifier key and the alt key —I don’t 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. - Let’s 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. +Let’s 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. - I’ll 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. +I’ll 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. - #+NAME: variable-table - | variable | value | - |----------+-------| - | $mod | Mod4 | - | $alt | Mod1 | - | $up | Up | - | $down | Down | - | $left | Left | - | $right | Right | - | $term | st | +#+NAME: variable-table +| variable | value | +|----------+-------| +| $mod | Mod4 | +| $alt | Mod1 | +| $up | Up | +| $down | Down | +| $left | Left | +| $right | Right | +| $term | st | - #+NAME: variable-sh - | variable | value | - |-------------+--------------------------------------------------------------------------| - | $exiti3 | i3-nagbar -t warning -m 'Leave i3?' -b 'Yes' 'i3-msg exit' | - | $lockscreen | Lucien Cartier-Tilet\n(Phuntsok Drak-pa)\n+33 (0)6 83 90 56 89 | - | $rofiexec | rofi -combi-modi 'window,drun' -show combi -mohh combi -m -1 -show-icons | - | $mail | emacsclient -c -e '(mu4e)' -n | - | $ec | emacsclient -c -n | - | $walset | wal -i ~/Pictures/Wallpapers -o wal-set | +#+NAME: variable-sh +| variable | value | +|-------------+--------------------------------------------------------------------------| +| $exiti3 | i3-nagbar -t warning -m 'Leave i3?' -b 'Yes' 'i3-msg exit' | +| $lockscreen | Lucien Cartier-Tilet\n(Phuntsok Drak-pa)\n+33 (0)6 83 90 56 89 | +| $rofiexec | rofi -combi-modi 'window,drun' -show combi -mohh combi -m -1 -show-icons | +| $mail | emacsclient -c -e '(mu4e)' -n | +| $ec | emacsclient -c -n | +| $walset | wal -i ~/Pictures/Wallpapers -o wal-set | - Variables will be set like so. - #+BEGIN_SRC conf :tangle no - set $term st - #+END_SRC +Variables will be set like so. +#+BEGIN_SRC conf :tangle no +set $term st +#+END_SRC - #+NAME: generate-variables - #+BEGIN_SRC emacs-lisp :var variables=variable-table :cache yes - (mapconcat (lambda (x) (format "set %s %s" (car x) (cadr x))) - variables - "\n") - #+END_SRC +#+NAME: generate-variables +#+BEGIN_SRC emacs-lisp :var variables=variable-table :cache yes + (mapconcat (lambda (x) (format "set %s %s" (car x) (cadr x))) + variables + "\n") +#+END_SRC - #+RESULTS[48079cbd7e6dbf2003fe5ae87216bd38f638b6f8]: generate-variables - : set $mod Mod4 - : set $alt Mod1 - : set $up Up - : set $down Down - : set $left Left - : set $right Right - : set $term st +#+RESULTS[48079cbd7e6dbf2003fe5ae87216bd38f638b6f8]: generate-variables +: set $mod Mod4 +: set $alt Mod1 +: set $up Up +: set $down Down +: set $left Left +: set $right Right +: set $term st - Finally, some variables hold some long strings for commands I don’t want to - have to type multiple times. - #+NAME: generate-variables2 - #+BEGIN_SRC emacs-lisp :var variables=variable-sh :cache yes - (mapconcat (lambda (x) (format "set %s \"%s\"" (car x) (cadr x))) - variables - "\n") - #+END_SRC +Finally, some variables hold some long strings for commands I don’t want to have to type multiple times. +#+NAME: generate-variables2 +#+BEGIN_SRC emacs-lisp :var variables=variable-sh :cache yes + (mapconcat (lambda (x) (format "set %s \"%s\"" (car x) (cadr x))) + variables + "\n") +#+END_SRC - #+RESULTS[c901e3e31c500859661650e86a6b63aef286acbe]: generate-variables2 - : set $exiti3 "i3-nagbar -t warning -m 'Leave i3?' -b 'Yes' 'i3-msg exit'" - : set $lockscreen "Lucien Cartier-Tilet\n(Phuntsok Drak-pa)\n+33 (0)6 83 90 56 89" - : set $rofiexec "rofi -combi-modi 'window,drun' -show combi -mohh combi -m -1 -show-icons" - : set $mail "emacsclient -c -e '(mu4e)' -n" - : set $ec "emacsclient -c -n" - : set $walset "wal -i ~/Pictures/Wallpapers -o wal-set" +#+RESULTS[c901e3e31c500859661650e86a6b63aef286acbe]: generate-variables2 +: set $exiti3 "i3-nagbar -t warning -m 'Leave i3?' -b 'Yes' 'i3-msg exit'" +: set $lockscreen "Lucien Cartier-Tilet\n(Phuntsok Drak-pa)\n+33 (0)6 83 90 56 89" +: set $rofiexec "rofi -combi-modi 'window,drun' -show combi -mohh combi -m -1 -show-icons" +: set $mail "emacsclient -c -e '(mu4e)' -n" +: set $ec "emacsclient -c -n" +: set $walset "wal -i ~/Pictures/Wallpapers -o wal-set" - Here is the configuration: - #+BEGIN_SRC conf :noweb yes - <> - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf :noweb yes + <> + <> +#+END_SRC - Now comes the font for the window tiles. Honestly, this setting is useless - since we do not see it, but let’s set it anyway. - #+BEGIN_SRC conf - font Fira Sans Book:style=Book:pixelsize=10 - #+END_SRC +Now comes the font for the window tiles. Honestly, this setting is useless since we do not see it, but let’s set it anyway. +#+BEGIN_SRC conf + font Fira Sans Book:style=Book:pixelsize=10 +#+END_SRC ** Floating windows :PROPERTIES: :CUSTOM_ID: Variables_declaration-Floating_windows-897d0c3b :END: - 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). +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). - Let’s declare our floading modyfier. With floating windows, you can move them - around by clicking on the window’s borders; but since we don’t 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. +Let’s declare our floading modyfier. With floating windows, you can move them around by clicking on the window’s borders; but since we don’t 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: - #+BEGIN_SRC conf - floating_modifier $mod - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +floating_modifier $mod +#+END_SRC * i3 global settings :PROPERTIES: :CUSTOM_ID: i3_global_settings-1b863d93 :END: - 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. +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 settings :PROPERTIES: :CUSTOM_ID: i3_global_settings-Mouse_settings-4630241d :END: - First of all, I do not want i3 to warp my mouse each time I change windows; - my mouse stays where it is. - #+BEGIN_SRC conf - mouse_warping none - #+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 - that the software mouse will most likely end up in another window I do not - want to focus. - #+BEGIN_SRC conf - focus_follows_mouse no - #+END_SRC +First of all, I do not want i3 to warp my mouse each time I change windows; my mouse stays where it is. +#+BEGIN_SRC conf +mouse_warping none +#+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 that the software mouse will most likely end up in another window I do not want to focus. +#+BEGIN_SRC conf + focus_follows_mouse no +#+END_SRC ** Popup handling :PROPERTIES: :CUSTOM_ID: i3_global_settings-Popup_handling-51b6ed8d :END: - 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. - #+BEGIN_SRC conf - popup_during_fullscreen leave_fullscreen - #+END_SRC +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. +#+BEGIN_SRC conf +popup_during_fullscreen leave_fullscreen +#+END_SRC ** Behavior of workspace changes :PROPERTIES: :CUSTOM_ID: i3_global_settings-Behavior_of_workspace_changes-00202985 :END: - 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. - #+BEGIN_SRC conf - workspace_auto_back_and_forth yes - #+END_SRC +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. +#+BEGIN_SRC conf +workspace_auto_back_and_forth yes +#+END_SRC ** Gaps and window appearance :PROPERTIES: :CUSTOM_ID: i3_global_settings-Gaps_and_window_appearance-749e9f7b :END: - As mentioned in at the beginning of this document, I am using i3-gaps, which - brings spacing (gaps) between windows to i3. +As mentioned in at the beginning of this document, I am using i3-gaps, which brings spacing (gaps) between windows to i3. - First, I want space around my windows only when there are several containers - on the same screen, otherwise they will be maximized. - #+BEGIN_SRC conf - smart_gaps on - #+END_SRC +First, I want space around my windows only when there are several containers on the same screen, otherwise they will be maximized. +#+BEGIN_SRC conf + smart_gaps on +#+END_SRC - I also do not want to see any window border, so I will be turning this - setting off. - #+BEGIN_SRC conf - smart_borders on - #+END_SRC +I also do not want to see any window border, so I will be turning this setting off. +#+BEGIN_SRC conf + smart_borders on +#+END_SRC - By the way, the default border is invisible, since it is zero pixels wide. - #+BEGIN_SRC conf - default_border pixel 0 - #+END_SRC +By the way, the default border is invisible, since it is zero pixels wide. +#+BEGIN_SRC conf +default_border pixel 0 +#+END_SRC - 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. - #+BEGIN_SRC conf - gaps inner 20 - gaps outer -10 - #+END_SRC +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. +#+BEGIN_SRC conf + gaps inner 20 + gaps outer -10 +#+END_SRC - Some parameters are also available when it comes to the colors i3 uses. - Honestly, we won’t see these colors much, so let’s simply keep the default - values. - #+BEGIN_SRC conf - set_from_resource $fg i3wm.color7 #f0f0f0 - set_from_resource $bg i3wm.color2 #f0f0f0 +Some parameters are also available when it comes to the colors i3 uses. Honestly, we won’t see these colors much, so let’s simply keep the default values. +#+BEGIN_SRC conf + set_from_resource $fg i3wm.color7 #f0f0f0 + set_from_resource $bg i3wm.color2 #f0f0f0 - # class border backgr. text indicator child_border - client.focused $bg $bg $fg $bg $bg - client.focused_inactive $bg $bg $fg $bg $bg - client.unfocused $bg $bg $fg $bg $bg - client.urgent $bg $bg $fg $bg $bg - client.placeholder $bg $bg $fg $bg $bg - #+END_SRC + # class border backgr. text indicator child_border + client.focused $bg $bg $fg $bg $bg + client.focused_inactive $bg $bg $fg $bg $bg + client.unfocused $bg $bg $fg $bg $bg + client.urgent $bg $bg $fg $bg $bg + client.placeholder $bg $bg $fg $bg $bg +#+END_SRC * Assigning windows to workspaces :PROPERTIES: :CUSTOM_ID: Assigning_windows_to_workspaces-e59f61e5 :END: - I decided to bind some windows to some workspaces in order to have a better - organization of my desktop. +I decided to bind some windows to some workspaces in order to have a better organization of my desktop. +#+NAME: assignment-table +| Application | Class | Workspace | +|-------------+-------------+-----------| +| Emacs | Emacs | 2 | +| Chromium | Chromium | 3 | +| Firefox | firefox | 3 | +| Nemo | Nemo | 4 | +| Wonderdraft | Godot | 5 | +| Gimp | Gimp* | 6 | +| Gnome Boxes | gnome-boxes | 8 | +| Steam | Steam | 9 | +| Discord | discord | 10 | - #+NAME: assignment-table - | Application | Class | Workspace | - |-------------+-------------+-----------| - | Emacs | Emacs | 2 | - | Chromium | Chromium | 3 | - | Firefox | firefox | 3 | - | Nemo | Nemo | 4 | - | Wonderdraft | Godot | 5 | - | Gimp | Gimp* | 6 | - | Gnome Boxes | gnome-boxes | 8 | - | Steam | Steam | 9 | - | Discord | discord | 10 | +The class table is used in the assignment in the i3 config file. For instance, Gimp’s assignment will look like this: +#+BEGIN_SRC conf :tangle no + assign [class="Gimp*"] 6 +#+END_SRC - The class table is used in the assignment in the i3 config file. For instance, - Gimp’s assignment will look like this: - #+BEGIN_SRC conf :tangle no - assign [class="Gimp*"] 6 - #+END_SRC +#+NAME: generate-workspaces +#+BEGIN_SRC emacs-lisp :var workspaces=assignment-table :cache yes + (mapconcat (lambda (x) (format "assign [class=\"%s\"] %s" (cadr x) (caddr x))) + workspaces + "\n") +#+END_SRC - #+NAME: generate-workspaces - #+BEGIN_SRC emacs-lisp :var workspaces=assignment-table :cache yes - (mapconcat (lambda (x) (format "assign [class=\"%s\"] %s" (cadr x) (caddr x))) - workspaces - "\n") - #+END_SRC +#+RESULTS[0995341b013e50227edf78257ab502e46a30bc9a]: generate-workspaces +: assign [class="Emacs"] 2 +: assign [class="Chromium"] 3 +: assign [class="firefox"] 3 +: assign [class="Nemo"] 4 +: assign [class="Godot"] 5 +: assign [class="Gimp*"] 6 +: assign [class="gnome-boxes"] 8 +: assign [class="Steam"] 9 +: assign [class="discord"] 10 - #+RESULTS[0995341b013e50227edf78257ab502e46a30bc9a]: generate-workspaces - : assign [class="Emacs"] 2 - : assign [class="Chromium"] 3 - : assign [class="firefox"] 3 - : assign [class="Nemo"] 4 - : assign [class="Godot"] 5 - : assign [class="Gimp*"] 6 - : assign [class="gnome-boxes"] 8 - : assign [class="Steam"] 9 - : assign [class="discord"] 10 +Here is the configuration: +#+BEGIN_SRC conf :noweb yes +<> +#+END_SRC - Here is the configuration: - #+BEGIN_SRC conf :noweb yes - <> - #+END_SRC +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. +#+NAME: ws10-output-edp1 +#+BEGIN_SRC emacs-lisp + (if (string= system-name "Marpa") + "workspace 10 output eDP-1" + "") +#+END_SRC - 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. - #+NAME: ws10-output-edp1 - #+BEGIN_SRC emacs-lisp - (if (string= system-name "Marpa") - "workspace 10 output eDP-1" - "") - #+END_SRC - - Now I’ll call the above code as a noweb reference that should be executed. - #+BEGIN_SRC conf - <> - #+END_SRC +Now I’ll call the above code as a noweb reference that should be executed. +#+BEGIN_SRC conf + <> +#+END_SRC * Shortcuts :PROPERTIES: :CUSTOM_ID: Shortcuts-9c7074d3 :END: - 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 I’ll try to make it readable - still. +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 I’ll try to make it readable still. - Shortcuts are set like so: - #+BEGIN_SRC conf :tangle no - bindsym shortcut command - #+END_SRC +Shortcuts are set like so: +#+BEGIN_SRC conf :tangle no +bindsym shortcut command +#+END_SRC - #+NAME: generate-shortcuts - #+BEGIN_SRC emacs-lisp :exports none :var table=[] :tangle no - (mapconcat (lambda (x) (format "bindsym %s %s" (car x) (cadr x))) - table - "\n") - #+END_SRC +#+NAME: generate-shortcuts +#+BEGIN_SRC emacs-lisp :exports none :var table=[] :tangle no + (mapconcat (lambda (x) (format "bindsym %s %s" (car x) (cadr x))) + table + "\n") +#+END_SRC ** Terminal shortcuts :PROPERTIES: :CUSTOM_ID: Shortcuts-Terminal_shortcuts-514ecdbe :END: - 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. - #+NAME: terminal-shortcuts - | shortcut | command | What it does | - |-------------------+----------------------+--------------------------------------------------| - | $mod+Return | exec $term | Opens a regular terminal console | - | $mod+$alt+Return | split h;; exec $term | Opens a terminal console below the current one | - | $mod+Shift+Return | split v;; exec $term | Opens a terminal on the right of the current one | - | $mod+$alt+m | exec $term ssh Mila | Opens an SSH instance in my Mila host | - | $mod+$alt+n | exec $term ssh Naro | Opens an SSH instance in my Naro host | - | $mod+Shift+h | exec $term htop | Opens a terminal with ~htop~ | +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. +#+NAME: terminal-shortcuts +| shortcut | command | What it does | +|-------------------+----------------------+--------------------------------------------------| +| $mod+Return | exec $term | Opens a regular terminal console | +| $mod+$alt+Return | split h;; exec $term | Opens a terminal console below the current one | +| $mod+Shift+Return | split v;; exec $term | Opens a terminal on the right of the current one | +| $mod+$alt+m | exec $term ssh Mila | Opens an SSH instance in my Mila host | +| $mod+$alt+n | exec $term ssh Naro | Opens an SSH instance in my Naro host | +| $mod+Shift+h | exec $term htop | Opens a terminal with ~htop~ | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC ** i3 shortcuts :PROPERTIES: :CUSTOM_ID: Shortcuts-i3_shortcuts-369039ae :END: - A couple of shortcuts are dedicated to i3 itself. - #+NAME: i3-sh - | shortcut | command | what it does | - |--------------+---------------------------------+----------------------------------| - | $mod+Shift+c | exec yadm alt && i3-msg reload | Reload the i3 configuration file | - | $mod+Shift+r | exec yadm alt && i3-msg restart | Restart i3 inplace | - | $mod+Shift+e | exec $exiti3 | Quit i3 | +A couple of shortcuts are dedicated to i3 itself. +#+NAME: i3-sh +| shortcut | command | what it does | +|--------------+---------------------------------+----------------------------------| +| $mod+Shift+c | exec yadm alt && i3-msg reload | Reload the i3 configuration file | +| $mod+Shift+r | exec yadm alt && i3-msg restart | Restart i3 inplace | +| $mod+Shift+e | exec $exiti3 | Quit i3 | - 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 system’s color configuration from it. - #+NAME: wal-sh - | shortcut | command | what it does | - |----------+--------------+--------------------------------------------------------------| - | $mod+w | exec $walset | Set a random wallpaper and generates a color profile from it | +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 system’s color configuration from it. +#+NAME: wal-sh +| shortcut | command | what it does | +|----------+--------------+--------------------------------------------------------------| +| $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 - down our computer. - #+NAME: computer-sh - | shortcut | command | what it does | - |---------------+----------------------------+------------------------| - | $mod+l | exec i3lock -fol | Lock the screen | - | $mod+$alt+h | exec "systemctl suspend" | Suspend the computer | - | $mod+Ctrl+h | exec "systemctl hibernate" | Hibernate the computer | - | $mod+Shift+F4 | exec poweroff | Power off the computer | +We also have some shortcuts to lock our screen, sleep, hibernate and shut down our computer. +#+NAME: computer-sh +| shortcut | command | what it does | +|---------------+----------------------------+------------------------| +| $mod+l | exec i3lock -fol | Lock the screen | +| $mod+$alt+h | exec "systemctl suspend" | Suspend the computer | +| $mod+Ctrl+h | exec "systemctl hibernate" | Hibernate the computer | +| $mod+Shift+F4 | exec poweroff | Power off the computer | - Here is the configuration: - #+BEGIN_SRC conf - <> - <> - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +<> +<> +#+END_SRC ** Window and workspace management :PROPERTIES: @@ -392,533 +334,479 @@ :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Managing_how_windows_will_split-5a22ae31 :END: - 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. - #+NAME: split-win-sh - | shortcuts | command | what it does | - |-----------+---------+--------------------------------------------------------| - | $mod+h | split h | Next window to spawn will spawn below the current one | - | $mod+v | split v | Next window to spawn will spawn beside the current one | +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. +#+NAME: split-win-sh +| shortcuts | command | what it does | +|-----------+---------+--------------------------------------------------------| +| $mod+h | split h | Next window to spawn will spawn below the current one | +| $mod+v | split v | Next window to spawn will spawn beside the current one | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Focus windows :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Focus_windows-69a00ae9 :END: - To change window focus, you can use one of the following shortcuts: - #+NAME: window-focus-sh - | shortcut | command | what it does | - |-------------+-------------+-------------------------------------------| - | $mod+$left | focus left | Focus the window left of the current one | - | $mod+$down | focus down | Focus the window down of the current one | - | $mod+$up | focus up | Focus the window up of the current one | - | $mod+$right | focus right | Focus the windof right of the current one | +To change window focus, you can use one of the following shortcuts: +#+NAME: window-focus-sh +| shortcut | command | what it does | +|-------------+-------------+-------------------------------------------| +| $mod+$left | focus left | Focus the window left of the current one | +| $mod+$down | focus down | Focus the window down of the current one | +| $mod+$up | focus up | Focus the window up of the current one | +| $mod+$right | focus right | Focus the windof right of the current one | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Focus workspaces :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Focus_workspaces-9f4bee74 :END: - Just like windows, it is also possible to change focus between workspaces, - because let’s be honest, most people won’t have ten screens to display all - ten workspaces at the same time, and frankly that would be impractical. - #+NAME: ws-focus-sh - | shortcut | window | what it does | - |----------+--------------+-------------------------| - | $mod+1 | workspace 1 | Focus first workspace | - | $mod+2 | workspace 2 | Focus second workspace | - | $mod+3 | workspace 3 | Focus third workspace | - | $mod+4 | workspace 4 | Focus fourth workspace | - | $mod+5 | workspace 5 | Focus fifth workspace | - | $mod+6 | workspace 6 | Focus sixth workspace | - | $mod+7 | workspace 7 | Focus seventh workspace | - | $mod+8 | workspace 8 | Focus eighth workspace | - | $mod+9 | workspace 9 | Focus ninth workspace | - | $mod+0 | workspace 10 | Focus tenth workspace | +Just like windows, it is also possible to change focus between workspaces, because let’s be honest, most people won’t have ten screens to display all ten workspaces at the same time, and frankly that would be impractical. +#+NAME: ws-focus-sh +| shortcut | window | what it does | +|----------+--------------+-------------------------| +| $mod+1 | workspace 1 | Focus first workspace | +| $mod+2 | workspace 2 | Focus second workspace | +| $mod+3 | workspace 3 | Focus third workspace | +| $mod+4 | workspace 4 | Focus fourth workspace | +| $mod+5 | workspace 5 | Focus fifth workspace | +| $mod+6 | workspace 6 | Focus sixth workspace | +| $mod+7 | workspace 7 | Focus seventh workspace | +| $mod+8 | workspace 8 | Focus eighth workspace | +| $mod+9 | workspace 9 | Focus ninth workspace | +| $mod+0 | workspace 10 | Focus tenth workspace | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Moving windows :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Moving_windows-d8c90ac2 :END: - To move windows, a couple of shortcuts are available: - #+NAME: window-move-sh - | shortcut | command | what it does | - |-------------------+------------+-------------------------------| - | $mod+Shift+$left | move left | Move the focused window left | - | $mod+Shift+$down | move down | Move the focused window down | - | $mod+Shift+$up | move up | Move the focused window up | - | $mod+Shift+$right | move right | Move the focused window right | +To move windows, a couple of shortcuts are available: +#+NAME: window-move-sh +| shortcut | command | what it does | +|-------------------+------------+-------------------------------| +| $mod+Shift+$left | move left | Move the focused window left | +| $mod+Shift+$down | move down | Move the focused window down | +| $mod+Shift+$up | move up | Move the focused window up | +| $mod+Shift+$right | move right | Move the focused window right | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Moving containers :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Moving_containers-b97cf4ae :END: - To move containers between the available screens, you have the following - shortcuts: - #+NAME: containers-move-sh - | shortcut | command | what it does | - |------------------+--------------------------------+------------------------------------------------------------| - | $mod+Ctrl+$left | move container to output left | Moves the container to the screen left of the current one | - | $mod+Ctrl+$down | move container to output down | Moves the container to the screen down of the current one | - | $mod+Ctrl+$up | move container to output up | Moves the container to the screen above the current one | - | $mod+Ctrl+$right | move container to output right | Moves the container to the screen right of the current one | +To move containers between the available screens, you have the following shortcuts: +#+NAME: containers-move-sh +| shortcut | command | what it does | +|------------------+--------------------------------+------------------------------------------------------------| +| $mod+Ctrl+$left | move container to output left | Moves the container to the screen left of the current one | +| $mod+Ctrl+$down | move container to output down | Moves the container to the screen down of the current one | +| $mod+Ctrl+$up | move container to output up | Moves the container to the screen above the current one | +| $mod+Ctrl+$right | move container to output right | Moves the container to the screen right of the current one | - You can also send containers to other workspaces by their number. - #+NAME: containers-ws-sh - | shortcut | command | what it does | - |--------------+--------------------------------+--------------------------------------------| - | $mod+Shift+1 | move container to workspace 1 | Move current container to the workspace 1 | - | $mod+Shift+2 | move container to workspace 2 | Move current container to the workspace 2 | - | $mod+Shift+3 | move container to workspace 3 | Move current container to the workspace 3 | - | $mod+Shift+4 | move container to workspace 4 | Move current container to the workspace 4 | - | $mod+Shift+5 | move container to workspace 5 | Move current container to the workspace 5 | - | $mod+Shift+6 | move container to workspace 6 | Move current container to the workspace 6 | - | $mod+Shift+7 | move container to workspace 7 | Move current container to the workspace 7 | - | $mod+Shift+8 | move container to workspace 8 | Move current container to the workspace 8 | - | $mod+Shift+9 | move container to workspace 9 | Move current container to the workspace 9 | - | $mod+Shift+0 | move container to workspace 10 | Move current container to the workspace 10 | +You can also send containers to other workspaces by their number. +#+NAME: containers-ws-sh +| shortcut | command | what it does | +|--------------+--------------------------------+--------------------------------------------| +| $mod+Shift+1 | move container to workspace 1 | Move current container to the workspace 1 | +| $mod+Shift+2 | move container to workspace 2 | Move current container to the workspace 2 | +| $mod+Shift+3 | move container to workspace 3 | Move current container to the workspace 3 | +| $mod+Shift+4 | move container to workspace 4 | Move current container to the workspace 4 | +| $mod+Shift+5 | move container to workspace 5 | Move current container to the workspace 5 | +| $mod+Shift+6 | move container to workspace 6 | Move current container to the workspace 6 | +| $mod+Shift+7 | move container to workspace 7 | Move current container to the workspace 7 | +| $mod+Shift+8 | move container to workspace 8 | Move current container to the workspace 8 | +| $mod+Shift+9 | move container to workspace 9 | Move current container to the workspace 9 | +| $mod+Shift+0 | move container to workspace 10 | Move current container to the workspace 10 | - Here is the configuration: - #+BEGIN_SRC conf - <> - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +<> +#+END_SRC *** Moving workspaces :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Moving_workspaces-a71d7b54 :END: - It is also possible to move workspaces. The related shortcuts available are - the following: +It is also possible to move workspaces. The related shortcuts available are the following: - #+NAME: workspace-move-sh - | shortcut | command | what it does | - |------------------------+--------------------------------+------------------------------------------------------------| - | $mod+Ctrl+Shift+$left | move workspace to output left | Moves the workspace to the screen left of the current one | - | $mod+Ctrl+Shift+$down | move workspace to output down | Moves the workspace to the screen down of the current one | - | $mod+Ctrl+Shift+$up | move workspace to output up | Moves the workspace to the screen above the current one | - | $mod+Ctrl+Shift+$right | move workspace to output right | Moves the workspace to the screen right of the current one | +#+NAME: workspace-move-sh +| shortcut | command | what it does | +|------------------------+--------------------------------+------------------------------------------------------------| +| $mod+Ctrl+Shift+$left | move workspace to output left | Moves the workspace to the screen left of the current one | +| $mod+Ctrl+Shift+$down | move workspace to output down | Moves the workspace to the screen down of the current one | +| $mod+Ctrl+Shift+$up | move workspace to output up | Moves the workspace to the screen above the current one | +| $mod+Ctrl+Shift+$right | move workspace to output right | Moves the workspace to the screen right of the current one | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Close windows :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Close_windows-5e521a48 :END: - To close windows, we have two main shortcuts: Alt+F4 and mod+q. The first - one is here due to habits, but I don’t really use it anymore due to my main - keyboard which doesn’t have any easy access to the functions keys, hence - mod+q. - #+NAME: close-win-sh - | shortcut | command | what it does | - |----------+---------+-------------------------| - | $mod+q | kill | kill the current window | - | $alt+F4 | kill | kill the current window | +To close windows, we have two main shortcuts: Alt+F4 and mod+q. The first one is here due to habits, but I don’t really use it anymore due to my main keyboard which doesn’t have any easy access to the functions keys, hence mod+q. +#+NAME: close-win-sh +| shortcut | command | what it does | +|----------+---------+-------------------------| +| $mod+q | kill | kill the current window | +| $alt+F4 | kill | kill the current window | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Manage the size of the current window :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Manage_the_size_of_the_current_window-11afa914 :END: - 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. - #+NAME: size-win-sh - | shortcut | command | what it does | - |----------+-------------------+---------------------------------------------------| - | $mod+f | fullscreen toggle | Puts the current window in fullscreen or exits it | - | $mod+r | mode "resize" | Enter resize mode | +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. +#+NAME: size-win-sh +| shortcut | command | what it does | +|----------+-------------------+---------------------------------------------------| +| $mod+f | fullscreen toggle | Puts the current window in fullscreen or exits it | +| $mod+r | mode "resize" | Enter resize mode | - When it comes to modes, they are defined as follows: - #+BEGIN_SRC conf :tangle no - mode "nameofyourmode" { - here go your shortcuts - } - #+END_SRC +When it comes to modes, they are defined as follows: +#+BEGIN_SRC conf :tangle no + mode "nameofyourmode" { + here go your shortcuts + } +#+END_SRC - 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~. - #+NAME: resize-win-sh - | shortcut | command | what it does | - |----------+-------------------------------------+-------------------------------------------| - | $right | resize grow width 20 px or 10 ppt | Increase the width of the current window | - | r | resize grow width 20 px or 10 ppt | Increase the width of the current window | - | $left | resize shrink width 10 px or 5 ppt | Decrease the width of the current window | - | c | resize shrink width 10 px or 5 ppt | Decrease the width of the current window | - | $down | resize grow height 10 px or 5 ppt | Increase the height of the current window | - | t | resize grow height 10 px or 5 ppt | Increase the height of the current window | - | $up | 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 | - | Escape | mode "default" | Return to the default mode | - 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. +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~. +#+NAME: resize-win-sh +| shortcut | command | what it does | +|----------+-------------------------------------+-------------------------------------------| +| $right | resize grow width 20 px or 10 ppt | Increase the width of the current window | +| r | resize grow width 20 px or 10 ppt | Increase the width of the current window | +| $left | resize shrink width 10 px or 5 ppt | Decrease the width of the current window | +| c | resize shrink width 10 px or 5 ppt | Decrease the width of the current window | +| $down | resize grow height 10 px or 5 ppt | Increase the height of the current window | +| t | resize grow height 10 px or 5 ppt | Increase the height of the current window | +| $up | 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 | +| Escape | mode "default" | Return to the default mode | +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. - Here is the configuration: - #+BEGIN_SRC conf - <> - mode "resize" { - <> - } - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf + <> + mode "resize" { + <> + } +#+END_SRC *** Manage floating windows :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Manage_floating_windows-9206f4da :END: - 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: - #+NAME: float-win-sh - | shortcut | command | what it does | - |------------------+----------------------+------------------------------------------------------| - | $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+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 - mouse while holding down the floating modifier declared [[#Variables_declaration-Floating_windows-897d0c3b][here]]. +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: +#+NAME: float-win-sh +| shortcut | command | what it does | +|------------------+----------------------+------------------------------------------------------| +| $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+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 mouse while holding down the floating modifier declared [[#Variables_declaration-Floating_windows-897d0c3b][here]]. - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Scratchpad and window display :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Scratchpad_and_window_display-10d8d1f4 :END: - You can think of i3’s 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 think of i3’s 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 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. - #+NAME: scratchpad-sh - | shortcut | command | what it does | - |--------------+-----------------+------------------------------------------------------| - | $mod+Shift+s | move scratchpad | Sends the current window to the scratchpad | - | $mod+s | scratchpad show | Shows and cycles through windows from the scratchpad | - | $mod+Ctrl+s | sticky toggle | Toggles sticky mode on current 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. +#+NAME: scratchpad-sh +| shortcut | command | what it does | +|--------------+-----------------+------------------------------------------------------| +| $mod+Shift+s | move scratchpad | Sends the current window to the scratchpad | +| $mod+s | scratchpad show | Shows and cycles through windows from the scratchpad | +| $mod+Ctrl+s | sticky toggle | Toggles sticky mode on current window | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Gaps management :PROPERTIES: :CUSTOM_ID: Shortcuts-Window_and_workspace_management-Gaps_management-33979213 :END: - 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. - #+NAME: gaps-resize-sh - | shortcut | command | what it does | - |-------------------+-----------------------------------------------+-----------------------------| - | $mod+g | gaps inner current plus 5 | Increase the inner gap size | - | $mod+Shift+g | gaps inner current minus 5 | Decrease the inner gap size | - | $mod+Ctrl+g | gaps outer current plus 5 | Increase the outer gap size | - | $mod+Ctrl+Shift+g | gaps outer current minus 5 | Decrease the outer gap size | - | $mod+$alt+g | gaps inner all set 20; gaps outer all set -10 | Reset gaps | +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. +#+NAME: gaps-resize-sh +| shortcut | command | what it does | +|-------------------+-----------------------------------------------+-----------------------------| +| $mod+g | gaps inner current plus 5 | Increase the inner gap size | +| $mod+Shift+g | gaps inner current minus 5 | Decrease the inner gap size | +| $mod+Ctrl+g | gaps outer current plus 5 | Increase the outer gap size | +| $mod+Ctrl+Shift+g | gaps outer current minus 5 | Decrease the outer gap size | +| $mod+$alt+g | gaps inner all set 20; gaps outer all set -10 | Reset gaps | - Here is the corresponding configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the corresponding configuration: +#+BEGIN_SRC conf +<> +#+END_SRC ** Launching software :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-0e088e69 :END: - A big part of my i3 shortcuts though are related to launching various - software. I’ll 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. +A big part of my i3 shortcuts though are related to launching various software. I’ll 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 :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Software_and_command_launcher-a3f5863e :END: - 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. - #+NAME: launcher-sh - | shortcut | command | what it does | - |--------------+---------------------------------------+-------------------------------------------------------| - | $mod+Shift+d | exec --no-startup-id j4-dmenu-desktop | Launch a registered application | - | $mod+d | exec --no-startup-id $rofiexec | Launch a terminal command or a registered application | +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. +#+NAME: launcher-sh +| shortcut | command | what it does | +|--------------+---------------------------------------+-------------------------------------------------------| +| $mod+Shift+d | exec --no-startup-id j4-dmenu-desktop | Launch a registered application | +| $mod+d | exec --no-startup-id $rofiexec | Launch a terminal command or a registered application | - Here is the configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Here is the configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Internet software :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Internet_software-a0524cd8 :END: - I have a couple of Internet-related software I can launch easily. - #+NAME: internet-sh - | shortcut | command | what it does | - |--------------+---------------------+-----------------------------| - | $mod+b | exec firefox | Launch browser | - | $mod+m | exec $mail | Launch Gnus, my mail client | - | Ctrl+Shift+d | exec discord-canary | Launch Discord | +I have a couple of Internet-related software I can launch easily. +#+NAME: internet-sh +| shortcut | command | what it does | +|--------------+---------------------+-----------------------------| +| $mod+b | exec firefox | Launch browser | +| $mod+m | exec $mail | Launch Gnus, my mail client | +| Ctrl+Shift+d | exec discord-canary | Launch Discord | - Hence this configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +Hence this configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Screenshots :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Screenshots-41e41c88 :END: - A couple of shortcuts are available for taking screenshots. - #+NAME: screenshot-sh - | shortcut | command | what it does | - |-------------+-----------------------------------+----------------------------------------------------------| - | Print | exec --no-startup-id scrot | Takes a screenshot of the entire desktop | - | Ctrl+Print | exec --no-startup-id "scrot -s" | Takes a screenshot of a region or the selected window | - | Shift+Print | exec --no-startup-id "scrot -d 3" | takes a screenshot of the desktop three in three seconds | +A couple of shortcuts are available for taking screenshots. +#+NAME: screenshot-sh +| shortcut | command | what it does | +|-------------+-----------------------------------+----------------------------------------------------------| +| Print | exec --no-startup-id scrot | Takes a screenshot of the entire desktop | +| Ctrl+Print | exec --no-startup-id "scrot -s" | Takes a screenshot of a region or the selected window | +| Shift+Print | exec --no-startup-id "scrot -d 3" | takes a screenshot of the desktop three in three seconds | - This gives us this configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +This gives us this configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Screen brightness :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Screen_brightness-6855d53f :END: - Here we have four commands for managing our screen’s 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 doesn’t have dedicated keys or - we are using a keyboard which doesn’t provide them. - #+NAME: brightness-sh - | shortcut | command | what it does | - |-----------------------+------------------------+---------------------------------------| - | XF86MonBrightnessUp | exec xbacklight -inc 5 | Increase the brightness of the screen | - | $mod+$alt+Next | exec xbacklight -inc 5 | Increase the brightness of the screen | - | XF86MonBrightnessDown | exec xbacklight -dec 5 | Decrease the brightness of the screen | - | $mod+$alt+Prev | exec xbacklight -dec 5 | Decrease the brightness of the screen | +Here we have four commands for managing our screen’s 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 doesn’t have dedicated keys or we are using a keyboard which doesn’t provide them. +#+NAME: brightness-sh +| shortcut | command | what it does | +|-----------------------+------------------------+---------------------------------------| +| XF86MonBrightnessUp | exec xbacklight -inc 5 | Increase the brightness of the screen | +| $mod+$alt+Next | exec xbacklight -inc 5 | Increase the brightness of the screen | +| XF86MonBrightnessDown | exec xbacklight -dec 5 | Decrease the brightness of the screen | +| $mod+$alt+Prev | exec xbacklight -dec 5 | Decrease the brightness of the screen | - This gives us this configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +This gives us this configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Media control :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Media_control-18ad2815 :END: - 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. - #+NAME: media-sh - | shortcut | command | what it does | - |---------------------------+--------------------+--------------------------------| - | XF86AudioNext | exec mpc next | Forward to the next track | - | $alt+XF86AudioRaiseVolume | exec mpc next | Forward to the next track | - | $mod+Next | exec mpc next | Forward to the next track | - | XF86AudioPrev | exec mpc prev | Backward to the previous track | - | $alt+XF86AudioLowerVolume | exec mpc prev | Backward to the previous track | - | $mod+Prior | exec mpc prev | Backward to the previous track | - | XF86AudioPlay | exec mpc toggle | Play or pause the music | - | $mod+p | exec mpc toggle | Play or pause the music | - | $mod+$alt+p | exec mpc stop | Completely stop the music | - | XF86AudioStop | exec mpc stop | Completely stop the music | - | $alt+XF86AudioPlay | exec mpc stop | Completely stop the music | - | $mod+$alt+7 | exec mpc volume +5 | Increase the volume from mpd | - | $mod+$alt+8 | exec mpc volume -5 | Decrease the volume from mpd | +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. +#+NAME: media-sh +| shortcut | command | what it does | +|---------------------------+--------------------+--------------------------------| +| XF86AudioNext | exec mpc next | Forward to the next track | +| $alt+XF86AudioRaiseVolume | exec mpc next | Forward to the next track | +| $mod+Next | exec mpc next | Forward to the next track | +| XF86AudioPrev | exec mpc prev | Backward to the previous track | +| $alt+XF86AudioLowerVolume | exec mpc prev | Backward to the previous track | +| $mod+Prior | exec mpc prev | Backward to the previous track | +| XF86AudioPlay | exec mpc toggle | Play or pause the music | +| $mod+p | exec mpc toggle | Play or pause the music | +| $mod+$alt+p | exec mpc stop | Completely stop the music | +| XF86AudioStop | exec mpc stop | Completely stop the music | +| $alt+XF86AudioPlay | exec mpc stop | Completely stop the music | +| $mod+$alt+7 | exec mpc volume +5 | Increase 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 - with the playlist open by default, or the visualizes open. - #+NAME: ncmpcpp-sh - | shortcut | command | what it does | - |--------------+-----------------------------------+----------------------------------| - | $mod+Shift+n | exec $term ncmpcpp -q | Launch ncmpcpp’s playlist editor | - | $mod+Shift+v | exec $term ncmpcpp -qs visualizer | Launch ncmpcpp’s visualizer | +We also have two shortcuts for launching ncmpcpp, my mpd frontend, either with the playlist open by default, or the visualizes open. +#+NAME: ncmpcpp-sh +| shortcut | command | what it does | +|--------------+-----------------------------------+----------------------------------| +| $mod+Shift+n | exec $term ncmpcpp -q | Launch ncmpcpp’s playlist editor | +| $mod+Shift+v | exec $term ncmpcpp -qs visualizer | Launch ncmpcpp’s visualizer | - We also have more general shortcuts, like how to manipulate the general - volume level. - #+NAME: volume-sh - | shortcut | command | what it does | - |----------------------+----------------------------------------+----------------------| - | XF86AudioMute | exec "amixer set Master 1+ toggle" | Mute or unmute audio | - | Ctrl+$mod+Prior | exec "amixer -q set Master 2%+ unmute" | Raise volume | - | XF86AudioRaiseVolume | exec "amixer -q set Master 2%+ unmute" | Raise volume | - | Ctrl+$mod+Next | exec "amixer -q set Master 2%- unmute" | Reduce volume | - | XF86AudioLowerVolume | exec "amixer -q set Master 2%- unmute" | Reduce volume | +We also have more general shortcuts, like how to manipulate the general volume level. +#+NAME: volume-sh +| shortcut | command | what it does | +|----------------------+----------------------------------------+----------------------| +| XF86AudioMute | exec "amixer set Master 1+ toggle" | Mute or unmute audio | +| Ctrl+$mod+Prior | exec "amixer -q set Master 2%+ unmute" | Raise volume | +| XF86AudioRaiseVolume | exec "amixer -q set Master 2%+ unmute" | Raise volume | +| Ctrl+$mod+Next | exec "amixer -q set Master 2%- unmute" | Reduce volume | +| XF86AudioLowerVolume | exec "amixer -q set Master 2%- unmute" | Reduce volume | - This gives us this configuration: - #+BEGIN_SRC conf - <> - <> - <> - #+END_SRC +This gives us this configuration: +#+BEGIN_SRC conf +<> +<> +<> +#+END_SRC *** Rofi utilities :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Rofi_utilities-b8eb5b95 :END: - We also have some utilities I’ve written and which are interfaced with rofi. - Here are said shortcuts. - #+NAME: rofi-sh - | shortcut | command | what it does | - |-------------------+-----------------------+-----------------------------------------------------------------------| - | $mod+Shift+p | exec rofi-pass --type | Types the selected password available from ~pass~ where the cursor is | - | $mod+Ctrl+Shift+p | exec rofi-pass | Copies in the clipboard the selected password from ~pass~ for 45 sec | - | $mod+Ctrl+m | exec rofi-mount | Volume mounting helper | - | $mod+Ctrl+u | exec rofi-umount | Volume unmounting helper | - | $mod+$alt+e | exec rofi-emoji | Emoji picker, copies it in the clipboard | - | $mod+Ctrl+w | exec wacom-setup | Sets my Wacom Bamboo tablet as being active on the selected screen | - | $mod+Shift+w | exec connect-wifi | Connect to an available WiFi network | +We also have some utilities I’ve written and which are interfaced with rofi. Here are said shortcuts. +#+NAME: rofi-sh +| shortcut | command | what it does | +|-------------------+-----------------------+-----------------------------------------------------------------------| +| $mod+Shift+p | exec rofi-pass --type | Types the selected password available from ~pass~ where the cursor is | +| $mod+Ctrl+Shift+p | exec rofi-pass | Copies in the clipboard the selected password from ~pass~ for 45 sec | +| $mod+Ctrl+m | exec rofi-mount | Volume mounting helper | +| $mod+Ctrl+u | exec rofi-umount | Volume unmounting helper | +| $mod+$alt+e | exec rofi-emoji | Emoji picker, copies it in the clipboard | +| $mod+Ctrl+w | exec wacom-setup | Sets my Wacom Bamboo tablet as being active on the selected screen | +| $mod+Shift+w | exec connect-wifi | Connect to an available WiFi network | - This gives us the following configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +This gives us the following configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Miscellaneous :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Miscellaneous-7ec80fea :END: - 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. - #+NAME: misc-sh - | shortcut | command | what it does | - |-------------+------------------+---------------------------------| - | $mod+e | exec $ec | Launch Emacs client | - | $mod+n | exec nemo | Launch Nemo (file manager) | - | $mod+$alt+c | exec speedcrunch | Launch Speedcrunch (calculator) | - | $mod+F3 | exec arandr | Launch arandr | +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. +#+NAME: misc-sh +| shortcut | command | what it does | +|-------------+------------------+---------------------------------| +| $mod+e | exec $ec | Launch Emacs client | +| $mod+n | exec nemo | Launch Nemo (file manager) | +| $mod+$alt+c | exec speedcrunch | Launch Speedcrunch (calculator) | +| $mod+F3 | exec arandr | Launch arandr | - This gives us the following configuration: - #+BEGIN_SRC conf - <> - #+END_SRC +This gives us the following configuration: +#+BEGIN_SRC conf +<> +#+END_SRC *** Screen management :PROPERTIES: :CUSTOM_ID: Shortcuts-Launching_software-Screen_management-f9b35bf2 :END: - 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. We’ll use some - Emacs Lisp to determine on the configuration file export which screens names - to use. - #+NAME: hostname-screen-management - #+BEGIN_SRC emacs-lisp - (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")) - #+END_SRC +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. We’ll use some Emacs Lisp to determine on the configuration file export which screens names to use. +#+NAME: hostname-screen-management +#+BEGIN_SRC emacs-lisp + (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")) +#+END_SRC - Now, we just have to call this Emacs Lisp code as a noweb reference and - execute it. - #+BEGIN_SRC conf :noweb yes - <> - #+END_SRC +Now, we just have to call this Emacs Lisp code as a noweb reference and execute it. +#+BEGIN_SRC conf :noweb yes + <> +#+END_SRC * Software autolaunch :PROPERTIES: :CUSTOM_ID: Software_autolaunch-ccee82f6 :END: - When i3 is launched, I want it to also launch some software automatically. - Here is what we will launch: - #+NAME: autolaunch - | always execute it? | command | what it is | - |--------------------+-------------------------------------------+----------------------------------------| - | no | /usr/lib/xfce-polkit/xfce-polkit | Launch the XFCE Polkit | - | no | picom --experimental-backends -e 1 | Launch picom | - | no | xss-lock -- lock | Launch power management | - | no | numlockx on | Activate NumLock | - | no | dunst -config ~/.config/dunst/dunstrc | Launch notification manager | - | no | nm-applet | NetworkManager system tray | - | yes | wal -i "$(< "${HOME}/.cache/wal/wal")" | Sets the wallpaper from last session | - | no | xrdb $HOME/.Xresources | Load Xresources files | - | yes | polybar-launch | Launch polybar | - | no | mpc stop | Stop music from mpd | - | no | mpd_discord_richpresence --no-idle --fork | Launch mpd status sharing with Discord | +When i3 is launched, I want it to also launch some software automatically. Here is what we will launch: +#+NAME: autolaunch +| always execute it? | command | what it is | +|--------------------+-------------------------------------------+----------------------------------------| +| no | /usr/lib/xfce-polkit/xfce-polkit | Launch the XFCE Polkit | +| no | picom --experimental-backends -e 1 | Launch picom | +| no | xss-lock -- lock | Launch power management | +| no | numlockx on | Activate NumLock | +| no | dunst -config ~/.config/dunst/dunstrc | Launch notification manager | +| no | nm-applet | NetworkManager system tray | +| yes | wal -i "$(< "${HOME}/.cache/wal/wal")" | Sets the wallpaper from last session | +| no | xrdb $HOME/.Xresources | Load Xresources files | +| yes | polybar-launch | Launch polybar | +| no | mpc stop | Stop music from mpd | +| no | mpd_discord_richpresence --no-idle --fork | Launch mpd status sharing with Discord | - #+NAME: generate-autolaunch - #+BEGIN_SRC emacs-lisp :exports none :cache yes :var table=autolaunch - (mapconcat (lambda (x) - (format (concat (if (string= (car x) - "yes") - "exec_always" - "exec") - " --no-startup-id %s") - (cadr x))) - table - "\n") - #+END_SRC +#+NAME: generate-autolaunch +#+BEGIN_SRC emacs-lisp :exports none :cache yes :var table=autolaunch + (mapconcat (lambda (x) + (format (concat (if (string= (car x) + "yes") + "exec_always" + "exec") + " --no-startup-id %s") + (cadr x))) + table + "\n") +#+END_SRC - #+RESULTS[283577fe2e66b30c936b7fcf142713d285db8da6]: generate-autolaunch - #+begin_example - exec_always --no-startup-id wal -i "$(< "${HOME}/.cache/wal/wal")" - exec --no-startup-id xss-lock -- i3lock -fol - exec --no-startup-id dunst -config ~/.config/dunst/dunstrc - exec --no-startup-id xrdb $HOME/.Xresources - exec --no-startup-id compton -F --opengl --config ~/.config/compton.conf -e 1 - exec_always --no-startup-id polybar-launch - exec_always --no-startup-id enable_touch - exec --no-startup-id syndaemon -i 1.0 -t -k - exec --no-startup-id mpc stop - exec --no-startup-id mpd_discord_richpresence --no-idle --fork - exec --no-startup-id nm-applet - exec --no-startup-id numlockx on - #+end_example +#+RESULTS[283577fe2e66b30c936b7fcf142713d285db8da6]: generate-autolaunch +#+begin_example +exec_always --no-startup-id wal -i "$(< "${HOME}/.cache/wal/wal")" +exec --no-startup-id xss-lock -- i3lock -fol +exec --no-startup-id dunst -config ~/.config/dunst/dunstrc +exec --no-startup-id xrdb $HOME/.Xresources +exec --no-startup-id compton -F --opengl --config ~/.config/compton.conf -e 1 +exec_always --no-startup-id polybar-launch +exec_always --no-startup-id enable_touch +exec --no-startup-id syndaemon -i 1.0 -t -k +exec --no-startup-id mpc stop +exec --no-startup-id mpd_discord_richpresence --no-idle --fork +exec --no-startup-id nm-applet +exec --no-startup-id numlockx on +#+end_example - My travel laptop has a fingerprint reader which can be used as an - authentification method when the root password is asked. Let’s launch our - policy kit manager if that is the case: - #+NAME: fingerprint-thinkpad - #+BEGIN_SRC emacs-lisp - (if (string= system-name "gampo") - "exec --no-startup-id /usr/lib/mate-polkit/polkit-mate-authentication-agent-1" - "") - #+END_SRC +My travel laptop has a fingerprint reader which can be used as an authentification method when the root password is asked. Let’s launch our policy kit manager if that is the case: +#+NAME: fingerprint-thinkpad +#+BEGIN_SRC emacs-lisp + (if (string= system-name "gampo") + "exec --no-startup-id /usr/lib/mate-polkit/polkit-mate-authentication-agent-1" + "") +#+END_SRC - #+BEGIN_SRC conf - <> - <> - #+END_SRC +#+BEGIN_SRC conf + <> + <> +#+END_SRC diff --git a/org/config/index.org b/org/config/index.org index 49a2086..f53d201 100644 --- a/org/config/index.org +++ b/org/config/index.org @@ -9,69 +9,51 @@ :PROPERTIES: :CUSTOM_ID: Presentation-981f2f04 :END: - 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. +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. - For starters, here is the link to all the pages on my website that you might - find interesting. I’ll describe them in more details below. - - [[file:installation.org][Arch Linux bootstrap script]] - - [[file:awesome.org][AwesomeWM configuration]] - - [[file:bin.org][Custom scripts]] - - [[file:spacemacs.org][Emacs (Spacemacs) configuration]] - - [[file:fish.org][Fish shell configuration]] - - [[file:i3.org][i3 configuration]] (deprecated) - - [[file:nano.org][Nano configuration]] (deprecated) - - [[file:ncmpcpp.org][ncmpcpp configuration]] (work in progress) - - [[file:neofetch.org][Neofetch configuration]] - - [[file:picom.org][Picom configuration]] (new fork of Compton) - - [[file:polybar.org][Polybar configuration]] (deprecated) - - [[file:rustfmt.org][Rustfmt configuration]] - - [[file:tmux.org][Tmux configuration]] +For starters, here is the link to all the pages on my website that you might find interesting. I’ll describe them in more details below. +- [[file:installation.org][Arch Linux bootstrap script]] +- [[file:awesome.org][AwesomeWM configuration]] +- [[file:bin.org][Custom scripts]] +- [[file:spacemacs.org][Emacs (Spacemacs) configuration]] +- [[file:fish.org][Fish shell configuration]] +- [[file:i3.org][i3 configuration]] (deprecated) +- [[file:nano.org][Nano configuration]] (deprecated) +- [[file:ncmpcpp.org][ncmpcpp configuration]] (work in progress) +- [[file:neofetch.org][Neofetch configuration]] +- [[file:picom.org][Picom configuration]] (new fork of Compton) +- [[file:polybar.org][Polybar configuration]] (deprecated) +- [[file:rustfmt.org][Rustfmt 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 - (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. +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. - 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]]. +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]]. - 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. +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. * Screenshots :PROPERTIES: :CUSTOM_ID: Screenshots-51f1cef3 :END: +#+CAPTION: Desktop with Neofetch in the terminal +[[./img/neofetch.png.webp]] - #+CAPTION: Desktop with Neofetch in the terminal - [[./img/neofetch.png.webp]] +#+CAPTION: Desktop with Emacs opened +[[./img/emacs.png.webp]] - #+CAPTION: Desktop with Emacs opened - [[./img/emacs.png.webp]] - - #+CAPTION: Desktop with Rofi - [[./img/rofi.png.webp]] +#+CAPTION: Desktop with Rofi +[[./img/rofi.png.webp]] * Features :PROPERTIES: :CUSTOM_ID: Features-5ab2a2c0 :END: - - Emacs configuration perfectly tailored for my own use - - Beautiful and comfy i3 and polybar configuration - - And enough information below to get basically the same distro install as I - have on my main computer and my travel laptop. +- Emacs configuration perfectly tailored for my own use +- Beautiful and comfy i3 and polybar configuration +- And enough information below to get basically the same distro install as I 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 - 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. +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. ** Tiling Window Managers :PROPERTIES: @@ -81,25 +63,19 @@ :PROPERTIES: :CUSTOM_ID: Features-Tiling_Window_Managers-AwesomeWM-2eac61a9 :END: - 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]]. +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]]. *** i3 configuration (Deprecated) :PROPERTIES: :CUSTOM_ID: Features-Tiling_Window_Managers-i3_configuration-9c92e43c :END: - 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. +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. ** Polybar config (Deprecated) :PROPERTIES: :CUSTOM_ID: Features-Polybar_config_(Deprecated)-c8f95774 :END: - 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. +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. ** Graphical tweaks :PROPERTIES: @@ -118,207 +94,191 @@ :HEADER-ARGS: :mkdirp yes :tangle ~/.gtkrc-2.0 :CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK2-General_configuration-eb1f1f3c :END: - 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, let’s select the Nordic theme for GTK2. Let’s also set - the icon theme. - #+BEGIN_SRC conf-unix - # -*- mode: unix-config -*- - gtk-theme-name="Nordic" - gtk-icon-theme-name="Flat-Remix-Dark" - #+END_SRC +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, let’s select the Nordic theme for GTK2. Let’s also set the icon theme. +#+BEGIN_SRC conf-unix + # -*- mode: unix-config -*- + gtk-theme-name="Nordic" + gtk-icon-theme-name="Flat-Remix-Dark" +#+END_SRC - #+BEGIN_SRC conf-unix - gtk-xft-antialias=1 - gtk-xft-hinting=1 - gtk-xft-hintstyle="hintslight" - #+END_SRC +#+BEGIN_SRC conf-unix + gtk-xft-antialias=1 + gtk-xft-hinting=1 + gtk-xft-hintstyle="hintslight" +#+END_SRC - This changes the shortcuts in menu, let’s also make the menus snappier. - #+BEGIN_SRC conf-unix - gtk-can-change-accels=1 - gtk-menu-bar-popup-delay=0 - gtk-menu-popdown-delay=0 - gtk-menu-popup-delay=0 - #+END_SRC +This changes the shortcuts in menu, let’s also make the menus snappier. +#+BEGIN_SRC conf-unix + gtk-can-change-accels=1 + gtk-menu-bar-popup-delay=0 + gtk-menu-popdown-delay=0 + gtk-menu-popup-delay=0 +#+END_SRC ***** Filechooser :PROPERTIES: :HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-2.0/gtkfilechooser.ini :CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK2-Filechooser-389f040d :END: - #+BEGIN_SRC conf-unix - [Filechooser Settings] - #+END_SRC +#+BEGIN_SRC conf-unix + [Filechooser Settings] +#+END_SRC - The first option alows me to open the file chooser in the current working - directory: - #+BEGIN_SRC conf-unix - StartupMode=cwd - #+END_SRC +The first option alows me to open the file chooser in the current working directory: +#+BEGIN_SRC conf-unix + StartupMode=cwd +#+END_SRC - Next, setting the location mode to ~path-bar~ will show the path as buttons - that can be clicked rather than the full path. - #+BEGIN_SRC conf-unix - LocationMode=path-bar - #+END_SRC +Next, setting the location mode to ~path-bar~ will show the path as buttons that can be clicked rather than the full path. +#+BEGIN_SRC conf-unix + LocationMode=path-bar +#+END_SRC - With this configuration, by default we won’t see hidden files. - #+BEGIN_SRC conf-unix - ShowHidden=true - #+END_SRC +With this configuration, by default we won’t see hidden files. +#+BEGIN_SRC conf-unix + ShowHidden=true +#+END_SRC - And we'll also see the size of the visible files. - #+BEGIN_SRC conf-unix - ShowSizeColumn=true - #+END_SRC +And we'll also see the size of the visible files. +#+BEGIN_SRC conf-unix + ShowSizeColumn=true +#+END_SRC - Now, let’s choose the geometry of our file picker. These two first lines - set where the file picker appears: - #+BEGIN_SRC conf-unix - GeometryX=566 - GeometryY=202 - #+END_SRC +Now, let’s choose the geometry of our file picker. These two first lines set where the file picker appears: +#+BEGIN_SRC conf-unix + GeometryX=566 + GeometryY=202 +#+END_SRC - And these two describe the size of the window: - #+BEGIN_SRC conf-unix - GeometryWidth=800 - GeometryHeight=400 - #+END_SRC +And these two describe the size of the window: +#+BEGIN_SRC conf-unix + GeometryWidth=800 + GeometryHeight=400 +#+END_SRC - With these two lines, we set how our files are sorted: by name, and in the - ascending order. - #+BEGIN_SRC conf-unix - SortColumn=name - SortOrder=ascending - #+END_SRC +With these two lines, we set how our files are sorted: by name, and in the ascending order. +#+BEGIN_SRC conf-unix + SortColumn=name + SortOrder=ascending +#+END_SRC - Our default view mode is a list of files: - #+BEGIN_SRC conf-unix - ViewMode=list-view - #+END_SRC +Our default view mode is a list of files: +#+BEGIN_SRC conf-unix + ViewMode=list-view +#+END_SRC - And finally, setting our icon view scale to ~-1~ sets the icon view to the - max size. - #+BEGIN_SRC conf-unix - IconViewScale=-1 - #+END_SRC +And finally, setting our icon view scale to ~-1~ sets the icon view to the max size. +#+BEGIN_SRC conf-unix + IconViewScale=-1 +#+END_SRC **** GTK3 :PROPERTIES: :HEADER-ARGS: :mkdirp yes :tangle ~/.config/gtk-3.0/settings.ini :CUSTOM_ID: Features-Graphical_tweaks-GTK_Settings-GTK3-3d6cba86 :END: - The following file helps me choosing the aspect of various GTK+ 3 software, - including their theme and icons. First, let’s declare the header: - #+BEGIN_SRC conf-unix - [Settings] - #+END_SRC +The following file helps me choosing the aspect of various GTK+ 3 software, including their theme and icons. First, let’s declare the header: +#+BEGIN_SRC conf-unix + [Settings] +#+END_SRC - Now, let’s 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. - #+BEGIN_SRC conf-unix - gtk-application-prefer-dark-theme = true - #+END_SRC +Now, let’s 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. +#+BEGIN_SRC conf-unix + gtk-application-prefer-dark-theme = true +#+END_SRC - Next, the icon theme is the Flat Remix Dark icon theme: - #+BEGIN_SRC conf-unix - gtk-icon-theme-name = Flat-Remix-Dark - #+END_SRC +Next, the icon theme is the Flat Remix Dark icon theme: +#+BEGIN_SRC conf-unix + gtk-icon-theme-name = Flat-Remix-Dark +#+END_SRC - Now, the general theme for GTK3 is Nordic. - #+BEGIN_SRC conf-unix - gtk-theme-name = Nordic - #+END_SRC +Now, the general theme for GTK3 is Nordic. +#+BEGIN_SRC conf-unix + gtk-theme-name = Nordic +#+END_SRC - #+BEGIN_SRC conf-unix - gtk-can-change-accels=1 - gtk-menu-bar-popup-delay=0 - gtk-menu-popdown-delay=0 - gtk-menu-popup-delay=0 - #+END_SRC +#+BEGIN_SRC conf-unix + gtk-can-change-accels=1 + gtk-menu-bar-popup-delay=0 + gtk-menu-popdown-delay=0 + gtk-menu-popup-delay=0 +#+END_SRC - #+BEGIN_SRC conf-unix - gtk-xft-antialias=1 - gtk-xft-hinting=1 - gtk-xft-hintstyle=hintslight - # gtk-xft-rgba=rgb - #+END_SRC +#+BEGIN_SRC conf-unix + gtk-xft-antialias=1 + gtk-xft-hinting=1 + gtk-xft-hintstyle=hintslight + # gtk-xft-rgba=rgb +#+END_SRC - Since window decorations are handled by my WMs, I will leave this variable - empty. - #+BEGIN_SRC conf-unix - gtk-decoration-layout= - #+END_SRC +Since window decorations are handled by my WMs, I will leave this variable empty. +#+BEGIN_SRC conf-unix + gtk-decoration-layout= +#+END_SRC *** Picom (Compton) :PROPERTIES: :CUSTOM_ID: Features-Graphical_tweaks-Picom-b5b9a4dd :END: - 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]]. +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]]. *** Xresources :PROPERTIES: :HEADER-ARGS: :mkdirp yes :tangle ~/.Xresources :exports code :CUSTOM_ID: Features-Graphical_tweaks-Xresources-8b622de1 :END: - 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. - #+BEGIN_SRC conf - st.font: Fantasque Sans Mono:size=10:antialias=true - #+END_SRC - I can also set the transparency of st (my terminal emulator) like so: - #+BEGIN_SRC conf - st.alpha: 0.85 - #+END_SRC +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. +#+BEGIN_SRC conf + st.font: Fantasque Sans Mono:size=10:antialias=true +#+END_SRC - 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]]. - #+BEGIN_SRC conf - #define nord0 #2E3440 - #define nord1 #3B4252 - #define nord2 #434C5E - #define nord3 #4C566A - #define nord4 #D8DEE9 - #define nord5 #E5E9F0 - #define nord6 #ECEFF4 - #define nord7 #8FBCBB - #define nord8 #88C0D0 - #define nord9 #81A1C1 - #define nord10 #5E81AC - #define nord11 #BF616A - #define nord12 #D08770 - #define nord13 #EBCB8B - #define nord14 #A3BE8C - #define nord15 #B48EAD +I can also set the transparency of st (my terminal emulator) like so: +#+BEGIN_SRC conf + st.alpha: 0.85 +#+END_SRC - ,*.foreground: nord4 - ,*.background: nord0 - ,*.cursorColor: nord4 - ,*fading: 35 - ,*fadeColor: nord3 +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]]. +#+BEGIN_SRC conf + #define nord0 #2E3440 + #define nord1 #3B4252 + #define nord2 #434C5E + #define nord3 #4C566A + #define nord4 #D8DEE9 + #define nord5 #E5E9F0 + #define nord6 #ECEFF4 + #define nord7 #8FBCBB + #define nord8 #88C0D0 + #define nord9 #81A1C1 + #define nord10 #5E81AC + #define nord11 #BF616A + #define nord12 #D08770 + #define nord13 #EBCB8B + #define nord14 #A3BE8C + #define nord15 #B48EAD - ,*.color0: nord1 - ,*.color1: nord11 - ,*.color2: nord14 - ,*.color3: nord13 - ,*.color4: nord9 - ,*.color5: nord15 - ,*.color6: nord8 - ,*.color7: nord5 - ,*.color8: nord3 - ,*.color9: nord11 - ,*.color10: nord14 - ,*.color11: nord13 - ,*.color12: nord9 - ,*.color13: nord15 - ,*.color14: nord7 - ,*.color15: nord6 - #+END_SRC + ,*.foreground: nord4 + ,*.background: nord0 + ,*.cursorColor: nord4 + ,*fading: 35 + ,*fadeColor: nord3 + + ,*.color0: nord1 + ,*.color1: nord11 + ,*.color2: nord14 + ,*.color3: nord13 + ,*.color4: nord9 + ,*.color5: nord15 + ,*.color6: nord8 + ,*.color7: nord5 + ,*.color8: nord3 + ,*.color9: nord11 + ,*.color10: nord14 + ,*.color11: nord13 + ,*.color12: nord9 + ,*.color13: nord15 + ,*.color14: nord7 + ,*.color15: nord6 +#+END_SRC ** Text and source code editing :PROPERTIES: @@ -328,47 +288,36 @@ :PROPERTIES: :CUSTOM_ID: Features-Text_and_source_code_editing-Emacs_configuration-ef937102 :END: - Emacs is my main text editor, which I use for almost everything. Because, - you know… - #+begin_quote - Emacs is a great operating system, it just lacks a good text editor. - #+end_quote +Emacs is my main text editor, which I use for almost everything. Because, you know… +#+begin_quote +Emacs is a great operating system, it just lacks a good text editor. +#+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 - my user configuration in my [[file:emacs.org][emacs.org]] file. +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. *** Nano (deprecated) :PROPERTIES: :CUSTOM_ID: Features-Text_and_source_code_editing-Nano-a9d4839f :END: - 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. +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. *** Rustfmt :PROPERTIES: :CUSTOM_ID: Features-Text_and_source_code_editing-Rustfmt-2c4ac0b3 :END: - You can find my Rustfmt configuration [[file:rustfmt.org][here]]. +You can find my Rustfmt configuration [[file:rustfmt.org][here]]. ** Custom scripts in =PATH= :PROPERTIES: :CUSTOM_ID: Features-Custom_scripts_in_=PATH=-043e8c8e :END: - 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. +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. ** Fish configuration with useful abbreviations :PROPERTIES: :CUSTOM_ID: Features-Fish_configuration_with_useful_abbreviations-c71ffba0 :END: - 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. +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. ** And some minor configuration files :PROPERTIES: @@ -379,85 +328,69 @@ :HEADER-ARGS: :mkdirp yes :tangle ~/.signature :CUSTOM_ID: Features-And_some_minor_configuration_files-Email_signature-8c5f2218 :END: - This file gets inserted automatically at the end of my emails. - #+BEGIN_SRC text - Lucien “Phundrak” Cartier-Tilet - Étudiant en Master Informatique, Tuteur, Université Paris 8 - https://phundrak.com (Français) - https://phundrak.com/en (English) +This file gets inserted automatically at the end of my emails. +#+BEGIN_SRC text + Lucien “Phundrak” Cartier-Tilet + Étudiant en Master Informatique, Tuteur, Université Paris 8 + https://phundrak.com (Français) + https://phundrak.com/en (English) - Sent from GNU/Emacs - #+END_SRC + Sent from GNU/Emacs +#+END_SRC *** Global gitignore :PROPERTIES: :HEADER-ARGS: :mkdirp yes :tangle ~/.gitignore_global :CUSTOM_ID: Features-And_some_minor_configuration_files-Global_gitignore-42467108 :END: - 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 don’t want - nano’s backup files. - #+BEGIN_SRC text - ~* - #+END_SRC +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 don’t want nano’s backup files. +#+BEGIN_SRC text + ~* +#+END_SRC - And object files and output binaries generated by =gcc= and the likes aren’t - welcome either. - #+BEGIN_SRC text - ,*.out - ,*.o - #+END_SRC +And object files and output binaries generated by =gcc= and the likes aren’t welcome either. +#+BEGIN_SRC text + ,*.out + ,*.o +#+END_SRC ** Tmux configuration :PROPERTIES: :CUSTOM_ID: Features-Tmux_configuration-ce76e030 :END: - 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]]. +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]]. * Dependencies :PROPERTIES: :CUSTOM_ID: Dependencies-ef5057dd :END: - 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: - - [[https://www.gnu.org/software/emacs/][GNU/Emacs]] >= 26.2 - - [[http://spacemacs.org][Spacemacs]] (develop branch) - - 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]] - - 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://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://github.com/enkore/j4-dmenu-desktop][j4-dmenu-desktop]] - - [[https://github.com/davatorium/rofi][Rofi]] - - [[https://github.com/gpoore/minted][minted]] - - [[https://www.rust-lang.org/][Rust]] (stable and nightly) - - [[https://www.latex-project.org/][LaTeX]] and [[http://xetex.sourceforge.net/][XeTeX]] (=texlive= packages on Arch Linux) - - [[https://github.com/tmux/tmux][tmux]], based on [[https://github.com/gpakosz/.tmux][this repo]]’s configuration by [[https://pempek.net/][Grégory Pakosz]]. - - And a bunch of other stuff, see below - And some other stuff scattered around in my dotfiles. +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: +- [[https://www.gnu.org/software/emacs/][GNU/Emacs]] >= 26.2 + - [[http://spacemacs.org][Spacemacs]] (develop branch) + - 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]] +- 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://tools.suckless.org/dmenu/][dmenu]] +- [[https://github.com/enkore/j4-dmenu-desktop][j4-dmenu-desktop]] +- [[https://github.com/davatorium/rofi][Rofi]] +- [[https://github.com/gpoore/minted][minted]] +- [[https://www.rust-lang.org/][Rust]] (stable and nightly) +- [[https://www.latex-project.org/][LaTeX]] and [[http://xetex.sourceforge.net/][XeTeX]] (=texlive= packages on Arch Linux) +- [[https://github.com/tmux/tmux][tmux]], based on [[https://github.com/gpakosz/.tmux][this repo]]’s configuration by [[https://pempek.net/][Grégory Pakosz]]. +- And a bunch of other stuff, see below +And some other stuff scattered around in my dotfiles. - BTW, I use Arch. +BTW, I use Arch. * Installation :PROPERTIES: :CUSTOM_ID: Installation-9ec2ae86 :END: - 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. +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. * Licence :PROPERTIES: :CUSTOM_ID: Licence-48911096 :END: - 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, it’s your - own responsibility. +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, it’s your own responsibility. diff --git a/org/config/installation.org b/org/config/installation.org index 6ad1413..86cc78f 100644 --- a/org/config/installation.org +++ b/org/config/installation.org @@ -13,421 +13,371 @@ :PROPERTIES: :CUSTOM_ID: Introduction-cd5792cd :END: - 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 computer’s and my travelling laptop’s configuration. +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 computer’s and my travelling laptop’s configuration. * Install Arch Linux :PROPERTIES: :CUSTOM_ID: Install_Arch_Linux-ac7ad3b2 :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 - install easily the distro (I’ve done it so many times, I know how it works - now). Usually, my distros will be installed on two partitions: ~/home~ and ~/~ - (root). +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 (I’ve 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 - ~/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. +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. - 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 won’t be able to use - this command. +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 won’t be able to use this command. For instance, my current computer has 32GB of RAM, hence my SWAP partition is 16GB large. ** Get the latest, fastest mirrors :PROPERTIES: :CUSTOM_ID: Install_Arch_Linux-Get_the_latest_fastest_mirrors-765401c9 :END: - When you boot into the live ISO, execute the following command: - #+BEGIN_SRC sh - pacman -Sy reflector - reflector -c FR -c DE -c BE -l 200 -p http -p https --sort rate \ - --save /etc/pacman.d/mirrorlist --verbose - #+END_SRC +When you boot into the live ISO, execute the following command: +#+BEGIN_SRC sh + pacman -Sy reflector + reflector -c FR -c DE -c BE -l 200 -p http -p https --sort rate \ + --save /etc/pacman.d/mirrorlist --verbose +#+END_SRC - 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. +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. ** Install the system :PROPERTIES: :CUSTOM_ID: Install_Arch_Linux-Install_the_system-3ff49aa6 :END: - Then you can use a custom script to ease your installation of Arch if you do - not wish to do it manually. Personally, I’ve done it several times already, I - know how the distro works, I just want to be able to install my distro - quickly now. I’ll need to download the script with ~wget~, but apparently it - isn’t installed by default on Arch ISOs anymore, so I’ll need to install it. - #+BEGIN_SRC sh - pacman -S wget - #+END_SRC +Then you can use a custom script to ease your installation of Arch if you do not wish to do it manually. Personally, I’ve done it several times already, I know how the distro works, I just want to be able to install my distro quickly now. I’ll need to download the script with ~wget~, but apparently it isn’t installed by default on Arch ISOs anymore, so I’ll need to install it. +#+BEGIN_SRC sh + pacman -S wget +#+END_SRC - Now, let’s grab the script. You can check it on [[https://github.com/matmoul/archfi][Github]]. - #+BEGIN_SRC sh - wget archfi.sf.net/archfi - # Or from matmoul.github.io/archfi if SourceForge is down - sh archfi - #+END_SRC +Now, let’s grab the script. You can check it on [[https://github.com/matmoul/archfi][Github]]. +#+BEGIN_SRC sh + wget archfi.sf.net/archfi + # Or from matmoul.github.io/archfi if SourceForge is down + sh archfi +#+END_SRC - 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. +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. - Once your system is installed, reboot and remove your installation media from - your computer. +Once your system is installed, reboot and remove your installation media from your computer. * Execute bootstrap :PROPERTIES: :HEADER-ARGS:fish: :tangle ~/.config/yadm/bootstrap :shebang "#!/usr/bin/fish" :exports code :mkdirp yes :CUSTOM_ID: Execute_bootstrap-e37054ef :END: - 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, let’s install ~fish~ (our shell - running the script), ~git~, and my dotfiles manager ~yadm~. - #+BEGIN_SRC sh - yay -Sy fish git yadm - #+END_SRC +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, let’s install ~fish~ (our shell running the script), ~git~, and my dotfiles manager ~yadm~. +#+BEGIN_SRC sh + yay -Sy fish git yadm +#+END_SRC - ~yadm~ comes with a very handy feature: its bootstrap script. It can be - executed automatically once the dotfiles are cloned with yadm: - #+BEGIN_SRC sh - yadm clone https://labs.phundrak.com/phundrak/dotfiles - # or if labs.phundrak.com is down or too slow for you - #yadm clone https://github.com/phundrak/dotfiles - #+END_SRC +~yadm~ comes with a very handy feature: its bootstrap script. It can be executed automatically once the dotfiles are cloned with yadm: +#+BEGIN_SRC sh + yadm clone https://labs.phundrak.com/phundrak/dotfiles + # or if labs.phundrak.com is down or too slow for you + #yadm clone https://github.com/phundrak/dotfiles +#+END_SRC - Let’s take a look at what it does. +Let’s take a look at what it does. ** Decrypt private yadm files :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Decrypt_private_yadm_files-68af7157 :END: - Some private files are stored encrypted in the repository of my yadm - dotfiles. I will need them later on during the bootstrap execution. - #+BEGIN_SRC fish - if test "$USER" = 'phundrak' - yadm decrypt - else - whiptail --yesno "Decrypt private files?" 8 40 && yadm decrypt - end - #+END_SRC +Some private files are stored encrypted in the repository of my yadm dotfiles. I will need them later on during the bootstrap execution. +#+BEGIN_SRC fish + if test "$USER" = 'phundrak' + yadm decrypt + else + whiptail --yesno "Decrypt private files?" 8 40 && yadm decrypt + end +#+END_SRC ** Get a correct keyboard layout :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Get_a_correct_keyboard_layout-77d24b30 :END: - 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: - #+BEGIN_SRC fish - set keyboardconf \ - 'Section "InputClass" - Identifier "system-keyboard" - MatchIsKeyboard "on" - Option "XkbLayout" "fr" - Option "XkbModel" "pc104" - Option "XkbVariant" "bepo_afnor" - Option "XkbOptions" "caps:ctrl_modifier" - EndSection' - #+END_SRC +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: +#+BEGIN_SRC fish + set keyboardconf \ + 'Section "InputClass" + Identifier "system-keyboard" + MatchIsKeyboard "on" + Option "XkbLayout" "fr" + Option "XkbModel" "pc104" + Option "XkbVariant" "bepo_afnor" + Option "XkbOptions" "caps:ctrl_modifier" + EndSection' +#+END_SRC - So, let’s ask the user if they want to set it as their keyboard - configuration. - #+BEGIN_SRC fish - printf "\n# Set keyboard layout #########################################################\n\n" - whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55 - if test $status -eq 0 - echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf - end - #+END_SRC +So, let’s ask the user if they want to set it as their keyboard configuration. +#+BEGIN_SRC fish + printf "\n# Set keyboard layout #########################################################\n\n" + whiptail --yesno "Would you like to set your keyboard layout to the bépo layout?" 8 55 + if test $status -eq 0 + echo $keyboardconf | sudo tee /etc/X11/xorg.conf.d/00-keyboard.conf + end +#+END_SRC ** Set our locale :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_our_locale-e74d772a :END: - I use two main locales, the French and US UTF-8 locales, and I like to keep - the Japanese locale activated just in case. - #+BEGIN_SRC fish - set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8" - #+END_SRC +I use two main locales, the French and US UTF-8 locales, and I like to keep the Japanese locale activated just in case. +#+BEGIN_SRC fish + set mylocales "en_US.UTF-8 UTF-8" "fr_FR.UTF-8 UTF-8" "ja_JP.UTF-8 UTF-8" +#+END_SRC - I’ll let the user accept them one by one. - #+BEGIN_SRC fish - printf "\n# Set locale ##################################################################\n\n" +I’ll let the user accept them one by one. +#+BEGIN_SRC fish + printf "\n# Set locale ##################################################################\n\n" - for item in $mylocales - whiptail --yesno "Set the \"$item\" locale?" 8 40 - if test $status -eq 0 -a (grep -e "#$item" /etc/locale.gen) - sudo sed -i "/$item/s/^#//g" /etc/locale.gen - end - end - #+END_SRC + for item in $mylocales + whiptail --yesno "Set the \"$item\" locale?" 8 40 + if test $status -eq 0 -a (grep -e "#$item" /etc/locale.gen) + sudo sed -i "/$item/s/^#//g" /etc/locale.gen + end + end +#+END_SRC - This is my configuration I usually use when it comes to my locale. - #+BEGIN_SRC fish - set localeconf "LANG=en_US.UTF-8 - LC_COLLATE=C - LC_NAME=fr_FR.UTF-8 - LC_NUMERIC=fr_FR.UTF-8 - LC_IDENTIFICATION=fr_FR.UTF-8 - LC_TELEPHONE=fr_FR.UTF-8 - LC_MONETARY=fr_FR.UTF-8 - LC_PAPER=fr_FR.UTF-8 - LC_ADDRESS=fr_FR.UTF-8 - LC_TIME=fr_FR.UTF-8 - LC_MEASUREMENT=fr_FR.UTF-8" - #+END_SRC +This is my configuration I usually use when it comes to my locale. +#+BEGIN_SRC fish + set localeconf "LANG=en_US.UTF-8 + LC_COLLATE=C + LC_NAME=fr_FR.UTF-8 + LC_NUMERIC=fr_FR.UTF-8 + LC_IDENTIFICATION=fr_FR.UTF-8 + LC_TELEPHONE=fr_FR.UTF-8 + LC_MONETARY=fr_FR.UTF-8 + LC_PAPER=fr_FR.UTF-8 + LC_ADDRESS=fr_FR.UTF-8 + LC_TIME=fr_FR.UTF-8 + LC_MEASUREMENT=fr_FR.UTF-8" +#+END_SRC - Let’s set it as our system’s locale if the user whishes to. - #+BEGIN_SRC fish - whiptail --yesno "Do you agree to have the following locale set?\n\n $localeconf" 20 43 - if test $status -eq 0 - echo $localeconf | sudo tee /etc/locale.conf - end - #+END_SRC +Let’s set it as our system’s locale if the user whishes to. +#+BEGIN_SRC fish + whiptail --yesno "Do you agree to have the following locale set?\n\n $localeconf" 20 43 + if test $status -eq 0 + echo $localeconf | sudo tee /etc/locale.conf + end +#+END_SRC - Now we can generate our locale! - #+BEGIN_SRC fish - printf "\n# Generate locale #############################################################\n\n" - sudo locale-gen - #+END_SRC +Now we can generate our locale! +#+BEGIN_SRC fish + printf "\n# Generate locale #############################################################\n\n" + sudo locale-gen +#+END_SRC ** Create some folders :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Create_some_folders-bf701387 :END: - Let’s create some folders we might need for mounting our drives, Android - devices and CDs. - #+BEGIN_SRC fish - printf "\n# Create directories for mounting #############################################\n\n" - sudo mkdir -p /mnt/{USB,CD,Android} - sudo chown $USER:(id -g $USER) /mnt/{USB,CD,Android} - #+END_SRC +Let’s create some folders we might need for mounting our drives, Android devices and CDs. +#+BEGIN_SRC fish + printf "\n# Create directories for mounting #############################################\n\n" + sudo mkdir -p /mnt/{USB,CD,Android} + sudo chown $USER:(id -g $USER) /mnt/{USB,CD,Android} +#+END_SRC ** Set user’s shell to fish :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_user’s_shell_to_fish-1a794be2 :END: - First of all, the bootstrap shell will set the user’s shell to fish. - #+BEGIN_SRC fish - printf "\n# Set fish as the default shell ###############################################\n\n" - whiptail --yesno "Set the current user’s default shell to fish?" 8 50 - if test $status -eq 0 -a ! "$SHELL" = '/usr/bin/fish' - chsh -s /usr/bin/fish - end - #+END_SRC +First of all, the bootstrap shell will set the user’s shell to fish. +#+BEGIN_SRC fish + printf "\n# Set fish as the default shell ###############################################\n\n" + whiptail --yesno "Set the current user’s default shell to fish?" 8 50 + if test $status -eq 0 -a ! "$SHELL" = '/usr/bin/fish' + chsh -s /usr/bin/fish + end +#+END_SRC ** Install basic packages :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_basic_packages-17173316 :END: - Let’s set in a custom varible what packages we’ll be needing. - #+BEGIN_SRC fish - set PACKAGES \ - acpilight adobe-source-han-sans-jp-fonts arc-gtk-theme asar ascii aspell-en \ - aspell-fr awesome awesome-terminal-fonts awesome-freedesktop-git base-devel \ - bashtop bat biber bitwarden-bin bluez-firmware bluez-utils bookworm bzip2 \ - chicken chromium clisp corrupter-git cppcheck cppreference \ - cppreference-devhelp cpupower discord-canary discount docker docker-compose \ - dockerfile-language-server-bin doxygen emacs emacs-org-mode exa exfat-utils \ - farbfeld fd ffmpegthumbnailer findutils firefox flake8 flat-remix-gtk freeglut \ - fzf gcc-libs gdb gimp gnome-disk-utility gnome-epub-thumbnailer gnu-free-fonts \ - gnuplot go go-tools golangci-lint-bin graphviz htop i3lock-color inetutils \ - isync inter-font javascript-typescript-langserver js-beautify jfsutils jmtpfs \ - lain-git libxft-bgra linux-headers lldb logrotate ly meson minted man-db \ - man-pages mpc mpd mpd-rich-presence-discord-git mpv mupdf-tools nano ncdu \ - ncmpcpp nemo-fileroller nemo-preview neofetch netctl network-manager-applet \ - networkmanager networkmanager-openvpn nitrogen nm-connection-editor nodejs-vmd \ - nomacs nordic-theme-git nordvpn-bin noto-fonts-emoji npm ntfs-3g numlockx \ - obs-studio openssh otf-fandol otf-ipafont p7zip pacman-contrib pandoc-bin pass \ - pavucontrol pdfpc picom-ibhagwan-git powerline-fonts prettier \ - pulseaudio-bluetooth python-autoflake python-epc python-importmagic \ - python-language-server python-nose python-pip python-poetry python-ptvsd \ - python-pytest qt5-imageformats qemu r raw-thumbnailer reflector ripgrep rofi \ - rsync rtv ruby-rb-fsevent ruby-sass rustup samba scrot sent shadow siji-git \ - simplescreenrecorder sshfs st-luke-git sxiv texlive-bin texlive-langchinese \ - texlive-langcyrillic texlive-langgreek texlive-langjapanese texlive-langkorean \ - texlive-latexextra texlive-localmanager-git texlive-most tmux tree \ - ttf-arphic-uming ttf-baekmuk ttf-charis-sil ttf-dejavu \ - ttf-google-fonts-opinionated-git ttf-hanazono ttf-joypixels ttf-koruri \ - ttf-liberation ttf-monapo ttf-sazanami ttf-tibetan-machine typescript \ - typescript-language-server-bin unicode-emoji unrar usbutils valgrind \ - vscode-css-languageserver-bin vscode-html-languageserver-bin w3m wget \ - x11-ssh-askpass xclip xdg-user-dirs-gtk xfce-polkit xidlehook xfsprogs \ - xorg-drivers xorg-server xorg-xinit xss-lock xvkbd yaml-language-server-bin \ - zeal - #+END_SRC +Let’s set in a custom varible what packages we’ll be needing. +#+BEGIN_SRC fish + set PACKAGES \ + acpilight adobe-source-han-sans-jp-fonts arc-gtk-theme asar ascii aspell-en \ + aspell-fr awesome awesome-terminal-fonts awesome-freedesktop-git base-devel \ + bashtop bat biber bitwarden-bin bluez-firmware bluez-utils bookworm bzip2 \ + chicken chromium clisp corrupter-git cppcheck cppreference \ + cppreference-devhelp cpupower discord-canary discount docker docker-compose \ + dockerfile-language-server-bin doxygen emacs emacs-org-mode exa exfat-utils \ + farbfeld fd ffmpegthumbnailer findutils firefox flake8 flat-remix-gtk freeglut \ + fzf gcc-libs gdb gimp gnome-disk-utility gnome-epub-thumbnailer gnu-free-fonts \ + gnuplot go go-tools golangci-lint-bin graphviz htop i3lock-color inetutils \ + isync inter-font javascript-typescript-langserver js-beautify jfsutils jmtpfs \ + lain-git libxft-bgra linux-headers lldb logrotate ly meson minted man-db \ + man-pages mpc mpd mpd-rich-presence-discord-git mpv mupdf-tools nano ncdu \ + ncmpcpp nemo-fileroller nemo-preview neofetch netctl network-manager-applet \ + networkmanager networkmanager-openvpn nitrogen nm-connection-editor nodejs-vmd \ + nomacs nordic-theme-git nordvpn-bin noto-fonts-emoji npm ntfs-3g numlockx \ + obs-studio openssh otf-fandol otf-ipafont p7zip pacman-contrib pandoc-bin pass \ + pavucontrol pdfpc picom-ibhagwan-git powerline-fonts prettier \ + pulseaudio-bluetooth python-autoflake python-epc python-importmagic \ + python-language-server python-nose python-pip python-poetry python-ptvsd \ + python-pytest qt5-imageformats qemu r raw-thumbnailer reflector ripgrep rofi \ + rsync rtv ruby-rb-fsevent ruby-sass rustup samba scrot sent shadow siji-git \ + simplescreenrecorder sshfs st-luke-git sxiv texlive-bin texlive-langchinese \ + texlive-langcyrillic texlive-langgreek texlive-langjapanese texlive-langkorean \ + texlive-latexextra texlive-localmanager-git texlive-most tmux tree \ + ttf-arphic-uming ttf-baekmuk ttf-charis-sil ttf-dejavu \ + ttf-google-fonts-opinionated-git ttf-hanazono ttf-joypixels ttf-koruri \ + ttf-liberation ttf-monapo ttf-sazanami ttf-tibetan-machine typescript \ + typescript-language-server-bin unicode-emoji unrar usbutils valgrind \ + vscode-css-languageserver-bin vscode-html-languageserver-bin w3m wget \ + x11-ssh-askpass xclip xdg-user-dirs-gtk xfce-polkit xidlehook xfsprogs \ + xorg-drivers xorg-server xorg-xinit xss-lock xvkbd yaml-language-server-bin \ + zeal +#+END_SRC - These are the minimum I would have in my own installation. You can edit it - however you want. Let’s install those. - #+BEGIN_SRC fish - printf "\n# Installing needed packages ##################################################\n\n" - sudo pacman -Syu - for pkg in $PACKAGES - yay -S --needed $pkg - end - #+END_SRC +These are the minimum I would have in my own installation. You can edit it however you want. Let’s install those. +#+BEGIN_SRC fish + printf "\n# Installing needed packages ##################################################\n\n" + sudo pacman -Syu + for pkg in $PACKAGES + yay -S --needed $pkg + end +#+END_SRC ** Tangle configuration files from Org files :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Tangle_configuration_files_from_Org_files-cc524361 :END: - Before tangling our configuration files, we need to create some directories - first so our files can be properly tangled. Here’s the list of directories we - need to create: - #+NAME: dirs-tangled-files - | $HOME/.config/awesome | - | $HOME/.config/awesome/theme | - | $HOME/.config/emacs/private | - | $HOME/.config/fish | - | $HOME/.config/gtk-2.0 | - | $HOME/.config/gtk-3.0 | - | $HOME/.config/ncmpcpp | - | $HOME/.config/neofetch | - | $HOME/.config/picom | - | $HOME/.config/yadm | - | $HOME/.local/bin | - | $HOME/org/capture | +Before tangling our configuration files, we need to create some directories first so our files can be properly tangled. Here’s the list of directories we need to create: +#+NAME: dirs-tangled-files +| $HOME/.config/awesome | +| $HOME/.config/awesome/theme | +| $HOME/.config/emacs/private | +| $HOME/.config/fish | +| $HOME/.config/gtk-2.0 | +| $HOME/.config/gtk-3.0 | +| $HOME/.config/ncmpcpp | +| $HOME/.config/neofetch | +| $HOME/.config/picom | +| $HOME/.config/yadm | +| $HOME/.local/bin | +| $HOME/org/capture | - #+NAME: gen-dirs-tangle - #+BEGIN_SRC emacs-lisp :var dirs=dirs-tangled-files - (mapconcat (lambda (x) (format "mkdir -p %s" (car x))) - dirs - "\n") - #+END_SRC +#+NAME: gen-dirs-tangle +#+BEGIN_SRC emacs-lisp :var dirs=dirs-tangled-files + (mapconcat (lambda (x) (format "mkdir -p %s" (car x))) + dirs + "\n") +#+END_SRC - #+RESULTS[a95e25a5f3ac91b1f884b39dde38e3b51366b188]: gen-dirs-tangle - #+begin_example - mkdir -p $HOME/.config/awesome - mkdir -p $HOME/.config/awesome/theme - mkdir -p $HOME/.config/emacs/private - mkdir -p $HOME/.config/fish - mkdir -p $HOME/.config/gtk-2.0 - mkdir -p $HOME/.config/gtk-3.0 - mkdir -p $HOME/.config/ncmpcpp - mkdir -p $HOME/.config/neofetch - mkdir -p $HOME/.config/picom - mkdir -p $HOME/.config/yadm - mkdir -p $HOME/.local/bin - mkdir -p $HOME/org/capture - #+end_example +#+RESULTS[a95e25a5f3ac91b1f884b39dde38e3b51366b188]: gen-dirs-tangle +#+begin_example +mkdir -p $HOME/.config/awesome +mkdir -p $HOME/.config/awesome/theme +mkdir -p $HOME/.config/emacs/private +mkdir -p $HOME/.config/fish +mkdir -p $HOME/.config/gtk-2.0 +mkdir -p $HOME/.config/gtk-3.0 +mkdir -p $HOME/.config/ncmpcpp +mkdir -p $HOME/.config/neofetch +mkdir -p $HOME/.config/picom +mkdir -p $HOME/.config/yadm +mkdir -p $HOME/.local/bin +mkdir -p $HOME/org/capture +#+end_example - Our code to generate such directories looks like this: - #+BEGIN_SRC fish :noweb yes - <> - #+END_SRC +Our code to generate such directories looks like this: +#+BEGIN_SRC fish :noweb yes + <> +#+END_SRC - The next step is to tangle all the Org files. Here is the list of files that - are to be tangled: - #+NAME: tangled-files - | filename | - |-------------| - | awesome.org | - | bin.org | - | emacs.org | - | fish.org | - | index.org | - | picom.org | - | rustfmt.org | - | tmux.org | +The next step is to tangle all the Org files. Here is the list of files that are to be tangled: +#+NAME: tangled-files +| filename | +|-------------| +| awesome.org | +| bin.org | +| emacs.org | +| fish.org | +| index.org | +| picom.org | +| rustfmt.org | +| tmux.org | - #+NAME: generate-tangle - #+BEGIN_SRC emacs-lisp :var files=tangled-files[,0] - (mapconcat (lambda (x) (concat - (format "printf '\\n\\n==== Tangling %s\\n\\n' && \\\n" x) - (concat "emacs -q --batch --eval '(require \\'ob-tangle)' \\\n" - "--eval '(setq org-confirm-babel-evaluate nil)' \\\n" - (format "--eval '(org-babel-tangle-file \"~/org/config/%s\")'\n" x)))) - files - "\n") - #+END_SRC +#+NAME: generate-tangle +#+BEGIN_SRC emacs-lisp :var files=tangled-files[,0] + (mapconcat (lambda (x) (concat + (format "printf '\\n\\n==== Tangling %s\\n\\n' && \\\n" x) + (concat "emacs -q --batch --eval '(require \\'ob-tangle)' \\\n" + "--eval '(setq org-confirm-babel-evaluate nil)' \\\n" + (format "--eval '(org-babel-tangle-file \"~/org/config/%s\")'\n" x)))) + files + "\n") +#+END_SRC - #+RESULTS[87a25d6c524e8d1346452c54aa42ac3ac09d94cf]: generate-tangle - #+begin_example - printf '\n\n==== Tangling awesome.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/awesome.org")' +#+RESULTS[87a25d6c524e8d1346452c54aa42ac3ac09d94cf]: generate-tangle +#+begin_example +printf '\n\n==== Tangling awesome.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/awesome.org")' - printf '\n\n==== Tangling bin.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/bin.org")' +printf '\n\n==== Tangling bin.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/bin.org")' - printf '\n\n==== Tangling emacs.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/emacs.org")' +printf '\n\n==== Tangling emacs.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/emacs.org")' - printf '\n\n==== Tangling fish.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/fish.org")' +printf '\n\n==== Tangling fish.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/fish.org")' - printf '\n\n==== Tangling index.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/index.org")' +printf '\n\n==== Tangling index.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/index.org")' - printf '\n\n==== Tangling picom.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/picom.org")' +printf '\n\n==== Tangling picom.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/picom.org")' - printf '\n\n==== Tangling rustfmt.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/rustfmt.org")' +printf '\n\n==== Tangling rustfmt.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/rustfmt.org")' - printf '\n\n==== Tangling tmux.org\n\n' && \ - emacs -q --batch --eval '(require \'ob-tangle)' \ - --eval '(setq org-confirm-babel-evaluate nil)' \ - --eval '(org-babel-tangle-file "~/org/config/tmux.org")' - #+end_example +printf '\n\n==== Tangling tmux.org\n\n' && \ +emacs -q --batch --eval '(require \'ob-tangle)' \ +--eval '(setq org-confirm-babel-evaluate nil)' \ +--eval '(org-babel-tangle-file "~/org/config/tmux.org")' +#+end_example - #+BEGIN_SRC fish :noweb yes - printf "\n# Tangling org files ##########################################################\n\n" - <> - #+END_SRC +#+BEGIN_SRC fish :noweb yes + printf "\n# Tangling org files ##########################################################\n\n" + <> +#+END_SRC ** Setting up Emacs: Installing Spacemacs :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Setting_up_Emacs:_Installing_Spacemacs-0b3d44b2 :END: - Now, the first thing we want to do with Emacs is install its Spacemacs - distribution. We’ll 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 won’t let us - clone Spacemacs in an already existing and non-empty directory. To make sure - it isn’t one, let’s delete any potentially existing =~/.config/emacs= - directory: - #+BEGIN_SRC fish - printf "\n# Installing Spacemacs ########################################################\n\n" - rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs - #+END_SRC +Now, the first thing we want to do with Emacs is install its Spacemacs distribution. We’ll 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 won’t let us clone Spacemacs in an already existing and non-empty directory. To make sure it isn’t one, let’s delete any potentially existing =~/.config/emacs= directory: +#+BEGIN_SRC fish + printf "\n# Installing Spacemacs ########################################################\n\n" + rm -rf $HOME/.config/emacs $HOME/.emacs* .spacemacs +#+END_SRC - Now we can clone Spacemacs: - #+BEGIN_SRC fish - git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs - #+END_SRC +Now we can clone Spacemacs: +#+BEGIN_SRC fish + git clone --branch develop https://github.com/syl20bnr/spacemacs ~/.config/emacs +#+END_SRC - And we can restore what might have been deleted in our =~/.emacs.d/private= - directory: - #+BEGIN_SRC fish - yadm checkout -- ~/.config/emacs/private/ - #+END_SRC +And we can restore what might have been deleted in our =~/.emacs.d/private= directory: +#+BEGIN_SRC fish + yadm checkout -- ~/.config/emacs/private/ +#+END_SRC ** Set up dotfiles’ git repository :PROPERTIES: @@ -437,208 +387,181 @@ :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_dotfiles’_remotes-5a0fe6f7 :END: - This line in the bootstrap script will test if the current user is using my - username. If yes, it’s probably me. - #+BEGIN_SRC fish - if test "$USER" = 'phundrak' - #+END_SRC +This line in the bootstrap script will test if the current user is using my username. If yes, it’s probably me. +#+BEGIN_SRC fish + if test "$USER" = 'phundrak' +#+END_SRC - 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. - #+BEGIN_SRC fish - printf "\n# Update yadm’s remotes #######################################################\n\n" - yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git - yadm remote add github git@github.com:phundrak/dotfiles.git - #+END_SRC +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. +#+BEGIN_SRC fish + printf "\n# Update yadm’s remotes #######################################################\n\n" + yadm remote set-url origin git@labs.phundrak.com:phundrak/dotfiles.git + yadm remote add github git@github.com:phundrak/dotfiles.git +#+END_SRC - I will also want to decrypt my encrypted files, such as said ssh keys. - #+BEGIN_SRC fish - printf "\n# Decrypt encrypted dotfiles ##################################################\n\n" - yadm decrypt - #+END_SRC +I will also want to decrypt my encrypted files, such as said ssh keys. +#+BEGIN_SRC fish + printf "\n# Decrypt encrypted dotfiles ##################################################\n\n" + yadm decrypt +#+END_SRC - Finally, let’s close this ~if~ statement. - #+BEGIN_SRC fish - end - #+END_SRC +Finally, let’s close this ~if~ statement. +#+BEGIN_SRC fish + end +#+END_SRC *** Update our submodules :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_dotfiles-Update_our_submodules-3e921579 :END: - Now we can download the various dependencies of our dotfiles. To do so, - let’s run the following command: - #+BEGIN_SRC fish - printf "\n# Getting yadm susbmodules ####################################################\n\n" - yadm submodule update --init --recursive - #+END_SRC +Now we can download the various dependencies of our dotfiles. To do so, let’s run the following command: +#+BEGIN_SRC fish + printf "\n# Getting yadm susbmodules ####################################################\n\n" + yadm submodule update --init --recursive +#+END_SRC ** Enable some services :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-3d38d98e :END: - We have installed some packages which require some services to run. Let’s - enable them. +We have installed some packages which require some services to run. Let’s enable them. *** Systemd-timesyncd :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Systemd-timesyncd-d887e45b :END: - This service enables time syncing with the NTP protocol, so I can be sure my - computer’s time is correct. The service first needs to be enabled: - #+BEGIN_SRC fish - printf "\n# Enabling timesync ###########################################################\n\n" - sudo systemctl enable --now systemd-timesyncd - #+END_SRC +This service enables time syncing with the NTP protocol, so I can be sure my computer’s time is correct. The service first needs to be enabled: +#+BEGIN_SRC fish + printf "\n# Enabling timesync ###########################################################\n\n" + sudo systemctl enable --now systemd-timesyncd +#+END_SRC - Now, let systemd know I want to use the NTP protocol to keep my computer’s - time synced. - #+BEGIN_SRC fish - sudo timedatectl set-ntp true - #+END_SRC +Now, let systemd know I want to use the NTP protocol to keep my computer’s time synced. +#+BEGIN_SRC fish + sudo timedatectl set-ntp true +#+END_SRC *** Docker :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Docker-305e8309 :END: - First, let’s activate Docker. - #+BEGIN_SRC fish - printf "\n# Enabling and starting Docker ################################################\n\n" - sudo systemctl enable --now docker - #+END_SRC +First, let’s activate Docker on startup. +#+BEGIN_SRC fish + printf "\n# Enabling and starting Docker ################################################\n\n" + sudo systemctl enable --now docker +#+END_SRC - Now, if we wish it, we can be added to the =docker= group so we won’t have - to type =sudo= each time we call Docker or Docker Compose. - #+BEGIN_SRC fish - 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 = '' - sudo usermod -aG docker $USER - end - #+END_SRC +Now, if we wish it, we can be added to the =docker= group so we won’t have to type =sudo= each time we call Docker or Docker Compose. +#+BEGIN_SRC fish + 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 = '' + sudo usermod -aG docker $USER + end +#+END_SRC *** Emacs :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Emacs-c7785c21 :END: - Emacs will run as a user service, which means it won’t be launched until we - log in. However, the service won’t 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 - printf "\n# Enabling Emacs as user service ##############################################\n\n" - systemctl --user enable emacs - #+END_SRC +Emacs will run as a user service, which means it won’t be launched until we log in. However, the service won’t 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 + printf "\n# Enabling Emacs as user service ##############################################\n\n" + systemctl --user enable emacs +#+END_SRC *** Mpd :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Mpd-f0f5b9b7 :END: - Mpd will also use as a user service in order to get rid of some lines of - code in my configuration. - #+BEGIN_SRC fish - printf "\n# Enabling Mpd as a user service ##############################################\n\n" - mkdir -p ~/.config/mpd/playlists - systemctl --user enable --now mpd - #+END_SRC +Mpd will also use as a user service in order to get rid of some lines of code in my configuration. +#+BEGIN_SRC fish + printf "\n# Enabling Mpd as a user service ##############################################\n\n" + mkdir -p ~/.config/mpd/playlists + systemctl --user enable --now mpd +#+END_SRC *** SSH server :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-SSH_server-204f5997 :END: - Maybe we want to activate an SSH server on our machine. If so, we can enable - it. Let’s ask the question. - #+BEGIN_SRC fish - whiptail --yesno 'Do you want to activate the ssh server?' 8 50 - if test $status -eq 0 - printf "\n# Enabling ssh server #########################################################\n\n" - sudo systemctl enable --now sshd - end - #+END_SRC +Maybe we want to activate an SSH server on our machine. If so, we can enable it. Let’s ask the question. +#+BEGIN_SRC fish + whiptail --yesno 'Do you want to activate the ssh server?' 8 50 + if test $status -eq 0 + printf "\n# Enabling ssh server #########################################################\n\n" + sudo systemctl enable --now sshd + end +#+END_SRC *** Ly :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Ly-f4b161c0 :END: - Ly is a display manager based on ncurses which I find nice enough for me to - use (I generally don’t like using display managers). Let’s enable it, and - let’s disable tty2 while we’re at it (Ly uses it to run X). - #+BEGIN_SRC fish - sudo systemctl disable getty@tty2 - sudo systemctl enable --now ly - #+END_SRC +Ly is a display manager based on ncurses which I find nice enough for me to use (I generally don’t like using display managers). Let’s enable it, and let’s disable tty2 while we’re at it (Ly uses it to run X). +#+BEGIN_SRC fish + sudo systemctl disable getty@tty2 + sudo systemctl enable --now ly +#+END_SRC *** Acpilight :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-Acpilight-39152794 :END: - ~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~. - #+BEGIN_SRC fish - sudo usermod -aG video $USER - #+END_SRC +~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~. +#+BEGIN_SRC fish + sudo usermod -aG video $USER +#+END_SRC *** NordVPN :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Enable_some_services-NordVPN-75c1bd88 :END: - 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: - #+BEGIN_SRC fish - sudo systemctl enable --now nordvpnd - #+END_SRC +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: +#+BEGIN_SRC fish + sudo systemctl enable --now nordvpnd +#+END_SRC - Let’s 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. - #+BEGIN_SRC fish - nordvpn s protocol udp - #+END_SRC +Let’s 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. +#+BEGIN_SRC fish + nordvpn s protocol tcp +#+END_SRC ** Symlink some system config files :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Symlink_some_system_config_files-1dd95175 :END: - We have some files in [[file:ect/][etc/]] that are to be symlinked to =/etc=. - #+BEGIN_SRC fish - for f in (find ~/.etc -type f) - set dest (echo $f | sed -n 's|^.*etc\(.*\)$|/etc\1|p') - sudo ln -s $f $dest - end - #+END_SRC - - Let’s also symlink the ~plock~ script ([[file:bin.org::#Lock-635fcb38][source here]]) to ~/usr/bin~ so - ~xss-lock~ can find it. - #+BEGIN_SRC fish - sudo ln -s (which plock) /usr/bin/plock - #+END_SRC +We have some files in [[file:ect/][etc/]] that are to be symlinked to =/etc=. +#+BEGIN_SRC fish + for f in (find ~/.etc -type f) + set dest (echo $f | sed -n 's|^.*etc\(.*\)$|/etc\1|p') + sudo ln -s $f $dest + end +#+END_SRC +Let’s also symlink the ~plock~ script ([[file:bin.org::#Lock-635fcb38][source here]]) to ~/usr/bin~ so ~xss-lock~ can find it. +#+BEGIN_SRC fish + sudo ln -s (which plock) /usr/bin/plock +#+END_SRC ** Install packages from git :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-7c6a6ea4 :END: - Now, let’s install some packages from git directly. - #+BEGIN_SRC fish - mkdir -p ~/fromGIT - #+END_SRC +Now, let’s install some packages from git directly. +#+BEGIN_SRC fish + mkdir -p ~/fromGIT +#+END_SRC *** Reveal.JS :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_packages_from_git-Reveal.JS-bb4da0bf :END: - I sometimes use Reveal.JS to make presentations, and I set its location in - my [[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so let’s clone it there. - #+BEGIN_SRC fish - printf "\n# Install Reveal.JS ###########################################################\n\n" - cd ~/fromGIT - git clone https://github.com/hakimel/reveal.js.git - #+END_SRC +I sometimes use Reveal.JS to make presentations, and I set its location in my [[file:.spacemacs][dotspacemacs]] file to be in =~/fromGIT=, so let’s clone it there. +#+BEGIN_SRC fish + printf "\n# Install Reveal.JS ###########################################################\n\n" + cd ~/fromGIT + git clone https://github.com/hakimel/reveal.js.git +#+END_SRC ** Install Rust :PROPERTIES: @@ -648,157 +571,148 @@ :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_the_toolchains-3480764a :END: - 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. - #+BEGIN_SRC fish - printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n" - rustup default stable - #+END_SRC +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. +#+BEGIN_SRC fish + printf "\n# Install the rust toolchains, nightly is the default one #####################\n\n" + rustup default stable +#+END_SRC - This will both download the stable toolchain and set it as the default one. - Now to install the nightly toolchain, let’s run this: - #+BEGIN_SRC fish - rustup toolchain install nightly - #+END_SRC +This will both download the stable toolchain and set it as the default one. Now to install the nightly toolchain, let’s run this: +#+BEGIN_SRC fish + rustup toolchain install nightly +#+END_SRC *** Install some utilities :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_Rust-Install_some_utilities-c4a7c785 :END: - We’ll need some utilities when developing Rust from Emacs, namely ~rustfmt~ - and ~racer~. Let’s install them with ~cargo~. - #+BEGIN_SRC fish - printf "\n# Add rust utilities ##########################################################\n\n" - cargo install rustfmt racer - #+END_SRC +We’ll need some utilities when developing Rust from Emacs, namely ~rustfmt~ and ~racer~. Let’s install them with ~cargo~. +#+BEGIN_SRC fish + printf "\n# Add rust utilities ##########################################################\n\n" + cargo install rustfmt racer +#+END_SRC - We will also need some components for development purposes. - #+NAME: rust-components-table - | Component | Why | - |-----------+---------------------------------------------| - | rust-src | Rust documentation in Emacs | - | rls | LSP backend for Emacs | - | clippy | A better version of cargo’s ~check~ command | +We will also need some components for development purposes. +#+NAME: rust-components-table +| Component | Why | +|-----------+---------------------------------------------| +| rust-src | Rust documentation in Emacs | +| rls | LSP backend for Emacs | +| clippy | A better version of cargo’s ~check~ command | - #+NAME: rust-components-gen - #+BEGIN_SRC emacs-lisp :var components=rust-components-table[,0] - (mapconcat (lambda (x) (format "rustup component add %s" x)) - components - "\n") - #+END_SRC +#+NAME: rust-components-gen +#+BEGIN_SRC emacs-lisp :var components=rust-components-table[,0] + (mapconcat (lambda (x) (format "rustup component add %s" x)) + components + "\n") +#+END_SRC - #+RESULTS[b3935b1c09d86fe506b43670f52960306a1e9809]: - : rustup component add rust-src - : rustup component add rls - : rustup component add clippy +#+RESULTS[b3935b1c09d86fe506b43670f52960306a1e9809]: +: rustup component add rust-src +: rustup component add rls +: rustup component add clippy - Here is the code to do so: - #+BEGIN_SRC fish :noweb yes - <> - #+END_SRC +Here is the code to do so: +#+BEGIN_SRC fish :noweb yes + <> +#+END_SRC ** Install some python packages :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Install_some_python_packages-a4447a6f :END: - Some packages will be needed from pip in order to get our Emacs setup - correctly working. - #+NAME: python-packages-table - | Package | Why | - |-----------------------------+-------------------------| - | python-language-server[all] | Python LSP packages | - | pyls-isort | Import sortings for LSP | - | pyls-mypy | Mypy linter for LSP | - | pyls-black | Black plugin for pyls | +Some packages will be needed from pip in order to get our Emacs setup correctly working. +#+NAME: python-packages-table +| Package | Why | +|-----------------------------+-------------------------| +| python-language-server[all] | Python LSP packages | +| pyls-isort | Import sortings for LSP | +| pyls-mypy | Mypy linter for LSP | +| pyls-black | Black plugin for pyls | - #+NAME: python-packages-gen - #+BEGIN_SRC emacs-lisp :var packages=python-packages-table[,0] - (format "pip install --user %s" - (s-join " " packages)) - #+END_SRC +#+NAME: python-packages-gen +#+BEGIN_SRC emacs-lisp :var packages=python-packages-table[,0] + (format "pip install --user %s" + (s-join " " packages)) +#+END_SRC - #+RESULTS[cb6abaea9d7130a67569af2b4d1a545651bf29ab]: python-packages-gen - : pip install --user python-language-server[all] pyls-isort pyls-mypy pyls-black +#+RESULTS[cb6abaea9d7130a67569af2b4d1a545651bf29ab]: python-packages-gen +: pip install --user python-language-server[all] pyls-isort pyls-mypy pyls-black - Let’s install them locally for our user. - #+BEGIN_SRC fish :noweb yes - printf "\n# Installing Python packages ##################################################\n\n" - <> - #+END_SRC +Let’s install them locally for our user. +#+BEGIN_SRC fish :noweb yes + printf "\n# Installing Python packages ##################################################\n\n" + <> +#+END_SRC ** Set up Chicken (Scheme interpreter/compiler) :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_Chicken_(Scheme_interpreter-compiler)-3c1a3c4a :END: - Chicken needs to be set up before being used. First, we need to install its - documentation. - #+BEGIN_SRC fish - printf "\n# Setting up Chicken ##########################################################\n\n" - chicken-install -s apropos chicken-doc - #+END_SRC +Chicken needs to be set up before being used. First, we need to install its documentation. +#+BEGIN_SRC fish + printf "\n# Setting up Chicken ##########################################################\n\n" + chicken-install -s apropos chicken-doc +#+END_SRC - Then, we’ll complete the documentation like so: - #+BEGIN_SRC fish - cd (chicken-csi -b -e "(import (chicken platform))" -p "(chicken-home)") - curl https://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx - #+END_SRC +Then, we’ll complete the documentation like so: +#+BEGIN_SRC fish + cd (chicken-csi -b -e "(import (chicken platform))" -p "(chicken-home)") + curl https://3e8.org/pub/chicken-doc/chicken-doc-repo.tgz | sudo tar zx +#+END_SRC ** Set up our fish shell :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-f0741c22 :END: - The last thing we want to do is to set up our fish shell with some extensions - in order to improve the user experience. +The last thing we want to do is to set up our fish shell with some extensions in order to improve the user experience. *** Install ~fisher~ :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-Install_=fisher=-3a44531b :END: - We will be using ~fisher~ as our extensions manager for Fish. Let’s install - it. - #+BEGIN_SRC fish - printf "\n# Installing fisher ###########################################################\n\n" - curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish - #+END_SRC +We will be using ~fisher~ as our extensions manager for Fish. Let’s install it. +#+BEGIN_SRC fish + printf "\n# Installing fisher ###########################################################\n\n" + curl https://git.io/fisher --create-dirs -sLo ~/.config/fish/functions/fisher.fish +#+END_SRC *** Install our extensions :PROPERTIES: :CUSTOM_ID: Execute_bootstrap-Set_up_our_fish_shell-Install_our_extensions-188e4566 :END: - I generally use the following extensions in my Fish shell. - #+NAME: fish-extensions-table - #+CAPTION: Fish extensions managed by Fisher - | Package name | Description | - |-----------------------------+------------------------------------------------------------------| - | decors/fish-colored-man | Color man pages to make them more readable | - | franciscolourenco/done | Automatically receive notifications when a long process finishes | - | jethrokuan/fzf | Improved key bindings for [[https://github.com/junegunn/fzf][junegunn/fzf]] | - | jethrokuan/z | Pure-fish [[https://github.com/rupa/z][rupa/z]]-like directory jumping | - | jorgebucaran/fish-bax | Run bash scripts, replaying environment changes in fish | - | jorgebucaran/fish-getopts | CLI options parser; alternative to the [[https://fishshell.com/docs/current/commands.html#argparse][argparse]] fish builtin | - | laughedelic/pisces | Autoclose parentheses, braces, quotes and other paired symbols | - | oh-my-fish/theme-bobthefish | A Powerline-style, Git-aware fish theme optimized for awesome. | +I generally use the following extensions in my Fish shell. +#+NAME: fish-extensions-table +#+CAPTION: Fish extensions managed by Fisher +| Package name | Description | +|-----------------------------+------------------------------------------------------------------| +| decors/fish-colored-man | Color man pages to make them more readable | +| franciscolourenco/done | Automatically receive notifications when a long process finishes | +| jethrokuan/fzf | Improved key bindings for [[https://github.com/junegunn/fzf][junegunn/fzf]] | +| jethrokuan/z | Pure-fish [[https://github.com/rupa/z][rupa/z]]-like directory jumping | +| jorgebucaran/fish-bax | Run bash scripts, replaying environment changes in fish | +| jorgebucaran/fish-getopts | CLI options parser; alternative to the [[https://fishshell.com/docs/current/commands.html#argparse][argparse]] fish builtin | +| laughedelic/pisces | Autoclose parentheses, braces, quotes and other paired symbols | +| oh-my-fish/theme-bobthefish | A Powerline-style, Git-aware fish theme optimized for awesome. | - #+NAME: fish-extensions-gen - #+BEGIN_SRC emacs-lisp :var extensions=fish-extensions-table[,0] - (mapconcat (lambda (x) (format "fisher add %s" x)) - extensions - "\n") - #+END_SRC +#+NAME: fish-extensions-gen +#+BEGIN_SRC emacs-lisp :var extensions=fish-extensions-table[,0] + (mapconcat (lambda (x) (format "fisher add %s" x)) + extensions + "\n") +#+END_SRC - #+RESULTS[a88b321ba9148acc8c28c7fb1aaf924c23b6b072]: fish-extensions-gen - : fisher add decors/fish-colored-man - : fisher add franciscolourenco/done - : fisher add jethrokuan/fzf - : fisher add jethrokuan/z - : fisher add jorgebucaran/fish-bax - : fisher add jorgebucaran/fish-getopts - : fisher add laughedelic/pisces - : fisher add oh-my-fish/theme-bobthefish +#+RESULTS[a88b321ba9148acc8c28c7fb1aaf924c23b6b072]: fish-extensions-gen +: fisher add decors/fish-colored-man +: fisher add franciscolourenco/done +: fisher add jethrokuan/fzf +: fisher add jethrokuan/z +: fisher add jorgebucaran/fish-bax +: fisher add jorgebucaran/fish-getopts +: fisher add laughedelic/pisces +: fisher add oh-my-fish/theme-bobthefish - #+BEGIN_SRC fish :noweb yes - printf "\n# Installing Fisher Extensions ################################################\n\n" - <> - #+END_SRC +#+BEGIN_SRC fish :noweb yes + printf "\n# Installing Fisher Extensions ################################################\n\n" + <> +#+END_SRC diff --git a/org/config/nano.org b/org/config/nano.org index d0f4029..6e887e5 100644 --- a/org/config/nano.org +++ b/org/config/nano.org @@ -10,134 +10,106 @@ :PROPERTIES: :CUSTOM_ID: Introduction-7e535842 :END: - *Before proceeding, be aware that I deprecated this nano config on August - 28th, 2020, meaning I won’t update it anymore unless I use it again some day - in the future. I will keep it on my website though.* +*Before proceeding, be aware that I deprecated this nano config on August 28th, 2020, meaning I won’t 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 - all sorts of tasks, including quick file editing. However, at times, Emacs - won’t work or won’t 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: +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 won’t work or won’t 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 :PROPERTIES: :CUSTOM_ID: Configuration-b55668a7 :END: - 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/=. - #+BEGIN_SRC conf - set backup - set backupdir /home/phundrak/.cache/nano/backups/ - #+END_SRC +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/=. +#+BEGIN_SRC conf + set backup + set backupdir /home/phundrak/.cache/nano/backups/ +#+END_SRC - 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=.) - #+BEGIN_SRC conf - set unix - #+END_SRC +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=.) +#+BEGIN_SRC conf + set unix +#+END_SRC ** Keys behavior :PROPERTIES: :CUSTOM_ID: Configuration-Keys_behavior-c665fa36 :END: - 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. - #+BEGIN_SRC conf - set smarthome - #+END_SRC +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. +#+BEGIN_SRC conf + set smarthome +#+END_SRC ** Search :PROPERTIES: :CUSTOM_ID: Configuration-Search-6e458076 :END: - Do case-unsensitive searches by default. - #+BEGIN_SRC conf - unset casesensitive - #+END_SRC +Do case-unsensitive searches by default. +#+BEGIN_SRC conf + unset casesensitive +#+END_SRC - Do regular-expression searches by default. Regular expressions in =nano= are - of the extended type (ERE). - #+BEGIN_SRC conf - set regexp - #+END_SRC +Do regular-expression searches by default. Regular expressions in =nano= are of the extended type (ERE). +#+BEGIN_SRC conf + set regexp +#+END_SRC ** Visual settings :PROPERTIES: :CUSTOM_ID: Configuration-Visual_settings-9952f2ae :END: - 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=. - #+BEGIN_SRC conf - set boldtext - #+END_SRC +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=. +#+BEGIN_SRC conf + set boldtext +#+END_SRC - Enable soft line wrapping for easier viewing of very long lines. - #+BEGIN_SRC conf - set softwrap - #+END_SRC +Enable soft line wrapping for easier viewing of very long lines. +#+BEGIN_SRC conf + set softwrap +#+END_SRC - 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. - #+BEGIN_SRC conf - set atblanks - #+END_SRC +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. +#+BEGIN_SRC conf + set atblanks +#+END_SRC - Display line numbers to the left of the text area. - #+BEGIN_SRC conf - set linenumbers - #+END_SRC +Display line numbers to the left of the text area. +#+BEGIN_SRC conf + set linenumbers +#+END_SRC - Constantly display the cursor position in the status bar. This overrides the - option =quickblank=. - #+BEGIN_SRC conf - set constantshow - #+END_SRC +Constantly display the cursor position in the status bar. This overrides the option =quickblank=. +#+BEGIN_SRC conf + set constantshow +#+END_SRC ** Whitespace settings :PROPERTIES: :CUSTOM_ID: Configuration-Whitespace_settings-8cef9cd7 :END: - Convert typed tabs to spaces. Sue me. - #+BEGIN_SRC conf - set tabstospaces - #+END_SRC +Convert typed tabs to spaces. Sue me. +#+BEGIN_SRC conf + set tabstospaces +#+END_SRC - Use a tab size of a certain amount of columns. The value of number must be - greater than 0. The default value is 8. - #+BEGIN_SRC conf - set tabsize 2 - #+END_SRC +Use a tab size of a certain amount of columns. The value of number must be greater than 0. The default value is 8. +#+BEGIN_SRC conf +set tabsize 2 +#+END_SRC - 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). - #+BEGIN_SRC conf - set autoindent - #+END_SRC +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). +#+BEGIN_SRC conf + set autoindent +#+END_SRC - Remove trailing whitespace from wrapped lines when automatic hard-wrapping - occurs or when text is justified. - #+BEGIN_SRC conf - set trimblanks - #+END_SRC +Remove trailing whitespace from wrapped lines when automatic hard-wrapping occurs or when text is justified. +#+BEGIN_SRC conf +set trimblanks +#+END_SRC ** Included configuration file :PROPERTIES: :CUSTOM_ID: Configuration-Included_configuration_file-70b0f35b :END: - 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. - #+BEGIN_SRC conf - include ~/.config/nano/nano-syntax/*.nanorc - #+END_SRC +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. +#+BEGIN_SRC conf + include ~/.config/nano/nano-syntax/*.nanorc +#+END_SRC diff --git a/org/config/ncmpcpp.org b/org/config/ncmpcpp.org index 88730b9..885c4fa 100644 --- a/org/config/ncmpcpp.org +++ b/org/config/ncmpcpp.org @@ -10,55 +10,47 @@ :PROPERTIES: :CUSTOM_ID: Introduction-3e61ecfc :END: - Ncmpcpp is a TUI front-end for MPD, with an UI very similar to Ncmpc. This is - my main MPD front-end after my i3 shortcuts. You can find below some - screenshots of how my current ncmpcpp configuration looks like. +Ncmpcpp is a TUI front-end for MPD, with an UI very similar to Ncmpc. This is +my main MPD front-end after my i3 shortcuts. You can find below some +screenshots of how my current ncmpcpp configuration looks like. - [[file:img/ncmpcpp-queue.png]] +[[file:img/ncmpcpp-queue.png]] - [[file:img/ncmpcpp-directory.png]] +[[file:img/ncmpcpp-directory.png]] - [[file:img/ncmpcpp-visualizer.png]] +[[file:img/ncmpcpp-visualizer.png]] * Core Ncmpcpp settings :PROPERTIES: :CUSTOM_ID: Core_Ncmpcpp_settings-8cacae18 :END: - #+BEGIN_SRC conf :exports none - # -*- mode: conf -*- - #+END_SRC +#+BEGIN_SRC conf :exports none + # -*- mode: conf -*- +#+END_SRC ** Directories :PROPERTIES: :CUSTOM_ID: Core_Ncmpcpp_settings-Directories-28092c92 :END: - 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/~. - #+BEGIN_SRC conf - ncmpcpp_directory = ~/.config/ncmpcpp - #+END_SRC +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/~. +#+BEGIN_SRC conf + ncmpcpp_directory = ~/.config/ncmpcpp +#+END_SRC - When it comes to the lyrics, be sure to set the directory to the same - directory pointed at by Mpd. - #+BEGIN_SRC conf - lyrics_directory = ~/.lyrics - #+END_SRC +When it comes to the lyrics, be sure to set the directory to the same directory pointed at by Mpd. +#+BEGIN_SRC conf + lyrics_directory = ~/.lyrics +#+END_SRC ** MPD :PROPERTIES: :CUSTOM_ID: Core_Ncmpcpp_settings-MPD-a2a7452e :END: - 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. - #+BEGIN_SRC conf - mpd_host = localhost - mpd_port = 6600 - mpd_music_dir = ~/Music - mpd_connection_timeout = 5 - mpd_crossfade_time = 0 - #+END_SRC +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. +#+BEGIN_SRC conf + mpd_host = localhost + mpd_port = 6600 + mpd_music_dir = ~/Music + mpd_connection_timeout = 5 + mpd_crossfade_time = 0 +#+END_SRC diff --git a/org/config/neofetch.org b/org/config/neofetch.org index 48a299a..76e1725 100644 --- a/org/config/neofetch.org +++ b/org/config/neofetch.org @@ -11,101 +11,84 @@ :PROPERTIES: :CUSTOM_ID: Introduction-5942aea3 :END: - [[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]]. +[[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]]. * The ~print_info~ functions :PROPERTIES: :CUSTOM_ID: The_print_info_functions-bb30763f :END: - The ~print_info~ function is the function called by Neofetch in order to print - the system information it could fetch. In this function, we’ll choose what to - display, and how. This function looks like this: - #+BEGIN_SRC sh :tangle no - print_info() { - # Print information here… - } - #+END_SRC +The ~print_info~ function is the function called by Neofetch in order to print the system information it could fetch. In this function, we’ll choose what to display, and how. This function looks like this: +#+BEGIN_SRC sh :tangle no + print_info() { + # Print information here… + } +#+END_SRC - 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: - #+NAME: info-elements-table - | Prefix | Information | What it does | - |----------+-------------+-----------------------------------| - | | title | Username and hostname | - | | line_break | Insert a blank line | - | | cols | System theme | - | | line_break | Insert a blank line | - | OS | distro | Distribution name | - | Kernel | kernel | Kernel version | - | Uptime | uptime | Machine uptime | - | Packages | packages | Number of installed packages | - | Shell | shell | User’s default shell | - | WM | wm | User’s Window Manager | - | Terminal | term | Default terminal | - | CPU | cpu | CPU information | - | GPU | gpu | GPU information | - | Memory | memory | RAM information | +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: +#+NAME: info-elements-table +| Prefix | Information | What it does | +|----------+-------------+------------------------------| +| | title | Username and hostname | +| | line_break | Insert a blank line | +| | cols | System theme | +| | line_break | Insert a blank line | +| OS | distro | Distribution name | +| Kernel | kernel | Kernel version | +| Uptime | uptime | Machine uptime | +| Packages | packages | Number of installed packages | +| Shell | shell | User’s default shell | +| WM | wm | User’s Window Manager | +| Terminal | term | Default terminal | +| CPU | cpu | CPU information | +| GPU | gpu | GPU information | +| Memory | memory | RAM information | - #+NAME: info-elements-gen - #+BEGIN_SRC emacs-lisp :var table=info-elements-table :cache yes - (mapconcat (lambda (x) - (format "info %s%s" - (if (not (string= (car x) "")) - (format "\"%s\" " (car x)) - "") - (cadr x))) - table - "\n") - #+END_SRC +#+NAME: info-elements-gen +#+BEGIN_SRC emacs-lisp :var table=info-elements-table :cache yes + (mapconcat (lambda (x) + (format "info %s%s" + (if (not (string= (car x) "")) + (format "\"%s\" " (car x)) + "") + (cadr x))) + table + "\n") +#+END_SRC - #+RESULTS[1e66bf48472ad24006f0cb9dc9c86078764ba84e]: info-elements-gen - #+begin_example - info line_break - info title - info line_break - info cols - info line_break - info "OS" distro - info "Kernel" kernel - info "Uptime" uptime - info "Packages" packages - info "Shell" shell - info "WM" wm - info "Terminal" term - info "CPU" cpu - info "GPU" gpu - info "Memory" memory - info "Disks" disks - #+end_example +#+RESULTS[1e66bf48472ad24006f0cb9dc9c86078764ba84e]: info-elements-gen +#+begin_example +info line_break +info title +info line_break +info cols +info line_break +info "OS" distro +info "Kernel" kernel +info "Uptime" uptime +info "Packages" packages +info "Shell" shell +info "WM" wm +info "Terminal" term +info "CPU" cpu +info "GPU" gpu +info "Memory" memory +info "Disks" disks +#+end_example - Hence, the function looks like so: - #+BEGIN_SRC sh - print_info() { - <> - } - #+END_SRC +Hence, the function looks like so: +#+BEGIN_SRC sh + print_info() { + <> + } +#+END_SRC - Each of these modules can be tuned with the variables presented below. +Each of these modules can be tuned with the variables presented below. * Information settings :PROPERTIES: :CUSTOM_ID: Information_settings-9d4cfe88 :END: - 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. +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. ** Software :PROPERTIES: @@ -119,73 +102,72 @@ :PROPERTIES: :CUSTOM_ID: Information_settings-Software-OS-Distro-cd12bc4f :END: - This variable can shorten the output of the ~distro~ function. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--distro_shorthand~ - - Supports :: Everything except Windows and Haiku - - Examples :: - - on :: ~Arch Linux~ - - off :: ~Arch~ - #+begin_src sh - distro_shorthand="off" - #+end_src +This variable can shorten the output of the ~distro~ function. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--distro_shorthand~ +- Supports :: Everything except Windows and Haiku +- Examples :: + - on :: ~Arch Linux~ + - off :: ~Arch~ +#+begin_src sh + distro_shorthand="off" +#+end_src - It is possible to display when the distro has been installed on the computer. +It is possible to display when the distro has been installed on the computer. **** Kernel :PROPERTIES: :CUSTOM_ID: Information_settings-Software-OS-Kernel-658cedce :END: - The variable below can shorten the output ofh the ~kernel~ function. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--kernel_shorthand~ - - Supports :: Everything except *BSDs (except PacBSD and PC-BSD) - - Examples :: - - on :: ~4.8.9-1-ARCH~ - - off :: ~Linux 4.8.9-1-ARCH~ - #+begin_src sh - kernel_shorthand="off" - #+end_src +The variable below can shorten the output ofh the ~kernel~ function. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--kernel_shorthand~ +- Supports :: Everything except *BSDs (except PacBSD and PC-BSD) +- Examples :: + - on :: ~4.8.9-1-ARCH~ + - off :: ~Linux 4.8.9-1-ARCH~ +#+begin_src sh + kernel_shorthand="off" +#+end_src **** OS Architecture :PROPERTIES: :CUSTOM_ID: Information_settings-Software-OS-OS_Architecture-2f60c93c :END: - This variable can show or hide the OS architecture in the ~distro~ output. - - Default value :: ~"off"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--os_arch~ - - Examples :: - - on :: ~Arch Linux x86_64~ - - off :: ~Arch Linux~ - #+begin_src sh - os_arch="off" - #+end_src +This variable can show or hide the OS architecture in the ~distro~ output. +- Default value :: ~"off"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--os_arch~ +- Examples :: + - on :: ~Arch Linux x86_64~ + - off :: ~Arch Linux~ +#+begin_src sh + os_arch="off" +#+end_src **** Packages :PROPERTIES: :CUSTOM_ID: Information_settings-Software-OS-Packages-f836a58d :END: - It is possible to show or hide Package Manager names. - - - Default :: ~'tiny'~ - - Values :: ~'on'~ / ~'tiny'~ / ~'off'~ - - Flag :: ~--package_managers~ - - Example :: - - on :: ~'998 (pacman), 8 (flatpak), 4 (snap)'~ - - tiny :: ~'908 (pacman, flatpak, snap)'~ - - off :: ~'908'~ - #+BEGIN_SRC sh - package_managers="on" - #+END_SRC +It is possible to show or hide Package Manager names. +- Default :: ~'tiny'~ +- Values :: ~'on'~ / ~'tiny'~ / ~'off'~ +- Flag :: ~--package_managers~ +- Example :: + - on :: ~'998 (pacman), 8 (flatpak), 4 (snap)'~ + - tiny :: ~'908 (pacman, flatpak, snap)'~ + - off :: ~'908'~ +#+BEGIN_SRC sh + package_managers="on" +#+END_SRC **** Shell :PROPERTIES: @@ -195,142 +177,136 @@ :PROPERTIES: :CUSTOM_ID: Information_settings-Software-Shell-Shell_path-9eda636d :END: - This allows to show either the path of the user’s shell, or simply its - name. - - Default value :: ~"off"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--shell_path~ - - Examples :: - - on :: ~/bin/bash~ - - off :: ~bash~ - #+begin_src sh - shell_path="off" - #+end_src +This allows to show either the path of the user’s shell, or simply its name. +- Default value :: ~"off"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--shell_path~ +- Examples :: + - on :: ~/bin/bash~ + - off :: ~bash~ ++begin_src sh + shell_path="off" ++end_src ***** Shell version :PROPERTIES: :CUSTOM_ID: Information_settings-Software-Shell-Shell_version-03964bb3 :END: - This allows to show the shell’s version in the output of ~shell~. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--shell_version~ - - Examples :: - - on :: ~bash 4.4.5~ - - off :: ~bash~ - #+begin_src sh - shell_version="off" - #+end_src +This allows to show the shell’s version in the output of ~shell~. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--shell_version~ +- Examples :: + - on :: ~bash 4.4.5~ + - off :: ~bash~ +#+begin_src sh + shell_version="off" +#+end_src *** Uptime :PROPERTIES: :CUSTOM_ID: Information_settings-Software-Uptime-a7b5361a :END: - This variable can shorten the output of the ~uptime~ function. ~on~ shortens - it a bit, while ~tiny~ shortens it greatly. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"tiny"~ - - ~"off"~ - - Flag :: ~--uptime_shorthand~ - - Examples :: - - on :: ~2 days, 10 hours, 3 mins~ - - off :: ~2 days, 10 hours, 3 minutes~ - - tiny :: ~2d 10h 3m~ - #+begin_src sh - uptime_shorthand="on" - #+end_src +This variable can shorten the output of the ~uptime~ function. ~on~ shortens +it a bit, while ~tiny~ shortens it greatly. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"tiny"~ + - ~"off"~ +- Flag :: ~--uptime_shorthand~ +- Examples :: + - on :: ~2 days, 10 hours, 3 mins~ + - off :: ~2 days, 10 hours, 3 minutes~ + - tiny :: ~2d 10h 3m~ +#+begin_src sh + uptime_shorthand="on" +#+end_src *** IP address :PROPERTIES: :CUSTOM_ID: Information_settings-Software-IP_address-26df5e1d :END: - It is possible to display the machine’s public IP address with the function - ~ip~. The value below allows the user to change the website used to fetch - it. - - Default value :: ~"http://ident.me"~ - - Value :: ~"url"~ - - Flag :: ~--ip_host~ - #+begin_src sh - public_ip_host="http://ident.me" - #+end_src +It is possible to display the machine’s public IP address with the function ~ip~. The value below allows the user to change the website used to fetch it. +- Default value :: ~"http://ident.me"~ +- Value :: ~"url"~ +- Flag :: ~--ip_host~ +#+begin_src sh + public_ip_host="http://ident.me" +#+end_src - - Default value :: ~""~ - - Values :: - - ~""~ - - ~""~ - - Flag :: ~""~ - - Supports :: - - Examples :: - - on :: ~~ - - off :: ~~ - #+begin_src sh - #+end_src +- Default value :: ~""~ +- Values :: + - ~""~ + - ~""~ +- Flag :: ~""~ +- Supports :: +- Examples :: + - on :: ~~ + - off :: ~~ +#+begin_src sh +#+end_src *** Theming :PROPERTIES: :CUSTOM_ID: Information_settings-Software-Theming-ba7f1ccd :END: - This section will allow the user to modify what Neofetch can and cannot - display about the machine’s theming —by this, I mean its GTK theme, its - icons and its default font. +This section will allow the user to modify what Neofetch can and cannot display about the machine’s theming —by this, I mean its GTK theme, its icons and its default font. **** Shorten output :PROPERTIES: :CUSTOM_ID: Information_settings-Software-Theming-Shorten_output-cbef1fa4 :END: - With this value, it is possible to shorten the output of the computer’s - theming. - - Default value :: ~"off"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--gtk_shorthand~ - - Examples :: - - on :: ~Numix, Adwaita~ - - off :: ~Numix [GTK2], Adwaita [GTK3]~ - #+begin_src sh - gtk_shorthand="on" - #+end_src +With this value, it is possible to shorten the output of the computer’s theming. +- Default value :: ~"off"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--gtk_shorthand~ +- Examples :: + - on :: ~Numix, Adwaita~ + - off :: ~Numix [GTK2], Adwaita [GTK3]~ +#+begin_src sh + gtk_shorthand="on" +#+end_src **** Enable or disable theming display for GTK2 :PROPERTIES: :CUSTOM_ID: Information_settings-Software-Theming-Enable_or_disable_theming_display_for_GTK2-f4398571 :END: - It is possible to explicitely show or hide the computer’s theming with GTK2 - with this variable. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--gtk2~ - - Examples :: - - on :: ~Numix [GTK2], Adwaita [GTK3]~ - - off :: ~Adwaita [GTK3]~ - #+begin_src sh - gtk2="off" - #+end_src +It is possible to explicitely show or hide the computer’s theming with GTK2 with this variable. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--gtk2~ +- Examples :: + - on :: ~Numix [GTK2], Adwaita [GTK3]~ + - off :: ~Adwaita [GTK3]~ +#+begin_src sh + gtk2="off" +#+end_src **** Enable or disable theming display for GTK3 :PROPERTIES: :CUSTOM_ID: Information_settings-Software-Theming-Enable_or_disable_theming_display_for_GTK3-c4070e66 :END: - The same variable as above is also available for GTK3. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--gtk3~ - - Examples :: - - on :: ~Numix [GTK2], Adwaita [GTK3]~ - - off :: ~Numix [GTK2]~ - #+begin_src sh - #+end_src +The same variable as above is also available for GTK3. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--gtk3~ +- Examples :: + - on :: ~Numix [GTK2], Adwaita [GTK3]~ + - off :: ~Numix [GTK2]~ +#+begin_src sh + gtk3="off" +#+end_src ** Hardware :PROPERTIES: @@ -340,190 +316,177 @@ :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-CPU-eb0bcd7d :END: - **** CPU brand :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_brand-5b25776b :END: - With this variables, it is possible to show or hide the brand of a CPU in - the ~cpu~ output. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--cpu_brand~ - - Examples :: - - on :: ~Intel i7-6500U~ - - off :: ~i7-6500U~ - #+begin_src sh - cpu_brand="off" - #+end_src +With this variables, it is possible to show or hide the brand of a CPU in +the ~cpu~ output. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--cpu_brand~ +- Examples :: + - on :: ~Intel i7-6500U~ + - off :: ~i7-6500U~ +#+begin_src sh + cpu_brand="off" +#+end_src **** CPU speed :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_speed-2bf6e5f7 :END: - With this variable, it is possible to show or hide the speed of the CPU. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--cpu_speed~ - - Examples :: - - on :: ~Intel i7-6500U (4) @ 3.1GHz~ - - off :: ~Intel i7-6500U (4)~ - #+begin_src sh - cpu_speed="off" - #+end_src +With this variable, it is possible to show or hide the speed of the CPU. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--cpu_speed~ +- Examples :: + - on :: ~Intel i7-6500U (4) @ 3.1GHz~ + - off :: ~Intel i7-6500U (4)~ +#+begin_src sh + cpu_speed="off" +#+end_src **** CPU speed type :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_speed_type-a24de48f :END: - This allows Neofetch to know what type of speed it has to fetch regarding - the machine’s CPU. Any file in ~/sys/devices/system/cpu/cpu0/cpufreq~ can - be used as a value. - - Default value :: ~"bios_limit"~ - - Values :: - - ~"scaling_cur_freq"~ - - ~"scaling_min_freq"~ - - ~"scaling_max_freq"~ - - ~"bios_limit"~ - - Flag :: ~--speed_type~ - - Supports :: Linux with ~cpufreq~ - #+begin_src sh - speed_type="bios_limit" - #+end_src +This allows Neofetch to know what type of speed it has to fetch regarding the machine’s CPU. Any file in ~/sys/devices/system/cpu/cpu0/cpufreq~ can be used as a value. +- Default value :: ~"bios_limit"~ +- Values :: + - ~"scaling_cur_freq"~ + - ~"scaling_min_freq"~ + - ~"scaling_max_freq"~ + - ~"bios_limit"~ +- Flag :: ~--speed_type~ +- Supports :: Linux with ~cpufreq~ +#+begin_src sh + speed_type="bios_limit" +#+end_src **** CPU speed shorthand :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_speed_shorthand-0d15fe08 :END: - This value allows to show sorter CPU speed with less digits. This flag is - not supported in systems with CPU speed below 1GHz. - - Default value :: ~"off"~ - - Values :: - - ~"on"~ - - ~"on"~ - - Flag :: ~--speed_shorthand~ - - Examples :: - - on :: ~i7-6500U (4) @ 3.1GHz~ - - off :: ~i7-6500U (4) @ 3.100GHz~ - #+begin_src sh - speed_shorthand="on" - #+end_src +This value allows to show sorter CPU speed with less digits. This flag is not supported in systems with CPU speed below 1GHz. +- Default value :: ~"off"~ +- Values :: + - ~"on"~ + - ~"on"~ +- Flag :: ~--speed_shorthand~ +- Examples :: + - on :: ~i7-6500U (4) @ 3.1GHz~ + - off :: ~i7-6500U (4) @ 3.100GHz~ +#+begin_src sh + speed_shorthand="on" +#+end_src **** CPU cores :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_cores-30177354 :END: - With this variable, it is possible to display the number of cores that are - available in the CPU. - - Default value :: ~"logical"~ - - Values :: - - ~"logical"~ - - ~"physical"~ - - ~"off"~ - - Flag :: ~--cpu_cores~ - - Supports :: ~physical~ does not work on BSD. - - Examples :: - - logical :: ~Intel i7-6500U (4) @ 3.1GHz~ (All virtual cores) - - physical :: ~Intel i7-6500U (2) @ 3.1GHz~ (All physical cores) - - off :: ~Intel i7-6500U @ 3.1GHz~ - #+begin_src sh - cpu_cores="off" - #+end_src +With this variable, it is possible to display the number of cores that are available in the CPU. +- Default value :: ~"logical"~ +- Values :: + - ~"logical"~ + - ~"physical"~ + - ~"off"~ +- Flag :: ~--cpu_cores~ +- Supports :: ~physical~ does not work on BSD. +- Examples :: + - logical :: ~Intel i7-6500U (4) @ 3.1GHz~ (All virtual cores) + - physical :: ~Intel i7-6500U (2) @ 3.1GHz~ (All physical cores) + - off :: ~Intel i7-6500U @ 3.1GHz~ +#+begin_src sh + cpu_cores="off" +#+end_src **** CPU temperature :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-CPU-CPU_temperature-a22e522c :END: - This variable allows the user to hide or show the CPU’s temperature, and if - shown, the user can display it in Celcius or Farenheit degrees. For FreeBSD - and NetBSD-based systems, you’ll need to enable the ~coretemp~ kernel - module. This only supports newer Intel processors. - - Default value :: ~"off"~ - - Values :: - - ~"C"~ - - ~"F"~ - - ~"off"~ - - Flag :: ~--cpu_temp~ - - Supports :: Linux, BSD - - Examples :: - - C :: ~Intel i7-6500U (4) @ 3.1GHz [27.2°C]~ - - F :: ~Intel i7-6500U (4) @ 3.1GHz [82.0°F]~ - - off :: ~Intel i7-6500U (4) @ 3.1GHz~ - #+begin_src sh - cpu_temp="off" - #+end_src +This variable allows the user to hide or show the CPU’s temperature, and if shown, the user can display it in Celcius or Farenheit degrees. For FreeBSD and NetBSD-based systems, you’ll need to enable the ~coretemp~ kernel module. This only supports newer Intel processors. +- Default value :: ~"off"~ +- Values :: + - ~"C"~ + - ~"F"~ + - ~"off"~ +- Flag :: ~--cpu_temp~ +- Supports :: Linux, BSD +- Examples :: + - C :: ~Intel i7-6500U (4) @ 3.1GHz [27.2°C]~ + - F :: ~Intel i7-6500U (4) @ 3.1GHz [82.0°F]~ + - off :: ~Intel i7-6500U (4) @ 3.1GHz~ +#+begin_src sh + cpu_temp="off" +#+end_src *** GPU :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-GPU-2c842575 :END: - 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. +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 brand :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-GPU-GPU_brand-6e2da615 :END: - This value allows the user to hide or show the brand of their GPU in the - output of ~gpu~. - - Default value :: ~"on"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--gpu_brand~ - - Supports :: - - Examples :: - - on :: ~AMD HD 7950~ - - off :: ~HD 7950~ - #+begin_src sh - gpu_brand="off" - #+end_src +This value allows the user to hide or show the brand of their GPU in the output of ~gpu~. +- Default value :: ~"on"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--gpu_brand~ +- Supports :: +- Examples :: + - on :: ~AMD HD 7950~ + - off :: ~HD 7950~ +#+begin_src sh + gpu_brand="off" +#+end_src **** Which GPU to display :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-GPU-Which_GPU_to_display-f40d3aac :END: - This allows the user to choose which GPU appears in the output of the - function ~gpu~. - - Default value :: ~"all"~ - - Values :: - - ~"all"~ - - ~"dedicated"~ - - ~"integrated"~ - - Flag :: ~--gpu_type~ - - Supports :: Linux - - Examples :: - - all :: - #+BEGIN_SRC text - GPU1: AMD HD 7950 - GPU2: Intel Integrated Graphics - #+END_SRC - - dedicated :: ~GPU1: AMD HD 7950~ - - integrated :: ~GPU1: Intel Integrated Graphics~ - #+begin_src sh - gpu_type="all" - #+end_src +This allows the user to choose which GPU appears in the output of the function ~gpu~. +- Default value :: ~"all"~ +- Values :: + - ~"all"~ + - ~"dedicated"~ + - ~"integrated"~ +- Flag :: ~--gpu_type~ +- Supports :: Linux +- Examples :: + - all :: + #+BEGIN_SRC text + GPU1: AMD HD 7950 + GPU2: Intel Integrated Graphics + #+END_SRC + - dedicated :: ~GPU1: AMD HD 7950~ + - integrated :: ~GPU1: Intel Integrated Graphics~ +#+begin_src sh + gpu_type="all" +#+end_src *** Resolution :PROPERTIES: :CUSTOM_ID: Information_settings-Hardware-Resolution-b768f865 :END: - 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. - - Default value :: ~"off"~ - - Values :: - - ~"on"~ - - ~"off"~ - - Flag :: ~--refresh_rate~ - - Supports :: Does not work on Windows - - Examples :: - - on :: ~1920x1080 @ 60Hz~ - - off :: ~1920x1080~ - #+begin_src sh - refresh_rate="off" - #+end_src +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. +- Default value :: ~"off"~ +- Values :: + - ~"on"~ + - ~"off"~ +- Flag :: ~--refresh_rate~ +- Supports :: Does not work on Windows +- Examples :: + - on :: ~1920x1080 @ 60Hz~ + - off :: ~1920x1080~ +#+begin_src sh + refresh_rate="off" +#+end_src diff --git a/org/config/picom.org b/org/config/picom.org index 3ebb0b4..dc0f8ec 100644 --- a/org/config/picom.org +++ b/org/config/picom.org @@ -9,627 +9,526 @@ :PROPERTIES: :CUSTOM_ID: Introduction-a5320326 :END: - 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][ibhagwan’s fork of compton]] which provides the ~dual-kawase~ - blur from [[https://github.com/tryone144/compton][tryone’s compton]] and rounded corners from [[https://github.com/sdhand/picom][sdhand’s compton]]. +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][ibhagwan’s fork of compton]] which provides the ~dual-kawase~ blur from [[https://github.com/tryone144/compton][tryone’s compton]] and rounded corners from [[https://github.com/sdhand/picom][sdhand’s compton]]. * Shadows :PROPERTIES: :CUSTOM_ID: Shadows-f4ffbb27 :END: - 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 don’t work out too well with rounded corners. - #+BEGIN_SRC conf - shadow = false; - #+END_SRC +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 don’t work out too well with rounded corners. +#+BEGIN_SRC conf + shadow = false; +#+END_SRC - The blur radius radius for shadows is measured in pixels, and it defaults to - 12px. - #+BEGIN_SRC conf - shadow-radius = 7; - #+END_SRC +The blur radius radius for shadows is measured in pixels, and it defaults to 12px. +#+BEGIN_SRC conf + shadow-radius = 7; +#+END_SRC - Picom can also apply some level of opacity on shadows. - | Default value | ~0.75~ | - | Min value | ~0.0~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - shadow-opacity = 0.85 - #+END_SRC +Picom can also apply some level of opacity on shadows. +| Default value | ~0.75~ | +| Min value | ~0.0~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + shadow-opacity = 0.85 +#+END_SRC - The left and top offsets for shadows are expressed in pixels. - | Default value | ~-15~ | - #+BEGIN_SRC conf - shadow-offset-x = -5; - shadow-offset-y = -5; - #+END_SRC +The left and top offsets for shadows are expressed in pixels. +| Default value | ~-15~ | +#+BEGIN_SRC conf + shadow-offset-x = -5; + shadow-offset-y = -5; +#+END_SRC - The following values have an impact on the shadow’s RGB color. - | Default value | ~0.0~ | - | Min value | ~0.0~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - shadow-red = 0.0; - shadow-green = 0.0; - shadow-blue = 0.0; - #+END_SRC +The following values have an impact on the shadow’s RGB color. +| Default value | ~0.0~ | +| Min value | ~0.0~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + shadow-red = 0.0; + shadow-green = 0.0; + shadow-blue = 0.0; +#+END_SRC - It is possible to specify a list of conditions of windows that should have no - shadow. - | Default value | ~[]~ | - #+BEGIN_SRC conf - shadow-exclude = [ - "name = 'Notification'", - "class_g = 'Conky'", - "class_g ?= 'Notify-osd'", - "class_g = 'Cairo-clock'", - "_GTK_FRAME_EXTENTS@:c" - ]; - #+END_SRC +It is possible to specify a list of conditions of windows that should have no +shadow. +| Default value | ~[]~ | +#+BEGIN_SRC conf + shadow-exclude = [ + "name = 'Notification'", + "class_g = 'Conky'", + "class_g ?= 'Notify-osd'", + "class_g = 'Cairo-clock'", + "_GTK_FRAME_EXTENTS@:c" + ]; +#+END_SRC - It is also possible to specify an X geometry that describes the region in - which shadows should not be painted in, such as a dock window region. For - example, - #+BEGIN_SRC conf :tangle no - # shadow-exclude-reg = "x10+0+0" - #+END_SRC - would make the 10 pixels at the bottom of the screen not have any shadow - painted on. - | Default value | ~""~ | - #+BEGIN_SRC conf :tangle no - shadow-exclude-reg = "" - #+END_SRC +It is also possible to specify an X geometry that describes the region in +which shadows should not be painted in, such as a dock window region. For +example, +#+BEGIN_SRC conf :tangle no + # shadow-exclude-reg = "x10+0+0" +#+END_SRC +would make the 10 pixels at the bottom of the screen not have any shadow +painted on. +| Default value | ~""~ | +#+BEGIN_SRC conf :tangle no + shadow-exclude-reg = "" +#+END_SRC - Finally, it is also possible to crop the shadow of a window fully on a - particular Xinerama screen to the screen. - - Default value :: ~false~ - #+BEGIN_SRC conf - xinerama-shadow-crop = false - #+END_SRC +Finally, it is also possible to crop the shadow of a window fully on a +particular Xinerama screen to the screen. +- Default value :: ~false~ +#+BEGIN_SRC conf + xinerama-shadow-crop = false +#+END_SRC ** Deprecated options :PROPERTIES: :HEADER-ARGS:conf: :tangle no :CUSTOM_ID: Shadows-Deprecated_options-da215d5a :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 - windows. This option is deprecated, and users should use the ~wintypes~ - option in their config file instead. - | Default value | ~false~ | - #+BEGIN_SRC conf - no-dock-shadow = false; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + no-dock-shadow = false; +#+END_SRC - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - no-dnd-shadow = false; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + no-dnd-shadow = false; +#+END_SRC - ~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 Picom’s control. Since it is deprecated, you could instead use - #+BEGIN_SRC conf :tangle no - shadow-exclude = 'bounding_shaped' - #+END_SRC - or - #+BEGIN_SRC conf :tangle no - shadow-exclude = 'bounding_shaped && !rounded_corners' - #+END_SRC - | Default value | ~""~ | - #+BEGIN_SRC conf :tangle no - shadow-ignore-shaped = "" - #+END_SRC +~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 Picom’s control. Since it is deprecated, you could instead use +#+BEGIN_SRC conf :tangle no + shadow-exclude = 'bounding_shaped' +#+END_SRC +or +#+BEGIN_SRC conf :tangle no + shadow-exclude = 'bounding_shaped && !rounded_corners' +#+END_SRC +| Default value | ~""~ | +#+BEGIN_SRC conf :tangle no + shadow-ignore-shaped = "" +#+END_SRC * Rounded corners :PROPERTIES: :CUSTOM_ID: Rounded_corners-33bfcd20 :END: - A great feature added by ibhagwan’s fork of compton is the addition of rounded - corners from sdhand’s fork, and the Kawase blur (described [[#Background_blurring-55835066][here]]) from - tryone144’s fork. Here we can see the declaration of the corners’ radius: - #+BEGIN_SRC conf - corner-radius = 9.0; - #+END_SRC +A great feature added by ibhagwan’s fork of picom is the addition of rounded corners from sdhand’s fork, and the Kawase blur (described [[#Background_blurring-55835066][here]]) from tryone144’s fork. Here we can see the declaration of the corners’ radius: +#+BEGIN_SRC conf + corner-radius = 9.0; +#+END_SRC - It is also possible to exclude some windows from getting their corners - rounded. I personally excluded any window generated by AwesomeWM. - #+BEGIN_SRC conf - rounded-corners-exclude = [ - "_NET_WM_WINDOW_TYPE@[0]:a = '_NET_WM_WINDOW_TYPE_DOCK'" - ]; - #+END_SRC +It is also possible to exclude some windows from getting their corners rounded. I personally excluded any window generated by AwesomeWM. +#+BEGIN_SRC conf + rounded-corners-exclude = [ + "_NET_WM_WINDOW_TYPE@[0]:a = '_NET_WM_WINDOW_TYPE_DOCK'" + ]; +#+END_SRC * Fading :PROPERTIES: :CUSTOM_ID: Fading-419d8047 :END: - 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~. - | Default value | ~false~ | - #+BEGIN_SRC conf - fading = true - #+END_SRC +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~. +| Default value | ~false~ | +#+BEGIN_SRC conf + fading = true +#+END_SRC - These values controls the opacity change between steps while fading in and - out. - | Default value | ~0.028~ (fade-in), ~0.03~ (fade-out) | - | Min value | ~0.01~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - fade-in-step = 0.09; - fade-out-step = 0.08; - #+END_SRC +These values controls the opacity change between steps while fading in and out. +| Default value | ~0.028~ (fade-in), ~0.03~ (fade-out) | +| Min value | ~0.01~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + fade-in-step = 0.09; + fade-out-step = 0.08; +#+END_SRC - This value represents the time between steps in fade steps, in milliseconds. - | Default value | ~10~ | - | Min value | ~1~ | - #+BEGIN_SRC conf - fade-delta = 20; - #+END_SRC +This value represents the time between steps in fade steps, in milliseconds. +| Default value | ~10~ | +| Min value | ~1~ | +#+BEGIN_SRC conf + fade-delta = 20; +#+END_SRC - It is possible to exclude some windows that should not be faded with a - specified list of conditions. - | Default value | ~[]~ | - #+BEGIN_SRC conf - fade-exclude = [ "class_g = 'mpv'" ]; - #+END_SRC +It is possible to exclude some windows that should not be faded with a specified list of conditions. +| Default value | ~[]~ | +#+BEGIN_SRC conf + fade-exclude = [ "class_g = 'mpv'" ]; +#+END_SRC - This option allows Picom not to create any fade on windows opening or closing. - | Default value | ~false~ | - #+BEGIN_SRC conf - no-fading-openclose = true; - #+END_SRC +This option allows Picom not to create any fade on windows opening or closing. +| Default value | ~false~ | +#+BEGIN_SRC conf + no-fading-openclose = true; +#+END_SRC - Finally, this option is a workaround for Openbox, Fluxbox and others by not - fading destroyed ARGB windows with WM frame. - | Default value | ~false~ | - #+BEGIN_SRC conf - no-fading-destroyed-argb = false - #+END_SRC +Finally, this option is a workaround for Openbox, Fluxbox and others by not fading destroyed ARGB windows with WM frame. +| Default value | ~false~ | +#+BEGIN_SRC conf + no-fading-destroyed-argb = false +#+END_SRC * Transparency and opacity :PROPERTIES: :CUSTOM_ID: Transparency_and_opacity-6c6b36d2 :END: - 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. - | Default value | ~1.0~ | - | Min value | ~0.1~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - inactive-opacity = 0.6; - #+END_SRC +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. +| Default value | ~1.0~ | +| Min value | ~0.1~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + inactive-opacity = 0.6; +#+END_SRC - On the other hand, it is possible to declare a default opacity for active - windows. - | Default value | ~1.0~ | - | Min value | ~0.1~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - active-opacity = 1; - #+END_SRC +On the other hand, it is possible to declare a default opacity for active windows. +| Default value | ~1.0~ | +| Min value | ~0.1~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + active-opacity = 1; +#+END_SRC - This however describes the opacity of window titlebars and borders. - | Default value | ~1.0~ | - | Min value | ~0.1~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - frame-opacity = 1.0; - #+END_SRC +This however describes the opacity of window titlebars and borders. +| Default value | ~1.0~ | +| Min value | ~0.1~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + frame-opacity = 1.0; +#+END_SRC - ~menu-opacity~ describes the opacity for dropdown menus and popup menus. - | Default value | ~1.0~ | - | Min value | ~0.1~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - # menu-opacity = 0.9; - #+END_SRC +~menu-opacity~ describes the opacity for dropdown menus and popup menus. +| Default value | ~1.0~ | +| Min value | ~0.1~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + # menu-opacity = 0.9; +#+END_SRC - ~inactive-opacity-override~ allows the user to let inactive opacity set by - ~-i~ override the ~_NET_WM_OPACITY_ values of windows. - | Default value | ~true~ | - #+BEGIN_SRC conf - inactive-opacity-override = true; - #+END_SRC +~inactive-opacity-override~ allows the user to let inactive opacity set by ~-i~ override the ~_NET_WM_OPACITY_ values of windows. +| Default value | ~true~ | +#+BEGIN_SRC conf + inactive-opacity-override = true; +#+END_SRC - While it is possible to alter opacity on inactive windows, it is also possible - to dim them. - | Default value | ~1.0~ | - | Min value | ~0.1~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - # inactive-dim = 1.0 - #+END_SRC +While it is possible to alter opacity on inactive windows, it is also possible to dim them. +| Default value | ~1.0~ | +| Min value | ~0.1~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + # inactive-dim = 1.0 +#+END_SRC - It is also possible to use a fixed inactive dim value, instead of adjusting - according to window opacity. - | Default value | ~1.0~ | - | Min value | ~0.1~ | - | Max value | ~1.0~ | - #+BEGIN_SRC conf - # inactive-dim-fixed = 1.0 - #+END_SRC +It is also possible to use a fixed inactive dim value, instead of adjusting according to window opacity. +| Default value | ~1.0~ | +| Min value | ~0.1~ | +| Max value | ~1.0~ | +#+BEGIN_SRC conf + # inactive-dim-fixed = 1.0 +#+END_SRC - It is also possible to specify a list of conditions of windows that should - always be considered focused. - | Default value | ~[]~ | - #+BEGIN_SRC conf - focus-exclude = [ "class_g = 'mpv'" ]; - #+END_SRC +It is also possible to specify a list of conditions of windows that should always be considered focused. +| Default value | ~[]~ | +#+BEGIN_SRC conf + focus-exclude = [ "class_g = 'mpv'" ]; +#+END_SRC - 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. - | Default value | ~[]~ | - #+BEGIN_SRC conf - opacity-rule = [ - "85:class_g = 'Polybar'", - # "55:class_g *?= 'Rofi'", - ]; - #+END_SRC +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. +| Default value | ~[]~ | +#+BEGIN_SRC conf + opacity-rule = []; +#+END_SRC * Background blurring :PROPERTIES: :CUSTOM_ID: Background_blurring-55835066 :END: - The following are the parameters for background blurring, see the \*BLUR\* - section for more information. - #+BEGIN_SRC conf - blur: { - method = "dual_kawase"; - strength = 7; - background = false; - background-frame = false; - background-fixed = false; - } - #+END_SRC +The following are the parameters for background blurring, see the \*BLUR\* section for more information. +#+BEGIN_SRC conf + blur: { + method = "dual_kawase"; + strength = 7; + background = false; + background-frame = false; + background-fixed = false; + } +#+END_SRC - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - blur-background = true; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + blur-background = true; +#+END_SRC - Blur background of windows when the window frame is not opaque. If true, this - implies the value ~true~ for ~blur-background~. - | Default value | ~false~ | - #+BEGIN_SRC conf - blur-background-frame = true; - #+END_SRC +Blur background of windows when the window frame is not opaque. If true, this implies the value ~true~ for ~blur-background~. +| Default value | ~false~ | +#+BEGIN_SRC conf + blur-background-frame = true; +#+END_SRC - The following determines whether to use fixed blur strength rather than - adjusting according to window opacity. - | Default value | ~false~ | - #+BEGIN_SRC conf - blur-background-fixed = false; - #+END_SRC +The following determines whether to use fixed blur strength rather than adjusting according to window opacity. +| Default value | ~false~ | +#+BEGIN_SRC conf + blur-background-fixed = false; +#+END_SRC - 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"~. - | Default value | ~""~ | - #+BEGIN_SRC conf - # blur-kern = "3x3box"; - blur-kern = "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"; - #+END_SRC +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"~. +| Default value | ~""~ | +#+BEGIN_SRC conf + # blur-kern = "3x3box"; + blur-kern = "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"; +#+END_SRC - It is possible to write exclude conditions for background blur. - | Default value | ~[]~ | - #+BEGIN_SRC conf - blur-background-exclude = [ - "window_type = 'desktop'", - "class_g = 'Polybar'", - "class_g = 'discord-overlay'", - "_GTK_FRAME_EXTENTS@:c" - ]; - #+END_SRC +It is possible to write exclude conditions for background blur. +| Default value | ~[]~ | +#+BEGIN_SRC conf + blur-background-exclude = [ + "window_type = 'desktop'", + "class_g = 'Polybar'", + "class_g = 'discord-overlay'", + "_GTK_FRAME_EXTENTS@:c" + ]; +#+END_SRC * General settings :PROPERTIES: :CUSTOM_ID: General_settings-41398de7 :END: - Daemonize process. Fork to background after initialization. Causes issues - with certain (badly-written) drivers. - | Default value | ~false~ | - #+BEGIN_SRC conf - daemon = true; - #+END_SRC +Daemonize process. Fork to background after initialization. Causes issues with certain (badly-written) drivers. +| Default value | ~false~ | +#+BEGIN_SRC conf + daemon = true; +#+END_SRC - 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. - | Default value | ~xrender~ | - #+BEGIN_SRC conf - backend = "glx"; - #+END_SRC +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. +| Default value | ~xrender~ | +#+BEGIN_SRC conf + backend = "glx"; +#+END_SRC - This enables or disables VSync. - | Default value | ~false~ | - #+BEGIN_SRC conf - vsync = true; - #+END_SRC +This enables or disables VSync. +| Default value | ~false~ | +#+BEGIN_SRC conf + vsync = true; +#+END_SRC - Enable remote control via D-Bus. See the *D-BUS API* section below for more - details. - | Default value | ~false~ | - #+BEGIN_SRC conf - dbus = false; - #+END_SRC +Enable remote control via D-Bus. See the *D-BUS API* section below for more details. +| Default value | ~false~ | +#+BEGIN_SRC conf + dbus = false; +#+END_SRC - Try to detect WM windows (a non-override-redirect window with no child that - has ~WM_STATE~) and markz them as active. - | Default value | ~false~ | - #+BEGIN_SRC conf - mark-wmwin-focused = true; - #+END_SRC +Try to detect WM windows (a non-override-redirect window with no child that has ~WM_STATE~) and markz them as active. +| Default value | ~false~ | +#+BEGIN_SRC conf + mark-wmwin-focused = true; +#+END_SRC - Mark override-redirect windows that doesn't have a child window with - ~WM_STATE~ focused. - | Default value | ~false~ | - #+BEGIN_SRC conf - mark-ovredir-focused = true; - #+END_SRC +Mark override-redirect windows that doesn't have a child window with ~WM_STATE~ focused. +| Default value | ~false~ | +#+BEGIN_SRC conf + mark-ovredir-focused = true; +#+END_SRC - Try to detect windows with rounded corners and don't consider them shaped - windows. The accuracy is not very high, unfortunately. - | Default value | ~false~ | - #+BEGIN_SRC conf - detect-rounded-corners = true; - #+END_SRC +Try to detect windows with rounded corners and don't consider them shaped windows. The accuracy is not very high, unfortunately. +| Default value | ~false~ | +#+BEGIN_SRC conf + detect-rounded-corners = true; +#+END_SRC - Detect ~_NET_WM_OPACITY~ on client windows, useful for window managers not - passing ~_NET_WM_OPACITY~ of client windows to frame windows. - | Default value | ~false~ | - #+BEGIN_SRC conf - detect-client-opacity = true; - #+END_SRC +Detect ~_NET_WM_OPACITY~ on client windows, useful for window managers not passing ~_NET_WM_OPACITY~ of client windows to frame windows. +| Default value | ~false~ | +#+BEGIN_SRC conf + detect-client-opacity = true; +#+END_SRC - Specify refresh rate of the screen. If not specified or 0, picom will try - detecting this with X RandR extension. - | Default value | ~60~ | - #+BEGIN_SRC conf - refresh-rate = 60; - #+END_SRC +Specify refresh rate of the screen. If not specified or 0, picom will try detecting this with X RandR extension. +| Default value | ~60~ | +#+BEGIN_SRC conf + refresh-rate = 120; +#+END_SRC - Limit picom to repaint at most once every 1 / ~refresh_rate~ second to boost - performance. This should not be used with - #+BEGIN_SRC text :tangle no - vsync drm/opengl/opengl-oml - #+END_SRC - as they essentially does sw-opti's job already, unless you wish to specify a - lower refresh rate than the actual value. - | Default value | ~""~ | - #+BEGIN_SRC conf - # sw-opti =; - #+END_SRC +Limit picom to repaint at most once every 1 / ~refresh_rate~ second to boost performance. This should not be used with +#+BEGIN_SRC text :tangle no + vsync drm/opengl/opengl-oml +#+END_SRC +as they essentially does sw-opti's job already, unless you wish to specify a lower refresh rate than the actual value. +| Default value | ~""~ | +#+BEGIN_SRC conf + # sw-opti =; +#+END_SRC - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - # use-ewmh-active-win = false; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + # use-ewmh-active-win = false; +#+END_SRC - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - unredir-if-possible = false; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + unredir-if-possible = false; +#+END_SRC - Delay before unredirecting the window, in milliseconds. - | Default value | ~0~ | - #+BEGIN_SRC conf - unredir-if-possible-delay = 0; - #+END_SRC +Delay before unredirecting the window, in milliseconds. +| Default value | ~0~ | +#+BEGIN_SRC conf + unredir-if-possible-delay = 0; +#+END_SRC - Conditions of windows that shouldn't be considered full-screen for - unredirecting screen. - | Default value | ~[]~ | - #+BEGIN_SRC conf - unredir-if-possible-exclude = []; - #+END_SRC +Conditions of windows that shouldn't be considered full-screen for unredirecting screen. +| Default value | ~[]~ | +#+BEGIN_SRC conf + unredir-if-possible-exclude = []; +#+END_SRC - Use ~WM_TRANSIENT_FOR~ to group windows, and consider windows in the same - group focused at the same time. - | Default value | ~false~ | - #+BEGIN_SRC conf - detect-transient = true; - #+END_SRC +Use ~WM_TRANSIENT_FOR~ to group windows, and consider windows in the same group focused at the same time. +| Default value | ~false~ | +#+BEGIN_SRC conf + detect-transient = true; +#+END_SRC - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - detect-client-leader = true; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + detect-client-leader = true; +#+END_SRC - 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. - | Default value | ~1~ | - #+BEGIN_SRC conf - resize-damage = 1; - #+END_SRC +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. +| Default value | ~1~ | +#+BEGIN_SRC conf + resize-damage = 1; +#+END_SRC - Specify a list of conditions of windows that should be painted with inverted - color. Resource-hogging, and is not well tested. - | Default value | ~[]~ | - #+BEGIN_SRC conf - invert-color-include = []; - #+END_SRC +Specify a list of conditions of windows that should be painted with inverted color. Resource-hogging, and is not well tested. +| Default value | ~[]~ | +#+BEGIN_SRC conf + invert-color-include = []; +#+END_SRC - 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 - | Default value | ~false~ | - #+BEGIN_SRC conf - use-damage = false; - #+END_SRC +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 +| Default value | ~false~ | +#+BEGIN_SRC conf + use-damage = false; +#+END_SRC - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - xrender-sync-fence = false; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + xrender-sync-fence = false; +#+END_SRC - Force all windows to be painted with blending. Useful if you have a - glx-fshader-win that could turn opaque pixels transparent. - | Default value | ~false~ | - #+BEGIN_SRC conf - force-win-blend = false; - #+END_SRC +Force all windows to be painted with blending. Useful if you have a glx-fshader-win that could turn opaque pixels transparent. +| Default value | ~false~ | +#+BEGIN_SRC conf + force-win-blend = false; +#+END_SRC - Do not use EWMH to detect fullscreen windows. Reverts to checking if a window - is fullscreen based only on its size and coordinates. - | Default value | ~false~ | - #+BEGIN_SRC conf - no-ewmh-fullscreen = false; - #+END_SRC +Do not use EWMH to detect fullscreen windows. Reverts to checking if a window is fullscreen based only on its size and coordinates. +| Default value | ~false~ | +#+BEGIN_SRC conf + no-ewmh-fullscreen = false; +#+END_SRC - 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. - | Default value | ~1.0~ | - #+BEGIN_SRC conf - max-brightness = 1.0; - #+END_SRC +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. +| Default value | ~1.0~ | +#+BEGIN_SRC conf + max-brightness = 1.0; +#+END_SRC - Make transparent windows clip other windows like non-transparent windows do, - instead of blending on top of them. - | Default value | ~false~ | - #+BEGIN_SRC conf - transparent-clipping = false; - #+END_SRC +Make transparent windows clip other windows like non-transparent windows do, instead of blending on top of them. +| Default value | ~false~ | +#+BEGIN_SRC conf + transparent-clipping = false; +#+END_SRC - Set the log level. Possible values are: - - ~trace~ - - ~debug~ - - ~info~ - - ~warn~ - - ~error~ - 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. - | Default value | ~"debug"~ | - #+BEGIN_SRC conf - log-level = "warn"; - #+END_SRC +Set the log level. Possible values are: +- ~trace~ +- ~debug~ +- ~info~ +- ~warn~ +- ~error~ +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. +| Default value | ~"debug"~ | +#+BEGIN_SRC conf + log-level = "warn"; +#+END_SRC - 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. - | Default value | ~''~ | - #+BEGIN_SRC conf - # log-file = '/path/to/your/log/file'; - #+END_SRC +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. +| Default value | ~''~ | +#+BEGIN_SRC conf + # log-file = '/path/to/your/log/file'; +#+END_SRC - Show all X errors (for debugging) - | Default value | ~false~ | - #+BEGIN_SRC conf - # show-all-xerrors = false; - #+END_SRC +Show all X errors (for debugging) +| Default value | ~false~ | +#+BEGIN_SRC conf + # show-all-xerrors = false; +#+END_SRC - Write process ID to a file. - | Default value | ~''~ | - #+BEGIN_SRC conf - # write-pid-path = '/path/to/your/log/file'; - #+END_SRC +Write process ID to a file. +| Default value | ~''~ | +#+BEGIN_SRC conf + # write-pid-path = '/path/to/your/log/file'; +#+END_SRC - Window type settings. ~WINDOW_TYPE~ is one of the 15 window types defined in - EWMH standard: - - ~"unknown"~ - - ~"desktop"~ - - ~"dock"~ - - ~"toolbar"~ - - ~"menu"~ - - ~"utility"~ - - ~"splash"~ - - ~"dialog"~ - - ~"normal"~ - - ~"dropdown_menu"~ - - ~"popup_menu"~ - - ~"tooltip"~ - - ~"notification"~ - - ~"combo"~ - - ~"dnd"~ - Following per window-type options are available: - - fade, shadow :: Controls window-type-specific shadow and fade settings. - - opacity :: Controls default opacity of the window type. - - 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.) - - 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 - wintypes: - { - tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; - dock = { shadow = false; } - dnd = { shadow = false; } - popup_menu = { opacity = 0.8; } - dropdown_menu = { opacity = 0.8; } - }; - #+END_SRC +Window type settings. ~WINDOW_TYPE~ is one of the 15 window types defined in EWMH standard: +- ~"unknown"~ +- ~"desktop"~ +- ~"dock"~ +- ~"toolbar"~ +- ~"menu"~ +- ~"utility"~ +- ~"splash"~ +- ~"dialog"~ +- ~"normal"~ +- ~"dropdown_menu"~ +- ~"popup_menu"~ +- ~"tooltip"~ +- ~"notification"~ +- ~"combo"~ +- ~"dnd"~ +Following per window-type options are available: +- fade, shadow :: Controls window-type-specific shadow and fade settings. +- opacity :: Controls default opacity of the window type. +- 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.) +- 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 + wintypes: + { + tooltip = { fade = true; shadow = true; opacity = 0.75; focus = true; full-shadow = false; }; + dock = { shadow = false; } + dnd = { shadow = false; } + popup_menu = { opacity = 0.8; } + dropdown_menu = { opacity = 0.8; } + }; +#+END_SRC ** GLX backend-specific options :PROPERTIES: :CUSTOM_ID: General_settings-GLX_backend-specific_options-43892981 :END: - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - glx-no-stencil = true; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + glx-no-stencil = true; +#+END_SRC - 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. - | Default value | ~false~ | - #+BEGIN_SRC conf - glx-no-rebind-pixmap = false; - #+END_SRC +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. +| Default value | ~false~ | +#+BEGIN_SRC conf + glx-no-rebind-pixmap = false; +#+END_SRC - 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. - | Default value | ~''~ | - #+BEGIN_SRC conf :tangle no - glx-fshader-win = ''; - #+END_SRC +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. +| Default value | ~''~ | +#+BEGIN_SRC conf :tangle no + glx-fshader-win = ''; +#+END_SRC diff --git a/org/config/polybar.org b/org/config/polybar.org index 8fd8ab3..4c32918 100644 --- a/org/config/polybar.org +++ b/org/config/polybar.org @@ -12,25 +12,15 @@ :PROPERTIES: :CUSTOM_ID: Presentation-4e723f32 :END: - *Before proceeding, be aware that I deprecated this polybar config on August - 22nd, 2020, meaning I won’t update it anymore unless I use it again some day - in the future. I will keep it on my website though.* +*Before proceeding, be aware that I deprecated this polybar config on August 22nd, 2020, meaning I won’t 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 - 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. +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. - 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]]. +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]]. - #+BEGIN_EXPORT latex - 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. - #+END_EXPORT +#+BEGIN_EXPORT latex +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. +#+END_EXPORT * General settings :PROPERTIES: @@ -59,391 +49,310 @@ :PROPERTIES: :CUSTOM_ID: Colors_declaration_for_polybar-75ee0b65 :END: - #+BEGIN_SRC conf-windows :exports none - ; -*- mode: conf-windows -*- - #+END_SRC - 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: - #+BEGIN_SRC conf-windows +#+BEGIN_SRC conf-windows :exports none + ; -*- mode: conf-windows -*- +#+END_SRC +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: +#+BEGIN_SRC conf-windows [colors] - #+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, - let’s declare our default background and foreground colors with their - alternative option. - #+BEGIN_SRC conf-windows - background = ${xrdb:color1:#50000000} - background-alt = ${xrdb:color2:#444} - foreground = ${xrdb:color7:#dfdfdf} - foreground-alt = ${xrdb:color6:#555} - #+END_SRC - - Now, we can also declare our primary and secondary colors. - #+BEGIN_SRC conf-windows - primary = #ffb52a - secondary = #e60053 - #+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, let’s declare an alert - color. - #+BEGIN_SRC conf-windows - alert = #bd2c40 - #+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, let’s declare our default background and foreground colors with their alternative option. +#+BEGIN_SRC conf-windows + background = ${xrdb:color1:#50000000} + background-alt = ${xrdb:color2:#444} + foreground = ${xrdb:color7:#dfdfdf} + foreground-alt = ${xrdb:color6:#555} +#+END_SRC +Now, we can also declare our primary and secondary colors. +#+BEGIN_SRC conf-windows + primary = #ffb52a + secondary = #e60053 +#+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, let’s declare an alert color. +#+BEGIN_SRC conf-windows + alert = #bd2c40 +#+END_SRC * Declaration of the bars :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-a95135a3 :END: - 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: - #+BEGIN_SRC conf-windows :tangle no +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: +#+BEGIN_SRC conf-windows :tangle no [bar/nameofthebar] - #+END_SRC - In my configuration, I use two of such bars, one atop of my screen, and one at - the bottom. +#+END_SRC +In my configuration, I use two of such bars, one atop of my screen, and one at the bottom. ** Top bar declaration :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-fc0cd977 :END: - 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. - #+BEGIN_SRC conf-windows - [bar/top] - #+END_SRC +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. +#+BEGIN_SRC conf-windows +[bar/top] +#+END_SRC *** Positioning :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Positioning-2505760c :END: - 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. - #+NAME: monitor-bar - #+BEGIN_SRC conf-windows - monitor = ${env:MONITOR} - #+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. - #+BEGIN_SRC conf-windows - bottom = false - border-size = 5 - <> - #+END_SRC - - #+NAME: position-bar-top - #+BEGIN_SRC conf-windows :exports none :tangle no - width = 100% - height = 22 - radius = 10.0 - fixed-center = true - #+END_SRC - 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. - #+NAME: padding-bar - #+BEGIN_SRC conf-windows - padding-left = 2 - padding-right = 4 - #+END_SRC - - Each module will have some padding around it, so that modules aren’t 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 - #+BEGIN_SRC conf-windows - module-margin-left = 1 - module-margin-right = 2 - #+END_SRC - - The top bar doesn’t include any system tray, so let’s disable that. - #+BEGIN_SRC conf-windows - tray-position = none - #+END_SRC +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. +#+NAME: monitor-bar +#+BEGIN_SRC conf-windows +monitor = ${env:MONITOR} +#+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. +#+BEGIN_SRC conf-windows + bottom = false + border-size = 5 + <> +#+END_SRC +#+NAME: position-bar-top +#+BEGIN_SRC conf-windows :exports none :tangle no + width = 100% + height = 22 + radius = 10.0 + fixed-center = true +#+END_SRC +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. +#+NAME: padding-bar +#+BEGIN_SRC conf-windows + padding-left = 2 + padding-right = 4 +#+END_SRC +Each module will have some padding around it, so that modules aren’t 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 +#+BEGIN_SRC conf-windows + module-margin-left = 1 + module-margin-right = 2 +#+END_SRC +The top bar doesn’t include any system tray, so let’s disable that. +#+BEGIN_SRC conf-windows + tray-position = none +#+END_SRC *** Colors and display :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Colors_and_display-30f12652 :END: - As explained above, we declared some global variables when it comes to - colors, and this is where they will be used. The bar’s background will be of - the same color as the main background color declared earlier, and the same - goes for the foreground. - #+NAME: bar-colors - #+BEGIN_SRC conf-windows - background = ${colors.background} - foreground = ${colors.foreground} - #+END_SRC +As explained above, we declared some global variables when it comes to colors, and this is where they will be used. The bar’s background will be of the same color as the main background color declared earlier, and the same goes for the foreground. +#+NAME: bar-colors +#+BEGIN_SRC conf-windows + background = ${colors.background} + foreground = ${colors.foreground} +#+END_SRC - 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 won’t 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 - #+BEGIN_SRC conf-windows - line-color = #f00 - ; border-color = #00000000 - #+END_SRC +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 won’t 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 +#+BEGIN_SRC conf-windows + line-color = #f00 + ; border-color = #00000000 +#+END_SRC - 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. - #+NAME: line-size-bar - #+BEGIN_SRC conf-windows - line-size = 3 - #+END_SRC +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. +#+NAME: line-size-bar +#+BEGIN_SRC conf-windows + line-size = 3 +#+END_SRC *** Fonts and locale :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466 :END: - 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: - #+NAME: locale-bar - #+BEGIN_SRC conf-windows - locale = ja_JP.UTF-8 - #+END_SRC +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: +#+NAME: locale-bar +#+BEGIN_SRC conf-windows + locale = ja_JP.UTF-8 +#+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: +#+NAME: fonts-polybar +| Font | fontconfig | Vertical offset | Why it’s used | +|--------------+----------------------------------------------------+-----------------+-----------------------| +| Fira Sans | Fira Sans Book:style=Book:pixelsize=10 | 1 | Text display | +| IPA Mincho | IPAMincho:style=regular:pixelsize=6 | 0 | Japanese text display | +| Unifont | unifont:fontformat=truetype:size=6:antialias=false | 0 | Fallback font | +| NotoEmoji | NotoEmoji:style=Book:scale=16 | 0 | Emoji display | +| Siji | Siji:pixelsize=8 | 0 | Symbol display | +| Default font | fixed:pixelsize=8 | 0 | Fallback font | +#+NAME: font-ws-config +#+HEADER: :var text="font" +#+BEGIN_SRC emacs-lisp :var table=fonts-polybar[,1:2] :cache yes + (setq counter 0) + (mapconcat (lambda (font) + (setq counter (+ 1 counter)) + (format "%s-%d = %s;%s" + text + (- counter 1) + (nth 0 font) + (nth 1 font))) + table + "\n") +#+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: - #+NAME: fonts-polybar - | Font | fontconfig | Vertical offset | Why it’s used | - |--------------+----------------------------------------------------+-----------------+-----------------------| - | Fira Sans | Fira Sans Book:style=Book:pixelsize=10 | 1 | Text display | - | IPA Mincho | IPAMincho:style=regular:pixelsize=6 | 0 | Japanese text display | - | Unifont | unifont:fontformat=truetype:size=6:antialias=false | 0 | Fallback font | - | NotoEmoji | NotoEmoji:style=Book:scale=16 | 0 | Emoji display | - | Siji | Siji:pixelsize=8 | 0 | Symbol display | - | Default font | fixed:pixelsize=8 | 0 | Fallback font | +#+RESULTS[53fd99d75f6b08e96288fd2a62b455d7ef8b1754]: font-ws-config +: font-0 = Fira Sans Book:style=Book:pixelsize=10;1 +: font-1 = IPAMincho:style=regular:pixelsize=6;0 +: font-2 = unifont:fontformat=truetype:size=6:antialias=false;0 +: font-3 = NotoEmoji:style=Book:scale=16;0 +: font-4 = Siji:pixelsize=8;0 +: font-5 = fixed:pixelsize=8;0 - #+NAME: font-ws-config - #+HEADER: :var text="font" - #+BEGIN_SRC emacs-lisp :var table=fonts-polybar[,1:2] :cache yes - (setq counter 0) - (mapconcat (lambda (font) - (setq counter (+ 1 counter)) - (format "%s-%d = %s;%s" - text - (- counter 1) - (nth 0 font) - (nth 1 font))) - table - "\n") - #+END_SRC - - #+RESULTS[53fd99d75f6b08e96288fd2a62b455d7ef8b1754]: font-ws-config - : font-0 = Fira Sans Book:style=Book:pixelsize=10;1 - : font-1 = IPAMincho:style=regular:pixelsize=6;0 - : font-2 = unifont:fontformat=truetype:size=6:antialias=false;0 - : font-3 = NotoEmoji:style=Book:scale=16;0 - : font-4 = Siji:pixelsize=8;0 - : font-5 = fixed:pixelsize=8;0 - - Here’s the font configuration: - #+BEGIN_SRC conf-windows - <> - #+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. +Here’s the font configuration: +#+BEGIN_SRC conf-windows + <> +#+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. *** Modules :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Top_bar_declaration-Modules-18979638 :END: - 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, we’ll get the title of the - focused window, and to the left we’ll have the date and time. - #+NAME: modules-generate - #+BEGIN_SRC emacs-lisp :var table=top-modules :results value :cache yes - (setq right '() - center '() - left '()) - (dolist (module table) - (let* ((module-name (nth 0 module)) - (module-layout (nth 1 module))) - (message "%S" module-layout) - (add-to-list (cond - ((string= "left" module-layout) 'left) - ((string= "center" module-layout) 'center) - (t 'right)) - module-name))) - (concat (concat "modules-left = " - (mapconcat #'identity left " ") - "\n") - (concat "modules-center = " - (mapconcat #'identity center " ") - "\n") - (concat "modules-right = " - (mapconcat #'identity right " ") - "\n")) - #+END_SRC +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, we’ll get the title of the focused window, and to the left we’ll have the date and time. +#+NAME: modules-generate +#+BEGIN_SRC emacs-lisp :var table=top-modules :results value :cache yes + (setq right '() + center '() + left '()) + (dolist (module table) + (let* ((module-name (nth 0 module)) + (module-layout (nth 1 module))) + (message "%S" module-layout) + (add-to-list (cond + ((string= "left" module-layout) 'left) + ((string= "center" module-layout) 'center) + (t 'right)) + module-name))) + (concat (concat "modules-left = " + (mapconcat #'identity left " ") + "\n") + (concat "modules-center = " + (mapconcat #'identity center " ") + "\n") + (concat "modules-right = " + (mapconcat #'identity right " ") + "\n")) +#+END_SRC - #+RESULTS[90b932dc0fd32501e1513f14059b92de09a7b59e]: modules-generate - : modules-left = i3 - : modules-center = xwindow - : modules-right = date +#+RESULTS[90b932dc0fd32501e1513f14059b92de09a7b59e]: modules-generate +: modules-left = i3 +: modules-center = xwindow +: modules-right = date - Here is the list of modules used: - #+NAME: top-modules - | Module name | Position | Brief description | - |-------------+----------+----------------------------| - | i3 | left | i3 workspace indicator | - | xwindow | center | Name of the focused window | - | date | right | Date and time | +Here is the list of modules used: +#+NAME: top-modules +| Module name | Position | Brief description | +|-------------+----------+----------------------------| +| i3 | left | i3 workspace indicator | +| xwindow | center | Name of the focused window | +| date | right | Date and time | - #+BEGIN_SRC conf-windows :cache yes - <> - #+END_SRC +#+BEGIN_SRC conf-windows :cache yes + <> +#+END_SRC - Each module will be described in details later in this document. +Each module will be described in details later in this document. ** Bottom bar declaration :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-8504b5ec :END: - As described above, we will once again have to declare our bar with an - equally unimaginative but explicit name. - #+BEGIN_SRC conf-windows - [bar/bottom] - #+END_SRC +As described above, we will once again have to declare our bar with an equally unimaginative but explicit name. +#+BEGIN_SRC conf-windows + [bar/bottom] +#+END_SRC *** Positioning :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Positioning-b1883756 :END: - The variables are the same as above, but two of them will be slightly - modified: - #+BEGIN_SRC conf-windows - bottom = true - border-size = 0 - <> - #+END_SRC +The variables are the same as above, but two of them will be slightly modified: +#+BEGIN_SRC conf-windows + bottom = true + border-size = 0 + <> +#+END_SRC - #+NAME: position-bar-bottom - #+BEGIN_SRC conf-windows :exports none :tangle no - width = 100% - height = 22 - radius = 0.0 - fixed-center = true - #+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 aren’t modified. - #+BEGIN_SRC conf-windows - <> - <> - <> - #+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. - #+BEGIN_SRC conf-windows - tray-position = right - tray-padding = 0 - tray-detached = false - tray-maxsize = 15 - #+END_SRC +#+NAME: position-bar-bottom +#+BEGIN_SRC conf-windows :exports none :tangle no + width = 100% + height = 22 + radius = 0.0 + fixed-center = true +#+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 aren’t modified. +#+BEGIN_SRC conf-windows + <> + <> + <> +#+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. +#+BEGIN_SRC conf-windows + tray-position = right + tray-padding = 0 + tray-detached = false + tray-maxsize = 15 +#+END_SRC *** Colors and display :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Colors_and_display-854aae82 :END: - 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. - #+BEGIN_SRC conf-windows - <> - <> - <> - #+END_SRC +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. +#+BEGIN_SRC conf-windows + <> + <> + <> +#+END_SRC *** Fonts and locale :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Fonts_and_locale-67459d62 :END: - Again, nothing changes from the top bar, so for more info on what’s going - on, see [[#Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466][Fonts and locale]] of the top bar. - #+BEGIN_SRC conf-windows - <> - <> - #+END_SRC +Again, nothing changes from the top bar, so for more info on what’s going on, see [[#Declaration_of_the_bars-Top_bar_declaration-Fonts_and_locale-70a25466][Fonts and locale]] of the top bar. +#+BEGIN_SRC conf-windows + <> + <> +#+END_SRC *** Modules :PROPERTIES: :CUSTOM_ID: Declaration_of_the_bars-Bottom_bar_declaration-Modules-702b21fc :END: - 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: - #+NAME: table-modules-bottom - | Module name | Position | Brief description | - |----------------+----------+---------------------------------| - | mpd | left | MPD status indicator | - | filesystem | right | Free storage in our filesystem | - | wlan | right | Name of the active WiFi network | - | eth | right | Local address on Ethernet | - | volume | right | System volume | - | backlight-acpi | right | Screen backlight | - | cpu | right | CPU usage | - | memory | right | RAM usage | - | temperature | right | CPU temperature | - | custom-battery | right | Battery usage | +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: +#+NAME: table-modules-bottom +| Module name | Position | Brief description | +|----------------+----------+---------------------------------| +| mpd | left | MPD status indicator | +| filesystem | right | Free storage in our filesystem | +| wlan | right | Name of the active WiFi network | +| eth | right | Local address on Ethernet | +| volume | right | System volume | +| backlight-acpi | right | Screen backlight | +| cpu | right | CPU usage | +| memory | right | RAM usage | +| temperature | right | CPU temperature | +| custom-battery | right | Battery usage | +Here’s the corresponding configuration: +#+ATTR_LATEX: :options breaklines +#+BEGIN_SRC conf-windows + <> +#+END_SRC +All these modules will be explained below. - Here’s the corresponding configuration: - #+ATTR_LATEX: :options breaklines - #+BEGIN_SRC conf-windows - <> - #+END_SRC - All these modules will be explained below. - - As you may have noticed, no modules will be displayed in the middle of this - bar. +As you may have noticed, no modules will be displayed in the middle of this bar. * Modules :PROPERTIES: :CUSTOM_ID: Modules-2e1a51bc :END: - Before we begin to describe the different modules, I would like to point out - something that will be repeated multiple times if I don’t 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 - #+BEGIN_SRC conf-windows :tangle no - format-prefix-foreground = ${colors.foreground-alt} - format-prefix-underline = ${colors.secondary} - format-underline = ${colors.secondary} - format-padding = 1 - #+END_SRC +Before we begin to describe the different modules, I would like to point out something that will be repeated multiple times if I don’t 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 +#+BEGIN_SRC conf-windows :tangle no + format-prefix-foreground = ${colors.foreground-alt} + format-prefix-underline = ${colors.secondary} + format-underline = ${colors.secondary} + format-padding = 1 +#+END_SRC ** Hardware :PROPERTIES: @@ -453,334 +362,274 @@ :PROPERTIES: :CUSTOM_ID: Modules-Hardware-Battery-299f2e42 :END: - 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~. +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~. - The first line of the module declaration lets the user name the module - however they want. In this case, the name is ~custom-battery~. - #+BEGIN_SRC conf-windows - [module/custom-battery] - #+END_SRC +The first line of the module declaration lets the user name the module however they want. In this case, the name is ~custom-battery~. +#+BEGIN_SRC conf-windows + [module/custom-battery] +#+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. +#+BEGIN_SRC conf-windows + type = custom/script +#+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. +#+BEGIN_SRC conf-windows + exec = polybar-ab -polybar -thr 10 + tail = true +#+END_SRC +The ~-thr 10~ specifies the threshold for polybar-ab at which it should warn the user about the battery level of the computer. - 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 - type = custom/script - #+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. - #+BEGIN_SRC conf-windows - exec = polybar-ab -polybar -thr 10 - tail = true - #+END_SRC - The ~-thr 10~ specifies the threshold for polybar-ab at which it should warn - the user about the battery level of the computer. - - Of course, users on desktop computers won’t need this module which is aimed - at laptop users. Feel free to remove it if you do not need it. +Of course, users on desktop computers won’t need this module which is aimed at laptop users. Feel free to remove it if you do not need it. *** Filesystem :PROPERTIES: :CUSTOM_ID: Modules-Hardware-Filesystem-26f0a3c6 :END: - 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 let’s declare it as such: - #+BEGIN_SRC conf-windows - [module/filesystem] - type = internal/fs - #+END_SRC - 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. - #+BEGIN_SRC conf-windows - interval = 20 - #+END_SRC +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 let’s declare it as such: +#+BEGIN_SRC conf-windows + [module/filesystem] + type = internal/fs +#+END_SRC +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. +#+BEGIN_SRC conf-windows + interval = 20 +#+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. +#+NAME: include-home-partition +#+BEGIN_SRC emacs-lisp :tangle no :exports code + (if (string= system-name "Marpa") + "mount-1 = /home") +#+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. - #+NAME: include-home-partition - #+BEGIN_SRC emacs-lisp :tangle no :exports code - (if (string= system-name "Marpa") - "mount-1 = /home") - #+END_SRC - - #+BEGIN_SRC conf-windows - mount-0 = / - <> - #+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, we’ll simply use - their label. - #+BEGIN_SRC conf-windows - format-mounted = - format-unmounted = - #+END_SRC - 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. - #+BEGIN_SRC conf-windows - label-mounted = 💽 %mountpoint%: %used%/%total% (%percentage_used%%) - label-mounted-foreground = ${colors.foreground} - label-mounted-underline = ${colors.secondary} - #+END_SRC - - If the volume is unmounted (which should be worrying considering the - mountpoints chosen), then we’ll simply have a message telling us about that, - and the foreground color will use the alternative foreground color described - earlier. - #+BEGIN_SRC conf-windows - label-unmounted = %mountpoint% not mounted - label-unmounted-foreground = ${colors.foreground-alt} - #+END_SRC +#+BEGIN_SRC conf-windows + mount-0 = / + <> +#+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, we’ll simply use their label. +#+BEGIN_SRC conf-windows + format-mounted = + format-unmounted = +#+END_SRC +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. +#+BEGIN_SRC conf-windows + label-mounted = 💽 %mountpoint%: %used%/%total% (%percentage_used%%) + label-mounted-foreground = ${colors.foreground} + label-mounted-underline = ${colors.secondary} +#+END_SRC +If the volume is unmounted (which should be worrying considering the mountpoints chosen), then we’ll simply have a message telling us about that, and the foreground color will use the alternative foreground color described earlier. +#+BEGIN_SRC conf-windows + label-unmounted = %mountpoint% not mounted + label-unmounted-foreground = ${colors.foreground-alt} +#+END_SRC *** Xbacklight :PROPERTIES: :CUSTOM_ID: Modules-Hardware-Xbacklight-2901c504 :END: - 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. - #+BEGIN_SRC conf-windows - [module/xbacklight] - type = internal/xbacklight - format =