wip
This commit is contained in:
parent
cd81ce6ca8
commit
f0f4766a26
@ -28,10 +28,10 @@ LIST+=(
|
||||
"screen_pick" "screenshot output"
|
||||
"screen_pick" "screenshot selection"
|
||||
"todo" "pass"
|
||||
"tui" "calc"
|
||||
"calc" "calc"
|
||||
"todo" "translate ru-en"
|
||||
"todo" "translate en-ru"
|
||||
"word_pick" "pick-word"
|
||||
"grep_dict" "dict"
|
||||
)
|
||||
if [ "$FEAT_BRIGHTNESS" ]; then
|
||||
LIST+=(
|
||||
@ -95,24 +95,59 @@ exec_man() {
|
||||
[ -n "$page" ] && exec footclient "$SHELL" -c "man '$page' || read -n1"
|
||||
}
|
||||
exec_screen_pick() {
|
||||
shift 1
|
||||
shift
|
||||
if [ "$1" = "output" ]; then
|
||||
mon="$(swaymsg -t get_outputs | jq -r '. | map(select(.focused == true)) | .[0].name')"
|
||||
grim -o "$mon" - | wl-copy -t image/png
|
||||
elif [ "$1" = "selection" ]; then
|
||||
grim -g "$(slurp)" - | wl-copy -t image/png
|
||||
fi
|
||||
notify-send -a Screenshot "Done" "PNG image copied to clipboard" -t 3000
|
||||
notify-send Done -a screenshot "PNG image copied to clipboard" -t 3000
|
||||
}
|
||||
exec_pass() {
|
||||
echo 1
|
||||
}
|
||||
exec_calc() {
|
||||
shift
|
||||
query="$1"
|
||||
if [ -z "$query" ]; then
|
||||
query="$(echo "tui" | bemenu --prompt "qalc")"
|
||||
fi
|
||||
if [ "$query" = "tui" ]; then
|
||||
exec_float_tui "qalc"
|
||||
elif [ -n "$query" ]; then
|
||||
calc_res="$(qalc --terse "$query")"
|
||||
menu_res="$(echo -e "$calc_res\ntui" | bemenu --prompt "qalc")"
|
||||
if [ "$calc_res" = "$menu_res" ]; then
|
||||
notify-send "$calc_res" -a calc "Result copied to clipboard" -t 3000
|
||||
elif [ -n "$menu_res" ]; then
|
||||
exec_calc _ "$menu_res"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
exec_transl() {
|
||||
echo 1
|
||||
}
|
||||
exec_word_pick() {
|
||||
shift 1
|
||||
|
||||
exec_grep_dict() {
|
||||
shift
|
||||
dict="$1"
|
||||
pattern="$2"
|
||||
dicts_path="$HOME/know/dict/"
|
||||
if [ -z "$dict" ]; then
|
||||
dict="$(find "$dicts_path" -type f -printf "%f\n" | bemenu --prompt "dict")"
|
||||
[ -z "$dict" ] && return
|
||||
fi
|
||||
if [ -z "$pattern" ]; then
|
||||
pattern="$(echo -n | bemenu --prompt "grep $dict")"
|
||||
[ -z "$pattern" ] && return
|
||||
fi
|
||||
res="$({ echo ..; grep "$pattern" "$dicts_path/$dict"; } | bemenu --prompt " ")"
|
||||
if [ "$res" = ".." ]; then
|
||||
exec_grep_dict _ "$dict"
|
||||
else
|
||||
wl-copy "$res"
|
||||
notify-send "$res" -a dict "Word copied to clipboard" -t 3000
|
||||
fi
|
||||
}
|
||||
exec_brightness() {
|
||||
shift
|
||||
@ -121,13 +156,11 @@ exec_brightness() {
|
||||
current="$(($(brightnessctl g)*100/$(brightnessctl m)))"
|
||||
current_i="$((current/5))"
|
||||
list="$(echo 1%; seq 5 5 100 | sed 's/$/%/')";
|
||||
target="$(
|
||||
echo "$list" | bemenu --index $current_i --prompt "$current% ->"
|
||||
)";
|
||||
target="$(echo "$list" | bemenu --index $current_i --prompt "$current% ->")";
|
||||
fi
|
||||
if [ -n "$target" ]; then
|
||||
if [ -n "$target" ] && [ "$target" != "$current%" ]; then
|
||||
brightnessctl set "$target"
|
||||
[ -z "$1" ] && exec_brightness brightness
|
||||
[ -z "$1" ] && exec_brightness _
|
||||
fi
|
||||
}
|
||||
exec_power() {
|
||||
|
Loading…
Reference in New Issue
Block a user