mirror of
https://github.com/basecamp/omarchy.git
synced 2026-02-17 15:25:37 +00:00
Compare commits
5 Commits
revert-458
...
d346f5d522
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d346f5d522 | ||
|
|
f152ff68ea | ||
|
|
01d7296616 | ||
|
|
b573a37e33 | ||
|
|
68b4939993 |
@@ -32,7 +32,6 @@ open_editor() {
|
|||||||
if [[ "$SCREENSHOT_EDITOR" == "satty" ]]; then
|
if [[ "$SCREENSHOT_EDITOR" == "satty" ]]; then
|
||||||
satty --filename "$filepath" \
|
satty --filename "$filepath" \
|
||||||
--output-filename "$filepath" \
|
--output-filename "$filepath" \
|
||||||
--early-exit \
|
|
||||||
--actions-on-enter save-to-clipboard \
|
--actions-on-enter save-to-clipboard \
|
||||||
--save-after-copy \
|
--save-after-copy \
|
||||||
--copy-command 'wl-copy'
|
--copy-command 'wl-copy'
|
||||||
@@ -52,51 +51,54 @@ get_rectangles() {
|
|||||||
|
|
||||||
# Select based on mode
|
# Select based on mode
|
||||||
case "$MODE" in
|
case "$MODE" in
|
||||||
region)
|
region)
|
||||||
wayfreeze & PID=$!
|
wayfreeze &
|
||||||
sleep .1
|
PID=$!
|
||||||
SELECTION=$(slurp 2>/dev/null)
|
sleep .1
|
||||||
kill $PID 2>/dev/null
|
SELECTION=$(slurp 2>/dev/null)
|
||||||
;;
|
kill $PID 2>/dev/null
|
||||||
windows)
|
;;
|
||||||
wayfreeze & PID=$!
|
windows)
|
||||||
sleep .1
|
wayfreeze &
|
||||||
SELECTION=$(get_rectangles | slurp -r 2>/dev/null)
|
PID=$!
|
||||||
kill $PID 2>/dev/null
|
sleep .1
|
||||||
;;
|
SELECTION=$(get_rectangles | slurp -r 2>/dev/null)
|
||||||
fullscreen)
|
kill $PID 2>/dev/null
|
||||||
SELECTION=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | "\(.x),\(.y) \((.width / .scale) | floor)x\((.height / .scale) | floor)"')
|
;;
|
||||||
;;
|
fullscreen)
|
||||||
smart|*)
|
SELECTION=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | "\(.x),\(.y) \((.width / .scale) | floor)x\((.height / .scale) | floor)"')
|
||||||
RECTS=$(get_rectangles)
|
;;
|
||||||
wayfreeze & PID=$!
|
smart | *)
|
||||||
sleep .1
|
RECTS=$(get_rectangles)
|
||||||
SELECTION=$(echo "$RECTS" | slurp 2>/dev/null)
|
wayfreeze &
|
||||||
kill $PID 2>/dev/null
|
PID=$!
|
||||||
|
sleep .1
|
||||||
|
SELECTION=$(echo "$RECTS" | slurp 2>/dev/null)
|
||||||
|
kill $PID 2>/dev/null
|
||||||
|
|
||||||
# If the selection area is L * W < 20, we'll assume you were trying to select whichever
|
# If the selection area is L * W < 20, we'll assume you were trying to select whichever
|
||||||
# window or output it was inside of to prevent accidental 2px snapshots
|
# window or output it was inside of to prevent accidental 2px snapshots
|
||||||
if [[ "$SELECTION" =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+)$ ]]; then
|
if [[ "$SELECTION" =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+)$ ]]; then
|
||||||
if (( ${BASH_REMATCH[3]} * ${BASH_REMATCH[4]} < 20 )); then
|
if ((${BASH_REMATCH[3]} * ${BASH_REMATCH[4]} < 20)); then
|
||||||
click_x="${BASH_REMATCH[1]}"
|
click_x="${BASH_REMATCH[1]}"
|
||||||
click_y="${BASH_REMATCH[2]}"
|
click_y="${BASH_REMATCH[2]}"
|
||||||
|
|
||||||
while IFS= read -r rect; do
|
while IFS= read -r rect; do
|
||||||
if [[ "$rect" =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+) ]]; then
|
if [[ "$rect" =~ ^([0-9]+),([0-9]+)[[:space:]]([0-9]+)x([0-9]+) ]]; then
|
||||||
rect_x="${BASH_REMATCH[1]}"
|
rect_x="${BASH_REMATCH[1]}"
|
||||||
rect_y="${BASH_REMATCH[2]}"
|
rect_y="${BASH_REMATCH[2]}"
|
||||||
rect_width="${BASH_REMATCH[3]}"
|
rect_width="${BASH_REMATCH[3]}"
|
||||||
rect_height="${BASH_REMATCH[4]}"
|
rect_height="${BASH_REMATCH[4]}"
|
||||||
|
|
||||||
if (( click_x >= rect_x && click_x < rect_x+rect_width && click_y >= rect_y && click_y < rect_y+rect_height )); then
|
if ((click_x >= rect_x && click_x < rect_x + rect_width && click_y >= rect_y && click_y < rect_y + rect_height)); then
|
||||||
SELECTION="${rect_x},${rect_y} ${rect_width}x${rect_height}"
|
SELECTION="${rect_x},${rect_y} ${rect_width}x${rect_height}"
|
||||||
break
|
break
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
done <<< "$RECTS"
|
fi
|
||||||
fi
|
done <<<"$RECTS"
|
||||||
fi
|
fi
|
||||||
;;
|
fi
|
||||||
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
[[ -z $SELECTION ]] && exit 0
|
[[ -z $SELECTION ]] && exit 0
|
||||||
@@ -106,10 +108,10 @@ FILEPATH="$OUTPUT_DIR/$FILENAME"
|
|||||||
|
|
||||||
if [[ $PROCESSING == "slurp" ]]; then
|
if [[ $PROCESSING == "slurp" ]]; then
|
||||||
grim -g "$SELECTION" "$FILEPATH" || exit 1
|
grim -g "$SELECTION" "$FILEPATH" || exit 1
|
||||||
wl-copy < "$FILEPATH"
|
wl-copy <"$FILEPATH"
|
||||||
|
|
||||||
(
|
(
|
||||||
ACTION=$(notify-send "Screenshot copied & saved" "Click to edit" -t 10000 -i "$FILEPATH" -A "default=edit")
|
ACTION=$(notify-send "Screenshot saved to clipboard and file" "Edit with Super + Alt + , (or click this)" -t 10000 -i "$FILEPATH" -A "default=edit")
|
||||||
[[ "$ACTION" == "default" ]] && open_editor "$FILEPATH"
|
[[ "$ACTION" == "default" ]] && open_editor "$FILEPATH"
|
||||||
) &
|
) &
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ fzf_args=(
|
|||||||
pkg_names=$(yay -Slqa | fzf "${fzf_args[@]}")
|
pkg_names=$(yay -Slqa | fzf "${fzf_args[@]}")
|
||||||
|
|
||||||
if [[ -n "$pkg_names" ]]; then
|
if [[ -n "$pkg_names" ]]; then
|
||||||
# Convert newline-separated selections to space-separated for yay
|
# Add aur/ prefix to each package name and convert to space-separated for yay
|
||||||
echo "$pkg_names" | tr '\n' ' ' | xargs yay -S -a --noconfirm
|
echo "$pkg_names" | sed 's/^/aur\//' | tr '\n' ' ' | xargs yay -S --noconfirm
|
||||||
sudo updatedb
|
sudo updatedb
|
||||||
omarchy-show-done
|
omarchy-show-done
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user