diff --git a/roles/desktop-environment/tasks/utils.yml b/roles/desktop-environment/tasks/utils.yml index 015e829..c75845c 100644 --- a/roles/desktop-environment/tasks/utils.yml +++ b/roles/desktop-environment/tasks/utils.yml @@ -26,4 +26,7 @@ - fonts-noto-color-emoji - thunar - dunst - - polkit-kde-agent-1 \ No newline at end of file + - polkit-kde-agent-1 + - slurp + - grim + - swappy \ No newline at end of file diff --git a/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 b/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 index 45dac2d..60bf495 100644 --- a/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 +++ b/roles/desktop-environment/templates/.config/hypr/hyprland.conf.j2 @@ -109,7 +109,8 @@ workspace = {{ workspace['id'] }}{% if 'monitor' in workspace %}, monitor:desc:{ exec-once = systemctl --user import-environment DISPLAY WAYLAND_DISPLAY && hash dbus-update-activation-environment 2>/dev/null && dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK exec-once = systemctl --user start plasma-polkit-agent.service exec-once = dunst -config ~/.config/dunst/dunst.ini -exec-once = waybar & ~/.local/bin/hyprhelpr background & ~/.local/bin/hyprhelpr idle +exec-once = waybar +exec-once = ~/.local/bin/hyprhelpr background & ~/.local/bin/hyprhelpr idle exec-once = flatpak run com.tomjwatson.Emote # Execute apps at launch @@ -132,6 +133,7 @@ bind = $mainMod, F, fullscreen, 0 bind = $mainMod, V, togglefloating, bind = $mainMod, L, exec, ~/.local/bin/hyprhelpr lock bind = $mainMod, P, exec, ~/.local/bin/hyprhelpr powermenu +bind = $mainMod SHIFT, S, exec, ~/.local/bin/hyprhelpr screenshot bind = $mainMod, period, exec, flatpak run com.tomjwatson.Emote # Move focus with mainMod + arrow keys diff --git a/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 b/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 index 1753113..9180a3b 100644 --- a/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 +++ b/roles/desktop-environment/templates/.local/bin/hyprhelpr.j2 @@ -59,6 +59,23 @@ powermenu() { fi } +screenshot() { + ACTION=$(printf "Area\nWindow\nScreen" | wofi --show=dmenu -i --width 200 --height 150) + if [ -n "$ACTION" ]; then + case $ACTION in + Area) + grim -g "$(slurp)" - | swappy -f - + ;; + Window) + grim -g "$(hyprctl clients -j | jq -r ".[] | select(.workspace.id | IN(["$(hyprctl monitors -j | jq '.[].activeWorkspace.id' | xargs | sed -e 's/ /,/g')"][]))" | jq -r ".at,.size" | jq -s "add" | jq '_nwise(4)' | jq -r '"\(.[0]),\(.[1]) \(.[2])x\(.[3])"' | slurp)" - | swappy -f - + ;; + Screen) + grim -g "$(slurp -o)" - | swappy -f - + ;; + esac + fi +} + ACTION=$1 case $ACTION in background) @@ -79,6 +96,9 @@ case $ACTION in powermenu) powermenu ;; + screenshot) + screenshot + ;; help | -h | --help) echo "Usage: hyprhelpr [parameters]" echo "Available actions:" @@ -88,6 +108,7 @@ case $ACTION in echo " shutdown Shut down the system." echo " reboot Reboot the system." echo " powermenu Show wofi in dmenu mode with different power options" + echo " screenshot Show wofi in dmenu mode with different screenshot options" echo " help Show this help text." ;; *)