From a76aa8c932030a64ba277ed9a9cbeadb8dd910d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Tue, 14 Sep 2021 11:04:04 +0300 Subject: Trying out vimb as main browser --- dotfiles/.local/bin/menuwebsurf | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'dotfiles/.local') diff --git a/dotfiles/.local/bin/menuwebsurf b/dotfiles/.local/bin/menuwebsurf index bef9890..cb32299 100755 --- a/dotfiles/.local/bin/menuwebsurf +++ b/dotfiles/.local/bin/menuwebsurf @@ -5,18 +5,22 @@ # Source settings from .bemenurc . ~/.config/bemenurc -prompt="🌐" +searchurl="https://srx.yaroslavps.com/search?q=" +histf="$HOME/.config/vimb/history" # Have to use this "hack" because bemenu doesn't know how to paste if [ "$1" = "paste" ]; then - prompt="$(wl-paste)" + prompt="$(wl-paste)" +else + prompt="$(cat "$histf")" fi -choice=$(echo "$prompt" | bemenu -i -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") || exit 1 +choice=$(printf "%s" "$prompt" | bemenu -i -l 25 -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") || exit 1 -if [ "$choice" = "🌐" ]; then - $BROWSER +if echo "$choice" | egrep ".*://.*" >/dev/null 2>&1; then + choice="$(echo "$choice" | cut -f 1)" + mimeo "$choice" else - mimeo "$choice" + $BROWSER "$choice" fi -- cgit v1.2.3 From a479092a592bc1f97f849410593f8a06a8688cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Fri, 17 Sep 2021 23:59:38 +0300 Subject: Some changes/improvements * New menuman mode to search with apropos * Dragon drag-and-drop marked images in sxiv * Other changes. --- dotfiles/.local/bin/menuman | 60 ++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 6 deletions(-) (limited to 'dotfiles/.local') diff --git a/dotfiles/.local/bin/menuman b/dotfiles/.local/bin/menuman index acad4c4..30a5424 100755 --- a/dotfiles/.local/bin/menuman +++ b/dotfiles/.local/bin/menuman @@ -1,19 +1,67 @@ #!/bin/sh # Search and open man page +# Options: +# -t use in terminal with fzf otherwise launch bemenu. +# -s search with apropos. -list="$(man -k . | awk '{ print $1$2 }')" +# Source settings from .bemenurc +. ~/.config/bemenurc -if [ "$1" = "-t" ]; then - chosen=$(printf "$list" | fzf) +issearch= +isterminal= + +printusage() { + echo "Options:" >2 + echo " -t use in terminal with fzf otherwise launch bemenu." >2 + echo " -s search with apropos." >2 +} + +while getopts "st" curopt "$@"; do + case "$curopt" in + "s") + issearch=1 + continue;; + "t") + isterminal=1 + continue;; + "?") + printusage + exit 1;; + esac +done + +if [ ! -z "$issearch" ]; then + if [ ! -z "$isterminal" ]; then + printf "Enter query:\t" + read query + else + query="$(echo "" | bemenu -p "Enter apropos query:" -i --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" + fi + if [ -z "$query" ]; then + echo "Empty query" >2 + exit 1 + fi + list="$(apropos "$query")" else - # Source settings from .bemenurc - . ~/.config/bemenurc + list="$(man -k . | awk '{ print $1$2 }')" +fi - chosen=$(printf "$list" | bemenu -p "Select man page:" -i -l 25 --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") +if [ ! -z "$isterminal" ]; then + chosen=$(printf "$list" | fzf) +else + chosen=$(printf "$list" | bemenu -p "Select man page:" -i -l 25 --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") fi if [ -z "$chosen" ]; then exit 0 fi +if [ ! -z "$issearch" ]; then + chosen="$(printf "$chosen" | sed "s/\(.* ([a-zA-Z0-9]*)\)\s*-.*/\1/")" +fi + +if [ ! -z "$isterminal" ]; then + man "$chosen" && exit +fi + $TERMINAL -T "man $chosen" man $chosen -- cgit v1.2.3 From 52a2aa5d4168f4f82ee62b778f4f57dc4d1a975b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Tue, 21 Sep 2021 19:58:36 +0300 Subject: menuman: fix redirect to stderr --- dotfiles/.local/bin/menuman | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'dotfiles/.local') diff --git a/dotfiles/.local/bin/menuman b/dotfiles/.local/bin/menuman index 30a5424..98efc02 100755 --- a/dotfiles/.local/bin/menuman +++ b/dotfiles/.local/bin/menuman @@ -11,9 +11,9 @@ issearch= isterminal= printusage() { - echo "Options:" >2 - echo " -t use in terminal with fzf otherwise launch bemenu." >2 - echo " -s search with apropos." >2 + echo "Options:" >&2 + echo " -t use in terminal with fzf otherwise launch bemenu." >&2 + echo " -s search with apropos." >&2 } while getopts "st" curopt "$@"; do @@ -38,7 +38,7 @@ if [ ! -z "$issearch" ]; then query="$(echo "" | bemenu -p "Enter apropos query:" -i --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" fi if [ -z "$query" ]; then - echo "Empty query" >2 + echo "Empty query" >&2 exit 1 fi list="$(apropos "$query")" -- cgit v1.2.3 From dec85ad80a0e7b0b49c354280e1ee3ff4157b9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Tue, 28 Sep 2021 18:58:29 +0300 Subject: workspace script A quick script to quickly open several terminal windows, in a layout that I often use, all in the specified directory. --- dotfiles/.local/bin/workspace | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 dotfiles/.local/bin/workspace (limited to 'dotfiles/.local') diff --git a/dotfiles/.local/bin/workspace b/dotfiles/.local/bin/workspace new file mode 100755 index 0000000..bfc2357 --- /dev/null +++ b/dotfiles/.local/bin/workspace @@ -0,0 +1,40 @@ +#!/bin/sh + +# Yaroslav de la Peña Smirnov 2021 +# +# A quick script to quickly open several terminal windows, in a layout that I +# often use, all in the specified directory. The layout looks something like +# this: +# +# ┌──────────────────┬──────────────────────────────────────────────┐ +# │ │ │ +# │ │ │ +# │ lf │ │ +# │ │ │ +# │ │ │ +# ├──────────────────┤ │ +# │ │ shell │ +# │ │ │ +# │ │ │ +# │ shell │ │ +# │ │ │ +# │ │ │ +# │ │ │ +# └──────────────────┴──────────────────────────────────────────────┘ + +if [ -z "$1" ]; then + echo "Specify working directory" + exit 1 +fi + +swaymsg "gaps inner current set 0; gaps outer current set 0" + +cd "$1" +setsid $TERMINAL -a "$TERMINAL lf:$1" "lf" >/dev/null 2>&1 & sleep 0.1 +setsid $TERMINAL -a "$TERMINAL edit:$1" >/dev/null 2>&1 & sleep 0.1 + +sleep 0.2 +swaymsg "[app_id=\"$TERMINAL lf:$1\"] focus; resize set width 27ppt; split v" +setsid $TERMINAL >/dev/null 2>&1 & sleep 0.2 +swaymsg "resize set height 60ppt" && sleep 0.1 +swaymsg "[app_id=\"$TERMINAL edit:$1\"] focus" -- cgit v1.2.3 From d24e93fbc4d147627e99ef751b6f945a8924a14f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Thu, 7 Oct 2021 14:00:03 +0300 Subject: Revert "Trying out vimb as main browser" This reverts commit a76aa8c932030a64ba277ed9a9cbeadb8dd910d2. And makes changes to adapt qutebrowser history to menuwebsurf. Sorry vimb, you are nice and I like that you are really minimal. But even though qb is written in Python, it still manages to work better than you (even though slower on startup). --- dotfiles/.local/bin/menuwebsurf | 13 +++++++++---- dotfiles/.local/share/applications/neomutt.desktop | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) create mode 100644 dotfiles/.local/share/applications/neomutt.desktop (limited to 'dotfiles/.local') diff --git a/dotfiles/.local/bin/menuwebsurf b/dotfiles/.local/bin/menuwebsurf index cb32299..9e1a7a9 100755 --- a/dotfiles/.local/bin/menuwebsurf +++ b/dotfiles/.local/bin/menuwebsurf @@ -6,19 +6,24 @@ . ~/.config/bemenurc searchurl="https://srx.yaroslavps.com/search?q=" -histf="$HOME/.config/vimb/history" # Have to use this "hack" because bemenu doesn't know how to paste if [ "$1" = "paste" ]; then prompt="$(wl-paste)" else - prompt="$(cat "$histf")" + qmarks="$HOME/.config/qutebrowser/quickmarks" + hist="$HOME/.local/share/qutebrowser/history.sqlite" + prompt="$(sqlite3 -separator ' ' "$hist" \ + 'select title, url from CompletionHistory' | + cat "$qmarks" -)" fi -choice=$(printf "%s" "$prompt" | bemenu -i -l 25 -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") || exit 1 +choice=$(printf "%s" "$prompt" | + bemenu -i -l 25 -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR") || exit 1 if echo "$choice" | egrep ".*://.*" >/dev/null 2>&1; then - choice="$(echo "$choice" | cut -f 1)" + choice="$(echo "$choice" | sed -E 's/[^ ]+ +//g' | + grep -E "https?:" || echo "$choice")" mimeo "$choice" else $BROWSER "$choice" diff --git a/dotfiles/.local/share/applications/neomutt.desktop b/dotfiles/.local/share/applications/neomutt.desktop new file mode 100644 index 0000000..326ccfc --- /dev/null +++ b/dotfiles/.local/share/applications/neomutt.desktop @@ -0,0 +1,6 @@ +[Desktop Entry] +Name=neomutt +GenericName=Email Client +Exec=neomutt %u +Terminal=true +MimeType=x-scheme-handler/mailto -- cgit v1.2.3 From 4213b8745e62801b9926c699edf7ad3ffd94f0b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yaroslav=20de=20la=20Pe=C3=B1a=20Smirnov?= Date: Thu, 7 Oct 2021 14:40:43 +0300 Subject: menuworkspace script --- dotfiles/.local/bin/menuworkspace | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100755 dotfiles/.local/bin/menuworkspace (limited to 'dotfiles/.local') diff --git a/dotfiles/.local/bin/menuworkspace b/dotfiles/.local/bin/menuworkspace new file mode 100755 index 0000000..7d947d0 --- /dev/null +++ b/dotfiles/.local/bin/menuworkspace @@ -0,0 +1,12 @@ +#!/bin/sh + +# Open a "workspace" (see workspace) from a list of dirs under home + +# Source settings from .bemenurc +. ~/.config/bemenurc + +# All dirs under home, except ones under hidden dirs +dirs="$(find $HOME -type d -path "*/\.*" -prune -o -not -name ".*" -type d)" + +workspace "$(echo "$dirs" | + bemenu -i -l 25 -p "Enter link or query:" --tf="$BEMENU_TF" --tb="$BEMENU_NB" --fb="$BEMENU_NB" --fn="$BEMENU_FN" --nb="$BEMENU_NB" --nf="$BEMENU_NF" --hf="$BEMENU_HF" --hb="$BEMENU_HB" --monitor="$BEMENU_MONITOR")" -- cgit v1.2.3