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

86 lines
1.7 KiB
Plaintext
Raw Normal View History

2020-11-03 06:15:23 +01:00
#!/bin/sh
2020-04-26 08:43:54 +02:00
# 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
2019-12-01 23:21:31 +01:00
2020-11-03 06:15:23 +01:00
if test "$1" = "run"
then
test -n "$2" && t="$2" || t="terminal"
2021-04-16 07:04:47 +02:00
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
2020-11-03 06:15:23 +01:00
fi
2019-12-01 23:21:31 +01:00
fullscreen=false
test -n "$SWAYSOCK" &&
swaymsg -t get_tree |
jq -je '..|select(.focused? and .fullscreen_mode? == 1)|""' &&
swaymsg -q fullscreen off &&
fullscreen=true
2021-03-31 20:19:57 +02:00
end(){
"$fullscreen" && swaymsg -q fullscreen on
}
trap end EXIT
2020-04-24 23:17:08 +02:00
# t title
# f filter
# n normal
# h highlighted
# s selected
# sc scrollbar
fn="{{@@ font.mono @@}} {{@@ font.size.small @@}}"
2020-10-20 18:54:12 +02:00
tb="{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
tf="{{@@ accent_color @@}}"
2020-10-20 18:54:12 +02:00
fb="{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
ff="{{@@ color.txt @@}}"
2020-10-20 18:54:12 +02:00
nb="{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
nf="{{@@ color.txt @@}}"
2020-10-20 18:54:12 +02:00
2021-04-16 07:05:20 +02:00
hb="{{@@ accent_color @@}}"
hf="{{@@ accent_fg @@}}"
2020-10-20 18:54:12 +02:00
#{%@@ if False @@%}#
# Hacks to allow runnning even if not templated
fn="Fira Code 12"
2020-10-20 18:54:12 +02:00
tf="#D9534F"
tb="#202020"
2020-10-20 18:54:12 +02:00
ff="#ffffff"
fb="#202020"
2020-10-20 18:54:12 +02:00
nf="#ffffff"
nb="#202020"
2020-10-20 18:54:12 +02:00
hf="#D9534F"
hb="#404040"
2020-10-20 18:54:12 +02:00
#{%@@ endif @@%}#
2019-12-01 23:21:31 +01:00
bemenu \
2021-04-01 18:25:18 +02:00
-m -1\
2019-12-01 23:21:31 +01:00
--ignorecase\
--bottom\
2020-04-24 23:17:08 +02:00
--no-overlap\
2019-12-01 23:21:31 +01:00
--list 20\
2020-12-07 02:12:21 +01:00
--prefix '>'\
2020-10-20 18:54:12 +02:00
--fn "$fn"\
--tb "$tb" --tf "$tf" \
--fb "$fb" --ff "$ff" \
--nb "$nb" --nf "$nf" \
--hb "$hb" --hf "$hf" \
2020-11-03 06:15:23 +01:00
$@