Using i3 window manager in Linux
Overview
Notes to start using i3 lightweight window manager in Linux for developers.
Reasons
After using some popular desktop environments you realize that you don’t need all the fancy stuff they provide and that waster a lot of memory.
To use a lightweight window manager like i3 you need to feel comfortable with command line.
This is why a Window Manager is a great solution instead a Desktop Environment.
Unix philosophy
Be compliant with Unix/Linux philosophy:
This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together.
That means it is better to use a Window Manager and other small dedicated programs that play nicely together instead of a full Desktop Environment.
Memory
Have the right amount of running processes you need, i.e.: optimize memory usage
Keyboard navigation
Have full control with keyboard navigation, this is the kind of VIm or Emacs users really appreciate.
Minimalistic
Minimalistic design, no window decorations or nonsense icons floating around.
Install
We will begin installing i3 with: sudo apt install i3
Basic commands
- To start a new console: $meta+
. - To start any GTK-based program: $meta+d
. - To move through different workspaces we use: $meta +
.
Workspaces
After we switch our session to i3, we will arrange our screens in three groups, in i3 terminology these are three different workspaces (group windows together).
- $meta+1. First for a browser
- To start the Firefox for example, $meta+d and then
write the
firefox
command, Enter
- $meta+2. Second for communication programs (irssi, mutt, etc)
- $meta+3. Rest of programs like text editors (hopefully Emacs ;) and consoles.
Additional commands
- Moving a window to the third workspace, $mod+Shift+3
- Close i3 session: $mod+Shift+e
- Making a window float: $mod+Shift+Space
Additional configuration
The configuration file ~/.config/i3/config
is the main place to
tweak our settings and look for (or customize) key shortcuts.
i3status
i3status is a small program for generating a status bar for i3bar.
i3status configuration file possible locations:
~/.config/i3status/config (or $XDG_CONFIG_HOME/i3status/config if set)
/etc/xdg/i3status/config (or $XDG_CONFIG_DIRS/i3status/config if set)
~/.i3status.conf
/etc/i3status.conf
The idea of the i3 status configuration file is to specify which modules should be used and then configure each module in its own section.
After changing anything, $mod+Shift+r to reload i3 in place and reflect any changes.
dmenu
When trying to execute a command with the built in menu
$meta+d, by default i3 runs: dmenu_run
which shows a
list of all available commands at console.
It would make more sense to only show the ones with a GTK visual
interface, this can be done with the command i3-dmenu-desktop which
shows the .desktop
files with dmenu.
In the config file ~/.config/i3/config
, comment the dmenu_run line
and uncomment the new i3-dmenu-desktop line:
# start dmenu (a program launcher)
## bindsym $mod+d exec dmenu_run
# There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed.
bindsym $mod+d exec --no-startup-id i3-dmenu-desktop
i3lock
Similar to xscreensaver, lets lock the screen with $mod+z.
Add this to your config and reload to apply changes:
# Lock screen
bindsym $mod+z exec i3lock
Then $mod+Shift+r and $mod+z
will lock the screen
until you enter your user’s password.
Screen brightness
Download and install xbacklight
:
$ sudo apt install xbacklight
Now configure keystrokes, in config file ~/.config/i3/config
:
# Screen
# increase screen brightness
bindsym XF86MonBrightnessUp exec --no-startup-id "xbacklight -inc 5"
# decrease screen brightness
bindsym XF86MonBrightnessDown exec --no-startup-id "xbacklight -dec 5"
bindsym XF86MonBrightnessDown exec --no-startup-id "light -U 10"
There is also an alternative to xbacklight
: light which can be used with the command light -U 10
.
Volume keys
We have to configure volume keys to increase, decrease and mute using the Pulse Audio server, pactl
command.
$ sudo apt install pavucontrol
And in config:
# Sound
# increase sound level
bindsym XF86AudioRaiseVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ +5%"
# decrease sound level
bindsym XF86AudioLowerVolume exec --no-startup-id "pactl set-sink-volume @DEFAULT_SINK@ -5%"
# mute sound
bindsym XF86AudioMute exec --no-startup-id "pactl set-sink-mute 0 toggle"
Utilities
Some utilities that are useful to keep in mind, specially at console.
Image viewers
sxiv
Simple X Image Viewer. The primary goal of sxiv is to create an image viewer, which only has the most basic features required for fast image viewing
sudo apt install sxiv sxiv <image>
feh
There is a lightweight image viewer for the terminal: feh.
sudo apt install feh feh <image>
Also useful for setting up a wallpaper, in i3 config:
exec --no-startup-id feh --bg-fill /path/to/wallpaper.jpg
Live USB creator
Creating usb disk from iso
files:
usb-creator-gtk
unetbootin
PDF viewer
qpdfview is a tabbed document viewer.
It uses Poppler for PDF support, libspectre for PS support, DjVuLibre for DjVu support, CUPS for printing support and the Qt toolkit for its interface.
To install it: sudo apt install qpdfview
Printing
See which printers are available: lpstat -p -d
To configure CUPS printers using a graphical interface: system-config-printers
Print files from command line: lpr command: lpr < file >
TODO
Add resources monitor like conky.
References
- Official user guide: https://i3wm.org/docs/userguide.html
- Full list of XF86 key codes: https://cgit.freedesktop.org/xorg/proto/x11proto/tree/XF86keysym.h
- Find out IP addresses from MACs in a Local Area NetworkMay 10, 2023
- Choose any key as the modifier in i3wm in 6 stepsJanuary 20, 2021
- Adding a swap memory to Linux from command line in 6 stepsApril 2, 2020
- Free up space in Linux (Ubuntu)March 27, 2020
- Switch between languages in Linux. Write in multiple languages with same keyboard.March 21, 2020
- How to make Ubuntu display emojisFebruary 12, 2020
- Detect and mount USB devices in Linux from consoleJanuary 24, 2019
- How to make screencasts in Ubuntu LinuxJanuary 21, 2019
- Using i3 window manager in Linux
- Setting Up A Fresh Linux ServerAugust 25, 2018
- How To Download A Website With Wget The Right WayJune 30, 2017
- Replicate Installed Package Selections From One Ubuntu System To AnotherApril 24, 2017
- Using Clamav Antivirus In UbuntuJanuary 25, 2017
- How to Type Spanish Characters, Accents and Symbols in LinuxJune 6, 2016
Ubuntu
- How to activate tap to click touchpad's feature in Ubuntu in 4 stepsMarch 4, 2021
- Difference between suspend and hibernate in Ubuntu and how to execute them from command lineApril 12, 2020
- Solving Google Chrome's gpu-process error message in Ubuntu LinuxJanuary 7, 2019
- Solving Google Chrome's secret service operation error message in Ubuntu LinuxJanuary 7, 2019
- Start Emacs In Ubuntu The Right WayJune 10, 2017
Unix Shell
- Connect to a Bluetooth device from command line in Ubuntu LinuxJune 23, 2020
- Add Infolinks Script To An Existing Website From Console With Sed CommandApril 4, 2017
- How to change all files permissions to 644 and directories to 755January 10, 2017
- Shell Redirect Output And Errors To The Null Device In BashDecember 9, 2016
- Prevent Running Of Duplicate Cron JobsDecember 8, 2016
- Delete All Backup Files Recursively In BashNovember 28, 2016
- Bash Script to Find Out If MySQL Is Running Or NotNovember 9, 2016
Articles
Subcategories
Except as otherwise noted, the content of this page is licensed under CC BY-NC-ND 4.0 . Terms and Policy.
Powered by SimpleIT Hugo Theme
·