nixos-config/scripts/bmenu
2023-01-21 16:06:23 -03:00

54 lines
1.2 KiB
Fish

#!/usr/bin/env fish
# wrapper around bemenu
# bmenu * - use as dmenu, -p for custom prompt (man bemenu)
# bmenu run - select from .desktop files and run it
# bmenu start - internal option
if test "$argv[1]" = "run"
test -n "$argv[2]" && set t "$argv[2]" || set t "terminal"
test -n "$i3SOCK" && set wrapper 'i3-msg exec --'
test -n "$SWAYSOCK" && set wrapper 'swaymsg exec --'
exec j4-dmenu-desktop \
--dmenu="bmenu start -p Iniciar:" \
--term "$t" \
--wrapper="$wrapper" \
--no-generic
end
if test -n "$SWAYSOCK"
swaymsg -t get_outputs |
jq -r 'map(.focused)|reverse|index(true)' |
read focused_output
test -n "$focused_output"
and set focused_output "-m $focused_output"
end
set -l config "$HOME/.config/bmenu.conf"
if test -f $config
source $config
end
exec dhist wrap -- bemenu \
$focused_output\
--ignorecase\
--border 2\
--center\
--width-factor 0.5\
--no-overlap\
--list 30\
--prefix '>'\
--bdr "$bdr"\
--fn "$fn"\
--tb "$tb" --tf "$tf" \
--fb "$fb" --ff "$ff" \
--nb "$nb" --nf "$nf" \
--ab "$ab" --af "$af" \
--hb "$hb" --hf "$hf" \
$argv
# vim: ft=fish