forked from RepoMirrors/bemenu
cairo: add BEMENU_SCALE env variable
Allows overriding the scaling factor for bemenu
This commit is contained in:
parent
7266ebb795
commit
65cea5e20a
@ -73,6 +73,7 @@ All dependencies are searched with `pkg-config`
|
||||
| BEMENU_BACKEND | Force backend by name | x11, wayland, curses |
|
||||
| BEMENU_RENDERER | Force backend by loading a .so file | Path to the .so file |
|
||||
| BEMENU_RENDERERS | Override the backend search path | Path to a directory |
|
||||
| BEMENU_SCALE | Override the rendering scale factor | Float value |
|
||||
|
||||
## About Wayland support
|
||||
|
||||
|
@ -263,7 +263,13 @@ recreate_windows(const struct bm_menu *menu, struct wayland *wayland)
|
||||
|
||||
struct window *window = calloc(1, sizeof(struct window));
|
||||
window->bottom = menu->bottom;
|
||||
window->scale = output->scale;
|
||||
|
||||
const char *scale = getenv("BEMENU_SCALE");
|
||||
if (scale) {
|
||||
window->scale = fmax(strtof(scale, NULL), 1.0f);
|
||||
} else {
|
||||
window->scale = output->scale;
|
||||
}
|
||||
|
||||
if (!bm_wl_window_create(window, wayland->display, wayland->shm, output->output, wayland->layer_shell, surface))
|
||||
free(window);
|
||||
|
@ -21,7 +21,12 @@ create_buffer(struct window *window, struct buffer *buffer, int32_t width, int32
|
||||
|
||||
cairo_xlib_surface_set_size(surf, width, height);
|
||||
|
||||
buffer->cairo.scale = 1;
|
||||
const char *scale = getenv("BEMENU_SCALE");
|
||||
if (scale) {
|
||||
buffer->cairo.scale = fmax(strtof(scale, NULL), 1.0f);
|
||||
} else {
|
||||
buffer->cairo.scale = 1;
|
||||
}
|
||||
|
||||
if (!bm_cairo_create_for_surface(&buffer->cairo, surf)) {
|
||||
cairo_surface_destroy(surf);
|
||||
|
@ -224,3 +224,9 @@ Force backend by loading a .so file.
|
||||
.RS
|
||||
Override the backend search path.
|
||||
.RE
|
||||
|
||||
.TP
|
||||
.B BEMENU_SCALE
|
||||
.RS
|
||||
Override the rendering scale factor.
|
||||
.RE
|
||||
|
Loading…
Reference in New Issue
Block a user