From b769e5c08da0d6b4e2cc62d9c5b2ea988f78f79c Mon Sep 17 00:00:00 2001
From: David Luevano <55825613+luevano@users.noreply.github.com>
Date: Wed, 12 Feb 2020 02:37:21 -0700
Subject: Debug for no booting pc
---
.config/dunst/dunstrc | 119 ++++------------------------
.config/i3blocks/config | 2 +-
.local/bin/blocklets/calendar | 41 ----------
.local/bin/blocklets/cpu | 62 ---------------
.local/bin/blocklets/gpu | 71 -----------------
.local/bin/blocklets/memory | 69 -----------------
.local/bin/blocklets/time | 100 ------------------------
.local/bin/blocklets/volume | 175 ------------------------------------------
.local/bin/blocks/calendar | 41 ++++++++++
.local/bin/blocks/cpu | 62 +++++++++++++++
.local/bin/blocks/gpu | 71 +++++++++++++++++
.local/bin/blocks/memory | 69 +++++++++++++++++
.local/bin/blocks/time | 100 ++++++++++++++++++++++++
.local/bin/blocks/volume | 175 ++++++++++++++++++++++++++++++++++++++++++
.local/bin/color_test | 41 ++++++++++
.local/bin/py/xcolors.py | 55 -------------
.local/bin/pys/xcolors.py | 55 +++++++++++++
.profile | 2 +-
.xinitrc | 2 +-
.xprofile | 10 +--
20 files changed, 635 insertions(+), 687 deletions(-)
delete mode 100755 .local/bin/blocklets/calendar
delete mode 100755 .local/bin/blocklets/cpu
delete mode 100755 .local/bin/blocklets/gpu
delete mode 100755 .local/bin/blocklets/memory
delete mode 100755 .local/bin/blocklets/time
delete mode 100755 .local/bin/blocklets/volume
create mode 100755 .local/bin/blocks/calendar
create mode 100755 .local/bin/blocks/cpu
create mode 100755 .local/bin/blocks/gpu
create mode 100755 .local/bin/blocks/memory
create mode 100755 .local/bin/blocks/time
create mode 100755 .local/bin/blocks/volume
create mode 100755 .local/bin/color_test
delete mode 100644 .local/bin/py/xcolors.py
create mode 100644 .local/bin/pys/xcolors.py
diff --git a/.config/dunst/dunstrc b/.config/dunst/dunstrc
index 3c0a3e4..3337148 100644
--- a/.config/dunst/dunstrc
+++ b/.config/dunst/dunstrc
@@ -1,3 +1,6 @@
+#
+# ~/.config/dunst/dunstrc
+# vim: ft=cfg
[global]
monitor = 0
follow = mouse
@@ -15,27 +18,9 @@
sort = yes
idle_threshold = 120
- ### Text ###
- font = Monospace 10
+ ## Text.
+ font = Monospace 10
line_height = 0
- # full: Allow a small subset of html markup in notifications:
- # bold
- # italic
- # strikethrough
- # underline
- #
- # For a complete reference see
- # .
- #
- # strip: This setting is provided for compatibility with some broken
- # clients that send markup even though it's not enabled on the
- # server. Dunst will try to strip the markup but the parsing is
- # simplistic so using this option outside of matching rules for
- # specific applications *IS GREATLY DISCOURAGED*.
- #
- # no: Disable markup parsing, incoming notifications will be treated as
- # plain text. Dunst will not advertise that it has the body-markup
- # capability if this is set as a global setting.
markup = full
# %a appname
# %s summary
@@ -46,7 +31,6 @@
# %n progress value if set without any extra characters
# %% Literal %
format = "%s\n%b"
- # Possible values are "left", "center" and "right".
alignment = left
show_age_threshold = 60
word_wrap = yes
@@ -55,40 +39,30 @@
stack_duplicates = true
hide_duplicate_count = false
show_indicators = yes
-
- ### Icons ###
+
+ ## Icons.
icon_position = off
max_icon_size = 32
icon_path = /usr/share/icons/gnome/16x16/status/:/usr/share/icons/gnome/16x16/devices/
- ### History ###
- sticky_history = yes
+ ## History.
+ sticky_history = yes
history_length = 20
- ### Misc/Advanced ###
- dmenu = /usr/bin/dmenu -p dunst:
+ ## Misc advanced.
+ dmenu = /usr/bin/dmenu -p dunst:
browser = /usr/bin/firefox -new-tab
always_run_script = true
title = Dunst
class = Dunst
startup_notification = false
- # crit: Critical features. Dunst aborts
- # warn: Only non-fatal warnings
- # mesg: Important Messages
- # info: all unimportant stuff
- # debug: all less than unimportant stuff
verbosity = mesg
corner_radius = 0
- ### Legacy
+ ### Legacy.
force_xinerama = false
- ### mouse
- # * none: Don't do anything.
- # * do_action: If the notification has exactly one action, or one is marked as default,
- # invoke it. If there are multiple and no default, open the context menu.
- # * close_current: Close current notification.
- # * close_all: Close all notifications.
+ ## Mouse.
mouse_left_click = close_current
mouse_middle_click = do_action
mouse_right_click = close_all
@@ -97,41 +71,21 @@
per_monitor_dpi = false
[shortcuts]
-
- # Shortcuts are specified as [modifier+][modifier+]...key
- # Available modifiers are "ctrl", "mod1" (the alt-key), "mod2",
- # "mod3" and "mod4" (windows-key).
- # Xev might be helpful to find names for keys.
-
- # Close notification.
close = ctrl+space
-
- # Close all notifications.
close_all = ctrl+shift+space
-
- # Redisplay last message(s).
- # On the US keyboard layout "grave" is normally above TAB and left
- # of "1". Make sure this key actually exists on your keyboard layout,
- # e.g. check output of 'xmodmap -pke'
history = ctrl+grave
-
- # Context menu.
context = ctrl+shift+period
[urgency_low]
- # IMPORTANT: colors have to be defined in quotation marks.
- # Otherwise the "#" and following would be interpreted as a comment.
background = "#222222"
foreground = "#888888"
timeout = 10
- # Icon for notifications with low urgency, uncomment to enable
#icon = /path/to/icon
[urgency_normal]
background = "#285577"
foreground = "#ffffff"
timeout = 10
- # Icon for notifications with normal urgency, uncomment to enable
#icon = /path/to/icon
[urgency_critical]
@@ -139,53 +93,8 @@
foreground = "#ffffff"
frame_color = "#ff0000"
timeout = 0
- # Icon for notifications with critical urgency, uncomment to enable
#icon = /path/to/icon
-# Every section that isn't one of the above is interpreted as a rules to
-# override settings for certain messages.
-#
-# Messages can be matched by
-# appname (discouraged, see desktop_entry)
-# body
-# category
-# desktop_entry
-# icon
-# match_transient
-# msg_urgency
-# stack_tag
-# summary
-#
-# and you can override the
-# background
-# foreground
-# format
-# frame_color
-# fullscreen
-# new_icon
-# set_stack_tag
-# set_transient
-# timeout
-# urgency
-#
-# Shell-like globbing will get expanded.
-#
-# Instead of the appname filter, it's recommended to use the desktop_entry filter.
-# GLib based applications export their desktop-entry name. In comparison to the appname,
-# the desktop-entry won't get localized.
-#
-# SCRIPTING
-# You can specify a script that gets run when the rule matches by
-# setting the "script" option.
-# The script will be called as follows:
-# script appname summary body icon urgency
-# where urgency can be "LOW", "NORMAL" or "CRITICAL".
-#
-# NOTE: if you don't want a notification to be displayed, set the format
-# to "".
-# NOTE: It might be helpful to run dunst -print in a terminal in order
-# to find fitting options for rules.
-
# Disable the transient hint so that idle_threshold cannot be bypassed from the
# client
#[transient_disable]
@@ -256,5 +165,3 @@
#[stack-volumes]
# appname = "some_volume_notifiers"
# set_stack_tag = "volume"
-#
-# vim: ft=cfg
diff --git a/.config/i3blocks/config b/.config/i3blocks/config
index c1daacb..9cacae2 100644
--- a/.config/i3blocks/config
+++ b/.config/i3blocks/config
@@ -1,7 +1,7 @@
# i3blocks config
# Global properties
-command=$HOME/.local/bin/blocklets/$BLOCK_NAME
+command=$HOME/.local/bin/blocks/$BLOCK_NAME
separator=false
separator_block_width=5
markup=pango
diff --git a/.local/bin/blocklets/calendar b/.local/bin/blocklets/calendar
deleted file mode 100755
index eb8e210..0000000
--- a/.local/bin/blocklets/calendar
+++ /dev/null
@@ -1,41 +0,0 @@
-#! /bin/sh
-
-WIDTH=${WIDTH:-200}
-HEIGHT=${HEIGHT:-200}
-DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
-SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
-
-OPTIND=1
-while getopts ":f:W:H:" opt; do
- case $opt in
- f) DATEFMT="$OPTARG" ;;
- W) WIDTH="$OPTARG" ;;
- H) HEIGHT="$OPTARG" ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- exit 1
- ;;
- :)
- echo "Option -$OPTARG requires an argument." >&2
- exit 1
- ;;
- esac
-done
-
-case "$BLOCK_BUTTON" in
- 1|2|3)
-
- # the position of the upper left corner of the popup
- # The size is hardcoded for a 1080p monitor.
- posX=$((1899 - $WIDTH))
- posY=$((35))
-
- i3-msg -q "exec yad --calendar \
- --width=$WIDTH --height=$HEIGHT \
- --undecorated --fixed \
- --close-on-unfocus --no-buttons \
- --posx=$posX --posy=$posY \
- > /dev/null"
-esac
-echo "$LABEL$(date "$DATEFMT")"
-echo "$LABEL$(date "$SHORTFMT")"
diff --git a/.local/bin/blocklets/cpu b/.local/bin/blocklets/cpu
deleted file mode 100755
index 44c1189..0000000
--- a/.local/bin/blocklets/cpu
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/perl
-#
-# Copyright 2014 Pierre Mavro
-# Copyright 2014 Vivien Didelot
-# Copyright 2014 Andreas Guldstrand
-#
-# Licensed under the terms of the GNU GPL v3, or any later version.
-
-use strict;
-use warnings;
-use utf8;
-use Getopt::Long;
-
-# default values
-my $t_warn = $ENV{T_WARN} // 50;
-my $t_crit = $ENV{T_CRIT} // 80;
-my $cpu_usage = -1;
-my $decimals = $ENV{DECIMALS} // 2;
-my $label = $ENV{LABEL} // "";
-
-sub help {
- print "Usage: cpu_usage [-w ] [-c ] [-d ]\n";
- print "-w : warning threshold to become yellow\n";
- print "-c : critical threshold to become red\n";
- print "-d : Use decimals for percentage (default is $decimals) \n";
- exit 0;
-}
-
-GetOptions("help|h" => \&help,
- "w=i" => \$t_warn,
- "c=i" => \$t_crit,
- "d=i" => \$decimals,
-);
-
-# Get CPU usage
-$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
-open (MPSTAT, 'mpstat 1 1 |') or die;
-while () {
- if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) {
- $cpu_usage = 100 - $1; # 100% - %idle
- last;
- }
-}
-close(MPSTAT);
-
-$cpu_usage eq -1 and die 'Can\'t find CPU information';
-
-# Print short_text, full_text
-print "${label}";
-printf "%.${decimals}f%%\n", $cpu_usage;
-print "${label}";
-printf "%.${decimals}f%%\n", $cpu_usage;
-
-# Print color, if needed
-if ($cpu_usage >= $t_crit) {
- print "#FF0000\n";
- exit 33;
-} elsif ($cpu_usage >= $t_warn) {
- print "#FFFC00\n";
-}
-
-exit 0;
diff --git a/.local/bin/blocklets/gpu b/.local/bin/blocklets/gpu
deleted file mode 100755
index e5e460b..0000000
--- a/.local/bin/blocklets/gpu
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /usr/bin/perl
-
-# 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 .
-
-use strict;
-use warnings;
-use utf8;
-use Getopt::Long;
-
-# default values
-my $t_warn = $ENV{T_WARN} || 70;
-my $t_crit = $ENV{T_CRIT} || 90;
-my $gpu_usage = -1;
-my $gpu_mem = -1;
-my $gpu_video = -1;
-my $gpu_pcie = -1;
-my $label = $ENV{LABEL} // "";
-
-sub help {
- print "Usage: gpu-load [-w ] [-c ]\n";
- print "-w : warning threshold to become amber\n";
- print "-c : critical threshold to become red\n";
- exit 0;
-}
-
-GetOptions("help|h" => \&help,
- "w=i" => \$t_warn,
- "c=i" => \$t_crit);
-
-# Get GPU usage from nvidia-settings
-open (NVS, 'nvidia-settings -q GPUUtilization -t |') or die;
-while () {
- if (/^[a-zA-Z]*=(\d+), [a-zA-Z]*=(\d+), [a-zA-Z]*=(\d+), [a-zA-Z]*=(\d+)$/) {
- $gpu_usage = $1;
- $gpu_mem = $2;
- $gpu_video = $3;
- $gpu_pcie = $4;
- last;
- }
-}
-close(NVS);
-
-$gpu_usage eq -1 and die 'Can\'t find GPU information';
-
-# I edited this to only show the gpu_usage and gpu_mem.
-# Also fixed the label thing.
-# Print full_text, short_text
-# printf "%.0f%% %.0f%% %.0f%% %.0f%%\n", $gpu_usage, $gpu_mem, $gpu_video, $gpu_pcie;
-# printf "%.0f%%\n", $gpu_usage;
-printf "${label} %.0f%% %.0f%%\n", $gpu_usage, $gpu_mem;
-
-# Print color, if needed
-if ($gpu_usage >= $t_crit || $gpu_mem >= $t_crit || $gpu_video >= $t_crit || $gpu_pcie >= $t_crit) {
- print "#FF0000\n";
- exit 33;
-} elsif ($gpu_usage >= $t_warn || $gpu_mem >= $t_warn || $gpu_video >= $t_warn || $gpu_pcie >= $t_warn) {
- print "#FFBF00\n";
-}
-
-exit 0;
diff --git a/.local/bin/blocklets/memory b/.local/bin/blocklets/memory
deleted file mode 100755
index 90eb2c6..0000000
--- a/.local/bin/blocklets/memory
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh
-# Copyright (C) 2014 Julien Bonjean
-
-# 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 .
-
-TYPE="${BLOCK_INSTANCE:-mem}"
-
-awk -v type=$TYPE '
-/^MemTotal:/ {
- mem_total=$2
-}
-/^MemFree:/ {
- mem_free=$2
-}
-/^Buffers:/ {
- mem_free+=$2
-}
-/^Cached:/ {
- mem_free+=$2
-}
-/^SwapTotal:/ {
- swap_total=$2
-}
-/^SwapFree:/ {
- swap_free=$2
-}
-END {
- if (type == "swap") {
- free=swap_free/1024/1024
- used=(swap_total-swap_free)/1024/1024
- total=swap_total/1024/1024
- } else {
- free=mem_free/1024/1024
- used=(mem_total-mem_free)/1024/1024
- total=mem_total/1024/1024
- }
-
- pct=0
- if (total > 0) {
- pct=used/total*100
- }
-
- # full text
- printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
-
- # short text
- printf("%.f%%\n", pct)
-
- # color
- if (pct > 90) {
- print("#FF0000")
- } else if (pct > 80) {
- print("#FFAE00")
- } else if (pct > 70) {
- print("#FFF600")
- }
-}
-' /proc/meminfo
diff --git a/.local/bin/blocklets/time b/.local/bin/blocklets/time
deleted file mode 100755
index 725fc68..0000000
--- a/.local/bin/blocklets/time
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use POSIX qw/strftime/;
-
-my $click = $ENV{BLOCK_BUTTON} || 0;
-my $format = $ENV{BLOCK_INSTANCE} || $ENV{STRFTIME_FORMAT} || "%H:%M";
-my $tz_file = shift || $ENV{TZ_FILE} || "$ENV{HOME}/.tz";
-$tz_file = glob($tz_file);
-my $default_tz = get_default_tz();
-
-my $tzones = $ENV{TZONES} || '$DEFAULT_TZ';
-$tzones =~ s/\$DEFAULT_TZ/$default_tz/g;
-my @tz_list = split(/,/, $tzones);
-my @tz_labels = split(/,/, $ENV{TZ_LABELS} || "");
-if (scalar(@tz_list) != scalar(@tz_labels)) {
- @tz_labels = @tz_list;
-}
-
-my $current_tz;
-if ($click == 1) {
- $current_tz = get_tz();
-
- my %tzmap;
- $tzmap{""} = $tz_list[0];
- my $prev = $tz_list[0];
- foreach my $tz (@tz_list) {
- $tzmap{$prev} = $tz;
- $prev = $tz;
- }
- $tzmap{$prev} = $tz_list[0];
-
- if (exists $tzmap{$current_tz}) {
- set_tz($tzmap{$current_tz});
- $current_tz = $tzmap{$current_tz};
- }
-}
-
-# How each timezone will be displayed in the bar.
-my %display_map;
-for (my $i=0; $i < scalar(@tz_list); $i++) {
- $display_map{$tz_list[$i]} = $tz_labels[$i];
-}
-
-if (!defined $current_tz) {
- $current_tz = get_tz();
- set_tz($current_tz);
-}
-$ENV{TZ} = $current_tz;
-my $tz_display = "";
-if (!exists $display_map{$ENV{TZ}}) {
- $ENV{TZ} = $tz_list[0];
- set_tz($tz_list[0]);
-}
-$tz_display = $display_map{$ENV{TZ}};
-
-my $time = strftime($format, localtime());
-if ($tz_display eq "") {
- print "$time\n";
-} else {
- print "$time ($tz_display)\n";
-}
-
-sub get_tz {
- my $current_tz;
-
- if (-f $tz_file) {
- open my $fh, '<', $tz_file || die "Couldn't open file: $tz_file";
- $current_tz = <$fh>;
- chomp $current_tz;
- close $fh;
- }
-
- return $current_tz || get_default_tz();
-}
-
-sub set_tz {
- my $tz = shift;
-
- open my $fh, '>', $tz_file || die "Couldn't open file: $tz_file";
- print $fh $tz;
- close $fh;
-}
-
-sub get_default_tz {
- my $tz = "Europe/London";
-
- if (-f "/etc/timezone") {
- open my $fh, '<', "/etc/timezone" || die "Couldn't open file: /etc/timezone";
- $tz = <$fh>;
- chomp $tz;
- close $fh;
- } elsif (-l "/etc/localtime") {
- $tz = readlink "/etc/localtime";
- $tz = (split /zoneinfo\//, $tz)[-1];
- }
-
- return $tz;
-}
diff --git a/.local/bin/blocklets/volume b/.local/bin/blocklets/volume
deleted file mode 100755
index ad1b2d1..0000000
--- a/.local/bin/blocklets/volume
+++ /dev/null
@@ -1,175 +0,0 @@
-#!/bin/bash
-# Displays the default device, volume, and mute status for i3blocks
-
-set -a
-
-AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-' '}
-
-AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50}
-AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-' '}
-
-AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0}
-AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-' '}
-
-AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '}
-
-AUDIO_DELTA=${AUDIO_DELTA:-5}
-
-DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"}
-MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"}
-
-LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}% [${INDEX}:${NAME}]'}
-SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'}
-USE_ALSA_NAME=${USE_ALSA_NAME:-0}
-USE_DESCRIPTION=${USE_DESCRIPTION:-0}
-
-SUBSCRIBE=${SUBSCRIBE:-0}
-
-MIXER=${MIXER:-""}
-SCONTROL=${SCONTROL:-""}
-
-while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
- case "$opt" in
- S) SUBSCRIBE=1 ;;
- F) LONG_FORMAT="$OPTARG" ;;
- f) SHORT_FORMAT="$OPTARG" ;;
- a) USE_ALSA_NAME=1 ;;
- d) USE_DESCRIPTION=1 ;;
- H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
- M) AUDIO_MED_SYMBOL="$OPTARG" ;;
- L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
- X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
- T) AUDIO_MED_THRESH="$OPTARG" ;;
- t) AUDIO_LOW_THRESH="$OPTARG" ;;
- C) DEFAULT_COLOR="$OPTARG" ;;
- c) MUTED_COLOR="$OPTARG" ;;
- i) AUDIO_INTERVAL="$OPTARG" ;;
- m) MIXER="$OPTARG" ;;
- s) SCONTROL="$OPTARG" ;;
- h) printf \
-"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
- [-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
- [-m mixer] [-s scontrol] [-h]
-Options:
--F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
-\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
--S\tSubscribe to volume events (requires persistent block, always uses long format)
--a\tUse ALSA name if possible
--d\tUse device description instead of name if possible
--H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
--M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
--L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
--X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
--T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
--t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
--C\tColor for non-muted audio. Default: $DEFAULT_COLOR
--c\tColor for muted audio. Default: $MUTED_COLOR
--i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
--m\tUse the given mixer.
--s\tUse the given scontrol.
--h\tShow this help text
-" && exit 0;;
- esac
-done
-
-if [[ -z "$MIXER" ]] ; then
- MIXER="default"
- if amixer -D pulse info >/dev/null 2>&1 ; then
- MIXER="pulse"
- fi
-fi
-
-if [[ -z "$SCONTROL" ]] ; then
- SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
-fi
-
-CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
-
-
-function move_sinks_to_new_default {
- DEFAULT_SINK=$1
- pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
- do
- pacmd move-sink-input $SINK $DEFAULT_SINK
- done
-}
-
-function set_default_playback_device_next {
- inc=${1:-1}
- num_devices=$(pacmd list-sinks | grep -c index:)
- sink_arr=($(pacmd list-sinks | grep index: | grep -o '[0-9]\+'))
- default_sink_index=$(( $(pacmd list-sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
- default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
- default_sink=${sink_arr[$default_sink_index]}
- pacmd set-default-sink $default_sink
- move_sinks_to_new_default $default_sink
-}
-
-case "$BLOCK_BUTTON" in
- 1) set_default_playback_device_next ;;
- 2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
- 3) set_default_playback_device_next -1 ;;
- 4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%+ ;;
- 5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
-esac
-
-function print_format {
- echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
-}
-
-function print_block {
- ACTIVE=$(pacmd list-sinks | grep "state\: RUNNING" -B4 -A7 | grep "index:\|name:\|volume: front\|muted:")
- [ -z "$ACTIVE" ] && ACTIVE=$(pacmd list-sinks | grep "index:\|name:\|volume: front\|muted:" | grep -A3 '*')
- for name in INDEX NAME VOL MUTED; do
- read $name
- done < <(echo "$ACTIVE")
- INDEX=$(echo "$INDEX" | grep -o '[0-9]\+')
- VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
- VOL="${VOL%?}"
-
- NAME=$(echo "$NAME" | sed \
-'s/.*<.*\.\(.*\)>.*/\1/; t;'\
-'s/.*<\(.*\)>.*/\1/; t;'\
-'s/.*/unknown/')
-
- if [[ $USE_ALSA_NAME == 1 ]] ; then
- ALSA_NAME=$(pacmd list-sinks |\
-awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
-grep "alsa.name\|alsa.mixer_name" |\
-head -n1 |\
-sed 's/.*= "\(.*\)".*/\1/')
- NAME=${ALSA_NAME:-$NAME}
- elif [[ $USE_DESCRIPTION == 1 ]] ; then
- DESCRIPTION=$(pacmd list-sinks |\
-awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
-grep "device.description" |\
-head -n1 |\
-sed 's/.*= "\(.*\)".*/\1/')
- NAME=${DESCRIPTION:-$NAME}
- fi
-
- if [[ $MUTED =~ "no" ]] ; then
- SYMB=$AUDIO_HIGH_SYMBOL
- [[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL
- [[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL
- COLOR=$DEFAULT_COLOR
- else
- SYMB=$AUDIO_MUTED_SYMBOL
- COLOR=$MUTED_COLOR
- fi
-
- if [[ $SUBSCRIBE == 1 ]] ; then
- print_format "$LONG_FORMAT"
- else
- print_format "$LONG_FORMAT"
- print_format "$SHORT_FORMAT"
- echo "$COLOR"
- fi
-}
-
-print_block
-if [[ $SUBSCRIBE == 1 ]] ; then
- while read -r EVENT; do
- print_block
- done < <(pactl subscribe | stdbuf -oL grep change)
-fi
diff --git a/.local/bin/blocks/calendar b/.local/bin/blocks/calendar
new file mode 100755
index 0000000..eb8e210
--- /dev/null
+++ b/.local/bin/blocks/calendar
@@ -0,0 +1,41 @@
+#! /bin/sh
+
+WIDTH=${WIDTH:-200}
+HEIGHT=${HEIGHT:-200}
+DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
+SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
+
+OPTIND=1
+while getopts ":f:W:H:" opt; do
+ case $opt in
+ f) DATEFMT="$OPTARG" ;;
+ W) WIDTH="$OPTARG" ;;
+ H) HEIGHT="$OPTARG" ;;
+ \?)
+ echo "Invalid option: -$OPTARG" >&2
+ exit 1
+ ;;
+ :)
+ echo "Option -$OPTARG requires an argument." >&2
+ exit 1
+ ;;
+ esac
+done
+
+case "$BLOCK_BUTTON" in
+ 1|2|3)
+
+ # the position of the upper left corner of the popup
+ # The size is hardcoded for a 1080p monitor.
+ posX=$((1899 - $WIDTH))
+ posY=$((35))
+
+ i3-msg -q "exec yad --calendar \
+ --width=$WIDTH --height=$HEIGHT \
+ --undecorated --fixed \
+ --close-on-unfocus --no-buttons \
+ --posx=$posX --posy=$posY \
+ > /dev/null"
+esac
+echo "$LABEL$(date "$DATEFMT")"
+echo "$LABEL$(date "$SHORTFMT")"
diff --git a/.local/bin/blocks/cpu b/.local/bin/blocks/cpu
new file mode 100755
index 0000000..44c1189
--- /dev/null
+++ b/.local/bin/blocks/cpu
@@ -0,0 +1,62 @@
+#!/usr/bin/perl
+#
+# Copyright 2014 Pierre Mavro
+# Copyright 2014 Vivien Didelot
+# Copyright 2014 Andreas Guldstrand
+#
+# Licensed under the terms of the GNU GPL v3, or any later version.
+
+use strict;
+use warnings;
+use utf8;
+use Getopt::Long;
+
+# default values
+my $t_warn = $ENV{T_WARN} // 50;
+my $t_crit = $ENV{T_CRIT} // 80;
+my $cpu_usage = -1;
+my $decimals = $ENV{DECIMALS} // 2;
+my $label = $ENV{LABEL} // "";
+
+sub help {
+ print "Usage: cpu_usage [-w ] [-c ] [-d ]\n";
+ print "-w : warning threshold to become yellow\n";
+ print "-c : critical threshold to become red\n";
+ print "-d : Use decimals for percentage (default is $decimals) \n";
+ exit 0;
+}
+
+GetOptions("help|h" => \&help,
+ "w=i" => \$t_warn,
+ "c=i" => \$t_crit,
+ "d=i" => \$decimals,
+);
+
+# Get CPU usage
+$ENV{LC_ALL}="en_US"; # if mpstat is not run under en_US locale, things may break, so make sure it is
+open (MPSTAT, 'mpstat 1 1 |') or die;
+while () {
+ if (/^.*\s+(\d+\.\d+)[\s\x00]?$/) {
+ $cpu_usage = 100 - $1; # 100% - %idle
+ last;
+ }
+}
+close(MPSTAT);
+
+$cpu_usage eq -1 and die 'Can\'t find CPU information';
+
+# Print short_text, full_text
+print "${label}";
+printf "%.${decimals}f%%\n", $cpu_usage;
+print "${label}";
+printf "%.${decimals}f%%\n", $cpu_usage;
+
+# Print color, if needed
+if ($cpu_usage >= $t_crit) {
+ print "#FF0000\n";
+ exit 33;
+} elsif ($cpu_usage >= $t_warn) {
+ print "#FFFC00\n";
+}
+
+exit 0;
diff --git a/.local/bin/blocks/gpu b/.local/bin/blocks/gpu
new file mode 100755
index 0000000..e5e460b
--- /dev/null
+++ b/.local/bin/blocks/gpu
@@ -0,0 +1,71 @@
+#! /usr/bin/perl
+
+# 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 .
+
+use strict;
+use warnings;
+use utf8;
+use Getopt::Long;
+
+# default values
+my $t_warn = $ENV{T_WARN} || 70;
+my $t_crit = $ENV{T_CRIT} || 90;
+my $gpu_usage = -1;
+my $gpu_mem = -1;
+my $gpu_video = -1;
+my $gpu_pcie = -1;
+my $label = $ENV{LABEL} // "";
+
+sub help {
+ print "Usage: gpu-load [-w ] [-c ]\n";
+ print "-w : warning threshold to become amber\n";
+ print "-c : critical threshold to become red\n";
+ exit 0;
+}
+
+GetOptions("help|h" => \&help,
+ "w=i" => \$t_warn,
+ "c=i" => \$t_crit);
+
+# Get GPU usage from nvidia-settings
+open (NVS, 'nvidia-settings -q GPUUtilization -t |') or die;
+while () {
+ if (/^[a-zA-Z]*=(\d+), [a-zA-Z]*=(\d+), [a-zA-Z]*=(\d+), [a-zA-Z]*=(\d+)$/) {
+ $gpu_usage = $1;
+ $gpu_mem = $2;
+ $gpu_video = $3;
+ $gpu_pcie = $4;
+ last;
+ }
+}
+close(NVS);
+
+$gpu_usage eq -1 and die 'Can\'t find GPU information';
+
+# I edited this to only show the gpu_usage and gpu_mem.
+# Also fixed the label thing.
+# Print full_text, short_text
+# printf "%.0f%% %.0f%% %.0f%% %.0f%%\n", $gpu_usage, $gpu_mem, $gpu_video, $gpu_pcie;
+# printf "%.0f%%\n", $gpu_usage;
+printf "${label} %.0f%% %.0f%%\n", $gpu_usage, $gpu_mem;
+
+# Print color, if needed
+if ($gpu_usage >= $t_crit || $gpu_mem >= $t_crit || $gpu_video >= $t_crit || $gpu_pcie >= $t_crit) {
+ print "#FF0000\n";
+ exit 33;
+} elsif ($gpu_usage >= $t_warn || $gpu_mem >= $t_warn || $gpu_video >= $t_warn || $gpu_pcie >= $t_warn) {
+ print "#FFBF00\n";
+}
+
+exit 0;
diff --git a/.local/bin/blocks/memory b/.local/bin/blocks/memory
new file mode 100755
index 0000000..90eb2c6
--- /dev/null
+++ b/.local/bin/blocks/memory
@@ -0,0 +1,69 @@
+#!/bin/sh
+# Copyright (C) 2014 Julien Bonjean
+
+# 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 .
+
+TYPE="${BLOCK_INSTANCE:-mem}"
+
+awk -v type=$TYPE '
+/^MemTotal:/ {
+ mem_total=$2
+}
+/^MemFree:/ {
+ mem_free=$2
+}
+/^Buffers:/ {
+ mem_free+=$2
+}
+/^Cached:/ {
+ mem_free+=$2
+}
+/^SwapTotal:/ {
+ swap_total=$2
+}
+/^SwapFree:/ {
+ swap_free=$2
+}
+END {
+ if (type == "swap") {
+ free=swap_free/1024/1024
+ used=(swap_total-swap_free)/1024/1024
+ total=swap_total/1024/1024
+ } else {
+ free=mem_free/1024/1024
+ used=(mem_total-mem_free)/1024/1024
+ total=mem_total/1024/1024
+ }
+
+ pct=0
+ if (total > 0) {
+ pct=used/total*100
+ }
+
+ # full text
+ printf("%.1fG/%.1fG (%.f%%)\n", used, total, pct)
+
+ # short text
+ printf("%.f%%\n", pct)
+
+ # color
+ if (pct > 90) {
+ print("#FF0000")
+ } else if (pct > 80) {
+ print("#FFAE00")
+ } else if (pct > 70) {
+ print("#FFF600")
+ }
+}
+' /proc/meminfo
diff --git a/.local/bin/blocks/time b/.local/bin/blocks/time
new file mode 100755
index 0000000..725fc68
--- /dev/null
+++ b/.local/bin/blocks/time
@@ -0,0 +1,100 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+use POSIX qw/strftime/;
+
+my $click = $ENV{BLOCK_BUTTON} || 0;
+my $format = $ENV{BLOCK_INSTANCE} || $ENV{STRFTIME_FORMAT} || "%H:%M";
+my $tz_file = shift || $ENV{TZ_FILE} || "$ENV{HOME}/.tz";
+$tz_file = glob($tz_file);
+my $default_tz = get_default_tz();
+
+my $tzones = $ENV{TZONES} || '$DEFAULT_TZ';
+$tzones =~ s/\$DEFAULT_TZ/$default_tz/g;
+my @tz_list = split(/,/, $tzones);
+my @tz_labels = split(/,/, $ENV{TZ_LABELS} || "");
+if (scalar(@tz_list) != scalar(@tz_labels)) {
+ @tz_labels = @tz_list;
+}
+
+my $current_tz;
+if ($click == 1) {
+ $current_tz = get_tz();
+
+ my %tzmap;
+ $tzmap{""} = $tz_list[0];
+ my $prev = $tz_list[0];
+ foreach my $tz (@tz_list) {
+ $tzmap{$prev} = $tz;
+ $prev = $tz;
+ }
+ $tzmap{$prev} = $tz_list[0];
+
+ if (exists $tzmap{$current_tz}) {
+ set_tz($tzmap{$current_tz});
+ $current_tz = $tzmap{$current_tz};
+ }
+}
+
+# How each timezone will be displayed in the bar.
+my %display_map;
+for (my $i=0; $i < scalar(@tz_list); $i++) {
+ $display_map{$tz_list[$i]} = $tz_labels[$i];
+}
+
+if (!defined $current_tz) {
+ $current_tz = get_tz();
+ set_tz($current_tz);
+}
+$ENV{TZ} = $current_tz;
+my $tz_display = "";
+if (!exists $display_map{$ENV{TZ}}) {
+ $ENV{TZ} = $tz_list[0];
+ set_tz($tz_list[0]);
+}
+$tz_display = $display_map{$ENV{TZ}};
+
+my $time = strftime($format, localtime());
+if ($tz_display eq "") {
+ print "$time\n";
+} else {
+ print "$time ($tz_display)\n";
+}
+
+sub get_tz {
+ my $current_tz;
+
+ if (-f $tz_file) {
+ open my $fh, '<', $tz_file || die "Couldn't open file: $tz_file";
+ $current_tz = <$fh>;
+ chomp $current_tz;
+ close $fh;
+ }
+
+ return $current_tz || get_default_tz();
+}
+
+sub set_tz {
+ my $tz = shift;
+
+ open my $fh, '>', $tz_file || die "Couldn't open file: $tz_file";
+ print $fh $tz;
+ close $fh;
+}
+
+sub get_default_tz {
+ my $tz = "Europe/London";
+
+ if (-f "/etc/timezone") {
+ open my $fh, '<', "/etc/timezone" || die "Couldn't open file: /etc/timezone";
+ $tz = <$fh>;
+ chomp $tz;
+ close $fh;
+ } elsif (-l "/etc/localtime") {
+ $tz = readlink "/etc/localtime";
+ $tz = (split /zoneinfo\//, $tz)[-1];
+ }
+
+ return $tz;
+}
diff --git a/.local/bin/blocks/volume b/.local/bin/blocks/volume
new file mode 100755
index 0000000..ad1b2d1
--- /dev/null
+++ b/.local/bin/blocks/volume
@@ -0,0 +1,175 @@
+#!/bin/bash
+# Displays the default device, volume, and mute status for i3blocks
+
+set -a
+
+AUDIO_HIGH_SYMBOL=${AUDIO_HIGH_SYMBOL:-' '}
+
+AUDIO_MED_THRESH=${AUDIO_MED_THRESH:-50}
+AUDIO_MED_SYMBOL=${AUDIO_MED_SYMBOL:-' '}
+
+AUDIO_LOW_THRESH=${AUDIO_LOW_THRESH:-0}
+AUDIO_LOW_SYMBOL=${AUDIO_LOW_SYMBOL:-' '}
+
+AUDIO_MUTED_SYMBOL=${AUDIO_MUTED_SYMBOL:-' '}
+
+AUDIO_DELTA=${AUDIO_DELTA:-5}
+
+DEFAULT_COLOR=${DEFAULT_COLOR:-"#ffffff"}
+MUTED_COLOR=${MUTED_COLOR:-"#a0a0a0"}
+
+LONG_FORMAT=${LONG_FORMAT:-'${SYMB} ${VOL}% [${INDEX}:${NAME}]'}
+SHORT_FORMAT=${SHORT_FORMAT:-'${SYMB} ${VOL}% [${INDEX}]'}
+USE_ALSA_NAME=${USE_ALSA_NAME:-0}
+USE_DESCRIPTION=${USE_DESCRIPTION:-0}
+
+SUBSCRIBE=${SUBSCRIBE:-0}
+
+MIXER=${MIXER:-""}
+SCONTROL=${SCONTROL:-""}
+
+while getopts F:Sf:adH:M:L:X:T:t:C:c:i:m:s:h opt; do
+ case "$opt" in
+ S) SUBSCRIBE=1 ;;
+ F) LONG_FORMAT="$OPTARG" ;;
+ f) SHORT_FORMAT="$OPTARG" ;;
+ a) USE_ALSA_NAME=1 ;;
+ d) USE_DESCRIPTION=1 ;;
+ H) AUDIO_HIGH_SYMBOL="$OPTARG" ;;
+ M) AUDIO_MED_SYMBOL="$OPTARG" ;;
+ L) AUDIO_LOW_SYMBOL="$OPTARG" ;;
+ X) AUDIO_MUTED_SYMBOL="$OPTARG" ;;
+ T) AUDIO_MED_THRESH="$OPTARG" ;;
+ t) AUDIO_LOW_THRESH="$OPTARG" ;;
+ C) DEFAULT_COLOR="$OPTARG" ;;
+ c) MUTED_COLOR="$OPTARG" ;;
+ i) AUDIO_INTERVAL="$OPTARG" ;;
+ m) MIXER="$OPTARG" ;;
+ s) SCONTROL="$OPTARG" ;;
+ h) printf \
+"Usage: volume-pulseaudio [-S] [-F format] [-f format] [-p] [-a|-d] [-H symb] [-M symb]
+ [-L symb] [-X symb] [-T thresh] [-t thresh] [-C color] [-c color] [-i inter]
+ [-m mixer] [-s scontrol] [-h]
+Options:
+-F, -f\tOutput format (-F long format, -f short format) to use, with exposed variables:
+\${SYMB}, \${VOL}, \${INDEX}, \${NAME}
+-S\tSubscribe to volume events (requires persistent block, always uses long format)
+-a\tUse ALSA name if possible
+-d\tUse device description instead of name if possible
+-H\tSymbol to use when audio level is high. Default: '$AUDIO_HIGH_SYMBOL'
+-M\tSymbol to use when audio level is medium. Default: '$AUDIO_MED_SYMBOL'
+-L\tSymbol to use when audio level is low. Default: '$AUDIO_LOW_SYMBOL'
+-X\tSymbol to use when audio is muted. Default: '$AUDIO_MUTED_SYMBOL'
+-T\tThreshold for medium audio level. Default: $AUDIO_MED_THRESH
+-t\tThreshold for low audio level. Default: $AUDIO_LOW_THRESH
+-C\tColor for non-muted audio. Default: $DEFAULT_COLOR
+-c\tColor for muted audio. Default: $MUTED_COLOR
+-i\tInterval size of volume increase/decrease. Default: $AUDIO_DELTA
+-m\tUse the given mixer.
+-s\tUse the given scontrol.
+-h\tShow this help text
+" && exit 0;;
+ esac
+done
+
+if [[ -z "$MIXER" ]] ; then
+ MIXER="default"
+ if amixer -D pulse info >/dev/null 2>&1 ; then
+ MIXER="pulse"
+ fi
+fi
+
+if [[ -z "$SCONTROL" ]] ; then
+ SCONTROL=$(amixer -D "$MIXER" scontrols | sed -n "s/Simple mixer control '\([^']*\)',0/\1/p" | head -n1)
+fi
+
+CAPABILITY=$(amixer -D $MIXER get $SCONTROL | sed -n "s/ Capabilities:.*cvolume.*/Capture/p")
+
+
+function move_sinks_to_new_default {
+ DEFAULT_SINK=$1
+ pacmd list-sink-inputs | grep index: | grep -o '[0-9]\+' | while read SINK
+ do
+ pacmd move-sink-input $SINK $DEFAULT_SINK
+ done
+}
+
+function set_default_playback_device_next {
+ inc=${1:-1}
+ num_devices=$(pacmd list-sinks | grep -c index:)
+ sink_arr=($(pacmd list-sinks | grep index: | grep -o '[0-9]\+'))
+ default_sink_index=$(( $(pacmd list-sinks | grep index: | grep -no '*' | grep -o '^[0-9]\+') - 1 ))
+ default_sink_index=$(( ($default_sink_index + $num_devices + $inc) % $num_devices ))
+ default_sink=${sink_arr[$default_sink_index]}
+ pacmd set-default-sink $default_sink
+ move_sinks_to_new_default $default_sink
+}
+
+case "$BLOCK_BUTTON" in
+ 1) set_default_playback_device_next ;;
+ 2) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY toggle ;;
+ 3) set_default_playback_device_next -1 ;;
+ 4) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%+ ;;
+ 5) amixer -q -D $MIXER sset $SCONTROL $CAPABILITY $AUDIO_DELTA%- ;;
+esac
+
+function print_format {
+ echo "$1" | envsubst '${SYMB}${VOL}${INDEX}${NAME}'
+}
+
+function print_block {
+ ACTIVE=$(pacmd list-sinks | grep "state\: RUNNING" -B4 -A7 | grep "index:\|name:\|volume: front\|muted:")
+ [ -z "$ACTIVE" ] && ACTIVE=$(pacmd list-sinks | grep "index:\|name:\|volume: front\|muted:" | grep -A3 '*')
+ for name in INDEX NAME VOL MUTED; do
+ read $name
+ done < <(echo "$ACTIVE")
+ INDEX=$(echo "$INDEX" | grep -o '[0-9]\+')
+ VOL=$(echo "$VOL" | grep -o "[0-9]*%" | head -1 )
+ VOL="${VOL%?}"
+
+ NAME=$(echo "$NAME" | sed \
+'s/.*<.*\.\(.*\)>.*/\1/; t;'\
+'s/.*<\(.*\)>.*/\1/; t;'\
+'s/.*/unknown/')
+
+ if [[ $USE_ALSA_NAME == 1 ]] ; then
+ ALSA_NAME=$(pacmd list-sinks |\
+awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
+grep "alsa.name\|alsa.mixer_name" |\
+head -n1 |\
+sed 's/.*= "\(.*\)".*/\1/')
+ NAME=${ALSA_NAME:-$NAME}
+ elif [[ $USE_DESCRIPTION == 1 ]] ; then
+ DESCRIPTION=$(pacmd list-sinks |\
+awk '/^\s*\*/{f=1}/^\s*index:/{f=0}f' |\
+grep "device.description" |\
+head -n1 |\
+sed 's/.*= "\(.*\)".*/\1/')
+ NAME=${DESCRIPTION:-$NAME}
+ fi
+
+ if [[ $MUTED =~ "no" ]] ; then
+ SYMB=$AUDIO_HIGH_SYMBOL
+ [[ $VOL -le $AUDIO_MED_THRESH ]] && SYMB=$AUDIO_MED_SYMBOL
+ [[ $VOL -le $AUDIO_LOW_THRESH ]] && SYMB=$AUDIO_LOW_SYMBOL
+ COLOR=$DEFAULT_COLOR
+ else
+ SYMB=$AUDIO_MUTED_SYMBOL
+ COLOR=$MUTED_COLOR
+ fi
+
+ if [[ $SUBSCRIBE == 1 ]] ; then
+ print_format "$LONG_FORMAT"
+ else
+ print_format "$LONG_FORMAT"
+ print_format "$SHORT_FORMAT"
+ echo "$COLOR"
+ fi
+}
+
+print_block
+if [[ $SUBSCRIBE == 1 ]] ; then
+ while read -r EVENT; do
+ print_block
+ done < <(pactl subscribe | stdbuf -oL grep change)
+fi
diff --git a/.local/bin/color_test b/.local/bin/color_test
new file mode 100755
index 0000000..e89f24e
--- /dev/null
+++ b/.local/bin/color_test
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# This file echoes a bunch of color codes to the
+# terminal to demonstrate what's available. Each
+# line is the color code of one forground color,
+# out of 17 (default + 16 escapes), followed by a
+# test use of that color on all nine background
+# colors (default + 8 escapes).
+#
+# Author: Giles Orr
+# URL: http://gilesorr.com/bashprompt/howto/c350.html
+# License: GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation;
+# http://gilesorr.com/bashprompt/howto/a1004.html
+
+
+T='gYw' # The test text
+
+echo -e "\n 40m 41m 42m 43m\
+ 44m 45m 46m 47m";
+
+for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \
+ '1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \
+ ' 36m' '1;36m' ' 37m' '1;37m';
+ do FG=${FGs// /}
+ echo -en " $FGs \033[$FG $T "
+ for BG in 40m 41m 42m 43m 44m 45m 46m 47m;
+ do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";
+ done
+ echo;
+done
+echo
+
+echo -e "\e[0mCOLOR_NC (No color)"
+echo -e "\e[1;37mCOLOR_WHITE\t\e[0;30mCOLOR_BLACK"
+echo -e "\e[0;34mCOLOR_BLUE\t\e[1;34mCOLOR_LIGHT_BLUE"
+echo -e "\e[0;32mCOLOR_GREEN\t\e[1;32mCOLOR_LIGHT_GREEN"
+echo -e "\e[0;36mCOLOR_CYAN\t\e[1;36mCOLOR_LIGHT_CYAN"
+echo -e "\e[0;31mCOLOR_RED\t\e[1;31mCOLOR_LIGHT_RED"
+echo -e "\e[0;35mCOLOR_PURPLE\t\e[1;35mCOLOR_LIGHT_PURPLE"
+echo -e "\e[0;33mCOLOR_YELLOW\t\e[1;33mCOLOR_LIGHT_YELLOW"
+echo -e "\e[1;30mCOLOR_GRAY\t\e[0;37mCOLOR_LIGHT_GRAY"
diff --git a/.local/bin/py/xcolors.py b/.local/bin/py/xcolors.py
deleted file mode 100644
index 39010c7..0000000
--- a/.local/bin/py/xcolors.py
+++ /dev/null
@@ -1,55 +0,0 @@
-import os
-
-HOME=os.environ['HOME'] + '/'
-XCDIR=f'{HOME}.config/xcolors/'
-CSLIST=os.listdir(XCDIR)
-XRPATH=f'{HOME}.Xresources'
-ALPATH=f'{HOME}.config/alacritty/alacritty.yml'
-
-
-def update_xresources(csname):
- """
- Updates the ~/.Xresources file with new color scheme.
- """
- if csname not in CSLIST:
- return f"{csname} not in {XCDIR}"
-
- with open(XRPATH, 'r') as infile:
- lines = infile.readlines()
-
- with open(file_dir, 'w') as outfile:
- for i, line in enumerate(lines):
- if i == 4:
- nline = line.split('/')
- nline[-1] = csname + '"\n'
- nline = '/'.join(nline)
- outfile.write(nline)
- else:
- outfile.write(line)
-
-
-def update_alacritty(csname):
- """
- Updates the ~/.config/alacritty/alacritty.yml file with new color scheme.
- """
- if csname not in CSLIST:
- return f"{csname} not in {XCDIR}"
-
- with open(ALPATH, 'r') as infile:
- lines = infile.readlines()
-
- for line in lines:
- if 'background' in line:
- print(line)
-
- return None
-
- with open(file_dir, 'w') as outfile:
- for i, line in enumerate(lines):
- if i == 4:
- nline = line.split('/')
- nline[-1] = csname + '"\n'
- nline = '/'.join(nline)
- outfile.write(nline)
- else:
- outfile.write(line)
diff --git a/.local/bin/pys/xcolors.py b/.local/bin/pys/xcolors.py
new file mode 100644
index 0000000..39010c7
--- /dev/null
+++ b/.local/bin/pys/xcolors.py
@@ -0,0 +1,55 @@
+import os
+
+HOME=os.environ['HOME'] + '/'
+XCDIR=f'{HOME}.config/xcolors/'
+CSLIST=os.listdir(XCDIR)
+XRPATH=f'{HOME}.Xresources'
+ALPATH=f'{HOME}.config/alacritty/alacritty.yml'
+
+
+def update_xresources(csname):
+ """
+ Updates the ~/.Xresources file with new color scheme.
+ """
+ if csname not in CSLIST:
+ return f"{csname} not in {XCDIR}"
+
+ with open(XRPATH, 'r') as infile:
+ lines = infile.readlines()
+
+ with open(file_dir, 'w') as outfile:
+ for i, line in enumerate(lines):
+ if i == 4:
+ nline = line.split('/')
+ nline[-1] = csname + '"\n'
+ nline = '/'.join(nline)
+ outfile.write(nline)
+ else:
+ outfile.write(line)
+
+
+def update_alacritty(csname):
+ """
+ Updates the ~/.config/alacritty/alacritty.yml file with new color scheme.
+ """
+ if csname not in CSLIST:
+ return f"{csname} not in {XCDIR}"
+
+ with open(ALPATH, 'r') as infile:
+ lines = infile.readlines()
+
+ for line in lines:
+ if 'background' in line:
+ print(line)
+
+ return None
+
+ with open(file_dir, 'w') as outfile:
+ for i, line in enumerate(lines):
+ if i == 4:
+ nline = line.split('/')
+ nline[-1] = csname + '"\n'
+ nline = '/'.join(nline)
+ outfile.write(nline)
+ else:
+ outfile.write(line)
diff --git a/.profile b/.profile
index 064da8e..d98018a 100644
--- a/.profile
+++ b/.profile
@@ -3,7 +3,7 @@
#
##--Environment variables--##
## Modified env vars.
-export PATH="$PATH:$(du -L "$HOME/.local/bin/" | cut -f2 | tr '\n' ';' | sed 's/:*$//')"
+# export PATH="$PATH:$(du -L "$HOME/.local/bin/" | cut -f2 | tr '\n' ';' | sed 's/:*$//')"
## Default program.
export EDITOR="nvim"
diff --git a/.xinitrc b/.xinitrc
index 04c809a..0ddd63d 100644
--- a/.xinitrc
+++ b/.xinitrc
@@ -6,4 +6,4 @@
# but since display managers use ~/.xprofile instead,
# .xprofile is sourced to be compatible with both.
-[[ -f ~/.xprofile ]] && . ~/.xprofile
+# [[ -f ~/.xprofile ]] && . ~/.xprofile
diff --git a/.xprofile b/.xprofile
index c805b0d..4aaa84c 100644
--- a/.xprofile
+++ b/.xprofile
@@ -5,8 +5,8 @@
# This is run when a display manager logs in.
# Used as source for ~/.xinitrc.
-picom & # Transparency and stuff.
-dunst & # Notifications.
-nm-applet & # Network manager.
-udiskie & # Drive mounting.
-flameshot & # Screenshots.
+# picom & # Transparency and stuff.
+# dunst & # Notifications.
+# nm-applet & # Network manager.
+# udiskie & # Drive mounting.
+# flameshot & # Screenshots.
--
cgit v1.2.3-70-g09d2