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

99 lines
2.2 KiB
Plaintext
Raw Normal View History

2022-02-09 00:41:09 +01:00
#!/usr/bin/env fish
2021-04-15 23:03:42 +02:00
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
2021-04-15 23:03:42 +02:00
if test "$argv[1]" = "run"
test -n "$argv[2]" && set t "$argv[2]" || set t "terminal"
2021-04-16 07:04:47 +02:00
2021-04-15 23:03:42 +02:00
test -n "$i3SOCK" && set wrapper 'i3-msg exec --'
test -n "$SWAYSOCK" && set wrapper 'swaymsg exec --'
2021-04-16 07:04:47 +02:00
exec j4-dmenu-desktop \
--dmenu="bmenu start -p Iniciar:" \
--term "$t" \
--wrapper="$wrapper" \
--no-generic
2021-04-15 23:03:42 +02:00
end
if test -n "$SWAYSOCK"
swaymsg -t get_tree |
jq -je '..|select(.focused? and .fullscreen_mode? == 1)|""' &&
swaymsg -q fullscreen off &&
set fullscreen
2021-04-15 23:03:42 +02:00
swaymsg -t get_outputs |
jq -r 'map(.focused)|reverse|index(true)' |
read focused_output
2021-04-15 23:03:42 +02:00
test -n "$focused_output"
and set focused_output "-m $focused_output"
end
function clean_exit
set -q fullscreen
and swaymsg -q fullscreen on &
2021-04-15 23:03:42 +02:00
end
2021-03-31 20:19:57 +02:00
2021-04-15 23:03:42 +02:00
trap clean_exit EXIT
2020-04-24 23:17:08 +02:00
# t title
# f filter
# n normal
# h highlighted
# s selected
# sc scrollbar
2021-04-15 23:03:42 +02:00
set fn "{{@@ font.mono @@}} {{@@ font.size.small @@}}"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set tb "{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
set tf "{{@@ accent_color @@}}"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set fb "{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
set ff "{{@@ color.txt @@}}"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set nb "{{@@ color.bg @@}}{{@@ opacity | clamp_to_hex @@}}"
set nf "{{@@ color.txt @@}}"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set hb "{{@@ accent_color @@}}"
set hf "{{@@ accent_fg @@}}"
2020-10-20 18:54:12 +02:00
#{%@@ if False @@%}#
# Hacks to allow runnning even if not templated
2021-04-15 23:03:42 +02:00
set fn "Fira Code 12"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set tf "#D9534F"
set tb "#202020"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set ff "#ffffff"
set fb "#202020"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set nf "#ffffff"
set nb "#202020"
2020-10-20 18:54:12 +02:00
2021-04-15 23:03:42 +02:00
set hf "#D9534F"
set hb "#404040"
2020-10-20 18:54:12 +02:00
#{%@@ endif @@%}#
2021-12-08 00:54:17 +01:00
command -qs dhist &&
set wraper dhist wrap
env $wraper -- bemenu \
2021-04-15 23:03:42 +02:00
$focused_output\
2021-05-21 06:24:02 +02:00
--grab\
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" \
2021-12-08 00:54:17 +01:00
$argv
2021-04-15 23:03:42 +02:00
# vim: ft=fish