From 551176acf797e1877c6a6aca70f0fad5dbd7677e Mon Sep 17 00:00:00 2001 From: Evie Litherland-Smith Date: Tue, 2 Apr 2024 13:35:00 +0100 Subject: [PATCH] Fix no-GUI background removal for server/client setup Move to a custom function added to after-make-frame-functions hook, that only clears the default background if not GUI and a client frame. Also remove setting menu-bar-mode since it conflicts with Hyprland-specific options from NixOS --- config/ui.org | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/config/ui.org b/config/ui.org index 33eddff..f41920d 100644 --- a/config/ui.org +++ b/config/ui.org @@ -10,13 +10,26 @@ truncate-lines nil truncate-partial-width-windows nil) - (menu-bar-mode +1) (global-prettify-symbols-mode +1) (global-display-line-numbers-mode -1) (tool-bar-mode -1) - (when (not (display-graphic-p)) - (set-face-background 'default "undefined")) + + + (defun my/tty-frame-no-background (frame) + "Remove background if frame `FRAME' is non-GUI. + Sets default face background to undefined if `display-graphic-p' + is nil. + Add to `after-make-frame-functions' hook for + compatibility with server/client mode." + (when (and (not (display-graphic-p)) + (not (daemonp))) + (set-face-background 'default "undefined"))) + + ;; Run for already-existing frames + ;; (mapc 'new-frame-setup (frame-list)) + ;; Run when a new frame is created + (add-hook 'after-make-frame-functions 'my/tty-frame-no-background) (add-hook 'prog-mode-hook #'(lambda () (display-line-numbers-mode +1)))