hyprwm / Hyprland

Hyprland is an independent, highly customizable, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
https://hyprland.org
BSD 3-Clause "New" or "Revised" License
19.71k stars 837 forks source link

some windowrulev2 not work #2380

Closed colorsakura closed 1 year ago

colorsakura commented 1 year ago

Hyprland: 0.25.0.r67.g078ba6da-1

windowrulev2 = float,class:^(firefox)$,title:^(Developer Tools)(.*)$
windowrulev2 = float,class:^(firefox)$,title:^(.*About.*)$

First rule didnt work; Second rule for About Firefox Page, sometime work.

here is my config

# This is an example Hyprland config file.
#
# Refer to the wiki for more information.

#
# Please note not all available settings / options are set here.
# For a full list, see the wiki
#

# See https://wiki.hyprland.org/Configuring/Monitors/
monitor = eDP-1,2880x1800@90,auto,2,bitdepth,10

# Variables
$BROWSER = firefox
$mainMod = SUPER

# Enviroment
env = WOBSOCK, $XDG_RUNTIME_DIR/wob.sock
env = GTK_THEME, WhiteSur-Dark
env = XCURSOR_THEME, WhiteSur-cursors

exec-once = systemctl --user import-environment WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
exec-once = dbus-update-activation-environment --all
exec-once = xprop -root -f _XWAYLAND_GLOBAL_OUTPUT_SCALE 32c -set _XWAYLAND_GLOBAL_OUTPUT_SCALE 2
exec-once = mako
exec-once = wl-paste --type text --watch cliphist store #Stores only text data
exec-once = wl-paste --type image --watch cliphist store #Stores only image data
exec-once = swayidle -w timeout 60 'swaylock -f -c 000000' timeout 300 'hyprctl dispatch dpms off' resume 'hyprctl dispatch dpms on' before-sleep 'swaylock -f -c 000000'
exec-once = rm -f $WOBSOCK && mkfifo $WOBSOCK && tail -f $WOBSOCK | wob
exec-once = libinput-gestures-setup autostart
exec-once = /home/chauncey/.scripts/gsettings.sh
exec = pkill fcitx5; env LANG=zh_CN.UTF-8 fcitx5 -d
exec = pkill swaybg; swaybg -i ~/wallpaper.jpg -m fill
exec = pkill waybar; sleep 2; waybar

# For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input {
    kb_layout = us
    kb_variant =
    kb_model =
    kb_options = caps:escape 
    kb_rules =

    repeat_rate = 50
    repeat_delay = 500

    follow_mouse = 1

    touchpad {
        natural_scroll = true
    }

    sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
}

general {
    # See https://wiki.hyprland.org/Configuring/Variables/ for more

    gaps_in = 0
    gaps_out = 0
    border_size = 0
    col.active_border = rgba(33ccffee)
    col.inactive_border = rgba(595959aa)

    layout = dwindle
}

decoration {
    rounding = 8
    multisample_edges = true
    blur = false
    blur_new_optimizations = true
}

blurls = waybar

animations {
    enabled = true
}

dwindle {
    pseudotile = true # master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
    preserve_split = true # you probably want this
}

master {
    # See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
    new_is_master = true
}

gestures {
    # See https://wiki.hyprland.org/Configuring/Variables/ for more
    workspace_swipe = true
}

windowrulev2 = float,class:^(org.telegram.desktop)$
windowrulev2 = float,class:^(org.fcitx.fcitx5-config-qt)$
windowrulev2 = float,class:^(firefox)$,title:^(Library)$
windowrulev2 = float,class:^(firefox)$,title:^(Developer Tools)(.*)$
windowrulev2 = float,class:^(firefox)$,title:^(.*About.*)$
windowrulev2 = float,class:^(firefox)$,title:^(Picture-in-Picture)$
windowrulev2 = float,class:^transmission*
windowrulev2 = size 50%,50%,class:^transmission*
windowrulev2 = size 60%,60%,class:^(steam)$,title:^(steam)$
windowrulev2 = float,class:^(Element)$
# windowrulev2 = float,class:^(steam)$
windowrulev2 = float,class:^(org.qbittorrent.qBittorrent)$
windowrulev2 = float,class:^(org.wireshark.Wireshark)$
windowrulev2 = float,class:^(com.github.wwmm.easyeffects)$
windowrulev2 = float,class:^(mpv)$
windowrulev2 = float,class:^(anki)$
windowrulev2 = float,class:^(GoldenDict)$
windowrulev2 = float,title:^(LF Manager)$
windowrulev2 = float,title:^(Htop)$
windowrulev2 = float,title:^Blender*
windowrulev2 = workspace 4 silent,class:^(mpv)$
windowrulev2 = workspace 5,class:code*

# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
# bind=MODS,key,dispatcher,params
bind = CTRL_ALT, Backspace, exit,

