diff --git a/justfile b/justfile index c60140b..77c811a 100644 --- a/justfile +++ b/justfile @@ -15,7 +15,7 @@ zls-git install-scripts target=(`echo $HOME` + "/.local"): ln -sf \ - `pwd`/scripts/{map-touch-display,start-joshuto,withjava,startriver,update-nvim-plugins} \ + `pwd`/scripts/{map-touch-display,playvid,start-joshuto,withjava,startriver,update-nvim-plugins} \ {{target}}/bin cd scripts/randomwallpaper && zig build -Doptimize=ReleaseFast -p {{target}} diff --git a/scripts/playvid b/scripts/playvid new file mode 100755 index 0000000..d8ac9d9 --- /dev/null +++ b/scripts/playvid @@ -0,0 +1,22 @@ +#!/usr/bin/env racket +#lang racket + +;; Plays a random file in CWD using mpv, unless one is provided as CLI arg. +;; Asks to delete the file after viewing it. + +(require racket/gui/base) + +(current-print void) + +(define file + (command-line + ;; default to random file + #:args ([f (let ([dir (directory-list)]) (path->string (list-ref dir (random (length dir)))))]) + f)) + +(printf "playing: ~a\n" file) +(system* (find-executable-path "mpv") file) + +(when (eq? (message-box "Delete Video?" (format "Delete this video?\n\n~a" file) #f '(yes-no)) 'yes) + (printf "deleting `~a`\n" file) + (delete-file file))