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

View file

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

View file

@ -97,6 +97,7 @@ in {
interactiveShellInit = ''
set -g __accent_color "${accent.color}"
alias _fish_prompt_accent "_fish_prompt_color '$__accent_color'"
fzf_key_bindings
'';
shellAbbrs = {
v = "kak";
@ -122,11 +123,9 @@ in {
};
functions = { fish_greeting = ""; };
};
programs.zoxide = {
enable = true;
enableFishIntegration = true;
};
programs.zoxide.enable = true;
programs.direnv.enable = true;
programs.fzf.enable = true;
home.file = {
".config/fish/conf.d/prompt.fish".source = ./fish_prompt.fish;
".local/share/backgrounds".source = ./backgrounds;
@ -265,6 +264,22 @@ in {
home.sessionVariables = {
VOLUME_CHANGE_SOUND =
"${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 = {
enable = true;