custom-hypr - fix - drop fps when inactivity 10s

This commit is contained in:
huyjaky
2025-04-10 22:33:32 +07:00
parent 3537925aae
commit bde20ff733
31 changed files with 754 additions and 214 deletions

View File

@@ -1,31 +1,25 @@
#!/bin/bash
# Extract workspace ID from the output of hyprctl activewindow
current_monitor=$(hyprctl activeworkspace | grep 'monitorID' | awk '{print $2}')
current_workspace=$(hyprctl activeworkspace | grep 'workspace' | awk '{print $3}')
# Tắt globbing để tăng tốc
set -f
# Determine the second workspace based on whether the current workspace is even or odd
echo $current_workspace
echo $current_monitor
# Lấy thông tin từ JSON output
workspace_info=$(hyprctl activeworkspace -j)
current_monitor=$(echo "$workspace_info" | jq -r '.monitorID')
current_workspace=$(echo "$workspace_info" | jq -r '.id')
if [ $((current_workspace % 2)) -eq 0 ]; then
second_workspace=$((current_workspace - 1))
else
second_workspace=$((current_workspace + 1))
fi
# Tính toán second_workspace
second_workspace=$((current_workspace % 2 == 0 ? current_workspace - 1 : current_workspace + 1))
primary_monitor_workspace=$((current_workspace + 2)) # 1 + 2 =3
secondary_monitor_workspace=$((second_workspace + 2)) # 2 + 2 =4
# Tính toán workspace cho các monitor
primary_monitor_workspace=$((current_workspace + 2))
secondary_monitor_workspace=$((second_workspace + 2))
# Check if primary_monitor_workspace is less than or equal to 0
# or if secondary_monitor_workspace is greater than or equal to 11
if [ "$primary_monitor_workspace" -le 0 ] || [ "$secondary_monitor_workspace" -ge 9 ]; then
exit 1
fi
# Kiểm tra giới hạn workspace
[ "$primary_monitor_workspace" -le 0 ] || [ "$secondary_monitor_workspace" -ge 9 ] && exit 1
# Thực thi chuyển đổi workspace với tối ưu animation
hyprctl dispatch workspace "$primary_monitor_workspace"
hyprctl dispatch workspace "$secondary_monitor_workspace"
hyprctl --batch "
dispatch workspace $secondary_monitor_workspace ;
dispatch workspace $primary_monitor_workspace ;
"
exit 0