Commit Graph

81 Commits

Author SHA1 Message Date
Patrick Ziegler
282b0f4e73
Create default config (#2511)
* Create default config and install to /etc/polybar

Closes #2405

* Search for config in /etc

We search in XDG_CONFIG_DIRS, /etc/xdg, and /etc but only for config.ini

Closes #2016

* Remove config installation from build.sh

* Remove userconfig cmake file

* Cleanup

* Cleanup default config

* Update CHANGELOG.md

Co-authored-by: dvermd <315743+dvermd@users.noreply.github.com>

* Update src/main.cpp

Co-authored-by: dvermd <315743+dvermd@users.noreply.github.com>

* Add tests for string functions

* Support loading bars from fallbacks in /etc

* Combine duplicate string_util::contains test

Co-authored-by: dvermd <315743+dvermd@users.noreply.github.com>
2021-10-05 13:07:19 +02:00
patrick96
bb70b7c743 Cleanup 2020-12-24 02:20:38 +01:00
patrick96
17f4dfd342 cmake: Use lists 2020-12-24 02:20:38 +01:00
patrick96
64e246e734 cmake: Add option to enable/disable shell files 2020-12-24 02:20:38 +01:00
patrick96
9d47b83697 cmake: Add option to enable/disable sample config 2020-12-24 02:20:38 +01:00
patrick96
923d9ae061 Add cmake files for configuring individual targets
This makes the code a bit less messy. We barely need if(BUILD_...)
guards inside the cmake files, just the root CMakeLists.txt.
2020-12-24 02:20:38 +01:00
patrick96
c24a6999a4 refactor(cmake): Allow targets to be enabled individually
Each major target of polybar can now be enabled/disabled while
configuring (even polybar itself).

The cmake code specific to each target will only run if the target is
enabled.

This allows us to for example just build the documentation without
having to run all the cmake code related to compilation or having the
polybar dependencies installed (other than sphinx).
2020-12-24 02:20:38 +01:00
patrick96
771154742c cmake: Use CMAKE_CXX_COMPILER_LAUNCHER for ccache 2020-12-24 02:20:38 +01:00
patrick96
16b2970bd7 build: Bump cmake version to 3.5.0
This includes the changes from polybar/xpp#30 which also updates the
minimum cmake version in the xpp submodule
2020-12-24 02:20:38 +01:00
patrick96
1dc8d2f30e cmake: Make xrandr and xcomposite required
They were required before, but could technically be deactived (the
compilation would fail, but configuration was possible).

The WITH_XRANDR and WITH_XCOMPOSITE now no longer appear in the cmake
part. It still appears in the source code, but is always set to 1

Fixes #1536
2020-12-22 00:37:07 +01:00
Rune Morling
43556b5d92 cmake: Use GNUInstallDirs (#1818)
* Use GNUInstallDirs instead of hardcoded paths

This change should be a no-op in the normal case and at the same time make it
easier to customise polybar builds on systems with special needs.

* Avoid creating /usr/share/doc/polybar/polybar/*

* Include GNUInstallDirs for the doc target itself

* cmake: Don't try to set CMAKE_INSTALL_* variables

Since we include GNUInstallDirs all these variables are already set

* cmake: Print install directories in summary

* fix(cmake): Make doc-only work like normal build

This is kind of a dirty hack to force CMAKE_INSTALL_DOCDIR to use
`polybar` as the project name when only polybar-doc is built.

Maybe it is wiser at some point to be able to do a doc only build (and
install) that can be done from the top level project. Then we would also
not need to include GNUInstallDirs here
2019-06-24 18:08:59 +02:00
patrick96
e1e28f09f3 refactor(build): Remove version number namespace
I don't know the original intention behind this but it clutters up debug
traces and basically makes ccache useless.

The only benefit it has, giving version info in stacktraces, is kind of
void since we already ask for version information on github issues.
2019-05-17 16:49:47 +02:00
patrick96
01b326c10f move shell completion to contrib folder
Now the doc folder is exclusively for documentation
2019-04-24 08:11:27 +02:00
patrick96
bfaeb71cb8 build: create config even when docs are disabled
Fixes #1733
2019-04-24 08:11:27 +02:00
patrick96
0251a80e75 build: Remove C compiler
There isn't a single .c file in the project. It just added bloat
2019-04-08 09:01:48 +02:00
patrick96
7d0c6300f6 cmake: put version string into version.txt 2019-04-05 23:43:37 +02:00
patrick96
5b7bb2514e refactor(doc): Enable only if sphinx is available 2019-04-05 23:43:37 +02:00
patrick96
3596001de1 refactor(cmake): Add version information to summary 2019-04-05 23:43:37 +02:00
patrick96
243a6a84a6 refactor(cmake): Use exit code of git describe 2019-04-05 23:43:37 +02:00
patrick96
fc2d2db76f refactor(cmake): Determine version in cmake
We need to have the version string available in multiple places not just
the source code. It is now hardcoded in the root CMakeLists.txt and all
files that need it will be configured with cmake.

This also removed the unecessary duality of GIT_TAG and APP_VERSION and
GIT_TAG_NAMESPACE and APP_VERSION_NAMESPACE.
2019-04-05 23:43:37 +02:00
patrick96
166f704e58 doc: Install rst based man pages 2019-04-05 23:43:37 +02:00
sam-lunt
d3e37918e5 CMake refactor (#1510)
* Clean up CMake logic

- removed logic to find CppUnit (no longer used)
- removed "dirs" variable used to pass include directories
- removed add_library function (no longer used)
- removed make_executable function
    * only used in 2 places (polybar and polybar-msg)
    * it was more general than needed, logic is simpler without it
- split polybar into static library and executable
    * this allows linking unit tests to the library

* rename library

* add coverage build

- Added a CMake build type "Coverage" that builds C and C++
  code with the "--coverage" flag (recognized by both GCC and Clang)
- removed "-Wno-missing-field-initializers" from test flags,
  since it didn't seem to be needed any more
- removed logic from tests/CMakeLists to disable "-Werror" and "-pedantic-errors"
  since there didn't seem to be any warnings during the build

* fix whitespace

* update travis

* remove O2 from defalt flags

* allow tests to be built by default make target

* disable Werror for debug builds
2018-11-21 18:46:33 +01:00
patrick96
b5129ae0c4 refactor(ccache): Enable by default
Following [1] to get to this setup.

We setup all the ccache configuration before calling project() because
project will perform compiler checks. This is also why we can't use
message_colored here and print the colors manually

Before ENABLE_CCACHE was not yet defined when we reached the check in
01-core because the option was defined in 02-opts

[1] https://crascit.com/2016/04/09/using-ccache-with-cmake/
2018-06-01 10:49:00 -07:00
patrick96
3f9ce4bb99 tests: Only configure tests when asked for
This prevents the download of googletest for normal builds. Now when we
want to compile and run tests we need to specify -DBUILD_TESTS=ON
2018-04-10 00:56:51 +02:00
patrick96
c865add821 refactor(tests): Migrate to googletest
googletest (gtest) is more feature rich than the current implementation
which only provides expect() which is basically an assertion. It is also
quite intuitive to use, this can be seen in the rewrite of the
command_line test where EXPECT_THROW replaces a whole try-catch block.

I have also moved the source files the test depend on to be linked in
CMakeLists.txt instead of including them directly because include .cpp
files is bad.

The two x11 tests were removed because they were written two years ago
and a lot of the things they depend on, don't actually exist anymore in
polybar (I think we switched to xpp after those tests were written)

Tests are now compiled with the gcov lib which can be used to provide
test coverage in a second step
2018-04-10 00:56:51 +02:00
Olmo Kramer
3f5141bf22 bash completion 2017-05-19 17:02:47 +02:00
Michael Carlberg
43a17c3b36 refactor(cmake): Cleanup 2017-01-26 17:39:50 +01:00
Michael Carlberg
37d0a0e57b refactor(cmake): Cleanup 2017-01-25 23:28:25 +01:00
Michael Carlberg
92424f0d49 refactor(cmake): Install components 2016-12-23 18:10:19 +01:00
Michael Carlberg
fd57ab0f3d fix: project rename 2016-11-19 06:26:07 +01:00
Michael Carlberg
e7cb345cec wip: Separate source from definitions 2016-11-03 12:54:32 +01:00
Michael Carlberg
f2233cee2d fix(cmake): Require working C compiler
Closes jaagr/lemonbuddy#129
2016-10-28 11:54:00 +02:00
Michael Carlberg
91a9bb6d95 refactor(tray): Better support for conflicting managers
Listen for destroy event on the new manager window when
systray selection is lost. If the window gets destroyed
we can re-activate the manager.
2016-10-25 22:59:02 +02:00
Michael Carlberg
eac65cdabb fix(cmake): Make specific c++lib linking optional
- Do not enforce linking against libc++
- Fix various linter warnings
2016-10-25 20:47:53 +02:00
Michael Carlberg
f03bca6df3 fix(cmake): Add libc++ linker flag 2016-10-25 09:22:28 +02:00
Michael Carlberg
9e22b3e693 refactor(cmake): Target libc++ 2016-10-25 01:46:35 +02:00
Michael Carlberg
94ded75756 feat(config): Reference values defined in Xresources
Add config tag to reference a value defined in the Xresource db

`parameter = ${xrdb:var_name}`
2016-10-19 09:16:09 +02:00
Michael Carlberg
d879d6d42e fix: Throttle X input events
- Limit the amount of allowed input events
- Yield on lock failure
- Cleanup
2016-10-19 06:03:01 +02:00
Michael Carlberg
adf18108c3 build: Use -O1 for release builds
Optimize less to not break the code.
Still some undefined behaviour that are messing
with builds using -O3
2016-10-19 02:21:26 +02:00
Michael Carlberg
01c5dcb6b7 fix: Guarded module teardown 2016-10-18 17:55:34 +02:00
Michael Carlberg
593e5afbdf build: Configurable build of testsuite 2016-10-12 07:17:03 +02:00
Michael Carlberg
ed77e2eec6 Merge branch '2.0-beta' 2016-10-12 05:26:41 +02:00
Michael Carlberg
c4e9f9d035 wip: Update CMakeLists 2016-10-12 02:16:48 +02:00
Michael Carlberg
d23119e24e fix(build): Make project compile using gcc5/gcc6 2016-10-11 12:58:26 +02:00
Michael Carlberg
d359ab6057 refactor: Application rewrite 2016-10-10 14:52:57 +02:00
Michael Carlberg
2b1aa99f4c refactor(cmake): Removed dynamic handling of flags
Only set initial state of the ENABLE_X options
based on if the required library is available
2016-08-31 19:24:25 +02:00
Michael Carlberg
afb787f0d7 fix(cmake): Don't trigger versioning on build 2016-08-31 11:52:35 +02:00
Michael Carlberg
3273ed689f build: Include man pages in build 2016-06-30 04:56:58 +02:00
Michael Carlberg
338c04ec91 fix(cmake): Enable C support for the project 2016-06-28 23:10:25 +02:00
Michael Carlberg
16cc82d920 refactor(cmake): Specify compile opts on target 2016-06-28 22:25:31 +02:00