From 66e198e7e59e25e8cc45f391fec19e2babbe72f4 Mon Sep 17 00:00:00 2001 From: Ahwx Date: Mon, 14 Oct 2024 08:23:02 +0200 Subject: [PATCH] feat: move to "self-written shell script packages" --- modules/home/scripts/scripts.nix | 4 +++- modules/home/scripts/scripts/grabtext.sh | 3 +++ modules/home/scripts/scripts/notes.sh | 10 +++++----- 3 files changed, 11 insertions(+), 6 deletions(-) create mode 100644 modules/home/scripts/scripts/grabtext.sh diff --git a/modules/home/scripts/scripts.nix b/modules/home/scripts/scripts.nix index 48332df..230af59 100644 --- a/modules/home/scripts/scripts.nix +++ b/modules/home/scripts/scripts.nix @@ -3,7 +3,8 @@ wallpaper-picker = pkgs.writeShellScriptBin "wallpaper-picker" (builtins.readFile ./scripts/wallpaper-picker.sh); runbg = pkgs.writeShellScriptBin "runbg" (builtins.readFile ./scripts/runbg.sh); - notes = pkgs.writeShellScriptBin "runbg" (builtins.readFile ./scripts/runbg.sh); + notes = pkgs.writeShellScriptBin "notes" (builtins.readFile ./scripts/notes.sh); + grabtext = pkgs.writeShellScriptBin "grabtext" (builtins.readFile ./scripts/grabtext.sh); toggle_blur = pkgs.writeScriptBin "toggle_blur" (builtins.readFile ./scripts/toggle_blur.sh); toggle_oppacity = pkgs.writeScriptBin "toggle_oppacity" (builtins.readFile ./scripts/toggle_oppacity.sh); @@ -20,6 +21,7 @@ in { runbg notes + grabtext ascii diff --git a/modules/home/scripts/scripts/grabtext.sh b/modules/home/scripts/scripts/grabtext.sh new file mode 100644 index 0000000..979a7f1 --- /dev/null +++ b/modules/home/scripts/scripts/grabtext.sh @@ -0,0 +1,3 @@ +#!/usr/bin/env bash + +slurp | xargs -I {} grim -s 2 -t png -g {} - | tesseract - - | wl-copy -n diff --git a/modules/home/scripts/scripts/notes.sh b/modules/home/scripts/scripts/notes.sh index c21e788..d7fadc5 100644 --- a/modules/home/scripts/scripts/notes.sh +++ b/modules/home/scripts/scripts/notes.sh @@ -3,16 +3,16 @@ # MIT license # Ahwx https://ahwx.org - 2024 # -# Dependencies: find/grep/tofi/ping/git/ +# Dependencies: find/grep/bemenu/ping/git/ NOTEDIR="$HOME/Notes" -CHOSEN=$(find "$HOME/Notes" -follow | grep -E '.md$' | tofi) +CHOSEN=$(find "$HOME/Notes" -follow | grep -E '.md$' | bemenu -l 10) cd "$NOTEDIR" || mkdir -p "$NOTEDIR" && cd "$NOTEDIR" || echo 'Error with moving into directory, is "$NOTEDIR" set?' # Change dir to notes dir, if it doesn't exist, create it and try again. Otherwise it should just die, I guess? -notify-send "Trying to connect to internet and pull changes from Git" +echo "Check if connected to internet and pull changes from Git" ping -c1 github.com >/dev/null && notify-send "$(git pull)" # Pull most recent changes, be sure to not create conficts... -foot -e nix run "$HOME/Development/nixvim" -- "$CHOSEN" # Finally open chosen note +kitty -e nvim "$CHOSEN" # Finally open chosen note -git add "$CHOSEN" && git commit -m "chore: updates (auto)" && git push && notify-send "Done" +git add "$CHOSEN" && git commit -m "chore: updates (auto)" && git push && notify-send "Changes pushed"