✨ feat(hypr): script to toggle floating states and control the size of the window
This commit is contained in:
parent
b126fe5bb0
commit
a864434259
2 changed files with 32 additions and 1 deletions
|
@ -6,7 +6,7 @@ bindm = SUPER, mouse:273, resizewindow
|
||||||
bind = SUPER, Q, killactive,
|
bind = SUPER, Q, killactive,
|
||||||
bind = SUPERCTRL, R, exec, pkill waybar || waybar
|
bind = SUPERCTRL, R, exec, pkill waybar || waybar
|
||||||
bind = SUPERCTRL, M, exit
|
bind = SUPERCTRL, M, exit
|
||||||
bind = SUPER, A, exec, hyprctl dispatch togglefloating && hyprctl dispatch centerwindow 1
|
bind = SUPER, A, exec, ~/.config/hypr/scripts/toggle_floating
|
||||||
bind = SUPER, P, pseudo
|
bind = SUPER, P, pseudo
|
||||||
bind = SUPER, F, fullscreen, 0
|
bind = SUPER, F, fullscreen, 0
|
||||||
bind = SUPER, Z, exec, pypr zoom
|
bind = SUPER, Z, exec, pypr zoom
|
||||||
|
|
31
.config/hypr/scripts/toggle_floating
Executable file
31
.config/hypr/scripts/toggle_floating
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
floating=$(hyprctl activewindow -j | jq '.floating')
|
||||||
|
window=$(hyprctl activewindow -j | jq '.initialClass' | tr -d "\"")
|
||||||
|
|
||||||
|
function toggle() {
|
||||||
|
width=$1
|
||||||
|
height=$2
|
||||||
|
|
||||||
|
hyprctl --batch "dispatch togglefloating; dispatch resizeactive exact ${width} ${height}; dispatch centerwindow"
|
||||||
|
}
|
||||||
|
|
||||||
|
function untoggle() {
|
||||||
|
hyprctl dispatch togglefloating
|
||||||
|
}
|
||||||
|
|
||||||
|
function handle() {
|
||||||
|
width=$1
|
||||||
|
height=$2
|
||||||
|
|
||||||
|
if [ "$floating" == "false" ]; then
|
||||||
|
toggle "$width" "$height"
|
||||||
|
else
|
||||||
|
untoggle
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
case $window in
|
||||||
|
kitty) handle "55%" "60%" ;;
|
||||||
|
*) handle "75%" "80%" ;;
|
||||||
|
esac
|
Loading…
Add table
Reference in a new issue