{"id":6951,"date":"2020-09-27T21:22:33","date_gmt":"2020-09-27T18:22:33","guid":{"rendered":"https:\/\/kifarunix.com\/?p=6951"},"modified":"2024-03-14T22:53:34","modified_gmt":"2024-03-14T19:53:34","slug":"install-and-setup-i3-windows-manager-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/kifarunix.com\/install-and-setup-i3-windows-manager-on-ubuntu-20-04\/","title":{"rendered":"Install and Setup i3 Windows Manager on Ubuntu 20.04"},"content":{"rendered":"\n<p>Welcome to our tutorial on how to install i3 windows manager on Ubuntu 20.04. i3 is a <a href=\"https:\/\/en.wikipedia.org\/wiki\/Tiling_window_manager\" target=\"_blank\" rel=\"noreferrer noopener\">tiling window manager<\/a> for X11. <em>&#8220;A&nbsp;<strong>tiling window manager<\/strong>&nbsp;is a&nbsp;window manager&nbsp;with an organization of the screen into mutually non-overlapping frames, as opposed to the more popular approach of coordinate-based stacking of overlapping objects (windows) that tries to fully emulate the&nbsp;desktop metaphor.&#8221;<\/em><\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Installing i3 Windows Manager on Ubuntu 20.04<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\">Run System Update<\/h3>\n\n\n\n<p>To begin with, run system package update.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt update<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\"><a href=\"#install-i3-on-ubuntu-20.04\">Install i3 on Ubuntu 20.04<\/a><\/h3>\n\n\n\n<p>i3 windows manager can be installed via the <code>i3<\/code> package which is available on the default Ubuntu 20.04 repos.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt show i3<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code>\nPackage: i3\nVersion: 4.17.1-1\nPriority: optional\nSection: universe\/x11\nSource: i3-wm\nOrigin: Ubuntu\nMaintainer: Ubuntu Developers <ubuntu-devel-discuss@lists.ubuntu.com>\nOriginal-Maintainer: Michael Stapelberg <stapelberg@debian.org>\nBugs: https:\/\/bugs.launchpad.net\/ubuntu\/+filebug\nInstalled-Size: 20.5 kB\nDepends: i3-wm (= 4.17.1-1)\nRecommends: i3lock (>= 2.2), suckless-tools, i3status (>= 2.3), dunst\nHomepage: https:\/\/i3wm.org\/\nDownload-Size: 1,996 B\nAPT-Sources: http:\/\/ke.archive.ubuntu.com\/ubuntu focal\/universe amd64 Packages\n<\/code><\/pre>\n\n\n\n<p>There are other tools that are needed to use the i3 window manager efficiently. These include;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code><strong>i3 window manager<\/strong><\/code>: The i3-wm itself<\/li>\n\n\n\n<li><code><strong>i3lock<\/strong><\/code> screen locker<\/li>\n\n\n\n<li><code><strong>i3status<\/strong><\/code> for system information<\/li>\n\n\n\n<li><strong><code>suckless-tools<\/code><\/strong> for dmenu<\/li>\n<\/ul>\n\n\n\n<p>These packages are installed along with the i3 meta package.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Install i3 WM from Ubuntu\/Debian Repos<\/h4>\n\n\n\n<p>The current stable version of i3 is 4.18.2. However, if you can check the version provided by the default Ubuntu repos, you realize it is not up-to-date.<\/p>\n\n\n\n<p>To ensure we install and latest version and to ensure seamless updates\/upgrades, create i3-wm repos;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>wget -O- https:\/\/baltocdn.com\/i3-window-manager\/signing.asc | gpg --dearmor &gt; \/etc\/apt\/trusted.gpg.d\/i3wm-signing.gpg<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install apt-transport-https --yes<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>echo \"deb https:\/\/baltocdn.com\/i3-window-manager\/i3\/i3-autobuild\/ all main\" | sudo tee \/etc\/apt\/sources.list.d\/i3-autobuild.list<\/code><\/pre>\n\n\n\n<p>Update your package sources lists.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt update<\/code><\/pre>\n\n\n\n<p>You should now be able to install latest version of i3-wm by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install i3<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"-configure-i3wm-ubuntu-20.04\"><a href=\"#configure-i3wm-ubuntu-20.04\">Configuring i3 Windows Manager on Ubuntu 20.04<\/a><\/h3>\n\n\n\n<p>Once the installation is done, you can now proceed to configure i3-wm on Ubuntu 20.04.<\/p>\n\n\n\n<p>First, log out of your system and log in again. While logging in, be sure to select &nbsp;i3 session as your login screen.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"805\" height=\"603\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-session.png\" alt=\"Install and Setup i3 Windows Manager on Ubuntu 20.04\" class=\"wp-image-7042\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-session.png?v=1601229311 805w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-session-768x575.png?v=1601229311 768w\" sizes=\"(max-width: 805px) 100vw, 805px\" \/><\/figure><\/div>\n\n\n<p>Upon successfully logging in, you are then prompted on whether to:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>auto-generate an i3-wm configuration file, <code><strong>~\/.config\/i3\/config<\/strong><\/code> or <\/li>\n\n\n\n<li>simply use the default configuration file.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"684\" height=\"275\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/gen-i3-wm-config.png\" alt=\"\" class=\"wp-image-7041\" title=\"\"><\/figure><\/div>\n\n\n<p>In this setup, we will go with the first option of having to auto generate the i3-wm configuration file. We will later modify it to suit our needs. Therefore, press <strong>ENTER<\/strong> and continue.<\/p>\n\n\n\n<p>Next, you need to define the i3-wm modifier key ($mod). You have two options here: you can use the <code><strong>Windows&nbsp;logo&nbsp;key<\/strong><\/code> or the<code><strong> Alt key<\/strong><\/code>. In this setup, we will use the popular $mod key, the&nbsp;<em><code>Windows&nbsp;logo&nbsp;key<\/code><\/em> as our i3-wm modifier, and is selected by default. Use the arrow up or down keys to select the <strong>$mod<\/strong> keys.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"647\" height=\"290\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/mod-key.png\" alt=\"\" class=\"wp-image-7043\" title=\"\"><\/figure><\/div>\n\n\n<p>Write the changes by pressing <strong>ENTER<\/strong>.<\/p>\n\n\n\n<p>And you should now be welcomed by black screen with some status bar at the bottom that resembles the one shown in the screenshot below;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1912\" height=\"243\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-wm-default-status-bar.png\" alt=\"\" class=\"wp-image-7044\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-wm-default-status-bar.png?v=1601229441 1912w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-wm-default-status-bar-768x98.png?v=1601229441 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-wm-default-status-bar-1536x195.png?v=1601229441 1536w\" sizes=\"(max-width: 1912px) 100vw, 1912px\" \/><\/figure>\n\n\n\n<h4 class=\"wp-block-heading\">Basic Usage of i3<\/h4>\n\n\n\n<p>Now that it is installed with the basic configuration setup, there are a few key combinations that can be used to perform some basic tasks;<\/p>\n\n\n\n<p>Note that $mod represents the modifier key you selected. Either Alt or Win key. <strong>It is Win key on our setup<\/strong>.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Open a terminal: <code><strong>$mod + ENTER<\/strong><\/code>.<\/li>\n\n\n\n<li>Launching system applications via the dmenu: <strong><code>$mod + d<\/code><\/strong>. This opens up a menu at the top of the screen where you can put keywords to search for specific app.<\/li>\n\n\n\n<li>Enter a fullscreen&nbsp;mode on and off: <code><strong>$mod + f<\/strong><\/code>.<\/li>\n\n\n\n<li>Closing an application window; <code><strong>$mod + Shift + q<\/strong><\/code><\/li>\n\n\n\n<li>Restarting i3: <code><strong>$mod + Shift + r<\/strong><\/code>.<\/li>\n\n\n\n<li>Exiting i3 windows manager: <code><strong>$mod + Shift + e<\/strong><\/code>.<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\">Customizing i3 on Ubuntu 20.04<\/h4>\n\n\n\n<p>Next, we want to make i3 appealing and easy to use. You can customize i3-wm by modifying the <code><strong>~\/.config\/i3\/config<\/strong><\/code> file.<\/p>\n\n\n\n<p>Below is our sample i3 wm configuration;<\/p>\n\n\n\n<pre class=\"scroll-box\"><code># Please see http:\/\/i3wm.org\/docs\/userguide.html for a complete reference!\n#\n\nset_from_resource $darkred     color1  #000000\nset_from_resource $red         color9  #000000\nset_from_resource $darkgreen   color2  #000000\nset_from_resource $green       color10 #000000\nset_from_resource $darkyellow  color3  #000000\nset_from_resource $yellow      color11 #000000\nset_from_resource $darkblue    color4  #000000\nset_from_resource $blue        color12 #000000\nset_from_resource $darkmagenta color5  #000000\nset_from_resource $magenta     color13 #000000\nset_from_resource $darkcyan    color6  #000000\nset_from_resource $cyan        color14 #000000\nset_from_resource $darkwhite   color7  #000000\nset_from_resource $white       color15 #000000\n\n# Use custom colors for black\n set $black       #282828\n set $darkblack   #1d2021\n set $transparent #00000000\n\nset $mod Mod4\nset $mod1 Mod1\nset $terminator terminator\n\n\n# Font for window titles. Will also be used by the bar unless a different font\n# is used in the bar {} block below.\nfont pango:monospace 12\n\n# This font is widely installed, provides lots of unicode glyphs, right-to-left\n# text rendering and scalability on retina\/hidpi displays (thanks to pango).\n\nfont pango:DejaVu Sans Mono 12\n#font pango:Meslo LG L Regular Nerd Font Complete 15\n\n# Use Mouse+$mod to drag floating windows to their wanted position\nfloating_modifier $mod\n\n# start a terminator by pressing Mod key + x or ENTER\nbindsym $mod+Return exec $terminator\nbindsym $mod+x exec $terminator\n\n# Custom bindsyms\nbindsym $mod+p exec ~\/.config\/i3\/bin\/logout\nbindsym $mod+l exec i3lock -i \/home\/koromicha\/Pictures\/linuxtux.png\nbindsym $mod+c exec google-chrome\nbindsym $mod+r mode \"resize\"\nbindsym $mod+Shift+f exec \/home\/koromicha\/.config\/i3\/bin\/rofifinder\n\n\n# Enable Print Screen\n#bindsym --release $mod+Print exec gnome-screenshot -i\nbindsym --release $mod+Print exec shutter -s\n\n# kill focused window\nbindsym $mod+q kill\n\n# start dmenu (a program launcher)\nbindsym $mod+d exec --no-startup-id ~\/.config\/i3\/bin\/rofi_app_launcher\n\n\n# change focus\nbindsym $mod+j focus left\nbindsym $mod+k focus down\n# bindsym $mod+l focus up\nbindsym $mod+semicolon focus right\n\n# alternatively, you can use the cursor keys:\nbindsym $mod+Left focus left\nbindsym $mod+Down focus down\nbindsym $mod+Up focus up\nbindsym $mod+Right focus right\n\n# move focused window\nbindsym $mod+Shift+j move left\nbindsym $mod+Shift+k move down\nbindsym $mod+Shift+l move up\nbindsym $mod+Shift+semicolon move right\n\n# alternatively, you can use the cursor keys:\nbindsym $mod+Shift+Left move left\nbindsym $mod+Shift+Down move down\nbindsym $mod+Shift+Up move up\nbindsym $mod+Shift+Right move right\n\n\n# split in horizontal orientation\nbindsym $mod+h split h\n\n# split in vertical orientation\nbindsym $mod+v split v\n\n# enter fullscreen mode for the focused container\nbindsym $mod+f fullscreen toggle\n\n# change container layout (stacked, tabbed, toggle split)\nbindsym $mod+s layout stacking\n#bindsym $mod+w layout tabbed\nbindsym $mod+t layout tabbed\nbindsym $mod+e layout toggle split\n\n# toggle tiling \/ floating\nbindsym $mod+Shift+space floating toggle\n\n# change focus between tiling \/ floating windows\nbindsym $mod+space focus mode_toggle\n\n# focus the parent container\nbindsym $mod+a focus parent\n# focus the child container\nbindsym $mod+z focus child\n\n# Workspace Variables\nset $ws1 \"1:<i class=\"fab fa-linux\"><\/i> \"\n#set $ws2 \"2:<i class=\"fa fa-firefox\" aria-hidden=\"true\"><\/i> \"\nset $ws2 \"2:<i class=\"fab fa-chrome\"><\/i> \"\nset $ws3 \"3:<i class=\"fa fa-book\" aria-hidden=\"true\"><\/i> \"\nset $ws4 \"4:<i class=\"fa fa-folder-open-o\" aria-hidden=\"true\"><\/i> \"\nset $ws5 \"5:<i class=\"fa fa-desktop\" aria-hidden=\"true\"><\/i> \"\nset $ws6 \"6:<i class=\"fa fa-skype\" aria-hidden=\"true\"><\/i>\"\nset $ws7 \"7:<i class=\"fa fa-envelope-o\" aria-hidden=\"true\"><\/i>\"\nset $ws8 \"8:<i class=\"fa fa-windows\" aria-hidden=\"true\"><\/i> \"\nset $ws9 \"9:<i class=\"fa fa-play-circle-o\" aria-hidden=\"true\"><\/i> \"\n\n\n# switch to workspace\nbindsym $mod+1 workspace $ws1\nbindsym $mod+2 workspace $ws2\nbindsym $mod+3 workspace $ws3\nbindsym $mod+4 workspace $ws4\nbindsym $mod+5 workspace $ws5\nbindsym $mod+6 workspace $ws6\nbindsym $mod+7 workspace $ws7\nbindsym $mod+8 workspace $ws8\nbindsym $mod+9 workspace $ws9\nbindsym $mod+0 workspace $ws10\n\n# move focused container to workspace\nbindsym $mod+Shift+1 move container to workspace $ws1\nbindsym $mod+Shift+2 move container to workspace $ws2\nbindsym $mod+Shift+3 move container to workspace $ws3\nbindsym $mod+Shift+4 move container to workspace $ws4\nbindsym $mod+Shift+5 move container to workspace $ws5\nbindsym $mod+Shift+6 move container to workspace $ws6\nbindsym $mod+Shift+7 move container to workspace $ws7\nbindsym $mod+Shift+8 move container to workspace $ws8\nbindsym $mod+Shift+9 move container to workspace $ws9\nbindsym $mod+Shift+0 move container to workspace $ws10\n\n# reload the configuration file\nbindsym $mod+Shift+c reload\n# restart i3 inplace\nbindsym $mod+Shift+r restart\n# exit i3 (logs you out of your X session)\nbindsym $mod+Shift+e exec \"i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\"\n\n# resize window (you can also use the mouse for that)\nmode \"resize\" {\n        # These bindings trigger as soon as you enter the resize mode\n\n        # Pressing left will shrink the window\u2019s width.\n        # Pressing right will grow the window\u2019s width.\n        # Pressing up will shrink the window\u2019s height.\n        # Pressing down will grow the window\u2019s height.\n        bindsym j resize shrink width 10 px or 10 ppt\n        bindsym k resize grow height 10 px or 10 ppt\n        bindsym l resize shrink height 10 px or 10 ppt\n        bindsym semicolon resize grow width 10 px or 10 ppt\n\n        # same bindings, but for the arrow keys\n        bindsym Left resize shrink width 10 px or 10 ppt\n        bindsym Up resize grow height 10 px or 10 ppt\n        bindsym Down resize shrink height 10 px or 10 ppt\n        bindsym Right resize grow width 10 px or 10 ppt\n\n        # back to normal: Enter or Escape\n        bindsym Return mode \"default\"\n        bindsym Escape mode \"default\"\n}\n#\n# Pulse Audio controls\n# run pactl list sinks\n#bindsym XF86AudioRaiseVolume exec --no-startup-id pactl set-sink-volume 0 +5% #increase sound volume\n#bindsym XF86AudioLowerVolume exec --no-startup-id pactl set-sink-volume 0 -5% #decrease sound volume#\n#bindsym XF86AudioMute exec --no-startup-id pactl set-sink-mute 1 toggle # mute sound\n\n# Amixer\n\nbindsym XF86AudioRaiseVolume exec --no-startup-id amixer -D pulse sset Master 5%+ #increase sound volume\nbindsym XF86AudioLowerVolume exec --no-startup-id amixer -D pulse sset Master 5%- #decrease sound volume#\nbindsym XF86AudioMute exec --no-startup-id amixer -q set Master toggle # mute sound\n\n# Sreen brightness controls\n# enable passwordless sudo for ybacklight. echo \"koromicha ALL=NOPASSWD: \/usr\/bin\/ybacklight\" &gt; \/etc\/sudoers.d\/ybacklight\nbindsym XF86MonBrightnessUp exec sudo ybacklight -inc 5 # increase screen brightness\nbindsym XF86MonBrightnessDown exec sudo ybacklight -dec 5 # decrease screen brightness\n\n# i3blocks\nbar {\n    status_command i3blocks\n    position top\n    font pango:Hack, FontAwesome 11\n\n    colors {\n        separator #081419\n        background #253941\n        #statusline #839496\n        focused_workspace #fdf6e3 #6c71c4 #fdf6e3\n        active_workspace #fdf6e3 #6c71c4 #fdf6e3\n        inactive_workspace #002b36 #586e75 #002b36\n        urgent_workspace #d33682 #d33682 #fdf6e3\n\n        statusline         $white\n        separator          $transparent\n  }\n}\n\n\nset $m1 #808080 \nset $m2 #FFF0E0\n\n# Startup programs\nexec --no-startup-id dunst \nexec_always compton &amp;;\nexec --no-startup-id clipit &amp;; \nexec_always feh --bg-scale \/home\/koromicha\/Pictures\/linux-wallpaper.jpg\nexec_always --no-startup-id nm-applet\n\n\n# Bind App to workspace\n# Check class by using xprop command\nassign [class=\"chromium\"] $ws2\nassign [class=\"Firefox\"] $ws2\nassign [class=\"Atom\"] $ws3\nassign [class=\"Foxit Reader\"] $ws3\nassign [class=\"Pcmanfm\"] $ws4\nassign [class=\"VirtualBox\"] $ws5\nassign [class=\"Virt-manager\"] $ws5\nassign [class=\"Skype\"] $ws6\nassign [class=\"mpv\"] $ws9\nassign [class=\"vlc\"] $ws9\nassign [class=\"Thunderbird\"] $ws7\nassign [class=\"(?i)libreoffice-startcenter\"] $ws8\nassign [class=\"(?i)soffice\"] $ws8\nassign [class=\"(?i)libreoffice\"] $ws8\n\n\n# Assign to certain workspace\nassign [window_role=\"browser\"] $ws2\n\n# Press $mod+o followed by either f, s, l, m, v, k, d, t, Esc or Return {ENTER),\n# to launch FoxiReader, Skype, lxappearance, thunderbird, VirtualBox,\n# KVM Virt-manager, spectacle, pcmanfm file manager, \n# or return to the default mode, respectively.\nset $mode_launcher Launcher\nbindsym $mod+o mode \"$mode_launcher\"\n\nmode \"$mode_launcher\" {\n    bindsym f exec FoxitReader \n    bindsym s exec skypeforlinux\n    bindsym l exec lxappearance  \n    bindsym m exec thunderbird  \n    bindsym v exec VirtualBox \n    bindsym k exec virt-manager \n    bindsym d exec spectacle \n    bindsym t exec \"pcmanfm \/home\/koromicha\"\n\n    bindsym Esc mode \"default\"\n    bindsym Return mode \"default\"\n}\n\n# Shutdown, Reboot, Lock Screen, and Logout \n\nset $power_mode \"power\"\nbindsym $mod+Shift+q      mode $power_mode\nmode $power_mode {\n    bindsym p         exec systemctl poweroff\n    bindsym r         exec systemctl reboot \n    bindsym l         exec i3lock -i \/home\/koromicha\/Pictures\/linuxtux.png, mode \"default\"\n    bindsym q         exec --no-startup-id i3-msg exit, mode \"default\"\n    bindsym h         exec sudo systemctl hibernate \n    bindsym s         exec sudo systemctl suspend\n    bindsym Return    mode \"default\"\n    bindsym Escape    mode \"default\"\n}\n\n# Floating windows\nfor_window [window_role=\"task_dialog|bubble|page-info|Preferences|pop-up\"] floating enable\nfor_window [window_role=\"Open Files\"] floating enable sticky\nfor_window [window_role=\"File Operation Progress\"] floating enable sticky\nfor_window [class=\"qBittorrent\" window_role=\"pop-up\"] floating enable\nfor_window [window_type=\"dialog\"] floating enable\nfor_window [window_type=\"menu\"] floating enable\n\n# Sticky window\nfor_window [instance=\"file_progress\"]  sticky enable\nfor_window [class=\"info|Mate-color-select|gcolor2|timesup|QtPass|GtkFileChooserDialog\"] sticky enable\n\n# Focus window settings\nno_focus [window_role=\"pop-up\"]\nfocus_on_window_activation focus\n<\/code><\/pre>\n\n\n\n<p>The above configuration gives us such a window;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1919\" height=\"184\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/general-i3-wm.png\" alt=\"\" class=\"wp-image-7045\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/general-i3-wm.png?v=1601229485 1919w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/general-i3-wm-768x74.png?v=1601229485 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/general-i3-wm-1536x147.png?v=1601229485 1536w\" sizes=\"(max-width: 1919px) 100vw, 1919px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">What is needed for the above<\/h3>\n\n\n\n<h4 class=\"wp-block-heading\">Install Requires packages<\/h4>\n\n\n\n<p>A number of packages are requires for the above display and various shortcuts defined in the configuration file above;<\/p>\n\n\n\n<pre id=\"block-3c086b49-2d4e-4e03-b792-b13cff36c558\" class=\"wp-block-code\"><code>apt install feh fonts-font-awesome rofi pulseaudio-utils xbacklight alsa-tools clipit gcc git terminator locate pcmanfm acpi libnotify-bin htop<\/code><\/pre>\n\n\n\n<p>Install ybacklight for controlling the screen brightness if xbacklight doesn&#8217;t work;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>git clone https:\/\/github.com\/szekelyszilv\/ybacklight.git\ncd ybacklight\/src\ngcc ybacklight.c -o \/usr\/bin\/ybacklight<\/code><\/pre>\n\n\n\n<p>Install Shutter for screenshots;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo add-apt-repository -y -u ppa:linuxuprising\/shutter\napt install shutter<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Install i3 Logout Script<\/h4>\n\n\n\n<p>As defined the i3 configuration above, log out script, which gives such an logout interface shown below upon pressing <strong><code>$mod+p<\/code><\/strong> key combination, is installed under, <code><strong>~\/.config\/i3\/bin\/logout<\/strong><\/code>.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"608\" height=\"557\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/logout-screen.png\" alt=\"\" class=\"wp-image-7046\" title=\"\"><\/figure><\/div>\n\n\n<p>Create the i3 binary scripts directory and install the logout script.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mkdir ~\/.config\/i3\/bin\/\nvim ~\/.config\/i3\/bin\/logout<\/code><\/pre>\n\n\n\n<pre class=\"scroll-sz\"><code>#!\/usr\/bin\/env bash\n# Manage logout with rofi\noption=`echo -e \"suspend\\nlock screen\\nlogout\\nreboot\\npoweroff\\nKill user $USER\" | rofi -width 600 -dmenu -p system:`\ncase $option in\n    suspend)\n        sudo  \/usr\/bin\/systemctl syspend\n        ;;\n    'lock screen')\n        i3lock -i \/home\/koromicha\/Pictures\/linuxtux.png\n        ;;\n    logout)\n        i3-nagbar -t warning -m 'Are you sure you  want to exit i3? This will end your X session.' -b 'Yes, exit i3' 'i3-msg exit'\n        ;;\n    reboot)\n        \/usr\/bin\/systemctl reboot\n        ;;\n    poweroff)\n        \/usr\/bin\/systemctl poweroff\n        ;;\n    'kill user $USER')\n        loginctl kill-user $USER\n        ;;\nesac\n<\/code><\/pre>\n\n\n\n<p>NB: The script is a modified version of the logout script provided on the <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/jmutai\/dotfiles\/blob\/master\/.config\/i3\/bin\" target=\"_blank\">Jmutai dotfiles<\/a> github repository.Be sure to make the script executable;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>chmod +x ~\/.config\/i3\/bin\/logout<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Search and Locate Files using Rofi<\/h4>\n\n\n\n<p>The rofi can be used to search for and locate files and folders within your system. Below is the rofi finder script we use;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim ~\/.config\/i3\/bin\/rofifinder<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\nxdg-open \"$(locate -i \/ | rofi -threads 0 -width 100 -dmenu -i -p \"Find\")\"<\/code><\/pre>\n\n\n\n<p>The rofi finder can be launched, as per our config, by pressing <code><strong>$mod+Shift+f<\/strong><\/code> key combination. This is how it looks like;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1909\" height=\"555\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/rofifinder.png\" alt=\"Rofi finder Ubuntu 20.04\" class=\"wp-image-7047\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/rofifinder.png?v=1601229686 1909w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/rofifinder-768x223.png?v=1601229686 768w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/rofifinder-1536x447.png?v=1601229686 1536w\" sizes=\"(max-width: 1909px) 100vw, 1909px\" \/><\/figure>\n\n\n\n<p>Note that the script uses <code>locate<\/code> command. There install it, if not already install, and update the mlocate database;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>apt install mlocate &amp;&amp; updatedb<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Launching System Apps using Rofi<\/h4>\n\n\n\n<p>You can as well configure rofi to launch your system applications with i3-dmenu-desktop. Below is the script used in this guide to launch system apps;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim ~\/.config\/i3\/bin\/rofi_app_launcher<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/env bash\n# Run rofi app launcher\ni3-dmenu-desktop --dmenu=\"rofi -dmenu -i -p 'apps'\"<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>chmod +x ~\/.config\/i3\/bin\/rofi_app_launcher<\/code><\/pre>\n\n\n\n<p>The i3 configuration for rofi app launcher is;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># start dmenu (a program launcher)\nbindsym $mod+d exec --no-startup-id ~\/.config\/i3\/bin\/rofi_app_launcher<\/code><\/pre>\n\n\n\n<p>The shortcut for launching the rofi app launcher as per our config is, <strong><code>$mod+d<\/code><\/strong>. See sample launch menu screen;<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"967\" height=\"556\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/rofi_app_launcher.png\" alt=\"rofi app launcher\" class=\"wp-image-7048\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/rofi_app_launcher.png?v=1601229740 967w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/rofi_app_launcher-768x442.png?v=1601229740 768w\" sizes=\"(max-width: 967px) 100vw, 967px\" \/><\/figure><\/div>\n\n\n<p>To customize the rofi window, use <code><strong>rofi-theme-selector<\/strong><\/code>.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">Other customizations;<\/h4>\n\n\n\n<p>Enable Print Screen using shutter<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Enable Print Screen\n#bindsym --release $mod+Print exec gnome-screenshot -i\nbindsym --release $mod+Print exec shutter -s<\/code><\/pre>\n\n\n\n<p>Killing a focussed windows;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># kill focused window\nbindsym $mod+q kill<\/code><\/pre>\n\n\n\n<p>Changing Focus between different windows in a Workspace (see the respective key shortcuts);<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code># change focus\nbindsym $mod+j focus left\nbindsym $mod+k focus down\n# bindsym $mod+l focus up\nbindsym $mod+semicolon focus right\n\n# alternatively, you can use the cursor keys:\nbindsym $mod+Left focus left\nbindsym $mod+Down focus down\nbindsym $mod+Up focus up\nbindsym $mod+Right focus right\n\n# move focused window\nbindsym $mod+Shift+j move left\nbindsym $mod+Shift+k move down\nbindsym $mod+Shift+l move up\nbindsym $mod+Shift+semicolon move right\n\n# alternatively, you can use the cursor keys:\nbindsym $mod+Shift+Left move left\nbindsym $mod+Shift+Down move down\nbindsym $mod+Shift+Up move up\nbindsym $mod+Shift+Right move right\n<\/code><\/pre>\n\n\n\n<p>Splitting a Window vertically (<strong>$mod+v<\/strong>) or horizontally (<strong>$mod+h<\/strong>);<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># split in horizontal orientation\nbindsym $mod+h split h\n\n# split in vertical orientation\nbindsym $mod+v split v<\/code><\/pre>\n\n\n\n<p>Set a window in a full screen mode (<strong>$mod+f<\/strong>);<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># enter fullscreen mode for the focused container\nbindsym $mod+f fullscreen toggle<\/code><\/pre>\n\n\n\n<p>Set a window to tiling or floating mode (<strong><code>$mod+Shift+space<\/code><\/strong>);<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># toggle tiling \/ floating\nbindsym $mod+Shift+space floating toggle<\/code><\/pre>\n\n\n\n<p>Changing the focus of the parent or child window;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># focus the parent container\nbindsym $mod+a focus parent\n# focus the child container\nbindsym $mod+z focus child<\/code><\/pre>\n\n\n\n<p>Setting Icons for different Workspaces;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code># Workspace Variables\nset $ws1 \"1:<i class=\"fab fa-linux\"><\/i> \"\n#set $ws2 \"2:<i class=\"fa fa-firefox\" aria-hidden=\"true\"><\/i> \"\nset $ws2 \"2:<i class=\"fab fa-chrome\"><\/i> \"\nset $ws3 \"3:<i class=\"fa fa-book\" aria-hidden=\"true\"><\/i> \"\nset $ws4 \"4:<i class=\"fa fa-folder-open-o\" aria-hidden=\"true\"><\/i> \"\nset $ws5 \"5:<i class=\"fa fa-desktop\" aria-hidden=\"true\"><\/i> \"\nset $ws6 \"6:<i class=\"fa fa-skype\" aria-hidden=\"true\"><\/i>\"\nset $ws7 \"7:<i class=\"fa fa-envelope-o\" aria-hidden=\"true\"><\/i>\"\nset $ws8 \"8:<i class=\"fa fa-windows\" aria-hidden=\"true\"><\/i> \"\n<\/code><\/pre>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"398\" height=\"24\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3workspace-icons.png\" alt=\"\" class=\"wp-image-7050\" title=\"\"><\/figure><\/div>\n\n\n<p>Note we also bind various applications to their respective workspaces;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code># Bind App to workspace\n# Check class by using xprop command\nassign [class=\"chromium\"] $ws2\nassign [class=\"Firefox\"] $ws2\nassign [class=\"Atom\"] $ws3\nassign [class=\"Foxit Reader\"] $ws3\nassign [class=\"Pcmanfm\"] $ws4\nassign [class=\"VirtualBox\"] $ws5\nassign [class=\"Virt-manager\"] $ws5\nassign [class=\"Skype\"] $ws6\nassign [class=\"mpv\"] $ws9\nassign [class=\"vlc\"] $ws9\nassign [class=\"Thunderbird\"] $ws7\nassign [class=\"(?i)libreoffice-startcenter\"] $ws8\nassign [class=\"(?i)soffice\"] $ws8\nassign [class=\"(?i)libreoffice\"] $ws8\n\n\n# Assign to certain workspace\nassign [window_role=\"browser\"] $ws2\n<\/code><\/pre>\n\n\n\n<h5 class=\"wp-block-heading\">Set i3 Wallpaper<\/h5>\n\n\n\n<p>First off, let us set a wallpaper. i3 wallpaper can be set using <code>feh<\/code>, a light-weight, configurable and versatile image viewer. Run the command on terminal.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>feh --bg-scale <strong>\/path\/to\/wallpaper.jpg<\/strong><\/code><\/pre>\n\n\n\n<p>This should automatically change  your wallpaper. To ensure that the wallpaper is set always when you login to your i3 session, edit the <strong>~\/.config\/i3\/config<\/strong> and set the correct path to your wallpaper image;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>exec_always feh --bg-scale <strong>\/path\/to\/wallpaper.jpg<\/strong><\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">Configure i3blocks<\/h4>\n\n\n\n<p><a href=\"https:\/\/github.com\/vivien\/i3blocks\" target=\"_blank\" rel=\"noreferrer noopener\">i3blocks<\/a> is an alternative to i3status. i3blocks is available on the default Ubuntu 20.04 repos. Install i3blocks and it by running the command below;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt install i3blocks<\/code><\/pre>\n\n\n\n<p>Next, configure i3 to use i3blocks instead of i3status by replacing the i3 <code>bar {}<\/code> section with the configs below;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code># i3blocks\nbar {\n    status_command i3blocks\n    position top\n    font pango:Hack, FontAwesome 11\n\n    colors {\n        separator #081419\n        background #253941\n        #statusline #839496\n        focused_workspace #fdf6e3 #6c71c4 #fdf6e3\n        active_workspace #fdf6e3 #6c71c4 #fdf6e3\n        inactive_workspace #002b36 #586e75 #002b36\n        urgent_workspace #d33682 #d33682 #fdf6e3\n\n        statusline         $white\n        separator          $transparent\n  }\n}\n<\/code><\/pre>\n\n\n\n<p>This should change the i3 status bar. You as well need i3blocks blocklets. <em>&#8220;A blocklet is the configuration of a single block, part of the status line&#8221;<\/em>. You can find a comprehensive list of blocklets in the&nbsp;<a href=\"https:\/\/vivien.github.io\/i3blocks\/blocklets\" target=\"_blank\" rel=\"noopener\">blocklets page<\/a>. In my setup, most of the scripts are taken from <a rel=\"noreferrer noopener\" href=\"https:\/\/github.com\/vivien\/i3blocks-contrib\" target=\"_blank\">vivien blocklets<\/a>.<\/p>\n\n\n\n<p>Before you can proceed to get the blocklets scripts, edit the i3blocks.conf to define your icon fonts. <a href=\"https:\/\/fontawesome.com\/v4.7.0\/icons\/\" target=\"_blank\" rel=\"noreferrer noopener\">Font-Awesome<\/a> icons are used in this guide;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>vim \/etc\/i3blocks.conf<\/code><\/pre>\n\n\n\n<pre class=\"scroll-box\"><code># i3blocks config file\n#\n# Please see man i3blocks for a complete reference!\n# The man page is also hosted at http:\/\/vivien.github.io\/i3blocks\n#\n# List of valid properties:\n#\n# align\n# color\n# command\n# full_text\n# instance\n# interval\n# label\n# min_width\n# name\n# separator\n# separator_block_width\n# short_text\n# signal\n# urgent\n\n# Global properties\n#\n# The top properties below are applied to every block, but can be overridden.\n# Each block command defaults to the script name to avoid boilerplate.\ncommand=~\/.config\/i3\/blocklets\/$BLOCK_NAME\nseparator=false\nseparator_block_width= 10\nmarkup=pango\nalign=right\n\n# RAM usage\n[memory]\ninterval=1\nlabel=<i class=\"fa fa-tachometer\"><\/i> \ncolor=#4CAF50\n\n# CPU Usage\n[cpu_usage]\nlabel= <i class=\"fa fa-crosshairs\" aria-hidden=\"true\"><\/i>\ninterval=2\ncolor=#87AFAF\n\n# \/home Partition Usage\n[disk-home]\nlabel=<i class=\"fa fa-home\" aria-hidden=\"true\"><\/i>:\ninterval=30\ncolor=#586E75\n\n# Network Interface IP\n[iface]\ncolor=#B4B7B4\ninterval=1\nseparator=false\nlabel= <i class=\"fa fa-exchange\" aria-hidden=\"true\"><\/i>\n\n# Wi-Fi SSID\n[ssid]\nlabel=  <i class=\"fa fa-wifi\" aria-hidden=\"true\"><\/i>\ncolor=#d33682\ninterval=2\n\n#Network Bandwidth\n[bandwidth]\ninterval=1\ncolor=#d33682\n\n# Screen brightness\n[brightness]\nlabel= <i class=\"fa fa-adjust\" aria-hidden=\"true\"><\/i>\ninterval=1\nsignal=2\ncolor=#738899\n\n# Battery level\n[battery]\ninterval=10\n\n# Date and Time Calendar\n[time]\nlabel= <i class=\"fa fa-calendar\"><\/i>\ninterval=1\ncolor=#50C878\n\n# Battery level notification\n[batnotify]\ninterval=10\nseparator_block_width=4\n<\/code><\/pre>\n\n\n\n<p>Create a directory to store the blocklets scripts;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>mkdir ~\/.config\/i3\/blocklets<\/code><\/pre>\n\n\n\n<p>Some of the blocklets that are used in this setup are;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ls .config\/i3\/blocklets\/ -1<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>bandwidth\nbatnotify\nbattery\nbrightness\ncpu_usage\ndisk-home\niface\nmemory\nssid\ntime<\/code><\/pre>\n\n\n\n<p>Below are the scripts contents;<\/p>\n\n\n\n<p>RAM Usage;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code>\n#!\/bin\/sh\n# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>\n\n# This program is free software: you can redistribute it and\/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http:\/\/www.gnu.org\/licenses\/>.\n\nTYPE=\"${BLOCK_INSTANCE:-mem}\"\n\nawk -v type=$TYPE '\n\/^MemTotal:\/ {\n\tmem_total=$2\n}\n\/^MemFree:\/ {\n\tmem_free=$2\n}\n\/^Buffers:\/ {\n\tmem_free+=$2\n}\n\/^Cached:\/ {\n\tmem_free+=$2\n}\n\/^SwapTotal:\/ {\n\tswap_total=$2\n}\n\/^SwapFree:\/ {\n\tswap_free=$2\n}\nEND {\n\tif (type == \"swap\") {\n\t\tfree=swap_free\/1024\/1024\n\t\tused=(swap_total-swap_free)\/1024\/1024\n\t\ttotal=swap_total\/1024\/1024\n\t} else {\n\t\tfree=mem_free\/1024\/1024\n\t\tused=(mem_total-mem_free)\/1024\/1024\n\t\ttotal=mem_total\/1024\/1024\n\t}\n\tpct=used\/total*100\n\n\t# full text\n\tprintf(\"%.1fG\/%.1fG (%.f%%)\\n\", used, total, pct)\n\n\t# short text\n\tprintf(\"%.f%%\\n\", pct)\n\n\t# color\n\tif (pct > 90) {\n\t\tprint(\"#FF0000\\n\")\n\t} else if (pct > 80) {\n\t\tprint(\"#FFAE00\\n\")\n\t} else if (pct > 70) {\n\t\tprint(\"#FFF600\\n\")\n\t}\n}\n' \/proc\/meminfo\n\ncase $BLOCK_BUTTON in\n    1)\n        termite -e  htop\n        ;;\nesac\n<\/code><\/pre>\n\n\n\n<p>CPU Usage script;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code>\n#!\/usr\/bin\/perl\n#\n# Copyright 2014 Pierre Mavro <deimos@deimos.fr>\n# Copyright 2014 Vivien Didelot <vivien@didelot.org>\n# Copyright 2014 Andreas Guldstrand <andreas.guldstrand@gmail.com>\n#\n# Licensed under the terms of the GNU GPL v3, or any later version.\n\nuse strict;\nuse warnings;\nuse utf8;\nuse Getopt::Long;\n\n# default values\nmy $t_warn = 50;\nmy $t_crit = 80;\nmy $cpu_usage = -1;\n\nsub help {\n    print \"Usage: cpu_usage [-w <warning>] [-c <critical>]\\n\";\n    print \"-w <percent>: warning threshold to become yellow\\n\";\n    print \"-c <percent>: critical threshold to become red\\n\";\n    exit 0;\n}\n\nGetOptions(\"help|h\" => \\&help,\n           \"w=i\"    => \\$t_warn,\n           \"c=i\"    => \\$t_crit);\n\n# Get CPU usage\n$ENV{LC_ALL}=\"en_US\"; # if mpstat is not run under en_US locale, things may break, so make sure it is\nopen (MPSTAT, 'mpstat 1 1 |') or die;\nwhile (<MPSTAT>) {\n    if (\/^.*\\s+(\\d+\\.\\d+)\\s+$\/) {\n        $cpu_usage = 100 - $1; # 100% - %idle\n        last;\n    }\n}\nclose(MPSTAT);\n\n$cpu_usage eq -1 and die 'Can\\'t find CPU information';\n\n# Print short_text, full_text\nprintf \"%.2f%%\\n\", $cpu_usage;\nprintf \"%.2f%%\\n\", $cpu_usage;\n\n# Print color, if needed\nif ($cpu_usage >= $t_crit) {\n    print \"#C75D50\\n\";\n    exit 33;\n} elsif ($cpu_usage >= $t_warn) {\n    print \"#D7875F\\n\";\n}\n\nexit 0;\n<\/code><\/pre>\n\n\n\n<p>\/home Partition Usage;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code>\n#!\/bin\/sh\n# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>\n\n# This program is free software: you can redistribute it and\/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http:\/\/www.gnu.org\/licenses\/>.\n\nDIR=\"${BLOCK_INSTANCE:-$HOME}\"\nALERT_LOW=\"${1:-10}\" # color will turn red under this value (default: 10%)\n\ndf -h -P -l \"$DIR\" | awk -v alert_low=$ALERT_LOW '\n\/\\\/.*\/ {\n\t# full text\n\tprint $4\n\n\t# short text\n\tprint $4\n\n\tuse=$5\n\n\t# no need to continue parsing\n\texit 0\n}\n\nEND {\n\tgsub(\/%$\/,\"\",use)\n\tif (100 - use < alert_low) {\n\t\t# color\n\t\tprint \"#FF0000\"\n\t}\n}\n'\n# Mouse settings\ncase $BLOCK_BUTTON in\n    1) i3-msg exec 'caja --browser' ;;    # left click, locate +xdg-open files with rofi\n    3) i3-msg exec ~\/.config\/i3\/bin\/rofi_finder # find files on right click\nesac\n<\/code><\/pre>\n\n\n\n<p>Default route Network Interface IP<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code>\n#!\/bin\/bash\n# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>\n# Copyright (C) 2014 Alexander Keller <github@nycroth.com>\n\n# This program is free software: you can redistribute it and\/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http:\/\/www.gnu.org\/licenses\/>.\n\n#------------------------------------------------------------------------\n\n# Use the provided interface, otherwise the device used for the default route.\nif [[ -n $BLOCK_INSTANCE ]]; then\n  IF=$BLOCK_INSTANCE\nelse\n  IF=$(ip route | awk '\/^default\/ { print $5 ; exit }')\nfi\n\n#------------------------------------------------------------------------\n\n# As per #36 -- It is transparent: e.g. if the machine has no battery or wireless\n# connection (think desktop), the corresponding block should not be displayed.\n[[ ! -d \/sys\/class\/net\/${IF} ]] && exit\n\n#------------------------------------------------------------------------\n\nif [[ \"$(cat \/sys\/class\/net\/$IF\/operstate)\" = 'down' ]]; then\n  echo down # full text\n  echo down # short text\n  echo \\#FF0000 # color\n  exit\nfi\n\ncase $1 in\n  -4)\n    AF=inet ;;\n  -6)\n    AF=inet6 ;;\n  *)\n    AF=inet6? ;;\nesac\n\n# if no interface is found, use the first device with a global scope\nIPADDR=$(ip addr show $IF | perl -n -e \"\/$AF ([^\\\/]+).* scope global\/ && print \\$1 and exit\")\n\ncase $BLOCK_BUTTON in\n    1)\n        termite -e 'ping 8.8.8.8'         ;;\n\n    3) echo -n \"$IPADDR\" | xclip -q -se c \n        ;;\nesac\n\n#------------------------------------------------------------------------\n\necho \"$IPADDR\" # full text\necho \"$IPADDR\" # short text\n<\/code><\/pre>\n\n\n\n<p>Wi-Fi SSID;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/usr\/bin\/env bash\n# Be sure to change the WLAN interface\necho \"$(iw dev wlp0s20f3 link | grep SSID | cut -d \" \" -f 2-)\"<\/code><\/pre>\n\n\n\n<p>Network Bandwidth;<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code>\n#!\/bin\/bash\n\n# Use the provided interface, otherwise the device used for the default route.\nif [[ -n $BLOCK_INSTANCE ]]; then\n  INTERFACE=$BLOCK_INSTANCE\nelse\n  INTERFACE=$(ip route | awk '\/^default\/ { print $5 ; exit }')\nfi\n\n# # if the connection is down, the corresponding block should not be displayed.\nif ! [ -e \"\/sys\/class\/net\/${INTERFACE}\/operstate\" ] || ! [ \"`cat \/sys\/class\/net\/${INTERFACE}\/operstate`\" = \"up\" ]\nthen\n    exit 0\nfi\n\n# path to store the old results in\npath=\"\/dev\/shm\/$(basename $0)-${INTERFACE}\"\n\n# grabbing data for each adapter.\nread rx < \"\/sys\/class\/net\/${INTERFACE}\/statistics\/rx_bytes\"\nread tx < \"\/sys\/class\/net\/${INTERFACE}\/statistics\/tx_bytes\"\n\n# get time\ntime=$(date +%s)\n\n# write current data if file does not exist. Do not exit, this will cause\n# problems if this file is sourced instead of executed as another process.\nif ! [[ -f \"${path}\" ]]; then\n  echo \"${time} ${rx} ${tx}\" > \"${path}\"\n  chmod 0666 \"${path}\"\nfi\n\n# read previous state and update data storage\nread old < \"${path}\"\necho \"${time} ${rx} ${tx}\" > \"${path}\"\n\n# parse old data and calc time passed\nold=(${old\/\/;\/ })\ntime_diff=$(( $time - ${old[0]} ))\n\n# sanity check: has a positive amount of time passed\n[[ \"${time_diff}\" -gt 0 ]] || exit\n\n# calc bytes transferred, and their rate in byte\/s\nrx_diff=$(( $rx - ${old[1]} ))\ntx_diff=$(( $tx - ${old[2]} ))\nrx_rate=$(( $rx_diff \/ $time_diff ))\ntx_rate=$(( $tx_diff \/ $time_diff ))\n\n# shift by 10 bytes to get KiB\/s. If the value is larger than\n# 1024^2 = 1048576, then display MiB\/s instead\n\n# outgoing\ntx_kib=$(( $tx_rate >> 10 ))\nif [[ \"$tx_rate\" -gt 1048576 ]]; then\n    tx_mbs=$(printf '%s' \"`echo \"scale=1; $tx_kib \/ 1024\" | bc`\")\n  echo -n \"${tx_mbs}<span font='8' foreground='#969896'>M<\/span><span foreground='#B294BB'>\u2191<\/span><span font='3' foreground='#282A2E'>.<\/span>\"\nelse\n  echo -n \"${tx_kib}<span font='8' foreground='#969896'>K<\/span><span foreground='#B294BB'>\u2191<\/span><span font='3' foreground='#282A2E'>.<\/span>\"\nfi\n\n# incoming\nrx_kib=$(( $rx_rate >> 10 ))\nif [[ \"$rx_rate\" -gt 1048576 ]]; then\n    rx_mbs=$( printf '%s' \"`echo \"scale=1; $rx_kib \/ 1024\" | bc`\")\n  echo -n \"${rx_mbs}<span font='8' foreground='#969896'>M<\/span><span foreground='#81A2BE'>\u2193<\/span>\"\nelse\n  echo -n \"${rx_kib}<span font='8' foreground='#969896'>K<\/span><span foreground='#81A2BE'>\u2193<\/span>\"\nfi\n\n# mouse buttons  \ncase $BLOCK_BUTTON in\n    1) tm-cli ;; # transmission-remote-cli\n    3) rofi-connm # rofi connection manager \nesac\n<\/code><\/pre>\n\n\n\n<p>System Battery status;<\/p>\n\n\n\n<p>Check the battery instance and replace the value x in <code><strong>BAT<\/strong><\/code>x;<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><code>ls \/sys\/class\/power_supply\/<\/code><\/pre>\n\n\n\n<pre class=\"scroll-sz\"><code>\n!\/bin\/sh\n# Copyright (C) 2014 Julien Bonjean <julien@bonjean.info>\n\n# This program is free software: you can redistribute it and\/or modify\n# it under the terms of the GNU General Public License as published by\n# the Free Software Foundation, either version 3 of the License, or\n# (at your option) any later version.\n\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n\n# You should have received a copy of the GNU General Public License\n# along with this program.  If not, see <http:\/\/www.gnu.org\/licenses\/>.\n\nINSTANCE=\"${1:-BAT1}\"\nALERT_LOW=\"${2:-25}\" # color will turn red under this value (default: 10%)\nUPOWER=\"\/usr\/bin\/upower\"\n\nif [ ! -x \"$UPOWER\" ]; then\n\techo \"upower not found\"\n\texit 1\nfi\n\n$UPOWER -i \/org\/freedesktop\/UPower\/devices\/battery_$INSTANCE |\n\tawk -v alert_low=$ALERT_LOW '\n\/state:\/ {\n\tstate = $2\n}\n\/time to full:\/ {\n\tremaining_time = $4 \" \" substr ($5, 0, 1)\n}\n\/time to empty:\/ {\n\tremaining_time = $4 \" \" substr ($5, 0, 1)\n}\n\/percentage:\/ {\n\tpercentage = $2;\n}\nEND {\n\tif (state == \"charging\")\n        label = \"<i class=\"fa fa-plug\" aria-hidden=\"true\"><\/i>\"\n\telse if (percentage == \"100%\")\n\t\tlabel = \"<i class=\"fa fa-battery-full\" aria-hidden=\"true\"><\/i>\"\n\telse if (percentage > 99)\n\t\tlabel = \"<i class=\"fa fa-battery-full\" aria-hidden=\"true\"><\/i>\"\n\telse if (percentage > 75)\n\t\tlabel = \"<i class=\"fa fa-battery-three-quarters\" aria-hidden=\"true\"><\/i>\"\n\telse if (percentage > 50)\n\t\tlabel = \"<i class=\"fa fa-battery-half\" aria-hidden=\"true\"><\/i>\"\n\telse if (percentage > 25)\n\t\tlabel = \"<i class=\"fa fa-battery-quarter\" aria-hidden=\"true\"><\/i>\"\n    else if (percentage > 10) \n\t\tlabel = \"\uf243\"\n    else if (percentage > 5)  \n\t\tlabel = \"<i class=\"fa fa-battery-empty\" aria-hidden=\"true\"><\/i>\"\n\t\n    # full text & \"$@\" > \/dev\/null;\n    print label \" \" percentage\n\n\t# short text\n\tprint label \" \" percentage\n\n\t# color\n\tgsub(\/%$\/,\"\",percentage)\n    if (percentage == \"100\")\n\t\tprint \"#c5c8c6\"\n    else if (state == \"charging\")\n\t\tprint \"#c5c8c6\"\n    else if (+ percentage < + alert_low)\n        print \"#cc6666\"\n    else if (percentage < 26)\n        print \"#af9f87\"\n    else\n        print \"#7ea3a3\"\n}\n# mouse buttons\ncase $BLOCK_BUTTON in\n  3) toggle-dpms ;; # left click, control DPMS \n  2) toggle-red ;;  # right click, redshift on\/off\n  1) getacpi ;; # dialog with battery info\n  5) sudo brightness up ;; \n  # xbacklight doesn't work with modesetting use brightness script\n  4) sudo brightness down ;; \nesac\n<\/code><\/pre>\n\n\n\n<p>Date and Time Calendar;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#!\/bin\/bash\ndate_time=$(date '+%a %d-%m-%Y %R:%S')\necho \"$date_time\"\n\n#Buttons Control\ncase \"$BLOCK_BUTTON\" in\n    1) exec zenity --calendar\n        ;;\nesac<\/code><\/pre>\n\n\n\n<p>Battery Discharge Notification script. Be sure to replace the battery instance, BATx accordingly.<\/p>\n\n\n\n<pre class=\"scroll-sz\"><code>#!\/bin\/bash\n\n# Battery notifier script for i3\n# First warning is at 30%,  Critical warning less than 15%\n\ndischarge_mode=`acpi -a | grep -o off`\n\n# Get current battery level and set threshold\nbattery_level=$(cat \/sys\/class\/power_supply\/BAT1\/capacity)\ncritical_value=15\nwarning_value=30\n\n# Messages to print to notification\nmessage=\"*** Battery level is ${battery_level}%, critical, sleeping in 30 seconds time ***\"\nwarn_message=\"*** Battery level is ${battery_level}%, warning, connect your charger ***\"\n\n# Notification icon to use\nnot_icon=\"\/usr\/share\/icons\/gnome\/scalable\/status\/battery-low-symbolic.svg\"\n\nif [ \"$discharge_mode\" == \"off\" ]; then\n  if [  \"$battery_level\" -le \"$critical_value\" ]; then\n    if [ -f \"$not_icon\" ]; then\n        notify-send -u critical -i \"$not_icon\" -t 60000 \"$message\"\n       # i3-nagbar -m \"$message\"\n        sleep 300\n        sudo  \/lib\/systemd\/systemd-sleep hybrid-sleep\n    else\n         notify-send -u critical  -t 60000 \"$message\"\n        #i3-nagbar -m \"$message\"\n        sleep 120\n        sudo  \/lib\/systemd\/systemd-sleep hybrid-sleep\n\n    fi\n   elif [  \"$battery_level\" -eq \"$warning_value\" ]; then\n     notify-send -u low -i \"$not_icon\" -t 60000 \"$warn_message\"\nfi\nfi\n<\/code><\/pre>\n\n\n\n<p>Ensure the blocklets are executable;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>chmod +x ~\/.config\/i3\/blocklets\/*<\/code><\/pre>\n\n\n\n<p>This is how our i3 status bar now looks like;<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1176\" height=\"45\" src=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-blocks.png\" alt=\"\" class=\"wp-image-7054\" title=\"\" srcset=\"https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-blocks.png 1176w, https:\/\/kifarunix.com\/wp-content\/uploads\/2020\/09\/i3-blocks-768x29.png 768w\" sizes=\"(max-width: 1176px) 100vw, 1176px\" \/><\/figure>\n\n\n\n<p>Feel free to customize this awesome tool to your liking. Enjoy!!<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Further Reading<\/h3>\n\n\n\n<p>Refer to i3 user's guide for a comprehensive i3 reference.<\/p>\n\n\n\n<p><a href=\"https:\/\/i3wm.org\/docs\/userguide.html\" target=\"_blank\" rel=\"noreferrer noopener\">i3 User's Guide<\/a><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Other Tutorials<\/h3>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-setup-zsh-and-oh-my-zsh-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Setup ZSH and Oh-My-Zsh on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-bitwarden-password-manager-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install Bitwarden Password Manager on Ubuntu 20.04<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/monitor-openvpn-connections-with-prometheus-and-grafana\/\" target=\"_blank\" rel=\"noreferrer noopener\">Monitor OpenVPN Connections with Prometheus and Grafana<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/kifarunix.com\/install-and-configure-apt-caching-server-using-apt-cacher-ng-on-ubuntu-20-04\/\" target=\"_blank\" rel=\"noreferrer noopener\">Install and Configure APT-Caching Server Using Apt-Cacher NG on Ubuntu 20.04<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to our tutorial on how to install i3 windows manager on Ubuntu 20.04. i3 is a tiling window manager for X11. &#8220;A&nbsp;tiling window manager&nbsp;is<\/p>\n","protected":false},"author":1,"featured_media":9091,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_lock_modified_date":false,"footnotes":""},"categories":[993,121],"tags":[2555,2559,2556,2558,2554,2557],"class_list":["post-6951","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-desktop-environment","category-howtos","tag-configure-i3-windows-manager","tag-configure-i3-wm","tag-i3-wm-with-i3blocks","tag-i3-wm","tag-install-i3-wm-on-ubuntu-20-04","tag-install-i3blocks-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-50","resize-featured-image"],"_links":{"self":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6951"}],"collection":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/comments?post=6951"}],"version-history":[{"count":31,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6951\/revisions"}],"predecessor-version":[{"id":21509,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/posts\/6951\/revisions\/21509"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media\/9091"}],"wp:attachment":[{"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/media?parent=6951"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/categories?post=6951"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kifarunix.com\/wp-json\/wp\/v2\/tags?post=6951"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}