menu: wmenu -> tofi
This commit is contained in:
parent
5f4af0a156
commit
70a935fd7b
9 changed files with 62 additions and 40 deletions
|
@ -48,8 +48,8 @@ bookmark-interactive no
|
|||
bookmark-autopilot yes
|
||||
|
||||
# Macroses
|
||||
macro y set browser "echo %u | xclip -r -sel c"; open-in-browser; set browser linkhandler
|
||||
macro d set browser "wm-handler %u"; open-in-browser-and-mark-read; set browser linkhandler
|
||||
macro y set browser "echo %u | wl-copy"; open-in-browser; set browser linkhandler
|
||||
macro d set browser "handler %u"; open-in-browser-and-mark-read; set browser linkhandler
|
||||
macro c set browser "pipe-viewer --no-interactive --comments=%u | less"; open-in-browser; set browser linkhandler
|
||||
macro i set browser "pipe-viewer --no-interactive --info=%u | less"; open-in-browser; set browser linkhandler
|
||||
|
||||
|
@ -73,7 +73,4 @@ highlight article "\\[[0-9]+\\]" magenta default
|
|||
|
||||
# Filters
|
||||
ignore-mode "display"
|
||||
ignore-article "https://www.youtube.com/feeds/videos.xml?channel_id=UCWnNKC1wrH_NXAXc5bhbFnA" "title !# \"Опергеймер\""
|
||||
ignore-article "https://www.youtube.com/feeds/videos.xml?channel_id=UCjulQNQQJmpYzI-BD1-s03w" "title !# \"Маргинал\""
|
||||
ignore-article "http://feed.rutracker.cc/atom/f/1950.atom" "title !# \"Sub\""
|
||||
ignore-article "https://www.youtube.com/feeds/videos.xml?channel_id=UC4rpWi42yPqTA0wnfx7MqOA" "title =~ \"на Паучительных\""
|
||||
|
|
26
.config/tofi/config
Normal file
26
.config/tofi/config
Normal file
|
@ -0,0 +1,26 @@
|
|||
horizontal = true
|
||||
anchor = top
|
||||
|
||||
width = 100%
|
||||
outline-width = 0
|
||||
border-width = 0
|
||||
min-input-width = 120
|
||||
|
||||
height = 18
|
||||
result-spacing = 20
|
||||
|
||||
background-color = #222222
|
||||
text-color = #bbbbbb
|
||||
selection-background = #005577
|
||||
selection-color = #f2f0ec
|
||||
|
||||
font = Monospace
|
||||
font-size = 8
|
||||
|
||||
prompt-text = ">"
|
||||
prompt-padding = 10
|
||||
|
||||
padding-top = 2
|
||||
padding-bottom = 2
|
||||
padding-left = 5
|
||||
selection-padding = 8
|
|
@ -209,8 +209,8 @@ device_menu() {
|
|||
trusted=$(device_trusted "$mac")
|
||||
options="$connected\n$paired\n$trusted\n$divider\n$goback\nExit"
|
||||
|
||||
# Open wmenu menu, read chosen option
|
||||
chosen="$(echo -e "$options" | run_wmenu "$device_name")"
|
||||
# Open tofi, read chosen option
|
||||
chosen="$(echo -e "$options" | run_tofi "$device_name")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
|
@ -232,7 +232,7 @@ device_menu() {
|
|||
esac
|
||||
}
|
||||
|
||||
# Opens a wmenu menu with current bluetooth status and options to connect
|
||||
# Opens a tofi with current bluetooth status and options to connect
|
||||
show_menu() {
|
||||
# Get menu options
|
||||
if power_on; then
|
||||
|
@ -247,15 +247,15 @@ show_menu() {
|
|||
pairable=$(pairable_on)
|
||||
discoverable=$(discoverable_on)
|
||||
|
||||
# Options passed to wmenu
|
||||
# Options passed to tofi
|
||||
options="$devices\n$divider\n$power\n$scan\n$pairable\n$discoverable\nExit"
|
||||
else
|
||||
power="Power: off"
|
||||
options="$power\nExit"
|
||||
fi
|
||||
|
||||
# Open wmenu menu, read chosen option
|
||||
chosen="$(echo -e "$options" | run_wmenu "Bluetooth")"
|
||||
# Open tofi, read chosen option
|
||||
chosen="$(echo -e "$options" | run_tofi "Bluetooth")"
|
||||
|
||||
# Match chosen option to command
|
||||
case $chosen in
|
||||
|
@ -284,10 +284,10 @@ show_menu() {
|
|||
|
||||
original_args=("$@")
|
||||
|
||||
# wmenu command to pipe into. Extra arguments to wmenu-bluetooth are passed through to wmenu. This
|
||||
# tofi command to pipe into. Extra arguments to tofi-bluetooth are passed through to tofi. This
|
||||
# allows the user to set fonts, sizes, colours, etc.
|
||||
run_wmenu() {
|
||||
wmenu "${original_args[@]}" -i -p "$1"
|
||||
run_tofi() {
|
||||
tofi "${original_args[@]}" --prompt-text "$1"
|
||||
}
|
||||
|
||||
case "$1" in
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
output="$(date '+%y%m%d-%H%M-%S').png"
|
||||
|
||||
case "$(printf "a selected area\\nfull screen\\na selected area (copy)\\nfull screen (copy)" | wmenu -l 4 -i -p "Screenshot which area?")" in
|
||||
case "$(printf "a selected area\\na selected area (copy)\\nfull screen\\nfull screen (copy)" | tofi --prompt-text "Screenshot which area?")" in
|
||||
"a selected area") grim -g "$(slurp)" pic-selected-"${output}" ;;
|
||||
"a selected area (copy)") grim -g "$(slurp)" - | wl-copy ;;
|
||||
"full screen") grim pic-full-"${output}" ;;
|
||||
"a selected area (copy)") grim -g "$(slurp)" | wl-copy ;;
|
||||
"full screen (copy)") grim - | wl-copy ;;
|
||||
esac
|
18
.local/bin/menu/handler
Executable file
18
.local/bin/menu/handler
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Feed this script a link and it will give dmenu
|
||||
# some choice programs to use to open it.
|
||||
feed="${1:-$(printf "%s" | wmenu -p 'Paste URL or file path')}"
|
||||
|
||||
case "$(printf "yt-dlp\\nyt-dlp (audio)\\nyt-dlp (music)\\nmpv\\nmpv (audio)\\ncurl\\nzathura\\nimv\\nvim\\nbrowser" | tofi --prompt-text "Handle it with?")" in
|
||||
"yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
|
||||
"yt-dlp (audio)") qndl "$feed" 'yt-dlp -f bestaudio/best' >/dev/null 2>&1 ;;
|
||||
"yt-dlp (music)") qndl "$feed" 'yt-dlp -f bestaudio/best -x --no-playlist --audio-format mp3 -o $XDG_MUSIC_DIR/%(title)s.%(ext)s' >/dev/null 2>&1 ;;
|
||||
"mpv") setsid -f "$TERMINAL" -e mpv --quiet --no-video "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv (audio)") setsid -f "$TERMINAL" -e mpv --quiet --no-video "$feed" >/dev/null 2>&1 ;;
|
||||
"curl") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
zathura) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
imv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && imv "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1
|
||||
esac
|
5
.local/bin/menu/prompt
Executable file
5
.local/bin/menu/prompt
Executable file
|
@ -0,0 +1,5 @@
|
|||
#!/bin/sh
|
||||
|
||||
# A wmenu binary prompt script.
|
||||
|
||||
[ "$(printf "No\\nYes" | tofi --prompt-text "$1" )" = "Yes" ] && $2
|
|
@ -1,5 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# A wmenu binary prompt script.
|
||||
|
||||
[ "$(printf "No\\nYes" | wmenu -i -p "$1" )" = "Yes" ] && $2
|
|
@ -1,19 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# Feed this script a link and it will give dmenu
|
||||
# some choice programs to use to open it.
|
||||
feed="${1:-$(printf "%s" | wmenu -p 'Paste URL or file path')}"
|
||||
|
||||
case "$(printf "yt-dlp\\nyt-dlp (audio)\\nyt-dlp (music)\\ncurl\\nmpv (audio)\\nmpv (float)\\nmpv (loop)\\nzathura\\nsxiv\\nnvim\\nbrowser" | wmenu -i -p "Handle it with?")" in
|
||||
"yt-dlp") qndl "$feed" >/dev/null 2>&1 ;;
|
||||
"yt-dlp (audio)") qndl "$feed" 'yt-dlp -f bestaudio/best -icx --embed-metadata' >/dev/null 2>&1 ;;
|
||||
"yt-dlp (music)") qndl "$feed" 'yt-dlp -f bestaudio/best -icx --embed-metadata --no-playlist --audio-format mp3 -o $XDG_MUSIC_DIR/%(title)s.%(ext)s' >/dev/null 2>&1 ;;
|
||||
"curl") qndl "$feed" 'curl -LO' >/dev/null 2>&1 ;;
|
||||
"mpv (audio)") setsid -f "$TERMINAL" -e mpv --quiet --no-video "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv (float)") setsid -f mpv --geometry=+0-0 --autofit=30% --title="mpvfloat" "$feed" >/dev/null 2>&1 ;;
|
||||
"mpv (loop)") setsid -f mpv -quiet --loop "$feed" >/dev/null 2>&1 ;;
|
||||
zathura) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && zathura "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
sxiv) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && sxiv -a "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
vim) curl -sL "$feed" > "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" && setsid -f "$TERMINAL" -e "$EDITOR" "/tmp/$(echo "$feed" | sed "s/.*\///;s/%20/ /g")" >/dev/null 2>&1 ;;
|
||||
browser) setsid -f "$BROWSER" "$feed" >/dev/null 2>&1
|
||||
esac
|
Loading…
Reference in a new issue