Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Issue] AGS widgets/menus don't give back focus once closed #502

Open
b4shful opened this issue May 15, 2024 · 15 comments
Open

[Issue] AGS widgets/menus don't give back focus once closed #502

b4shful opened this issue May 15, 2024 · 15 comments

Comments

@b4shful
Copy link
Contributor

b4shful commented May 15, 2024

  • I have read the Usage and the Troubleshooting pages of the wiki Yes
  • I have made sure that both my config and system packages are up to date Yes
  • Linux distro: Arch Linux

The issue

I have been dealing with this issue for quite some time, but only just started looking into it.
Whenever the AGS widgets are opened (e.g the overview on SUPER key or the system panel on SUPER+N), keyboard focus doesn't seem to be returned to the previous window upon closing. The only way I can get it to work again is to go to a different workspace and then switch back to the workspace I wanted to use. I have tried this with different follow_mouse settings but these haven't helped.

If you are focused on for example the terminal (although it's the same for every app), then press SUPER twice (once to open overview and once to close it), the keyboard focus doesn't ever seem to return to the terminal until workspaces are switched and switched back.

I have included my hyprland general config below. I changed some of the focus settings to better suit my needs, but perhaps I've misconfigured something and that could be causing this behaviour (would appreciate if someone attempted to reproduce this issue and that might indicate if it's a me problem or not!).

Click to expand
# Put general config stuff here
# Here's a list of every variable: https://wiki.hyprland.org/Configuring/Variables/

# MONITOR CONFIG
monitor=Sharp Corporation 0x1449,preferred,auto,1.5
# monitor=,addreserved, 0, 0, 0, 0

# monitor=HDMI-A-1,1920x1080@60,1920x0,1,mirror,eDP-1

# CHANGED BY JOEL
# unscale XWayland
# xwayland {
#     force_zero_scaling = true
# }
# env = GDK_SCALE,1.5

input {
    # Keyboard: Add a layout and uncomment kb_options for Win+Space switching shortcut
    kb_layout = gb
    # kb_options = grp:win_space_toggle
    numlock_by_default = true
    repeat_delay = 250
    repeat_rate = 35

    touchpad {
        natural_scroll = yes
        disable_while_typing = true
        clickfinger_behavior = false
        scroll_factor = 0.5
    }
    
    special_fallthrough = true
    # CHANGED BY JOEL
    follow_mouse = 2 
    # accel_profile = adaptive
    # sensitivity = 0
}

# JOEL Custom settings for MX Master
device {
  name = logitech-wireless-mouse-mx-master-3-1
  sensitivity = 0.5
  accel_profile = flat
}

binds {
    # focus_window_on_workspace_c# For Auto-run stuff see execs.confhange = true
    scroll_event_delay = 0
}

gestures {
    workspace_swipe = true
    workspace_swipe_distance = 700
    workspace_swipe_fingers = 4
    workspace_swipe_cancel_ratio = 0.2
    workspace_swipe_min_speed_to_force = 5
    workspace_swipe_direction_lock = true
    workspace_swipe_direction_lock_threshold = 10
    workspace_swipe_create_new = true
}

general {
    # Gaps and border
    gaps_in = 4
    gaps_out = 5
    gaps_workspaces = 50
    border_size = 1
    
    # Fallback colors
    col.active_border = rgba(0DB7D4FF)
    col.inactive_border = rgba(31313600)

    resize_on_border = true
    # CHANGED BY JOEL
    no_focus_fallback = false
    layout = dwindle
    
    # focus_to_other_workspaces = true # ahhhh i still haven't properly implemented this
    allow_tearing = true # This just allows the `immediate` window rule to work
}

dwindle {
	preserve_split = true
        # no_gaps_when_only = 1
	smart_split = false
	smart_resizing = false
	# CHANGED BY JOEL
	# force split = 2: always split to right (or bottom)
	force_split = 2
}

decoration {
    rounding = 20
    
    blur {
        enabled = true
        xray = true
        special = false
        new_optimizations = true
        size = 7
        passes = 4
        brightness = 1
        noise = 0.01
        contrast = 1
        popups = true
        popups_ignorealpha = 0.6
    }
    # Shadow
    drop_shadow = true
    shadow_ignore_window = true
    shadow_range = 20
    shadow_offset = 0 2
    shadow_render_power = 4
    col.shadow = rgba(0000002A)
    
    # Shader
    # screen_shader = ~/.config/hypr/shaders/nothing.frag
    # screen_shader = ~/.config/hypr/shaders/vibrance.frag
    
    # Dim
    dim_inactive = false
    dim_strength = 0.1
    dim_special = 0
}

