From c4fa167aaafb80d28c3b25a95bcf3a8ba336e788 Mon Sep 17 00:00:00 2001 From: reidlab Date: Thu, 2 Jan 2025 16:19:49 -0600 Subject: [PATCH] oh hey thats nice --- modules/desktop/hyprland.nix | 8 +++++++- modules/desktop/swww.nix | 4 ++++ modules/desktop/waybar.nix | 4 ++++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/modules/desktop/hyprland.nix b/modules/desktop/hyprland.nix index d7cde8a..c4d4b6d 100644 --- a/modules/desktop/hyprland.nix +++ b/modules/desktop/hyprland.nix @@ -92,6 +92,8 @@ in { ]; bind = let screenshotScript = pkgs.writeShellScript "screenshot" '' + set -euo pipefail + temp_file=$(mktemp) trap 'rm -f "$temp_file"' EXIT @@ -112,7 +114,7 @@ in { ;; esac - ${lib.getExe pkgs.grimblast} --freeze save "$mode" - > "$temp_file" || exit 0 # exit successful, highly unlikely that grimblast failed, and it is more likely that the user cancelled the screenshot + ${lib.getExe pkgs.grimblast} --freeze save "$mode" - > "$temp_file" cat "$temp_file" | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t image/png @@ -130,6 +132,8 @@ in { esac ''; pickerScript = pkgs.writeShellScript "picker" '' + set -euo pipefail + ${lib.getExe pkgs.hyprpicker} --render-inactive --format hex | sed -z 's/\n//g' | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t text/plain ${pkgs.libnotify}/bin/notify-send "Color Captured" \ @@ -138,6 +142,8 @@ in { "Color copied to clipboard" ''; ocrScript = pkgs.writeShellScript "ocr" '' + set -euo pipefail + output=$(${lib.getExe pkgs.grimblast} --freeze save area - | ${lib.getExe pkgs.tesseract5} - -) echo "$output" | ${lib.getExe pkgs.wl-clipboard-x11} -selection clipboard -t text/plain diff --git a/modules/desktop/swww.nix b/modules/desktop/swww.nix index b2426ba..d864570 100644 --- a/modules/desktop/swww.nix +++ b/modules/desktop/swww.nix @@ -17,6 +17,8 @@ in { setScript = mkOption { type = types.package; default = pkgs.writeShellScript "swww-set" '' + set -euo pipefail + if [ ! -f "${lastWallpaper}" ]; then echo "$(ls ${wallpapersFolder} | shuf -n 1)" > "${lastWallpaper}" fi @@ -27,6 +29,8 @@ in { swapScript = mkOption { type = types.package; default = pkgs.writeShellScript "swww-swap" '' + set -euo pipefail + file=$(ls ${wallpapersFolder} | ${lib.getExe config.modules.desktop.rofi.package} -dmenu -sep '\n' -i -p "select a wallpaper") wallpaper="${wallpapersFolder}/$file" diff --git a/modules/desktop/waybar.nix b/modules/desktop/waybar.nix index 0eabe20..88f0c3d 100644 --- a/modules/desktop/waybar.nix +++ b/modules/desktop/waybar.nix @@ -76,6 +76,8 @@ in { }; "custom/power" = let powerMenuScript = pkgs.writeShellScript "power-menu" '' + set -euo pipefail + cmd=$(echo '⏻ shutdown|↻ reboot| lock|⎋ exit desktop environment' | ${lib.getExe pkgs.rofi-wayland} -dmenu -sep '|' -i -p 'what to do ?' -theme-str 'window { height: 132px; }') case "$cmd" in "⏻ shutdown") @@ -263,6 +265,8 @@ in { # https://github.com/chubin/wttr.in/issues/795 # i was NOT going to let ip-based location be a thing. i was suprisingly medicated when i wrote this locationScript = pkgs.writeShellScript "location" '' + set -euo pipefail + lon="" lat=""