dotfiles

My personal shell configs and stuff
git clone git://git.alex.balgavy.eu/dotfiles.git
Log | Files | Refs | Submodules | README | LICENSE

commit c5c4ad082fcec38c262bf3daea64578d3002c6b9
parent f242dc514757af97e62772b9b5bbd7fd7ce719bc
Author: Alex Balgavy <alexander.balgavy@spaceapplications.com>
Date:   Mon, 15 Jan 2024 13:45:51 +0100

dwmblocks scripts

Diffstat:
Mscripts/dwmblock-battery | 2+-
Ascripts/dwmblock-iss | 37+++++++++++++++++++++++++++++++++++++
Ascripts/dwmblock-touchpad | 25+++++++++++++++++++++++++
3 files changed, 63 insertions(+), 1 deletion(-)

diff --git a/scripts/dwmblock-battery b/scripts/dwmblock-battery @@ -15,6 +15,6 @@ status="$(battery | tac | tr -d '\n' | sed ' case "$status" in ‼*) notify "Battery low" "$status%" battery critical;; - # ✅*) notify "Battery charged" "$status%" battery;; + ✅*) notify "Battery charged" "$status%" battery;; esac printf "%s%%\n" "$status" diff --git a/scripts/dwmblock-iss b/scripts/dwmblock-iss @@ -0,0 +1,37 @@ +#!/bin/sh +iss_stream="https://www.youtube.com/watch?v=P9C25Un7xaM" +show_iss_stream() { + setsid -f mpv --no-osc --loop=inf --no-terminal --profile=low-latency "$iss_stream" ; + notify "ISS Tracker" "Opening stream..." +} + +iss_img="${XDG_CACHE_HOME:-$HOME/.cache}/iss.png" + +get_iss_pos() { + notify-send "ISS" "Pulling most recent ISS position map." + curl -sL "https://heavens-above.com/orbitdisplay.aspx?satid=25544&icon=iss&width=600&height=600" -o "$iss_img" +} + +iss_diagram="${XDG_CACHE_HOME:-$HOME/.cache}/iss.png" +get_iss_diagram() { + notify-send "ISS" "Pulling most recent ISS position map." + # From https://www.nasa.gov/international-space-station/space-station-facts-and-figures/ + curl -sL "https://www.nasa.gov/wp-content/uploads/2023/05/iss-blowout-updated-view-2023-300.png" -o "$iss_diagram" +} + +showimg() { setsid -f nsxiv "$1" ;} +case $BUTTON in + 1) case "$(printf 'Map\nStream\nDiagram' | dmenu -i -l 3 -p "Choose:")" in + 'Map') + get_iss_pos && showimg "$iss_img";; + 'Stream') + show_iss_stream;; + 'Diagram') + get_iss_diagram && showimg "$iss_diagram";; + *);; + esac + ;; + 6) "$TERMINAL" -e "$EDITOR" "$0" ;; +esac + +printf '🛰' diff --git a/scripts/dwmblock-touchpad b/scripts/dwmblock-touchpad @@ -0,0 +1,25 @@ +#!/bin/sh +touchpad="VEN_0488:00 0488:1024 Touchpad" +enabled="$(xinput list-props "$touchpad" | awk -F':\\s*' '/Device Enabled/ { print $2 }')" + +case "$BUTTON" in + 3) + case "$enabled" in + 1) + xinput disable "$touchpad" + pkill -RTMIN+15 dwmblocks + ;; + 0) + xinput enable "$touchpad" + pkill -RTMIN+15 dwmblocks + ;; + esac + ;; + 6) "$TERMINAL" -e "$EDITOR" "$0";; +esac + +case "$enabled" in + 1) s='🖱';; + 0) s='🖱 ❌';; +esac +printf '%s' "$s"