mirror of
https://github.com/labwc/labwc.git
synced 2026-04-13 08:21:15 -04:00
Window switcher, allow to use percent of monitor width.
OSD will size per monitor. With this the width stays relative sized on my 4k as well as my 1080p monitor example from my theme osd.window-switcher.width: 60%
This commit is contained in:
parent
4fc6bce3ea
commit
bda18df757
5 changed files with 17 additions and 2 deletions
|
|
@ -321,7 +321,7 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
|
|||
if (show_workspace) {
|
||||
/* Center workspace indicator on the x axis */
|
||||
int x = font_width(&rc.font_osd, workspace_name);
|
||||
x = (theme->osd_window_switcher_width - x) / 2;
|
||||
x = (w - x) / 2;
|
||||
cairo_move_to(cairo, x, y + theme->osd_window_switcher_item_active_border_width);
|
||||
PangoWeight weight = pango_font_description_get_weight(desc);
|
||||
pango_font_description_set_weight(desc, PANGO_WEIGHT_BOLD);
|
||||
|
|
@ -432,7 +432,7 @@ render_osd(struct server *server, cairo_t *cairo, int w, int h,
|
|||
struct wlr_fbox fbox = {
|
||||
.x = theme->osd_border_width + theme->osd_window_switcher_padding,
|
||||
.y = y,
|
||||
.width = theme->osd_window_switcher_width
|
||||
.width = w
|
||||
- 2 * theme->osd_border_width
|
||||
- 2 * theme->osd_window_switcher_padding,
|
||||
.height = theme->osd_window_switcher_item_height,
|
||||
|
|
@ -460,6 +460,9 @@ display_osd(struct output *output, struct wl_array *views)
|
|||
|
||||
float scale = output->wlr_output->scale;
|
||||
int w = theme->osd_window_switcher_width;
|
||||
if (theme->osd_width_should_parse_as_percentage) {
|
||||
w = output->wlr_output->width * theme->osd_window_switcher_width / 100;
|
||||
}
|
||||
int h = wl_array_len(views) * rc.theme->osd_window_switcher_item_height
|
||||
+ 2 * rc.theme->osd_border_width
|
||||
+ 2 * rc.theme->osd_window_switcher_padding;
|
||||
|
|
|
|||
|
|
@ -670,6 +670,12 @@ entry(struct theme *theme, const char *key, const char *value)
|
|||
parse_hexstr(value, theme->osd_border_color);
|
||||
}
|
||||
if (match_glob(key, "osd.window-switcher.width")) {
|
||||
theme->osd_width_should_parse_as_percentage = false;
|
||||
char *p = strrchr(value, '%');
|
||||
if (p) {
|
||||
*p = '\0';
|
||||
theme->osd_width_should_parse_as_percentage = true;
|
||||
}
|
||||
theme->osd_window_switcher_width = atoi(value);
|
||||
}
|
||||
if (match_glob(key, "osd.window-switcher.padding")) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue