ch11ng / exwm

Emacs X Window Manager
2.85k stars 134 forks source link

[Question] how to raise the minibuffer frame always on top #583

Closed QiangF closed 5 years ago

QiangF commented 5 years ago

I use a input method (pyim) that uses the minibuffer frame to show option list, when that list is changed, the detached minibuffer will flicker once. ( https://github.com/ch11ng/exwm/issues/572)

I guess it the redraw of the frame behind the minibuffer frame that causes the flickering, I was wondering if we can bring the detached minibuffer frame always on top in exwm-workspace--show-minibuffer, and it will be hidden only in exwm-workspace--hide-minibuffer.

There is an example on making a window always on top and below by the window properties: _NET_WM_STATE_ABOVE and _NET_WM_STATE_BELOW https://stackoverflow.com/questions/20733215/how-to-make-a-window-always-on-top

It can also achieve with wmctrl:

wmctrl -r windowname -b add,above
ch11ng commented 5 years ago

I believe the minibuffer frame does not automatically hide before exwm-workspace--hide-minibuffer is ever called. Perhaps it's resizing the minibuffer frame itself that causes the flickering?

QiangF commented 5 years ago

Pyim just uses the message function to show the options list, the options list is always in two lines, do you know which command does the resizing?

QiangF commented 5 years ago

OK. I have found the cause : (exwm-workspace--hide-minibuffer) in the echo-area-clear-hook

(defun exwm-workspace--on-echo-area-clear ()
"Run in echo-area-clear-hook to hide echo area container."
(unless (exwm-workspace--client-p)
    (unless (active-minibuffer-window)
    (exwm-workspace--hide-minibuffer))
    (when exwm-workspace--display-echo-area-timer
    (cancel-timer exwm-workspace--display-echo-area-timer)
    (setq exwm-workspace--display-echo-area-timer nil))))
QiangF commented 5 years ago

The solution is to check if pyim-translating before hide the minibuffer, I am not sure if it 's appropriate to include this to work with this sigle package.

(defun exwm-workspace--on-echo-area-clear ()
"Run in echo-area-clear-hook to hide echo area container."
(unless (exwm-workspace--client-p)
    (unless (or (active-minibuffer-window) pyim-translating)
    (exwm-workspace--hide-minibuffer))
    (when exwm-workspace--display-echo-area-timer
    (cancel-timer exwm-workspace--display-echo-area-timer)
    (setq exwm-workspace--display-echo-area-timer nil))))

I also need to advice pyim-terminate-translation to hide the echo area, pyim-terminate-translation set pyim-translating to nil, but that happens before echo area clear.

(advice-add 'pyim-terminate-translation :after 'exwm-workspace--on-echo-area-clear)
ch11ng commented 5 years ago

Perhaps it should not clear the echo area in the first place. If there's really nothing to show at some point then it can just display whitespace.

QiangF commented 5 years ago

I think some people may want to auto hide the echo area on clear. So I think it's necessary.

ch11ng commented 5 years ago

I'm puzzled. Isn't the IM that clears the echo area? So for it to work flawlessly, instead of actually clearing the echo area, the IM can use whitespace instead when it doesn't want to hide the window.

QiangF commented 5 years ago

I mean for other package that use the echo area, they want the echo area to be clear after use. In the case of the IM, it sure can clear the echo area on exit, but we shouldn't clear the echo area when the IM is still use the echo area for displaying purposes.

ch11ng commented 5 years ago

I mean for other package that use the echo area, they want the echo area to be clear after use.

Most packages don't care if the echo area is cleared; they simply call message to override it. And it's for each individual package to decide whether to clear the echo area.

QiangF commented 5 years ago

I mean people want exwm-workspace--on-echo-area-clear in the echo-area-clear-hook to hide the minbuffer frame. In my case I can leave without the hook entirely.

zhenhua-wang commented 1 year ago

The solution is to check if pyim-translating before hide the minibuffer, I am not sure if it 's appropriate to include this to work with this sigle package.

(defun exwm-workspace--on-echo-area-clear ()
"Run in echo-area-clear-hook to hide echo area container."
(unless (exwm-workspace--client-p)
    (unless (or (active-minibuffer-window) pyim-translating)
    (exwm-workspace--hide-minibuffer))
    (when exwm-workspace--display-echo-area-timer
    (cancel-timer exwm-workspace--display-echo-area-timer)
    (setq exwm-workspace--display-echo-area-timer nil))))

I also need to advice pyim-terminate-translation to hide the echo area, pyim-terminate-translation set pyim-translating to nil, but that happens before echo area clear.

(advice-add 'pyim-terminate-translation :after 'exwm-workspace--on-echo-area-clear)

Hi, thank you for your effort! This works very well in regular emacs buffer; however, it does not work in exwm buffer. Do you know how to solve this?

QiangF commented 1 year ago

@zhenhua-wang I have not used EXWM and pyim for a while, due to the input method not supporting qt5 applications, both have changed a lot, sorry.