animations {
    enabled = true
    # Animation curves
    
    bezier = linear, 0, 0, 1, 1
    bezier = md3_standard, 0.2, 0, 0, 1
    bezier = md3_decel, 0.05, 0.7, 0.1, 1
    bezier = md3_accel, 0.3, 0, 0.8, 0.15
    bezier = overshot, 0.05, 0.9, 0.1, 1.1
    bezier = crazyshot, 0.1, 1.5, 0.76, 0.92 
    bezier = hyprnostretch, 0.05, 0.9, 0.1, 1.0
    bezier = menu_decel, 0.1, 1, 0, 1
    bezier = menu_accel, 0.38, 0.04, 1, 0.07
    bezier = easeInOutCirc, 0.85, 0, 0.15, 1
    bezier = easeOutCirc, 0, 0.55, 0.45, 1
    bezier = easeOutExpo, 0.16, 1, 0.3, 1
    bezier = softAcDecel, 0.26, 0.26, 0.15, 1
    bezier = md2, 0.4, 0, 0.2, 1 # use with .2s duration
    # Animation configs
    animation = windows, 1, 3, md3_decel, popin 60%
    animation = windowsIn, 1, 3, md3_decel, popin 60%
    animation = windowsOut, 1, 3, md3_accel, popin 60%
    animation = border, 1, 10, default
    animation = fade, 1, 3, md3_decel
    # animation = layers, 1, 2, md3_decel, slide
    animation = layersIn, 1, 3, menu_decel, slide
    animation = layersOut, 1, 1.6, menu_accel
    animation = fadeLayersIn, 1, 2, menu_decel
    animation = fadeLayersOut, 1, 4.5, menu_accel
    animation = workspaces, 1, 7, menu_decel, slide
    # animation = workspaces, 1, 2.5, softAcDecel, slide
    # animation = workspaces, 1, 7, menu_decel, slidefade 15%
    # animation = specialWorkspace, 1, 3, md3_decel, slidefadevert 15%
    animation = specialWorkspace, 1, 3, md3_decel, slidevert
}

misc {
    vfr = 1
    vrr = 1
    # layers_hog_mouse_focus = true
    focus_on_activate = true
    animate_manual_resizes = false
    animate_mouse_windowdragging = false
    enable_swallow = false
    swallow_regex = (foot|kitty|allacritty|Alacritty)
    
    disable_hyprland_logo = true
    force_default_wallpaper = 0
    new_window_takes_over_fullscreen = 2
    allow_session_lock_restore = true
    
    initial_workspace_tracking = false
}

# Overview
plugin {
    hyprexpo {
        columns = 3
        gap_size = 5
        bg_col = rgb(000000)
        workspace_method = first 1 # [center/first] [workspace] e.g. first 1 or center m+1

        enable_gesture = false # laptop touchpad, 4 fingers
        gesture_distance = 300 # how far is the "max"
        gesture_positive = false
    }
}

@Ghanshyam-shaktawat
Copy link

Ghanshyam-shaktawat commented May 16, 2024

facing this same issue. When for example launching sidebar with bind key and you close it with bind key there is no focus on the window. Either i have to move my mouse to bring back focus or switch back and forth in workspaces. Its kind of annoying right now. I am on arch linux with the latest git commit.

One more update: if opening any toggle ags widget is closed by pressing escape key then the focus returns but not when pressing the same bind key used to open it.

@clsty
Copy link
Collaborator

clsty commented May 16, 2024

One more update: if opening any toggle ags widget is closed by pressing escape key then the focus returns but not when pressing the same bind key used to open it.

Same here.

@end-4
Copy link
Owner

end-4 commented May 17, 2024

click2Close, basically a transparent fullscreen layer to receive clicks, is the cause
but idk how to have click-outside-of-widget-to-close without it without totally messing up the stacking of the sidebars

@Ghanshyam-shaktawat
Copy link

Thanks for the response end-4. Love your work a lotttt!

