diff options
Diffstat (limited to 'config/hypr/scripts')
46 files changed, 497 insertions, 385 deletions
diff --git a/config/hypr/scripts/AirplaneMode.sh b/config/hypr/scripts/AirplaneMode.sh index 4379935d..548b9d6b 100755 --- a/config/hypr/scripts/AirplaneMode.sh +++ b/config/hypr/scripts/AirplaneMode.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Airplane Mode. Turning on or off all wifi using rfkill. diff --git a/config/hypr/scripts/Animations.sh b/config/hypr/scripts/Animations.sh index 477e5cd3..4bbe050f 100755 --- a/config/hypr/scripts/Animations.sh +++ b/config/hypr/scripts/Animations.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For applying Animations from different users diff --git a/config/hypr/scripts/Battery.sh b/config/hypr/scripts/Battery.sh index d7830058..2baed6ca 100644..100755 --- a/config/hypr/scripts/Battery.sh +++ b/config/hypr/scripts/Battery.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash for i in {0..3}; do if [ -f /sys/class/power_supply/BAT$i/capacity ]; then diff --git a/config/hypr/scripts/Brightness.sh b/config/hypr/scripts/Brightness.sh index 63fd02f3..ce443ef2 100755 --- a/config/hypr/scripts/Brightness.sh +++ b/config/hypr/scripts/Brightness.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Script for Monitor backlights (if supported) using brightnessctl diff --git a/config/hypr/scripts/BrightnessKbd.sh b/config/hypr/scripts/BrightnessKbd.sh index 24737b73..93e09d86 100755 --- a/config/hypr/scripts/BrightnessKbd.sh +++ b/config/hypr/scripts/BrightnessKbd.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Script for keyboard backlights (if supported) using brightnessctl diff --git a/config/hypr/scripts/ChangeBlur.sh b/config/hypr/scripts/ChangeBlur.sh index 895987a4..0060285b 100755 --- a/config/hypr/scripts/ChangeBlur.sh +++ b/config/hypr/scripts/ChangeBlur.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Script for changing blurs on the fly diff --git a/config/hypr/scripts/ChangeLayout.sh b/config/hypr/scripts/ChangeLayout.sh index b083fcdc..e2436b79 100755 --- a/config/hypr/scripts/ChangeLayout.sh +++ b/config/hypr/scripts/ChangeLayout.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # for changing Hyprland Layouts (Master or Dwindle) on the fly @@ -9,20 +9,14 @@ LAYOUT=$(hyprctl -j getoption general:layout | jq '.str' | sed 's/"//g') case $LAYOUT in "master") hyprctl keyword general:layout dwindle - hyprctl keyword unbind SUPER,J - hyprctl keyword unbind SUPER,K - hyprctl keyword bind SUPER,J,cyclenext - hyprctl keyword bind SUPER,K,cyclenext,prev + # SUPER+J/K are global and managed by KeybindsLayoutInit.sh; only manage SUPER+O here hyprctl keyword bind SUPER,O,togglesplit notify-send -e -u low -i "$notif" " Dwindle Layout" ;; "dwindle") hyprctl keyword general:layout master - hyprctl keyword unbind SUPER,J - hyprctl keyword unbind SUPER,K + # Drop togglesplit binding on SUPER+O when switching back to master hyprctl keyword unbind SUPER,O - hyprctl keyword bind SUPER,J,layoutmsg,cyclenext - hyprctl keyword bind SUPER,K,layoutmsg,cycleprev notify-send -e -u low -i "$notif" " Master Layout" ;; *) ;; diff --git a/config/hypr/scripts/ClipManager.sh b/config/hypr/scripts/ClipManager.sh index 9937b6f4..3ba5d91a 100755 --- a/config/hypr/scripts/ClipManager.sh +++ b/config/hypr/scripts/ClipManager.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Clipboard Manager. This script uses cliphist, rofi, and wl-copy. diff --git a/config/hypr/scripts/DarkLight.sh b/config/hypr/scripts/DarkLight.sh index 1bc1602f..e473efb2 100755 --- a/config/hypr/scripts/DarkLight.sh +++ b/config/hypr/scripts/DarkLight.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash ## /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For Dark and Light switching # Note: Scripts are looking for keywords Light or Dark except for wallpapers as the are in a separate directories diff --git a/config/hypr/scripts/Distro_update.sh b/config/hypr/scripts/Distro_update.sh index b0b1446b..2b3376e3 100755 --- a/config/hypr/scripts/Distro_update.sh +++ b/config/hypr/scripts/Distro_update.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Simple bash script to check and will try to update your system diff --git a/config/hypr/scripts/Dropterminal.sh b/config/hypr/scripts/Dropterminal.sh index 4833545c..9b2eeecb 100755 --- a/config/hypr/scripts/Dropterminal.sh +++ b/config/hypr/scripts/Dropterminal.sh @@ -1,9 +1,9 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # # Made and brought to by Kiran George # /* -- โจ https://github.com/SherLock707 โจ -- */ ## -# Dropdown Terminal +# Dropdown Terminal # Usage: ./Dropdown.sh [-d] <terminal_command> # Example: ./Dropdown.sh foot # ./Dropdown.sh -d foot (with debug output) @@ -15,186 +15,186 @@ 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 -Y_PERCENT=5 # Y position as percentage from top (X is auto-centered) +WIDTH_PERCENT=65 # Width as percentage of screen width +HEIGHT_PERCENT=65 # Height as percentage of screen height +Y_PERCENT=10 # Y position as percentage from top (X is auto-centered) # Animation settings -ANIMATION_DURATION=100 # milliseconds +ANIMATION_DURATION=100 # milliseconds SLIDE_STEPS=5 -SLIDE_DELAY=5 # milliseconds between steps +SLIDE_DELAY=5 # milliseconds between steps # Parse arguments if [ "$1" = "-d" ]; then - DEBUG=true - shift + DEBUG=true + shift fi TERMINAL_CMD="$1" # Debug echo function debug_echo() { - if [ "$DEBUG" = true ]; then - echo "$@" - fi + if [ "$DEBUG" = true ]; then + echo "$@" + fi } # Validate input if [ -z "$TERMINAL_CMD" ]; then - echo "Missing terminal command. Usage: $0 [-d] <terminal_command>" - echo "Examples:" - echo " $0 foot" - 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 " Y_PERCENT - Y position from top as percentage (default: 5)" - echo " Note: X position is automatically centered" - exit 1 + echo "Missing terminal command. Usage: $0 [-d] <terminal_command>" + echo "Examples:" + echo " $0 foot" + 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 " Y_PERCENT - Y position from top as percentage (default: 5)" + echo " Note: X position is automatically centered" + 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])"' + 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 + 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" + 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 including scale and name of focused monitor get_monitor_info() { - local monitor_data=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | "\(.x) \(.y) \(.width) \(.height) \(.scale) \(.name)"') - if [ -z "$monitor_data" ] || [[ "$monitor_data" =~ ^null ]]; then - debug_echo "Error: Could not get focused monitor information" - return 1 - fi - echo "$monitor_data" + local monitor_data=$(hyprctl monitors -j | jq -r '.[] | select(.focused == true) | "\(.x) \(.y) \(.width) \(.height) \(.scale) \(.name)"') + if [ -z "$monitor_data" ] || [[ "$monitor_data" =~ ^null ]]; then + debug_echo "Error: Could not get focused monitor information" + return 1 + fi + echo "$monitor_data" } # Function to calculate dropdown position with proper scaling and centering calculate_dropdown_position() { - local monitor_info=$(get_monitor_info) - - if [ $? -ne 0 ] || [ -z "$monitor_info" ]; then - debug_echo "Error: Failed to get monitor info, using fallback values" - echo "100 100 800 600 fallback-monitor" - return 1 - fi - - 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) - local mon_scale=$(echo $monitor_info | cut -d' ' -f5) - local mon_name=$(echo $monitor_info | cut -d' ' -f6) - - debug_echo "Monitor info: x=$mon_x, y=$mon_y, width=$mon_width, height=$mon_height, scale=$mon_scale" - - # Validate scale value and provide fallback - if [ -z "$mon_scale" ] || [ "$mon_scale" = "null" ] || [ "$mon_scale" = "0" ]; then - debug_echo "Invalid scale value, using 1.0 as fallback" - mon_scale="1.0" - fi - - # Calculate logical dimensions by dividing physical dimensions by scale - local logical_width logical_height - if command -v bc >/dev/null 2>&1; then - # Use bc for precise floating point calculation - logical_width=$(echo "scale=0; $mon_width / $mon_scale" | bc | cut -d'.' -f1) - logical_height=$(echo "scale=0; $mon_height / $mon_scale" | bc | cut -d'.' -f1) - else - # Fallback to integer math (multiply by 100 for precision, then divide) - local scale_int=$(echo "$mon_scale" | sed 's/\.//' | sed 's/^0*//') - if [ -z "$scale_int" ]; then scale_int=100; fi - - logical_width=$(((mon_width * 100) / scale_int)) - logical_height=$(((mon_height * 100) / scale_int)) - fi - - # Ensure we have valid integer values - if ! [[ "$logical_width" =~ ^-?[0-9]+$ ]]; then logical_width=$mon_width; fi - if ! [[ "$logical_height" =~ ^-?[0-9]+$ ]]; then logical_height=$mon_height; fi - - debug_echo "Physical resolution: ${mon_width}x${mon_height}" - debug_echo "Logical resolution: ${logical_width}x${logical_height} (physical รท scale)" - - # Calculate window dimensions based on LOGICAL space percentages - local width=$((logical_width * WIDTH_PERCENT / 100)) - local height=$((logical_height * HEIGHT_PERCENT / 100)) - - # Calculate Y position from top based on percentage of LOGICAL height - local y_offset=$((logical_height * Y_PERCENT / 100)) - - # Calculate centered X position in LOGICAL space - local x_offset=$(((logical_width - width) / 2)) - - # Apply monitor offset to get final positions in logical coordinates - local final_x=$((mon_x + x_offset)) - local final_y=$((mon_y + y_offset)) - - debug_echo "Window size: ${width}x${height} (logical pixels)" - debug_echo "Final position: x=$final_x, y=$final_y (logical coordinates)" - debug_echo "Hyprland will scale these to physical coordinates automatically" - - echo "$final_x $final_y $width $height $mon_name" + local monitor_info=$(get_monitor_info) + + if [ $? -ne 0 ] || [ -z "$monitor_info" ]; then + debug_echo "Error: Failed to get monitor info, using fallback values" + echo "100 100 800 600 fallback-monitor" + return 1 + fi + + 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) + local mon_scale=$(echo $monitor_info | cut -d' ' -f5) + local mon_name=$(echo $monitor_info | cut -d' ' -f6) + + debug_echo "Monitor info: x=$mon_x, y=$mon_y, width=$mon_width, height=$mon_height, scale=$mon_scale" + + # Validate scale value and provide fallback + if [ -z "$mon_scale" ] || [ "$mon_scale" = "null" ] || [ "$mon_scale" = "0" ]; then + debug_echo "Invalid scale value, using 1.0 as fallback" + mon_scale="1.0" + fi + + # Calculate logical dimensions by dividing physical dimensions by scale + local logical_width logical_height + if command -v bc >/dev/null 2>&1; then + # Use bc for precise floating point calculation + logical_width=$(echo "scale=0; $mon_width / $mon_scale" | bc | cut -d'.' -f1) + logical_height=$(echo "scale=0; $mon_height / $mon_scale" | bc | cut -d'.' -f1) + else + # Fallback to integer math (multiply by 100 for precision, then divide) + local scale_int=$(echo "$mon_scale" | sed 's/\.//' | sed 's/^0*//') + if [ -z "$scale_int" ]; then scale_int=100; fi + + logical_width=$(((mon_width * 100) / scale_int)) + logical_height=$(((mon_height * 100) / scale_int)) + fi + + # Ensure we have valid integer values + if ! [[ "$logical_width" =~ ^-?[0-9]+$ ]]; then logical_width=$mon_width; fi + if ! [[ "$logical_height" =~ ^-?[0-9]+$ ]]; then logical_height=$mon_height; fi + + debug_echo "Physical resolution: ${mon_width}x${mon_height}" + debug_echo "Logical resolution: ${logical_width}x${logical_height} (physical รท scale)" + + # Calculate window dimensions based on LOGICAL space percentages + local width=$((logical_width * WIDTH_PERCENT / 100)) + local height=$((logical_height * HEIGHT_PERCENT / 100)) + + # Calculate Y position from top based on percentage of LOGICAL height + local y_offset=$((logical_height * Y_PERCENT / 100)) + + # Calculate centered X position in LOGICAL space + local x_offset=$(((logical_width - width) / 2)) + + # Apply monitor offset to get final positions in logical coordinates + local final_x=$((mon_x + x_offset)) + local final_y=$((mon_y + y_offset)) + + debug_echo "Window size: ${width}x${height} (logical pixels)" + debug_echo "Final position: x=$final_x, y=$final_y (logical coordinates)" + debug_echo "Hyprland will scale these to physical coordinates automatically" + + echo "$final_x $final_y $width $height $mon_name" } # Get the current workspace @@ -202,179 +202,179 @@ 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 - cut -d' ' -f1 "$ADDR_FILE" - fi + if [ -f "$ADDR_FILE" ] && [ -s "$ADDR_FILE" ]; then + cut -d' ' -f1 "$ADDR_FILE" + fi } # Function to get stored monitor name get_terminal_monitor() { - if [ -f "$ADDR_FILE" ] && [ -s "$ADDR_FILE" ]; then - cut -d' ' -f2- "$ADDR_FILE" - fi + if [ -f "$ADDR_FILE" ] && [ -s "$ADDR_FILE" ]; then + cut -d' ' -f2- "$ADDR_FILE" + fi } # Function to check if terminal exists terminal_exists() { - 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 + 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() { - 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 + 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 spawn terminal and capture its address spawn_terminal() { - debug_echo "Creating new dropdown terminal with command: $TERMINAL_CMD" - - # Calculate dropdown position for later use - local pos_info=$(calculate_dropdown_position) - if [ $? -ne 0 ]; then - debug_echo "Warning: Using fallback positioning" - fi - - local target_x=$(echo $pos_info | cut -d' ' -f1) - local target_y=$(echo $pos_info | cut -d' ' -f2) - local width=$(echo $pos_info | cut -d' ' -f3) - local height=$(echo $pos_info | cut -d' ' -f4) - local monitor_name=$(echo $pos_info | cut -d' ' -f5) - - debug_echo "Target position: ${target_x},${target_y}, size: ${width}x${height}" - - # Get window count before spawning - local windows_before=$(hyprctl clients -j) - local 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 0.1 - - # Get windows after spawning - local windows_after=$(hyprctl clients -j) - local count_after=$(echo "$windows_after" | jq 'length') - - local new_addr="" - - if [ "$count_after" -gt "$count_before" ]; then - # Find the new window by comparing before/after lists - new_addr=$(comm -13 \ - <(echo "$windows_before" | jq -r '.[].address' | sort) \ - <(echo "$windows_after" | jq -r '.[].address' | sort) \ - | head -1) - fi - - # Fallback: try to find by the most recently mapped window - 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 and monitor name - echo "$new_addr $monitor_name" > "$ADDR_FILE" - debug_echo "Terminal created with address: $new_addr in special workspace on monitor $monitor_name" - - # Small delay to ensure it's properly in special workspace - 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 pin "address:$new_addr" - animate_slide_down "$new_addr" "$target_x" "$target_y" "$width" "$height" - - return 0 - fi - - debug_echo "Failed to get terminal address" - return 1 + debug_echo "Creating new dropdown terminal with command: $TERMINAL_CMD" + + # Calculate dropdown position for later use + local pos_info=$(calculate_dropdown_position) + if [ $? -ne 0 ]; then + debug_echo "Warning: Using fallback positioning" + fi + + local target_x=$(echo $pos_info | cut -d' ' -f1) + local target_y=$(echo $pos_info | cut -d' ' -f2) + local width=$(echo $pos_info | cut -d' ' -f3) + local height=$(echo $pos_info | cut -d' ' -f4) + local monitor_name=$(echo $pos_info | cut -d' ' -f5) + + debug_echo "Target position: ${target_x},${target_y}, size: ${width}x${height}" + + # Get window count before spawning + local windows_before=$(hyprctl clients -j) + local 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 0.1 + + # Get windows after spawning + local windows_after=$(hyprctl clients -j) + local count_after=$(echo "$windows_after" | jq 'length') + + local new_addr="" + + if [ "$count_after" -gt "$count_before" ]; then + # Find the new window by comparing before/after lists + new_addr=$(comm -13 \ + <(echo "$windows_before" | jq -r '.[].address' | sort) \ + <(echo "$windows_after" | jq -r '.[].address' | sort) | + head -1) + fi + + # Fallback: try to find by the most recently mapped window + 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 and monitor name + echo "$new_addr $monitor_name" >"$ADDR_FILE" + debug_echo "Terminal created with address: $new_addr in special workspace on monitor $monitor_name" + + # Small delay to ensure it's properly in special workspace + 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 pin "address:$new_addr" + animate_slide_down "$new_addr" "$target_x" "$target_y" "$width" "$height" + + 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" - focused_monitor=$(get_monitor_info | awk '{print $6}') - dropdown_monitor=$(get_terminal_monitor) - if [ "$focused_monitor" != "$dropdown_monitor" ]; then - debug_echo "Monitor focus changed: moving dropdown to $focused_monitor" - # Calculate new position for focused monitor - 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) - monitor_name=$(echo $pos_info | cut -d' ' -f5) - # Move and resize window - hyprctl dispatch movewindowpixel "exact $target_x $target_y,address:$TERMINAL_ADDR" - hyprctl dispatch resizewindowpixel "exact $width $height,address:$TERMINAL_ADDR" - # Update ADDR_FILE - echo "$TERMINAL_ADDR $monitor_name" > "$ADDR_FILE" - fi + TERMINAL_ADDR=$(get_terminal_address) + debug_echo "Found existing terminal: $TERMINAL_ADDR" + focused_monitor=$(get_monitor_info | awk '{print $6}') + dropdown_monitor=$(get_terminal_monitor) + if [ "$focused_monitor" != "$dropdown_monitor" ]; then + debug_echo "Monitor focus changed: moving dropdown to $focused_monitor" + # Calculate new position for focused monitor + 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) + monitor_name=$(echo $pos_info | cut -d' ' -f5) + # Move and resize window + hyprctl dispatch movewindowpixel "exact $target_x $target_y,address:$TERMINAL_ADDR" + hyprctl dispatch resizewindowpixel "exact $width $height,address:$TERMINAL_ADDR" + # Update ADDR_FILE + echo "$TERMINAL_ADDR $monitor_name" >"$ADDR_FILE" + fi - if terminal_in_special; then - 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) - - # 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 - 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" + if terminal_in_special; then + 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) + + # 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 + 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 "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 "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 + 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" - if spawn_terminal; then - TERMINAL_ADDR=$(get_terminal_address) - if [ -n "$TERMINAL_ADDR" ]; then - hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" - fi + debug_echo "No existing terminal found, creating new one" + if spawn_terminal; then + TERMINAL_ADDR=$(get_terminal_address) + if [ -n "$TERMINAL_ADDR" ]; then + hyprctl dispatch focuswindow "address:$TERMINAL_ADDR" fi + fi fi diff --git a/config/hypr/scripts/GameMode.sh b/config/hypr/scripts/GameMode.sh index 7a39da3d..59cf7372 100755 --- a/config/hypr/scripts/GameMode.sh +++ b/config/hypr/scripts/GameMode.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Game Mode. Turning off all animations @@ -20,6 +20,7 @@ if [ "$HYPRGAMEMODE" = 1 ] ; then hyprctl keyword "windowrule opacity 1 override 1 override 1 override, ^(.*)$" swww kill notify-send -e -u low -i "$notif" " Gamemode:" " enabled" + sleep 0.1 exit else swww-daemon --format xrgb && swww img "$HOME/.config/rofi/.current_wallpaper" & diff --git a/config/hypr/scripts/Hypridle.sh b/config/hypr/scripts/Hypridle.sh index 56176716..6acff434 100755 --- a/config/hypr/scripts/Hypridle.sh +++ b/config/hypr/scripts/Hypridle.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # This is for custom version of waybar idle_inhibitor which activates / deactivates hypridle instead diff --git a/config/hypr/scripts/Hyprsunset.sh b/config/hypr/scripts/Hyprsunset.sh index c7c4b395..4a2b52f4 100755 --- a/config/hypr/scripts/Hyprsunset.sh +++ b/config/hypr/scripts/Hyprsunset.sh @@ -8,12 +8,12 @@ set -euo pipefail # - On: sunset icon if available, otherwise a blue sun # # Customize via env vars: -# HYPERSUNSET_TEMP default 4500 (K) -# HYPERSUNSET_ICON_MODE sunset|blue (default: sunset) +# HYPRSUNSET_TEMP default 4500 (K) +# HYPRSUNSET_ICON_MODE sunset|blue (default: sunset) STATE_FILE="$HOME/.cache/.hyprsunset_state" -TARGET_TEMP="${HYPERSUNSET_TEMP:-4500}" -ICON_MODE="${HYPERSUNSET_ICON_MODE:-sunset}" +TARGET_TEMP="${HYPRSUNSET_TEMP:-4500}" +ICON_MODE="${HYPRSUNSET_ICON_MODE:-sunset}" ensure_state() { [[ -f "$STATE_FILE" ]] || echo "off" > "$STATE_FILE" @@ -92,8 +92,20 @@ cmd_status() { printf '{"text":"%s","class":"%s","tooltip":"%s"}\n' "$txt" "$cls" "$tip" } +cmd_init() { + ensure_state + state="$(cat "$STATE_FILE" || echo off)" + + if [[ "$state" == "on" ]]; then + if command -v hyprsunset >/dev/null 2>&1; then + nohup hyprsunset -t "$TARGET_TEMP" >/dev/null 2>&1 & + fi + fi +} + case "${1:-}" in toggle) cmd_toggle ;; status) cmd_status ;; - *) echo "usage: $0 [toggle|status]" >&2; exit 2 ;; + init) cmd_init ;; + *) echo "usage: $0 [toggle|status|init]" >&2; exit 2 ;; esac diff --git a/config/hypr/scripts/KeyBinds.sh b/config/hypr/scripts/KeyBinds.sh index 9c6b5ab7..46953cc5 100755 --- a/config/hypr/scripts/KeyBinds.sh +++ b/config/hypr/scripts/KeyBinds.sh @@ -1,6 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## -# searchable enabled keybinds using rofi +# searchable enabled keybinds using rofi (supports bindd descriptions) # kill yad to not interfere with this binds pkill yad || true @@ -17,23 +17,66 @@ laptop_conf="$HOME/.config/hypr/UserConfigs/Laptops.conf" rofi_theme="$HOME/.config/rofi/config-keybinds.rasi" msg='โฃ๏ธ NOTE โฃ๏ธ: Clicking with Mouse or Pressing ENTER will have NO function' -# combine the contents of the keybinds files and filter for keybinds -keybinds=$(cat "$keybinds_conf" "$user_keybinds_conf" | grep -E '^bind') +# collect raw bind lines (strip end-of-line comments) from available files +files=("$keybinds_conf" "$user_keybinds_conf") +[[ -f "$laptop_conf" ]] && files+=("$laptop_conf") -# check if laptop.conf exists and add its keybinds if present -if [[ -f "$laptop_conf" ]]; then - laptop_binds=$(grep -E '^bind' "$laptop_conf") - keybinds+=$'\n'"$laptop_binds" -fi +raw_keybinds=$(cat "${files[@]}" 2>/dev/null \ + | grep -E '^[[:space:]]*bind' \ + | sed -E 's/[[:space:]]+#.*$//') # check for any keybinds to display -if [[ -z "$keybinds" ]]; then +if [[ -z "$raw_keybinds" ]]; then echo "no keybinds found." exit 1 fi -# replace $mainmod with super in the displayed keybinds for rofi -display_keybinds=$(echo "$keybinds" | sed 's/\$mainMod/SUPER/g') +# transform into a readable list: MODS+KEY โ DESCRIPTION โ DISPATCHER [PARAMS] +display_keybinds=$(echo "$raw_keybinds" | awk -F'=' ' + function trim(s){ gsub(/^[ \t]+|[ \t]+$/,"",s); return s } + /^[[:space:]]*bind/ { + binder=$1; gsub(/[ \t]/, "", binder); + hasdesc = (index(binder, "d")>0); + + rhs=$2; rhs=trim(rhs); + n=split(rhs, a, /[ \t]*,[ \t]*/); + + mods=trim(a[1]); key=(n>=2?trim(a[2]):""); + desc=""; dispatcher=""; params=""; + + if (hasdesc) { + desc=(n>=3?trim(a[3]):""); + dispatcher=(n>=4?trim(a[4]):""); + start=5; + } else { + dispatcher=(n>=3?trim(a[3]):""); + start=4; + } + + for(i=start;i<=n;i++){ if(length(a[i])){ p=trim(a[i]); if(p!="") params = (params?params", ":"") p } } + + gsub(/\$mainMod/,"SUPER",mods); + gsub(/[ \t]+/,"+",mods); + + combo = (mods && key) ? mods "+" key : (key?key:mods); + + if (desc != "") { + if (dispatcher != "" && params != "") + print combo, " โ ", desc, " โ ", dispatcher, " ", params; + else if (dispatcher != "") + print combo, " โ ", desc, " โ ", dispatcher; + else + print combo, " โ ", desc; + } else { + if (dispatcher != "" && params != "") + print combo, " โ ", dispatcher, " ", params; + else if (dispatcher != "") + print combo, " โ ", dispatcher; + else + print combo; + } + } +') -# use rofi to display the keybinds with the modified content -echo "$display_keybinds" | rofi -dmenu -i -config "$rofi_theme" -mesg "$msg"
\ No newline at end of file +# use rofi to display the keybinds +printf '%s\n' "$display_keybinds" | rofi -dmenu -i -config "$rofi_theme" -mesg "$msg" diff --git a/config/hypr/scripts/KeyHints.sh b/config/hypr/scripts/KeyHints.sh index 7917ae3a..8a478039 100755 --- a/config/hypr/scripts/KeyHints.sh +++ b/config/hypr/scripts/KeyHints.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # GDK BACKEND. Change to either wayland or x11 if having issues diff --git a/config/hypr/scripts/KeybindsLayoutInit.sh b/config/hypr/scripts/KeybindsLayoutInit.sh new file mode 100755 index 00000000..0a53eaaf --- /dev/null +++ b/config/hypr/scripts/KeybindsLayoutInit.sh @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## +# Initialize J/K keybinds so they always cycle windows globally (no layout-specific behavior) +# This avoids double-actions when layouts change. + +set -euo pipefail + +# Always reset and bind SUPER+J/K the same way on startup +hyprctl keyword unbind SUPER,J || true +hyprctl keyword unbind SUPER,K || true + +# Cycle windows globally: J = next, K = previous +hyprctl keyword bind SUPER,J,cyclenext +hyprctl keyword bind SUPER,K,cyclenext,prev diff --git a/config/hypr/scripts/KillActiveProcess.sh b/config/hypr/scripts/KillActiveProcess.sh index bee146d7..2bc108f2 100755 --- a/config/hypr/scripts/KillActiveProcess.sh +++ b/config/hypr/scripts/KillActiveProcess.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Copied from Discord post. Thanks to @Zorg diff --git a/config/hypr/scripts/Kitty_themes.sh b/config/hypr/scripts/Kitty_themes.sh index 48bfa99f..55da7e44 100755 --- a/config/hypr/scripts/Kitty_themes.sh +++ b/config/hypr/scripts/Kitty_themes.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ย # # Kitty Themes Source https://github.com/dexpota/kitty-themes # diff --git a/config/hypr/scripts/KooLsDotsUpdate.sh b/config/hypr/scripts/KooLsDotsUpdate.sh index f4b8814a..51277ab1 100755 --- a/config/hypr/scripts/KooLsDotsUpdate.sh +++ b/config/hypr/scripts/KooLsDotsUpdate.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # simple bash script to check if update is available by comparing local version and github version diff --git a/config/hypr/scripts/Kool_Quick_Settings.sh b/config/hypr/scripts/Kool_Quick_Settings.sh index e43749bf..16742492 100755 --- a/config/hypr/scripts/Kool_Quick_Settings.sh +++ b/config/hypr/scripts/Kool_Quick_Settings.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Rofi menu for KooL Hyprland Quick Settings (SUPER SHIFT E) @@ -55,10 +55,10 @@ main() { case "$choice" in "view/edit User Defaults") file="$UserConfigs/01-UserDefaults.conf" ;; "view/edit ENV variables") file="$UserConfigs/ENVariables.conf" ;; - "view/edit Window Rules") file="$UserConfigs/WindowRules.conf" ;; + "view/edit Window Rules") file="$configs/WindowRules.conf" ;; "view/edit User Keybinds") file="$UserConfigs/UserKeybinds.conf" ;; "view/edit User Settings") file="$UserConfigs/UserSettings.conf" ;; - "view/edit Startup Apps") file="$UserConfigs/Startup_Apps.conf" ;; + "view/edit Startup Apps") file="$configs/Startup_Apps.conf" ;; "view/edit Decorations") file="$UserConfigs/UserDecorations.conf" ;; "view/edit Animations") file="$UserConfigs/UserAnimations.conf" ;; "view/edit Laptop Keybinds") file="$UserConfigs/Laptops.conf" ;; diff --git a/config/hypr/scripts/LockScreen.sh b/config/hypr/scripts/LockScreen.sh index 5e799181..d58f5c21 100755 --- a/config/hypr/scripts/LockScreen.sh +++ b/config/hypr/scripts/LockScreen.sh @@ -1,7 +1,11 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For Hyprlock -#pidof hyprlock || hyprlock -q +#pidof hyprlock || hyprlock -q + +# Ensure weather cache is up-to-date before locking (Waybar/lockscreen readers) +bash "$HOME/.config/hypr/UserScripts/WeatherWrap.sh" >/dev/null 2>&1 + +loginctl lock-session -loginctl lock-session
\ No newline at end of file diff --git a/config/hypr/scripts/MediaCtrl.sh b/config/hypr/scripts/MediaCtrl.sh index 000c3ade..9dc3571d 100755 --- a/config/hypr/scripts/MediaCtrl.sh +++ b/config/hypr/scripts/MediaCtrl.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Playerctl diff --git a/config/hypr/scripts/MonitorProfiles.sh b/config/hypr/scripts/MonitorProfiles.sh index 67316c09..1176a46a 100755 --- a/config/hypr/scripts/MonitorProfiles.sh +++ b/config/hypr/scripts/MonitorProfiles.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For applying Pre-configured Monitor Profiles diff --git a/config/hypr/scripts/OverviewToggle.sh b/config/hypr/scripts/OverviewToggle.sh new file mode 100755 index 00000000..2737234c --- /dev/null +++ b/config/hypr/scripts/OverviewToggle.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ # +# Overview toggle wrapper - tries Quickshell first, falls back to AGS + +set -euo pipefail + +# 1) Try Quickshell via Hyprland global dispatch (works if QS is running and listening) +# Only attempt this if a Quickshell process is running; otherwise Hyprland will +# still return success for the dispatch and we'll never fall back to AGS. +if pgrep -x quickshell >/dev/null 2>&1; then + if hyprctl dispatch global quickshell:overviewToggle >/dev/null 2>&1; then + exit 0 + fi +fi + +# If QS isn't running, but the CLI exists, try starting it and retry once +if command -v qs >/dev/null 2>&1; then + qs >/dev/null 2>&1 & + sleep 0.6 + if hyprctl dispatch global quickshell:overviewToggle >/dev/null 2>&1; then + exit 0 + fi +fi + +# 2) Fall back to AGS template +if command -v ags >/dev/null 2>&1; then + pkill rofi || true + if ags -t 'overview' >/dev/null 2>&1; then + exit 0 + fi + # If it failed, try starting AGS daemon then call the template + ags >/dev/null 2>&1 & + sleep 0.6 + if ags -t 'overview' >/dev/null 2>&1; then + exit 0 + fi +fi + +# If we get here, neither worked +notify-send "Overview" "Neither Quickshell nor AGS is available" -u low 2>/dev/null || true +exit 1 diff --git a/config/hypr/scripts/Polkit-NixOS.sh b/config/hypr/scripts/Polkit-NixOS.sh index 51675eff..28642d19 100755 --- a/config/hypr/scripts/Polkit-NixOS.sh +++ b/config/hypr/scripts/Polkit-NixOS.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For NixOS starting of polkit-gnome. Dec 2023, the settings stated in NixOS wiki does not work so have to manual start it diff --git a/config/hypr/scripts/Polkit.sh b/config/hypr/scripts/Polkit.sh index dcea7653..1af8fd1b 100755 --- a/config/hypr/scripts/Polkit.sh +++ b/config/hypr/scripts/Polkit.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # This script starts the first available Polkit agent from a list of possible locations diff --git a/config/hypr/scripts/PortalHyprland.sh b/config/hypr/scripts/PortalHyprland.sh index 9bdf4b8c..21cb7db4 100755 --- a/config/hypr/scripts/PortalHyprland.sh +++ b/config/hypr/scripts/PortalHyprland.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For manually starting xdg-desktop-portal-hyprland diff --git a/config/hypr/scripts/Refresh.sh b/config/hypr/scripts/Refresh.sh index 719c368d..76757aa4 100755 --- a/config/hypr/scripts/Refresh.sh +++ b/config/hypr/scripts/Refresh.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Scripts for refreshing ags, waybar, rofi, swaync, wallust @@ -7,23 +7,25 @@ UserScripts=$HOME/.config/hypr/UserScripts # Define file_exists function file_exists() { - if [ -e "$1" ]; then - return 0 # File exists - else - return 1 # File does not exist - fi + if [ -e "$1" ]; then + return 0 # File exists + else + return 1 # File does not exist + fi } # Kill already running processes _ps=(waybar rofi swaync ags) for _prs in "${_ps[@]}"; do - if pidof "${_prs}" >/dev/null; then - pkill "${_prs}" - fi + if pidof "${_prs}" >/dev/null; then + pkill "${_prs}" + fi done # added since wallust sometimes not applying -killall -SIGUSR2 waybar +killall -SIGUSR2 waybar +# Added sleep for GameMode causing multiple waybar +sleep 0.1 # quit ags & relaunch ags #ags -q && ags & @@ -33,23 +35,24 @@ killall -SIGUSR2 waybar # some process to kill for pid in $(pidof waybar rofi swaync ags swaybg); do - kill -SIGUSR1 "$pid" + kill -SIGUSR1 "$pid" + sleep 0.1 done #Restart waybar -sleep 1 +sleep 0.1 waybar & # relaunch swaync -sleep 0.5 -swaync > /dev/null 2>&1 & +sleep 0.3 +swaync >/dev/null 2>&1 & # reload swaync swaync-client --reload-config # Relaunching rainbow borders if the script exists sleep 1 if file_exists "${UserScripts}/RainbowBorders.sh"; then - ${UserScripts}/RainbowBorders.sh & + ${UserScripts}/RainbowBorders.sh & fi -exit 0
\ No newline at end of file +exit 0 diff --git a/config/hypr/scripts/RefreshNoWaybar.sh b/config/hypr/scripts/RefreshNoWaybar.sh index 8454124e..54c760bd 100755 --- a/config/hypr/scripts/RefreshNoWaybar.sh +++ b/config/hypr/scripts/RefreshNoWaybar.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Modified version of Refresh.sh but waybar wont refresh diff --git a/config/hypr/scripts/RofiEmoji.sh b/config/hypr/scripts/RofiEmoji.sh index 4570831e..7e3ef0f3 100755 --- a/config/hypr/scripts/RofiEmoji.sh +++ b/config/hypr/scripts/RofiEmoji.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Variables diff --git a/config/hypr/scripts/RofiSearch.sh b/config/hypr/scripts/RofiSearch.sh index 4218bed3..8ef12c46 100755 --- a/config/hypr/scripts/RofiSearch.sh +++ b/config/hypr/scripts/RofiSearch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For Searching via web browsers diff --git a/config/hypr/scripts/RofiThemeSelector-modified.sh b/config/hypr/scripts/RofiThemeSelector-modified.sh index 2cfc2d24..d6a353c0 100755 --- a/config/hypr/scripts/RofiThemeSelector-modified.sh +++ b/config/hypr/scripts/RofiThemeSelector-modified.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # A modified version of Rofi-Theme-Selector, concentrating only on ~/.local and also, applying only 10 @themes in ~/.config/rofi/config.rasi # as opposed to continous adding of //@theme diff --git a/config/hypr/scripts/RofiThemeSelector.sh b/config/hypr/scripts/RofiThemeSelector.sh index 8b2fcb71..b7236e8f 100755 --- a/config/hypr/scripts/RofiThemeSelector.sh +++ b/config/hypr/scripts/RofiThemeSelector.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ย # # Rofi Themes - Script to preview and apply themes by live-reloading the config. diff --git a/config/hypr/scripts/ScreenShot.sh b/config/hypr/scripts/ScreenShot.sh index 0a37c7e4..0ef70964 100755 --- a/config/hypr/scripts/ScreenShot.sh +++ b/config/hypr/scripts/ScreenShot.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Screenshots scripts diff --git a/config/hypr/scripts/Sounds.sh b/config/hypr/scripts/Sounds.sh index 8b2cc76e..b372d714 100755 --- a/config/hypr/scripts/Sounds.sh +++ b/config/hypr/scripts/Sounds.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # This script is used to play system sounds. # Script is used by Volume.Sh and ScreenShots.sh diff --git a/config/hypr/scripts/SwitchKeyboardLayout.sh b/config/hypr/scripts/SwitchKeyboardLayout.sh index f505fa6c..18a9517e 100755 --- a/config/hypr/scripts/SwitchKeyboardLayout.sh +++ b/config/hypr/scripts/SwitchKeyboardLayout.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # This is for changing kb_layouts. Set kb_layouts in $settings_file diff --git a/config/hypr/scripts/Tak0-Autodispatch.sh b/config/hypr/scripts/Tak0-Autodispatch.sh index a1f72129..114a3e8e 100755 --- a/config/hypr/scripts/Tak0-Autodispatch.sh +++ b/config/hypr/scripts/Tak0-Autodispatch.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # USAGE / ะะะกะขะ ะฃะะฆะะฏ: # 1) Run from terminal: # ./dispatch.sh <application_command> <target_workspace_number> diff --git a/config/hypr/scripts/TouchPad.sh b/config/hypr/scripts/TouchPad.sh index 8509d79f..030c36de 100755 --- a/config/hypr/scripts/TouchPad.sh +++ b/config/hypr/scripts/TouchPad.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # For disabling touchpad. # Edit the Touchpad_Device on ~/.config/hypr/UserConfigs/Laptops.conf according to your system diff --git a/config/hypr/scripts/Volume.sh b/config/hypr/scripts/Volume.sh index 8efdb55c..4c82f543 100755 --- a/config/hypr/scripts/Volume.sh +++ b/config/hypr/scripts/Volume.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Scripts for volume controls for audio and mic diff --git a/config/hypr/scripts/WallustSwww.sh b/config/hypr/scripts/WallustSwww.sh index 5e0148ee..657f41ab 100755 --- a/config/hypr/scripts/WallustSwww.sh +++ b/config/hypr/scripts/WallustSwww.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Wallust: derive colors from the current wallpaper and update templates # Usage: WallustSwww.sh [absolute_path_to_wallpaper] diff --git a/config/hypr/scripts/WaybarLayout.sh b/config/hypr/scripts/WaybarLayout.sh index b4d9c493..d3725a91 100755 --- a/config/hypr/scripts/WaybarLayout.sh +++ b/config/hypr/scripts/WaybarLayout.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Script for waybar layout or configs @@ -50,7 +50,7 @@ main() { [[ -z "$choice" ]] && { echo "No option selected. Exiting."; exit 0; } # Strip marker before applying - choice=${choice# $MARKER} + choice=${choice#"$MARKER "} case "$choice" in "no panel") diff --git a/config/hypr/scripts/WaybarScripts.sh b/config/hypr/scripts/WaybarScripts.sh index 7b3aaba2..d2205c42 100755 --- a/config/hypr/scripts/WaybarScripts.sh +++ b/config/hypr/scripts/WaybarScripts.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ # # This file used on waybar modules sourcing defaults set in $HOME/.config/hypr/UserConfigs/01-UserDefaults.conf diff --git a/config/hypr/scripts/WaybarStyles.sh b/config/hypr/scripts/WaybarStyles.sh index a439f8eb..8ebfed92 100755 --- a/config/hypr/scripts/WaybarStyles.sh +++ b/config/hypr/scripts/WaybarStyles.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # Script for waybar styles @@ -51,7 +51,7 @@ main() { [[ -z "$choice" ]] && { echo "No option selected. Exiting."; exit 0; } # remove annotation and apply - choice=${choice# $MARKER} + choice=${choice#"$MARKER "} apply_style "$choice" } diff --git a/config/hypr/scripts/Wlogout.sh b/config/hypr/scripts/Wlogout.sh index f552b83d..8879858c 100755 --- a/config/hypr/scripts/Wlogout.sh +++ b/config/hypr/scripts/Wlogout.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ ## # wlogout (Power, Screen Lock, Suspend, etc) diff --git a/config/hypr/scripts/sddm_wallpaper.sh b/config/hypr/scripts/sddm_wallpaper.sh index 9487188c..9dca2f72 100644..100755 --- a/config/hypr/scripts/sddm_wallpaper.sh +++ b/config/hypr/scripts/sddm_wallpaper.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # /* ---- ๐ซ https://github.com/JaKooLit ๐ซ ---- */ # SDDM Wallpaper and Wallust Colors Setter |
