switch to rofi

This commit is contained in:
Leonardo Eugênio 2022-08-12 23:35:42 -03:00
parent 0b04d298ac
commit f7d596a488
6 changed files with 95 additions and 19 deletions

View file

@ -3,7 +3,8 @@ pkgs.writeShellScriptBin "wpass" ''
set -xe set -xe
wtype=${pkgs.wtype}/bin/wtype wtype=${pkgs.wtype}/bin/wtype
dmenu=${pkgs.bmenu}/bin/bmenu # dmenu=${pkgs.bmenu}/bin/bmenu
dmenu="rofi -dmenu"
find_file() { find_file() {
${pkgs.fd}/bin/fd --strip-cwd-prefix '\.gpg$' | ${pkgs.fd}/bin/fd --strip-cwd-prefix '\.gpg$' |

View file

@ -18,6 +18,7 @@ in {
./git.nix ./git.nix
./qutebrowser ./qutebrowser
./gpg.nix ./gpg.nix
./rofi.nix
]; ];
# Home Manager needs a bit of information about you and the # Home Manager needs a bit of information about you and the
# paths it should manage. # paths it should manage.
@ -284,9 +285,7 @@ in {
"--preview '${pkgs.bat}/bin/bat --style=numbers --color=always {}'"; "--preview '${pkgs.bat}/bin/bat --style=numbers --color=always {}'";
in "${preview_opts} ${color_opts}"; in "${preview_opts} ${color_opts}";
}; };
programs.bash = { programs.bash = { enable = true; };
enable = true;
};
programs.firefox = { programs.firefox = {
enable = true; enable = true;
package = pkgs.firefox; package = pkgs.firefox;

View file

@ -56,48 +56,48 @@ map global find 'd' ': find_delete<ret>' -docstring 'file to delete'
define-command -override -hidden find_file \ define-command -override -hidden find_file \
%{ evaluate-commands %sh{ %{ 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'" echo "edit '$line'"
done done
} } } }
define-command -override -hidden find_delete \ define-command -override -hidden find_delete \
%{ nop %sh{ %{ 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 \ define-command -override -hidden find_git_file \
%{ evaluate-commands %sh{ %{ evaluate-commands %sh{
for line in `git ls-files | bmenu`; do for line in `git ls-files | rofi -dmenu`; do
echo "edit -existing '$line'" echo "edit -existing '$line'"
done done
} } } }
define-command -override -hidden find_git_modified \ define-command -override -hidden find_git_modified \
%{ evaluate-commands %sh{ %{ 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'" echo "edit -existing '$line'"
done done
} } } }
define-command -override -hidden find_dir \ define-command -override -hidden find_dir \
%{ cd %sh{ %{ 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'" echo "edit '$line'"
done done
} } } }
define-command -override -hidden find_buffer \ define-command -override -hidden find_buffer \
%{ evaluate-commands %sh{ %{ 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'" echo "buffer '$line'"
done done
} } } }
define-command -override -hidden find_ripgrep \ define-command -override -hidden find_ripgrep \
%{ evaluate-commands %sh{ %{ evaluate-commands %sh{
patter=$( bmenu -p "Regex") patter=$( rofi -dmenu -p "Regex")
rg --column -n "$patter" | bmenu | rg --column -n "$patter" | rofi -dmenu |
perl -ne 'print "edit \"$1\" \"$2\" \"$3\" " if /(.+):(\d+):(\d+):/' perl -ne 'print "edit \"$1\" \"$2\" \"$3\" " if /(.+):(\d+):(\d+):/'
} } } }
@ -108,7 +108,7 @@ define-command -override -hidden find_line \
line=$( line=$(
printf "%s\n" "$kak_reg_a" | printf "%s\n" "$kak_reg_a" |
nl -ba -w1 | nl -ba -w1 |
bmenu -p "Line" | rofi -dmenu -p "Line" |
cut -f1 cut -f1
) )
test -n "$line" && echo "${line}gx" test -n "$line" && echo "${line}gx"

76
user/rofi.nix Normal file
View 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;
};
};
};
};
}

View file

@ -3,7 +3,7 @@ let
inherit (import ./variables.nix) key theme color accent font; inherit (import ./variables.nix) key theme color accent font;
pulse_sink = pkgs.writeShellScriptBin "pulse_sink" '' pulse_sink = pkgs.writeShellScriptBin "pulse_sink" ''
#!/bin/sh #!/bin/sh
output=$(printf "HDMI\nHeadphones" | ${pkgs.bmenu}/bin/bmenu -b) output=$(printf "HDMI\nHeadphones" | rofi -dmenu)
vol=$(${pkgs.pamixer}/bin/pamixer --get-volume) vol=$(${pkgs.pamixer}/bin/pamixer --get-volume)
case "$output" in case "$output" in
HDMI) HDMI)
@ -120,7 +120,7 @@ in {
}; };
keybindings = let keybindings = let
mod = "Mod4"; mod = "Mod4";
menu = "${pkgs.bmenu}/bin/bmenu run"; menu = "rofi -show drun";
terminal = "alacritty"; terminal = "alacritty";
# Utility funcion # Utility funcion

View file

@ -63,10 +63,10 @@ in {
}; };
}; };
"sway/window" = { max-length = 40; }; "sway/window" = { max-length = 40; };
"tray"= { "tray" = {
"spacing"= 7; "spacing" = 7;
"icon-size"=19; "icon-size" = 19;
}; };
clock = { clock = {
interval = 60; interval = 60;
format = "<b>{:%H:%M %a %d/%m}</b>"; format = "<b>{:%H:%M %a %d/%m}</b>";