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

1 pixel border around screen #940

Open
walseb opened this issue Jan 5, 2024 · 15 comments
Open

1 pixel border around screen #940

walseb opened this issue Jan 5, 2024 · 15 comments

Comments

@walseb
Copy link
Contributor

walseb commented Jan 5, 2024

Hello!

Has anyone noticed a 1 pixel border on all sides of the screen when using EXWM?

For me, it's only really visible when switching to a light theme while in a dark web browser or other dark colored buffer.

Since it changes color depending on themes, it hints at it being an emacs created border decoration.

Does anyone else see it? Is there any way to remove it?

I haven't found anything online regarding it.

Thank you!

@minad
Copy link
Contributor

minad commented Jan 5, 2024

Yes, I also see a line at the bottom of the screen, when switching from a light to a dark theme. The effect is only visible when I start Emacs with a light background.

@walseb
Copy link
Contributor Author

walseb commented Jan 5, 2024

That's interesting, I see it on all sides. It's a bit annoying when using a light theme, but is thankfully not visible when using a dark theme.

@Stebalien
Copy link
Contributor

  1. Can you post your (frame-parameters) and (frame-geometry)?
  2. What toolkit (gtk, lucid, no tookit)?
  3. Does enabling the exwm-background module ((exwm-background-enable)) make a difference?

@minad
Copy link
Contributor

minad commented Jan 5, 2024

I use Lucid. I just checked the output of:

(pp `((frame-geometry . ,(frame-geometry))
      (frame-monitor-geometry . ,(frame-monitor-geometry))))

The problem is the external-border-size:

((frame-geometry
  (outer-position 0 . 0)
  (outer-size 2560 . 1440)
  (external-border-size 0 . 1)
  (outer-border-width . 0)
  (title-bar-size 0 . -1)
  (menu-bar-external . t)
  (menu-bar-size 0 . 0)
  (tab-bar-size 2558 . 21)
  (tool-bar-external)
  (tool-bar-position . top)
  (tool-bar-size 0 . 0)
  (internal-border-width . 1))
 (frame-monitor-geometry 0 0 2560 1440))

I've set x-no-window-manager=t in my early-init.el. Enabling the background module doesn't make a difference. The color of the line at the bottom is influenced by the *background Xresources, which I store depending on the selected theme, such that the next time Emacs starts up, the frame background doesn't flicker.

@minad
Copy link
Contributor

minad commented Jan 5, 2024

@walseb

Is there any way to remove it?

To answer that question - in my setup, I can remove the border when I evaluate the following:

(progn
  (tab-bar-mode -1)
  (pcase-let ((`(,x ,y ,w ,h) (frame-monitor-geometry)))
    (set-frame-size nil w h t))
  (tab-bar-mode 1))

I use the tab-bar for workspaces. The tab-bar has to be disabled first since otherwise one ends up with a frame which is too high (monitor height + tab bar height). Maybe this works for you too?

In order to figure out the reason of the initially wrong computation, I have to create a minimal example first.

@Stebalien
Copy link
Contributor

Hm. I have a similar issue, but I only see 5 pixels at the bottom, not all the way around. In my case, it's because I'm changing the tab-bar face's font size too early on startup (or something like that).

Deleting the current frame seems to "fix" it. So does delaying:

  • Enabling the tab bar.
  • Changing the tab bar face.

So does setting auto-resize-tab-bars to grow-only, but that causes the tab-bar to be too large.

@Stebalien
Copy link
Contributor

Taking the fringe into account and keeping the tab-bar visible, the following seems to work:

(defun fix-frame-size (&optional frame)
  (pcase-let ((`(,x ,y ,w ,h) (frame-monitor-geometry frame)))
    (set-frame-size frame
                    (- w (frame-fringe-width frame))
                    (- h (tab-bar-height frame t)) t)))

(technically one probably needs to take the menu bar, tool bar, scroll bar, etc. into account)

@walseb
Copy link
Contributor Author

walseb commented Jan 9, 2024

Hello!

Thanks for the replies!

I tried both of your code blocks. They removed the border on the right hand side and the bottom, but a one pixel border on the left side of my screen and the top still remain.

Here's the output of running:

(pp `((frame-geometry . ,(frame-geometry))
      (frame-monitor-geometry . ,(frame-monitor-geometry))))
((frame-geometry (outer-position 0 . 0) (outer-size 1920 . 1080)
                (external-border-size -2 . -2)
                (outer-border-width . 0) (title-bar-size 0 . 2)
                (menu-bar-external . t) (menu-bar-size 0 . 0)
                (tab-bar-size 0 . 0) (tool-bar-external)
                (tool-bar-position . top) (tool-bar-size 0 . 0)
                (internal-border-width . 1))
(frame-monitor-geometry 0 0 1920 1080))

@walseb
Copy link
Contributor Author

walseb commented Jan 9, 2024

Actually, the above is what I get when I run it after applying the set-frame-size functions. This is what I get when I run it before running those:

((frame-geometry (outer-position 0 . 0) (outer-size 1920 . 1080)
		 (external-border-size 0 . 0) (outer-border-width . 0)
		 (title-bar-size 0 . 0) (menu-bar-external . t)
		 (menu-bar-size 0 . 0) (tab-bar-size 0 . 0)
		 (tool-bar-external) (tool-bar-position . top)
		 (tool-bar-size 0 . 0) (internal-border-width . 1))
(frame-monitor-geometry 0 0 1920 1080))

@walseb
Copy link
Contributor Author

walseb commented Jan 9, 2024

It seems the issue was with internal-border-width.

Simply running Emacs with

emacs --internal-border=0 --border-width=0

solved the issue entirely for me. I have now reclaimed one slice of pixels in each direction!

You might be able to use modify-frame-parameters to achieve this, but I didn't understand what input it expected.

Does this solve the issue for anyone else?

I think this issue should be added to the Wiki. I will create a PR.

@walseb
Copy link
Contributor Author

walseb commented Jan 9, 2024

It seems like the Wiki change just went through, no need to create a PR.

I added it here https://github.com/ch11ng/exwm/wiki#border-in-corners-of-screen. If there's a better place to add it, please tell me or feel free to change it.

@minad
Copy link
Contributor

minad commented Jan 10, 2024 via email

@walseb
Copy link
Contributor Author

walseb commented Jan 12, 2024

Sebastian Wålinder @.***> writes:
It seems the issue was with internal-border-width. Simply running Emacs with emacs --internal-border=0 --border-width=0 solved the issue entirely for me. I have now reclaimed one slice of pixels in each direction!
In my case the problem is not solved by these settings (they should be th default?). The pixel offset at the bottom remains. I assume the problem there is a bug in an Emacs frame size computation.

That's strange, it works perfectly for me with those start parameters. I'm running Emacs 30, lucid, on NixOS without any special GTK settings. On the wiki I just inserted a link to this issue.

@walseb
Copy link
Contributor Author

walseb commented Jan 12, 2024

Are you managing your minibuffer using exwm? I tried (setq exwm-workspace-minibuffer-position 'top) just now, and running exwm-workspace-detach-minibuffer caused a massive border at the top appear. Same thing happens at the bottom of the frame when I set it to (setq exwm-workspace-minibuffer-position 'bottom)

@minad
Copy link
Contributor

minad commented Jan 12, 2024

@walseb No, I don't. When I tried it, I didn't have success and also observed some problems. It would be nice to try this again, since this would allow me to hide the minibuffer while it is not active. Otoh the echo area is also hidden.

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

3 participants