diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf index 37607a27..7025a7f1 100644 --- a/config/hypr/UserConfigs/UserKeybinds.conf +++ b/config/hypr/UserConfigs/UserKeybinds.conf @@ -29,14 +29,16 @@ bind = $mainMod SHIFT, G, exec, $RunCMD gamemode #! @description: "Toggle anim bind = ALT, F3, exec, $RunCMD kb_changer #! @description: "Change Keyboard Layout"; @actions; bind = $mainMod, space, exec, $RunCMD change_layout #! @description: "Change Layout(master/dwindle)"; @actions; bind = SHIFT ALT,W, exec, python -O $scriptsDir/wallpaper.py -R #! @description: "Random wallpaper"; @actions; -bind = $mainMod, Z, exec, $scriptsDir/ScreenShot.sh --area #! @description: "Window screenshot"; @actions; -bind = ,Print, exec, $scriptsDir/ScreenShot.sh --now #! @description: "Screenshot"; @actions; bind = $mainMod CTRL, L, exec, pidof hyprlock || hyprlock -q #! @description: "Lock screen"; @actions; bind = $mainMod CTRL, P, exec, systemctl poweroff #! @description: "ShutDown"; @actions; bind = $mainMod CTRL, R, exec, systemctl reboot #! @description: "Restart"; @actions; -bind = $mainMod CTRL, Q, exec, loginctl kill-session $XDG_SESSION_ID #! @description: "LogOut"; @actions; +bind = $mainMod, Z, exec, $scriptsDir/ScreenShot.sh #! @description: "Screenshot"; @actions; +bind = ALT SHIFT, S, exec, $scriptsDir/ScreenShot.sh --window #! @description: "Window screenshot"; @actions; +bind = ,Print, exec, $scriptsDir/ScreenShot.sh --active #! @description: "Active screen screenshot"; @actions; bind = CTRL SHIFT, R, exec, pkill ags ; ags #! @description: "Reload AGS" @actions; + + # Tools bind = $mainMod, D, exec, ags -r "toggleAppsWindow()" #! @description: "App Launcher"; @tools; bind = $mainMod SHIFT, Z, exec, ags -r "toggleMediaWindow()" #! @description: "Players"; @tools; @@ -48,9 +50,7 @@ bind = $mainMod, W, exec, ags -r "OpenSettings('wallpaper')" #! @descrip bind = $mainMod SHIFT, S, exec, ags -r 'OpenSettings()' #! @description: "Setting"; @tools; bind = ALT, F1, exec, ags -t cheatsheet #! @description: "List of keybindings"; @tools; - # Misc -# misc bind = $mainMod ALT, P, submap, passthru #! @description: "Passthrough mainMod key to Virtual Machine"; @misc; submap = passthru bind = $mainMod ALT, Escape, submap, reset #! @description: "Cancel passthrough"; @misc; diff --git a/config/hypr/assets/cancel.svg b/config/hypr/assets/cancel.svg deleted file mode 100644 index 666d5dd7..00000000 --- a/config/hypr/assets/cancel.svg +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/config/hypr/assets/screenshot.svg b/config/hypr/assets/screenshot.svg deleted file mode 100644 index 342a4a67..00000000 --- a/config/hypr/assets/screenshot.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index b9bb72c2..4c496029 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -1,73 +1,15 @@ #!/bin/bash +DIR="$HOME/Pictures/screenshots/" +NAME="screenshot_$(date +%d%m%Y_%H%M%S).png" -# Screenshots scripts -iDIR="$HOME/dotfiles/hypr/assets" +# hyprshot -z -m region -o "/tmp" -f "$NAME" -s -notify_cmd_shot="notify-send -h string:x-canonical-private-synchronous:shot-notify -u low -i ${iDIR}/screenshot.svg" -dir="$(xdg-user-dir PICTURES)/Screenshots" -[[ ! -d "$dir" ]] && mkdir -p "$dir" +if [[ "$1" == "--window" ]]; then + hyprshot -z -m window -o "/tmp" -f "$NAME" -s +elif [[ "$1" == "--active" ]]; then + hyprshot -z -m active -m output -o "/tmp" -f "$NAME" -s +else + hyprshot -z -m region -o "/tmp" -f "$NAME" -s -- +fi -notify_view() { - local msg="Screenshot Saved." - if [[ "$1" == "active" && ! -e "$active_window_path" ]]; then - msg="Screenshot NOT Saved." - fi - $notify_cmd_shot "$msg" -} - -countdown() { - for ((sec=$1; sec>0; sec--)); do - notify-send -h string:x-canonical-private-synchronous:shot-notify -t 1000 -i "$iDIR/timer.png" "Taking shot in: $sec" - sleep 1 - done -} - -take_shot() { - local time=$(date "+%d-%b_%H-%M-%S") - local file="Screenshot_${time}_${RANDOM}.png" - cd "$dir" && grim - | tee "$file" | wl-copy - sleep 2 - notify_view "$1" -} - -shot_timer() { - local time=$(date "+%d-%b_%H-%M-%S") - local file="Screenshot_${time}_${RANDOM}.png" - countdown "$1" - sleep 1 - take_shot "$2" -} - -shotarea() { - local time=$(date "+%d-%b_%H-%M-%S") - local tmpfile=$(mktemp) - local area=$(slurp) - if [[ -z "$area" ]]; then - notify-send -u low -i "$iDIR/cancel.svg" 'No area selected' - rm "$tmpfile" - return - fi - grim -g "$area" - > "$tmpfile" && [[ -s "$tmpfile" ]] && { - wl-copy < "$tmpfile" - mv "$tmpfile" "$dir/Screenshot_${time}_${RANDOM}.png" - notify_view - } - rm "$tmpfile" -} - -shotactive() { - local time=$(date "+%d-%b_%H-%M-%S") - local active_window_path="${dir}/Screenshot_${time}_$(hyprctl -j activewindow | jq -r '.class').png" - hyprctl -j activewindow | jq -r '"\(.at[0]),\(.at[1]) \(.size[0])x\(.size[1])"' | grim -g - "$active_window_path" - sleep 1 - notify_view "active" -} - -case "$1" in - --now) take_shot ;; - --in5) shot_timer 5 ;; - --in10) shot_timer 10 ;; - --area) shotarea ;; - --active) shotactive ;; - *) echo "Available Options: --now --in5 --in10 --area --active" ;; -esac +swappy -f "/tmp/$NAME" -o "$DIR$NAME" diff --git a/config/hypr/scripts/Ui_cmd.sh b/config/hypr/scripts/Ui_cmd.sh index 8e08ea62..df989961 100755 --- a/config/hypr/scripts/Ui_cmd.sh +++ b/config/hypr/scripts/Ui_cmd.sh @@ -10,15 +10,16 @@ notif="$HOME/dotfiles/hypr/assets/bell.png" ###################################### toggle_animation() { - STATE=$(hyprctl -j getoption animations:enabled | jq ".int") - if [ "${STATE}" = "1" ]; then - hyprctl keyword animations:enabled 0 - noti_n "Disable animation" - else - hyprctl keyword animations:enabled 1 - noti_n "Enable animation" - fi - + cache_file="/tmp/toggle_animation" +if [ -f $cache_file ]; then + hyprctl keyword animations:enabled true + ags -r 'enableAnimations(true)' + rm $cache_file +else + hyprctl keyword animations:enabled false + ags -r 'enableAnimations(false)' + touch $cache_file +fi } ################################################