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`.
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
* 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
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.
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.
Deprecates not using `polybar-msg` for IPC.
Fixes#2532Closes#2465Fixes#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
* 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>
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
* 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
* 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
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).
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
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.
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.
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.
* 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