Commit graph

68 commits

Author SHA1 Message Date
John Lindgren
ec145a14ca theme: support basic vertical titlebar gradients
Only Vertical and SplitVertical gradients are supported,
and only for window.*.title.bg.

Not supported at this time:

- horizontal or diagonal gradients
- gradients for window.*.label.bg, buttons, or menus
- any type of border (raised, sunken, etc.)
2025-06-18 15:48:24 -04:00
John Lindgren
990706b081 ssd: allow arbitrary cairo pattern as titlebar background
The titlebar background is now first rendered to a 1px wide buffer,
then stretched horizontally. This allows vertical gradients to be used.
2025-06-18 15:48:24 -04:00
Dmitry
4f42b7a12b osd: add osd.workspace-switcher.boxes.border.width 2025-04-14 20:06:38 +01:00
tokyo4j
6a04c5f0dd osd: add osd.window-switcher.item.icon.size
This allows users to make the icon in window switcher bigger (or smaller)
than the font size, which enables more Openbox-like appearance.

Example configuration:
  osd.window-switcher.item.icon.size: 50

This commit also makes the icon smaller than the font size if the width
allocated with <windowSwitcher><fields><field width=""> is smaller than
that.
2025-04-01 21:14:20 +01:00
tokyo4j
bffdccf8dc refactor: add LAB_BS_DEFAULT in lab_button_state 2025-01-25 07:27:21 +09:00
Johan Malm
8d9bd2d747 theme: use 'labwc' directory
as well as 'openbox-3', for example: /usr/share/themes/foo/labwc/themerc

Give 'labwc' higher precedence than 'openbox-3' if both exist.

For several reasons not all themes designed for labwc render well on
Openbox:

1. Labwc support some features like SVG/PNG icons and #rrggbbaa color
   definitions which Openbox does not.

2. Openbox generally defaults to black/white colors and will not render
   themes accurate without certain options specified in themerc. For
   example, in Openbox the following will just render as black:

       window.active.title.bg.color: #589bda

   ...because Openbox defaults the texture to "Gradient Vertical" and
   therefore either needs:

      window.active.title.bg.colorTo: #3c7cb7

   ...or remove 'Gradient' from the bg definition and just use something
   like:

      window.active.title.bg: Flat Border

Whilst none of this is a problem when using labwc, it causes problems for
setups with both Openbox and labwc because themes designed for labwc only
will now show up in obconf, lxappearance, etc causing confusion for users.
2025-01-06 20:15:26 +00:00
tokyo4j
16dbdc64e5 ssd: rework titlebar button rendering
- fix that icons for normal/hovered/rounded buttons are not placed
  exactly the same position
- fix blurry window button icons in scaled outputs

This commit introduces lab_img and scaled_img_buffer and uses them for
rendering icons in the window titlebar. Now the process of rendering
button icons are split into 2 phases: loading with lab_img_load() and
creating scene-nodes for them with scaled_img_buffer_create(). This
might incur some additional overhead since we no longer preload icon
textures, but the rendering of icon only happens for the first window
as backing buffers are shared and the overhead won't be noticeable.
This commit also simplifies the process of centering icon buffer in the
button, by creating icon buffers in a fixed geometry via
lab_img_render().
2024-12-23 18:11:32 +09:00
tokyo4j
da418f9720 menu: support borders
This commit adds following theme configurations:

  menu.border.width: 1
  menu.border.color: #aaaaaa
2024-11-25 19:41:07 +00:00
tokyo4j
9580caf8f8 theme: rename title_height to titlebar_height
Also removed the redundant initialization of title_height in
theme_builtin().
2024-11-12 17:25:39 +00:00
tokyo4j
1639919889 theme: rename menu_item_padding to menu_items_padding 2024-11-12 17:25:39 +00:00
tokyo4j
d916a78aca theme: move some variables into theme->window
For example, variables:
  `theme->window_inactive_border_color`
  `theme->window_active_border_color`
are converted to:
  `theme->window[THEME_INACTIVE].border_color`
  `theme->window[THEME_ACTIVE].border_color`
2024-11-12 17:25:39 +00:00
tokyo4j
720ae1fc87 theme: reorder theme entries in documentation and codebase 2024-11-12 17:25:39 +00:00
Tomi Ollila
ad2d24fb42 menu: use "MenuHeader" font height in separators with label 2024-10-28 19:06:32 +00:00
tokyo4j
fe6b3c1c35 theme: replace *.hover.bg.shape with *.hover.bg.corner-radius 2024-10-13 12:31:51 +01:00
Johan Malm
e16e78e7a4 theme: add window.titlebar.padding.{width,height}
...to replace padding.{width,height} to minimize breaking changes with the
visual appearance of the titlebar.

With the diverging labwc specification for the titlebar (listed below)
we have to choose between (a) not supporting the padding.{width,height}
option which exist in many extant Openbox themes to keep titlebar height
(almost) the same; or (b) making the allocated button areas much smaller
and not keeping the default hover going all the way to the edges. All in
all it just seems a lot simpler and cleaner to break this link to the
openbox spec.

Examples of previous change driving the requirement for this change:

- SVG and PNG support which often results in large icons with hover
  effects.
- Theme option window.button.{height,width}
- Larger default areas for icons (26x26)

In way of an example, Numix theme sets a padding.height of 6 which would
have resulted in a titlebar 12px taller without this change.
2024-10-08 20:04:05 +01:00
Johan Malm
0aa4cfe32d theme: add window.button.height
window.button.{height,width} determine the space allocated for buttons.
Buttons can be smaller than this size and will then just be center aligned
within the allocated space. However, buttons will be clamped at this size
to prevent them from going outside of the allocated space.
2024-10-08 20:04:05 +01:00
tokyo4j
c2a3a354db theme: refine the management of corner buttons
- The builtin hover effect is now unrounded when the window is tiled.
- All the corner button icons including ones provided by the user are
  now rounded when the window is not tiled.
- Fixed the bug that the window menu button as a fallback of the window
  icon is not correctly rounded.
2024-10-05 20:53:51 +01:00
Jens Peters
9395348c55 theme: add circle button hover effect (#2127) 2024-09-10 22:14:30 +01:00
Jens Peters
824b0fa4e3 theme: add button padding and spacing (#2127)
While at it, separate corner width from button
width. Both are independed and having them
separately improves readability.
2024-09-10 22:14:30 +01:00
Andrew J. Hesford
b7bccc8026 ssd: add optional omnipresent button 2024-08-24 05:42:38 +02:00
Andrew J. Hesford
186a07be9b ssd: add optional shade button 2024-08-24 05:42:38 +02:00
droc12345
8fda9968e6
menu: add title theme options (#2097)
Add theme options `menu.title.text.color` and `menu.title.text.justify`.

Add font place MenuHeader: `<font place="MenuHeader">`

Add `Oblique` font style

```
<theme>
  <font>
    <slant>Oblique</slant>
  </font>
</theme>
```
2024-08-21 18:27:07 +01:00
Johan Malm
9bc381d9e8 menu: use theme->menu_item_height instead of menu->item_height
...and set it in theme.c post_processing()
2024-08-20 18:01:22 +01:00
Johan Malm
0552c6b7f0 menu: support titles
...defined by `<separator label="">`.

Also add the theme option `menu.title.bg.color: #589bda`

The following will be added in separate commits
- menu.title.bg.border.color: #7cb6ec
- menu.title.text.color: #ffffff
- menu.title.text.justify: center
2024-08-20 18:01:22 +01:00
Consus
e4afa10fe4
theme: allow to set window button size (#1965)
This commit introduces new option "window.button.width". Despite the name
it currently affects both width and height.
2024-07-20 09:33:57 +01:00
Simon Long
8ba066a1a5
Add screen magnifier
This adds a screen magnifier which can be controlled with the
`ZoomIn` / `ZoomOut` and `ToggleMagnify` actions.

It scales up part of the rendered framebuffer so the magnification
may end up looking blurry depending on the magnification scale.

PR #1774
2024-05-16 00:07:23 +02:00
David Turner
ce0d2c2966
ssd: add window drop-shadows (#1648)
Add optional drop-shadows to windows using server-side decoration.
Shadows can be enabled/disabled rc.xml and their appearance configured
in themerc.  The default is no shadows to preserve current behaviour.

The shadows are drawn in fixed corner and edge buffers shared between
all windows, the edges are scaled to size depending on the size of each
window.  Two sets of buffers are used to give the different appearances
for active and inactive windows.  I use separate corner/edge buffers for
a few reasons:

- It avoids needing to store a separate large shadow buffer per window
- It avoids needing to redraw the shadows when the window is being
  resized
- Compositing the shadows onto the desktop should be faster as there are
  overall fewer pixels to blend, and scaling up the edge buffers only
  requires reading a tiny buffer which is then replicated.
2024-04-22 19:27:53 +01:00
tokyo4j
b0ba585ff8 overlay: allow to draw both/either of filled/outlined rectangle
Filled/outlined rectangles shown as snapping overlay are now enabled/disabled
independently with `snapping.overlay.[region|edge].bg.enabled` and
`snapping.overlay.[region|edge].border.enabled`.

To keep the default behavior, `*.bg.enabled` is yes and `*.border.enabled` is
no for hardware-based renderers, while `*.bg.enabled` is no and
`*.border.enabled` is yes for software-based (pixman) renderer.

Users can now use a filled rectangle as an overlay even with pixman renderer.
However, this may severely impact performance when used with translucent
`snapping.overlay.[region|edge].bg.color`.

This commit includes a refactor to use substruct `theme_snapping_overlay`
inside `theme` in order to pass it to `create_overlay_rect()` in a cleaner way.

Breaking changes is:
- `snapping.overlay.[region|edge].fill` is now removed.
2024-04-22 19:22:23 +01:00
tokyo4j
34290ef629 overlay: s/preview/overlay/
Replace "preview" in rc.xml and themerc with "overlay" since "preview" sounds
like it shows the window content.

Breaking changes are:
- `snapping.preview.*` in themerc is now replaced with `snapping.overlay`.
- `<snapping><preview>` in rc.xml is now replaced with `<snapping><overlay>`.
2024-04-22 19:22:23 +01:00
tokyo4j
8096df19ba osd: add theme settings for window-switcher preview
Adds theme settings like:
osd.window-switcher.preview.border.width: 2
osd.window-switcher.preview.border.color: #ffffff,#00a2ff,#ffffff
2024-04-16 09:58:34 +02:00
tokyo4j
3b13f4cdcd overlay: add theme settings for colors and border width
adds theme settings like:
snapping.overlay.[region|edge].bg.color: #8080b380
snapping.overlay.[region|edge].border.color: #ffffff,#000000,#ffffff
snapping.overlay.[region|edge].border.width: 1
2024-04-15 12:33:40 +02:00
tokyo4j
50fd65416f overlay: add theme setting snapping.preview.[region|edge].fill
This settings allows user to choose whether to draw a filled rectangle
or an outlined rectangle as the preview for window snapping.
2024-04-15 12:33:40 +02:00
Droc
eb5e855b69 osd: support percent values for window switcher width
Add ability to set width with percentage of monitor instead of just pixels.
With this the OSD sizes itself properly on both my 4k and 2k monitors.

example: 50% or 75% instead of 600, max 100%
2024-04-08 15:44:53 +02:00
John Lindgren
d207e97992 theme: use non-hover button variants as fallback
Some themes don't have hover variants for button pixmaps.
It looks better visually to use the non-hover variants as fallbacks
rather than the built-in 6x6 pixmaps.
2023-12-21 02:42:23 +01:00
kyak
268191fce8
Add theme option to configure boxes from workspace OSD
This allows to configure width and height of "boxes" displayed in the
workspace OSD. A setting of `0` disables the boxes.
2023-12-11 10:41:33 +01:00
Simon Long
c79b8ba8a7
Support hover icons in titlebar (#1280)
Allow both max_toggled_hover and max_hover_toggled names for icons
2023-12-06 20:33:26 +00:00
Moises Lima
47a80fc4f2 Refactor title height to use 'titlebar.height' from themerc 2023-10-06 22:19:16 +01:00
Johan Malm
eca98a9b6e theme: simplify loading of xbm buttons
No functional change.
2023-08-09 07:38:17 +01:00
Consolatis
235a8ad9bc ToggleKeybinds per window 2023-07-06 06:02:28 +01:00
Consolatis
660127acb0 theme: add option osd.window-switcher.item.active.border.width
...and change default values for the variables below to keep the
window-switcher look the same as it was at the last release.

osd.window-switcher.padding = 4
osd.window-switcher.item.padding.y = 1
osd.window-switcher.item.active.border.width = 2
2023-07-05 21:31:30 +01:00
Johan Malm
55bf79c3fe theme: add option osd.window-switcher.padding
Fixes: issue #969
2023-07-05 21:31:30 +01:00
Johan Malm
df53c28a0f theme: add window-switcher width/padding
...and calculate item-height based on font-height

Add theme options
  - osd.window-switcher.width
  - osd.window-switcher.item.padding.x
  - osd.window-switcher.item.padding.y

Issue #879
2023-06-29 19:14:08 +01:00
Tomi Ollila
7ad5200f2e includes: identifier consistency in include guards
Made all header files to have LABWC_ prefix in include guard identifers.

Converted from __LABWC_ in 35 include/ files.
Converted from __LAB_ in 5 include/ files.
Added LABWC prefix to 3 include/ files.
Added include guards to 3 include/ files.

The double underscores were removed since according to C standard
those "are always reserved for any use".
2023-05-13 22:29:21 +01:00
Consolatis
d00327bc32 menu: Dynamically adjust menu width based on widest item
Adds two new theme vars:
- menu.width.min (menu will never be smaller than this)
- menu.width.max (menu will never be wider than this + padding)

A fixed menu width can be achieved by setting
menu.width.min == menu.width.max.
2022-12-06 21:08:43 +00:00
Consolatis
f0666ba5c9 menu: Convert hardcoded item padding to theme vars
Adds two new theme vars:
- menu.items.padding.x
- menu.items.padding.y
2022-12-06 21:08:43 +00:00
Consolatis
3da7cfd8c6 theme: Rename separator_width to separator_line_thickness 2022-12-06 21:08:43 +00:00
Johan Malm
437230b3a0 menu: support <separator />
Add theme options:
- menu.separator.width
- menu.separator.padding.width
- menu.separator.padding.height
- menu.separator.color

Support separator lines defined by <separator />

Note that separator labels (with text) defined by <separator label="" />
are not supported.
2022-06-25 14:56:35 +02:00
Consolatis
b7907cc2da theme: implement osd.border.color and osd.border.width
http://openbox.org/wiki/Help:Themes#osd.border.color
http://openbox.org/wiki/Help:Themes#osd.border.width
2022-06-01 17:55:36 +01:00
Consolatis
044388a5cd Prepare to move from wlr_texture to lab_data_buffer 2022-02-23 21:47:01 +00:00
Consolatis
b7b1e8064f Add WindowMenu button 2022-01-26 06:17:41 +00:00