aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sway/.local
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-07-23 02:54:00 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-07-23 02:54:00 -0500
commit062c21e03cebeeeac9437f8d93da5f45770abfb1 (patch)
tree62e507e7238ba749986967a449f86a774ab5b4c2 /sway/.local
parenta06fc43b26c9de9f37c5270a421af62c790e5df0 (diff)
feat(mpv): add mpv watch_later resume script
Diffstat (limited to 'sway/.local')
-rwxr-xr-xsway/.local/bin/sway-mpv14
1 files changed, 14 insertions, 0 deletions
diff --git a/sway/.local/bin/sway-mpv b/sway/.local/bin/sway-mpv
new file mode 100755
index 0000000..a39a0aa
--- /dev/null
+++ b/sway/.local/bin/sway-mpv
@@ -0,0 +1,14 @@
+#!/bin/sh
+
+if [ ! -t 0 ]; then
+ set -- "$@" "$(cat)"
+elif [ $# -eq 0 ]; then
+ IFS=: grep -Po '# title: \K.*' "$XDG_STATE_HOME"/mpv/watch_later/* | while IFS=: read -r file match; do
+ grep -Pom1 '# \K.*' "$file" | tr -d '\n'
+ printf ': %s\n' "$match"
+ done
+ exit 0
+fi
+
+# shellcheck disable=SC2068
+swaymsg exec -- mpv "${1%*:*}"