greenhouse

kore

my public infrastructure monorepo

git clone [email protected]:kore.git

fix(home/feats): screenshot, volume and vesktop edge cases

commitc7dea5dc86cfba80d8ac98febf0b9be55a9fa43a
parent4dfd04ecae86b1eb739e5494e1e292008362b7e4
authorlostduk <[email protected]>
date2026-10-16 01:22 +0700
home/features/misc/vesktop.nix14++++++++++++--
home/features/wayland/dwl.nix26+++++++++++++++++---------

2 files changed, -11/+29

home/features/misc/vesktop.nix

@@ -10,9 +10,16 @@ let    jail = pkgs.writeShellApplication {     name = "vesktop";-    runtimeInputs = with pkgs; [ bubblewrap xdg-dbus-proxy coreutils ];+    runtimeInputs = with pkgs; [ bubblewrap xdg-dbus-proxy coreutils util-linux ];     text = ''       run="$XDG_RUNTIME_DIR"++      exec 9> "$run/vesktop.lock"+      if ! flock -n 9; then+        echo "vesktop is already running" >&2+        exit 0+      fi+       bus="$(mktemp -u "$run/vesktop-bus.XXXXXX")"        xdg-dbus-proxy "$DBUS_SESSION_BUS_ADDRESS" "$bus" --filter \@@ -20,7 +27,10 @@ let         --talk=org.freedesktop.Notifications &       proxy=$!       trap 'kill "$proxy" 2>/dev/null; rm -f "$bus"' EXIT-      while [ ! -S "$bus" ]; do sleep 0.05; done+      while [ ! -S "$bus" ]; do+        kill -0 "$proxy" 2>/dev/null || { echo "vesktop: xdg-dbus-proxy failed" >&2; exit 1; }+        sleep 0.05+      done        mkdir -p "${configDir}" "${downloads}" 

home/features/wayland/dwl.nix

@@ -6,15 +6,21 @@ let     runtimeInputs = with pkgs; [ grim slurp wl-clipboard coreutils ];     text = ''       case "''${1:-area}" in-        area) grim -g "$(slurp)" - | wl-copy -t image/png ;;-        output) grim -g "$(slurp -o)" - | wl-copy -t image/png ;;-        save)-          dir="${config.xdg.userDirs.pictures}/screenshots"-          mkdir -p "$dir"-          grim -g "$(slurp)" "$dir/$(date +%Y-%m-%d_%H-%M-%S).png"-          ;;+        area|save) geometry="$(slurp)" || exit 0 ;;+        output) geometry="$(slurp -o)" || exit 0 ;;         *) echo "usage: screenshot [area|output|save]" >&2; exit 1 ;;       esac++      if [ "''${1:-area}" = save ]; then+        dir="${config.xdg.userDirs.pictures}/screenshots"+        mkdir -p "$dir"+        grim -g "$geometry" "$dir/$(date +%Y-%m-%d_%H-%M-%S).png"+      else+        shot="$(mktemp)"+        trap 'rm -f "$shot"' EXIT+        grim -g "$geometry" "$shot"+        wl-copy -t image/png < "$shot"+      fi     '';   }; @@ -48,8 +54,10 @@ let       fi        idfile="''${XDG_RUNTIME_DIR:-/tmp}/volume-notify-id"-      id="$(cat "$idfile" 2>/dev/null || echo 0)"-      notify-send -p -r "$id" -c volume -h "int:value:$pct" "$title" > "$idfile"+      id="$(cat "$idfile" 2>/dev/null || true)"+      [[ "$id" =~ ^[0-9]+$ ]] || id=0+      id="$(notify-send -p -r "$id" -c volume -h "int:value:$pct" "$title")"+      printf '%s\n' "$id" > "$idfile"     '';   }; in {