diff --git a/dotfiles/mango/.config/mango/bindings/keyboard.conf b/dotfiles/mango/.config/mango/bindings/keyboard.conf index cfede3a..a5461f6 100644 --- a/dotfiles/mango/.config/mango/bindings/keyboard.conf +++ b/dotfiles/mango/.config/mango/bindings/keyboard.conf @@ -10,6 +10,9 @@ bind=ALT+SHIFT,r,reload_config bind=Alt,space,spawn,fuzzel bind=Alt,Return,spawn,ghostty +# screenshot +bind=NONE,Print,spawn,$HOME/.config/mango/scripts/screenshot/fullscreen.sh +bind=NONE,XF86SelectiveScreenshot,spawn,$HOME/.config/mango/scripts/screenshot/region.sh # exit bind=SUPER,m,quit bind=ALT,q,killclient, diff --git a/dotfiles/mango/.config/mango/look/blur.conf b/dotfiles/mango/.config/mango/look/blur.conf index 85d8c72..4609c66 100644 --- a/dotfiles/mango/.config/mango/look/blur.conf +++ b/dotfiles/mango/.config/mango/look/blur.conf @@ -9,7 +9,7 @@ blur_layer=1 i# Caches the wallpaper and blur background, significantly reducing GPU usage. # Disabling it will significantly increase GPU consumption and may cause rendering lag. # Highly recommended. -blur_optimized=1 +blur_optimized=0 # The strength (radius) of the blur. blur_params_radius=10 diff --git a/dotfiles/mango/.config/mango/rules/layer.conf b/dotfiles/mango/.config/mango/rules/layer.conf index 90def3d..9f7b36f 100644 --- a/dotfiles/mango/.config/mango/rules/layer.conf +++ b/dotfiles/mango/.config/mango/rules/layer.conf @@ -1,4 +1,4 @@ # https://mangowm.github.io/docs/window-management/rules#layer-rules -layerrule=animation_type_open:zoom,layer_name:rofi -layerrule=animation_type_close:zoom,layer_name:rofi +# No blur or animation for slurp selection layer (avoids occlusion and ghosting in screenshots) +layerrule=noanim:1,noblur:1,layer_name:selection diff --git a/dotfiles/mango/.config/mango/rules/window.conf b/dotfiles/mango/.config/mango/rules/window.conf index 76d7fdc..4777711 100644 --- a/dotfiles/mango/.config/mango/rules/window.conf +++ b/dotfiles/mango/.config/mango/rules/window.conf @@ -1 +1,4 @@ # https://mangowm.github.io/docs/window-management/rules#window-rules + +windowrule=noblur:1,appid:slurp +windowrule=isfloating:1,appid:satty diff --git a/dotfiles/mango/.config/mango/scripts/screenshot/common.sh b/dotfiles/mango/.config/mango/scripts/screenshot/common.sh new file mode 100755 index 0000000..3f383fc --- /dev/null +++ b/dotfiles/mango/.config/mango/scripts/screenshot/common.sh @@ -0,0 +1,19 @@ +#!/bin/sh +set -eu pipefail + +TARGET_DIR="$HOME/screenshots" +TARGET_FILE="$(date +%Y-%m-%d-%H%M%S-%2N).png" +TARGET_PATH="$TARGET_DIR/$TARGET_FILE" + +ensure_target_dir() +{ + if [ ! -d "$TARGET_DIR" ]; then + mkdir -p "$TARGET_DIR" + fi +} + +is_slurping() +{ + pgrep -x slurp >/dev/null +} + diff --git a/dotfiles/mango/.config/mango/scripts/screenshot/fullscreen.sh b/dotfiles/mango/.config/mango/scripts/screenshot/fullscreen.sh new file mode 100755 index 0000000..78a676e --- /dev/null +++ b/dotfiles/mango/.config/mango/scripts/screenshot/fullscreen.sh @@ -0,0 +1,11 @@ +#!/bin/sh +set -eu pipefail + +. ~/.config/mango/scripts/screenshot/common.sh + +ensure_target_dir +grim - | satty --filename - \ +--output-filename "$TARGET_PATH" \ +--actions-on-enter "save-to-file","save-to-clipboard","exit" \ +--actions-on-escape "save-to-clipboard","exit" \ +--copy-command "wl-copy --type image/png" \ diff --git a/dotfiles/mango/.config/mango/scripts/screenshot/region.sh b/dotfiles/mango/.config/mango/scripts/screenshot/region.sh new file mode 100755 index 0000000..ad92b09 --- /dev/null +++ b/dotfiles/mango/.config/mango/scripts/screenshot/region.sh @@ -0,0 +1,17 @@ +#!/bin/sh +set -eu pipefail + +. ~/.config/mango/scripts/screenshot/common.sh + +if is_slurping; then + exit 1 +fi + +ensure_target_dir +geometry=$(slurp -d); [ -z "$geometry" ] && exit 1 + +grim -g "$geometry" - | satty --filename - \ +--output-filename "$TARGET_PATH" \ +--actions-on-enter "save-to-file","save-to-clipboard","exit" \ +--actions-on-escape "save-to-clipboard","exit" \ +--copy-command "wl-copy --type image/png" \ diff --git a/packages/install-satty.sh b/packages/install-satty.sh new file mode 100755 index 0000000..d8910f4 --- /dev/null +++ b/packages/install-satty.sh @@ -0,0 +1,3 @@ +#!/bin/sh + +install_package "satty"