From eca35d6d822acba9bddec526ba95041880e20b67 Mon Sep 17 00:00:00 2001 From: Alec Goncharow Date: Tue, 16 Jan 2024 08:51:19 -0500 Subject: nushell churn is too much bash gets it --- bin/decrement-brightness.sh | 5 +++++ bin/wallpaper-shuffle | 29 +++++++++++++++++------------ 2 files changed, 22 insertions(+), 12 deletions(-) create mode 100755 bin/decrement-brightness.sh (limited to 'bin') diff --git a/bin/decrement-brightness.sh b/bin/decrement-brightness.sh new file mode 100755 index 0000000..22499d9 --- /dev/null +++ b/bin/decrement-brightness.sh @@ -0,0 +1,5 @@ +#!/usr/bin/env bash +LIGHT=$(light) +if [[ ${LIGHT%.*} -gt 5 ]]; then + brightnessctl set -q 5%- +fi diff --git a/bin/wallpaper-shuffle b/bin/wallpaper-shuffle index 820bfeb..9f55e0c 100755 --- a/bin/wallpaper-shuffle +++ b/bin/wallpaper-shuffle @@ -1,12 +1,17 @@ -#!/bin/nu -let wallpapers_path = "~/wallpapers/low-poly" -swaymsg -t get_outputs | - rg name | - str trim -a | - split row "," | - split column ":" | - get column2 | - str trim | str trim -c '"' | - each {|output| - swaymsg $"output ($output) bg `find ($wallpapers_path) -type f | shuf -n 1` fill" - } +#!/usr/bin/env bash + +set -o errexit +set -o nounset +set -o pipefail +if [[ "${TRACE-0}" == "1" ]]; then + set -o xtrace +fi + +OUTPUTS=$(swaymsg -t get_outputs | jq -r '.[] | .name') +export WALLPAPERS="$HOME/wallpapers/low-poly" + +main() { + echo "$OUTPUTS" | xargs -I{} sh -c "swaymsg output {} bg $(find "$WALLPAPERS" -type f | shuf -n 1) fill" +} + +main "$@" -- cgit v1.2.3-70-g09d2