From f7d596a4882531248cc2903eb57f080eb285a05f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leonardo=20Eug=C3=AAnio?= Date: Fri, 12 Aug 2022 23:35:42 -0300 Subject: [PATCH] switch to rofi --- scripts/wpass.nix | 3 +- user/home.nix | 5 ++- user/kak/usermode.kak | 18 +++++----- user/rofi.nix | 76 +++++++++++++++++++++++++++++++++++++++++++ user/sway.nix | 4 +-- user/waybar.nix | 8 ++--- 6 files changed, 95 insertions(+), 19 deletions(-) create mode 100644 user/rofi.nix diff --git a/scripts/wpass.nix b/scripts/wpass.nix index 6263095..7589886 100644 --- a/scripts/wpass.nix +++ b/scripts/wpass.nix @@ -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$' | diff --git a/user/home.nix b/user/home.nix index 75d8e68..8b118f4 100644 --- a/user/home.nix +++ b/user/home.nix @@ -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; diff --git a/user/kak/usermode.kak b/user/kak/usermode.kak index 154e82e..785e387 100644 --- a/user/kak/usermode.kak +++ b/user/kak/usermode.kak @@ -56,48 +56,48 @@ map global find 'd' ': find_delete' -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" diff --git a/user/rofi.nix b/user/rofi.nix new file mode 100644 index 0000000..495ac55 --- /dev/null +++ b/user/rofi.nix @@ -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; + }; + + + }; + + }; + }; +} diff --git a/user/sway.nix b/user/sway.nix index 0a11c01..9713577 100644 --- a/user/sway.nix +++ b/user/sway.nix @@ -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 diff --git a/user/waybar.nix b/user/waybar.nix index 87bfaaa..013efca 100644 --- a/user/waybar.nix +++ b/user/waybar.nix @@ -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 = "{:%H:%M %a %d/%m}";