Pular para o conteúdo

Instalar e configurar i3blocks da fonte

Dica publicada em Linux / Configuração
Xerxes xerxeslins
Hits: 12.653 Categoria: Linux Subcategoria: Configuração
  • Indicar
  • Impressora
  • Denunciar
O Viva o Linux depende da receita de anúncios para se manter. Ative os cookies aqui para nos patrocinar.
Não conseguimos carregar os anúncios. Se usa bloqueador, considere liberar o Viva o Linux para nos patrocinar.

Instalar e configurar i3blocks da fonte

Dica testada no Void Linux com gerenciador de janelas i3.

O i3 blocks é uma opção para exibir informações e adicionar controles na i3bar. Gosto do i3 blocks por ser simples de configurar. Não dá dor de cabeça. Provavelmente está no repositório da sua distro, mas eu prefiro pegar do fonte, pois assim obtenho os últimos scripts, mas atualizados.

Vamos ao passo a passo:

Certifique-se de ter as ferramentas de compilação e o git. No caso do Void Linux, basta instalar o base-devel e git.

sudo xbps-install base-devel git

Em seguida vá até seu home:

cd

Comece o processo:

git clone https://github.com/vivien/i3blocks
$ cd i3blocks
$ ./autogen.sh
$ ./configure
$ make
$ sudo make install


Depois:

cd
$ git clone https://github.com/vivien/i3blocks-contrib ~/.config/i3blocks
$ cd !$
$ cp config.example config


Agora altere a configuração do i3, trocando i3status por i3blocks. Assim:

nano ~/.config/i3/config

bar {
  status_command i3blocks
}

Salve e feche.

Se reiniciar o i3 agora, com Mod+Shift+r, verá que apenas a data e hora vão aparecer.
É necessário configurar o arquivo para exibir as outras informações.

nano ~/.config/i3blocks/config

Perceba que há um bloco de texto assim:

# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
# Change $SCRIPT_DIR to the location of your scripts!

command=$SCRIPT_DIR/$BLOCK_NAME
separator_block_width=15
markup=none

Se olhar com atenção e se der um "ls" no diretório do i3blocks, vai entender porque não está exibindo as outras informações. Vou mostrar logo como corrigir.

Adicione um caminho para o "$SCRIPT_DIR" e repita o "/$BLOCK_NAME". Como resultado o bloco de texto ficará assim:

# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
# Change $SCRIPT_DIR to the location of your scripts!

SCRIPT_DIR=/home/[seu_usuário]/.config/i3blocks/
command=$SCRIPT_DIR/$BLOCK_NAME/$BLOCK_NAME
separator_block_width=15
markup=none
O Viva o Linux depende da receita de anúncios para se manter. Ative os cookies aqui para nos patrocinar.
Não conseguimos carregar os anúncios. Se usa bloqueador, considere liberar o Viva o Linux para nos patrocinar.

Salve o arquivo e reinicie o i3.

Agora vai aparecer tudo:
Mas agora é necessário configurar ao seu gosto usando os módulos que interessar. Veja todas as opções dentro do diretório do i3blocks. No meu caso, prefiro resumir as coisas.

Primeiramente edito o script "memory" para exibir apenas porcentagem.

nano ~/.config/i3blocks/memory/memory

E comento a linha do "full text": printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct).

Salvo e fecho. As demais alterações eu vou mostrar aqui de uma vez:

# i3blocks config file
#
# Please see man i3blocks for a complete reference!
# The man page is also hosted at http://vivien.github.io/i3blocks
#
# List of valid properties:
#
# align
# color
# command
# full_text
# instance
# interval
# label
# min_width
# name
# separator
# separator_block_width
# short_text
# signal
# urgent

# Global properties
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
# Change $SCRIPT_DIR to the location of your scripts!

SCRIPT_DIR=/home/xerxes/.config/i3blocks/
command=$SCRIPT_DIR/$BLOCK_NAME/$BLOCK_NAME
separator_block_width=15
markup=none

# Volume indicator
#
# The first parameter sets the step (and units to display)
# The second parameter overrides the mixer selection
# See the script for details.


[volume]
#label=♪
label=VOL
interval=once
signal=10
#STEP=5%

# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
label=MEM
#separator=false
interval=30

#[memory]
#label=SWAP
#instance=swap
#separator=false
#interval=30

# Disk usage
#
# The directory defaults to $HOME if the instance is not specified.
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
[disk]
label=ROOT
DIR=/
interval=30

# Network interface monitoring
#
# If the instance is not specified, use the interface used for default route.
# The address can be forced to IPv4 or IPv6 with -4 or -6 switches.
[iface]
#IFACE=wlan0
color=#00FF00
interval=10
#separator=false

#[wifi]
#INTERFACE=wlp3s0
#label=wifi:
#interval=10
#separator=false

#[bandwidth]
#INTERFACE=eth0
#interval=5

# CPU usage
#
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
[cpu_usage]
label=CPU
interval=10
#min_width=CPU 100.00%
#separator=false

#[load_average]
#label=LOAD
#interval=10

# Battery indicator
#
# The battery instance defaults to 0.
#[battery]
#label=BAT
#label=⚡
#interval=30

# Date Time
#
[time]
command=date '+%a-%d-%b %H:%M'
interval=5

# Generic media player support
#
# This displays "ARTIST - SONG" if a music is playing.
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
#[mediaplayer]
#instance=spotify
#interval=5
#signal=10

# OpenVPN support
#
# Support multiple VPN, with colors.
#[openvpn]
#interval=20

# Temperature
#
# Support multiple chips, though lm-sensors.
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
#[temperature]
#label=TEMP
#interval=10

# Key indicators
#
# Add the following bindings to i3 config file:
#
# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
# bindsym --release Num_Lock exec pkill -SIGRTMIN+11 i3blocks
#[keyindicator]
#KEY=CAPS
#markup=pango
#interval=once
#signal=11

#[keyindicator]
#KEY=NUM
#markup=pango
#interval=once
#signal=11

Resultado:
O Viva o Linux depende da receita de anúncios para se manter. Ative os cookies aqui para nos patrocinar.
Não conseguimos carregar os anúncios. Se usa bloqueador, considere liberar o Viva o Linux para nos patrocinar.

Trocando skin do MC

Integração do Chrome ao tema do elementary OS

Jogos travando ao usar Compiz?

Repositórios do Salix OS (e GSlapt) no Slackware 14

Ajuda para usar Regex com Regex Generator

Squid: "ERROR: no running copy" [Resolvido]

LPRNG no Debian 7 - Erro:LPD doesn't listen on port 515 [Resolvido]

Melhorando a performance do Linux com preload e sem SWAP

Configurando o xorg.conf no Ubuntu - II

Analisando endereços IPs atribuídos pelo DHCP

Nenhum comentário foi encontrado.

Contribuir com comentário

Entre na sua conta para comentar.