summaryrefslogtreecommitdiff
path: root/bin/menuscripts
diff options
context:
space:
mode:
authorRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-15 03:00:25 +0200
committerRaymaekers Luca <raymaekers.luca@gmail.com>2024-06-15 03:00:25 +0200
commit4914b43f642e2772a140a8f9b1f26b4e555ed88b (patch)
treefa665e469f8daa1f150d13411d0f8537a93e5355 /bin/menuscripts
parentad05cb18f03f3a97a918e090c38ba760147a0bb6 (diff)
parent2a9d0908651ac236855fa515e14a83bada3ad7f9 (diff)
Merge branch 'main' of db:dotfiles
Diffstat (limited to 'bin/menuscripts')
-rwxr-xr-xbin/menuscripts/mmedia2
-rwxr-xr-xbin/menuscripts/mpass4
-rwxr-xr-xbin/menuscripts/tsh29
3 files changed, 23 insertions, 12 deletions
diff --git a/bin/menuscripts/mmedia b/bin/menuscripts/mmedia
index 63d3f7b..3141c3b 100755
--- a/bin/menuscripts/mmedia
+++ b/bin/menuscripts/mmedia
@@ -51,7 +51,7 @@ choice="$(
grep "$regex" |
sort | tee "$tmp" |
concat_path |
- dmenu -px -c -n -x -l 10 -g 1 -F)"
+ dmenu -px -c -i -l 10 -g 1 -x)"
file="$(sed -n "${choice}p" "$tmp")"
[ -r "$file" ] || exit 1
diff --git a/bin/menuscripts/mpass b/bin/menuscripts/mpass
index 7029ffe..7348321 100755
--- a/bin/menuscripts/mpass
+++ b/bin/menuscripts/mpass
@@ -14,14 +14,14 @@ list_pswds()
while [ -d "$store/$file" ]
do
- choice="$(list_pswds "$store/$file" | commander -c)"
+ choice="$(list_pswds "$store/$file" | dmenu -c -g 4 -l 4)"
[ "$choice" ] || exit 1
[ -z "$file" ] && file="$choice" || file="$file/$choice"
done
[ "$file" ] || exit 1
pass show -c "$file" || exit 1
-notify-send -t 1000 "mpass" "copied <b>$file</b>"
+notify-send -t 1000 "mpass" "copied: $file"
[ "$WAYLAND_DISPLAY" ] && cliphist list >/dev/null && # on wayland and cliphist is running
cliphist list | head -n 1 | cliphist delete
diff --git a/bin/menuscripts/tsh b/bin/menuscripts/tsh
index eac0c3e..aac27ee 100755
--- a/bin/menuscripts/tsh
+++ b/bin/menuscripts/tsh
@@ -19,7 +19,7 @@ done
export results="$tmp/results"
export links="$tmp/links"
-types="music anime movies shows other software games isos books"
+categories="music anime movies shows other software games isos books"
if [ "$WAYLAND_DISPLAY" ]
then
@@ -42,6 +42,9 @@ help ()
Available options: seeds, size, name
-m MODULE Select a module, if MODULE is 'list',
lists out available modules
+ -c CATEGORY Select category
+ -f Do not list files
+ -d Download without confirming
EOF
}
@@ -121,7 +124,7 @@ show_files()
# Select a type after having displayed them with 'show_types'
select_type()
{
- for type in $types
+ for type in $categories
do printf "%s\n" "$type"
done | fzf
}
@@ -131,10 +134,17 @@ trap "cleanup" EXIT
## OPTIONS
skip=0
-while getopts ":hm:rs:" opt
+while getopts ":hm:rs:c:fd" opt
do
case $opt in
h) help && exit ;;
+ c)
+ [ "$OPTARG" = "list" ] && >&2 printf '%s\n' "$categories" && exit
+ category="$(printf '%s\n' "$categories" | tr ' ' '\n' | grep -m 1 "^$OPTARG")"
+ [ -z "$category" ] && die "No valid category for '$OPTARG'"
+ logn "category: $category" ;;
+ f) noaskfiles="1" ;;
+ d) noaskdownload="1" ;;
m)
[ "$OPTARG" = "list" ] && list_modules && exit
module="$(list_modules | grep -m 1 "^$OPTARG")"
@@ -185,17 +195,18 @@ getfunctions=1 . "$LIBPFX/$module"
# select result from "$results"
for choice in $(select_result | xargs)
do
- printf 'choice: %s\n' "$choice"
+ printf 'choice: %s\n' "$(sed -n "${choice}p" "$results" | cut -f 3-)"
magnet="$(get_magnet "$choice")"
[ "$magnet" ] || exit 1
- confirm 'files?' && show_files "$magnet"
+ if [ -z "$noaskfiles" ] && confirm 'files?'; then
+ show_files "$magnet"
+ fi
- if confirm 'download?'
+ if [ "$noaskdownload" ] || confirm 'download?'
then
- type="$(select_type)"
- [ "$type" ] || exit 1
- transmission-remote debuc.com -a "$magnet" -w "/downloads/$type"
+ [ "${category:-$(select_type)}" ] || exit 1
+ transmission-remote debuc.com -a "$magnet" -w "/downloads/$category"
elif confirm "copy?"
then
echo "$magnet" | clipp