custom-hypr - synchronously multiple call

This commit is contained in:
huyjaky
2024-11-04 13:33:15 +07:00
parent d0d707a0c0
commit 1b2d31728e
11 changed files with 75 additions and 69 deletions

View File

@@ -13,23 +13,30 @@ window_state=$(echo "$window_info" | grep 'fullscreen:' | awk '{print $2}')
current_workspace=$(hyprctl activeworkspace | grep 'workspace' | awk '{print $3}')
window_width=$(echo "$window_info" | grep 'size:' | awk '{print $2}' | cut -d',' -f1)
echo $window_stat
echo $window_x_position
echo $window_width
hyprctl dispatch fullscreenstate 0 # minimize trước khi di chuyển
move(){
# hyprctl dispatch movetoworkspace $((window_at_workspace-1)) \
# && hyprctl dispatch focusmonitor 0 \
# && hyprctl dispatch workspace $((current_workspace-2)) \
# && hyprctl dispatch focusmonitor 1
hyprctl --batch "
dispatch movetoworkspace $((window_at_workspace-1)) ;
dispatch focusmonitor 0 ;
dispatch workspace $((current_workspace-2)) ;
dispatch focusmonitor 1
"
exit 0
}
# NOTE: Di chuyển cửa sổ nếu vị trí X vượt qua ngưỡng
if [ $window_x_position -eq 14 ] && [ $window_state -eq 1 ]; then
if [ $current_workspace -eq 1 ]; then
exit 1
fi
hyprctl dispatch movetoworkspace $((window_at_workspace-1)) \
&& hyprctl dispatch focusmonitor 0 \
&& hyprctl dispatch workspace $((current_workspace-2)) \
&& hyprctl dispatch focusmonitor 1
exit 0
move
fi
if [ $window_x_position -eq 14 ] && [ $window_width -eq 1892 ]; then
@@ -37,11 +44,7 @@ if [ $window_x_position -eq 14 ] && [ $window_width -eq 1892 ]; then
if [ $current_workspace -eq 1 ]; then
exit 1
fi
hyprctl dispatch movetoworkspace $((window_at_workspace-1)) \
&& hyprctl dispatch focusmonitor 0 \
&& hyprctl dispatch workspace $((current_workspace-2)) \
&& hyprctl dispatch focusmonitor 1
exit 0
move
fi
@@ -50,11 +53,7 @@ if [ $window_x_position -eq 14 ]; then
if [ $current_workspace -eq 1 ]; then
exit 1
fi
hyprctl dispatch movetoworkspace $((window_at_workspace-1)) \
&& hyprctl dispatch focusmonitor 0 \
&& hyprctl dispatch workspace $((current_workspace-2)) \
&& hyprctl dispatch focusmonitor 1
exit 0
move
fi
# Nếu không thoả điều kiện di chuyển, di chuyển cửa sổ sang phải