bind = $mainMod, T, exec, [workspace 2] alacritty
bind = SUPER_SHIFT, T, exec, [float] alacritty
bind = $mainMod, O, exec, [workspace 3] obsidian
bind = $mainMod, B, exec, [workspace 1] $BROWSER
bind = $mainMod, C, killactive,
bind = $mainMod, E, exec, alacritty -t 'LF Manager' -e lf
bind = $mainMod, F, togglefloating,
bind = $mainMod, R, exec, ~/.config/rofi/launchers/type-1/launcher.sh
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
bind = $mainMod, A, exec, slurp -b ff00ff20 -B ff00ff20 -c 00dffc -o | grim -g - - | wl-copy --type image/png
bind = SUPER_SHIFT, A, exec, slurp -b ff00ff20 -B ff00ff20 -c 00dffc -o | grim -g - - | swappy -f - -o -  | wl-copy --type image/png
bind = ALT, F4, exec, ~/.config/rofi/powermenu/type-1/powermenu.sh

bind = $mainMod, V, exec, cliphist list | rofi -dmenu | cliphist decode | wl-copy
bind = $mainMod, L, exec, swaylock -f

# to switch between windows in a floating workspace
bind = SUPER,Tab,cyclenext,          # change focus to another window
bind = SUPER,Tab,bringactivetotop,   # bring it to the top

# Keyboard Control Function
bindle = , XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
bindle = , XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindle = , XF86AudioRaiseVolume, exec, wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2*100)}' > $WOBSOCK
bindle = , XF86AudioLowerVolume, exec, wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{print int($2*100)}' > $WOBSOCK

bind = , XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bind = , XF86AudioMute, exec, wpctl get-volume @DEFAULT_AUDIO_SINK@ | awk '{if ($3) print 0; else print int($2*100)}' > $WOBSOCK
bind = , XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle

bindle = , XF86MonBrightnessUp, exec, light -A 5 && light -G | cut -d'.' -f1 > $WOBSOCK
bindle = , XF86MonBrightnessDown, exec, light -U 5 && light -G | cut -d'.' -f1 > $WOBSOCK

bindle = , XF86AudioPlay, exec, playerctl play-pause
bindle = , XF86AudioNext, exec, playerctl next
bindle = , XF86AudioPrev, exec, playerctl previous

bindle = , Print, exec, grim - | wl-copy --type image/png

# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d

# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1

# Switch workspaces with mainMod + [0-9]
bind = $mainMod, Tab, workspace, e+1 
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10

# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10

# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow

# will switch to a submap called resize
bind=$mainMod,S,submap,resize
# will start a submap called "resize"
submap=resize
# sets repeatable binds for resizing the active window
binde=,right,resizeactive,10 0
binde=,left,resizeactive,-10 0
binde=,up,resizeactive,0 -10
binde=,down,resizeactive,0 10
binde=,l,resizeactive,10 0
binde=,h,resizeactive,-10 0
binde=,k,resizeactive,0 -10
binde=,j,resizeactive,0 10
# use reset to go back to the global submap
bind=,escape,submap,reset 
# will reset the submap, meaning end the current one and return to the global one
submap=reset

# vim: set ft=confini :
vaxerski commented 1 year ago

have you considered your rule being wrong...?

image

image

That's not gonna match ^(.*About.*)$

colorsakura commented 1 year ago

https://we.tl/t-MCzduWPvtD

this is video.

image

image

uzvg commented 1 year ago

Perhaps it matches initialTitle, not title, i set the title field value with ^(Firefox)$, and then it worked.

felixsanz commented 11 months ago

@vaxerski I think it's a valid bug. It doesn't also work for me.

    class: firefox
    title: Developer Tools — some windowrulev2 not work · Issue #2380 · hyprwm/Hyprland — https://github.com/hyprwm/Hyprland/issues/2380
    initialClass: firefox
    initialTitle: Firefox

None of this work (tried both class:(firefox) and class:(Firefox)):

windowrulev2 = float,class:(firefox),title:^(Developer Tools)(.*)

windowrulev2 = float,class:(firefox),title:^(Developer Tools)(.*)$

windowrulev2 = float,class:(firefox),title:^(Developer Tools.*)

windowrulev2 = float,class:(firefox),title:^(Developer Tools.*)$

I'm doing something wrong?

vaxerski commented 11 months ago

float is not a dynamic rule and thus uses the initial properties.

felixsanz commented 11 months ago

float is not a dynamic rule and thus uses the initial properties.

so... if initial values are "firefox/Firefox", how can I target this developer tools? i don't want the entire firefox window to be floated, only the picture in picture, the devtools, etc

vaxerski commented 11 months ago

you can't :)

or you could make a script listen to socket2's title change events and dynamically call togglefloating I guess

felixsanz commented 11 months ago

you can't :)

or you could make a script listen to socket2's title change events and dynamically call togglefloating I guess

can it be solved? i mean... if you can't float a picture-in-picture window, it looks like a bug!

vaxerski commented 11 months ago

yes. You have to ask firefox developers to fix it :)

felixsanz commented 11 months ago

yes. You have to ask firefox developers to fix it :)

why it works on sway then?