extract dmenu and launcher

This commit is contained in:
Leonardo Eugênio 2022-08-19 20:40:39 -03:00
parent 270deeab42
commit 6d3d7e5d44
10 changed files with 59 additions and 29 deletions

View file

@ -1,11 +1,15 @@
{ config, lib, ... }:
(pkgs: _: {
bmenu = import ./bmenu.nix { inherit config pkgs lib; };
_diffr = import ./diffr.nix { inherit config pkgs lib; };
kak-pager = import ./kak-pager.nix { inherit config pkgs lib; };
terminal = import ./terminal.nix { inherit config pkgs lib; };
wpass = import ./wpass.nix { inherit config pkgs lib; };
screenshotsh = import ./screenshotsh.nix { inherit config pkgs lib; };
_gpg-unlock = import ./_gpg-unlock.nix { inherit config pkgs lib; };
br = import ./br.nix { inherit config pkgs lib; };
})
(pkgs: _:
let import_script = (_: path: import (path) { inherit config pkgs lib; });
in lib.mapAttrs import_script {
wdmenu = ./wdmenu.nix;
wlauncher = ./wlauncher.nix;
bmenu = ./bmenu.nix;
_diffr = ./diffr.nix;
kak-pager = ./kak-pager.nix;
terminal = ./terminal.nix;
wpass = ./wpass.nix;
screenshotsh = ./screenshotsh.nix;
_gpg-unlock = ./_gpg-unlock.nix;
br = ./br.nix;
})

11
scripts/wdmenu.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs, lib, ... }:
let
inherit (pkgs.uservars) dmenu;
available_menus = {
bmenu = "bmenu";
rofi = "rofi -dmenu";
};
menu_cmd = available_menus.${dmenu};
in pkgs.writeShellScriptBin "wdmenu" ''
exec ${menu_cmd} "$@"
''

11
scripts/wlauncher.nix Normal file
View file

@ -0,0 +1,11 @@
{ config, pkgs, lib, ... }:
let
inherit (pkgs.uservars) dmenu;
available_menus = {
bmenu = "bmenu run";
rofi = "rofi -show drun";
};
menu_cmd = available_menus.${dmenu};
in pkgs.writeShellScriptBin "wlauncher" ''
exec ${menu_cmd} "$@"
''

View file

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

View file

@ -53,6 +53,8 @@ in {
pass
dhist
bmenu
wdmenu
wlauncher
volumesh
pamixer
libnotify

View file

@ -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 | rofi -dmenu -i -p "File: "`; do
for line in `fd --strip-cwd-prefix -tf -HE .git | wdmenu -i -p "File: "`; do
echo "edit '$line'"
done
} }
define-command -override -hidden find_delete \
%{ nop %sh{
fd --strip-cwd-prefix -H -E .git -t f | rofi -dmenu -i | xargs -r trash
fd --strip-cwd-prefix -H -E .git -t f | wdmenu -i | xargs -r trash
} }
define-command -override -hidden find_git_file \
%{ evaluate-commands %sh{
for line in `git ls-files | rofi -dmenu -i`; do
for line in `git ls-files | wdmenu -i`; do
echo "edit -existing '$line'"
done
} }
define-command -override -hidden find_git_modified \
%{ evaluate-commands %sh{
for line in `git status --porcelain | sd '^.. ' ''| rofi -dmenu -i`; do
for line in `git status --porcelain | sd '^.. ' ''| wdmenu -i`; do
echo "edit -existing '$line'"
done
} }
define-command -override -hidden find_dir \
%{ cd %sh{
for line in `fd --strip-cwd-prefix -Htd | rofi -dmenu -i`; do
for line in `fd --strip-cwd-prefix -Htd | wdmenu -i`; do
echo "edit '$line'"
done
} }
define-command -override -hidden find_buffer \
%{ evaluate-commands %sh{
for line in `printf "%s\n" $kak_buflist | rofi -dmenu -i`; do
for line in `printf "%s\n" $kak_buflist | wdmenu -i`; do
echo "buffer '$line'"
done
} }
define-command -override -hidden find_ripgrep \
%{ evaluate-commands %sh{
patter=$( rofi -dmenu -i -p "Regex")
rg --column -n "$patter" | rofi -dmenu -i |
patter=$( wdmenu -i -p "Regex")
rg --column -n "$patter" | wdmenu -i |
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 |
rofi -dmenu -i -p "Line" |
wdmenu -i -p "Line" |
cut -f1
)
test -n "$line" && echo "${line}gx"

View file

@ -1,5 +1,4 @@
{ config, pkgs, lib, ... }:
{
{ config, pkgs, lib, ... }: {
# RNNoise is a noise supperssion neural network
# Here we use it as a plugin for pipewire to create a virtual microphone
config = {

View file

@ -32,7 +32,8 @@ in {
};
"#window" = {
background-color = mkLiteral "${color.bg}${lib.toHexString (theme.opacity * 255 / 100)}";
background-color = mkLiteral
"${color.bg}${lib.toHexString (theme.opacity * 255 / 100)}";
# children = map mkLiteral [ "prompt" "entry" ];
border = mkLiteral "2px solid";
border-color = mkLiteral accent.color;

View file

@ -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" | rofi -dmenu -i -p "Output:")
output=$(printf "HDMI\nHeadphones" | wdmenu -i -p "Output:")
vol=$(${pkgs.pamixer}/bin/pamixer --get-volume)
case "$output" in
HDMI)
@ -34,7 +34,7 @@ in {
config = {
wayland.windowManager.sway = let
mod = "Mod4";
menu = "rofi -show drun";
menu = "wlauncher";
terminal = "alacritty";
# Utility funcion
@ -52,8 +52,7 @@ in {
# ${i} = v;
# })
# Ouput: {val1 = 1; val2 = 2;}
iforEach0mergeAttrsSet = list: func:
mergeAttrsSet (iforEach0 list func);
iforEach0mergeAttrsSet = list: func: mergeAttrsSet (iforEach0 list func);
in {
enable = true;
config = {
@ -279,7 +278,8 @@ in {
"${mod}+Ctrl+Return" = "exec thunar";
"${mod}+x" = "kill";
"${mod}+m" = "mode audio";
"${mod}+escape" = "mode passthrough;exec notify-send 'Passthrough on'";
"${mod}+escape" =
"mode passthrough;exec notify-send 'Passthrough on'";
"${mod}+f" = "fullscreen toggle";
"${mod}+Shift+space" = "floating toggle";
"${mod}+space" = "focus mode_toggle";

View file

@ -90,4 +90,6 @@ in rec {
host = "cloud.disroot.org";
pass = "disroot.org";
};
dmenu = "bmenu";
}