Pls try to find some way if its possible as this situation is kidna annoying as many a times i press the same key to open and close the widget which makes lose focus from window. Then i have to switch workspace or move mouse to bring back focus. Its just itterates after a point. I love all the widgets and config. Hove we find a solution for this.

Not sure if i am asking right question but is it possible to use the escape event for like the situation where visible value change, as when pressing escape key to close widget focus comes back again.

@end-4
Copy link
Owner

end-4 commented May 18, 2024

Not sure if i am asking right question but is it possible to use the escape event for like the situation where visible value change, as when pressing escape key to close widget focus comes back again.

that's exactly how it's implemented
it just doesn't work

i guess i'll have another attempt of filling the screen with eventboxes that close the window on click. this is also what the ags developer recommends

@end-4
Copy link
Owner

end-4 commented May 18, 2024

done easily for overview and cheatsheet
there's still the two sidebars that'll probably take more effort

@Ghanshyam-shaktawat
Copy link

Ghanshyam-shaktawat commented May 18, 2024

done easily for overview and cheatsheet
there's still the two sidebars that'll probably take more effort

Thanks a lot man.
I will update my config now, let us know when u fix the sidebar too.

@end-4
Copy link
Owner

end-4 commented May 18, 2024

done for sidebar
used a stupid solution, and now the sidebars end up popping up from the bottom though

@end-4
Copy link
Owner

end-4 commented May 18, 2024

prob needs work on hyprland side
imma add that to my todo list

@Ghanshyam-shaktawat
Copy link

prob needs work on hyprland side imma add that to my todo list

Thanks @end-4 for all your response, i updated to the latest fix and now everything working fine. Now when closing widget focus comes back to window.

used a stupid solution, and now the sidebars end up popping up from the bottom though

I just wanted to ask one question. With the sidebar fix now the animation brings it up from bottom of screen. Is it fixable like the previouse animation or its just the solution for now. I will try to fix it from my side. Still, thanks again for giving us this amazing hyprland config with ags. Love it!!!

@end-4
Copy link
Owner

end-4 commented May 18, 2024

those anims are handled by hyprland
and actually, these rules can fix the slide anim direction:

layerrule = animation slide left, sideleft.*
layerrule = animation slide right, sideright.*

but i don't like it because it makes the layer close animation use the accelerating curve from the enter animation, not the exit one

@Ghanshyam-shaktawat
Copy link

those anims are handled by hyprland and actually, these rules can fix the slide anim direction:

layerrule = animation slide left, sideleft.*
layerrule = animation slide right, sideright.*

but i don't like it because it makes the layer close animation use the accelerating curve from the enter animation, not the exit one

this worked, although you are right about the exit animation but i think its still fine as it better then getting the bottom up animation from before. Maybe in future you can fix it. Unitl I will maybe reduce the speed of this animation a little. Rest all good and i think this issue is solved so maybe it can be closed now.

Thanks for all the support.

@end-4
Copy link
Owner

end-4 commented May 18, 2024

nah I'm going to leave this open since I'm still not satisfied with the solution

@b4shful
Copy link
Contributor Author

b4shful commented May 20, 2024

Also as a follow_mouse=2 user, just adding this recent upstream issue (now fixed) for future reference/in case anyone is searching for specific follow_mouse=2 issues. It's not the exact same issue but there were some other focus issues when using follow_mouse=2 which might have compounded with the AGS focus issue.

That one was fixed as of 5 days ago in hyprwm/Hyprland@7fbe05a

end-4 added a commit to Soliprem/dots-hyprland that referenced this issue May 24, 2024
end-4 added a commit to Soliprem/dots-hyprland that referenced this issue May 24, 2024
@end-4
Copy link
Owner

end-4 commented May 25, 2024

those anims are handled by hyprland and actually, these rules can fix the slide anim direction:

layerrule = animation slide left, sideleft.*
layerrule = animation slide right, sideright.*

but i don't like it because it makes the layer close animation use the accelerating curve from the enter animation, not the exit one

oops i meant decelerating curve
anyway, turns out it wasn't hyprland's fault for not using an accelerating curve on close
the problem lies in how the layer is too big and the accelerating curve doesn't seem accelerating for the visible parts. so maybe i need a faster accelerating curve for closing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants