commit d3c3947

hovercats  ·  2026-08-20 19:58:49 +0000 UTC
parent 1e2b00a
clean out unused scripts
11 files changed,  +0, -647
+0, -2
1@@ -1,2 +0,0 @@
2-*.o
3-/batt
+0, -18
 1@@ -1,18 +0,0 @@
 2-.POSIX:
 3-.SUFFIXES:
 4-
 5-CC      = cc
 6-CFLAGS  = -Wall -Wextra -pedantic
 7-LDFLAGS = -s
 8-
 9-all: batt
10-
11-batt: batt.o
12-	$(CC) $(LDFLAGS) batt.o -o batt
13-
14-.SUFFIXES: .c .o
15-.c.o:
16-	$(CC) $(CFLAGS) -c $<
17-
18-clean:
19-	rm -f *.o batt
+0, -20
 1@@ -1,20 +0,0 @@
 2-#include <stdio.h>
 3-
 4-int
 5-main()
 6-{
 7-	FILE *fptr;
 8-
 9-	fptr = fopen("/sys/class/power_supply/BAT1/capacity", "r");
10-	char capacity[10];
11-	fgets(capacity, 10, fptr);
12-	printf("%s", capacity);
13-	fclose(fptr);
14-
15-	fptr = fopen("/sys/class/power_supply/BAT1/status", "r");
16-	char status[10];
17-	fgets(status, 10, fptr);
18-	printf("%s", status);
19-	fclose(fptr);
20-	return 0;
21-}
+0, -16
 1@@ -1,16 +0,0 @@
 2-#!/bin/rc
 3-
 4-flag e +
 5-
 6-dir=$HOME/usr/scrots
 7-filename=`{date +scrot-%Y%m%d-%H-%M}
 8-out=$dir/$filename.png
 9-
10-test -d $dir || mkdir -p $dir
11-
12-ffmpeg \
13-	-hide_banner -loglevel error \
14-	-f x11grab -r 144 -draw_mouse 0 \
15-	-i $DISPLAY -frames:v 1 $out
16-
17-printf %s\n $out
+0, -5
1@@ -1,5 +0,0 @@
2-#!/bin/rc
3-
4-flag e +
5-
6-curl --create-dirs -O --output-dir $HOME/usr/transmission $1
+0, -23
 1@@ -1,23 +0,0 @@
 2-#!/bin/rc
 3-
 4-flag e +
 5-
 6-# Pipe from wew recieve events
 7-while(ev=`{read -n 1}) {
 8-	switch($ev(1)) {
 9-		case MAP
10-			# Attempt to focus on the newly mapped window
11-			wattr o $ev(2) || focus $ev(2)
12-		case CREATE
13-			# Attempt to focus on the newly created window
14-			# Fallback for unregistered MAP events
15-			wattr o $ev(2) || focus $ev(2)
16-		case UNMAP
17-			# Attempt to regain focus when windows are unmapped
18-			test ! `{pfw} && focus top
19-		case DESTROY
20-			# Attempt to regain focus when windows are killed
21-			# Fallback for unregistered UNMAP events
22-			test ! `{pfw} && focus top
23-	}
24-}
+0, -231
  1@@ -1,231 +0,0 @@
  2-#!/bin/sh
  3-#
  4-# Copyright (c) 2015 Greduan <me@greduan.com>, licensed under the WTFPL
  5-# Adds group-like capabilities, sorta like those you find in CWM and such WMs
  6-
  7-set -e
  8-
  9-# Original, unmodified script can be found at https://github.com/wmutils/contrib
 10-
 11-usage() {
 12-    cat << EOF
 13-usage: $(basename "$0") [-hCU] [-c wid] [-s wid group] [-tmMu group]
 14-       -h shows this help
 15-       -c cleans WID from group files (and makes it visible)
 16-       -C runs cleanup routine
 17-       -s sets WID's group
 18-       -t toggle group visibility state
 19-       -m maps (shows) group
 20-       -M maps group and unmaps all other groups
 21-       -u unmaps (hides) group
 22-       -U unmaps all the groups
 23-EOF
 24-
 25-    exit 1
 26-}
 27-
 28-# test for no arguments
 29-[ $# -eq 0 ] && usage
 30-
 31-# I suggest it's under /tmp or somewhere that gets cleaned up at reboot or gets
 32-# cleaned up after X stops running
 33-FSDIR="${FSDIR:-/tmp/groups}"
 34-
 35-# define our functions
 36-
 37-# clean WID ($1) from group files
 38-clean_wid() {
 39-    t="$(mktemp /tmp/groups.XXXXXX)"
 40-    for x in "${FSDIR}"/group.*; do
 41-        sed "/$1/d" "$x" >"$t"
 42-        mv "$t" "$x"
 43-    done
 44-    rm -f "$t"
 45-}
 46-
 47-# cleans group ($1) from (in)active files
 48-clean_status() {
 49-    t="$(mktemp /tmp/groups.XXXXXX)"
 50-    sed "/$1/d" "${FSDIR}/active" >"$t"
 51-    mv "$t" "${FSDIR}/active"
 52-    sed "/$1/d" "${FSDIR}/inactive" >"$t"
 53-    mv "$t" "${FSDIR}/inactive"
 54-}
 55-
 56-# shows all the windows in group ($1)
 57-map_group() {
 58-    # safety
 59-    if ! grep -q "$1" < "${FSDIR}/all"; then
 60-        printf "Group doesn't exist\n"
 61-        exit 1
 62-    fi
 63-
 64-    # clean statuses
 65-    clean_status "$1"
 66-    # add to active
 67-    printf "%s\n" "$1" >> "${FSDIR}/active"
 68-
 69-    # loop through group and map windows
 70-	xargs mapw -m <"${FSDIR}/group.$1"
 71-}
 72-
 73-# hides all the windows in group ($1)
 74-unmap_group() {
 75-    # safety
 76-    if ! grep -q "$1" < "${FSDIR}/all"; then
 77-        printf "Group doesn't exist\n"
 78-        exit 1
 79-    fi
 80-
 81-    # clean statuses
 82-    clean_status "$1"
 83-    # add to inactive
 84-    printf "%s\n" "$1" >> "${FSDIR}/inactive"
 85-
 86-    # loop through group and unmap windows
 87-    while read -r line; do
 88-        mapw -u "$line"
 89-    done < "${FSDIR}/group.$1"
 90-}
 91-
 92-# assigns WID ($1) to the group ($2)
 93-set_group() {
 94-    #so that neither grep nor ls in clean_wid complain
 95-    #when group.$2 does not exist
 96-    touch "${FSDIR}/group.$2"
 97-
 98-    # make sure we've no duplicates
 99-    clean_wid "$1"
100-    clean_status "$2"
101-
102-    # insert WID into new group if not already there
103-    grep -q "$1" < "${FSDIR}/group.$2" || \
104-    printf "%s\n" "$1" >> "${FSDIR}/group.$2"
105-
106-    # if we can't find the group add it to groups and make it active
107-    grep -q "$2" < "${FSDIR}/all" || \
108-    printf "%s\n" "$2" >> "${FSDIR}/all" && \
109-    printf "%s\n" "$2" >> "${FSDIR}/active"
110-
111-    # map WID if group is active
112-    grep -q "$2" < "${FSDIR}/active" && \
113-    mapw -m "$1"
114-
115-    # unmap WID if group is inactive
116-    grep -q "$2" < "${FSDIR}/inactive" && \
117-    mapw -u "$1"
118-}
119-
120-# toggles visibility state of all the windows in group ($1)
121-toggle_group() {
122-    # safety
123-    if ! grep -q "$1" < "${FSDIR}/all"; then
124-        printf "Group doesn't exist\n"
125-        return
126-    fi
127-
128-    # search through active groups first
129-    grep -q "$1" < "${FSDIR}/active" && \
130-    unmap_group "$1" && \
131-    return
132-
133-    # search through inactive groups next
134-    grep -q "$1" < "${FSDIR}/inactive" && \
135-    map_group "$1" && \
136-    return
137-}
138-
139-# removes all the unexistent WIDs from groups
140-# removes all group files that don't exist
141-# removes from 'all' file all groups that don't exist
142-cleanup_everything() {
143-    # clean WIDs that don't exist
144-    # using `cat` instead of `<` because error suppression
145-    cat "${FSDIR}"/group.* 2>/dev/null | while read -r wid; do
146-        wattr "${wid}" || \
147-        clean_wid "${wid}"
148-    done
149-
150-    # clean group files that are empty
151-    for file in "${FSDIR}"/group.*; do
152-        # is the group empty?
153-        if [ ! -s "${file}" ]; then
154-            rm -f "${file}"
155-        fi
156-    done
157-
158-    cp "${FSDIR}/all" "${FSDIR}/tmpall"
159-    # remove groups that don't exist from 'all'
160-    while read -r line; do
161-        if [ ! -f "${FSDIR}/group.${line}" ]; then
162-            t="$(mktemp /tmp/groups.XXXXXX)"
163-            sed "/$line/d" "${FSDIR}/tmpall" >"$t"
164-            mv "$t" "${FSDIR}/tmpall"
165-            clean_status "${line}"
166-        fi
167-    done  < "${FSDIR}/all"
168-    mv -f "${FSDIR}/tmpall" "${FSDIR}/all"
169-}
170-
171-# actual run logic (including arguments and such)
172-
173-# check $FSDIR exists
174-[ -d "${FSDIR}" ] || mkdir -p "${FSDIR}"
175-
176-# touch all the files
177-[ -f "${FSDIR}/active" ] || :> "${FSDIR}/active"
178-[ -f "${FSDIR}/inactive" ] || :> "${FSDIR}/inactive"
179-[ -f "${FSDIR}/all" ] || :> "${FSDIR}/all"
180-
181-cleanup_everything
182-
183-# getopts yo
184-while getopts "hc:Cs:t:m:M:u:U" opt; do
185-    case $opt in
186-        h)
187-            usage
188-            ;;
189-        c)
190-            clean_wid "${OPTARG}"
191-            mapw -m "${OPTARG}"
192-            break
193-            ;;
194-        C)
195-            cleanup_everything
196-            break
197-            ;;
198-        s)
199-            set_group "${OPTARG}" "$(eval printf "\$$OPTIND")"
200-            break
201-            ;;
202-        t)
203-            toggle_group "${OPTARG}"
204-            break
205-            ;;
206-        m)
207-            map_group "${OPTARG}"
208-            break
209-            ;;
210-        M)
211-            for file in "${FSDIR}"/group.*; do
212-                group="${file##*.}"
213-                unmap_group "${group}"
214-            done
215-            map_group "${OPTARG}"
216-            break
217-            ;;
218-        u)
219-            unmap_group "${OPTARG}"
220-            break
221-            ;;
222-        U)
223-            for file in "${FSDIR}"/group.*; do
224-                group="${file##*.}"
225-                unmap_group "${group}"
226-            done
227-            break
228-            ;;
229-        *) 
230-            printf "Unrecognized option. use h flag to show usage\n"
231-    esac
232-done
+0, -160
  1@@ -1,160 +0,0 @@
  2-#!/bin/sh
  3-# Check repository for outdated packages
  4-
  5-die() {
  6-    printf '%s\n' "$*" >&2
  7-    exit 1
  8-}
  9-
 10-mkcd() {
 11-    mkdir -p "$1" && cd "$1"
 12-}
 13-
 14-repology_name() {
 15-    # Fix any known naming inconsistences between packages and Repology.
 16-    remote=$(
 17-        # Strip unrelated suffixes.
 18-        remote=${1%%-bin}
 19-        remote=${remote%%-git}
 20-
 21-        # Remote names are all lowercase.
 22-        tr '[:upper:]' '[:lower:]' <<EOF |
 23-$remote
 24-EOF
 25-        # Remote always uses -.
 26-        tr _ -
 27-    )
 28-
 29-    case $remote in
 30-        cairo)
 31-            remote=cairo-graphics-library
 32-        ;;
 33-        
 34-        liberation-fonts)
 35-            remote=fonts:liberation
 36-        ;;
 37-
 38-        libjpeg)
 39-            remote=ijg-libjpeg
 40-        ;;
 41-
 42-        libmupdf | libxaw3d)
 43-            # TODO [community]: Rename packages?
 44-            remote=${remote##lib}
 45-        ;;
 46-
 47-        linux-headers)
 48-            remote=linux
 49-        ;;
 50-
 51-        lpeg)
 52-            remote=lua:lpeg
 53-        ;;
 54-
 55-        samurai)
 56-            remote=samurai-build-tool
 57-        ;;
 58-        
 59-        sshfs)
 60-            remote=fusefs:sshfs
 61-        ;;
 62-        
 63-        surf)
 64-            remote=surf-browser
 65-        ;;
 66-
 67-        st)
 68-            remote=st-term
 69-        ;;
 70-
 71-        terminus-font)
 72-            remote=fonts:terminus
 73-        ;;
 74-
 75-        vis)
 76-            remote=vis-editor
 77-        ;;
 78-
 79-        webkit2gtk)
 80-            # TODO [community]: Rename package?
 81-            remote=webkitgtk
 82-        ;;
 83-
 84-        tz)
 85-        	remote=tzdata
 86-        ;;
 87-
 88-        libpkgconf)
 89-        	remote=pkgconf
 90-        ;;
 91-
 92-    esac
 93-}
 94-
 95-repology_version() {
 96-    [ -f "$1.svg" ] || return 1
 97-    read -r remote_ver < "$1.svg" || :
 98-    remote_ver=${remote_ver%</text>*}
 99-    remote_ver=${remote_ver##*>}
100-}
101-
102-repo_version() {
103-    read -r ver _ 2>/dev/null < "$2/ver" || {
104-        printf '%-30s local version not found\n' "$1" >&2
105-        return 1
106-    }
107-
108-    [ "$ver" != git ]
109-}
110-
111-get_outdated() {
112-    repo=${PWD%%/}
113-    printf '\n[Checking Repology for outdated packages in %s]\n\n' "$repo" >&2
114-
115-    for pkg in */; do
116-        pkg=${pkg%%/}
117-        repology_name "${pkg##*/}"
118-
119-        [ "$remote" = - ] ||
120-            set -- "$@" -z "$remote.svg" \
121-                "https://repology.org/badge/latest-versions/$remote.svg"
122-    done
123-
124-    mkcd "$tmp/${repo##*/}"
125-
126-    curl -SsZA 'kiss-outdated' --parallel-max 16 --remote-name-all "$@" ||
127-        die 'fatal: network error'
128-
129-    for _pkg in "$OLDPWD"/*/; do
130-        pkg=${_pkg%%/}
131-        pkg=${pkg##*/}
132-
133-        repo_version  "$pkg" "$_pkg" || continue
134-        repology_name "$pkg"
135-        repology_version "$remote" || continue
136-
137-        case $remote_ver in
138-            *", $ver"* | *"$ver,"* | "$ver" | '') continue ;;
139-            -) printf '%-30s no remote version found\n' "$pkg" >&2; continue ;;
140-        esac
141-
142-        printf '%-30s %s -> %s\n' "$pkg" "$ver" "$remote_ver"
143-    done
144-}
145-
146-main() {
147-    set -e
148-
149-    [ "$1" ] || set -- "$PWD"
150-
151-    mkdir -p "${tmp:=${XDG_CACHE_HOME:-"$HOME/.cache"}/kiss/repology}"
152-
153-    for repo do
154-        old_pwd=$PWD
155-        cd "$repo"
156-        get_outdated
157-        cd "$old_pwd"
158-    done
159-}
160-
161-main "$@"
+0, -17
 1@@ -1,17 +0,0 @@
 2-#!/bin/sh -e
 3-
 4-cd "$HOME"/usr/img
 5-
 6-while :; do
 7-    set -- *
 8-    n=$(echo $# | awk '{srand(); print int(rand()*$0) + 1}')
 9-    eval "wall=\$$n"
10-    # shellcheck disable=2154
11-    bgs "$wall"
12-    sleep 300
13-done
14-
15-
16-# I wasnt sure as to how to create the random generator without using shuf,
17-# so Ive found this for reference:
18-# https://stackoverflow.com/a/6747490 
+0, -43
 1@@ -1,43 +0,0 @@
 2-#!/bin/sh
 3-#
 4-# z3bra - 2014 (c) wtfpl
 5-# arrange windows in a tiled pattern
 6-
 7-set -e
 8-
 9-# default values for gaps and master area
10-PANEL="${PANEL:-0}"
11-GAP="${GAP:-20}"
12-MASTER="${MASTER:-1000}"
13-
14-# get current window id and its borderwidth
15-PFW="$(pfw)"
16-BW="$(wattr b "${PFW}")"
17-
18-# get root window's size (beware, multi-head setups...)
19-ROOT="$(lsw -r)"
20-SW="$(wattr w "${ROOT}")"
21-SH="$(wattr h "${ROOT}")"
22-
23-# get the number of windows to put in the stacking area
24-# using grep -c here does not give us the correct behavior.
25-# shellcheck disable=2126
26-MAX="$(lsw | grep -v "${PFW}" | wc -l)"
27-
28-# calculate usable screen size (without borders and gaps)
29-SW="$((SW - GAP - 2*BW))"
30-SH="$((SH - GAP - PANEL))"
31-
32-Y="$((0 + GAP + PANEL))"
33-# put current window in master area
34-wtp "${GAP}" "$Y" "$((MASTER - GAP - 2*BW))" "$((SH - GAP - 2*BW))" "${PFW}"
35-
36-# and now, stack up all remaining windows on the right
37-X="$((MASTER + GAP))"
38-W="$((SW - MASTER - GAP))"
39-H="$((SH / MAX - GAP - 2*BW))"
40-
41-for wid in $(lsw | grep -v "${PFW}"); do
42-    wtp "$X" "$Y" "$W" "$H" "${wid}"
43-    Y="$((Y + H + GAP + 2*BW))"
44-done
+0, -112
  1@@ -1,112 +0,0 @@
  2-#!/bin/sh
  3-
  4-set -e
  5-
  6-# Original, unmodified script can be found at https://github.com/wmutils/contrib
  7-
  8-# Constructs and groups windows into workspaces to switch between using your favorite keybinder.
  9-
 10-NUM_WS=9
 11-
 12-help() {
 13-	cat << EOF
 14-usage: $(basename "$0") [-hinp] [-g ws_num] [-m ws_num]
 15-	-h: Displays this message
 16-	-i: Initialize workspaces. Should be called once in a startup script.
 17-	-n: Move up one workspace
 18-	-p: Move down one workspace
 19-	-g, <ws_num>: go to the workspace specified by <ws_num>
 20-	-m, <ws_num>: move the currently focused window to the worskpace specified by <ws_num>
 21-EOF
 22-	exit 1
 23-}
 24-# Initializes us in workspace 0.
 25-ws_init() {
 26-	mkdir -p /tmp/workspaces/
 27-	i=0
 28-	while [ "$i" -le "${NUM_WS}" ]; do
 29-		:> /tmp/workspaces/ws"$i"
 30-		i="$(echo "$i" + 1 | bc)"
 31-	done
 32-	echo 0 > /tmp/workspaces/curr
 33-}
 34-# Saves all mapped windows to the current workspace.
 35-save_ws() {
 36-	curr=$(cat /tmp/workspaces/curr)
 37-	lsw > "/tmp/workspaces/ws${curr}"
 38-}
 39-move_to_ws() {
 40-	ws_num="$1"
 41-	if [ "${ws_num}" -gt "${NUM_WS}" ] || [ "${ws_num}" -lt 0 ]; then
 42-		echo "Workspace not found"
 43-		return
 44-	fi
 45-	curr_ws="$(cat /tmp/workspaces/curr)";
 46-	if [ "${ws_num}" = "${curr_ws}" ]; then
 47-		# same workspace. ignore flicker
 48-		return
 49-	fi
 50-	save_ws
 51-	curr_windows="$(lsw)"
 52-	if [ "${curr_windows}" ]; then
 53-		mapw -u "$(lsw)"
 54-	fi
 55-	new_windows="$(cat /tmp/workspaces/ws"${ws_num}")"
 56-	if [ "${new_windows}" ]; then
 57-		mapw -m "${new_windows}"
 58-	fi
 59-	echo "${ws_num}" > /tmp/workspaces/curr
 60-}
 61-next_ws() {
 62-	# Get what ws we're currently in.
 63-	curr="$(cat /tmp/workspaces/curr)"
 64-	curr="$(echo "${curr}" + 1 | bc)"
 65-
 66-	# Take care of loopback.
 67-	if [ "${curr}" -gt "${NUM_WS}" ]; then
 68-		curr=0
 69-	fi
 70-
 71-	move_to_ws "${curr}"
 72-}
 73-prev_ws() {
 74-	# Get what ws we're currently in.
 75-	curr="$(cat /tmp/workspaces/curr)"
 76-	curr="$(echo "${curr}" - 1 | bc)"
 77-
 78-	# Take care of loopback.
 79-	if [ "${curr}" -lt 0 ]; then
 80-		curr="${NUM_WS}"
 81-	fi
 82-
 83-	move_to_ws "${curr}"
 84-}
 85-move_focused_window() {
 86-	ws_num="$1"
 87-	if [ "${ws_num}" -gt "${NUM_WS}" ] || [ "${ws_num}" -lt 0 ]; then
 88-		echo "Workspace not found"
 89-		return
 90-	fi
 91-	wid="$(pfw)"
 92-	curr_ws="$(cat /tmp/workspaces/curr)";
 93-	if [ "${ws_num}" != "${curr_ws}" ]; then
 94-		pfw >> "/tmp/workspaces/ws$1"
 95-		mapw -u "${wid}"
 96-	fi
 97-}
 98-while getopts ":m:g:npi" opt; do
 99-	case "${opt}" in
100-		n)
101-			next_ws;;
102-		p)
103-			prev_ws;;
104-		g)
105-			move_to_ws "${OPTARG}";;
106-		m)
107-			move_focused_window "${OPTARG}";;
108-		i)
109-			ws_init;;
110-		\?)
111-			help;;
112-	esac
113-done