add script to resize extensions
This commit is contained in:
Executable
+33
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
|
||||
timeout=0
|
||||
handle() {
|
||||
case $1 in
|
||||
windowtitle*)
|
||||
# Extract the window ID from the line
|
||||
window_id=${1#*>>}
|
||||
|
||||
# Fetch the list of windows and parse it using jq to find the window by its decimal ID
|
||||
window_info=$(hyprctl clients -j | jq --arg id "0x$window_id" '.[] | select(.address == ($id))')
|
||||
|
||||
# Extract the title from the window info
|
||||
window_title=$(echo "$window_info" | jq -r '.title')
|
||||
|
||||
# Check if the title matches the characteristics of the Bitwarden popup window
|
||||
if [[ "$window_title" == *"Extension : (Gestionnaire de mots de passe Bitwarden) - Bitwarden — Mozilla Firefox"* || "$window_title" == "Coinbase Wallet" ]]; then
|
||||
|
||||
# in case of double rename only allow once per second
|
||||
#if ((SECONDS < timeout)); then
|
||||
# return
|
||||
#fi
|
||||
#timeout=$((SECONDS + 1))
|
||||
|
||||
# echo "$window_id", "$window_title"
|
||||
hyprctl --batch "dispatch togglefloating address:0x$window_id; dispatch resizewindowpixel exact 14% 54%,address:0x$window_id; dispatch centerwindow"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
# Listen to the Hyprland socket for events and process each line with the handle function
|
||||
socat -U - UNIX-CONNECT:"$XDG_RUNTIME_DIR"/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock | while read -r line; do handle "$line"; done
|
||||
@@ -2,9 +2,16 @@ windowrulev2 = float,class:(org.gnome.Nautilus)
|
||||
windowrulev2 = float,class:(org.gnome.Calculator)
|
||||
windowrulev2 = float,class:(Signal)
|
||||
windowrulev2 = pin,class:(Signal)
|
||||
windowrulev2 = size 15% 70%,class:(Signal)
|
||||
windowrulev2 = move 83% 15%,class:(Signal)
|
||||
|
||||
# REAPER
|
||||
#windowrulev2 = tile,class:(REAPER)
|
||||
windowrulev2 = move cursor,class:REAPER,floating:1
|
||||
windowrulev2 = nofocus,class:REAPER,title:^(menu)$
|
||||
windowrulev2 = nofocus,class:REAPER,title:^$
|
||||
|
||||
#windowrulev2 = float,class:(kitty)
|
||||
windowrulev2 = size 30% 30%,class:(kitty)
|
||||
|
||||
exec-once = ~/.config/hypr/scripts/resize-window.sh
|
||||
|
||||
Reference in New Issue
Block a user