man: add the prefixed path were config is loaded

This commit is contained in:
Minijackson 2020-09-29 22:31:28 +02:00
parent e9b5be9adb
commit 73681a30e5
No known key found for this signature in database
GPG Key ID: FEA888C9F5D64F62
2 changed files with 23 additions and 5 deletions

View File

@ -14,6 +14,7 @@ Valid locations for this file are:
- *~/.config/waybar/config* - *~/.config/waybar/config*
- *~/waybar/config* - *~/waybar/config*
- */etc/xdg/waybar/config* - */etc/xdg/waybar/config*
- *@sysconfdir@/xdg/waybar/config*
A good starting point is the default configuration found at https://github.com/Alexays/Waybar/blob/master/resources/config A good starting point is the default configuration found at https://github.com/Alexays/Waybar/blob/master/resources/config
Also a minimal example configuration can be found on the at the bottom of this man page. Also a minimal example configuration can be found on the at the bottom of this man page.

View File

@ -9,6 +9,8 @@ project(
], ],
) )
fs = import('fs')
compiler = meson.get_compiler('cpp') compiler = meson.get_compiler('cpp')
cpp_args = [] cpp_args = []
@ -256,9 +258,20 @@ scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_opti
if scdoc.found() if scdoc.found()
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true) scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true) sh = find_program('sh', native: true)
main_manpage = configure_file(
input: 'man/waybar.5.scd.in',
output: 'waybar.5.scd',
configuration: {
'sysconfdir': join_paths(prefix, sysconfdir)
}
)
main_manpage_path = join_paths(meson.build_root(), '@0@'.format(main_manpage))
mandir = get_option('mandir') mandir = get_option('mandir')
man_files = [ man_files = [
'waybar.5.scd', main_manpage_path,
'waybar-backlight.5.scd', 'waybar-backlight.5.scd',
'waybar-battery.5.scd', 'waybar-battery.5.scd',
'waybar-clock.5.scd', 'waybar-clock.5.scd',
@ -281,14 +294,18 @@ if scdoc.found()
'waybar-bluetooth.5.scd', 'waybar-bluetooth.5.scd',
] ]
foreach filename : man_files foreach file : man_files
topic = filename.split('.')[-3].split('/')[-1] path = '@0@'.format(file)
section = filename.split('.')[-2] basename = fs.name(path)
topic = basename.split('.')[-3].split('/')[-1]
section = basename.split('.')[-2]
output = '@0@.@1@'.format(topic, section) output = '@0@.@1@'.format(topic, section)
custom_target( custom_target(
output, output,
input: 'man/@0@'.format(filename), # drops the 'man' if `path` is an absolute path
input: join_paths('man', path),
output: output, output: output,
command: [ command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output) sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output)