summaryrefslogtreecommitdiffstats
path: root/.local
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-x.local/bin/install-port169
-rwxr-xr-x.local/bin/status/sb-battery33
-rwxr-xr-x.local/bin/status/sb-clock29
-rwxr-xr-x.local/bin/status/sb-cpu37
-rwxr-xr-x.local/bin/status/sb-disk9
-rwxr-xr-x.local/bin/status/sb-forecast17
-rwxr-xr-x.local/bin/status/sb-mailbox51
-rwxr-xr-x.local/bin/status/sb-memory15
-rwxr-xr-x.local/bin/status/sb-mpd11
-rwxr-xr-x.local/bin/status/sb-net23
-rwxr-xr-x.local/bin/status/sb-os9
-rwxr-xr-x.local/bin/status/sb-temp7
-rwxr-xr-x.local/bin/status/sb-tools10
-rwxr-xr-x.local/bin/status/sb-updatempd6
-rwxr-xr-x.local/bin/status/sb-volume33
15 files changed, 0 insertions, 459 deletions
diff --git a/.local/bin/install-port b/.local/bin/install-port
deleted file mode 100755
index 83ec07c..0000000
--- a/.local/bin/install-port
+++ /dev/null
@@ -1,169 +0,0 @@
-#!/usr/bin/env perl
-
-use strict;
-use warnings;
-use Term::ANSIColor;
-
-sub upgrdports {
- my $upgrd_nbr_cmd = "/usr/sbin/pkg version -l '<' | /usr/bin/wc -l | /usr/bin/awk '{print \$1}'";
- if (system(
- '/usr/local/bin/doas',
- '/usr/sbin/pkg',
- 'update'
- ) != 0) {
- exit;
- }
- if (system(
- '/usr/local/bin/doas',
- '/usr/sbin/portsnap',
- 'fetch',
- 'update'
- ) != 0) {
- exit;
- }
- print colored("\nPorts to be updated: ", 'bold');
- my $upgrd_nbr = `$upgrd_nbr_cmd`;
- chomp $upgrd_nbr;
- print colored($upgrd_nbr, 'bold green') . "\n";
- open(PS, "/usr/sbin/pkg version -l '<' |");
- while (<PS>) {
- print
- }
- close(PS);
- if ($upgrd_nbr == 0) {
- print colored("No ports to be updated.\n", 'bold green');
- exit;
- }
- print colored("\nUpgrade these ports? ", 'bold yellow')
- . colored('[', 'bold green')
- . colored('y', 'bold red')
- . colored('/N', 'bold green')
- . colored("]\n", 'bold green')
- . colored("~> ", 'yellow');
- my $answer = <STDIN>;
- chomp $answer;
- if ($answer ne "y" && $answer ne "Y") {
- print "Exiting...\n";
- exit;
- }
- system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/notify-send "Initiating upgrade" "Ports upgrade has started\nTotal: ' . $upgrd_nbr . ' to be updated" >/dev/null 2>&1');
- if (system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/doas /usr/local/sbin/portmaster -dya --no-confirm') == 0) {
- my $failed_nbr = `$upgrd_nbr_cmd`;
- chomp $failed_nbr;
- my $diff_nbr = $upgrd_nbr - $failed_nbr;
- system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/notify-send "Upgrade complete!" "Ports upgrade installed successfully\nTotal: ' . $diff_nbr . ' installed" >/dev/null 2>&1');
- }
- else {
- my $failed_nbr = `$upgrd_nbr_cmd`;
- substr($failed_nbr, -1) = "";
- my $diff_nbr = $upgrd_nbr - $failed_nbr;
- system('/usr/local/bin/dash',
- '-c',
- '/usr/local/bin/notify-send -u critical -t 10000 "Upgrade failed!" "Some ports failed to compile\nTotal: ' . $diff_nbr . ' installed - ' . $failed_nbr . ' failed" >/dev/null 2>&1');
- }
- exit;
-}
-
-sub configport {
- my $port = $_[0];
- my $port_basename = $_[1];
- if (system(
- '/usr/local/bin/doas',
- '/usr/bin/make',
- 'config-recursive') == 0) {
- if (system(
- '/usr/local/bin/doas',
- '/usr/bin/make',
- 'config-recursive') == 0) {
- if (system(
- '/usr/local/bin/doas',
- '/usr/bin/make',
- 'config-recursive') == 0) {
- }
- system(
- '/usr/local/bin/notify-send',
- 'Configuration success!',
- 'Ports config - ' . $port . ' - configured successfully',
- );
- }
- }
- else {
- system(
- '/usr/local/bin/notify-send',
- '-u',
- 'critical',
- '-t',
- '10000',
- 'Configuration failure!',
- 'Ports config - ' . $port . ' - failed to configure'
- );
- }
-}
-
-sub installport {
- my $port = $_[0];
- my $port_basename = $_[1];
- if (system(
- '/usr/local/bin/doas',
- '/usr/bin/make',
- 'install',
- 'clean'
- ) == 0) {
- system(
- '/usr/local/bin/notify-send',
- 'Compilation success!',
- 'Ports - ' . $port . ' - installed successfully'
- );
- }
- else {
- system(
- '/usr/local/bin/notify-send',
- '-u',
- 'critical',
- '-t',
- '10000',
- 'Compilation failure!',
- 'Ports - ' . $port . ' - failed to install'
- );
- }
-}
-
-sub main {
- my $argc = $#ARGV + 1;
- if ($argc == 0) {
- print colored("Failed!\n", 'bold red')
- . "No port or argument specified\n";
- exit 1;
- }
- my $port = $ARGV[0];
- if ($ARGV[0] eq "upgrade") {
- upgrdports();
- }
- elsif (-d "/usr/ports/" . $port) {
- my $port_basename = `echo $ARGV[0] | awk -F '/' '{print \$2}'`;
- print colored("Port ", 'bold')
- . colored($port, 'bold green')
- . colored(" found\n", 'bold');
- chdir "/usr/ports/" . $port;
- configport($port, $port_basename);
- installport($port, $port_basename);
- }
- else {
- print colored("Failed!\n", 'bold red')
- . "Port "
- . colored($port, 'bold yellow')
- . " doesn't exist in "
- . colored("/usr/ports/\n", 'bold');
- }
- exit;
-}
-
-main();
-
-__END__
diff --git a/.local/bin/status/sb-battery b/.local/bin/status/sb-battery
deleted file mode 100755
index 2fe3ce5..0000000
--- a/.local/bin/status/sb-battery
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-case $(hostname -s) in
- mother) exit ;;
- po-rbo)
- printf "^c#fabd2f^"
- charge=$(cat /sys/class/power_supply/BAT0/capacity)
- case "$(cat /sys/class/power_supply/BAT0/status)" in
- "Charging"|"Not charging") printf "󱐋 " ;;
- "Full") printf "󱐋 "; return ;;
- esac
- ;;
- mars)
- echo -n "^c#fabd2f^"
- charge=$(apm -l)
- [ "$(apm -b)" -eq 3 ] && printf "󱐋 "
- ;;
-esac
-
-case $(echo "$charge" / 20 | bc) in
- "0") printf " " ;;
- "1") printf " " ;;
- "2") printf " " ;;
- "3") printf " " ;;
- "4")
- [ "$charge" -gt 98 ] && return
- printf " "
- ;;
- "5")
- [ "$(cat /sys/class/power_supply/BAT0/status)" = "Charging" ] && return
- printf "󱐋"
- ;;
-esac
diff --git a/.local/bin/status/sb-clock b/.local/bin/status/sb-clock
deleted file mode 100755
index cf315f0..0000000
--- a/.local/bin/status/sb-clock
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh
-
-echo -n "^d^"
-clock=$(date '+%I')
-
-case "$clock" in
- "00") icon="" ;;
- "01") icon="" ;;
- "02") icon="" ;;
- "03") icon="" ;;
- "04") icon="" ;;
- "05") icon="" ;;
- "06") icon="" ;;
- "07") icon="" ;;
- "08") icon="" ;;
- "09") icon="" ;;
- "10") icon="" ;;
- "11") icon="" ;;
- "12") icon="" ;;
-esac
-
-# case $BLOCK_BUTTON in
-# 1) notify-send -u low "This Month" "$(cal | sed "s/..7m/<b><span color=\"red\">/;s|..27m|</span></b>|")" && notify-send "Appointments" "$(calcurse -d3)" ;;
-# 2) bsdsetsid -f "$TERMINAL" -e calcurse -C $XDG_CONFIG_HOME/calcurse -D $XDG_DATA_HOME/calcurse ;;
-# 3) notify-send -u low "📅 Time/date module" "\- Left click to show upcoming appointments for the next three days via \`calcurse -d3\` and show the month via \`cal\` - Middle click opens calcurse if installed" ;;
-# 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
-# esac
-
-date "+$icon %H:%M"
diff --git a/.local/bin/status/sb-cpu b/.local/bin/status/sb-cpu
deleted file mode 100755
index fe3712a..0000000
--- a/.local/bin/status/sb-cpu
+++ /dev/null
@@ -1,37 +0,0 @@
-#!/bin/sh
-
-# ncpu_file="/tmp/ncpu"
-# if [ -f $ncpu_file ]; then
-# ncpu=$(cat $ncpu_file)
-# else
-# ncpu=$(sysctl -n hw.ncpu | tee $ncpu_file)
-# fi
-
-printf "^c#8ec07c^ "
-# for i in $(top -P -d 2 -s 0.2 | grep '^CPU' | tail -n$ncpu | sed '{s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/100 - /;}' | bc); do
-case $(hostname -s) in
- mother|po-rbo)
- stats=$(uptime | head -n1)
- top -b -d 0.1 -n 1 | grep "Cpu(s)" | \
- sed "s/.*, *\([0-9.]*\)%* id.*/\1/" | \
- awk '{print int(100 - $1)"%"}'
- exit
- ;;
- mars)
- stats=$(top -d 2 -s 0.2 | grep -E 'load averages:|^CPU')
- printf "%s " "$(echo "$stats" | sed '{1,2d;4d;s/.*averages: *//;s/,.*//;}')"
- ;;
-esac
-
-case $(echo "$stats" | sed '{1,3d;s/% idle$//;s/.*[[:blank:]]//;s/\..*//;s/^/(100 - /;s/$/) \/ 12\.5/;}' | bc) in
- "0") printf "[ ]\n" ;;
- "1") printf "[= ]\n" ;;
- "2") printf "[== ]\n" ;;
- "3") printf "[=== ]\n" ;;
- "4") printf "[==== ]\n" ;;
- "5") printf "[===== ]\n" ;;
- "6") printf "[====== ]\n" ;;
- "7") printf "[======= ]\n" ;;
- "8") printf "[========]\n" ;;
-esac
-
diff --git a/.local/bin/status/sb-disk b/.local/bin/status/sb-disk
deleted file mode 100755
index 527a1d1..0000000
--- a/.local/bin/status/sb-disk
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-echo -n "^c#d3869b^ "
-df=$(df -h -T | grep '/$')
-if echo "$df" | grep zfs >/dev/null 2>&1; then
- zpool list $(echo $df | sed 's/\/.*//') | tail -n1 | awk '{print $3"/"$2}'
-else
- echo "$df" | awk '{print $6}'
-fi
diff --git a/.local/bin/status/sb-forecast b/.local/bin/status/sb-forecast
deleted file mode 100755
index e3c8f0d..0000000
--- a/.local/bin/status/sb-forecast
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# weatherreport="/tmp/weatherreport"
-# weatherglyph="/tmp/weatherglyph"
-# moonglyph="/tmp/moonglyph"
-
-weatherreport=$(curl -sf "wttr.in/Lyon" 2>&1 || exit 1) # >$weatherreport || (rm -f $weatherreport && exit 1)
-weatherglyph=$(curl -sf "wttr.in/Lyon?format=%c" 2>&1 || exit 1) # >$weatherglyph || exit 1
-moonglyph=$(curl -sf "wttr.in/?format=%m" 2>&1 || exit 1) # >$moonglyph || exit 1
-
-printf "^c#83a598^%s%s" \
- "$(echo "$weatherglyph")" \
- "$(echo "$weatherreport" | sed '16q;d' | grep -wo "[0-9]*%" | sort -rn | sed "s/^/ /g;1q" | tr -d '\n')"
-
-echo "$weatherreport" | sed '13q;d' | grep -o "m\\([-+]\\)*[0-9]\\+" | sed 's/+//g' |
- sort -n -t 'm' -k 2n | sed -e 1b -e '$!d' | tr '\n|m' ' ' |
- awk -v moon="$(echo "$moonglyph")" '{print "  " $1 "/" $2 "°C " moon}'
diff --git a/.local/bin/status/sb-mailbox b/.local/bin/status/sb-mailbox
deleted file mode 100755
index f7a3786..0000000
--- a/.local/bin/status/sb-mailbox
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/bin/sh
-
-# Displays number of unread mail and an loading icon if updating.
-# When clicked, brings up `neomutt`.
-
-case $BLOCK_BUTTON in
- 1) setsid -f "$TERMINAL" -e neomutt ;;
- 2) setsid -f mw -Y >/dev/null ;;
- 3) notify-send "📬 Mail module" "\- Shows unread mail
-- Shows 🔃 if syncing mail
-- Left click opens neomutt
-- Middle click syncs mail" ;;
- 6) "$TERMINAL" -e "$EDITOR" "$0" ;;
-esac
-
-mb_a="$(ls "${MAIL:-/var/mail/jozan}"/gmail_br/INBOX/new/ | wc -l 2>/dev/null)"
-mb_b="$(ls "${MAIL:-/var/mail/jozan}"/gmail_oon/INBOX/new/ | wc -l 2>/dev/null)"
-mb_c="$(ls "${MAIL:-/var/mail/jozan}"/gmail_tos/INBOX/new/ | wc -l 2>/dev/null)"
-
-sync=0
-if pidof mbsync >/dev/null 2>&1; then
- sync=1
-fi
-
-case "$sync" in
- 0) ([ "$mb_a" -gt 0 ] || [ "$mb_b" -gt 0 ] || [ "$mb_c" -gt 0 ] || [ "$mb_d" -gt 0 ]) && echo -n " " ;;
- 1) echo -n " " ;;
- *) ;;
-esac
-
-if [ "$mb_a" -gt 0 ]; then
- echo -n "br:" $mb_a
-fi
-
-if [ "$mb_a" -gt 0 ] && [ "$mb_b" -gt 0 ]; then
- echo -n " - "
-fi
-
-if [ "$mb_b" -gt 0 ]; then
- echo -n "oon:" $mb_b
-fi
-
-if [ "$mb_b" -gt 0 ] && [ "$mb_c" -gt 0 ]; then
- echo -n " - "
-elif [ "$mb_a" -gt 0 ] && [ "$mb_c" -gt 0 ]; then
- echo -n " - "
-fi
-
-if [ "$mb_c" -gt 0 ]; then
- echo -n "tos:" $mb_c
-fi
diff --git a/.local/bin/status/sb-memory b/.local/bin/status/sb-memory
deleted file mode 100755
index 0786b85..0000000
--- a/.local/bin/status/sb-memory
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/bin/sh
-
-echo -n "^c#b8bb26^ "
-case $(hostname -s) in
- mother|po-rbo)
- free | sed -n '2p' | awk '{print int(100 - ($7 * 100 / $2))"%"}'
- ;;
- mars)
- sysctl -n hw.physmem \
- hw.pagesize \
- vm.stats.vm.v_inactive_count \
- vm.stats.vm.v_free_count \
- vm.stats.vm.v_cache_count | xargs | awk '{printf ("%2.2fG/%2.2fG\n", ($1 / (1024 ^ 3)) - (($3 + $4 + $5) * $2 / (1024 ^ 3)), ($1 / (1024 ^ 3)))}'
- ;;
-esac
diff --git a/.local/bin/status/sb-mpd b/.local/bin/status/sb-mpd
deleted file mode 100755
index 21bf2c7..0000000
--- a/.local/bin/status/sb-mpd
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-
-return
-mp=$(mpc status)
-icon=$(echo "$mp" | sed -n 2p | sed -E 's/(^|\])[^[]*($|\[)//g')
-case $icon in
- "playing") icon="契" ;;
- "paused") icon="" ;;
- *) return ;;
-esac
-printf "%s %s" "$icon" "$(echo "$mp" | head -n1)"
diff --git a/.local/bin/status/sb-net b/.local/bin/status/sb-net
deleted file mode 100755
index 50fdc0a..0000000
--- a/.local/bin/status/sb-net
+++ /dev/null
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-echo -n "^c#a89984^"
-case $(hostname -s) in
- mother|po-rbo) ping="ping -c1 -w1 9.9.9.9" ;;
- mars) ping="ping -c1 -t1 9.9.9.9" ;;
-esac
-ifc=$(ifconfig)
-if echo "$ifc" | grep -E '^wg' >/dev/null 2>&1; then
- echo -n "󰞀 "
-fi
-if echo "${ifc}" | grep -E '^zt' >/dev/null 2>&1; then
- echo -n " "
-fi
-if echo "${ifc}" | grep -E '^tun|^vpn' >/dev/null 2>&1; then
- echo -n "󰖂 "
-fi
-if ! $ping >/dev/null 2>&1; then
- echo "󰲜"
- exit
-fi
-
-echo "󰲝"
diff --git a/.local/bin/status/sb-os b/.local/bin/status/sb-os
deleted file mode 100755
index 304aa19..0000000
--- a/.local/bin/status/sb-os
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-case $(hostname -s) in
- mother) os="^c#83a598^" ;;
- po-rbo) os="^c#8ec07c^" ;;
- mars) os="^c#fb4934^" ;;
-esac
-
-echo "$os "
diff --git a/.local/bin/status/sb-temp b/.local/bin/status/sb-temp
deleted file mode 100755
index dfa17c7..0000000
--- a/.local/bin/status/sb-temp
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh
-
-case $(hostname -s) in
- mother) ;;
- po-rbo) cat /sys/class/hwmon/hwmon5/temp1_input | awk '{printf ("^c#fb4934^ %3.1f°C", ($1 / 1000))}' ;;
- mars) echo -n "" $(sysctl -n dev.cpu.0.temperature | cut -d '.' -f1)"°C" ;;
-esac
diff --git a/.local/bin/status/sb-tools b/.local/bin/status/sb-tools
deleted file mode 100755
index 9c7484c..0000000
--- a/.local/bin/status/sb-tools
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-if pidof emacs-28.2 >/dev/null 2>&1; then
- echo -n " "
-fi
-if pgrep gpg-agent >/dev/null 2>&1; then
- echo -n " "
-else
- echo -n " "
-fi
diff --git a/.local/bin/status/sb-updatempd b/.local/bin/status/sb-updatempd
deleted file mode 100755
index 878052a..0000000
--- a/.local/bin/status/sb-updatempd
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-while true; do
- mpc idle >/dev/null 2>&1
- kill -75 $(pidof dwmblocks) >/dev/null 2>&1
-done
diff --git a/.local/bin/status/sb-volume b/.local/bin/status/sb-volume
deleted file mode 100755
index bc1ca97..0000000
--- a/.local/bin/status/sb-volume
+++ /dev/null
@@ -1,33 +0,0 @@
-#!/bin/sh
-
-[ $(hostname -s) = "mars" ] || return
-
-vol="$(mixer vol | awk '{print $7}' | cut -d ':' -f1)"
-
-if [ "$vol" -gt "0" ]; then
- icon=""
-else
- icon="婢"
-fi
-
-mic="$(mixer rec | awk '{print $7}' | cut -d ':' -f1)"
-
-if [ "$mic" -gt "0" ]; then
- micon=""
-else
- micon=""
-fi
-
-echo -n "$micon $icon "
-
-case $(echo $vol / 12.5 | bc) in
- "0") printf "[ ]";;
- "1") printf "[= ]";;
- "2") printf "[== ]";;
- "3") printf "[=== ]";;
- "4") printf "[==== ]";;
- "5") printf "[===== ]";;
- "6") printf "[====== ]";;
- "7") printf "[======= ]";;
- "8") printf "[========]";;
-esac