nixos-config/scripts/bmenu

54 lines
1.2 KiB
Plaintext
Raw Normal View History

2022-10-18 12:37:14 -03:00
#!/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 \
2022-10-18 12:37:14 -03:00
$focused_output\
--ignorecase\
2023-01-21 16:06:23 -03:00
--border 2\
--center\
--width-factor 0.5\
2022-10-18 12:37:14 -03:00
--no-overlap\
2023-01-21 16:06:23 -03:00
--list 30\
2022-10-18 12:37:14 -03:00
--prefix '>'\
2023-01-21 16:06:23 -03:00
--bdr "$bdr"\
2022-10-18 12:37:14 -03:00
--fn "$fn"\
--tb "$tb" --tf "$tf" \
--fb "$fb" --ff "$ff" \
--nb "$nb" --nf "$nf" \
--ab "$ab" --af "$af" \
2022-10-18 12:37:14 -03:00
--hb "$hb" --hf "$hf" \
$argv
# vim: ft=fish