diff options
| author | 魏曹先生 <1992414357@qq.com> | 2025-11-20 21:39:14 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-08-14 05:08:56 +0800 |
| commit | 25c5e0b1704b7d7cc4a37619a508c592f6a794c0 (patch) | |
| tree | 3de9056d74619d0922b85e4920af29b5648844de /scripts/toggle_float_center.sh | |
Add initial Hyprland configuration
This commit introduces the base Hyprland setup including: - Monitor
configuration for dual display setup - Default applications and
keybindings - Window management rules and animations - Autostart
services (waybar, hyprpaper, fcitx5) - Custom scripts for window
toggling - Hyprspace plugin for workspace overview
Diffstat (limited to 'scripts/toggle_float_center.sh')
| -rwxr-xr-x | scripts/toggle_float_center.sh | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/scripts/toggle_float_center.sh b/scripts/toggle_float_center.sh new file mode 100755 index 0000000..889430c --- /dev/null +++ b/scripts/toggle_float_center.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +# 使用 grep 检查浮动状态 +FLOATING=$(hyprctl activewindow | grep -oP 'floating:\s*\K\w+') + +if [ "$FLOATING" = "0" ] || [ -z "$FLOATING" ]; then + # 平铺 -> 浮动 + hyprctl dispatch togglefloating + sleep 0.05 + hyprctl dispatch resizeactive exact 50% 75% + hyprctl dispatch centerwindow + sleep 0.05 + # 移动鼠标到屏幕中心(近似窗口中心) + hyprctl dispatch movecursor 50% 50% +else + # 浮动 -> 平铺 + hyprctl dispatch togglefloating +fi |
