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

Icons on a per frame basis #375

Closed
MagicRB opened this issue Sep 12, 2020 · 10 comments
Closed

Icons on a per frame basis #375

MagicRB opened this issue Sep 12, 2020 · 10 comments
Labels
good first issue Good for newcomers

Comments

@MagicRB
Copy link

MagicRB commented Sep 12, 2020

Is your feature request related to a problem? Please describe.
When emacs is started in daemon mode, the assumption is made that only terminal frames will be created, therefore doom-modeline-icon must be set to non-nil, or icons wont work. Issue is that when both terminal and GUI frames exist, the setting applies to all globally

Describe the solution you'd like
I want to be able to manually set whether icons should be enabled on a per frame basis, ideally programmatically

Describe alternatives you've considered
There are no alternatives as currently icons can be enabled or not

Additional context
None needed

@seagle0128
Copy link
Owner

I am not sure if I understand your request completely. You may try this.

(make-variable-buffer-local 'doom-modeline-icon)
(add-hook 'after-make-frame-hook
 (lambda ()
    (setq doom-modeline-icon (display-graphic-p))))

@MagicRB
Copy link
Author

MagicRB commented Sep 17, 2020

i do have it globally set to always display as if it were in a GUI frame, but i want to mix gui and tui

@seagle0128
Copy link
Owner

Did you try the snippet?

@seagle0128
Copy link
Owner

Any update?

@rjhwelsh
Copy link

(make-variable-buffer-local 'doom-modeline-icon)
(add-hook 'server-after-make-frame-hook
 (lambda ()
     (setq doom-modeline-icon (display-graphic-p))))

The original snippet did not work for me. I had to change after-make-frame-hook with server-after-frame-make-hook.
As documented here

This switches the icons on/off globally not locally, so I don't think it 100% solves MagicRB's issue.
This fits my usecase though.
Thanks.

@rjhwelsh
Copy link

I spoke too soon...

(make-variable-buffer-local 'doom-modeline-icon)

appears to make all subsequent buffers default to showing no icons.
So leave that part out.

@seagle0128
Copy link
Owner

seagle0128 commented Nov 20, 2020

@rjhwelsh after-make-frame-hook is just an example. You can use other hooks in your cases. I just point out buffer-local var should be fine for this request.

@seagle0128
Copy link
Owner

I believe this snippet does work according my tests recently.

(make-variable-buffer-local 'doom-modeline-icon)
(add-hook 'server-after-make-frame-hook
 (lambda ()
     (setq doom-modeline-icon (display-graphic-p))))

@seagle0128 seagle0128 added the good first issue Good for newcomers label Jun 20, 2021
@noctuid
Copy link

noctuid commented Aug 14, 2021

That will not work. Setting the variable on every buffer create or switch would be better, but buffer-local variables cannot correctly solve this because the same buffer can be visited by both a GUI and terminal frame.

@seagle0128
Copy link
Owner

Now just use (setq doom-modeline-icon t), and icons will be displayed in GUI automatically.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

4 participants