From 72ef08cc8c594ec701497ba4db4be70677fca355 Mon Sep 17 00:00:00 2001 From: Derek Stevens Date: Sat, 27 Nov 2021 20:50:19 -0700 Subject: [PATCH] add riosh --- README.md | 7 +++++- rio.sh | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ sleepy.sh | 23 ------------------- 3 files changed, 72 insertions(+), 24 deletions(-) create mode 100755 rio.sh delete mode 100755 sleepy.sh diff --git a/README.md b/README.md index f601adf..129fcc4 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # [[ zenUtils ]] -### --refined UI helper scripts-- +### --refined UI/workflow helper scripts-- #### Derek Stevens ## About This is a simple collection of helper scripts to round out my two common desktop sessions: + * ryudo * fluxbox @@ -33,6 +34,10 @@ Background worker to sync an imap mailbox. Generate a timesheet for a given month by manipulating the output from `zeit` +### riosh + +Shell script to loosley emulate `rio` behavior in a EWMH-compliant WM + ## License This collection is released permissively under the MIT License. You can do whatever you want with it, as long as you leave my name on it. diff --git a/rio.sh b/rio.sh new file mode 100755 index 0000000..ec7e146 --- /dev/null +++ b/rio.sh @@ -0,0 +1,66 @@ +#!/bin/sh + +termcmd="alacritty --option geometry=" +movebind="super+v" + +delete() +{ + wmctrl -c :SELECT: +} + +new() +{ + geom=$(slop -t 0 -f %x,%y,%w,%h) + x=$(echo $geom | awk -F , '{print $1}') + y=$(echo $geom | awk -F , '{print $2}') + + wl=$(mktemp .windowlistXXX) + + wmctrl -l >> $wl + + ${termcmd}80x24+${x}+${y}& + + while true; do + lastCreatedID=$(wmctrl -l | tail -n 1 | awk '{print $1}') + if [ "$lastCreatedID" != "$(tail -n 1 $wl | awk '{print $1}')" ]; then + break + fi + done + + wmctrl -i -r $lastCreatedID -e 0,$geom + rm $wl +} + +resize() +{ + wid=$(slop -t 9999999 -f %i) + geom=$(slop -t 0 -f %x,%y,%w,%h) + wmctrl -i -r $wid -b remove,maximized_vert,maximized_horz + wmctrl -i -r $wid -e 0,$geom +} + +move() +{ + wid=$(slop -t 9999999 -f %i) + wmctrl -a $wid + xdotool key $movebind +} + +hide() +{ + wid=$(slop -t 9999999 -f %i) + wmctrl -i -r $wid -b add,hidden +} + +case $1 in + delete) + delete;; + new) + new;; + resize) + resize;; + move) + move;; + hide) + hide;; +esac diff --git a/sleepy.sh b/sleepy.sh deleted file mode 100755 index 0c263a0..0000000 --- a/sleepy.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh - -# this is a simple replacmeent for an ACPI handler script -# put it somewhere accessible for single-user mode and make a runit script for it -# copyleft 2020 Derek Stevens -# MIT License -- do whatever you want - -acpi_listen | { - while read event; do - - # if no external monitor - # if [ ! -z "$(xrandr | grep HDMI | grep disconnected)" ]; then - - # if AC is offline - if [ ! -z "$(acpi -a | grep off-line)" ]; then - - if [ "${event}" = "button/lid LID close" ]; then - zzz - fi - fi - # fi - done -}