From 4a053155d7238a8613921551c19de2cb798c99fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Mon, 1 Aug 2022 20:59:20 -0300 Subject: [PATCH] add launch menu style --- user/home.nix | 88 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 86 insertions(+), 2 deletions(-) diff --git a/user/home.nix b/user/home.nix index ec7659a..51e76ff 100644 --- a/user/home.nix +++ b/user/home.nix @@ -27,6 +27,7 @@ let dark = { background = "~/.local/share/backgrounds/assembly_dark.png"; opacity = "98"; + opacityHex = "ee"; color = { type = "dark"; bg = "#202020"; @@ -57,7 +58,8 @@ let nerdfonts_fira_hack = (pkgs.nerdfonts.override { fonts = [ "FiraCode" "Hack" ]; }); accent = accents.red; - color = themes.dark.color; + theme = themes.dark; + color = theme.color; pulse_sink = pkgs.writeShellScriptBin "pulse_sink" '' #!/bin/sh output=$(printf "HDMI\nHeadphones" | bemenu -b) @@ -72,6 +74,87 @@ let esac ${pkgs.pamixer}/bin/pamixer --set-volume "$vol" ''; + bmenu = pkgs.writeScriptBin "bmenu" '' + #!${pkgs.fish}/bin/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 + + set swaymsg ${pkgs.sway}/bin/swaymsg + set swaymsg ${pkgs.sway}/bin/swaymsg + + 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 ${pkgs.j4-dmenu-desktop}/bin/j4-dmenu-desktop \ + --dmenu="bmenu start -p Iniciar:" \ + --term "$t" \ + --wrapper="$wrapper" \ + --no-generic + end + + if test -n "$SWAYSOCK" + swaymsg -t get_tree | + ${pkgs.jq}/bin/jq -je '..|select(.focused? and .fullscreen_mode? == 1)|""' && + ${pkgs.sway}/bin/swaymsg -q fullscreen off && + set fullscreen + + ${pkgs.sway}/bin/swaymsg -t get_outputs | + ${pkgs.jq}/bin/jq -r 'map(.focused)|reverse|index(true)' | + read focused_output + + test -n "$focused_output" + and set focused_output "-m $focused_output" + end + + function clean_exit + set -q fullscreen + and swaymsg -q fullscreen on & + end + + trap clean_exit EXIT + + # t title + # f filter + # n normal + # h highlighted + # s selected + # sc scrollbar + + set fn "${font.mono} ${font.size.small}" + + set tb "${ color.bg }${theme.opacityHex}" + set tf "${ accent.color }" + + set fb "${ color.bg }${theme.opacityHex}" + set ff "${ color.txt }" + + set nb "${ color.bg }${theme.opacityHex}" + set nf "${ color.txt }" + set hb "${ accent.color }" + set hf "${ accent.fg }" + + ${pkgs.dhist}/bin/dhist wrap -- ${pkgs.bemenu}/bin/bemenu \ + $focused_output\ + --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" \ + $argv + + # vim: ft=fish + ''; in { # Home Manager needs a bit of information about you and the # paths it should manage. @@ -101,6 +184,7 @@ in { xfce.thunar pass dhist + bmenu # media yt-dlp ffmpeg @@ -455,7 +539,7 @@ in { keybindings = let mod = "Mod4"; floating.modifier = "Mod4"; - menu = "bemenu-run --bottom"; + menu = "bmenu run"; terminal = "alacritty"; workspace_binds = { "${mod}+1" = "workspace number 1";