enable fzf

This commit is contained in:
Leonardo Eugênio 2022-08-09 09:23:07 -03:00
parent 1ad8e22a0b
commit 0c67a2e212
3 changed files with 58 additions and 45 deletions

View file

@ -1,47 +1,47 @@
{ config, pkgs, lib, ... }: { config, pkgs, lib, ... }:
pkgs.writeShellScriptBin "screenshotsh" '' pkgs.writeShellScriptBin "screenshotsh" ''
export XCURSOR_SIZE=40 export XCURSOR_SIZE=40
export XCURSOR_THEME='capitaine-cursors-light' # ${pkgs.capitaine-cursors} export XCURSOR_THEME='capitaine-cursors-light' # ${pkgs.capitaine-cursors}
if which xdg-user-dir >/dev/null 2>&1; then if which xdg-user-dir >/dev/null 2>&1; then
DESTFOLDER="$(${pkgs.capitaine-cursors}/bin/xdg-user-dir PICTURES)" DESTFOLDER="$(${pkgs.capitaine-cursors}/bin/xdg-user-dir PICTURES)"
else else
for i in Images Imagens Pictures Fotos ""; do for i in Images Imagens Pictures Fotos ""; do
DESTFOLDER="$HOME/$i" DESTFOLDER="$HOME/$i"
test -d "$DESTFOLDER" && test -d "$DESTFOLDER" &&
break break
done done
fi fi
DESTFOLDER="$DESTFOLDER/Screenshots" DESTFOLDER="$DESTFOLDER/Screenshots"
mkdir -p "$DESTFOLDER" mkdir -p "$DESTFOLDER"
DESTFILE="$DESTFOLDER/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')" DESTFILE="$DESTFOLDER/$(date +'%Y-%m-%d-%H%M%S_screenshot.png')"
case $1 in case $1 in
def) def)
# Screenshot to file # Screenshot to file
${pkgs.grim}/bin/grim "$DESTFILE" ${pkgs.grim}/bin/grim "$DESTFILE"
echo "$DESTFILE" echo "$DESTFILE"
;; ;;
area) area)
# Screen area to file # Screen area to file
${pkgs.grim}/bin/grim -g "$(slurp -d -b 30303088)" "$DESTFILE" ${pkgs.grim}/bin/grim -g "$(slurp -d -b 30303088)" "$DESTFILE"
echo "$DESTFILE" echo "$DESTFILE"
;; ;;
area-clip) area-clip)
# Screen area to clipboard # Screen area to clipboard
${pkgs.grim}/bin/grim -g "$(slurp -d -b 30303088)" - | ${pkgs.wl-clipboard}/bin/wl-copy ${pkgs.grim}/bin/grim -g "$(slurp -d -b 30303088)" - | ${pkgs.wl-clipboard}/bin/wl-copy
;; ;;
clip) clip)
# Focused monitor to clipboard # Focused monitor to clipboard
cur_output=$(${pkgs.sway}/bin/swaymsg -t get_outputs | cur_output=$(${pkgs.sway}/bin/swaymsg -t get_outputs |
${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .name') ${pkgs.jq}/bin/jq -r '.[] | select(.focused) | .name')
test -n "$cur_output" && test -n "$cur_output" &&
${pkgs.grim}/bin/grim -o "$cur_output" - | ${pkgs.wl-clipboard}/bin/wl-copy || ${pkgs.grim}/bin/grim -o "$cur_output" - | ${pkgs.wl-clipboard}/bin/wl-copy ||
${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy
;; ;;
esac esac
'' ''

View file

@ -18,9 +18,7 @@
PartOf = [ "graphical-session.target" ]; PartOf = [ "graphical-session.target" ];
After = [ "graphical-session.target" ]; After = [ "graphical-session.target" ];
}; };
Service = { Service = { ExecStart = "${pkgs._gpg-unlock}/bin/_gpg-unlock"; };
ExecStart = "${pkgs._gpg-unlock}/bin/_gpg-unlock";
};
}; };
}; };
systemd.user.timers = { systemd.user.timers = {

View file

@ -97,6 +97,7 @@ in {
interactiveShellInit = '' interactiveShellInit = ''
set -g __accent_color "${accent.color}" set -g __accent_color "${accent.color}"
alias _fish_prompt_accent "_fish_prompt_color '$__accent_color'" alias _fish_prompt_accent "_fish_prompt_color '$__accent_color'"
fzf_key_bindings
''; '';
shellAbbrs = { shellAbbrs = {
v = "kak"; v = "kak";
@ -122,11 +123,9 @@ in {
}; };
functions = { fish_greeting = ""; }; functions = { fish_greeting = ""; };
}; };
programs.zoxide = { programs.zoxide.enable = true;
enable = true;
enableFishIntegration = true;
};
programs.direnv.enable = true; programs.direnv.enable = true;
programs.fzf.enable = true;
home.file = { home.file = {
".config/fish/conf.d/prompt.fish".source = ./fish_prompt.fish; ".config/fish/conf.d/prompt.fish".source = ./fish_prompt.fish;
".local/share/backgrounds".source = ./backgrounds; ".local/share/backgrounds".source = ./backgrounds;
@ -265,6 +264,22 @@ in {
home.sessionVariables = { home.sessionVariables = {
VOLUME_CHANGE_SOUND = VOLUME_CHANGE_SOUND =
"${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/audio-volume-change.oga"; "${pkgs.sound-theme-freedesktop}/share/sounds/freedesktop/stereo/audio-volume-change.oga";
FZF_DEFAULT_OPTS = let
colors = {
"bg+" = color.bg_light;
"hl+" = color.normal.green;
gutter = color.bg;
prompt = accent.color;
pointer = accent.color;
spinner = accent.color;
};
makeKeyValue = (k: v: "${k}:${v}");
makeOptList = lib.mapAttrsToList makeKeyValue colors;
makeColorValue = lib.strings.concatStringsSep "," makeOptList;
color_opts = "--color=${makeColorValue}";
preview_opts =
"--preview '${pkgs.bat}/bin/bat --style=numbers --color=always {}'";
in "${preview_opts} ${color_opts}";
}; };
programs.firefox = { programs.firefox = {
enable = true; enable = true;