wjcferguson · 2022-03-28 16:25
I made a small package [`textsize`](https://github.com/WJCFerguson/textsize/) to automatically adjust text size when the display changes (mentioned [earlier](https://www.reddit.com/r/emacs/comments/qoslj5/automatic_text_size_adjustment_per_display/))
It automatically calculates and applies a point size to the frame's `default` face, based on monitor size and pixel pitch. I find it invaluable as I switch between a large 4k desk monitor and the laptop when mobile, and presenting on big screens in meeting rooms.
I just added it to MELPA, and converted it to a minor mode, so anyone already using it will have to tweak config to change `(textsize-setup)` to `(textsize-mode)`.
I'd be very happy to hear about issues or desired features (here or on Github). I don't encounter displays that don't report size, but presumably projectors are not reliable for this - is there good generic metadata I could use to detect and compensate for them? At worst I could add overrides by EDID (unique display identifier).
Also, while the default parameters I came up with work for me, there are many display geometries I just haven't encountered that may be sub-optimal with the defaults(?).
CellularAut0maton · 2022-03-28 22:36
Looking forward to testing this out!
Danrobi1 · 2022-03-28 23:56
Nice. Thanks for sharing
shaggy_amreeki · 2022-04-06 14:54
Using it, and I played around the thresholds to find my setup and now I like it. I have two peculiar use cases however:
1. For work, I sit at my desk and connect my 14" laptop to a 24" monitor so I have those two screens to work with. Since the laptop is kept a bit further away (next to the monitor), I have kept my thresholds accordingly such that the fonts on my laptop are magnified and the ones on my monitor are comparatively smaller than the laptop.
2. When I am working on my laptop only though, say in the night on my sofa, I suddenly have very big font sizes on my laptop as the laptop is configured to be used on the desk. So I have to decrease the sizes manually.
Is there a way by which my laptop 'knows' when an external monitor is not connected, to change the thresholds accordingly and to de-magnify the font size?
wjcferguson · 2022-04-21 18:17
Sorry I didn't log in for a while. I'll think about this. It would certainly be possible to hack it.
wjcferguson · 2022-04-25 21:01
I'm not sure what the cleanest option is here.
I can't think of a clean and simple way to make it part of the package. But you could add advise to `textsize-fix-frame` that calls the function within a `let` block that conditionally modifies the threshold variable.
I see in the source of `make-frame-on-monitor` there's presumably a good way to get the list of current monitors:
(mapcar (lambda (a) (cdr (assq 'name a)))
(display-monitor-attributes-list))