summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <david@luevano.xyz>2021-03-03 22:47:20 -0700
committerDavid Luevano Alvarado <david@luevano.xyz>2021-03-03 22:47:20 -0700
commit48ad841f56bb73da2734f571507ece7848615e61 (patch)
treea2eb2fb31cf232fe5479489324b57a6dd573451e
parent3aea44014574efbb1fc7a2696ee1ee74c40fa95f (diff)
DELETE i3GAPS BLOCKS that I forgot, slightly changes to blog management tools
-rw-r--r--.config/flameshot/flameshot.ini2
-rw-r--r--.config/shell/aliasrc3
-rw-r--r--.config/shell/profile1
-rwxr-xr-x.local/bin/blocks/calendar40
-rwxr-xr-x.local/bin/blocks/cpu55
-rwxr-xr-x.local/bin/blocks/dunst59
-rwxr-xr-x.local/bin/blocks/gpu57
-rwxr-xr-x.local/bin/blocks/memory44
-rwxr-xr-x.local/bin/blocks/player136
-rwxr-xr-x.local/bin/blocks/volume-pulseaudio178
-rwxr-xr-x.local/bin/lsync17
-rwxr-xr-x.local/bin/mkblog4
-rwxr-xr-x.local/bin/ssg24
-rwxr-xr-x.local/bin/sshf3
14 files changed, 31 insertions, 592 deletions
diff --git a/.config/flameshot/flameshot.ini b/.config/flameshot/flameshot.ini
index c5d861e..86cbddf 100644
--- a/.config/flameshot/flameshot.ini
+++ b/.config/flameshot/flameshot.ini
@@ -1,6 +1,6 @@
[General]
disabledTrayIcon=false
-drawColor=#ff0010
+drawColor=#ff0000
drawThickness=2
filenamePattern=SS_%d%b%y_%I%M%S
saveAfterCopyPath=/home/lz/pix/ss
diff --git a/.config/shell/aliasrc b/.config/shell/aliasrc
index 10cb23a..e69d551 100644
--- a/.config/shell/aliasrc
+++ b/.config/shell/aliasrc
@@ -22,3 +22,6 @@ alias dots="/usr/bin/git --git-dir=$HOME/.dots/ --work-tree=$HOME"
# TexLive Manager fix as described in https://wiki.archlinux.org/index.php/TeX_Live
alias tlmgr="$TEXMFDIST/scripts/texlive/tlmgr.pl --usermode"
+
+# MyCli
+alias mycli="mycli --myclirc $HOME/.config/mycli/myclirc"
diff --git a/.config/shell/profile b/.config/shell/profile
index e3651ef..a7dc0a8 100644
--- a/.config/shell/profile
+++ b/.config/shell/profile
@@ -47,6 +47,7 @@ export GTK2_RC_FILES="$XDG_CONFIG_HOME/gtk-2.0/gtkrc"
export JUPYTER_CONFIG_DIR="$XDG_CONFIG_HOME/jupyter"
export JUPYTERLAB_DIR="$XDG_DATA_HOME/jupyter/lab"
# Other.
+export MYCLI_HISTFILE="$XDG_CACHE_HOME/mycli/history"
export ZDOTDIR="$XDG_CONFIG_HOME/zsh"
export CARGO_HOME="$XDG_DATA_HOME/cargo"
export GOPATH="$XDG_DATA_HOME/go"
diff --git a/.local/bin/blocks/calendar b/.local/bin/blocks/calendar
deleted file mode 100755
index a35cf65..0000000
--- a/.local/bin/blocks/calendar
+++ /dev/null
@@ -1,40 +0,0 @@
-#!/bin/bash
-
-LABEL=${LABEL:"+"}
-DATEFMT=${DATEFMT:-"+%a %d.%m.%Y %H:%M:%S"}
-SHORTFMT=${SHORTFMT:-"+%H:%M:%S"}
-WIDTH=${WIDTH:-200}
-HEIGHT=${HEIGHT:-200}
-
-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)
- # Position of the upper left corner of the popup.
- posX=$(($BLOCK_X - $WIDTH/2))
- posY=$(($BLOCK_Y + 20))
-
- 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
deleted file mode 100755
index 7f4bca0..0000000
--- a/.local/bin/blocks/cpu
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/perl
-
-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 <warning>] [-c <critical>] [-d <decimals>]\n";
- print "-w <percent>: warning threshold to become yellow\n";
- print "-c <percent>: critical threshold to become red\n";
- print "-d <decimals>: Use <decimals> 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 (<MPSTAT>) {
- 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';
-
-# Full text.
-printf "%s %.${decimals}f%%\n", $label, $cpu_usage;
-# Short text.
-printf "%s %.${decimals}f%%\n", $label, $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/dunst b/.local/bin/blocks/dunst
deleted file mode 100755
index 6f7ab0c..0000000
--- a/.local/bin/blocks/dunst
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/usr/bin/python
-"""
-A do-not-disturb button for muting Dunst notifications in i3 using i3blocks
-Mute is handled by passing 'DUNST_COMMAND_PAUSE' and 'DUNST_COMMAND_RESUME' to
-the notify-send script and the 'DUNST_MUTE' environment variable is set to keep
-track of the toggle.
-"""
-import os
-import subprocess
-import json
-
-
-def mute_on():
- '''Turns off dunst notifications'''
- subprocess.run(["notify-send", "DUNST_COMMAND_PAUSE"], check=True)
- return {
- "full_text":"<span font='Font Awesome 5 Free Solid' color='#BE616E'>\uf1f6</span>",
- "DUNST_MUTE":"on"
- }
-
-
-def mute_off():
- '''Turns back on dunst notifications'''
- subprocess.run(["notify-send", "DUNST_COMMAND_RESUME"], check=True)
- return {
- "full_text":"<span font='Font Awesome 5 Free Solid' color='#A4B98E'>\uf0f3</span>",
- "DUNST_MUTE":"off"
- }
-
-
-def clicked():
- '''Returns True if the button was clicked'''
- button = "BLOCK_BUTTON" in os.environ and os.environ["BLOCK_BUTTON"]
- return bool(button)
-
-
-def muted():
- '''Returns True if Dunst is muted'''
- mute = "DUNST_MUTE" in os.environ and os.environ["DUNST_MUTE"]
- return mute == 'on'
-
-
-if clicked():
- # toggle button click to turn mute on and off
- if muted():
- RTN = mute_off()
- else:
- RTN = mute_on()
-
-
-else:
- # Set default state using 'DUNST_MUTE' environment variable
- if muted():
- RTN = mute_on()
- else:
- RTN = mute_off()
-
-
-print(json.dumps(RTN))
diff --git a/.local/bin/blocks/gpu b/.local/bin/blocks/gpu
deleted file mode 100755
index b20fc4a..0000000
--- a/.local/bin/blocks/gpu
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/usr/bin/perl
-
-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 <warning>] [-c <critical>]\n";
- print "-w <percent>: warning threshold to become amber\n";
- print "-c <percent>: 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 (<NVS>) {
- 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';
-
-# Full text.
-# printf "%s %.0f%% %.0f%% %.0f%% %.0f%%\n", $label, $gpu_usage, $gpu_mem, $gpu_video, $gpu_pcie;
-printf "%s %.0f%% %.0f%%\n", $label, $gpu_usage, $gpu_mem;
-# Short text.
-printf "%s %.0f%% %.0f%%\n", $label, $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
deleted file mode 100755
index c581a53..0000000
--- a/.local/bin/blocks/memory
+++ /dev/null
@@ -1,44 +0,0 @@
-#!/bin/bash
-
-LABEL=${LABEL:"+"}
-TYPE="${TYPE:-mem}"
-
-awk -v type=$TYPE '
-/^MemTotal:/ {
- mem_total=$2
-}
-/^MemFree:/ {
- mem_free=$2
-}
-/^Buffers:/ {
- mem_free+=$2
-}
-/^Cached:/ {
- mem_free+=$2
-}
-END {
- 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("%s %.1fG/%.1fG (%.f%%)\n", LABEL, used, total, pct)
- printf("%s %.1fG\n", LABEL, used)
- # Short text.
- printf("%s %.f%%\n", LABEL, 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/player b/.local/bin/blocks/player
deleted file mode 100755
index cc17a4e..0000000
--- a/.local/bin/blocks/player
+++ /dev/null
@@ -1,136 +0,0 @@
-#!/usr/bin/env perl
-
-use Time::HiRes qw(usleep);
-use Env qw(BLOCK_INSTANCE);
-
-use constant DELAY => 50; # Delay in ms to let network-based players (spotify) reflect new data.
-use constant SPOTIFY_STR => 'spotify';
-
-my $label = $ENV{LABEL} // "";
-my @metadata = ();
-my $player_arg = "";
-
-if ($BLOCK_INSTANCE) {
- $player_arg = "--player='$BLOCK_INSTANCE'";
-}
-
-sub buttons {
- my $method = shift;
-
- if($method eq 'mpd') {
- if ($ENV{'BLOCK_BUTTON'} == 1) {
- system("mpc prev");
- } elsif ($ENV{'BLOCK_BUTTON'} == 2) {
- system("mpc toggle");
- } elsif ($ENV{'BLOCK_BUTTON'} == 3) {
- system("mpc next");
- } elsif ($ENV{'BLOCK_BUTTON'} == 4) {
- system("mpc volume +10");
- } elsif ($ENV{'BLOCK_BUTTON'} == 5) {
- system("mpc volume -10");
- }
- } elsif ($method eq 'cmus') {
- if ($ENV{'BLOCK_BUTTON'} == 1) {
- system("cmus-remote --prev");
- } elsif ($ENV{'BLOCK_BUTTON'} == 2) {
- system("cmus-remote --pause");
- } elsif ($ENV{'BLOCK_BUTTON'} == 3) {
- system("cmus-remote --next");
- }
- } elsif ($method eq 'playerctl') {
- if ($ENV{'BLOCK_BUTTON'} == 1) {
- system("playerctl $player_arg previous");
- usleep(DELAY * 1000) if $BLOCK_INSTANCE eq SPOTIFY_STR;
- } elsif ($ENV{'BLOCK_BUTTON'} == 2) {
- system("playerctl $player_arg play-pause");
- } elsif ($ENV{'BLOCK_BUTTON'} == 3) {
- system("playerctl $player_arg next");
- usleep(DELAY * 1000) if $BLOCK_INSTANCE eq SPOTIFY_STR;
- } elsif ($ENV{'BLOCK_BUTTON'} == 4) {
- system("playerctl $player_arg volume 0.01+");
- } elsif ($ENV{'BLOCK_BUTTON'} == 5) {
- system("playerctl $player_arg volume 0.01-");
- }
- } elsif ($method eq 'rhythmbox') {
- if ($ENV{'BLOCK_BUTTON'} == 1) {
- system("rhythmbox-client --previous");
- } elsif ($ENV{'BLOCK_BUTTON'} == 2) {
- system("rhythmbox-client --play-pause");
- } elsif ($ENV{'BLOCK_BUTTON'} == 3) {
- system("rhythmbox-client --next");
- }
- }
-}
-
-print("$label ");
-sub cmus {
- my @cmus = split /^/, qx(cmus-remote -Q);
- if ($? == 0) {
- foreach my $line (@cmus) {
- my @data = split /\s/, $line;
- if (shift @data eq 'tag') {
- my $key = shift @data;
- my $value = join ' ', @data;
-
- @metadata[0] = $value if $key eq 'artist';
- @metadata[1] = $value if $key eq 'title';
- }
- }
-
- if (@metadata) {
- buttons('cmus');
-
- # metadata found so we are done
- print(join ' - ', @metadata);
- exit 0;
- }
- }
-}
-
-sub mpd {
- my $data = qx(mpc current);
- if (not $data eq '') {
- buttons("mpd");
- print($data);
- exit 0;
- }
-}
-
-sub playerctl {
- buttons('playerctl');
-
- my $artist = qx(playerctl $player_arg metadata artist);
- chomp $artist;
- # exit status will be nonzero when playerctl cannot find your player
- exit(0) if $? || $artist eq '(null)';
-
- push(@metadata, $artist) if $artist;
-
- my $title = qx(playerctl $player_arg metadata title);
- exit(0) if $? || $title eq '(null)';
-
- push(@metadata, $title) if $title;
-
- print(join(" - ", @metadata)) if @metadata;
-}
-
-sub rhythmbox {
- buttons('rhythmbox');
-
- my $data = qx(rhythmbox-client --print-playing --no-start);
- print($data);
-}
-
-if ($player_arg eq '' or $player_arg =~ /mpd/) {
- mpd;
-}
-elsif ($player_arg =~ /cmus/) {
- cmus;
-}
-elsif ($player_arg =~ /rhythmbox/) {
- rhythmbox;
-}
-else {
- playerctl;
-}
-print("\n");
diff --git a/.local/bin/blocks/volume-pulseaudio b/.local/bin/blocks/volume-pulseaudio
deleted file mode 100755
index 071537f..0000000
--- a/.local/bin/blocks/volume-pulseaudio
+++ /dev/null
@@ -1,178 +0,0 @@
-#!/bin/bash
-
-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" |\
-grep "alsa.card_name" |\
-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"
- # I added this only to print "custom color" when muted.
- if [[ $MUTED =~ "yes" ]] ; then
- echo "$COLOR"
- fi
- 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/lsync b/.local/bin/lsync
index 136e43e..533710d 100755
--- a/.local/bin/lsync
+++ b/.local/bin/lsync
@@ -1,25 +1,10 @@
#!/bin/sh
# Push to luevano.xyz
-# This pushes everything! (except for blog, since it needs a bit mor management)
+# This pushes everything! (except for blog, since it needs a bit more management)
echo "rsync: pushing (U) local (lz) to webserver (lzserver). (luevano.xyz)"
rsync -rtuvP --delete-after --exclude-from=$HOME/dox/www/luevano.xyz/.rsyncignore $HOME/dox/www/luevano.xyz/ lzr:/var/www/
# This pushes the blog.
echo "rsync: pushing (U) local (lz) to webserver (lzserver). (blog.luevano.xyz)"
rsync -rtuvP --delete-after $HOME/dox/www/luevano.xyz/blog/dst/ lzr:/var/www/blog/
-
-# Only static.luevano.xyz.
-# echo "rsync: pushing (U) local (lz) to webserver (lzserver). (luevano.xyz)"
-# rsync -rtuvP --delete-after $HOME/dox/www/luevano.xyz/static/ lzr:/var/www/static/
-
-# Only luevano.xyz.
-# echo "rsync: pushing (U) local (lz) to webserver (lzserver). (luevano.xyz)"
-# rsync -rtuvP --delete-after $HOME/dox/www/luevano.xyz/luevano/ lzr:/var/www/luevano/
-
-# Only gb.luevano.xyz.
-# echo "rsync: pushing (U) local (lz) to webserver (lzserver). (luevano.xyz)"
-# rsync -rtuvP --delete-after $HOME/dox/www/luevano.xyz/gb/ lzr:/var/www/gb/
-
-# echo "rsync: pulling (U) webserver (lzserver) to local (lz)."
-# rsync -rtuvP lzr:/var/www/luevano/ $HOME/dox/www/luevano
diff --git a/.local/bin/mkblog b/.local/bin/mkblog
index c364202..3358b01 100755
--- a/.local/bin/mkblog
+++ b/.local/bin/mkblog
@@ -1,4 +1,6 @@
#!/bin/sh
-# Run ssg to make the blog. (blog.luevano.xyz)
+# Create _header.html and _footer.html based on index.html from luevano.xyz.
+sshf $HOME'/dox/www/luevano.xyz/luevano/index.html' $HOME'/dox/www/luevano.xyz/blog/src'
+# Run ssg to make the blog. (blog.luevano.xyz)
ssg $HOME'/dox/www/luevano.xyz/blog/src' $HOME'/dox/www/luevano.xyz/blog/dst' "Luevano's blog" 'https://blog.luevano.xyz'
diff --git a/.local/bin/ssg b/.local/bin/ssg
index 5339958..805fd83 100755
--- a/.local/bin/ssg
+++ b/.local/bin/ssg
@@ -101,6 +101,8 @@ main() {
test -n "$urls" &&
render_sitemap "$urls" "$base_url" "$date" > "$dst/sitemap.xml"
+ render_article_list "$urls" "$base_url" "$dst" "$src"
+
print_status 'url' 'urls' "$urls" >&2
echo >&2
}
@@ -189,9 +191,10 @@ render_md_files_lowdown() {
while read -r f
do
lowdown \
- -D html-skiphtml \
- -d metadata \
- -d autolink < "$1/$f" |
+ --html-no-skiphtml \
+ --html-no-escapehtml \
+ --html-no-owasp \
+ --html-no-head-ids < "$1/$f" |
render_html_file "$3" \
> "$2/${f%\.md}.html"
done
@@ -237,13 +240,26 @@ render_html_file() {
}'
}
-
list_pages() {
e="\\( -name '*.html' -o -name '*.md' \\)"
cd "$1" && eval "find . -type f ! -path '*/.*' ! -path '*/_*' $IGNORE $e" |
sed 's#^./##;s#.md$#.html#;s#/index.html$#/#'
}
+render_article_list() {
+ urls="$1"
+ base_url="$2"
+ items=""
+ for i in $1; do
+ if ! echo $i | grep "index"; then
+ url="$i"
+ page_title=$(head -n 1 "$4/${i%\.html}.md" | cut -c 3-)
+ item="<li><a href=https://blog.luevano.xyz/${url}>${page_title}</a></li>"
+ items=$items$item
+ fi
+ done
+ sed -i "s|<hr/>|<ul class="articles">${items}</ul>|g" "$3/index.html"
+}
render_sitemap() {
urls="$1"
diff --git a/.local/bin/sshf b/.local/bin/sshf
index 85a0055..44766bc 100755
--- a/.local/bin/sshf
+++ b/.local/bin/sshf
@@ -3,9 +3,10 @@
# Get the _header.html and _footer.html required for ssg from an already defined html.
main() {
in_file="${1:-$HOME/dox/www/luevano.xyz/luevano/index.html}"
- out_folder="${2:-$HOME/dow/www/blog/src/}"
+ out_folder="${2:-$HOME/dow/www/blog/src}"
sed '/<\/header/q' $in_file > $out_folder/_header.html
+ sed -i "s/<title>Luévano/<title>Luévano's Blog/g" $out_folder/_header.html
# Not proud of this, lol.
tac $in_file | sed '/<footer/q' | tac > $out_folder/_footer.html
}