2018-08-10 14:37:03 +00:00
|
|
|
project(
|
|
|
|
'waybar', 'cpp', 'c',
|
2024-04-23 05:53:22 +00:00
|
|
|
version: '0.10.1',
|
2018-08-10 14:37:03 +00:00
|
|
|
license: 'MIT',
|
2024-02-17 08:58:39 +00:00
|
|
|
meson_version: '>= 0.59.0',
|
2018-08-30 09:30:20 +00:00
|
|
|
default_options : [
|
2023-07-16 13:05:42 +00:00
|
|
|
'cpp_std=c++20',
|
2018-11-08 08:57:24 +00:00
|
|
|
'buildtype=release',
|
|
|
|
'default_library=static'
|
2018-08-30 09:30:20 +00:00
|
|
|
],
|
2018-08-10 14:37:03 +00:00
|
|
|
)
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2020-02-11 13:38:05 +00:00
|
|
|
compiler = meson.get_compiler('cpp')
|
|
|
|
|
2018-12-26 10:13:36 +00:00
|
|
|
cpp_args = []
|
2018-08-19 11:41:22 +00:00
|
|
|
cpp_link_args = []
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2019-05-12 17:53:14 +00:00
|
|
|
if get_option('libcxx')
|
2018-08-08 21:54:58 +00:00
|
|
|
cpp_args += ['-stdlib=libc++']
|
|
|
|
cpp_link_args += ['-stdlib=libc++', '-lc++abi']
|
2019-08-09 10:00:52 +00:00
|
|
|
endif
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2019-08-09 10:00:52 +00:00
|
|
|
if compiler.has_link_argument('-lc++fs')
|
|
|
|
cpp_link_args += ['-lc++fs']
|
|
|
|
elif compiler.has_link_argument('-lstdc++fs')
|
2018-08-08 21:54:58 +00:00
|
|
|
cpp_link_args += ['-lstdc++fs']
|
|
|
|
endif
|
|
|
|
|
2020-04-05 14:12:25 +00:00
|
|
|
git = find_program('git', native: true, required: false)
|
2018-12-26 10:13:36 +00:00
|
|
|
|
|
|
|
if not git.found()
|
|
|
|
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
|
|
|
|
else
|
2024-02-17 07:59:38 +00:00
|
|
|
git_path = run_command(git, 'rev-parse', '--show-toplevel', check: false).stdout().strip()
|
|
|
|
if meson.project_source_root() == git_path
|
|
|
|
git_commit_hash = run_command(git, 'describe', '--always', '--tags', check: false).stdout().strip()
|
|
|
|
git_branch = run_command(git, 'rev-parse', '--abbrev-ref', 'HEAD', check: false).stdout().strip()
|
2020-06-24 13:06:30 +00:00
|
|
|
version = '"@0@ (branch \'@1@\')"'.format(git_commit_hash, git_branch)
|
2020-05-24 17:14:27 +00:00
|
|
|
add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp')
|
|
|
|
else
|
|
|
|
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
|
|
|
|
endif
|
2018-12-26 10:13:36 +00:00
|
|
|
endif
|
2018-11-08 08:57:24 +00:00
|
|
|
|
2020-02-05 19:02:42 +00:00
|
|
|
code = '''
|
|
|
|
#include <langinfo.h>
|
|
|
|
#include <locale.h>
|
2020-02-04 00:58:18 +00:00
|
|
|
int main(int argc, char** argv) {
|
2020-02-05 19:02:42 +00:00
|
|
|
locale_t locale = newlocale(LC_ALL, "en_US.UTF-8", nullptr);
|
2020-02-04 00:58:18 +00:00
|
|
|
char* str;
|
2020-02-05 19:02:42 +00:00
|
|
|
str = nl_langinfo_l(_NL_TIME_WEEK_1STDAY, locale);
|
|
|
|
str = nl_langinfo_l(_NL_TIME_FIRST_WEEKDAY, locale);
|
|
|
|
freelocale(locale);
|
2020-02-04 00:58:18 +00:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
if compiler.links(code, name : 'nl_langinfo with _NL_TIME_WEEK_1STDAY, _NL_TIME_FIRST_WEEKDAY')
|
|
|
|
add_project_arguments('-DHAVE_LANGINFO_1STDAY', language: 'cpp')
|
|
|
|
endif
|
|
|
|
|
2018-08-08 21:54:58 +00:00
|
|
|
add_global_arguments(cpp_args, language : 'cpp')
|
|
|
|
add_global_link_arguments(cpp_link_args, language : 'cpp')
|
|
|
|
|
2019-08-09 09:52:16 +00:00
|
|
|
is_linux = host_machine.system() == 'linux'
|
2019-08-09 10:40:33 +00:00
|
|
|
is_dragonfly = host_machine.system() == 'dragonfly'
|
|
|
|
is_freebsd = host_machine.system() == 'freebsd'
|
|
|
|
is_netbsd = host_machine.system() == 'netbsd'
|
|
|
|
is_openbsd = host_machine.system() == 'openbsd'
|
2019-08-09 09:52:16 +00:00
|
|
|
|
2018-08-08 21:54:58 +00:00
|
|
|
thread_dep = dependency('threads')
|
2022-06-24 13:44:06 +00:00
|
|
|
fmt = dependency('fmt', version : ['>=8.1.1'], fallback : ['fmt', 'fmt_dep'])
|
|
|
|
spdlog = dependency('spdlog', version : ['>=1.10.0'], fallback : ['spdlog', 'spdlog_dep'], default_options : ['external_fmt=enabled'])
|
2018-08-08 21:54:58 +00:00
|
|
|
wayland_client = dependency('wayland-client')
|
|
|
|
wayland_cursor = dependency('wayland-cursor')
|
|
|
|
wayland_protos = dependency('wayland-protocols')
|
2019-08-28 03:57:23 +00:00
|
|
|
gtkmm = dependency('gtkmm-3.0', version : ['>=3.22.0'])
|
2018-10-25 09:47:03 +00:00
|
|
|
dbusmenu_gtk = dependency('dbusmenu-gtk3-0.4', required: get_option('dbusmenu-gtk'))
|
2024-02-17 07:30:00 +00:00
|
|
|
giounix = dependency('gio-unix-2.0')
|
2022-11-03 13:08:22 +00:00
|
|
|
jsoncpp = dependency('jsoncpp', version : ['>=1.9.2'], fallback : ['jsoncpp', 'jsoncpp_dep'])
|
2018-08-08 21:54:58 +00:00
|
|
|
sigcpp = dependency('sigc++-2.0')
|
2022-08-23 18:22:40 +00:00
|
|
|
libinotify = dependency('libinotify', required: false)
|
2019-08-09 09:52:16 +00:00
|
|
|
libepoll = dependency('epoll-shim', required: false)
|
2022-08-22 12:36:21 +00:00
|
|
|
libinput = dependency('libinput', required: get_option('libinput'))
|
2018-10-21 09:58:35 +00:00
|
|
|
libnl = dependency('libnl-3.0', required: get_option('libnl'))
|
|
|
|
libnlgen = dependency('libnl-genl-3.0', required: get_option('libnl'))
|
2022-03-15 16:54:06 +00:00
|
|
|
upower_glib = dependency('upower-glib', required: get_option('upower_glib'))
|
2023-10-26 21:08:57 +00:00
|
|
|
pipewire = dependency('libpipewire-0.3', required: get_option('pipewire'))
|
2021-11-01 18:17:29 +00:00
|
|
|
playerctl = dependency('playerctl', version : ['>=2.0.0'], required: get_option('mpris'))
|
2018-10-21 09:58:35 +00:00
|
|
|
libpulse = dependency('libpulse', required: get_option('pulseaudio'))
|
2019-02-19 04:11:18 +00:00
|
|
|
libudev = dependency('libudev', required: get_option('libudev'))
|
2021-02-07 20:05:11 +00:00
|
|
|
libevdev = dependency('libevdev', required: get_option('libevdev'))
|
2019-04-16 14:34:37 +00:00
|
|
|
libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
|
2021-07-13 01:33:12 +00:00
|
|
|
xkbregistry = dependency('xkbregistry')
|
2022-02-09 07:53:52 +00:00
|
|
|
libjack = dependency('jack', required: get_option('jack'))
|
2024-02-14 20:37:36 +00:00
|
|
|
libwireplumber = dependency('wireplumber-0.5', required: get_option('wireplumber'))
|
2020-09-06 17:44:13 +00:00
|
|
|
|
|
|
|
libsndio = compiler.find_library('sndio', required: get_option('sndio'))
|
|
|
|
if libsndio.found()
|
|
|
|
if not compiler.has_function('sioctl_open', prefix: '#include <sndio.h>', dependencies: libsndio)
|
|
|
|
if get_option('sndio').enabled()
|
|
|
|
error('libsndio is too old, required >=1.7.0')
|
|
|
|
else
|
|
|
|
warning('libsndio is too old, required >=1.7.0')
|
|
|
|
libsndio = dependency('', required: false)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2024-01-16 06:10:28 +00:00
|
|
|
gtk_layer_shell = dependency('gtk-layer-shell-0', version: ['>=0.6.0'],
|
2024-01-14 18:25:37 +00:00
|
|
|
default_options: ['introspection=false', 'vapi=false'],
|
|
|
|
fallback: ['gtk-layer-shell', 'gtk_layer_shell'])
|
2019-09-07 17:57:35 +00:00
|
|
|
systemd = dependency('systemd', required: get_option('systemd'))
|
2023-01-17 01:30:06 +00:00
|
|
|
|
|
|
|
cpp_lib_chrono = compiler.compute_int('__cpp_lib_chrono', prefix : '#include <chrono>')
|
2023-11-10 14:57:26 +00:00
|
|
|
have_chrono_timezones = cpp_lib_chrono >= 201611
|
|
|
|
|
|
|
|
if have_chrono_timezones
|
|
|
|
code = '''
|
|
|
|
#include <chrono>
|
|
|
|
using namespace std::chrono;
|
|
|
|
int main(int argc, char** argv) {
|
|
|
|
const time_zone* tz;
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
'''
|
|
|
|
if not compiler.links(code)
|
|
|
|
have_chrono_timezones = false
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2023-01-17 01:30:06 +00:00
|
|
|
if have_chrono_timezones
|
|
|
|
tz_dep = declare_dependency()
|
|
|
|
else
|
|
|
|
tz_dep = dependency('date',
|
|
|
|
required: false,
|
|
|
|
default_options : [ 'use_system_tzdb=true' ],
|
|
|
|
modules : [ 'date::date', 'date::date-tz' ],
|
|
|
|
fallback: [ 'date', 'tz_dep' ])
|
|
|
|
endif
|
2019-09-07 17:57:35 +00:00
|
|
|
|
2019-09-10 12:12:52 +00:00
|
|
|
prefix = get_option('prefix')
|
build: drop -Dout in favor of --prefix
$ meson --prefix=/tmp/foo _build
$ ninja install -C _build
[49/50] Installing files.
Installing waybar to /tmp/foo/bin
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 127, in run
return options.run_func(options)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 514, in run
installer.do_install(datafilename)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 346, in do_install
self.install_data(d)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 375, in install_data
d.dirmaker.makedirs(outdir, exist_ok=True)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 55, in makedirs
os.makedirs(path, exist_ok=exist_ok)
File "/usr/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/etc/xdg'
FAILED: meson-install
2019-08-11 10:09:55 +00:00
|
|
|
sysconfdir = get_option('sysconfdir')
|
2019-09-08 12:04:34 +00:00
|
|
|
conf_data = configuration_data()
|
2019-09-10 12:12:52 +00:00
|
|
|
conf_data.set('prefix', prefix)
|
2019-09-08 12:04:34 +00:00
|
|
|
|
2024-02-17 08:53:45 +00:00
|
|
|
add_project_arguments('-DSYSCONFDIR="@0@"'.format(prefix / sysconfdir), language : 'cpp')
|
build: drop -Dout in favor of --prefix
$ meson --prefix=/tmp/foo _build
$ ninja install -C _build
[49/50] Installing files.
Installing waybar to /tmp/foo/bin
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/mesonbuild/mesonmain.py", line 127, in run
return options.run_func(options)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 514, in run
installer.do_install(datafilename)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 346, in do_install
self.install_data(d)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 375, in install_data
d.dirmaker.makedirs(outdir, exist_ok=True)
File "/usr/lib/python3.6/site-packages/mesonbuild/minstall.py", line 55, in makedirs
os.makedirs(path, exist_ok=exist_ok)
File "/usr/lib/python3.6/os.py", line 210, in makedirs
makedirs(head, mode, exist_ok)
File "/usr/lib/python3.6/os.py", line 220, in makedirs
mkdir(name, mode)
PermissionError: [Errno 13] Permission denied: '/etc/xdg'
FAILED: meson-install
2019-08-11 10:09:55 +00:00
|
|
|
|
2019-09-07 17:57:35 +00:00
|
|
|
if systemd.found()
|
2024-02-17 07:59:38 +00:00
|
|
|
user_units_dir = systemd.get_variable(pkgconfig: 'systemduserunitdir')
|
2019-09-08 12:04:34 +00:00
|
|
|
|
|
|
|
configure_file(
|
|
|
|
configuration: conf_data,
|
|
|
|
input: './resources/waybar.service.in',
|
|
|
|
output: '@BASENAME@',
|
|
|
|
install_dir: user_units_dir
|
|
|
|
)
|
2019-09-07 17:57:35 +00:00
|
|
|
endif
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2018-08-20 15:20:02 +00:00
|
|
|
src_files = files(
|
|
|
|
'src/factory.cpp',
|
2019-06-15 12:57:52 +00:00
|
|
|
'src/AModule.cpp',
|
2018-08-20 15:20:02 +00:00
|
|
|
'src/ALabel.cpp',
|
2021-10-17 18:08:16 +00:00
|
|
|
'src/AIconLabel.cpp',
|
2023-07-10 20:50:58 +00:00
|
|
|
'src/AAppIconLabel.cpp',
|
2018-08-20 15:20:02 +00:00
|
|
|
'src/modules/custom.cpp',
|
2019-09-23 20:25:54 +00:00
|
|
|
'src/modules/disk.cpp',
|
2019-08-22 16:04:09 +00:00
|
|
|
'src/modules/idle_inhibitor.cpp',
|
2022-01-16 23:55:13 +00:00
|
|
|
'src/modules/image.cpp',
|
2022-12-21 16:44:11 +00:00
|
|
|
'src/modules/load.cpp',
|
2019-03-13 12:18:08 +00:00
|
|
|
'src/modules/temperature.cpp',
|
2022-09-30 11:33:23 +00:00
|
|
|
'src/modules/user.cpp',
|
2023-10-15 14:32:05 +00:00
|
|
|
'src/ASlider.cpp',
|
2018-08-20 15:20:02 +00:00
|
|
|
'src/main.cpp',
|
|
|
|
'src/bar.cpp',
|
2020-01-21 16:48:45 +00:00
|
|
|
'src/client.cpp',
|
2021-08-13 13:08:27 +00:00
|
|
|
'src/config.cpp',
|
2021-10-31 22:55:13 +00:00
|
|
|
'src/group.cpp',
|
search for dark or light mode stylesheet
summary:
-------
This commit adds xdg-desktop-portal support to waybar. If a portal
supporting `org.freedesktop.portal.Settings` exists, then it will be
queried for the current colorscheme. This colorscheme will then be used
to prefer a `style-light.css` or `style-dark.css` over the basic
`style.css`.
technical details:
-----------------
Appearance is provided by several libraries, such as libhandy (mobile)
and libadwaita. However, waybar links to neither of these libraries. As
the amount of code required to communicate with xdg-desktop portal as a
client is rather minimal, I believe doing so is better than linking to
an additional library.
The Gio library for communicating with dbus is rather messy, Instead of
the `Portal` class containing a `Gio::Dbus::Proxy`, it extends it which
simplifies signal handling.
`Portal` then exposes its own signal, which can be listened to by waybar
to update CSS.
For a reference implementation, please see another one of my projects:
https://github.com/4e554c4c/darkman.nvim/blob/main/portal.go
test plan:
---------
If no desktop portal which provides `Settings` exists, then waybar
continues with the log line
```
[2023-09-06 14:14:37.754] [info] Unable to receive desktop appearance: GDBus.Error:org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.Settings” on object at path /org/freedesktop/portal/desktop
```
Furthermore, if `style-light.css` or `style-dark.css` do not exist, then
`style.css` will still be searched for.
Waybar has been tested with both light and dark startup. E.g. if the
appearance is dark on startup the log lines
```
[2023-09-06 14:27:45.379] [info] Discovered appearance 'dark'
[2023-09-06 14:27:45.379] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style-dark.css
[2023-09-06 14:27:45.379] [debug] Found config file: $XDG_CONFIG_HOME/waybar/style-dark.css
[2023-09-06 14:27:45.379] [info] Using CSS file /home/pounce/.config/waybar/style-dark.css
```
will be observed.
If the color then changes to light during the operation of waybar, it
will change css files:
```
[2023-09-06 14:28:17.173] [info] Received new appearance 'dark'
[2023-09-06 14:28:17.173] [debug] Try expanding: $XDG_CONFIG_HOME/waybar/style-light.css
[2023-09-06 14:28:17.173] [debug] Found config file: $XDG_CONFIG_HOME/waybar/style-light.css
[2023-09-06 14:28:17.173] [info] Using CSS file /home/pounce/.config/waybar/style-light.css
```
Finally, tested resetting waybar and toggling style (works, and style is
only changed once).
fixes: Alexays/Waybar#1973
2023-09-06 15:19:56 +00:00
|
|
|
'src/util/portal.cpp',
|
2023-09-09 22:48:36 +00:00
|
|
|
'src/util/enum.cpp',
|
2023-06-07 08:17:42 +00:00
|
|
|
'src/util/prepare_for_sleep.cpp',
|
2022-10-09 17:13:54 +00:00
|
|
|
'src/util/ustring_clen.cpp',
|
2022-10-19 11:25:08 +00:00
|
|
|
'src/util/sanitize_str.cpp',
|
2023-06-28 22:28:38 +00:00
|
|
|
'src/util/rewrite_string.cpp',
|
2023-10-09 16:53:00 +00:00
|
|
|
'src/util/gtk_icon.cpp',
|
2024-01-22 02:23:46 +00:00
|
|
|
'src/util/regex_collection.cpp',
|
|
|
|
'src/util/css_reload_helper.cpp'
|
2018-08-20 15:20:02 +00:00
|
|
|
)
|
2018-08-08 21:54:58 +00:00
|
|
|
|
2024-02-17 16:17:42 +00:00
|
|
|
man_files = files(
|
|
|
|
'man/waybar-custom.5.scd',
|
|
|
|
'man/waybar-disk.5.scd',
|
|
|
|
'man/waybar-idle-inhibitor.5.scd',
|
|
|
|
'man/waybar-image.5.scd',
|
|
|
|
'man/waybar-states.5.scd',
|
|
|
|
'man/waybar-temperature.5.scd',
|
|
|
|
)
|
|
|
|
|
2023-04-14 23:36:15 +00:00
|
|
|
inc_dirs = ['include']
|
|
|
|
|
2019-08-09 09:52:16 +00:00
|
|
|
if is_linux
|
2019-08-11 13:10:37 +00:00
|
|
|
add_project_arguments('-DHAVE_CPU_LINUX', language: 'cpp')
|
2019-08-09 10:40:33 +00:00
|
|
|
add_project_arguments('-DHAVE_MEMORY_LINUX', language: 'cpp')
|
2024-01-09 10:05:17 +00:00
|
|
|
add_project_arguments('-DHAVE_SYSTEMD_MONITOR', language: 'cpp')
|
2019-08-09 09:52:16 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/battery.cpp',
|
2024-02-19 21:54:46 +00:00
|
|
|
'src/modules/bluetooth.cpp',
|
2023-10-16 20:13:51 +00:00
|
|
|
'src/modules/cffi.cpp',
|
2023-07-29 14:27:46 +00:00
|
|
|
'src/modules/cpu.cpp',
|
2022-12-21 16:45:53 +00:00
|
|
|
'src/modules/cpu_frequency/common.cpp',
|
|
|
|
'src/modules/cpu_frequency/linux.cpp',
|
2022-12-21 16:47:06 +00:00
|
|
|
'src/modules/cpu_usage/common.cpp',
|
|
|
|
'src/modules/cpu_usage/linux.cpp',
|
2019-08-09 10:40:33 +00:00
|
|
|
'src/modules/memory/common.cpp',
|
|
|
|
'src/modules/memory/linux.cpp',
|
2024-02-18 21:06:21 +00:00
|
|
|
'src/modules/power_profiles_daemon.cpp',
|
2024-01-09 10:05:17 +00:00
|
|
|
'src/modules/systemd_failed_units.cpp',
|
2019-08-09 10:40:33 +00:00
|
|
|
)
|
2024-02-17 16:17:42 +00:00
|
|
|
man_files += files(
|
|
|
|
'man/waybar-battery.5.scd',
|
2024-02-19 21:54:46 +00:00
|
|
|
'man/waybar-bluetooth.5.scd',
|
2024-02-17 16:17:42 +00:00
|
|
|
'man/waybar-cffi.5.scd',
|
|
|
|
'man/waybar-cpu.5.scd',
|
|
|
|
'man/waybar-memory.5.scd',
|
|
|
|
'man/waybar-systemd-failed-units.5.scd',
|
2024-03-01 14:07:58 +00:00
|
|
|
'man/waybar-power-profiles-daemon.5.scd',
|
2024-02-17 16:17:42 +00:00
|
|
|
)
|
2019-08-09 10:40:33 +00:00
|
|
|
elif is_dragonfly or is_freebsd or is_netbsd or is_openbsd
|
2019-08-11 13:10:37 +00:00
|
|
|
add_project_arguments('-DHAVE_CPU_BSD', language: 'cpp')
|
2019-08-09 10:40:33 +00:00
|
|
|
add_project_arguments('-DHAVE_MEMORY_BSD', language: 'cpp')
|
|
|
|
src_files += files(
|
2023-10-16 20:13:51 +00:00
|
|
|
'src/modules/cffi.cpp',
|
2023-07-29 14:27:46 +00:00
|
|
|
'src/modules/cpu.cpp',
|
2023-09-13 21:12:35 +00:00
|
|
|
'src/modules/cpu_frequency/bsd.cpp',
|
|
|
|
'src/modules/cpu_frequency/common.cpp',
|
2022-12-21 16:47:06 +00:00
|
|
|
'src/modules/cpu_usage/bsd.cpp',
|
|
|
|
'src/modules/cpu_usage/common.cpp',
|
2019-08-09 10:40:33 +00:00
|
|
|
'src/modules/memory/bsd.cpp',
|
|
|
|
'src/modules/memory/common.cpp',
|
2019-08-09 09:52:16 +00:00
|
|
|
)
|
2024-02-17 16:17:42 +00:00
|
|
|
man_files += files(
|
|
|
|
'man/waybar-cffi.5.scd',
|
|
|
|
'man/waybar-cpu.5.scd',
|
|
|
|
'man/waybar-memory.5.scd',
|
|
|
|
)
|
2022-09-30 19:59:27 +00:00
|
|
|
if is_freebsd
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/battery.cpp')
|
|
|
|
man_files += files('man/waybar-battery.5.scd')
|
2022-09-30 19:59:27 +00:00
|
|
|
endif
|
2019-08-09 09:52:16 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-17 16:17:42 +00:00
|
|
|
if true
|
|
|
|
add_project_arguments('-DHAVE_SWAY', language: 'cpp')
|
|
|
|
src_files += files(
|
|
|
|
'src/modules/sway/ipc/client.cpp',
|
|
|
|
'src/modules/sway/bar.cpp',
|
|
|
|
'src/modules/sway/mode.cpp',
|
|
|
|
'src/modules/sway/language.cpp',
|
|
|
|
'src/modules/sway/window.cpp',
|
|
|
|
'src/modules/sway/workspaces.cpp',
|
|
|
|
'src/modules/sway/scratchpad.cpp'
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-sway-language.5.scd',
|
|
|
|
'man/waybar-sway-mode.5.scd',
|
|
|
|
'man/waybar-sway-scratchpad.5.scd',
|
|
|
|
'man/waybar-sway-window.5.scd',
|
|
|
|
'man/waybar-sway-workspaces.5.scd',
|
|
|
|
)
|
|
|
|
endif
|
2018-08-20 15:20:02 +00:00
|
|
|
|
2020-05-30 10:07:38 +00:00
|
|
|
if true
|
2024-02-17 16:17:42 +00:00
|
|
|
add_project_arguments('-DHAVE_WLR_TASKBAR', language: 'cpp')
|
|
|
|
src_files += files('src/modules/wlr/taskbar.cpp')
|
|
|
|
man_files += files('man/waybar-wlr-taskbar.5.scd')
|
2020-05-30 10:07:38 +00:00
|
|
|
endif
|
|
|
|
|
2020-06-06 13:41:37 +00:00
|
|
|
if true
|
|
|
|
add_project_arguments('-DHAVE_RIVER', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/river/layout.cpp',
|
|
|
|
'src/modules/river/mode.cpp',
|
|
|
|
'src/modules/river/tags.cpp',
|
|
|
|
'src/modules/river/window.cpp',
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-river-layout.5.scd',
|
|
|
|
'man/waybar-river-mode.5.scd',
|
|
|
|
'man/waybar-river-tags.5.scd',
|
|
|
|
'man/waybar-river-window.5.scd',
|
|
|
|
)
|
2020-06-06 13:41:37 +00:00
|
|
|
endif
|
|
|
|
|
2023-04-11 01:50:21 +00:00
|
|
|
if true
|
|
|
|
add_project_arguments('-DHAVE_DWL', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/dwl/tags.cpp')
|
2024-03-14 20:07:45 +00:00
|
|
|
src_files += files('src/modules/dwl/window.cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
man_files += files('man/waybar-dwl-tags.5.scd')
|
2024-03-14 20:07:45 +00:00
|
|
|
man_files += files('man/waybar-dwl-window.5.scd')
|
2020-06-06 13:41:37 +00:00
|
|
|
endif
|
|
|
|
|
2022-07-01 10:46:28 +00:00
|
|
|
if true
|
|
|
|
add_project_arguments('-DHAVE_HYPRLAND', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/hyprland/backend.cpp',
|
|
|
|
'src/modules/hyprland/language.cpp',
|
|
|
|
'src/modules/hyprland/submap.cpp',
|
|
|
|
'src/modules/hyprland/window.cpp',
|
|
|
|
'src/modules/hyprland/workspaces.cpp',
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-hyprland-language.5.scd',
|
|
|
|
'man/waybar-hyprland-submap.5.scd',
|
|
|
|
'man/waybar-hyprland-window.5.scd',
|
|
|
|
'man/waybar-hyprland-workspaces.5.scd',
|
|
|
|
)
|
2022-07-01 10:46:28 +00:00
|
|
|
endif
|
|
|
|
|
2018-08-20 15:20:02 +00:00
|
|
|
if libnl.found() and libnlgen.found()
|
|
|
|
add_project_arguments('-DHAVE_LIBNL', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/network.cpp')
|
|
|
|
man_files += files('man/waybar-network.5.scd')
|
2018-08-20 15:20:02 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-17 07:30:00 +00:00
|
|
|
if not get_option('logind').disabled()
|
|
|
|
add_project_arguments('-DHAVE_GAMEMODE', '-DHAVE_LOGIND_INHIBITOR', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/gamemode.cpp',
|
|
|
|
'src/modules/inhibitor.cpp',
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-gamemode.5.scd',
|
|
|
|
'man/waybar-inhibitor.5.scd',
|
|
|
|
)
|
2022-05-13 19:30:45 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-17 07:30:00 +00:00
|
|
|
if (upower_glib.found() and not get_option('logind').disabled())
|
2022-03-15 16:54:06 +00:00
|
|
|
add_project_arguments('-DHAVE_UPOWER', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/upower/upower.cpp',
|
|
|
|
'src/modules/upower/upower_tooltip.cpp',
|
|
|
|
)
|
|
|
|
man_files += files('man/waybar-upower.5.scd')
|
2022-03-15 16:54:06 +00:00
|
|
|
endif
|
|
|
|
|
2023-10-26 21:08:57 +00:00
|
|
|
|
2024-02-17 16:17:42 +00:00
|
|
|
if pipewire.found()
|
2023-10-26 21:08:57 +00:00
|
|
|
add_project_arguments('-DHAVE_PIPEWIRE', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/privacy/privacy.cpp',
|
|
|
|
'src/modules/privacy/privacy_item.cpp',
|
2024-03-25 18:40:23 +00:00
|
|
|
'src/util/pipewire/pipewire_backend.cpp',
|
|
|
|
'src/util/pipewire/privacy_node_info.cpp',
|
2024-02-17 16:17:42 +00:00
|
|
|
)
|
|
|
|
man_files += files('man/waybar-privacy.5.scd')
|
2023-10-26 21:08:57 +00:00
|
|
|
endif
|
|
|
|
|
2024-02-17 16:17:42 +00:00
|
|
|
if playerctl.found()
|
2021-11-01 18:17:29 +00:00
|
|
|
add_project_arguments('-DHAVE_MPRIS', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/mpris/mpris.cpp')
|
|
|
|
man_files += files('man/waybar-mpris.5.scd')
|
2021-11-01 18:17:29 +00:00
|
|
|
endif
|
|
|
|
|
2018-08-20 15:20:02 +00:00
|
|
|
if libpulse.found()
|
|
|
|
add_project_arguments('-DHAVE_LIBPULSE', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/pulseaudio.cpp',
|
|
|
|
'src/modules/pulseaudio_slider.cpp',
|
|
|
|
'src/util/audio_backend.cpp',
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-pulseaudio.5.scd',
|
|
|
|
'man/waybar-pulseaudio-slider.5.scd',
|
|
|
|
)
|
2018-08-20 15:20:02 +00:00
|
|
|
endif
|
|
|
|
|
2022-07-19 23:27:39 +00:00
|
|
|
if libjack.found()
|
2022-02-09 07:53:52 +00:00
|
|
|
add_project_arguments('-DHAVE_LIBJACK', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/jack.cpp')
|
|
|
|
man_files += files('man/waybar-jack.5.scd')
|
2022-02-09 07:53:52 +00:00
|
|
|
endif
|
|
|
|
|
2022-11-16 20:23:12 +00:00
|
|
|
if libwireplumber.found()
|
|
|
|
add_project_arguments('-DHAVE_LIBWIREPLUMBER', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/wireplumber.cpp')
|
|
|
|
man_files += files('man/waybar-wireplumber.5.scd')
|
2022-11-16 20:23:12 +00:00
|
|
|
endif
|
|
|
|
|
2018-10-25 09:47:03 +00:00
|
|
|
if dbusmenu_gtk.found()
|
|
|
|
add_project_arguments('-DHAVE_DBUSMENU', language: 'cpp')
|
|
|
|
src_files += files(
|
|
|
|
'src/modules/sni/tray.cpp',
|
2018-11-22 14:47:23 +00:00
|
|
|
'src/modules/sni/watcher.cpp',
|
|
|
|
'src/modules/sni/host.cpp',
|
|
|
|
'src/modules/sni/item.cpp'
|
2018-10-25 09:47:03 +00:00
|
|
|
)
|
2024-02-17 16:17:42 +00:00
|
|
|
man_files += files(
|
|
|
|
'man/waybar-tray.5.scd',
|
|
|
|
)
|
2018-10-25 09:47:03 +00:00
|
|
|
endif
|
|
|
|
|
2019-08-09 09:52:16 +00:00
|
|
|
if libudev.found() and (is_linux or libepoll.found())
|
2019-02-19 04:11:18 +00:00
|
|
|
add_project_arguments('-DHAVE_LIBUDEV', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/backlight.cpp',
|
|
|
|
'src/modules/backlight_slider.cpp',
|
|
|
|
'src/util/backlight_backend.cpp',
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-backlight.5.scd',
|
|
|
|
'man/waybar-backlight-slider.5.scd',
|
|
|
|
)
|
2019-02-19 04:11:18 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-23 18:22:40 +00:00
|
|
|
if libevdev.found() and (is_linux or libepoll.found()) and libinput.found() and (is_linux or libinotify.found())
|
2021-02-07 20:05:11 +00:00
|
|
|
add_project_arguments('-DHAVE_LIBEVDEV', language: 'cpp')
|
2022-08-22 12:36:21 +00:00
|
|
|
add_project_arguments('-DHAVE_LIBINPUT', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/keyboard_state.cpp')
|
|
|
|
man_files += files('man/waybar-keyboard-state.5.scd')
|
2021-02-07 20:05:11 +00:00
|
|
|
endif
|
|
|
|
|
2019-04-16 14:34:37 +00:00
|
|
|
if libmpdclient.found()
|
|
|
|
add_project_arguments('-DHAVE_LIBMPDCLIENT', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files(
|
|
|
|
'src/modules/mpd/mpd.cpp',
|
|
|
|
'src/modules/mpd/state.cpp',
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-mpd.5.scd',
|
|
|
|
)
|
2019-04-16 14:34:37 +00:00
|
|
|
endif
|
|
|
|
|
2020-09-06 17:44:13 +00:00
|
|
|
if libsndio.found()
|
|
|
|
add_project_arguments('-DHAVE_LIBSNDIO', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/sndio.cpp')
|
|
|
|
man_files += files('man/waybar-sndio.5.scd')
|
2021-12-03 22:32:53 +00:00
|
|
|
endif
|
|
|
|
|
2022-05-02 16:11:21 +00:00
|
|
|
if get_option('rfkill').enabled() and is_linux
|
|
|
|
add_project_arguments('-DWANT_RFKILL', language: 'cpp')
|
|
|
|
src_files += files(
|
|
|
|
'src/util/rfkill.cpp'
|
|
|
|
)
|
2020-08-14 18:56:45 +00:00
|
|
|
endif
|
|
|
|
|
2023-01-17 01:30:06 +00:00
|
|
|
if have_chrono_timezones
|
|
|
|
add_project_arguments('-DHAVE_CHRONO_TIMEZONES', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/clock.cpp')
|
|
|
|
man_files += files('man/waybar-clock.5.scd')
|
2023-01-17 01:30:06 +00:00
|
|
|
elif tz_dep.found()
|
2020-10-10 12:09:55 +00:00
|
|
|
add_project_arguments('-DHAVE_LIBDATE', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/clock.cpp')
|
|
|
|
man_files += files('man/waybar-clock.5.scd')
|
2020-10-10 12:09:55 +00:00
|
|
|
else
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/simpleclock.cpp')
|
|
|
|
man_files += files('man/waybar-clock.5.scd')
|
2020-10-10 12:09:55 +00:00
|
|
|
endif
|
|
|
|
|
2021-11-27 22:12:35 +00:00
|
|
|
if get_option('experimental')
|
2024-02-17 16:17:42 +00:00
|
|
|
add_project_arguments('-DHAVE_WLR_WORKSPACES', language: 'cpp')
|
|
|
|
src_files += files(
|
|
|
|
'src/modules/wlr/workspace_manager.cpp',
|
|
|
|
'src/modules/wlr/workspace_manager_binding.cpp',
|
|
|
|
)
|
|
|
|
man_files += files(
|
|
|
|
'man/waybar-wlr-workspaces.5.scd',
|
|
|
|
)
|
2021-11-27 22:12:35 +00:00
|
|
|
endif
|
|
|
|
|
2023-04-28 10:38:35 +00:00
|
|
|
cava = dependency('cava',
|
2024-02-17 15:20:03 +00:00
|
|
|
version : '>=0.10.1',
|
2023-04-28 10:38:35 +00:00
|
|
|
required: get_option('cava'),
|
|
|
|
fallback : ['cava', 'cava_dep'],
|
|
|
|
not_found_message: 'cava is not found. Building waybar without cava')
|
2023-04-14 23:36:15 +00:00
|
|
|
|
|
|
|
if cava.found()
|
|
|
|
add_project_arguments('-DHAVE_LIBCAVA', language: 'cpp')
|
2024-02-17 16:17:42 +00:00
|
|
|
src_files += files('src/modules/cava.cpp')
|
|
|
|
man_files += files('man/waybar-cava.5.scd')
|
2023-04-14 23:36:15 +00:00
|
|
|
endif
|
|
|
|
|
2018-08-20 15:20:02 +00:00
|
|
|
subdir('protocol')
|
2018-08-16 12:29:41 +00:00
|
|
|
|
2023-10-26 21:08:57 +00:00
|
|
|
app_resources = []
|
|
|
|
subdir('resources/icons')
|
|
|
|
|
2018-08-08 21:54:58 +00:00
|
|
|
executable(
|
|
|
|
'waybar',
|
2023-10-26 21:08:57 +00:00
|
|
|
[src_files, app_resources],
|
2018-08-08 21:54:58 +00:00
|
|
|
dependencies: [
|
|
|
|
thread_dep,
|
|
|
|
client_protos,
|
|
|
|
wayland_client,
|
|
|
|
fmt,
|
2019-05-18 23:44:45 +00:00
|
|
|
spdlog,
|
2018-08-08 21:54:58 +00:00
|
|
|
sigcpp,
|
|
|
|
jsoncpp,
|
|
|
|
wayland_cursor,
|
|
|
|
gtkmm,
|
2018-10-04 16:03:01 +00:00
|
|
|
dbusmenu_gtk,
|
2018-10-27 06:19:58 +00:00
|
|
|
giounix,
|
2022-08-22 12:36:21 +00:00
|
|
|
libinput,
|
2018-08-09 14:38:24 +00:00
|
|
|
libnl,
|
|
|
|
libnlgen,
|
2022-03-15 16:54:06 +00:00
|
|
|
upower_glib,
|
2023-10-26 21:08:57 +00:00
|
|
|
pipewire,
|
2021-11-01 18:17:29 +00:00
|
|
|
playerctl,
|
2019-02-10 09:35:19 +00:00
|
|
|
libpulse,
|
2022-02-09 07:53:52 +00:00
|
|
|
libjack,
|
2022-11-16 20:23:12 +00:00
|
|
|
libwireplumber,
|
2019-04-16 14:34:37 +00:00
|
|
|
libudev,
|
2022-08-23 18:22:40 +00:00
|
|
|
libinotify,
|
2019-08-09 09:52:16 +00:00
|
|
|
libepoll,
|
2019-08-18 01:12:20 +00:00
|
|
|
libmpdclient,
|
2021-02-07 20:05:11 +00:00
|
|
|
libevdev,
|
2020-01-20 23:47:15 +00:00
|
|
|
gtk_layer_shell,
|
2020-09-06 17:44:13 +00:00
|
|
|
libsndio,
|
2021-07-13 01:33:12 +00:00
|
|
|
tz_dep,
|
2023-04-14 23:36:15 +00:00
|
|
|
xkbregistry,
|
|
|
|
cava
|
2018-08-08 21:54:58 +00:00
|
|
|
],
|
2023-04-14 23:36:15 +00:00
|
|
|
include_directories: inc_dirs,
|
2018-08-08 21:54:58 +00:00
|
|
|
install: true,
|
|
|
|
)
|
2018-08-09 15:02:30 +00:00
|
|
|
|
|
|
|
install_data(
|
2024-02-25 19:33:04 +00:00
|
|
|
'resources/config.jsonc',
|
|
|
|
'resources/style.css',
|
2024-02-17 08:53:45 +00:00
|
|
|
install_dir: sysconfdir / 'xdg/waybar'
|
2018-08-09 15:02:30 +00:00
|
|
|
)
|
2018-08-16 12:29:41 +00:00
|
|
|
|
2019-08-29 10:25:04 +00:00
|
|
|
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
|
2019-08-22 16:04:09 +00:00
|
|
|
|
|
|
|
if scdoc.found()
|
2024-02-17 16:17:42 +00:00
|
|
|
man_files += configure_file(
|
2020-09-29 20:31:28 +00:00
|
|
|
input: 'man/waybar.5.scd.in',
|
|
|
|
output: 'waybar.5.scd',
|
|
|
|
configuration: {
|
2024-02-17 08:53:45 +00:00
|
|
|
'sysconfdir': prefix / sysconfdir
|
2020-09-29 20:31:28 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2024-04-09 14:02:33 +00:00
|
|
|
man_files += configure_file(
|
|
|
|
input: 'man/waybar-styles.5.scd.in',
|
|
|
|
output: 'waybar-styles.5.scd',
|
|
|
|
configuration: {
|
|
|
|
'sysconfdir': prefix / sysconfdir
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2024-02-17 16:17:42 +00:00
|
|
|
fs = import('fs')
|
2019-08-22 16:04:09 +00:00
|
|
|
mandir = get_option('mandir')
|
2020-09-29 20:31:28 +00:00
|
|
|
foreach file : man_files
|
2024-02-17 16:17:42 +00:00
|
|
|
basename = fs.name(file)
|
2020-09-29 20:31:28 +00:00
|
|
|
|
2020-11-26 23:31:40 +00:00
|
|
|
topic = basename.split('.')[-3]
|
2020-09-29 20:31:28 +00:00
|
|
|
section = basename.split('.')[-2]
|
2019-08-22 16:04:09 +00:00
|
|
|
output = '@0@.@1@'.format(topic, section)
|
|
|
|
|
|
|
|
custom_target(
|
|
|
|
output,
|
2024-02-17 16:17:42 +00:00
|
|
|
input: file,
|
2019-08-22 16:04:09 +00:00
|
|
|
output: output,
|
2024-02-17 08:58:39 +00:00
|
|
|
command: scdoc.get_variable('scdoc'),
|
|
|
|
feed: true,
|
|
|
|
capture: true,
|
2019-08-22 16:04:09 +00:00
|
|
|
install: true,
|
|
|
|
install_dir: '@0@/man@1@'.format(mandir, section)
|
|
|
|
)
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
2023-06-30 23:23:37 +00:00
|
|
|
catch2 = dependency(
|
|
|
|
'catch2',
|
2024-02-17 16:56:43 +00:00
|
|
|
default_options: [ 'tests=false' ],
|
2023-06-30 23:23:37 +00:00
|
|
|
fallback: ['catch2', 'catch2_dep'],
|
|
|
|
required: get_option('tests'),
|
|
|
|
)
|
|
|
|
if catch2.found()
|
|
|
|
subdir('test')
|
|
|
|
endif
|
2021-08-14 01:33:24 +00:00
|
|
|
|
2018-08-16 12:29:41 +00:00
|
|
|
clangtidy = find_program('clang-tidy', required: false)
|
|
|
|
|
|
|
|
if clangtidy.found()
|
|
|
|
run_target(
|
|
|
|
'tidy',
|
|
|
|
command: [
|
|
|
|
clangtidy,
|
|
|
|
'-checks=*,-fuchsia-default-arguments',
|
2024-02-17 07:59:38 +00:00
|
|
|
'-p', meson.project_build_root()
|
2018-08-16 12:29:41 +00:00
|
|
|
] + src_files)
|
|
|
|
endif
|