From 6594a935a8c0c4b3bc90e6d5f5d74829c06c53f7 Mon Sep 17 00:00:00 2001 From: aditya-an1l Date: Thu, 22 May 2025 11:08:00 +0530 Subject: feat: Add Power Info (level and status) in Hyprlock Window - Display current power level (battery percentage) and power status (full, charging, discharging) at the bottom right section of Hyprlock - This feature allows laptop user to view the power info when their device are locked, especially if the device is getting discharged. --- config/hypr/scripts/Power.sh | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 config/hypr/scripts/Power.sh (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Power.sh b/config/hypr/scripts/Power.sh new file mode 100644 index 00000000..42431ea9 --- /dev/null +++ b/config/hypr/scripts/Power.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +for i in {0..3}; do + if [ -f /sys/class/power_supply/BAT$i/capacity ]; then + battery_level=$(cat /sys/class/power_supply/BAT$i/status) + battery_capacity=$(cat /sys/class/power_supply/BAT$i/capacity) + echo "Power: $battery_capacity% ($battery_level)" + fi +done -- cgit v1.2.3 From 2c33cef6fdee97ac9a13f0f4bf49158aa48c9f03 Mon Sep 17 00:00:00 2001 From: Kiran George Date: Sun, 25 May 2025 20:02:03 +0530 Subject: Improved Dropdown terminal --- config/hypr/UserConfigs/UserKeybinds.conf | 2 +- config/hypr/scripts/Dropterminal.sh | 65 +++++++++++++++++++++++++++++++ 2 files changed, 66 insertions(+), 1 deletion(-) create mode 100755 config/hypr/scripts/Dropterminal.sh (limited to 'config/hypr/scripts') diff --git a/config/hypr/UserConfigs/UserKeybinds.conf b/config/hypr/UserConfigs/UserKeybinds.conf index 871f2ffb..ce501d85 100644 --- a/config/hypr/UserConfigs/UserKeybinds.conf +++ b/config/hypr/UserConfigs/UserKeybinds.conf @@ -39,7 +39,7 @@ bind = $mainMod SHIFT, F, fullscreen # whole full screen bind = $mainMod CTRL, F, fullscreen, 1 # fake full screen bind = $mainMod, SPACE, togglefloating, #Float Mode bind = $mainMod ALT, SPACE, exec, hyprctl dispatch workspaceopt allfloat #All Float Mode -bind = $mainMod SHIFT, Return, exec, [float; move 15% 5%; size 70% 60%] $term # Dropdown terminal +bind = $mainMod SHIFT, Return, exec, $scriptsDir/Dropterminal.sh $term # Dropdown terminal # Desktop zooming or magnifier bind = $mainMod ALT, mouse_down, exec, hyprctl keyword cursor:zoom_factor "$(hyprctl getoption cursor:zoom_factor | awk 'NR==1 {factor = $2; if (factor < 1) {factor = 1}; print factor * 2.0}')" diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh new file mode 100755 index 00000000..a160c3e9 --- /dev/null +++ b/config/hypr/scripts/Dropterminal.sh @@ -0,0 +1,65 @@ +#!/bin/bash +# /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## +# Dropdown Terminal Usage: ./dropdown.sh [foot|kitty] + +TERMINAL="$1" +SPECIAL_WS="special:scratchpad" + +# Validate input and set CLASS and CMD +case "$TERMINAL" in + foot) + CLASS="foot-dropterminal" + TERMINAL_CMD="foot --app-id $CLASS" + ;; + kitty) + CLASS="kitty-dropterminal" + TERMINAL_CMD="kitty --class $CLASS" + ;; + *) + echo "Invalid or missing terminal argument. Usage: $0 [foot|kitty]" + exit 1 + ;; +esac + +# Get the current workspace +CURRENT_WS=$(hyprctl activeworkspace -j | jq -r '.id') + +# Function to check if terminal exists +terminal_exists() { + hyprctl clients -j | jq -e --arg CLASS "$CLASS" 'any(.[]; .class == $CLASS)' >/dev/null 2>&1 +} + +# Function to check if terminal is in special workspace +terminal_in_special() { + hyprctl clients -j | jq -e --arg CLASS "$CLASS" 'any(.[]; .class == $CLASS and .workspace.name == "special:scratchpad")' >/dev/null 2>&1 +} + +# Function to get terminal address +get_terminal_address() { + hyprctl clients -j | jq -r --arg CLASS "$CLASS" '.[] | select(.class == $CLASS) | .address' +} + +if terminal_exists; then + TERMINAL_ADDR=$(get_terminal_address) + + if terminal_in_special; then + echo "Bringing terminal to workspace $CURRENT_WS and pinning" + hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$TERMINAL_ADDR" + hyprctl dispatch pin "address:$TERMINAL_ADDR" + hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" + else + echo "Unpinning and hiding terminal to special workspace" + hyprctl dispatch pin "address:$TERMINAL_ADDR" # Unpin (toggle) + sleep 0.1 + hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR" + fi +else + echo "Creating new dropdown terminal with command: $TERMINAL_CMD" + hyprctl dispatch exec "[float; move 25% 5%; size 50% 50%] $TERMINAL_CMD" + sleep 0.5 + if terminal_exists; then + TERMINAL_ADDR=$(get_terminal_address) + hyprctl dispatch pin "address:$TERMINAL_ADDR" + hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" + fi +fi -- cgit v1.2.3 From c6c06f0448413454b9ea58af7526c55c360b0e97 Mon Sep 17 00:00:00 2001 From: JaKooLit Date: Tue, 27 May 2025 03:58:55 +0900 Subject: updated Power.sh, renamed to Battery.sh since it is about battery information --- config/hypr/hyprlock-1080p.conf | 12 ++++++++++++ config/hypr/hyprlock.conf | 4 ++-- config/hypr/scripts/Battery.sh | 9 +++++++++ config/hypr/scripts/Power.sh | 9 --------- 4 files changed, 23 insertions(+), 11 deletions(-) create mode 100644 config/hypr/scripts/Battery.sh delete mode 100644 config/hypr/scripts/Power.sh (limited to 'config/hypr/scripts') diff --git a/config/hypr/hyprlock-1080p.conf b/config/hypr/hyprlock-1080p.conf index a0e105e0..70c00c16 100644 --- a/config/hypr/hyprlock-1080p.conf +++ b/config/hypr/hyprlock-1080p.conf @@ -156,6 +156,18 @@ label { valign = bottom } +# battery information +label { + monitor = + text = cmd[update:1000] echo " "$($Scripts/Battery.sh)" " + color = $color13 + font_size = 16 + font_family = Victor Mono Bold Oblique + position = 0, 50 + halign = right + valign = bottom +} + # weather edit the scripts for locations # weather scripts are located in ~/.config/hypr/UserScripts Weather.sh and/or Weather.py # see https://github.com/JaKooLit/Hyprland-Dots/wiki/TIPS#%EF%B8%8F-weather-app-related-for-waybar-and-hyprlock diff --git a/config/hypr/hyprlock.conf b/config/hypr/hyprlock.conf index 80a94fb1..b67bba51 100644 --- a/config/hypr/hyprlock.conf +++ b/config/hypr/hyprlock.conf @@ -157,10 +157,10 @@ label { valign = bottom } -# battery +# battery information label { monitor = - text = cmd[update:1000] echo " "$($Scripts/Power.sh)" " + text = cmd[update:1000] echo " "$($Scripts/Battery.sh)" " color = $color13 font_size = 18 font_family = Victor Mono Bold Oblique diff --git a/config/hypr/scripts/Battery.sh b/config/hypr/scripts/Battery.sh new file mode 100644 index 00000000..d7830058 --- /dev/null +++ b/config/hypr/scripts/Battery.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +for i in {0..3}; do + if [ -f /sys/class/power_supply/BAT$i/capacity ]; then + battery_level=$(cat /sys/class/power_supply/BAT$i/status) + battery_capacity=$(cat /sys/class/power_supply/BAT$i/capacity) + echo "Battery: $battery_capacity% ($battery_level)" + fi +done diff --git a/config/hypr/scripts/Power.sh b/config/hypr/scripts/Power.sh deleted file mode 100644 index 42431ea9..00000000 --- a/config/hypr/scripts/Power.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -for i in {0..3}; do - if [ -f /sys/class/power_supply/BAT$i/capacity ]; then - battery_level=$(cat /sys/class/power_supply/BAT$i/status) - battery_capacity=$(cat /sys/class/power_supply/BAT$i/capacity) - echo "Power: $battery_capacity% ($battery_level)" - fi -done -- cgit v1.2.3 From 84466963633538013e84c74c2d8b2ce33e06c504 Mon Sep 17 00:00:00 2001 From: Kiran George Date: Tue, 27 May 2025 10:11:45 +0530 Subject: Updated dropdown terminal script to use addressed based window tracking instead of class --- config/hypr/scripts/Dropterminal.sh | 140 ++++++++++++++++++++++++++++-------- 1 file changed, 109 insertions(+), 31 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh index a160c3e9..98420a24 100755 --- a/config/hypr/scripts/Dropterminal.sh +++ b/config/hypr/scripts/Dropterminal.sh @@ -1,65 +1,143 @@ #!/bin/bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## -# Dropdown Terminal Usage: ./dropdown.sh [foot|kitty] +# Dropdown Terminal +# Usage: ./dropdown.sh [-d] +# Example: ./dropdown.sh foot +# ./dropdown.sh -d foot (with debug output) +# ./dropdown.sh "kitty -e zsh" +# ./dropdown.sh "alacritty --working-directory /home/user" -TERMINAL="$1" +DEBUG=false SPECIAL_WS="special:scratchpad" +ADDR_FILE="/tmp/dropdown_terminal_addr" -# Validate input and set CLASS and CMD -case "$TERMINAL" in - foot) - CLASS="foot-dropterminal" - TERMINAL_CMD="foot --app-id $CLASS" - ;; - kitty) - CLASS="kitty-dropterminal" - TERMINAL_CMD="kitty --class $CLASS" - ;; - *) - echo "Invalid or missing terminal argument. Usage: $0 [foot|kitty]" - exit 1 - ;; -esac +# Parse arguments +if [ "$1" = "-d" ]; then + DEBUG=true + shift +fi + +TERMINAL_CMD="$1" + +# Debug echo function +debug_echo() { + if [ "$DEBUG" = true ]; then + echo "$@" + fi +} + +# Validate input +if [ -z "$TERMINAL_CMD" ]; then + echo "Missing terminal command. Usage: $0 [-d] " + echo "Examples:" + echo " $0 foot" + echo " $0 -d foot (with debug output)" + echo " $0 'kitty -e zsh'" + echo " $0 'alacritty --working-directory /home/user'" + exit 1 +fi # Get the current workspace CURRENT_WS=$(hyprctl activeworkspace -j | jq -r '.id') +# Function to get stored terminal address +get_terminal_address() { + if [ -f "$ADDR_FILE" ] && [ -s "$ADDR_FILE" ]; then + cat "$ADDR_FILE" + fi +} + # Function to check if terminal exists terminal_exists() { - hyprctl clients -j | jq -e --arg CLASS "$CLASS" 'any(.[]; .class == $CLASS)' >/dev/null 2>&1 + local addr=$(get_terminal_address) + if [ -n "$addr" ]; then + hyprctl clients -j | jq -e --arg ADDR "$addr" 'any(.[]; .address == $ADDR)' >/dev/null 2>&1 + else + return 1 + fi } # Function to check if terminal is in special workspace terminal_in_special() { - hyprctl clients -j | jq -e --arg CLASS "$CLASS" 'any(.[]; .class == $CLASS and .workspace.name == "special:scratchpad")' >/dev/null 2>&1 + local addr=$(get_terminal_address) + if [ -n "$addr" ]; then + hyprctl clients -j | jq -e --arg ADDR "$addr" 'any(.[]; .address == $ADDR and .workspace.name == "special:scratchpad")' >/dev/null 2>&1 + else + return 1 + fi } -# Function to get terminal address -get_terminal_address() { - hyprctl clients -j | jq -r --arg CLASS "$CLASS" '.[] | select(.class == $CLASS) | .address' +# Function to spawn terminal and capture its address +spawn_terminal() { + debug_echo "Creating new dropdown terminal with command: $TERMINAL_CMD" + + # Get window count and list before spawning + local windows_before=$(hyprctl clients -j) + local count_before=$(echo "$windows_before" | jq 'length') + + # Launch terminal with rules applied from the start + hyprctl dispatch exec "[float; move 25% 5%; size 50% 50%; pin] $TERMINAL_CMD" + + # Wait for window to appear + sleep 1 + + # Get windows after spawning + local windows_after=$(hyprctl clients -j) + local count_after=$(echo "$windows_after" | jq 'length') + + if [ "$count_after" -gt "$count_before" ]; then + # Find the new window by comparing before/after lists + local new_addr=$(comm -13 \ + <(echo "$windows_before" | jq -r '.[].address' | sort) \ + <(echo "$windows_after" | jq -r '.[].address' | sort) \ + | head -1) + + if [ -n "$new_addr" ] && [ "$new_addr" != "null" ]; then + # Store the address + echo "$new_addr" > "$ADDR_FILE" + debug_echo "Terminal created with address: $new_addr" + return 0 + fi + fi + + # Fallback: try to find by the most recently mapped window + local new_addr=$(hyprctl clients -j | jq -r 'sort_by(.focusHistoryID) | .[-1] | .address') + + if [ -n "$new_addr" ] && [ "$new_addr" != "null" ]; then + echo "$new_addr" > "$ADDR_FILE" + debug_echo "Terminal created with address: $new_addr (fallback method)" + return 0 + fi + + debug_echo "Failed to get terminal address" + return 1 } +# Main logic if terminal_exists; then TERMINAL_ADDR=$(get_terminal_address) + debug_echo "Found existing terminal: $TERMINAL_ADDR" if terminal_in_special; then - echo "Bringing terminal to workspace $CURRENT_WS and pinning" + debug_echo "Bringing terminal to workspace $CURRENT_WS and pinning" hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$TERMINAL_ADDR" hyprctl dispatch pin "address:$TERMINAL_ADDR" hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" else - echo "Unpinning and hiding terminal to special workspace" + debug_echo "Unpinning and hiding terminal to special workspace" hyprctl dispatch pin "address:$TERMINAL_ADDR" # Unpin (toggle) sleep 0.1 hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR" fi else - echo "Creating new dropdown terminal with command: $TERMINAL_CMD" - hyprctl dispatch exec "[float; move 25% 5%; size 50% 50%] $TERMINAL_CMD" - sleep 0.5 - if terminal_exists; then + debug_echo "No existing terminal found, creating new one" + if spawn_terminal; then TERMINAL_ADDR=$(get_terminal_address) - hyprctl dispatch pin "address:$TERMINAL_ADDR" - hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" + if [ -n "$TERMINAL_ADDR" ]; then + hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" + fi + else + echo "Failed to create terminal" + exit 1 fi -fi +fi \ No newline at end of file -- cgit v1.2.3 From b56edcff4d48d215ad26e1c64729a8ea7c311f22 Mon Sep 17 00:00:00 2001 From: Kiran George Date: Tue, 27 May 2025 21:45:24 +0530 Subject: Added animation similar to pyprland --- config/hypr/scripts/Dropterminal.sh | 196 ++++++++++++++++++++++++++++++------ 1 file changed, 168 insertions(+), 28 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh index 98420a24..51cdf31f 100755 --- a/config/hypr/scripts/Dropterminal.sh +++ b/config/hypr/scripts/Dropterminal.sh @@ -1,16 +1,21 @@ #!/bin/bash # /* ---- 💫 https://github.com/JaKooLit 💫 ---- */ ## # Dropdown Terminal -# Usage: ./dropdown.sh [-d] -# Example: ./dropdown.sh foot -# ./dropdown.sh -d foot (with debug output) -# ./dropdown.sh "kitty -e zsh" -# ./dropdown.sh "alacritty --working-directory /home/user" +# Usage: ./Dropdown.sh [-d] +# Example: ./Dropdown.sh foot +# ./Dropdown.sh -d foot (with debug output) +# ./Dropdown.sh "kitty -e zsh" +# ./Dropdown.sh "alacritty --working-directory /home/user" DEBUG=false SPECIAL_WS="special:scratchpad" ADDR_FILE="/tmp/dropdown_terminal_addr" +# Animation settings +ANIMATION_DURATION=100 # milliseconds +SLIDE_STEPS=10 +SLIDE_DELAY=5 # milliseconds between steps + # Parse arguments if [ "$1" = "-d" ]; then DEBUG=true @@ -37,6 +42,91 @@ if [ -z "$TERMINAL_CMD" ]; then exit 1 fi +# Function to get window geometry +get_window_geometry() { + local addr="$1" + hyprctl clients -j | jq -r --arg ADDR "$addr" '.[] | select(.address == $ADDR) | "\(.at[0]) \(.at[1]) \(.size[0]) \(.size[1])"' +} + +# Function to animate window slide down (show) +animate_slide_down() { + local addr="$1" + local target_x="$2" + local target_y="$3" + local width="$4" + local height="$5" + + debug_echo "Animating slide down for window $addr to position $target_x,$target_y" + + # Start position (above screen) + local start_y=$((target_y - height - 50)) + + # Calculate step size + local step_y=$(((target_y - start_y) / SLIDE_STEPS)) + + # Move window to start position instantly (off-screen) + hyprctl dispatch movewindowpixel "exact $target_x $start_y,address:$addr" >/dev/null 2>&1 + sleep 0.05 + + # Animate slide down + for i in $(seq 1 $SLIDE_STEPS); do + local current_y=$((start_y + (step_y * i))) + hyprctl dispatch movewindowpixel "exact $target_x $current_y,address:$addr" >/dev/null 2>&1 + sleep 0.03 + done + + # Ensure final position is exact + hyprctl dispatch movewindowpixel "exact $target_x $target_y,address:$addr" >/dev/null 2>&1 +} + +# Function to animate window slide up (hide) +animate_slide_up() { + local addr="$1" + local start_x="$2" + local start_y="$3" + local width="$4" + local height="$5" + + debug_echo "Animating slide up for window $addr from position $start_x,$start_y" + + # End position (above screen) + local end_y=$((start_y - height - 50)) + + # Calculate step size + local step_y=$(((start_y - end_y) / SLIDE_STEPS)) + + # Animate slide up + for i in $(seq 1 $SLIDE_STEPS); do + local current_y=$((start_y - (step_y * i))) + hyprctl dispatch movewindowpixel "exact $start_x $current_y,address:$addr" >/dev/null 2>&1 + sleep 0.03 + done + + debug_echo "Slide up animation completed" +} + +# Function to get monitor info for centering +get_monitor_info() { + hyprctl monitors -j | jq -r '.[0] | "\(.x) \(.y) \(.width) \(.height)"' +} + +# Function to calculate dropdown position +calculate_dropdown_position() { + local monitor_info=$(get_monitor_info) + local mon_x=$(echo $monitor_info | cut -d' ' -f1) + local mon_y=$(echo $monitor_info | cut -d' ' -f2) + local mon_width=$(echo $monitor_info | cut -d' ' -f3) + local mon_height=$(echo $monitor_info | cut -d' ' -f4) + + # Calculate 50% width, 50% height, centered horizontally, 5% from top + local width=$((mon_width / 2)) + local height=$((mon_height / 2)) + local x=$((mon_x + (mon_width - width) / 2)) + local y=$((mon_y + mon_height / 20)) # 5% from top + + echo "$x $y $width $height" +} + # Get the current workspace CURRENT_WS=$(hyprctl activeworkspace -j | jq -r '.id') @@ -71,41 +161,57 @@ terminal_in_special() { spawn_terminal() { debug_echo "Creating new dropdown terminal with command: $TERMINAL_CMD" - # Get window count and list before spawning - local windows_before=$(hyprctl clients -j) - local count_before=$(echo "$windows_before" | jq 'length') + # Calculate dropdown position for later use + pos_info=$(calculate_dropdown_position) + target_x=$(echo $pos_info | cut -d' ' -f1) + target_y=$(echo $pos_info | cut -d' ' -f2) + width=$(echo $pos_info | cut -d' ' -f3) + height=$(echo $pos_info | cut -d' ' -f4) + + debug_echo "Target position: ${target_x}x${target_y}, size: ${width}x${height}" - # Launch terminal with rules applied from the start - hyprctl dispatch exec "[float; move 25% 5%; size 50% 50%; pin] $TERMINAL_CMD" + # Get window count before spawning + windows_before=$(hyprctl clients -j) + count_before=$(echo "$windows_before" | jq 'length') + + # Launch terminal directly in special workspace to avoid visible spawn + hyprctl dispatch exec "[float; size $width $height; workspace special:scratchpad silent] $TERMINAL_CMD" # Wait for window to appear - sleep 1 + sleep 0.1 # Get windows after spawning - local windows_after=$(hyprctl clients -j) - local count_after=$(echo "$windows_after" | jq 'length') + windows_after=$(hyprctl clients -j) + count_after=$(echo "$windows_after" | jq 'length') + + new_addr="" if [ "$count_after" -gt "$count_before" ]; then # Find the new window by comparing before/after lists - local new_addr=$(comm -13 \ + new_addr=$(comm -13 \ <(echo "$windows_before" | jq -r '.[].address' | sort) \ <(echo "$windows_after" | jq -r '.[].address' | sort) \ | head -1) - - if [ -n "$new_addr" ] && [ "$new_addr" != "null" ]; then - # Store the address - echo "$new_addr" > "$ADDR_FILE" - debug_echo "Terminal created with address: $new_addr" - return 0 - fi fi # Fallback: try to find by the most recently mapped window - local new_addr=$(hyprctl clients -j | jq -r 'sort_by(.focusHistoryID) | .[-1] | .address') + if [ -z "$new_addr" ] || [ "$new_addr" = "null" ]; then + new_addr=$(hyprctl clients -j | jq -r 'sort_by(.focusHistoryID) | .[-1] | .address') + fi if [ -n "$new_addr" ] && [ "$new_addr" != "null" ]; then + # Store the address echo "$new_addr" > "$ADDR_FILE" - debug_echo "Terminal created with address: $new_addr (fallback method)" + debug_echo "Terminal created with address: $new_addr in special workspace" + + # Small delay to ensure it's properly in special workspace + sleep 0.2 + + # Now bring it back with the same animation as subsequent shows + hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$new_addr" + hyprctl dispatch pin "address:$new_addr" + animate_slide_down "$new_addr" "$target_x" "$target_y" "$width" "$height" + return 0 fi @@ -119,15 +225,49 @@ if terminal_exists; then debug_echo "Found existing terminal: $TERMINAL_ADDR" if terminal_in_special; then - debug_echo "Bringing terminal to workspace $CURRENT_WS and pinning" + debug_echo "Bringing terminal from scratchpad with slide down animation" + + # Calculate target position + pos_info=$(calculate_dropdown_position) + target_x=$(echo $pos_info | cut -d' ' -f1) + target_y=$(echo $pos_info | cut -d' ' -f2) + width=$(echo $pos_info | cut -d' ' -f3) + height=$(echo $pos_info | cut -d' ' -f4) + + # Move to current workspace and pin hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$TERMINAL_ADDR" hyprctl dispatch pin "address:$TERMINAL_ADDR" + + # Set size and animate slide down + hyprctl dispatch resizewindowpixel "exact $width $height,address:$TERMINAL_ADDR" + animate_slide_down "$TERMINAL_ADDR" "$target_x" "$target_y" "$width" "$height" + hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" else - debug_echo "Unpinning and hiding terminal to special workspace" - hyprctl dispatch pin "address:$TERMINAL_ADDR" # Unpin (toggle) - sleep 0.1 - hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR" + debug_echo "Hiding terminal to scratchpad with slide up animation" + + # Get current geometry for animation + geometry=$(get_window_geometry "$TERMINAL_ADDR") + if [ -n "$geometry" ]; then + curr_x=$(echo $geometry | cut -d' ' -f1) + curr_y=$(echo $geometry | cut -d' ' -f2) + curr_width=$(echo $geometry | cut -d' ' -f3) + curr_height=$(echo $geometry | cut -d' ' -f4) + + debug_echo "Current geometry: ${curr_x},${curr_y} ${curr_width}x${curr_height}" + + # Animate slide up first + animate_slide_up "$TERMINAL_ADDR" "$curr_x" "$curr_y" "$curr_width" "$curr_height" + + # Small delay then move to special workspace and unpin + sleep 0.1 + hyprctl dispatch pin "address:$TERMINAL_ADDR" # Unpin (toggle) + hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR" + else + debug_echo "Could not get window geometry, moving to scratchpad without animation" + hyprctl dispatch pin "address:$TERMINAL_ADDR" + hyprctl dispatch movetoworkspacesilent "$SPECIAL_WS,address:$TERMINAL_ADDR" + fi fi else debug_echo "No existing terminal found, creating new one" -- cgit v1.2.3 From d8aee89ba261d17597deff3fe00a7907adf240e2 Mon Sep 17 00:00:00 2001 From: Kiran George Date: Sat, 31 May 2025 08:18:33 +0530 Subject: Dropdown terminal improvements - Round 2 --- config/hypr/scripts/Dropterminal.sh | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh index 51cdf31f..a8e1cda3 100755 --- a/config/hypr/scripts/Dropterminal.sh +++ b/config/hypr/scripts/Dropterminal.sh @@ -11,9 +11,15 @@ DEBUG=false SPECIAL_WS="special:scratchpad" ADDR_FILE="/tmp/dropdown_terminal_addr" +# Dropdown size and position configuration (percentages) +WIDTH_PERCENT=50 # Width as percentage of screen width +HEIGHT_PERCENT=50 # Height as percentage of screen height +X_PERCENT=25 # X position as percentage from left (25% centers a 50% width window) +Y_PERCENT=5 # Y position as percentage from top + # Animation settings ANIMATION_DURATION=100 # milliseconds -SLIDE_STEPS=10 +SLIDE_STEPS=5 SLIDE_DELAY=5 # milliseconds between steps # Parse arguments @@ -39,6 +45,12 @@ if [ -z "$TERMINAL_CMD" ]; then echo " $0 -d foot (with debug output)" echo " $0 'kitty -e zsh'" echo " $0 'alacritty --working-directory /home/user'" + echo "" + echo "Edit the script to modify size and position:" + echo " WIDTH_PERCENT - Width as percentage of screen (default: 50)" + echo " HEIGHT_PERCENT - Height as percentage of screen (default: 50)" + echo " X_PERCENT - X position from left as percentage (default: 25)" + echo " Y_PERCENT - Y position from top as percentage (default: 5)" exit 1 fi @@ -118,11 +130,11 @@ calculate_dropdown_position() { local mon_width=$(echo $monitor_info | cut -d' ' -f3) local mon_height=$(echo $monitor_info | cut -d' ' -f4) - # Calculate 50% width, 50% height, centered horizontally, 5% from top - local width=$((mon_width / 2)) - local height=$((mon_height / 2)) - local x=$((mon_x + (mon_width - width) / 2)) - local y=$((mon_y + mon_height / 20)) # 5% from top + # Calculate position and size based on percentages + local width=$((mon_width * WIDTH_PERCENT / 100)) + local height=$((mon_height * HEIGHT_PERCENT / 100)) + local x=$((mon_x + (mon_width * X_PERCENT / 100))) + local y=$((mon_y + (mon_height * Y_PERCENT / 100))) echo "$x $y $width $height" } @@ -175,7 +187,7 @@ spawn_terminal() { count_before=$(echo "$windows_before" | jq 'length') # Launch terminal directly in special workspace to avoid visible spawn - hyprctl dispatch exec "[float; size $width $height; workspace special:scratchpad silent] $TERMINAL_CMD" + hyprctl dispatch exec "[float; size $width $height; stayfocused; workspace special:scratchpad silent] $TERMINAL_CMD" # Wait for window to appear sleep 0.1 @@ -208,7 +220,8 @@ spawn_terminal() { sleep 0.2 # Now bring it back with the same animation as subsequent shows - hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$new_addr" + # Use movetoworkspacesilent to avoid affecting workspace history + hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$new_addr" hyprctl dispatch pin "address:$new_addr" animate_slide_down "$new_addr" "$target_x" "$target_y" "$width" "$height" @@ -234,8 +247,8 @@ if terminal_exists; then width=$(echo $pos_info | cut -d' ' -f3) height=$(echo $pos_info | cut -d' ' -f4) - # Move to current workspace and pin - hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$TERMINAL_ADDR" + # Use movetoworkspacesilent to avoid affecting workspace history + hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$TERMINAL_ADDR" hyprctl dispatch pin "address:$TERMINAL_ADDR" # Set size and animate slide down @@ -276,8 +289,5 @@ else if [ -n "$TERMINAL_ADDR" ]; then hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" fi - else - echo "Failed to create terminal" - exit 1 fi fi \ No newline at end of file -- cgit v1.2.3 From 713f9498329cd15457abe3d65b07ae9481510a22 Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" <85185940+JaKooLit@users.noreply.github.com> Date: Sat, 31 May 2025 20:28:08 +0000 Subject: Revert "Dropdown terminal improvements - Round 2" --- config/hypr/scripts/Dropterminal.sh | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh index a8e1cda3..51cdf31f 100755 --- a/config/hypr/scripts/Dropterminal.sh +++ b/config/hypr/scripts/Dropterminal.sh @@ -11,15 +11,9 @@ DEBUG=false SPECIAL_WS="special:scratchpad" ADDR_FILE="/tmp/dropdown_terminal_addr" -# Dropdown size and position configuration (percentages) -WIDTH_PERCENT=50 # Width as percentage of screen width -HEIGHT_PERCENT=50 # Height as percentage of screen height -X_PERCENT=25 # X position as percentage from left (25% centers a 50% width window) -Y_PERCENT=5 # Y position as percentage from top - # Animation settings ANIMATION_DURATION=100 # milliseconds -SLIDE_STEPS=5 +SLIDE_STEPS=10 SLIDE_DELAY=5 # milliseconds between steps # Parse arguments @@ -45,12 +39,6 @@ if [ -z "$TERMINAL_CMD" ]; then echo " $0 -d foot (with debug output)" echo " $0 'kitty -e zsh'" echo " $0 'alacritty --working-directory /home/user'" - echo "" - echo "Edit the script to modify size and position:" - echo " WIDTH_PERCENT - Width as percentage of screen (default: 50)" - echo " HEIGHT_PERCENT - Height as percentage of screen (default: 50)" - echo " X_PERCENT - X position from left as percentage (default: 25)" - echo " Y_PERCENT - Y position from top as percentage (default: 5)" exit 1 fi @@ -130,11 +118,11 @@ calculate_dropdown_position() { local mon_width=$(echo $monitor_info | cut -d' ' -f3) local mon_height=$(echo $monitor_info | cut -d' ' -f4) - # Calculate position and size based on percentages - local width=$((mon_width * WIDTH_PERCENT / 100)) - local height=$((mon_height * HEIGHT_PERCENT / 100)) - local x=$((mon_x + (mon_width * X_PERCENT / 100))) - local y=$((mon_y + (mon_height * Y_PERCENT / 100))) + # Calculate 50% width, 50% height, centered horizontally, 5% from top + local width=$((mon_width / 2)) + local height=$((mon_height / 2)) + local x=$((mon_x + (mon_width - width) / 2)) + local y=$((mon_y + mon_height / 20)) # 5% from top echo "$x $y $width $height" } @@ -187,7 +175,7 @@ spawn_terminal() { count_before=$(echo "$windows_before" | jq 'length') # Launch terminal directly in special workspace to avoid visible spawn - hyprctl dispatch exec "[float; size $width $height; stayfocused; workspace special:scratchpad silent] $TERMINAL_CMD" + hyprctl dispatch exec "[float; size $width $height; workspace special:scratchpad silent] $TERMINAL_CMD" # Wait for window to appear sleep 0.1 @@ -220,8 +208,7 @@ spawn_terminal() { sleep 0.2 # Now bring it back with the same animation as subsequent shows - # Use movetoworkspacesilent to avoid affecting workspace history - hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$new_addr" + hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$new_addr" hyprctl dispatch pin "address:$new_addr" animate_slide_down "$new_addr" "$target_x" "$target_y" "$width" "$height" @@ -247,8 +234,8 @@ if terminal_exists; then width=$(echo $pos_info | cut -d' ' -f3) height=$(echo $pos_info | cut -d' ' -f4) - # Use movetoworkspacesilent to avoid affecting workspace history - hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$TERMINAL_ADDR" + # Move to current workspace and pin + hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$TERMINAL_ADDR" hyprctl dispatch pin "address:$TERMINAL_ADDR" # Set size and animate slide down @@ -289,5 +276,8 @@ else if [ -n "$TERMINAL_ADDR" ]; then hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" fi + else + echo "Failed to create terminal" + exit 1 fi fi \ No newline at end of file -- cgit v1.2.3 From 4564b38d1b84888f153802cc5b4e9c32de4aa8a3 Mon Sep 17 00:00:00 2001 From: "Ja.KooLit" <85185940+JaKooLit@users.noreply.github.com> Date: Sat, 31 May 2025 20:37:06 +0000 Subject: Revert "Revert "Dropdown terminal improvements - Round 2"" --- config/hypr/scripts/Dropterminal.sh | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh index 51cdf31f..a8e1cda3 100755 --- a/config/hypr/scripts/Dropterminal.sh +++ b/config/hypr/scripts/Dropterminal.sh @@ -11,9 +11,15 @@ DEBUG=false SPECIAL_WS="special:scratchpad" ADDR_FILE="/tmp/dropdown_terminal_addr" +# Dropdown size and position configuration (percentages) +WIDTH_PERCENT=50 # Width as percentage of screen width +HEIGHT_PERCENT=50 # Height as percentage of screen height +X_PERCENT=25 # X position as percentage from left (25% centers a 50% width window) +Y_PERCENT=5 # Y position as percentage from top + # Animation settings ANIMATION_DURATION=100 # milliseconds -SLIDE_STEPS=10 +SLIDE_STEPS=5 SLIDE_DELAY=5 # milliseconds between steps # Parse arguments @@ -39,6 +45,12 @@ if [ -z "$TERMINAL_CMD" ]; then echo " $0 -d foot (with debug output)" echo " $0 'kitty -e zsh'" echo " $0 'alacritty --working-directory /home/user'" + echo "" + echo "Edit the script to modify size and position:" + echo " WIDTH_PERCENT - Width as percentage of screen (default: 50)" + echo " HEIGHT_PERCENT - Height as percentage of screen (default: 50)" + echo " X_PERCENT - X position from left as percentage (default: 25)" + echo " Y_PERCENT - Y position from top as percentage (default: 5)" exit 1 fi @@ -118,11 +130,11 @@ calculate_dropdown_position() { local mon_width=$(echo $monitor_info | cut -d' ' -f3) local mon_height=$(echo $monitor_info | cut -d' ' -f4) - # Calculate 50% width, 50% height, centered horizontally, 5% from top - local width=$((mon_width / 2)) - local height=$((mon_height / 2)) - local x=$((mon_x + (mon_width - width) / 2)) - local y=$((mon_y + mon_height / 20)) # 5% from top + # Calculate position and size based on percentages + local width=$((mon_width * WIDTH_PERCENT / 100)) + local height=$((mon_height * HEIGHT_PERCENT / 100)) + local x=$((mon_x + (mon_width * X_PERCENT / 100))) + local y=$((mon_y + (mon_height * Y_PERCENT / 100))) echo "$x $y $width $height" } @@ -175,7 +187,7 @@ spawn_terminal() { count_before=$(echo "$windows_before" | jq 'length') # Launch terminal directly in special workspace to avoid visible spawn - hyprctl dispatch exec "[float; size $width $height; workspace special:scratchpad silent] $TERMINAL_CMD" + hyprctl dispatch exec "[float; size $width $height; stayfocused; workspace special:scratchpad silent] $TERMINAL_CMD" # Wait for window to appear sleep 0.1 @@ -208,7 +220,8 @@ spawn_terminal() { sleep 0.2 # Now bring it back with the same animation as subsequent shows - hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$new_addr" + # Use movetoworkspacesilent to avoid affecting workspace history + hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$new_addr" hyprctl dispatch pin "address:$new_addr" animate_slide_down "$new_addr" "$target_x" "$target_y" "$width" "$height" @@ -234,8 +247,8 @@ if terminal_exists; then width=$(echo $pos_info | cut -d' ' -f3) height=$(echo $pos_info | cut -d' ' -f4) - # Move to current workspace and pin - hyprctl dispatch movetoworkspace "$CURRENT_WS,address:$TERMINAL_ADDR" + # Use movetoworkspacesilent to avoid affecting workspace history + hyprctl dispatch movetoworkspacesilent "$CURRENT_WS,address:$TERMINAL_ADDR" hyprctl dispatch pin "address:$TERMINAL_ADDR" # Set size and animate slide down @@ -276,8 +289,5 @@ else if [ -n "$TERMINAL_ADDR" ]; then hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" fi - else - echo "Failed to create terminal" - exit 1 fi fi \ No newline at end of file -- cgit v1.2.3 From e9c7d8a3882b1166c0ed99e4501e465937089b05 Mon Sep 17 00:00:00 2001 From: Kiran George Date: Sun, 1 Jun 2025 08:45:47 +0530 Subject: Fixed drop down terminal focus --- config/hypr/scripts/Dropterminal.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh index a8e1cda3..fa5b899b 100755 --- a/config/hypr/scripts/Dropterminal.sh +++ b/config/hypr/scripts/Dropterminal.sh @@ -187,7 +187,7 @@ spawn_terminal() { count_before=$(echo "$windows_before" | jq 'length') # Launch terminal directly in special workspace to avoid visible spawn - hyprctl dispatch exec "[float; size $width $height; stayfocused; workspace special:scratchpad silent] $TERMINAL_CMD" + hyprctl dispatch exec "[float; size $width $height; workspace special:scratchpad silent] $TERMINAL_CMD" # Wait for window to appear sleep 0.1 -- cgit v1.2.3 From 30ed636ba6c51b417cccb5acde1fbb8221b55b84 Mon Sep 17 00:00:00 2001 From: Kiran George Date: Sun, 1 Jun 2025 08:48:40 +0530 Subject: SwayNC DND bypass for volume and brightness notification --- config/hypr/scripts/Brightness.sh | 2 +- config/hypr/scripts/BrightnessKbd.sh | 2 +- config/hypr/scripts/Volume.sh | 14 +++++++------- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'config/hypr/scripts') diff --git a/config/hypr/scripts/Brightness.sh b/config/hypr/scripts/Brightness.sh index 8e5d525a..bf28fc8c 100755 --- a/config/hypr/scripts/Brightness.sh +++ b/config/hypr/scripts/Brightness.sh @@ -29,7 +29,7 @@ get_icon() { # Notify notify_user() { - notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i $icon "Screen" "Brightness:$current%" + notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -h boolean:SWAYNC_BYPASS_DND:true -u low -i $icon "Screen" "Brightness:$current%" } # Change brightness diff --git a/config/hypr/scripts/BrightnessKbd.sh b/config/hypr/scripts/BrightnessKbd.sh index 4c56bc03..24737b73 100755 --- a/config/hypr/scripts/BrightnessKbd.sh +++ b/config/hypr/scripts/BrightnessKbd.sh @@ -26,7 +26,7 @@ get_icon() { } # Notify notify_user() { - notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -u low -i "$icon" "Keyboard" "Brightness:$current%" + notify-send -e -h string:x-canonical-private-synchronous:brightness_notif -h int:value:$current -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$icon" "Keyboard" "Brightness:$current%" } # Change brightness diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index b205f8f9..8efdb55c 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -32,9 +32,9 @@ get_icon() { # Notify notify_user() { if [[ "$(get_volume)" == "Muted" ]]; then - notify-send -e -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" " Volume:" " Muted" + notify-send -e -h string:x-canonical-private-synchronous:volume_notif -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$(get_icon)" " Volume:" " Muted" else - notify-send -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -u low -i "$(get_icon)" " Volume Level:" " $(get_volume)" && + notify-send -e -h int:value:"$(get_volume | sed 's/%//')" -h string:x-canonical-private-synchronous:volume_notif -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$(get_icon)" " Volume Level:" " $(get_volume)" && "$sDIR/Sounds.sh" --volume fi } @@ -60,18 +60,18 @@ dec_volume() { # Toggle Mute toggle_mute() { if [ "$(pamixer --get-mute)" == "false" ]; then - pamixer -m && notify-send -e -u low -i "$iDIR/volume-mute.png" " Mute" + pamixer -m && notify-send -e -u low -h boolean:SWAYNC_BYPASS_DND:true -i "$iDIR/volume-mute.png" " Mute" elif [ "$(pamixer --get-mute)" == "true" ]; then - pamixer -u && notify-send -e -u low -i "$(get_icon)" " Volume:" " Switched ON" + pamixer -u && notify-send -e -u low -h boolean:SWAYNC_BYPASS_DND:true -i "$(get_icon)" " Volume:" " Switched ON" fi } # Toggle Mic toggle_mic() { if [ "$(pamixer --default-source --get-mute)" == "false" ]; then - pamixer --default-source -m && notify-send -e -u low -i "$iDIR/microphone-mute.png" " Microphone:" " Switched OFF" + pamixer --default-source -m && notify-send -e -u low -h boolean:SWAYNC_BYPASS_DND:true -i "$iDIR/microphone-mute.png" " Microphone:" " Switched OFF" elif [ "$(pamixer --default-source --get-mute)" == "true" ]; then - pamixer -u --default-source u && notify-send -e -u low -i "$iDIR/microphone.png" " Microphone:" " Switched ON" + pamixer -u --default-source u && notify-send -e -u low -h boolean:SWAYNC_BYPASS_DND:true -i "$iDIR/microphone.png" " Microphone:" " Switched ON" fi } # Get Mic Icon @@ -98,7 +98,7 @@ get_mic_volume() { notify_mic_user() { volume=$(get_mic_volume) icon=$(get_mic_icon) - notify-send -e -h int:value:"$volume" -h "string:x-canonical-private-synchronous:volume_notif" -u low -i "$icon" " Mic Level:" " $volume" + notify-send -e -h int:value:"$volume" -h "string:x-canonical-private-synchronous:volume_notif" -h boolean:SWAYNC_BYPASS_DND:true -u low -i "$icon" " Mic Level:" " $volume" } # Increase MIC Volume -- cgit v1.2.3