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

@@ -12,23 +12,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 1 \
# && hyprctl dispatch workspace $((current_workspace+2)) \
# && hyprctl dispatch focusmonitor 0
hyprctl --batch "
dispatch movetoworkspace $((window_at_workspace+1)) ;
dispatch focusmonitor 1 ;
dispatch workspace $((current_workspace+2)) ;
dispatch focusmonitor 0
"
exit 0
}
# NOTE: Di chuyển cửa sổ nếu vị trí X vượt qua ngưỡng
if [ $window_x_position -eq 1934 ] && [ $window_state -eq 1 ]; then
if [ $current_workspace -eq 8 ]; then
exit 1
fi
hyprctl dispatch movetoworkspace $((window_at_workspace+1)) \
&& hyprctl dispatch focusmonitor 1 \
&& hyprctl dispatch workspace $((current_workspace+2)) \
&& hyprctl dispatch focusmonitor 0
exit 0
move
fi
if [ $window_x_position -eq 1934 ] && [ $window_width -eq 1892 ]; then
@@ -36,11 +43,7 @@ if [ $window_x_position -eq 1934 ] && [ $window_width -eq 1892 ]; then
if [ $current_workspace -eq 8 ]; then
exit 1
fi
hyprctl dispatch movetoworkspace $((window_at_workspace+1)) \
&& hyprctl dispatch focusmonitor 1 \
&& hyprctl dispatch workspace $((current_workspace+2)) \
&& hyprctl dispatch focusmonitor 0
exit 0
move
fi
@@ -49,11 +52,7 @@ if [ $window_x_position -eq 2990 ]; then
if [ $current_workspace -eq 8 ]; then
exit 1
fi
hyprctl dispatch movetoworkspace $((window_at_workspace+1)) \
&& hyprctl dispatch focusmonitor 1 \
&& hyprctl dispatch workspace $((current_workspace+2)) \
&& hyprctl dispatch focusmonitor 0
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