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

statusbar disappears when switching between frames #1

Open
crypt17 opened this issue Sep 26, 2019 · 8 comments
Open

statusbar disappears when switching between frames #1

crypt17 opened this issue Sep 26, 2019 · 8 comments

Comments

@crypt17
Copy link

crypt17 commented Sep 26, 2019

Hi I have been trying statusbar and it is just about perfect for my needs.

The one issue that I have is that when switching between different frames on different virtual desktops. the statusbar does not show up for a time.

I suspect that this is it waiting for a timer to update but since I have several emacs clients running emacs on their own desktop this is a major distraction.

Any thoughts on this?

@dakra
Copy link
Owner

dakra commented Sep 26, 2019

Hi!

I use exwm so I don't really have this problem.
When switching frames (which is switching exwm workspaces) I have a very short time until the statusbar get's displayed again.
But I also just tested it with an "external" running Emacs and multiple frames and for me it basically instantly appears after focusing the new frame.
In general, there is no waiting for a timer. I use hooks that Emacs provides to detect if a new frame has focus

statusbar.el/statusbar.el

Lines 207 to 220 in 14588ba

;; When we're in exwm simply use the workspace-switch-hook
;; instead of the normal Emacs frame functions/hooks
(if (boundp 'exwm-workspace-switch-hook)
(add-hook 'exwm-workspace-switch-hook #'statusbar-refresh)
;; Check if we're on Emacs 27 where the frame focus functions changed
(with-no-warnings
(if (not (boundp 'after-focus-change-function))
(add-hook 'focus-in-hook #'statusbar-refresh)
;; `focus-in-hook' is obsolete in Emacs 27
(defun statusbar--refresh-with-focus-check ()
"Like `statusbar-refresh' but check `frame-focus-state' first."
(when (frame-focus-state)
(statusbar-refresh)))
(add-function :after after-focus-change-function #'statusbar--refresh-with-focus-check))))

That hook changed in Emacs 27, maybe it's faster there?
What OS are you using?

@crypt17
Copy link
Author

crypt17 commented Sep 26, 2019

ah I am using emacs 27 at the moment.

I am running it on debian with the i3 wm.

I am looking at using exwm in the near future as the status bar was one of the features that I was missing before moving

@dakra
Copy link
Owner

dakra commented Sep 26, 2019

I am using emacs 27 at the moment.
I am running it on debian with the i3 wm.

OK, that's similar to my setup (I used to use i3 as well before
switching to exwm).

So if you switch from one i3 workspace to another, where I guess
each has a maximized Emacs frame, it takes a while to show
the statusbar?

For me, it takes a little bit as well, but it get's displayed
very fast and as it's only on the bottom right I don't mind.

Maybe a solution would be to simply always display the statusbar
on every Emacs frame?

@crypt17
Copy link
Author

crypt17 commented Sep 26, 2019

I only find it odd as I have the battery and clock there so it is something that I tend to want to have visible.

It can take anywhere up to about 30 seconds to show up.

Since it seems to work other than that I will have a play and see if I can track anything down or move to using exwm

@dakra
Copy link
Owner

dakra commented Sep 26, 2019

Just to be clear, you mean 30 seconds after the Emacs frame got focus?
That may even be a bug in the new Emacs 27 frame handling then.

@crypt17
Copy link
Author

crypt17 commented Sep 27, 2019

hi I tested this under emacs 26 ant it looks like it is an issue with emacs 27. The interesting thing is that I appear to have issues when running under exwm as well but I have not fully tested this yet

@dakra
Copy link
Owner

dakra commented Sep 27, 2019

If it also doesn't work under exwm then it's strange because for exwm I don't even use the Emacs focus hooks but the exwm-workspace-switch-hook.
It's also strange that it works for me under both exwm and 'normal running' Emacs 27.

Please report back if you have any news or tested a bit more.
I don't have much time in the next weeks but I plan to polish this package and publish it on melpa.
As it is now, it's only alpha quality and I thought I'm the only one using it ;)

@crypt17
Copy link
Author

crypt17 commented Sep 28, 2019

I will do.

do yo have a good way to show the current workspace under exwm?

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

2 participants