elkowar / eww

ElKowars wacky widgets
https://elkowar.github.io/eww
MIT License
9.15k stars 380 forks source link

[BUG] Input field cannot be focused on a wm-ignored window #521

Open AlecsFerra opened 2 years ago

AlecsFerra commented 2 years ago

Checklist before submitting an issue

Description of the bug

On X11 + GTK a window is declared as as gtk::WindowType::Popup GTK will refuse to focus the window making the input field unusable.

Reproducing the issue

An example script

(defvar eww "eww -c $HOME/.config/eww/bat")

(defwindow batmenu
  :windowtype "normal"
  :wm-ignore  true
  :stacking   "fg"
  :geometry
    (geometry
      :y      "30%"
      :width  "40%"
      :height "40%"
      :anchor "center top")
  (mainbox))

(defwidget mainbox []
  (eventbox
    :onhoverlost "${eww} close batmenu"
    (box
      :orientation  "h" 
      :space-evenly true
      (input
        :value "a"
        :onchange "notify-send {}")
      (button
        :onclick "notify-send A"
        "A")
      (button
        :onclick "notify-send B"
        "B"))))

Expected behaviour

No response

Additional context

No response

AlecsFerra commented 2 years ago

I already have the fix ready, just tell me if you think that this is really a bug.

AlecsFerra commented 2 years ago

And if we should reuse the option focus or have this enabled by default

AlecsFerra commented 2 years ago

https://github.com/AlecsFerra/eww/commit/98ccfd145bbc4e7bbc339769c43662e84ff92343

elkowar commented 2 years ago

hmmm - I mean, generally, wm-ignore does mean that the WM doesn't really care about the window at all, so forcing focus and thus basically fighting the WM seems,... sketchy. Not sure about the implications here. What's the usecase for a window like that being wm-ignore?

AlecsFerra commented 2 years ago

To have a menu that can have an input field inside, I don't want window management but i would like to still be able to use an input field

VuiMuich commented 2 years ago

Tbh. such a window should probably be of type menu, dialog, toolbar or utility imo.

I like the function force_focus though, as it might be neat for some rofi-like widgets.

AlecsFerra commented 2 years ago

I'm using this exactly for that, I want a battery menu that can update his gui on battery status change stuff that can't be done with rofi

elkowar commented 2 years ago

I guess so, do file the PR then I'll have a closer look ^^