From db5bd1f26d1a498658d46aff58d0c46950a2ad6c Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 07:46:15 -0500
Subject: [PATCH 01/10] Vim: Update template plugin

---
 .vim/bundle/vim-template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.vim/bundle/vim-template b/.vim/bundle/vim-template
index b2fe1823..db11ae8b 160000
--- a/.vim/bundle/vim-template
+++ b/.vim/bundle/vim-template
@@ -1 +1 @@
-Subproject commit b2fe18239d862120778175c0e1a768c74a5cb6c0
+Subproject commit db11ae8bf0a13d6b01dd5f2b5a3e401b33d3c8fc

From 65bd43469828a5f59b48352adba4f2d5d88758d0 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 08:04:36 -0500
Subject: [PATCH 02/10] Polybar: Fully-qualify dirty i3 hack

---
 .config/polybar/launch.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/.config/polybar/launch.sh b/.config/polybar/launch.sh
index 825dd767..d7da1ff7 100755
--- a/.config/polybar/launch.sh
+++ b/.config/polybar/launch.sh
@@ -66,7 +66,9 @@ step_wait() {
 # Main
 main() {
 	# Dirty hack for i3
-	sleep 2
+	if pgrep -x i3 > /dev/null 2>&1; then
+		sleep 2
+	fi
 	step_fallback
 	step_configure
 	step_spawn_primary

From 307daaccf83eb0fdcd2c342c9e3572d1effe1667 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 08:06:50 -0500
Subject: [PATCH 03/10] Polybar: Remove trailing whitespace from figlet

---
 .config/polybar/config | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.config/polybar/config b/.config/polybar/config
index 80d1ab61..9af98e60 100644
--- a/.config/polybar/config
+++ b/.config/polybar/config
@@ -1,10 +1,10 @@
 # vim:ft=dosini
-#              _       _                
-#  _ __   ___ | |_   _| |__   __ _ _ __ 
+#              _       _
+#  _ __   ___ | |_   _| |__   __ _ _ __
 # | '_ \ / _ \| | | | | '_ \ / _` | '__|
-# | |_) | (_) | | |_| | |_) | (_| | |   
-# | .__/ \___/|_|\__, |_.__/ \__,_|_|   
-# |_|            |___/                  
+# | |_) | (_) | | |_| | |_) | (_| | |
+# | .__/ \___/|_|\__, |_.__/ \__,_|_|
+# |_|            |___/
 #
 # Copyright (c) 2020 Vintage Salt <rehashedsalt@cock.li>
 # Distributed under the terms of the MIT License

From 6fb54330a1f29924be13e9eafb0a3b41496f0fe3 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 08:08:38 -0500
Subject: [PATCH 04/10] Polybar: Why

---
 .config/polybar/config | 1 -
 1 file changed, 1 deletion(-)

diff --git a/.config/polybar/config b/.config/polybar/config
index 9af98e60..c74a7f08 100644
--- a/.config/polybar/config
+++ b/.config/polybar/config
@@ -143,7 +143,6 @@ label-empty-padding = 4
 [module/cpu]
 type = internal/cpu
 interval = 1
-
 format = <bar-load>
 format-prefix = "CPU: "
 format-prefix-foreground = ${res/colors.blue}

From 85eedfdf3743c51081a9a02acf5780faf20b5f38 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 17:40:10 -0500
Subject: [PATCH 05/10] Firestarter, Conky: Generate config file on-demand Now
 to implement fun things

---
 .config/conky/conky.conf         |   6 +-
 .config/conky/gen.sh             | 255 +++++++++++++++++++++++++++++++
 .config/firestarter/stat-glances |   2 +
 3 files changed, 260 insertions(+), 3 deletions(-)
 create mode 100755 .config/conky/gen.sh

diff --git a/.config/conky/conky.conf b/.config/conky/conky.conf
index 29f02def..9a79e3ad 100644
--- a/.config/conky/conky.conf
+++ b/.config/conky/conky.conf
@@ -1,5 +1,7 @@
 -- vim: ts=4 sw=4 noet ai cindent syntax=lua
-
+-- WARNING:
+-- This file was generated with conkygen. See gen.sh if you need to edit this!
+-- Any changes you make here can and probably will be clobbered!
 conky.config = {
 	own_window = true,
 	own_window_title = 'Conky',
@@ -50,7 +52,6 @@ conky.config = {
 	draw_graph_borders = true,
 	draw_shades = false
 }
-
 conky.text = [[
 ${font Roboto:style=Light:size=30}$alignr${no_update $nodename_short}$font
 ${font Roboto:style=Light:size=17}$alignr${time %I:%M %p}$font
@@ -96,4 +97,3 @@ ${color6}${upspeedgraph eno1 36,200} ${downspeedgraph eno1 36,200}$color$endif${
 enp0s20f0u2 (U/D):$alignr${addr enp0s20f0u2}
 ${color6}${upspeedgraph enp0s20f0u2 36,200} ${downspeedgraph enp0s20f0u2 36,200}$color$endif
 ]]
-
diff --git a/.config/conky/gen.sh b/.config/conky/gen.sh
new file mode 100755
index 00000000..75e5d63c
--- /dev/null
+++ b/.config/conky/gen.sh
@@ -0,0 +1,255 @@
+#! /bin/bash
+#                  _
+#   ___ ___  _ __ | | ___   _  __ _  ___ _ __
+#  / __/ _ \| '_ \| |/ / | | |/ _` |/ _ \ '_ \
+# | (_| (_) | | | |   <| |_| | (_| |  __/ | | |
+#  \___\___/|_| |_|_|\_\\__, |\__, |\___|_| |_|
+#                       |___/ |___/
+#
+# conkygen.sh
+# Create a Conky configuration file dynamically
+#
+# Copyright (c) 2020 Vintage Salt <rehashedsalt@cock.li>
+# Distributed under the terms of the MIT License
+#
+set -e
+
+# Read-only set-once variables
+declare -r _name="$(basename -- "$0")"
+# Options
+declare _optout="./conky.conf"
+declare -i _opthelp
+declare -i _optverbose
+# Working variables
+declare -a _args
+declare _return
+
+# Helper functions
+log() {
+	# Print a line to the terminal if _optverbose is greater than $2
+	# $2 defaults to 0
+	# loglevel 0: Daily-use messages
+	# loglevel 1: Detailed but not quite debugging
+	# loglevel 2: Definitely debugging
+	[ -z "$1" ] && return 1
+	if (( _optverbose >= ${2:-0} )); then
+		printf "%s\\n" "$1"
+	fi
+}
+warn() {
+	# Print a yellow line to the terminal, respecting _optverbose
+	[ -z "$1" ] && return 1
+	if (( _optverbose >= ${2:-0} )); then
+		if [ -t 1 ]; then
+			printf "\\e[33m%s\\e[0m\\n" "$1"
+		else
+			printf "WARN: %s\\n" "$1"
+		fi
+	fi
+}
+error() {
+	# Print a red line to the terminal, exit if $2 is specified
+	[ -z "$1" ] && return 1
+	if [ -t 2 ]; then
+		printf "\\e[31m%s\\e[0m\\n" "$1" 1>&2
+	else
+		printf "ERROR: %s\\n" "$1" 1>&2
+	fi
+	[ -z "$2" ] && return
+	exit "${2:-1}"
+}
+has() {
+	# Parse out all arguments and try to find them in path
+	# If an argument cannot be found, set _return and fail
+	for prog in "$@"; do
+		if ! command -v "$prog" > /dev/null 2>&1; then
+			_return="$prog"
+			return 1
+		fi
+	done
+	return 0
+}
+
+# Core program functions
+printhelp() {
+	cat << EOF
+Usage: $_name [OPTION]...
+Generate a conky.conf configuration file in the current directory
+
+  -o			Specify output file. Defaults to ./conky.conf
+  -h			Print this help text
+  -v			Print more status messages. Stacks
+
+Copyright (c) 2020 rehashedsalt@cock.li
+Licensed under the MIT license
+EOF
+}
+step_header() {
+	# Clobber output file with header
+	cat << EOF > "$_optout"
+-- vim: ts=4 sw=4 noet ai cindent syntax=lua
+-- WARNING:
+-- This file was generated with conkygen. See gen.sh if you need to edit this!
+-- Any changes you make here can and probably will be clobbered!
+EOF
+}
+step_config() {
+	# Append config to the output file
+	cat << EOF >> "$_optout"
+conky.config = {
+	own_window = true,
+	own_window_title = 'Conky',
+	own_window_class = 'Conky',
+	own_window_type = 'desktop',
+	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
+	own_window_argb_visual = true,
+	own_window_transparent = true,
+	own_window_colour = '000000',
+
+	double_buffer = true,
+	cpu_avg_samples = 2,
+	net_avg_samples = 2,
+	no_buffers = true,
+	update_interval = 1,
+
+	use_xft = true,
+	font = 'Roboto:style=Light:size=9',
+	default_color = '#fffcf6',
+	color1 = '383c4a', -- Background
+	color2 = 'fffcf6', -- Foreground
+	color3 = '4b5162', -- Background-alt
+	color4 = '11d116', -- Green (Battery)
+	color6 = '1abc9c', -- Cyan (Network)
+	color7 = 'fdbc4b', -- Yellow (Disk)
+	color8 = '1d99f3', -- Blue (CPU)
+	color9 = '9b59b6', -- Magenta (Memory)
+
+	alignment = 'bottom_right',
+	xinerama_head = 0,
+	minimum_height = 0,
+	minimum_width = 304,
+	border_width = 0,
+	border_outer_margin = 1,
+	border_inner_margin = 16,
+	gap_x = 32,
+	gap_y = 48,
+
+	format_human_readable = true,
+	temperature_unit = "celsius",
+	if_up_strictness = "link",
+
+	default_bar_height = 11,
+	default_bar_width = 130,
+	default_graph_height = 36,
+	draw_borders = true,
+	draw_outline = false,
+	draw_graph_borders = true,
+	draw_shades = false
+}
+EOF
+}
+step_text() {
+	# Generate our actual functional Conky stuff
+	cat << 'EOF' >> "$_optout"
+conky.text = [[
+${font Roboto:style=Light:size=30}$alignr${no_update $nodename_short}$font
+${font Roboto:style=Light:size=17}$alignr${time %I:%M %p}$font
+${font Roboto:style=Light:size=12}${acpitemp}°C$alignr${time %A, %B %d, %Y}$font
+${color3}$hr$color
+${font Roboto:style=Medium:size=9}CPU$font: $freq_g GHz$alignr$cpu%
+${color8}${cpugraph cpu1 36,200} ${cpugraph cpu2 36,200}
+${cpugraph cpu3 36,200} ${cpugraph cpu4 36,200}$color
+${color8}${top name 1}$color$alignr${top cpu 1}%
+${color8}${top name 2}$color$alignr${top cpu 2}%
+${color8}${top name 3}$color$alignr${top cpu 3}%
+${color8}${top name 4}$color$alignr${top cpu 4}%
+${color3}$hr$color
+${font Roboto:style=Medium:size=9}Memory$font: $mem / $memmax used$alignr$memperc%
+${color9}${memgraph}$color
+Memory$alignr$memeasyfree ${color9}${membar}$color
+Swap$alignr$swapfree ${color9}${swapbar}$color
+${color9}${top_mem name 1}$color$alignr${top_mem mem 1}%
+${color9}${top_mem name 2}$color$alignr${top_mem mem 2}%
+${color9}${top_mem name 3}$color$alignr${top_mem mem 3}%
+${color9}${top_mem name 4}$color$alignr${top_mem mem 4}%
+${color3}$hr$color
+${font Roboto:style=Medium:size=9}Disk$font (R/W):$alignr${diskio /dev/sda}
+${color7}${diskiograph_read /dev/sda 36,200} ${diskiograph_write /dev/sda 36,200}$color
+/$alignr${fs_free /} ${color7}${fs_bar /}$color
+/home$alignr${fs_free /home} ${color7}${fs_bar /home}$color
+/boot$alignr${fs_free /boot} ${color7}${fs_bar /boot}$color
+/boot/efi$alignr${fs_free /boot/efi} ${color7}${fs_bar /boot/efi}$color
+${color7}${top_io name 1}$color$alignr${top_io io_perc 1}%
+${color7}${top_io name 2}$color$alignr${top_io io_perc 2}%
+${color7}${top_io name 3}$color$alignr${top_io io_perc 3}%
+${color7}${top_io name 4}$color$alignr${top_io io_perc 4}%
+${color3}$hr$color
+${font Roboto:style=Medium:size=9}Network$font:${alignr}Default $gw_iface${if_up wlp1s0}
+wlp1s0 (U/D):$alignr${addr wlp1s0} / ${wireless_essid wlp1s0}
+${color6}${upspeedgraph wlp1s0 36,200} ${downspeedgraph wlp1s0 36,200}$color$endif${if_up wlp5s0}
+wlp5s0 (U/D):$alignr${addr wlp5s0} / ${wireless_essid wlp5s0}
+${color6}${upspeedgraph wlp5s0 36,200} ${downspeedgraph wlp5s0 36,200}$color$endif${if_up enp0s31f6}
+enp0s31f6 (U/D):$alignr${addr enp0s31f6}
+${color6}${upspeedgraph enp0s31f6 36,200} ${downspeedgraph enp0s31f6 36,200}$color$endif${if_up eno1}
+eno1 (U/D):$alignr${addr eno1}
+${color6}${upspeedgraph eno1 36,200} ${downspeedgraph eno1 36,200}$color$endif${if_up enp0s20f0u2}
+enp0s20f0u2 (U/D):$alignr${addr enp0s20f0u2}
+${color6}${upspeedgraph enp0s20f0u2 36,200} ${downspeedgraph enp0s20f0u2 36,200}$color$endif
+]]
+EOF
+}
+genconfig() {
+	step_header
+	step_config
+	step_text
+}
+
+# Main
+main() {
+	# Parse out arguments
+	while [ -n "$1" ]; do
+		# Parse out flags
+		while getopts ":ho:v" opt; do
+			case $opt in
+				o)
+					_optout="$OPTARG"
+					;;
+				h)
+					_opthelp=1
+					;;
+				v)
+					_optverbose+=1
+					;;
+				:)
+					error "Option requires argument: -$OPTARG" 2
+					;;
+				*)
+					error "Invalid option: -$OPTARG" 2
+					;;
+			esac
+		done
+		# Store arguments
+		shift $((OPTIND - 1))
+		if [ -n "$1" ]; then
+			_args+=("$1")
+			shift
+		fi
+		unset OPTIND
+	done
+	# Early hook for help
+	[ -n "$_opthelp" ] && printhelp && exit 0
+	# Validate critical options
+	# TODO: That
+	# Validate core program dependencies
+	log "Validating dependencies" 2
+	if ! has basename; then
+		error "Failed to find program: $_return" 1
+	fi
+
+	# Do the do
+	genconfig
+	exit 0
+}
+
+main "$@"
+
diff --git a/.config/firestarter/stat-glances b/.config/firestarter/stat-glances
index 3e5a7551..08f8109e 100644
--- a/.config/firestarter/stat-glances
+++ b/.config/firestarter/stat-glances
@@ -3,5 +3,7 @@
 :
 # Note: the dumb sleep hack is because Conky crashes with window_type override if the WM hasn't loaded yet
 # This gives the WM ample time to load up
