mirror of
https://github.com/szymon-jozef/superior_dotfiles.git
synced 2026-09-07 20:20:38 +02:00
Add .local/bin/home_backup.sh
Add .local/bin/screenshot.sh Update .local/bin/screenshots.sh Add .local/bin/sekirofpsunlock Add .local/bin/old/brightness.sh Add .local/bin/old/change_colors.sh Add .local/bin/old/random_wallpaper.sh Add .local/bin/steamtinkerlaunch
This commit is contained in:
49
private_dot_local/bin/executable_screenshot.sh
Normal file
49
private_dot_local/bin/executable_screenshot.sh
Normal file
@@ -0,0 +1,49 @@
|
||||
#!/bin/env bash
|
||||
|
||||
# variables
|
||||
## path vars
|
||||
date="$(date +'%d-%m-%Y_%H:%M:%S')"
|
||||
fname="$date.png"
|
||||
target_path="$HOME/Obrazy/zrzuty/$fname"
|
||||
## stdout
|
||||
error_wrong_type="The first argument needs to be \"fullscreen\", \"window\" or \"region\". Exiting..."
|
||||
notification_succes="$target_path saved and copied"
|
||||
|
||||
notification() {
|
||||
notify-send -i "$target_path" -u low -a "Screenshot" "Screenshot" "$notification_succes"
|
||||
}
|
||||
|
||||
# validate input
|
||||
case "$1" in
|
||||
"fullscreen" | "window" | "region")
|
||||
type=$1
|
||||
;;
|
||||
*)
|
||||
echo "$error_wrong_type"
|
||||
exit
|
||||
;;
|
||||
esac
|
||||
|
||||
case $type in
|
||||
"fullscreen")
|
||||
grim -o $(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name') "$target_path"
|
||||
wl-copy < "$target_path"
|
||||
notification
|
||||
;;
|
||||
"window")
|
||||
active_window_position="$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 0) | .at')"
|
||||
active_window_size="$(hyprctl clients -j | jq -r '.[] | select(.focusHistoryID == 0) | .size')"
|
||||
|
||||
x=$(echo "$active_window_position" | jq '.[0]')
|
||||
y=$(echo "$active_window_position" | jq '.[1]')
|
||||
width=$(echo "$active_window_size" | jq '.[0]')
|
||||
height=$(echo "$active_window_size" | jq '.[1]')
|
||||
|
||||
grim -g "${x},${y} ${width}x${height}" "$target_path"
|
||||
wl-copy < "$target_path"
|
||||
notification
|
||||
;;
|
||||
"region")
|
||||
grim -o $(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | .name') - | satty -f -
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user