This repository has been archived on 2024-04-07. You can view files and clone it, but cannot push or open issues or pull requests.
dotfiles/dotfiles/scripts/bmenu
2021-04-26 21:07:37 -03:00

86 lines
1.7 KiB
Bash
Executable file

#!/bin/sh
# 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 "$1" = "run"
then
test -n "$2" && t="$2" || t="terminal"
test -n "$i3SOCK" && wrapper='i3-msg exec --'
test -n "$SWAYSOCK" && wrapper='swaymsg exec --'
exec j4-dmenu-desktop \
--dmenu="bmenu start -p Iniciar:" \
--term "$t" \
--wrapper="$wrapper" \
--no-generic
fi
fullscreen=false
test -n "$SWAYSOCK" &&
swaymsg -t get_tree |
jq -je '..|select(.focused? and .fullscreen_mode? == 1)|""' &&
swaymsg -q fullscreen off &&
fullscreen=true
end(){
"$fullscreen" && swaymsg -q fullscreen on
}
trap end EXIT
# t title
# f filter
# n normal
# h highlighted
# s selected
# sc scrollbar
fn="{{@@ font.mono @@}} {{@@ font.size.small @@}}"
tb="{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
tf="{{@@ accent_color @@}}"
fb="{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
ff="{{@@ color.txt @@}}"
nb="{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
nf="{{@@ color.txt @@}}"
hb="{{@@ accent_color @@}}"
hf="{{@@ accent_fg @@}}"
#{%@@ if False @@%}#
# Hacks to allow runnning even if not templated
fn="Fira Code 12"
tf="#D9534F"
tb="#202020"
ff="#ffffff"
fb="#202020"
nf="#ffffff"
nb="#202020"
hf="#D9534F"
hb="#404040"
#{%@@ endif @@%}#
bemenu \
-m -1\
--ignorecase\
--bottom\
--no-overlap\
--list 20\
--prefix '>'\
--fn "$fn"\
--tb "$tb" --tf "$tf" \
--fb "$fb" --ff "$ff" \
--nb "$nb" --nf "$nf" \
--hb "$hb" --hf "$hf" \
$@