+command -v conky && [ -r "${XDG_CONFIG_HOME:-/home/salt/.config}/conky/gen.sh" ]
+sleep 5 && "${XDG_CONFIG_HOME:-/home/salt/.config}/conky/gen.sh" && conky
 command -v conky && [ -r "${XDG_CONFIG_HOME:-/home/salt/.config}/conky/conky.conf" ]
 sleep 5 && conky

From 2dd26fcbabf9ade41fc6241a0d61b3e516dfe5f0 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 17:44:15 -0500
Subject: [PATCH 06/10] Conky: Stop tracking config since it's now
 dynamically-generated

---
 .config/conky/conky.conf | 99 ----------------------------------------
 .config/conky/gen.sh     | 14 ++++++
 2 files changed, 14 insertions(+), 99 deletions(-)
 delete mode 100644 .config/conky/conky.conf

diff --git a/.config/conky/conky.conf b/.config/conky/conky.conf
deleted file mode 100644
index 9a79e3ad..00000000
--- a/.config/conky/conky.conf
+++ /dev/null
@@ -1,99 +0,0 @@
--- vim: ts=4 sw=4 noet ai cindent syntax=lua
--- WARNING:
--- This file was generated with conkygen. See gen.sh if you need to edit this!
--- Any changes you make here can and probably will be clobbered!
-conky.config = {
-	own_window = true,
-	own_window_title = 'Conky',
-	own_window_class = 'Conky',
-	own_window_type = 'desktop',
-	own_window_hints = 'undecorated,below,sticky,skip_taskbar,skip_pager',
-	own_window_argb_visual = true,
-	own_window_transparent = true,
-	own_window_colour = '000000',
-
-	double_buffer = true,
-	cpu_avg_samples = 2,
-	net_avg_samples = 2,
-	no_buffers = true,
-	update_interval = 1,
-
-	use_xft = true,
-	font = 'Roboto:style=Light:size=9',
-	default_color = '#fffcf6',
-	color1 = '383c4a', -- Background
-	color2 = 'fffcf6', -- Foreground
-	color3 = '4b5162', -- Background-alt
-	color4 = '11d116', -- Green (Battery)
-	color6 = '1abc9c', -- Cyan (Network)
-	color7 = 'fdbc4b', -- Yellow (Disk)
-	color8 = '1d99f3', -- Blue (CPU)
-	color9 = '9b59b6', -- Magenta (Memory)
-
-	alignment = 'bottom_right',
-	xinerama_head = 0,
-	minimum_height = 0,
-	minimum_width = 304,
-	border_width = 0,
-	border_outer_margin = 1,
-	border_inner_margin = 16,
-	gap_x = 32,
-	gap_y = 48,
-
-	format_human_readable = true,
-	temperature_unit = "celsius",
-	if_up_strictness = "link",
-
-	default_bar_height = 11,
-	default_bar_width = 130,
-	default_graph_height = 36,
-	draw_borders = true,
-	draw_outline = false,
-	draw_graph_borders = true,
-	draw_shades = false
-}
-conky.text = [[
-${font Roboto:style=Light:size=30}$alignr${no_update $nodename_short}$font
-${font Roboto:style=Light:size=17}$alignr${time %I:%M %p}$font
-${font Roboto:style=Light:size=12}${acpitemp}°C$alignr${time %A, %B %d, %Y}$font
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}CPU$font: $freq_g GHz$alignr$cpu%
-${color8}${cpugraph cpu1 36,200} ${cpugraph cpu2 36,200}
-${cpugraph cpu3 36,200} ${cpugraph cpu4 36,200}$color
-${color8}${top name 1}$color$alignr${top cpu 1}%
-${color8}${top name 2}$color$alignr${top cpu 2}%
-${color8}${top name 3}$color$alignr${top cpu 3}%
-${color8}${top name 4}$color$alignr${top cpu 4}%
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}Memory$font: $mem / $memmax used$alignr$memperc%
-${color9}${memgraph}$color
-Memory$alignr$memeasyfree ${color9}${membar}$color
-Swap$alignr$swapfree ${color9}${swapbar}$color
-${color9}${top_mem name 1}$color$alignr${top_mem mem 1}%
-${color9}${top_mem name 2}$color$alignr${top_mem mem 2}%
-${color9}${top_mem name 3}$color$alignr${top_mem mem 3}%
-${color9}${top_mem name 4}$color$alignr${top_mem mem 4}%
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}Disk$font (R/W):$alignr${diskio /dev/sda}
-${color7}${diskiograph_read /dev/sda 36,200} ${diskiograph_write /dev/sda 36,200}$color
-/$alignr${fs_free /} ${color7}${fs_bar /}$color
-/home$alignr${fs_free /home} ${color7}${fs_bar /home}$color
-/boot$alignr${fs_free /boot} ${color7}${fs_bar /boot}$color
-/boot/efi$alignr${fs_free /boot/efi} ${color7}${fs_bar /boot/efi}$color
-${color7}${top_io name 1}$color$alignr${top_io io_perc 1}%
-${color7}${top_io name 2}$color$alignr${top_io io_perc 2}%
-${color7}${top_io name 3}$color$alignr${top_io io_perc 3}%
-${color7}${top_io name 4}$color$alignr${top_io io_perc 4}%
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}Network$font:${alignr}Default $gw_iface${if_up wlp1s0}
-wlp1s0 (U/D):$alignr${addr wlp1s0} / ${wireless_essid wlp1s0}
-${color6}${upspeedgraph wlp1s0 36,200} ${downspeedgraph wlp1s0 36,200}$color$endif${if_up wlp5s0}
-wlp5s0 (U/D):$alignr${addr wlp5s0} / ${wireless_essid wlp5s0}
-${color6}${upspeedgraph wlp5s0 36,200} ${downspeedgraph wlp5s0 36,200}$color$endif${if_up enp0s31f6}
-enp0s31f6 (U/D):$alignr${addr enp0s31f6}
-${color6}${upspeedgraph enp0s31f6 36,200} ${downspeedgraph enp0s31f6 36,200}$color$endif${if_up eno1}
-eno1 (U/D):$alignr${addr eno1}
-${color6}${upspeedgraph eno1 36,200} ${downspeedgraph eno1 36,200}$color$endif${if_up enp0s20f0u2}
-enp0s20f0u2 (U/D):$alignr${addr enp0s20f0u2}
-${color6}${upspeedgraph enp0s20f0u2 36,200} ${downspeedgraph enp0s20f0u2 36,200}$color$endif
-]]
diff --git a/.config/conky/gen.sh b/.config/conky/gen.sh
index 75e5d63c..c9fecf9d 100755
--- a/.config/conky/gen.sh
+++ b/.config/conky/gen.sh
@@ -150,11 +150,15 @@ EOF
 }
 step_text() {
 	# Generate our actual functional Conky stuff
+	# Header
 	cat << 'EOF' >> "$_optout"
 conky.text = [[
 ${font Roboto:style=Light:size=30}$alignr${no_update $nodename_short}$font
 ${font Roboto:style=Light:size=17}$alignr${time %I:%M %p}$font
 ${font Roboto:style=Light:size=12}${acpitemp}°C$alignr${time %A, %B %d, %Y}$font
+EOF
+	# CPU info
+	cat << 'EOF' >> "$_optout"
 ${color3}$hr$color
 ${font Roboto:style=Medium:size=9}CPU$font: $freq_g GHz$alignr$cpu%
 ${color8}${cpugraph cpu1 36,200} ${cpugraph cpu2 36,200}
@@ -163,6 +167,9 @@ ${color8}${top name 1}$color$alignr${top cpu 1}%
 ${color8}${top name 2}$color$alignr${top cpu 2}%
 ${color8}${top name 3}$color$alignr${top cpu 3}%
 ${color8}${top name 4}$color$alignr${top cpu 4}%
+EOF
+	# Memory info
+	cat << 'EOF' >> "$_optout"
 ${color3}$hr$color
 ${font Roboto:style=Medium:size=9}Memory$font: $mem / $memmax used$alignr$memperc%
 ${color9}${memgraph}$color
@@ -172,6 +179,9 @@ ${color9}${top_mem name 1}$color$alignr${top_mem mem 1}%
 ${color9}${top_mem name 2}$color$alignr${top_mem mem 2}%
 ${color9}${top_mem name 3}$color$alignr${top_mem mem 3}%
 ${color9}${top_mem name 4}$color$alignr${top_mem mem 4}%
+EOF
+	# Disk info
+	cat << 'EOF' >> "$_optout"
 ${color3}$hr$color
 ${font Roboto:style=Medium:size=9}Disk$font (R/W):$alignr${diskio /dev/sda}
 ${color7}${diskiograph_read /dev/sda 36,200} ${diskiograph_write /dev/sda 36,200}$color
@@ -183,6 +193,9 @@ ${color7}${top_io name 1}$color$alignr${top_io io_perc 1}%
 ${color7}${top_io name 2}$color$alignr${top_io io_perc 2}%
 ${color7}${top_io name 3}$color$alignr${top_io io_perc 3}%
 ${color7}${top_io name 4}$color$alignr${top_io io_perc 4}%
+EOF
+	# Networking
+	cat << 'EOF' >> "$_optout"
 ${color3}$hr$color
 ${font Roboto:style=Medium:size=9}Network$font:${alignr}Default $gw_iface${if_up wlp1s0}
 wlp1s0 (U/D):$alignr${addr wlp1s0} / ${wireless_essid wlp1s0}
@@ -199,6 +212,7 @@ ${color6}${upspeedgraph enp0s20f0u2 36,200} ${downspeedgraph enp0s20f0u2 36,200}
 EOF
 }
 genconfig() {
+	log "Generating config: $_optout"
 	step_header
 	step_config
 	step_text

From 71020bd1b1d7ef23196ed312787e301f316021ce Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 18:12:15 -0500
Subject: [PATCH 07/10] Conky: Modularize more generated configs

---
 .config/conky/gen.sh | 112 ++++++++++++++++++++++---------------------
 1 file changed, 57 insertions(+), 55 deletions(-)

diff --git a/.config/conky/gen.sh b/.config/conky/gen.sh
index c9fecf9d..f6cb6feb 100755
--- a/.config/conky/gen.sh
+++ b/.config/conky/gen.sh
@@ -149,67 +149,69 @@ conky.config = {
 EOF
 }
 step_text() {
+	local -r topitems=4
 	# Generate our actual functional Conky stuff
 	# Header
-	cat << 'EOF' >> "$_optout"
-conky.text = [[
-${font Roboto:style=Light:size=30}$alignr${no_update $nodename_short}$font
-${font Roboto:style=Light:size=17}$alignr${time %I:%M %p}$font
-${font Roboto:style=Light:size=12}${acpitemp}°C$alignr${time %A, %B %d, %Y}$font
-EOF
+	cat <<- 'EOF' >> "$_optout"
+	conky.text = [[
+	${font Roboto:style=Light:size=30}$alignr${no_update $nodename_short}$font
+	${font Roboto:style=Light:size=17}$alignr${time %I:%M %p}$font
+	${font Roboto:style=Light:size=12}${acpitemp}°C$alignr${time %A, %B %d, %Y}$font
+	EOF
+
 	# CPU info
-	cat << 'EOF' >> "$_optout"
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}CPU$font: $freq_g GHz$alignr$cpu%
-${color8}${cpugraph cpu1 36,200} ${cpugraph cpu2 36,200}
-${cpugraph cpu3 36,200} ${cpugraph cpu4 36,200}$color
-${color8}${top name 1}$color$alignr${top cpu 1}%
-${color8}${top name 2}$color$alignr${top cpu 2}%
-${color8}${top name 3}$color$alignr${top cpu 3}%
-${color8}${top name 4}$color$alignr${top cpu 4}%
-EOF
+	cat <<- 'EOF' >> "$_optout"
+	${color3}$hr$color
+	${font Roboto:style=Medium:size=9}CPU$font: $freq_g GHz$alignr$cpu%
+	${color8}${cpugraph cpu1 36,200} ${cpugraph cpu2 36,200}
+	${cpugraph cpu3 36,200} ${cpugraph cpu4 36,200}$color
+	EOF
+	for i in $(seq $topitems); do
+		echo "\${color8}\${top name $i}\$color\$alignr\${top cpu $i}%" >> "$_optout"
+	done
+
 	# Memory info
-	cat << 'EOF' >> "$_optout"
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}Memory$font: $mem / $memmax used$alignr$memperc%
-${color9}${memgraph}$color
-Memory$alignr$memeasyfree ${color9}${membar}$color
-Swap$alignr$swapfree ${color9}${swapbar}$color
-${color9}${top_mem name 1}$color$alignr${top_mem mem 1}%
-${color9}${top_mem name 2}$color$alignr${top_mem mem 2}%
-${color9}${top_mem name 3}$color$alignr${top_mem mem 3}%
-${color9}${top_mem name 4}$color$alignr${top_mem mem 4}%
-EOF
+	cat <<- 'EOF' >> "$_optout"
+	${color3}$hr$color
+	${font Roboto:style=Medium:size=9}Memory$font: $mem / $memmax used$alignr$memperc%
+	${color9}${memgraph}$color
+	Memory$alignr$memeasyfree ${color9}${membar}$color
+	EOF
+	if [ -n "$(swapon)" ]; then
+		echo "Swap\$alignr\$swapfree \${color9}\${swapbar}\$color" >> "$_optout"
+	fi
+	for i in $(seq $topitems); do
+		echo "\${color9}\${top_mem name $i}\$color\$alignr\${top_mem mem $i}%" >> "$_optout"
+	done
+
 	# Disk info
-	cat << 'EOF' >> "$_optout"
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}Disk$font (R/W):$alignr${diskio /dev/sda}
-${color7}${diskiograph_read /dev/sda 36,200} ${diskiograph_write /dev/sda 36,200}$color
-/$alignr${fs_free /} ${color7}${fs_bar /}$color
-/home$alignr${fs_free /home} ${color7}${fs_bar /home}$color
-/boot$alignr${fs_free /boot} ${color7}${fs_bar /boot}$color
-/boot/efi$alignr${fs_free /boot/efi} ${color7}${fs_bar /boot/efi}$color
-${color7}${top_io name 1}$color$alignr${top_io io_perc 1}%
-${color7}${top_io name 2}$color$alignr${top_io io_perc 2}%
-${color7}${top_io name 3}$color$alignr${top_io io_perc 3}%
-${color7}${top_io name 4}$color$alignr${top_io io_perc 4}%
-EOF
+	cat <<- 'EOF' >> "$_optout"
+	${color3}$hr$color
+	${font Roboto:style=Medium:size=9}Disk$font (R/W):$alignr${diskio /dev/sda}
+	${color7}${diskiograph_read /dev/sda 36,200} ${diskiograph_write /dev/sda 36,200}$color
+	EOF
+	# Mountpoint detection
+	for mountpoint in / /home /var /usr /opt /boot /boot/efi; do
+		if mountpoint $mountpoint > /dev/null 2>&1; then
+			echo "$mountpoint\$alignr\${fs_free $mountpoint} \${color7}\${fs_bar $mountpoint}\$color" >> "$_optout"
+		fi
+	done
+	for i in $(seq $topitems); do
+		echo "\${color7}\${top_io name $i}\$color\$alignr\${top_io io_perc $i}%" >> "$_optout"
+	done
+
 	# Networking
-	cat << 'EOF' >> "$_optout"
-${color3}$hr$color
-${font Roboto:style=Medium:size=9}Network$font:${alignr}Default $gw_iface${if_up wlp1s0}
-wlp1s0 (U/D):$alignr${addr wlp1s0} / ${wireless_essid wlp1s0}
-${color6}${upspeedgraph wlp1s0 36,200} ${downspeedgraph wlp1s0 36,200}$color$endif${if_up wlp5s0}
-wlp5s0 (U/D):$alignr${addr wlp5s0} / ${wireless_essid wlp5s0}
-${color6}${upspeedgraph wlp5s0 36,200} ${downspeedgraph wlp5s0 36,200}$color$endif${if_up enp0s31f6}
-enp0s31f6 (U/D):$alignr${addr enp0s31f6}
-${color6}${upspeedgraph enp0s31f6 36,200} ${downspeedgraph enp0s31f6 36,200}$color$endif${if_up eno1}
-eno1 (U/D):$alignr${addr eno1}
-${color6}${upspeedgraph eno1 36,200} ${downspeedgraph eno1 36,200}$color$endif${if_up enp0s20f0u2}
-enp0s20f0u2 (U/D):$alignr${addr enp0s20f0u2}
-${color6}${upspeedgraph enp0s20f0u2 36,200} ${downspeedgraph enp0s20f0u2 36,200}$color$endif
-]]
-EOF
+	cat <<-'EOF' >>"$_optout"
+	${color3}$hr$color
+	${font Roboto:style=Medium:size=9}Network$font:${alignr}Default $gw_iface${if_up wlp1s0}
+	EOF
+	for interface in $(iw dev | awk '$1=="Interface"{print $2}'); do
+		cat <<- EOF >>"$_optout"
+		$interface (U/D): \$alignr\${addr $interface} / \${wireless_essid $interface}
+		\${color6}\${upspeedgraph $interface 36,200} \${downspeedgraph $interface 36,200}\$color
+		EOF
+	done
+	echo "]]" >> "$_optout"
 }
 genconfig() {
 	log "Generating config: $_optout"

From 028d611c48485611af01ec92025005cd1b9539b9 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 18:18:14 -0500
Subject: [PATCH 08/10] Conky: Declare all dependencies

---
 .config/conky/gen.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/.config/conky/gen.sh b/.config/conky/gen.sh
index f6cb6feb..e817580a 100755
--- a/.config/conky/gen.sh
+++ b/.config/conky/gen.sh
@@ -258,7 +258,7 @@ main() {
 	# TODO: That
 	# Validate core program dependencies
 	log "Validating dependencies" 2
-	if ! has basename; then
+	if ! has awk basename iw seq; then
 		error "Failed to find program: $_return" 1
 	fi
 

From b809fe570d7b8d67c76149eb4df183babbca43ef Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 18:37:51 -0500
Subject: [PATCH 09/10] Conky: Add graphs for more CPUs as needed

---
 .config/conky/gen.sh | 40 ++++++++++++++++++++++++++++++++++++++--
 1 file changed, 38 insertions(+), 2 deletions(-)

diff --git a/.config/conky/gen.sh b/.config/conky/gen.sh
index e817580a..011e1a7d 100755
--- a/.config/conky/gen.sh
+++ b/.config/conky/gen.sh
@@ -150,6 +150,7 @@ EOF
 }
 step_text() {
 	local -r topitems=4
+	local -r nproc="$(nproc)"
 	# Generate our actual functional Conky stuff
 	# Header
 	cat <<- 'EOF' >> "$_optout"
@@ -163,9 +164,44 @@ step_text() {
 	cat <<- 'EOF' >> "$_optout"
 	${color3}$hr$color
 	${font Roboto:style=Medium:size=9}CPU$font: $freq_g GHz$alignr$cpu%
-	${color8}${cpugraph cpu1 36,200} ${cpugraph cpu2 36,200}
-	${cpugraph cpu3 36,200} ${cpugraph cpu4 36,200}$color
 	EOF
+	local gpl=1
+	if (( nproc <= 2 )); then
+		gpl=1
+	elif (( nproc <= 4 )); then
+		gpl=2
+	elif (( nproc <= 8 )); then
+		gpl=4
+	else
+		gpl=8
+	fi
+	local width=$(( 400 / gpl ))
+	log "Generating $gpl graphs per row of CPU core stats" 1
+	log "Graphs will be $width wide" 2
+	local cpuinfo
+	for i in $(seq 1 "$gpl" "$nproc"); do
+		# Generate lines
+		local line="\${color8}"
+		for j in $(seq 0 $(( gpl - 1 ))); do
+			# Generate graphs
+			local cpu=$(( i + j ))
+			log "Generating graph for CPU $cpu" 2
+			if [ -z "$line" ]; then
+				line="\${cpugraph cpu$cpu 36,$width}"
+			else
+				line="$line \${cpugraph cpu$cpu 36,$width}"
+			fi
+		done
+		# Trim whitespace
+		line="${line%" "}$color"
+		log "Appending line: $line" 2
+		cpuinfo="$cpuinfo$line\n"
+		unset line
+	done
+	while [ "$cpuinfo" != "${cpuinfo%\\n}" ]; do
+		cpuinfo="${cpuinfo%\\n}"
+	done
+	echo -e "$cpuinfo" >> "$_optout"
 	for i in $(seq $topitems); do
 		echo "\${color8}\${top name $i}\$color\$alignr\${top cpu $i}%" >> "$_optout"
 	done

From c14e3783b7820fe6bf51bbaa1546a116738867c9 Mon Sep 17 00:00:00 2001
From: Salt <rehashedsalt@cock.li>
Date: Thu, 4 Jun 2020 18:39:22 -0500
Subject: [PATCH 10/10] Conky: Remove leading space on those graphs ups

---
 .config/conky/gen.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.config/conky/gen.sh b/.config/conky/gen.sh
index 011e1a7d..47e7bab0 100755
--- a/.config/conky/gen.sh
+++ b/.config/conky/gen.sh
@@ -181,7 +181,7 @@ step_text() {
 	local cpuinfo
 	for i in $(seq 1 "$gpl" "$nproc"); do
 		# Generate lines
-		local line="\${color8}"
+		local line
 		for j in $(seq 0 $(( gpl - 1 ))); do
 			# Generate graphs
 			local cpu=$(( i + j ))
@@ -193,7 +193,7 @@ step_text() {
 			fi
 		done
 		# Trim whitespace
-		line="${line%" "}$color"
+		line="\${color8}${line%" "}\$color"
 		log "Appending line: $line" 2
 		cpuinfo="$cpuinfo$line\n"
 		unset line