Commit Graph

136 Commits

Author SHA1 Message Date
6d42ccedd6 -----BEGIN PGP SIGNATURE-----
iQEzBAABCAAdFiEEHVeRNS1RoijU3dukUh5eA668oacFAmVkwa4ACgkQUh5eA668
 oackXggAtyUMZSVxtxrjS9LLYwSFR0p09a7ns1QYJmGjQo2ZHW3f4hHQuajqFPLE
 J8icknCPtRge2tm6J7XGQakZ+PUXe7ILLCBFf8DFbgdbCe3YiEvxHtnRa6MCR1yO
 4ljwg7MIlS58ynJt92nh3R/7PxigZYKn/DqV2HeMvXqLimLXvXLDbAjVwPbvHNDJ
 Eq/jJExEyX4ZrXEIIGxq3/QnxeSI+IPbReMbVZbERWG9jZt2RJoPUepRDH6jhWJN
 03oUZ6gm5qU8frvhbpGfqZ2hVncnyJRskXR1CJ31OyGGiS2WfGK5viI0geQyRAse
 LxaRJHdrURVX7x1VSzdah6yzaSo1fA==
 =Wy/L
 -----END PGP SIGNATURE-----

Merge tag '3.7.1'
2024-02-27 15:33:34 +01:00
dd03bb3c40 Merge tag '3.6.3'
Search for xcbgen with PYTHON_EXECUTABLE

This way users can specify `-D:PYTHON_EXECUTABLE` to force a certain
python executable and that executable will then also be used to search
for xcbgen.

This should also provide a more universal solution to the configuration
issues with pyenv or conda since the user can just specify
`-D:PYTHON_EXECUTABLE=/usr/bin/python3`.
2023-08-05 18:44:08 +02:00
patrick96
8cc1b4fcfd fix(build): Use CMAKE_INSTALL_FULL_<dir> for default config
Using CMAKE_INSTALL_SYSCONFDIR does respect CMAKE_INSTALL_PREFIX, but it
prefixes it to CMAKE_INSTALL_SYSCONFDIR, which results in the default
config being installed to /usr/etc/polybar/config.ini or
/usr/local/etc/polybar/config.ini

CMAKE_INSTALL_FULL_SYSCONFDIR gives an absolute path that respects the
prefix but does the right thing (uses /etc) if it is /usr

Ref: #2770
2023-02-13 22:08:57 +01:00
patrick96
87750c064e build: Bump C++ to C++17
Now requires gcc8 or clang7
2022-10-23 15:20:21 +02:00
patrick96
b0e33053f9 Use debug flags for sanitizer builds 2022-10-16 21:25:48 +02:00
Patrick Ziegler
56779a5902
Make the event loop return shared_ptrs (#2842)
* Return shared_ptr from eventloop

* Add -Wdeprecated-copy-dtor warning

Produces a warning if classes don't have explicit copy operations if
they have a user-defined constructor.
This helps us stick to the rule of 5 (kinda, no warnings for missing
move operators).

* Clean up eventloop

* Fix compiler warnings

* Fix fs_event_handle_t name
2022-10-15 23:21:40 +02:00
patrick96
c44336573b build: Create clangformat(-dryrun) build targets
The clangformat target updates all files in-place while the
clangformat-dryrun target prints an error message for each format-change
clang-format would apply.
The latter exits with a non-zero error code if there are any changes.
2022-09-28 22:00:33 +02:00
Dave
6ccecbfca2
feat(temperature): Add zone-type setting (#2752)
Signed-off-by: xphoniex <dj.2dixx@gmail.com>

Signed-off-by: xphoniex <dj.2dixx@gmail.com>
2022-08-21 19:25:42 +02:00
patrick96
a82e4324f6 fix(build): Do not replace CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS contains, among other things, the LDFLAGS which
many distros use to universally apply linker flags.
When completely replacing CMAKE_EXE_LINKER_FLAGS, these flags are lost.
2022-03-03 15:33:10 +01:00
patrick96
4350e356a7 Documentation update for 3.6 2022-03-02 14:58:49 +01:00
Patrick Ziegler
3356188056
Use sockets for IPC (#2539)
Deprecates not using `polybar-msg` for IPC.

Fixes #2532
Closes #2465
Fixes #2504

* Create FIFO specific NamedPipeHandle subclass to PipeHandle

* Prototype SocketHandle

* Move mainloop up to main.cpp

* Pass eventloop to ipc class

* Deprecate sending ipc over the named pipe

Unfortunately, we can only show the warning in the polybar log and not
give the user any feedback because the pipe is one-way

* Move eventloop into its own namespace

* Prototype ipc socket handling

* Remove handles from ipc_client

Should be independent from eventloop logic

* Remove ipc clients when finished

* Add tests for ipc_client decoding

* Add callback for complete ipc messages

* Remove template param from mixins

* Move signal handler to new callback system

* Move poll handle to new callback system

* Move FSEventHandle to new callback system

* Move TimerHandle and AsyncHandle to new callback system

* Move PipeHandle to new callback system

* Implement socket functionality in new callback system

* Correctly reset ipc named pipe handle

* Let client close handles in error callback

* Wrap client pipe and ipc::client in connection class

* Better decoder log messages

* Socket path logic

* Fix CI warnings

* Remove UVHandleGeneric

* Fix error when socket folder already exists

* Proof of concept message writeback

* Restructure ipc files

* polybar-msg: Use sockets

* polybar-msg: Better syntax for actions

* Fix memory leak with fifo

After EOF, the pipe wasn't closed and EOF was called all the time, each
time allocating a new pipe.

* Make polybar-msg compile on its own

* Rudimentary writeback for polybar-msg

* Fix payload reference going out of scope.

* Add IPC documentation

* Cleanup polybar-msg code

* Specify the v0 ipc message format

* Close ipc connection after message

* Fix ipc tests

* Properly close ipc connections

* Fix polybar-msg not working with action string

* Write polybar-msg manpage

* polybar-msg: Stop using exit()

* ipc: Print log message with PID

* Add tests for ipc util

* polybar-msg: Print PID with success message

* ipc: Propagate message errors

* Rename ipc::client to ipc::decoder

* Rename ipc.cpp to polybar-msg.cpp

* ipc: Write encoder function and fix decoder bugs

* ipc: Use message format for responses

* ipc: Handle wrong message types

* ipc: Write back error message if ipc message cannot be processed

This only happens for commands and empty actions.
Non-empty actions are not immediately executed, but deferred until the
next loop iteration.

* Remove TODO about deleting runtime directory

The socket file is not deleted after socket.close() is called, only
after libuv executes the close callback.
So we can't just call rmdir because it will probably always fail.

* CLeanup WriteRequest

* Update manpage authors

* Cleanup
2022-01-22 20:35:37 +01:00
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
Patrick Ziegler
444120e664
script: Fix concurrency issues (#2518)
Fixes #1978

* Move tail and non-tail handler to method

Defining them in the constructor is ugly.

* script: Iterate over defined actions instead of fixed list

* Separate running logic and lock m_output

* Include POLYBAR_FLAGS in linker flags

* Stop using m_prev in script_runner

* Join module threads in stop function

Joining in the destructor may lead to UB because the subclass is already
deconstructed but the threads may still require it to be around (e.g.
for calling any functions on the instance)

* Cleanup script module

* Update changelog

* Remove AfterReturn class

* Remove m_stopping from script module

* Fix polybar not reading the entire line from child process.

For every `readline` call we created a new fd_streambuf. This means once
`readline` returns, the streambuf is destructed and and pending data in
its temporary buffer discarded and we never actually read it.

* Remove unused includes
2021-10-03 01:27:11 +02:00
Patrick Ziegler
8afd5b71df
Integrate bar taskqueue into eventloop (#2510)
* Remove DEBUG_SHADED

Was disabled by default AND behind an #if 0

* Make TimerHandle expose more libuv functions

* Prepare for moving double clicks into eventloop

* Make eventloop available to bar

* Remove bar mutex

Everything in the bar is now in the same thread

* Move double-click handling to eventloop

* Extract double click deferred function into method

* Stop throttling clicks

* Increase double click interval to 400 and add option

double-click-interval in the bar section

Closes #1441

* Implement dimming using timer handles

* Remove taskqueue

* Remove unused dependencies

* Cleanup & Comments
2021-09-27 17:35:45 +02:00
patrick96
85d308cec8 Use libuv >= 1.3.0 2021-09-21 20:36:23 +02:00
patrick96
74d8cf281c cmake: Fix FindLibUV 2021-09-21 20:36:23 +02:00
patrick96
249c3ec141 Use libuv for the controller's event loop 2021-09-21 20:36:23 +02:00
patrick96
c901826317 Use CMAKE_EXE_LINKER_FLAGS
The newere target_link_options is not supported by our minimum cmake
version (3.5)
2021-07-11 14:47:26 +02:00
patrick96
3652d5fe0d cmake: Stop using CMAKE_* variables for flags
It is not recommended anyway and the -Werror flag set in CI was getting
set when compiling gtest, breaking our build.
2021-07-11 14:47:26 +02:00
patrick96
43d754bd1d cmake: Add modules for curl and alsa
Older versions of cmake (e.g. in Ubuntu 18.04) did not provide cmake
modules for these libraries that also created a target.

Fixes #2393
2021-03-01 00:05:44 +01:00
patrick96
63819d62f0 cmake: Use set_target_properties for include dirs
target_include_directories for INTERFACE IMPORTED targets is only
supported since cmake 3.11

Fixes #2387

Ref: https://gitlab.kitware.com/cmake/cmake/-/issues/15689
2021-03-01 00:05:44 +01:00
Patrick Ziegler
d5be8cad97
Add compiler warning for missing override specifier (#2341)
* build: Add -Wsuggest-override

We should always use the override specifier when overriding virtual
functions. This helps prevent errors when a subclass tries to create a
function with the same name as a virtual function in a super-class but
with a different purpose.

* clang-format

* Upload logs on failure

* Add override to unsupported.hpp

* cmake: Make -Wsuggest-override flag conditional
2021-01-04 10:38:43 +01:00
patrick96
bb70b7c743 Cleanup 2020-12-24 02:20:38 +01:00
patrick96
3c51a1d955 cmake: Remove empty files 2020-12-24 02:20:38 +01:00
patrick96
74903d49a7 cmake: Mark checklib variables as advanced 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
ddfec6fc8f build: Add option to enable/disable html/manpages 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
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
patrick96
dc8d7fd0e0 Add documentation 2020-12-22 00:37:07 +01:00
patrick96
fd2edfdc08 cmake: Display package versions in summary 2020-12-22 00:37:07 +01:00
patrick96
84da909b47 Fix FindXcb not doing version checks for components
Version checks for FindXcb only make sense if all components have the
same version or only a single component is specified
2020-12-22 00:37:07 +01:00
patrick96
ade8b40b36 cmake: Fix find_package_handle_standard_args warning 2020-12-22 00:37:07 +01:00
Jérôme BOULMIER
cb0aeacbf2 refactoring find packages 2020-12-22 00:37:07 +01:00
Jérôme BOULMIER
b143e43491 enhancement(cmake): remove all mentions of "dirs" variable 2020-12-22 00:37:07 +01:00
Jérôme BOULMIER
31fafa86f7 feat(cmake): removing globs and using imported targets 2020-12-22 00:37:07 +01:00
Mihir Lad
567b31bcc6 Remove dwm make dependency
dwm is not required to compile; it is only required to run the module, so
there's no reason to add it as a hard dependency.
2020-12-19 19:50:12 -05:00
Mihir Lad
de3748122f dwm: Get socket path from config, not env or cmake
Don't get the socket path from cmake or from an environment variable. Instead,
get it from the polybar config. If it's not specified, the default is
/tmp/dwm.sock which is default for the IPC patch.

This way is easier for the user to configure.
2020-12-19 19:48:48 -05:00
Mihir Lad
ad3666ed47 Update cmake/config files to include dwmipcpp
Include dwmipcpp as a library in cmake and config files, so it can be built
automatically. The configuration of dwmicpp was added to match that of i3 and
bspwm to maintain the same cmake workflow and style.
2020-12-19 19:28:34 -05:00
patrick96
0b713047aa doc: Allow custom SPHINX_BUILD 2020-02-21 16:17:12 +01:00
patrick96
2b31a3f112 fix(backlight): Use 'brightness' with amdgpu_bl0
The amdgpu driver seems to set 'actual_brightness' wrong.

Fixes #1870
Ref: https://github.com/Alexays/Waybar/issues/335
2019-10-21 14:37:29 +02:00
patrick96
c6bc8a6ee6 build: Remove pulseaudio binary dependency check
The binary is not needed to compile and run polybar with pulseaudio
support. Though of course there is no use in having a pulse module when
you don't have pulseaudio installed.
2019-07-31 00:37:05 +02: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
a3e2e51ac9 build: remove xdamage extension
Unused

Ref: #1730
2019-06-03 00:46:12 +02:00
patrick96
38af08d29a build: remove xsync extension
Unused

Ref: #1730
2019-06-03 00:46:12 +02:00
patrick96
6ff2b2b37f build: remove xrender extension
Some build recipes (exherbo, sourcemage) for some reason enable this
even though it doesn't do anything any only causes compilation issues.

Ref: #1730
2019-06-03 00:46:12 +02:00
Jérôme BOULMIER
28b8877edc cleanup(cmake): remove useless variables (#1767)
They also caused a cmake warning when compiling with debug symbols
2019-05-17 16:51:16 +02:00