We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

44
2.594.239,65

Cart

Quantity 1.600,00
Quantity 1.812,50
Quantity 116,00
Quantity 65,00
Quantity 212,50

Learn how to – Configure i3pystatus on Linux

Learn how to – Configure i3pystatus on Linux.

Hey all. I would like to share with you My i3pystatus setup as used on Arch Linux box. From the official site, i3pystatus is defined as a growing collection of python scripts for status output compatible to i3status / i3bar of the i3 window manager. I have tried many status bars for i3 including i3blocks, polybar and i3pystatus seem to be the winner. This is entirely because of its modular approach.

In this blog post, I’ll take you through i3pystatus installation, installing important modules, and finally configuration sample that’s running on my Arch Linux desktop machine.

Prereqs

  1. It’s important to have font-awesome for the icons on my configuration file to work
  2. Installed and working i3 window manager
  3. Installed python
  4. Installed pip python modules installer.
  5. Time to troubleshoot if things don’t work as expected

Installing i3pystatus

The easiest and quickest way to install i3pystatus is using pip python installer. Consult your distribution on how to install python pip package if you don’t have it already.

If you have pip, just execute:

$ sudo pip install i3pystatus

Install i3pystatus on Arch using AUR:

Arch Linux users always have advantage, the package is readily available on aur. Never tried Arch Linux but interested, look no more, just follow along below link to tutorial on how to install:

Install Luks encrypted Arch Linux With LVM

Install stable version from Arch aur:

$ yaourt -S i3pystatus --noconfirm

or if using pacaur:

$ pacaur --needed --noconfirm --noedit -S i3pystatus

To get latest git version on Arch:

$ pacaur --needed --noconfirm --noedit -S i3pystatus-git

Now install some important modules:

$ sudo pip install pyalsaaudio 
    netifaces 
    basiciw 
    colour 
    psutil 
    requests

You can add any other if you need.

Configure i3pystatus

I’ll place my i3pystatus configuration file on ~/.config/i3/i3pystatus.conf

The content for the file is:

# -*- coding: utf-8 -*-
#
import subprocess
import os
import os.path

from i3pystatus import Status
from i3pystatus.updates import pacman, cower


status = Status()

# Displays clock like this:
# Tue 30 Jul 11:59:46 PM KW31
#                          ^-- calendar week

status.register("updates",
    format = "Updates: {count}",
    format_no_updates = "",
    on_leftclick="termite --geometry=1200x600 --title=updates -e 'pacaur --needed --noconfirm --noedit -Syu'",
    backends = [pacman.Pacman(), cower.Cower()])

status.register("clock",
    format=" %H:%M:%S",
    color='#C678DD',
    interval=1,
    on_leftclick="/usr/bin/gsimplecal",)

status.register("clock",
    format="  %a %d-%m-%Y ",
    color='#61AEEE',
    interval=1,)


status.register("pulseaudio",
    color_unmuted='#98C379',
    color_muted='#E06C75',
    format_muted=' [muted]',
    format=" {volume}%")

#status.register("network",
#    interface="eno1",
#    color_up="#8AE234",
#    color_down="#EF2929",
#    format_up=": {v4cidr}",
#    format_down="",)

status.register("network",
    interface="wlo1",
    color_up="#8AE234",
    color_down="#EF2929",
    format_up="  {essid}  {kbs} kbs",
    format_down="",)

status.register("backlight",
    interval=5,
    format=" {percentage:.0f}%",
    backlight="intel_backlight",)


status.register("battery",
    battery_ident="BAT0",
    interval=5,
    format="{status} {percentage:.0f}%",
    alert=True,
    alert_percentage=15,
    color="#FFFFFF",
    critical_color="#FF1919",
    charging_color="#E5E500",
    full_color="#D19A66",
    status={
        "DIS": " ",
        "CHR": "  ",
        "FULL": "   ",
},)

status.register("temp",
    color='#78EAF2',
                )

status.register("cpu_usage",
    on_leftclick="termite --title=htop -e 'htop'",
    format="  {usage}%",)

status.register("mem",
    color="#999999",
    warn_color="#E5E500",
    alert_color="#FF1919",
    format=" {avail_mem}/{total_mem} GB",
    divisor=1073741824,)

status.register("disk",
    color='#56B6C2',
    path="/home",
    on_leftclick="pcmanfm",
    format=" {avail} GB",)

status.register("text",
    text="|",
    color="#222222")

status.register("disk",
    hints = {"separator": False, "separator_block_width": 3},
    color='#ABB2BF',
    path="/",
    format=": {avail} GB",)

#status.register('ping',
#    format_disabled='',
#    color='#61AEEE')

status.register("keyboard_locks",
    format='{caps} {num}',
    caps_on='Caps Lock',
    caps_off='',
    num_on='Num On',
    num_off='',
    color='#e60053',
    )

status.register("mpd",
    host='localhost',
    port='6600',
    format="{status}",
    on_leftclick="switch_playpause",
    on_rightclick=["mpd_command", "stop"],
    on_middleclick=["mpd_command", "shuffle"],
    on_upscroll=["mpd_command", "next_song"],
    on_downscroll=["mpd_command", "previous_song"],
    status={
        "pause": " ",
        "play": " ",
        "stop": " ",
    },)

status.run()

With above configuration file, you’re close to complete setup. The remaining part is telling i3 to use i3pystatus as default status bar. Modify the bar block in your i3 configuration file. Mine look like below:

bar {
    status_command    python ~/.config/i3/i3pystatus.conf
    position          top
    workspace_buttons yes
    font pango:Hack, FontAwesome 10
    colors {
        background #253941
        statusline #e7dfd9
        separator  #081419
        focused_workspace  #2aa198 #073642 #eee895
        active_workspace   #073642 #859900 #839496
        inactive_workspace #002b36  #002b36   #586e75
        urgent_workspace   #cb4b16 #dc322f #fdf6e3
    }
  }

After that, just restart your i3 and you should be good to go. Key combinations to restart i3 are:

$mod+Shift+r

My i3 look with i3pystatus:

These configurations are available on my dotfiles github repo:

My dotfiles Github repository

References

  1. i3pystatus
  2. i3wm

44
2.594.239,65

Cart

Quantity 1.600,00
Quantity 1.812,50
Quantity 116,00
Quantity 65,00
Quantity 212,50