switch to rofi
This commit is contained in:
		
							parent
							
								
									0b04d298ac
								
							
						
					
					
						commit
						f7d596a488
					
				
					 6 changed files with 95 additions and 19 deletions
				
			
		| 
						 | 
				
			
			@ -3,7 +3,8 @@ pkgs.writeShellScriptBin "wpass" ''
 | 
			
		|||
  set -xe
 | 
			
		||||
 | 
			
		||||
  wtype=${pkgs.wtype}/bin/wtype
 | 
			
		||||
  dmenu=${pkgs.bmenu}/bin/bmenu
 | 
			
		||||
  # dmenu=${pkgs.bmenu}/bin/bmenu
 | 
			
		||||
  dmenu="rofi -dmenu"
 | 
			
		||||
 | 
			
		||||
  find_file() {
 | 
			
		||||
    ${pkgs.fd}/bin/fd --strip-cwd-prefix '\.gpg$' |
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,7 @@ in {
 | 
			
		|||
    ./git.nix
 | 
			
		||||
    ./qutebrowser
 | 
			
		||||
    ./gpg.nix
 | 
			
		||||
    ./rofi.nix
 | 
			
		||||
  ];
 | 
			
		||||
  # Home Manager needs a bit of information about you and the
 | 
			
		||||
  # paths it should manage.
 | 
			
		||||
| 
						 | 
				
			
			@ -284,9 +285,7 @@ in {
 | 
			
		|||
        "--preview '${pkgs.bat}/bin/bat --style=numbers --color=always {}'";
 | 
			
		||||
    in "${preview_opts} ${color_opts}";
 | 
			
		||||
  };
 | 
			
		||||
  programs.bash = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
  };
 | 
			
		||||
  programs.bash = { enable = true; };
 | 
			
		||||
  programs.firefox = {
 | 
			
		||||
    enable = true;
 | 
			
		||||
    package = pkgs.firefox;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -56,48 +56,48 @@ map global find 'd' ': find_delete<ret>' -docstring 'file to delete'
 | 
			
		|||
 | 
			
		||||
define-command -override -hidden find_file \
 | 
			
		||||
%{ evaluate-commands %sh{
 | 
			
		||||
    for line in `fd --strip-cwd-prefix -tf -HE .git | bmenu`; do
 | 
			
		||||
    for line in `fd --strip-cwd-prefix -tf -HE .git | rofi -dmenu`; do
 | 
			
		||||
        echo "edit '$line'"
 | 
			
		||||
    done
 | 
			
		||||
} }
 | 
			
		||||
 | 
			
		||||
define-command -override -hidden find_delete \
 | 
			
		||||
%{ nop %sh{
 | 
			
		||||
    fd --strip-cwd-prefix -H -E .git -t f | bmenu | xargs -r trash
 | 
			
		||||
    fd --strip-cwd-prefix -H -E .git -t f | rofi -dmenu | xargs -r trash
 | 
			
		||||
} }
 | 
			
		||||
 | 
			
		||||
define-command -override -hidden find_git_file \
 | 
			
		||||
%{ evaluate-commands %sh{
 | 
			
		||||
    for line in `git ls-files | bmenu`; do
 | 
			
		||||
    for line in `git ls-files | rofi -dmenu`; do
 | 
			
		||||
        echo "edit -existing '$line'"
 | 
			
		||||
    done
 | 
			
		||||
} }
 | 
			
		||||
 | 
			
		||||
define-command -override -hidden find_git_modified \
 | 
			
		||||
%{ evaluate-commands %sh{
 | 
			
		||||
    for line in `git status --porcelain | sd '^.. ' ''| bmenu`; do
 | 
			
		||||
    for line in `git status --porcelain | sd '^.. ' ''| rofi -dmenu`; do
 | 
			
		||||
        echo "edit -existing '$line'"
 | 
			
		||||
    done
 | 
			
		||||
} }
 | 
			
		||||
 | 
			
		||||
define-command -override -hidden find_dir \
 | 
			
		||||
%{ cd %sh{
 | 
			
		||||
    for line in `fd --strip-cwd-prefix -Htd | bmenu`; do
 | 
			
		||||
    for line in `fd --strip-cwd-prefix -Htd | rofi -dmenu`; do
 | 
			
		||||
        echo "edit '$line'"
 | 
			
		||||
    done
 | 
			
		||||
} }
 | 
			
		||||
 | 
			
		||||
define-command -override -hidden find_buffer \
 | 
			
		||||
%{ evaluate-commands %sh{
 | 
			
		||||
    for line in `printf "%s\n" $kak_buflist | bmenu`; do
 | 
			
		||||
    for line in `printf "%s\n" $kak_buflist | rofi -dmenu`; do
 | 
			
		||||
        echo "buffer '$line'"
 | 
			
		||||
    done
 | 
			
		||||
} }
 | 
			
		||||
 | 
			
		||||
define-command -override -hidden find_ripgrep \
 | 
			
		||||
%{ evaluate-commands %sh{
 | 
			
		||||
    patter=$( bmenu -p "Regex")
 | 
			
		||||
    rg --column -n "$patter" | bmenu |
 | 
			
		||||
    patter=$( rofi -dmenu -p "Regex")
 | 
			
		||||
    rg --column -n "$patter" | rofi -dmenu |
 | 
			
		||||
        perl -ne 'print "edit \"$1\" \"$2\" \"$3\" " if /(.+):(\d+):(\d+):/'
 | 
			
		||||
} }
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -108,7 +108,7 @@ define-command -override -hidden find_line \
 | 
			
		|||
            line=$(
 | 
			
		||||
                printf "%s\n" "$kak_reg_a" |
 | 
			
		||||
                nl -ba -w1 |
 | 
			
		||||
                bmenu -p "Line" |
 | 
			
		||||
                rofi -dmenu -p "Line" |
 | 
			
		||||
                cut -f1
 | 
			
		||||
            )
 | 
			
		||||
            test -n "$line" && echo "${line}gx"
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										76
									
								
								user/rofi.nix
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										76
									
								
								user/rofi.nix
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,76 @@
 | 
			
		|||
{ config, pkgs, lib, font, ... }:
 | 
			
		||||
let inherit (import ./variables.nix) key theme color accent font;
 | 
			
		||||
in {
 | 
			
		||||
  config = {
 | 
			
		||||
    programs.rofi = {
 | 
			
		||||
      enable = true;
 | 
			
		||||
      package = pkgs.rofi-wayland.override { plugins = [ pkgs.rofi-emoji ]; };
 | 
			
		||||
      extraConfig = {
 | 
			
		||||
        show-icons = true;
 | 
			
		||||
        modi = "drun,emoji";
 | 
			
		||||
        terminal = "alacritty";
 | 
			
		||||
        display-drun = "Iniciar: ";
 | 
			
		||||
 | 
			
		||||
        kb-primary-paste = "Control+V,Shift+Insert";
 | 
			
		||||
        kb-secondary-paste = "Control+v,Insert";
 | 
			
		||||
      };
 | 
			
		||||
      theme = let
 | 
			
		||||
        # Use `mkLiteral` for string-like values that should show without
 | 
			
		||||
        # quotes, e.g.:
 | 
			
		||||
        # {
 | 
			
		||||
        #   foo = "abc"; => foo: "abc";
 | 
			
		||||
        #   bar = mkLiteral "abc"; => bar: abc;
 | 
			
		||||
        # };
 | 
			
		||||
        inherit (config.lib.formats.rasi) mkLiteral;
 | 
			
		||||
      in {
 | 
			
		||||
        "*" = {
 | 
			
		||||
          # foreground-color = mkLiteral color.txt;
 | 
			
		||||
          text-color = mkLiteral color.txt;
 | 
			
		||||
          # background-color = mkLiteral color.bg;
 | 
			
		||||
          background-color= mkLiteral  "transparent";
 | 
			
		||||
          # width = 512;
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        "#window" = {
 | 
			
		||||
          background-color = mkLiteral "${color.bg}ee";
 | 
			
		||||
          # children = map mkLiteral [ "prompt" "entry" ];
 | 
			
		||||
          border = mkLiteral "2px solid";
 | 
			
		||||
          border-color = mkLiteral accent.color;
 | 
			
		||||
          padding = 0;
 | 
			
		||||
        };
 | 
			
		||||
        "#inputbar" = { margin = mkLiteral "10px"; };
 | 
			
		||||
        "#listview" = {
 | 
			
		||||
          # fixed-height=0;
 | 
			
		||||
          border = mkLiteral "2px solid 0px 0px";
 | 
			
		||||
          border-color = mkLiteral "@separatorcolor";
 | 
			
		||||
          # spacing= 0 ;
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        # "#textbox-prompt-colon" = {
 | 
			
		||||
        #   expand = false;
 | 
			
		||||
        #   str = ":";
 | 
			
		||||
        #   margin = mkLiteral "0px 0.3em 0em 0em";
 | 
			
		||||
        #   text-color = mkLiteral "@foreground-color";
 | 
			
		||||
        # };
 | 
			
		||||
        "#element" = {
 | 
			
		||||
          # text-color = mkLiteral "#252525";
 | 
			
		||||
          background-color= mkLiteral "transparent";
 | 
			
		||||
          padding = mkLiteral "3px 10px";
 | 
			
		||||
        };
 | 
			
		||||
        "#element selected" = {
 | 
			
		||||
          # text-color = mkLiteral "#252525";
 | 
			
		||||
          background-color = mkLiteral accent.color;
 | 
			
		||||
        };
 | 
			
		||||
        element-icon=  {
 | 
			
		||||
            # background-color= inherit;
 | 
			
		||||
            # text-color=       inherit;
 | 
			
		||||
            margin-right = mkLiteral "20px";
 | 
			
		||||
            size = 24;
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
      };
 | 
			
		||||
 | 
			
		||||
    };
 | 
			
		||||
  };
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3,7 +3,7 @@ let
 | 
			
		|||
  inherit (import ./variables.nix) key theme color accent font;
 | 
			
		||||
  pulse_sink = pkgs.writeShellScriptBin "pulse_sink" ''
 | 
			
		||||
    #!/bin/sh
 | 
			
		||||
    output=$(printf "HDMI\nHeadphones" | ${pkgs.bmenu}/bin/bmenu -b)
 | 
			
		||||
    output=$(printf "HDMI\nHeadphones" | rofi -dmenu)
 | 
			
		||||
    vol=$(${pkgs.pamixer}/bin/pamixer --get-volume)
 | 
			
		||||
    case "$output" in
 | 
			
		||||
        HDMI)
 | 
			
		||||
| 
						 | 
				
			
			@ -120,7 +120,7 @@ in {
 | 
			
		|||
        };
 | 
			
		||||
        keybindings = let
 | 
			
		||||
          mod = "Mod4";
 | 
			
		||||
          menu = "${pkgs.bmenu}/bin/bmenu run";
 | 
			
		||||
          menu = "rofi -show drun";
 | 
			
		||||
          terminal = "alacritty";
 | 
			
		||||
 | 
			
		||||
          # Utility funcion
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -63,10 +63,10 @@ in {
 | 
			
		|||
          };
 | 
			
		||||
        };
 | 
			
		||||
        "sway/window" = { max-length = 40; };
 | 
			
		||||
    "tray"= {
 | 
			
		||||
        "spacing"= 7;
 | 
			
		||||
        "icon-size"=19;
 | 
			
		||||
    };
 | 
			
		||||
        "tray" = {
 | 
			
		||||
          "spacing" = 7;
 | 
			
		||||
          "icon-size" = 19;
 | 
			
		||||
        };
 | 
			
		||||
        clock = {
 | 
			
		||||
          interval = 60;
 | 
			
		||||
          format = "<b>{:%H:%M %a %d/%m}</b>";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue