Commit graph

109 commits

Author SHA1 Message Date
Delgan
b85ba99980 Apply "clang-format" preferences globally 2024-04-07 10:05:10 +02:00
Daniel Eklöf
d841aeeecd
config: layer: add 'overlay' and 'background'
The layer option (Wayland only) now accepts 'overlay' and
'background'.

Closes #372
2024-04-06 15:39:19 +02:00
Daniel Eklöf
f923261fec
config: don’t ignore asprintf() return value 2023-07-11 12:40:14 +02:00
Daniel Eklöf
d6e7710a7e
particle: on-click: tilde expansion
We now do tilde expansion of the *first* argument in on-click
handlers.

That is:

  ~/bin/foobar.sh ~/arg1

is expanded to

  $HOME/bin/foobar.sh ~/arg1

(meaning, the handler will most likely *not* do what you’d expect)

Related to #307
2023-07-11 10:31:40 +02:00
Peter Rice
6ed576c719
particle/on-click: support next/previous buttons 2022-10-04 21:14:29 +02:00
Daniel Eklöf
ffccabbb13
config: add inheritable option “font-shaping”
This patch adds an inheritable option, “font-shaping”, that controls
whether a particle that renders text should enable font-shaping or
not.

The option works similar to the ‘font’ option: one can set it at the
top-level, and it gets inherited down through all modules and to their
particles.

Or, you can set it on a module and it gets inherited to all its
particles, but not to other modules’ particles.

Finally, you can set it on individual particles, in which case it only
applies to them (or “child” particles).

When font-shaping is enabled (the default), the string particle shapes
full text runs using the fcft_rasterize_text_run_utf32() API. In fcft,
this results in HarfBuzz being used to shape the string.

When disabled, the string particle instead uses the simpler
fcft_rasterize_char_utf32() API, which rasterizes individual
characters.

This gives user greater control over the font rendering. One example
is bitmap fonts, which HarfBuzz often doesn’t get right.

Closes #159
2022-02-23 18:43:13 +01:00
Daniel Eklöf
6ac046dec3
config: implement font fallback
Fonts in the configuration may now be a comma separated list of
fonts (all using the fontconfig format). The first font is the primary
font, and the rest are fallback fonts that will be searched, in order.
2022-02-10 18:34:15 +01:00
Nulo
eb94c8cceb
Add layer option
Only applies to Wayland and the default is still bottom.
2021-08-25 18:42:46 +02:00
Daniel Eklöf
b97ba80aea
bar: add border.{left,right,top,bottom}-width
This allows you to configure the width of each side of the border
individually. border.width can still be used, and will set all four
borders to the same width.

Closes #77
2021-07-28 11:00:04 +02:00
Daniel Eklöf
0aef2f85ee
config: add bar.trackpad-sensitivity
This is an integer that specifies the amount of scrolling that needs
to be accumulated before a wheel-up/down event is emitted.

A higher value means you need to drag your fingers a longer distance
before the event is emitted.

The default is 30.
2021-07-01 17:15:54 +02:00
Daniel Eklöf
34d832cd22
config+particle: add support for mouse wheel up/down 2021-07-01 17:15:53 +02:00
Daniel Eklöf
c79ffbe057
Add support binding on-click handlers to other buttons than LEFT
One can now bind the left/middle/right mouse buttons to on-click. In
fact, you can have all three buttons bound to different handlers for
the same particle. The new syntax is

    on-click:
        left: <command>
        middle: <command>
        right: <command>

Leaving one out is the same thing as not mapping it at
all. Furthermore,

    on-click: <command>

is still valid, and is a shorthand for

    on-click:
        left: <commsnd>
2021-07-01 17:15:53 +02:00
Daniel Eklöf
3603ca982a
config: fix asan signed integer overflow warning 2021-01-02 12:53:24 +01:00
Daniel Eklöf
dee61e6239
config: fix rounding error when calculating background color with alpha
We use pre-multiplied alpha color channels, but were having bad
rounding errors due to the alpha divider being truncated to an
integer.

The algorithm for pre-multiplying a color channel is:

  alpha_divider = 0xffff / alpha
  pre_mult_color = color / alpha_divider

In order to fix the rounding errors, we could turn ‘alpha_divider’
into a double.

That however would introduce a performance penalty since now we’d need
to do floating point math for each cell.

The algorithm can be trivially converted to:

  pre_mult_color = color * alpha / 0xffff

Since both color and alpa values are < 65536, the multiplication is
“safe”; it will not overflow an uint32_t.
2020-12-20 12:48:06 +01:00
Daniel Eklöf
f49652130d
config: don’t crash (div-by-zero) if the alpha component is 0 2020-11-25 20:41:41 +01:00
Daniel Eklöf
03a5c8746f
fcft: adjust to fcft-2.0 API changes
* font_*() -> fcft_*()
* struct font -> struct fcft_font
* struct glyph -> struct fcft_glyph
* enum subpixel_order -> enum fcft_subpixel
2020-04-22 11:50:29 +02:00
Daniel Eklöf
ebc7511706
fcft: update to 1.1.0 2020-02-01 20:14:29 +01:00
Daniel Eklöf
677c43ea60
config: font_from_name() no longer accepts a tllist 2019-12-01 19:29:36 +01:00
Daniel Eklöf
51a6631c19
fcft: use fcft instead of local copy of font.{c,h} 2019-12-01 16:00:15 +01:00
Daniel Eklöf
c11fee4ce3
cairo: replace cairo with pixman in decos, particles and modules
All decoration, particle and module interfaces now takes a
pixman_image_t parameter, and all drawing is done using pixman APIs.

The wayland/xcb backends implement a new interface functions,
get_pixman_image(), that should return a pixman image instance that is
suitable for rendering.

In the wayland backend, the image uses the same backing data as the
cairo surface.

In the XCB backend, we create a new image each time, and then blit it
to the cairo surface at commit time.
2019-09-22 01:56:58 +02:00
Daniel Eklöf
b3a5e0b5d7
font: initial port from cairo scaled fonts to raw freetype + pixman 2019-09-22 00:50:11 +02:00
Daniel Eklöf
5eef162d39 main: add -b,--backend command line option
This option allows the user to explicitly select the backend to
use. The default is still to auto-detect.
2019-05-11 10:53:09 +02:00
Daniel Eklöf
473802cab8 bar: allow explicit backend selection 2019-05-11 10:43:14 +02:00
Daniel Eklöf
50d6afab6a bar: add margin properties to the border 2019-02-17 15:45:02 +01:00
Daniel Eklöf
ae5029826b cmake: break out bar stuff to separate CMakeLists.txt 2019-02-07 12:06:16 +01:00
Daniel Eklöf
f26892d938 bar: allow user to specify _which_ monitor to place the bar on
If not specified, the primary monitor will be used.
2019-01-20 22:05:12 +01:00
Daniel Eklöf
b1453fd65e font: simplify configuration format; it's just a string now 2019-01-20 09:51:44 +01:00
Daniel Eklöf
1c18dbf1a0 decorations: remove header files 2019-01-13 17:45:09 +01:00
Daniel Eklöf
7754ef3661 decorations: are now plugins 2019-01-13 17:43:25 +01:00
Daniel Eklöf
bc62843c91 modules: get rid of struct module_info
Since this struct only contained function pointers, make all modules
export those functions directly.

The plugin manager now defines a module interface struct, and fills it
it by dlsym:ing the functions that used to be in module_info.
2019-01-13 17:09:11 +01:00
Daniel Eklöf
07b1615a41 particles: get rid of struct particle_info
Since this struct only contained function pointers, make all particles
export those functions directly.

The plugin manager now defines a particle interface struct, and fills
it it by dlsym:ing the functions that used to be in particle_info.
2019-01-13 17:03:35 +01:00
Daniel Eklöf
a425378576 config: allow font/foreground attributes on modules too
Previously we allowed it on the bar, and on all particles. Now we also
allow it on all modules.

This allows us to specify a "default" font/foreground on a per-module
basis, having it applied to all the modules particles.
2019-01-13 14:24:44 +01:00
Daniel Eklöf
8dc278aaf2 config: pass a struct with inheritable values
For now, font and foreground color
2019-01-13 14:13:14 +01:00
Daniel Eklöf
7776135454 particles: caller of from_conf() must provide base particle instance 2019-01-13 13:25:14 +01:00
Daniel Eklöf
47018104da particles: compile as shared libraries (plugins) 2019-01-13 11:13:47 +01:00
Daniel Eklöf
7b98ea2b7c particle/string: expose info through the new struct particle_info struct 2019-01-13 10:49:10 +01:00
Daniel Eklöf
9f8000b047 particle/ramp: expose info through the new struct particle_info struct 2019-01-13 10:40:47 +01:00
Daniel Eklöf
21e28315e3 particle/progress-bar: expose info through the new struct particle_info struct 2019-01-13 10:38:25 +01:00
Daniel Eklöf
73b8bf1346 particle/map: expose info through the new struct particle_info struct 2019-01-13 10:34:15 +01:00
Daniel Eklöf
6379b1939f particle/list: expose info through the new struct particle_info struct 2019-01-12 22:56:00 +01:00
Daniel Eklöf
0f8f21510a particle/empty: expose info through the new struct particle_info struct 2019-01-12 22:48:23 +01:00
Daniel Eklöf
962252467f plugins: only dlopen() each plugin once. dlcose() in destructor 2019-01-12 19:38:06 +01:00
Daniel Eklöf
64b77a0efc config: dlopen() modules on-demand
TODO: optimizations and proper cleanup

* We currently reload the shared library for each *instance* of the
  module, and we do it twice; once when verifying, and once when
  instantiating.

* The shared libraries are never dlclosed()
2019-01-12 19:03:49 +01:00
Daniel Eklöf
731ab848e1 config: fix: attributes always use dash, not underscore 2019-01-12 13:56:02 +01:00
Daniel Eklöf
6f9e48698e module/xwindow: export module info through the new module_info struct type 2019-01-12 13:03:41 +01:00
Daniel Eklöf
905f289659 module/xkb: export module info through the new module_info struct type 2019-01-12 13:01:24 +01:00
Daniel Eklöf
87640339e1 module/removables: export module info through the new module_info struct type 2019-01-12 12:59:21 +01:00
Daniel Eklöf
697e613b2e module/network: export module info through the new module_info struct type 2019-01-12 12:56:54 +01:00
Daniel Eklöf
a16e2f5a53 module/mpd: export module info through the new module_info struct type 2019-01-12 12:52:42 +01:00
Daniel Eklöf
fb9f07dcad module/label: export module info through the new module_info struct type 2019-01-12 12:52:36 +01:00