diff --git a/README.md b/README.md
index 80b5024..fdef643 100644
--- a/README.md
+++ b/README.md
@@ -53,10 +53,13 @@ The following packages are required for the proper functioning of Hyprland on Vo
User Interface Components
- waybar
- - grim
- swaybg
- - swaylock or [swaylock-effects](https://github.com/mortie/swaylock-effects) : lock screen with effects
+ - swaylock or [swaylock-effects](https://github.com/mortie/swaylock-effects)
+ - grim
- slurp
+ - jq
+ - wl-clipboard
+ - libnotify
- dunst
- swayidle
- swappy
diff --git a/hyprland/.config/hypr/conf/keybindings/default.conf b/hyprland/.config/hypr/conf/keybindings/default.conf
index 06255f2..87c1d33 100644
--- a/hyprland/.config/hypr/conf/keybindings/default.conf
+++ b/hyprland/.config/hypr/conf/keybindings/default.conf
@@ -21,6 +21,10 @@ bind = $mainMod ALT, right, movewindow, r
bind = $mainMod ALT, up, movewindow, u
bind = $mainMod ALT, down, movewindow, d
+# Screenshot
+bind = $mainMod, PRINT, exec, $screenshot -m window
+bind = , PRINT, exec, $screenshot -m output
+
# Audio control
bind=,XF86AudioRaiseVolume,exec, $volume_control u
bind=,XF86AudioLowerVolume,exec, $volume_control d
diff --git a/hyprland/.config/hypr/hyprland.conf b/hyprland/.config/hypr/hyprland.conf
index e321a2c..22abfc5 100644
--- a/hyprland/.config/hypr/hyprland.conf
+++ b/hyprland/.config/hypr/hyprland.conf
@@ -16,6 +16,7 @@ $scr_path = ~/.config/hypr/scripts
$mainMod = SUPER
$terminal = alacritty
$fileManager = dolphin
+$screenshot = $scr_path/hyprshot.sh
$waybar_toggle = $scr_path/waybar-toggle.sh
$volume_control = $scr_path/volume-control.sh
$rofi_menu = $scr_path/rofi-launch.sh d
diff --git a/hyprland/.config/hypr/scripts/hyprshot.sh b/hyprland/.config/hypr/scripts/hyprshot.sh
index f15c369..1ea3d84 100755
--- a/hyprland/.config/hypr/scripts/hyprshot.sh
+++ b/hyprland/.config/hypr/scripts/hyprshot.sh
@@ -53,9 +53,8 @@ function send_notification() {
fi
local message=$([ $CLIPBOARD -eq 1 ] &&
- echo "Image copied to the clipboard" ||
- echo "Image saved in ${1} and copied to the clipboard.")
- notify-send "Screenshot saved" \
+ echo "Image copied to the clipboard")
+ dunstify "Screenshot Saved." \
"${message}" \
-t "$NOTIF_TIMEOUT" -i "${1}" -a Hyprshot
}
@@ -119,6 +118,7 @@ function save_geometry() {
}
else
wl-copy < <(grim -g "${cropped_geometry}" -)
+ echo ""
fi
send_notification $output
@@ -271,8 +271,15 @@ DEBUG=0
SILENT=0
RAW=0
NOTIF_TIMEOUT=5000
-CURRENT=0
-[ -z "$XDG_PICTURES_DIR" ] && type xdg-user-dir &>/dev/null && XDG_PICTURES_DIR=$(xdg-user-dir PICTURES)
+CURRENT=1
+HYPRSHOT_DIR="$HOME/Screenshots"
+
+if [[ ! -d "$HYPRSHOT_DIR" ]]; then
+ mkdir -p "$HYPRSHOT_DIR"
+fi
+
+# [ -z "$XDG_PICTURES_DIR" ] && type xdg-user-dir &>/dev/null && XDG_PICTURES_DIR=$(xdg-user-dir PICTURES)
+
FILENAME="$(date +'%Y-%m-%d-%H%M%S_hyprshot.png')"
[ -z "$HYPRSHOT_DIR" ] && SAVEDIR=${XDG_PICTURES_DIR:=~} || SAVEDIR=${HYPRSHOT_DIR}
diff --git a/hyprland/.config/rofi/applets/bin/screenshot.sh b/hyprland/.config/rofi/applets/bin/screenshot.sh
index fc743c5..b01f57c 100755
--- a/hyprland/.config/rofi/applets/bin/screenshot.sh
+++ b/hyprland/.config/rofi/applets/bin/screenshot.sh
@@ -8,6 +8,7 @@
# Import Current Theme
source "$HOME"/.config/rofi/applets/shared/theme.bash
theme="$type/$style"
+hyprshot="$HOME/.config/hypr/scripts/hyprshot.sh"
# Theme Elements
prompt='Screenshot'
@@ -64,28 +65,6 @@ run_rofi() {
echo -e "$option_1\n$option_2\n$option_3\n$option_4\n$option_5" | rofi_cmd
}
-# Screenshot
-time=$(date +%Y-%m-%d-%H-%M-%S)
-geometry=$(xrandr | grep 'current' | head -n1 | cut -d',' -f2 | tr -d '[:blank:],current')
-dir="$HOME/Screenshots"
-file="Screenshot_${time}_${geometry}.png"
-
-if [[ ! -d "$dir" ]]; then
- mkdir -p "$dir"
-fi
-
-# notify and view screenshot
-notify_view() {
- notify_cmd_shot='dunstify -u low --replace=699'
- ${notify_cmd_shot} "Copied to clipboard."
- viewnior ${dir}/"$file"
- if [[ -e "$dir/$file" ]]; then
- ${notify_cmd_shot} "Screenshot Saved."
- else
- ${notify_cmd_shot} "Screenshot Deleted."
- fi
-}
-
# Copy screenshot to clipboard
copy_shot() {
tee "$file" | xclip -selection clipboard -t image/png
@@ -101,30 +80,27 @@ countdown() {
# take shots
shotnow() {
- cd ${dir} && sleep 0.5 && maim -u -f png | copy_shot
- notify_view
+ sleep 1
+ $hyprshot -im output
}
shot5() {
countdown '5'
- sleep 1 && cd ${dir} && maim -u -f png | copy_shot
- notify_view
+ $hyprshot -m output
}
shot10() {
countdown '10'
- sleep 1 && cd ${dir} && maim -u -f png | copy_shot
- notify_view
+ $hyprshot -m output
}
shotwin() {
- cd ${dir} && maim -u -f png -i $(xdotool getactivewindow) | copy_shot
- notify_view
+ sleep 1
+ $hyprshot -m window
}
shotarea() {
- cd ${dir} && maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | copy_shot
- notify_view
+ $hyprshot -m region
}
# Execute Command