Commit Graph

16 Commits

Author SHA1 Message Date
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 1ddd8bd1e1 fix(build): Disable sphinx manpage section dirs
Before sphinx 4.0, this was the default but was changed in 4.0.
Now by default the folder structure looks like this:

man
├── 1
│   └── polybar.1
└── 5
    └── polybar.5

This restores the old behavior where there weren't individual folders
for the different sections.

Fixes #2424
Ref: https://www.sphinx-doc.org/en/master/changes.html#id14
2021-05-09 21:28:22 +02:00
patrick96 6b1c5489a2 fix(build): Only change VersionDirective if supported
The VersionChange class is not available in older versions of sphinx, so
we just disable it

Fixes #2356
2021-03-01 21:27:59 +01:00
Patrick Ziegler 1bf89e8b76
fix(docs): Support out-of-tree builds (#2312)
Searching up from the conf.py only works if it is inside the repository
and not for out-of-tree builds (because conf.py gets configured in the
build directory).
2020-12-17 14:02:48 +01:00
Patrick Ziegler cec463e830
doc: Don't use git for checking version number (#2311)
If git is not available (and it doesn't have to be when building from a
source archive) building the documentation fails because we use
`git rev-parse` to determine whether a certain version is unreleased.

We now use the version.txt file to do this check

This uses the packaging library, but this should not introduce a new
dependency because sphinx depends on setuptools which also depends on
that library.

Fixes #2309
2020-12-17 05:12:09 +01:00
patrick96 1d9365e74f doc: Allow using rtd theme locally 2020-11-26 20:53:53 +01:00
patrick96 3e4f8d402e doc: Initial action documentation 2020-11-26 20:53:53 +01:00
Patrick Ziegler b0e9e3ff61
doc: Add '(unreleased)' tag for unreleased versions (#2118)
The tag is added to the 'deprecated', 'versionadded', and the
'versionchanged' directives.
2020-06-07 21:54:04 +02:00
patrick96 fab8437ff1 doc: Write syntax definition in polybar.5 2020-02-21 16:17:12 +01:00
Patrick Ziegler 5a695c7065
doc: Update links to https (#2012) 2020-02-21 15:39:39 +01:00
patrick96 7724c4dccb rtd: Use provided version string on rtd
@APP_VERSION@ isn't available on rtd because it doesn't configure the
entire project
2019-05-17 17:03:51 +02:00
patrick96 72db0538e1 doc: Add copyright 2019-04-05 23:43:37 +02:00
patrick96 bbdcbee068 doc: Make conf.py work on readthedocs
rtd scans the project for a conf.py file so we cannot name it conf.py.in
unless we get rtd to run cmake before building.

The easier option is to have doc/conf.py be the file used by rtd and all
other builds use cmake to first configure it.
2019-04-05 23:43:37 +02:00
patrick96 2c42bae09f refactor(doc): Use cmake APP_VERSION in conf.py
This also moves the doc generation completely into cmake (no more
Makefile).

To generate the docs the project needs to first be configured and then
`make doc` can be run.

The approach used is leaned on the cmake's project own use of Sphinx:
Utilities/Sphinx/CMakeLists.txt
2019-04-05 23:43:37 +02:00
patrick96 1e361fa9ca doc: Add manpage as rst file
This allows us to also have the manual as part of the generated html
documentation.

The syntax is also easier to use.

Right now the man page installed on the system is not replaced with the
rst file, this will come in a later step
2019-04-05 23:43:37 +02:00
patrick96 7809be8d58 doc: Setup in-repo documentation 2019-04-05 23:43:37 +02:00