don't wrap shell scripts in nix file
This commit is contained in:
		
							parent
							
								
									cdcdc90a10
								
							
						
					
					
						commit
						5422aea875
					
				
					 5 changed files with 147 additions and 52 deletions
				
			
		
							
								
								
									
										61
									
								
								scripts/bmenu
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								scripts/bmenu
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,61 @@
 | 
			
		|||
#!/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_tree |
 | 
			
		||||
        jq -je '..|select(.focused? and .fullscreen_mode? == 1)|""' &&
 | 
			
		||||
        swaymsg -q fullscreen off &&
 | 
			
		||||
        set fullscreen
 | 
			
		||||
 | 
			
		||||
    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
 | 
			
		||||
 | 
			
		||||
function clean_exit
 | 
			
		||||
    set -q fullscreen
 | 
			
		||||
    and swaymsg -q fullscreen on &
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
trap clean_exit EXIT
 | 
			
		||||
 | 
			
		||||
set -l config "$HOME/.config/bmenu.conf"
 | 
			
		||||
if test -f $config
 | 
			
		||||
  source $config
 | 
			
		||||
end
 | 
			
		||||
 | 
			
		||||
dhist wrap -- 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
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue