From 728bfc73a762bc53f843e3c7c15700ad3bf0a7f3 Mon Sep 17 00:00:00 2001 From: zachir Date: Tue, 15 Jul 2025 21:01:25 -0500 Subject: Move some of my scripts out of bin to here --- dmenu_books | 19 +++++++++++++++++++ steamsession | 3 +++ touchpad.sh | 26 ++++++++++++++++++++++++++ video_download.sh | 30 ++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100755 dmenu_books create mode 100755 steamsession create mode 100755 touchpad.sh create mode 100755 video_download.sh diff --git a/dmenu_books b/dmenu_books new file mode 100755 index 0000000..3b6f1fe --- /dev/null +++ b/dmenu_books @@ -0,0 +1,19 @@ +#!/bin/sh + +printhelp () { + exit +} + +while getopts "hd:" o; do case "${o}" in + d) ARGS="$ARGS$OPTARG " ;; + *) printhelp ;; +esac done + +DMENU="dmenu" +DEFARGS="-l 15 -p" + +BOOK=`ls ~/Documents/shared | $DMENU $DEFARGS \"books\" $ARGS` + +[ -z "$BOOK" ] && exit 1 + +zathura "~/Documents/shared/$BOOK" diff --git a/steamsession b/steamsession new file mode 100755 index 0000000..fc5848a --- /dev/null +++ b/steamsession @@ -0,0 +1,3 @@ +#!/bin/sh + +exec gamescope -f -g -e -- steam -gamepadui diff --git a/touchpad.sh b/touchpad.sh new file mode 100755 index 0000000..bb864e9 --- /dev/null +++ b/touchpad.sh @@ -0,0 +1,26 @@ +#!/bin/sh + +export XDG_RUNTIME_DIR="${XDG_RUNTIME_DIR:-$HOME/.local/share}" +export STATUS_FILE="$XDG_RUNTIME_DIR/touchpad.status" + +enable_touchpad() { + printf "true" >"$STATUS_FILE" + notify-send -u normal "Enabling touchpad" + hyprctl keyword '$LAPTOP_TP_ENABLED' "true" -r +} + +disable_touchpad() { + printf "false" >"$STATUS_FILE" + notify-send -u normal "Disabling touchpad" + hyprctl keyword '$LAPTOP_TP_ENABLED' "false" -r +} + +if ! [ -f "$STATUS_FILE" ]; then + enable_touchpad +else + if [ $(cat "$STATUS_FILE") = "true" ]; then + disable_touchpad + elif [ $(cat "$STATUS_FILE") = "false" ]; then + enable_touchpad + fi +fi diff --git a/video_download.sh b/video_download.sh new file mode 100755 index 0000000..ffbc4f7 --- /dev/null +++ b/video_download.sh @@ -0,0 +1,30 @@ +#!/bin/sh + +VIDE_DIR="/var/tank/videos/Videos/" +PLAY_DIR="/var/tank/videos/Playlists/" + +PLAY_SUBS="$(ls -1 ${PLAY_DIR})" + +LAST_FILE="${XDG_CACHE_HOME:-$HOME/.cache}/video_download" + +get_videos () { + cd "$VIDE_DIR" + yt-dlp "$(cat url.txt)" + date '+%s' > "${LAST_FILE}.video.txt" +} + +get_playlists () { + cd "$PLAY_DIR" + ls -1 | while read subdir; do + cd "$PLAY_DIR/$subdir" + yt-dlp "$(cat url.txt)" + done +} + +if [ ! -f "${LAST_FILE}.video.txt" ] || [ "$(tail -1 "${LAST_FILE}.video.txt")" -lt "$(find "${VIDE_DIR}url.txt" -printf '%Cs\n')" ]; then + get_videos +fi + +if [ ! -f "${LAST_FILE}.playlist.txt" ] || [ "$(tail -1 "${LAST_FILE}.playlist.txt")" -lt "$(find "${PLAY_DIR}" -name 'url.txt' -printf '%Cs\n' | sort -n | tail -1)" ]; then + get_playlists +fi -- cgit v1.2.3