diff --git a/.config/i3blocks/config b/.config/i3blocks/config
index 3f680ab..b019683 100644
--- a/.config/i3blocks/config
+++ b/.config/i3blocks/config
@@ -11,7 +11,6 @@
# full_text
# instance
# interval
-# label
# min_width
# name
# separator
@@ -24,7 +23,7 @@
#
# The top properties below are applied to every block, but can be overridden.
# Each block command defaults to the script name to avoid boilerplate.
-command=${HOME}/.i3blocks/$BLOCK_NAME
+command=${HOME}/.i3blocks/$name
separator_block_width=11
markup=pango
@@ -37,13 +36,11 @@ markup=pango
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
[cpu_usage]
-#label=
interval=1
#min_width= 99.99%
#separator=false
[load_average]
-#label=
interval=5
# Temperature
@@ -52,27 +49,22 @@ interval=5
# The script may be called with -w and -c switches to specify thresholds,
# see the script for details.
#[temperature]
-##label=
-#label=cpu
#instance=coretemp-isa-0000
#interval=3
#separator=false
#
#[temperature]
-#label=gpu
#instance=radeon-pci-0300
#interval=3
# Memory usage
#
# The type defaults to "mem" if the instance is not specified.
[memory]
-label=ram
#separator=false
interval=2
#min_width=RAM 99.99%
#[memory]
-#label=swap
#instance=swap
##separator=false
#interval=2
@@ -84,18 +76,15 @@ interval=2
# The script may be called with a optional argument to set the alert
# (defaults to 10 for 10%).
#[disk]
-#label=
#instance=/
#interval=30
#separator=false
#[disk]
-#label=
#instance=/mnt/data
#interval=30
[internet]
-label=wan
interval=30
separator=false
@@ -104,18 +93,15 @@ separator=false
# 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]
-#label=wlan
#instance=wlp1s0
#interval=10
#separator=false
#[public_ip]
-#label=
#interval=60
#separator=false
[vpn]
-label=vpn
interval=30
separator=false
@@ -125,13 +111,10 @@ separator=false
# Packages to update
[updates]
-label=updt
interval=600
#[wifi]
-##label=
-##label=wlan
#instance=wlp1s0
#interval=3
#separator=false
@@ -151,14 +134,11 @@ interval=600
#
# The battery instance defaults to 0.
#[battery]
-#label=BAT
-#label=⚡
#instance=0
#interval=5
#[batterybar]
#[battery]
-#label=bat
#interval=10
#min_width="bat ██████"
@@ -184,19 +164,17 @@ signal=13
# The second parameter overrides the mixer selection
# See the script for details.
[volume]
-instance=Master
+instance=vol
#instance=PCM
interval=once
signal=10
separator=false
-label=vol
[volume]
-instance=Capture
+instance=mic
#instance=PCM
interval=once
signal=10
-label=mic
# Key indicators
@@ -206,15 +184,13 @@ label=mic
# bindsym --release Caps_Lock exec pkill -SIGRTMIN+11 i3blocks
# bindsym --release Num_Lock exec pkill -SIGRTMIN+12 i3blocks
[keyindicator]
-label=caps
-instance=CAPS
+instance=Caps
interval=once
signal=11
separator=false
[keyindicator]
-label=num
-instance=NUM
+instance=Num
interval=once
signal=12
# Date Time
diff --git a/.i3blocks/cpu_usage b/.i3blocks/cpu_usage
index 732d518..7510423 100755
--- a/.i3blocks/cpu_usage
+++ b/.i3blocks/cpu_usage
@@ -19,4 +19,4 @@ else color="#66cccc"
fi
# Affichage
-printf "cpu%3d%%" "$color" "$used"
+printf "cpu%3d%%\n" "$color" "$used"
diff --git a/.i3blocks/internet b/.i3blocks/internet
index a551b26..808ccbb 100755
--- a/.i3blocks/internet
+++ b/.i3blocks/internet
@@ -28,4 +28,4 @@ else
fi
fi
-echo "█"
+echo "wan █"
diff --git a/.i3blocks/keyindicator b/.i3blocks/keyindicator
index 529bbb8..0c74a9f 100755
--- a/.i3blocks/keyindicator
+++ b/.i3blocks/keyindicator
@@ -1,70 +1,14 @@
-#!/usr/bin/perl
-#
-# Copyright 2014 Marcelo Cerri
-#
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
+#!/bin/bash
-use strict;
-use warnings;
-use utf8;
-use Getopt::Long;
-use File::Basename;
+[[ -z "$instance" ]] && instance=Caps
-# Default values
-my $indicator = $ENV{BLOCK_INSTANCE} || "CAPS";
-my $color_on = "#99cc99";
-my $color_off = "#515151";
+status=$(xset q | grep -Po "$instance Lock: +(on|off)" | grep -Po "on|off")
-sub help {
- my $program = basename($0);
- printf "Usage: %s [-c ] [-C ]\n", $program;
- printf " -c : hex color to use when indicator is on\n";
- printf " -C : hex color to use when indicator is off\n";
- printf "\n";
- printf "Note: environment variable \$BLOCK_INSTANCE should be one of:\n";
- printf " CAPS, NUM (default is CAPS).\n";
- exit 0;
-}
+if [[ "$status" = "on" ]]
+then
+ color="#99CC99"
+else
+ color="#515151"
+fi
-Getopt::Long::config qw(no_ignore_case);
-GetOptions("help|h" => \&help,
- "c=s" => \$color_on,
- "C=s" => \$color_off) or exit 1;
-
-# Key mapping
-my %indicators = (
- CAPS => 0x00000001,
- NUM => 0x00000002,
-);
-
-# Retrieve key flags
-my $mask = 0;
-open(XSET, "xset -q |") or die;
-while () {
- if (/LED mask:\s*([0-9]+)/) {
- $mask = $1;
- last;
- }
-}
-close(XSET);
-
-my $indi = "N";
-
-# Output
-if (($indicators{$indicator} || 0) & $mask) {
- printf "█", $color_on;
-} else {
- printf "█", $color_off;
-}
-exit 0
+echo "${instance,*} █"
diff --git a/.i3blocks/memory b/.i3blocks/memory
index 4550221..4b9918f 100755
--- a/.i3blocks/memory
+++ b/.i3blocks/memory
@@ -16,6 +16,8 @@
TYPE="${BLOCK_INSTANCE:-mem}"
+echo -n "${TYPE//mem/ram} "
+
awk -v type=$TYPE '
/^MemTotal:/ {
mem_total=$2
diff --git a/.i3blocks/updates b/.i3blocks/updates
index a388772..b1840bb 100755
--- a/.i3blocks/updates
+++ b/.i3blocks/updates
@@ -1,5 +1,7 @@
#!/bin/bash
+echo -n "updt "
+
if [[ -f /dev/shm/claws_offline ]]
then
echo "█"
diff --git a/.i3blocks/volume b/.i3blocks/volume
index 2ea6ea5..b930648 100755
--- a/.i3blocks/volume
+++ b/.i3blocks/volume
@@ -1,95 +1,29 @@
#!/bin/bash
-# Copyright (C) 2014 Julien Bonjean
-# Copyright (C) 2014 Alexander Keller
-# This program is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
+if [[ "$instance" == mic ]]
+then
+ options=" --default-source"
+fi
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
+mixer="pamixer${options}"
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-#------------------------------------------------------------------------
-
-# The second parameter overrides the mixer selection
-# For PulseAudio users, use "pulse"
-# For Jack/Jack2 users, use "jackplug"
-# For ALSA users, you may use "default" for your primary card
-# or you may use hw:# where # is the number of the card desired
-MIXER="default"
-[ -n "$(lsmod | grep pulse)" ] && MIXER="pulse"
-[ -n "$(lsmod | grep jack)" ] && MIXER="jackplug"
-MIXER="${2:-$MIXER}"
-
-# The instance option sets the control to report and configure
-# This defaults to the first control of your selected mixer
-# For a list of the available, use `amixer -D $Your_Mixer scontrols`
-SCONTROL="${BLOCK_INSTANCE:-$(amixer -D $MIXER scontrols |
- sed -n "s/Simple mixer control '\([A-Za-z ]*\)',0/\1/p" |
- head -n1
- )}"
-
-# The first parameter sets the step to change the volume by (and units to display)
-# This may be in in % or dB (eg. 5% or 3dB)
-STEP="${1:-5%}"
-
-#------------------------------------------------------------------------
-
-capability() { # Return "Capture" if the device is a capture device
- amixer -D $MIXER get $SCONTROL |
- sed -n "s/ Capabilities:.*cvolume.*/Capture/p"
-}
-
-volume() {
- amixer -D $MIXER get $SCONTROL $(capability)
-}
-
-format() {
- TYPE=""
- TYPE_MUTE=""
- if [[ $SCONTROL = "Master" ]]
- then
- # TYPE_MUTE=" "
- # TYPE=" "
- # TYPE="vol "
- # TYPE_MUTE="vol "
- TYPE=''
- TYPE_MUTE=''
- elif [[ $SCONTROL = "Capture" ]]
- then
- # TYPE_MUTE=" "
- # TYPE=" "
- # TYPE="mic "
- # TYPE_MUTE="mic "
- TYPE=''
- TYPE_MUTE=''
- fi
- perl_filter='if (/.*\[(\d+%)\] (\[(-?\d+.\d+dB)\] )?\[(on|off)\]/)'
- perl_filter+='{CORE::say $4 eq "off" ? "'
- perl_filter+=$TYPE_MUTE
- perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
- perl_filter+='" : "'
- perl_filter+=$TYPE
- # If dB was selected, print that instead
- perl_filter+=$([[ $STEP = *dB ]] && echo '$3' || echo '$1')
- perl_filter+='"; exit}'
- perl -ne "$perl_filter"
-}
-
-#------------------------------------------------------------------------
-
-case $BLOCK_BUTTON in
- 3) amixer -q -D $MIXER sset $SCONTROL $(capability) 1%+ ;;
- 1) amixer -q -D $MIXER sset $SCONTROL $(capability) 1%- ;;
- 2) amixer -q -D $MIXER sset $SCONTROL $(capability) toggle ;; # right click, mute/unmute
- 4) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}+ ;; # scroll up, increase
- 5) amixer -q -D $MIXER sset $SCONTROL $(capability) ${STEP}- ;; # scroll down, decrease
+case $button in
+ 1) $mixer -d 1;;
+ 2) $mixer -t;;
+ 3) $mixer -i 1;;
+ 4) $mixer -i 5;;
+ 5) $mixer -d 5;;
esac
-volume | format
+volume="$($mixer --get-volume)"
+muted="$($mixer --get-mute)"
+
+if $muted
+then
+ color="#F2777A"
+else
+ color="#99CC99"
+fi
+
+printf "%s %2d%%\n" "$BLOCK_INSTANCE" "$color" "$volume"
+
diff --git a/.i3blocks/vpn b/.i3blocks/vpn
index f37fa71..323d491 100755
--- a/.i3blocks/vpn
+++ b/.i3blocks/vpn
@@ -1,5 +1,7 @@
#!/bin/bash
+echo -n "vpn "
+
if nmcli dev | grep tun0 | cut -f3 | grep " connecté" &>/dev/null
then
echo "█"