1
0
Fork 0
mirror of https://github.com/Cloudef/bemenu synced 2024-05-21 06:56:09 +02:00

cairo: add BEMENU_SCALE env variable

Allows overriding the scaling factor for bemenu
This commit is contained in:
Jari Vetoniemi 2020-06-29 00:12:20 +09:00
parent 7266ebb795
commit 65cea5e20a
4 changed files with 20 additions and 2 deletions

View File

@ -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

View File

@ -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);

View File

@ -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);

View File

@ -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