Commit Graph

19 Commits

Author SHA1 Message Date
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
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
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 9103d232a5 build: Remove -Werror
Whenever a new gcc version is released that introduces new warnings,
this breaks lots of builds on the user's side. This change pushes the
detection of these new warnings a bit back until either a user reports
warnings or developers get the new compiler updates. I think this is a
good tradeoff since release builds are no longer totally broken as soon
as a new compiler version comes out.

Travis still uses -Werror because there we actually want builds to fail.
2019-05-08 12:23:48 +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 a67b824e25 cmake: Make Release default build type
The polybar executable with RelWithDebInfo gets over 100MB. And there
really isn't any reason to have users install such huge executables.

Release build type gives you approx. 3.6M executables

Fixes #1497
2019-04-08 09:01:48 +02:00
patrick96 9aefbd5d34 build: Add UndefinedBehaviorSanitizer 2019-01-20 15:12:22 +01: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
Le Baron d'Merde 55331d17f7 fix(FreeBSD): Use libraries from LOCALBASE (#1111)
Ensures proper linking when not building a port
2018-03-22 00:03:47 +01:00
Kyle Cook 0f34178104 Add FreeBSD Support (#931) 2018-03-21 23:35:10 +01:00
Chase Geigle 299f1617d3 fix(cmake): Suppress -Wnoexcept-type warning on GCC
There is no way to avoid this error in the code itself, so we must
suppress this warning if we wish to keep -Werror.
2017-08-30 15:27:05 +02:00
Dmitry Marakasov b23ff17dde Disable -Werror for parentheses-equality warning
This warning fires here:

/home/travis/build/jaagr/polybar/src/utils/command.cpp:135:46: error: equality comparison with extraneous parentheses [-Werror,-Wparentheses-equality]
    } else if ((((*(int *) &(m_forkstatus))) == 0xffff)) {
                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~

and as this system macro cannot be changed, let's not turn this into an error
2017-07-05 17:17:58 +02:00
Michael Carlberg 41f7f82bd0 fix(cmake): Debug check 2017-01-27 13:30:23 +01:00
Michael Carlberg 43a17c3b36 refactor(cmake): Cleanup 2017-01-26 17:39:50 +01:00