Compare commits

...

1930 Commits

Author SHA1 Message Date
nicofolxarus
00ba9b5b70 update submodules 2025-10-12 19:43:06 +02:00
nicofolxarus
cb444c1309 add suport for source in puseaudio module
```

[module/pulseaudio]
type = internal/pulseaudio

; Source to be used, if it exists (find using `pacmd list-sources`, name field)
; If the source does not exist or the field is empty, uses the default Source.
; Can not be combined with sink, you need to instanciate 2 pulseaudio modules for that.
; If no sink or source field are specify, falling back to default sink.
source = alsa_output.pci-0000_12_00.3.analog-stereo

;
; [...]
;

```
2025-10-12 19:43:04 +02:00
p_q
f99e0b1c7a Fix missing cstdint header for compiling with gcc15.
See https://gcc.gnu.org/gcc-15/porting_to.html for the details.
2025-09-24 10:29:01 +02:00
Cliff L. Biffle
455d63611a Add Freetype to fix build on Arch (#3221)
Fixes #3220
2025-07-24 12:08:11 +02:00
Flexlolo
9476ad80b8 Implement tray-reversed option (#3182)
* implement tray-reversed option

* update changelog

* Update src/x11/tray_manager.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update CHANGELOG.md

---------

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2024-10-30 22:13:34 +01:00
jasonjyu
f59f509923 Added to string_util tests corner cases for empty strings and numerics (#3180) 2024-10-27 11:33:45 +01:00
Nolan Prochnau
552d81dd56 pulseaudio: Preserve channel balance (#3169)
Instead of preserving the proportions of PulseAudio channels, we now preserve the balance between the channels. This mirrors pulsemixer's approach.
2024-10-19 17:35:33 +02:00
clover
2d00384046 feat(battery): add ramp-charging tag (#3172)
* feat(battery): add ramp-charging tag

* Update battery.cpp

* Update CHANGELOG.md

* Update CHANGELOG.md

* Update CHANGELOG.md
2024-10-19 17:34:47 +02:00
Patrick Ziegler
15ccea6099 doc: Fix changelog entry (#3173)
Git merged the entry into the wrong section
2024-10-13 14:09:03 +02:00
Gregor Best
0eb39c5205 fix: don't restart if zero active screens are reported (#3078)
On laptops and similar devices, RandR sometimes returns zero active
screens, for example when closing a laptop's lid before it suspends.

Don't restart in that case because the new polybar instance will see
zero screens and quit. Instead, just ignore those kind of events.
2024-10-13 13:52:10 +02:00
sysek
cf50f75903 doc: change desc for openSUSE (#3166)
Co-authored-by: sysek <sysek@outlook.com>
2024-10-13 13:34:28 +02:00
Valentino Berta
a66c5fd91b fix: check if git top-level directory matches CMake project source (#3156) 2024-09-14 11:13:56 +02:00
ajakk
e7cf47de71 fix(build): Add missing cstdint includes (#3159)
In GCC 15, cstdint is less commonly included in stdlib headers so we
need explicit includes: https://gcc.gnu.org/gcc-15/porting_to.html

See-Also: https://bugs.gentoo.org/937526

Signed-off-by: John Helmert III <ajak@gentoo.org>
2024-09-01 14:28:36 +02:00
patrick96
f0f9563ecf Update PKGBUILD for 3.7.2 2024-08-17 13:54:40 +02:00
patrick96
469d0536e8 fix(ci): Release workflow
github.* doesn't exist anymore. Instead everything there is now
available under github.rest.*

Ref: https://github.com/octokit/plugin-rest-endpoint-methods.js/releases/tag/v5.0.0
2024-08-17 13:39:34 +02:00
patrick96
1ba083cdb2 Merge remote-tracking branch 'origin/hotfix/3.7.2' 2024-08-17 13:30:20 +02:00
patrick96
b3af5a3316 Version 3.7.2 2024-08-17 13:19:58 +02:00
patrick96
c0d3d7a3e7 fix(render): Deal with incomplete wallpapers
If the root pixmap does not fully cover the bar window, some
pseudo-transparent areas were filled with unitialized data, causing
pixelation or other rendering artifacts.

Now, ovserved background slices are first filled with black to make sure
this does not happen and they print an error if not the full pixmap can
be filled.

Fixes #3041
2024-08-17 13:13:12 +02:00
classabbyamp
03d01afed6 fix(modules/battery): make rate positive if negative
on the Lenovo X13s, the battery firmware returns a negative value for
power_now, which is interpreted by the battery module as 0 because it
converts the string to unsigned long. This should be read as a long
instead, as the kernel specifies that power_now is an int:
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/include/linux/power_supply.h?h=v6.0.11#n99
2024-08-04 13:55:49 +02:00
patrick96
35638027a8 Update github actions
checkout is bumped from v3 to v4, there shouldn't be any breaking
changes (just bumps the node version)

upload-artifact is bumped from v2 to v4, our use case shouldn't break

github-script is bumped from v3 to v7. I don't see any breaking changes
that should affect us. Again mainly a nodejs version bump
2024-08-04 13:55:04 +02:00
patrick96
6f8db4a3fe ci: Use codecov token
This wasn't required for PRs but for the job that runs on the `master`
branch, the job fails without the token (because it's a protected
branch)
2024-08-04 13:55:04 +02:00
patrick96
0e5760a824 Update github actions
checkout is bumped from v3 to v4, there shouldn't be any breaking
changes (just bumps the node version)

upload-artifact is bumped from v2 to v4, our use case shouldn't break

github-script is bumped from v3 to v7. I don't see any breaking changes
that should affect us. Again mainly a nodejs version bump
2024-08-04 13:54:57 +02:00
patrick96
5aaf49864a ci: Use codecov token
This wasn't required for PRs but for the job that runs on the `master`
branch, the job fails without the token (because it's a protected
branch)
2024-08-04 13:54:57 +02:00
patrick96
52ff00c28d fix(ci): Get Codecov to work again
Mainly updates the plugin
2024-08-01 12:13:30 +02:00
patrick96
df87c7ac21 fix(ci): Get Codecov to work again
Mainly updates the plugin
2024-08-01 12:13:27 +02:00
patrick96
4d1758457b fix(ipc): Clear output until initial hook finishes
Before, it just showed '%output%'

Fixes #3131
2024-08-01 11:15:48 +02:00
patrick96
baed54bc76 doc: Improve tray documentation
Unaware users may be confused by why the tray module is not shown in the
default config and if they add it, they may be confused why only one of
their bars shows the module.
2024-08-01 11:09:46 +02:00
Isak05
81ea16931e fix(script): Receiving multiple lines rapidly only displays first line (#3119)
Fixes #3117
2024-04-28 21:10:12 +02:00
patrick96
ab583b08cd fix(tray): Clients not being removed properly
The vector::erase call needs to be supplied with the end of the range,
otherwise only a single element is removed.

Fixes #3111
2024-04-15 23:43:25 +02:00
patrick96
c8f7dc1c14 fix(i3): Properly render non-full-width windows
Without override-redirect, i3 will not allow you to have a
non-full-width bar. But polybar simply ignores that request and
continues to render the user-requested width instead of the width i3 has
configured the window to be.

With the 3.7 release, we started setting the window's backing pixmap to
the rendering pixmap. In the case above, the pixmap would only be
allocted for the smaller width and when i3 maps the window, it repeats
the backing pixmap to fill the entire window.

At the point where i3 maps the window, the pixmap contains an initial
render of the bar without module content and that render is then
duplicated.

Reverting back to the old approach of simply copying over the pixmap
after each render does not have that problem and the remainder of the
bar is black (or fully transparent with a compositor).

Ideally, polybar would respect the width i3 configures for it, but that
would break many existing setups that rely on non-full-width bars in i3

Fixes #3060
2024-02-18 19:02:30 +01:00
Patrick Ziegler
020699724f fix(label): Misbehaving min-length tokens with non-ASCII characters (#3090)
* Changed bit count for label to use UTF8 standard

Fixes #3074

* label: Calculate length only once

The length calculation has to traverse the whole string

---------

Co-authored-by: nklloyd <nicholask.lloyd@gmail.com>
2024-02-10 12:51:34 +01:00
Patrick Ziegler
8e04f15ed6 fix(backlight): %backlight% token appearing on the bar (#3081)
* Fix backlight initial value matching the actual brightness level

The initial value is `0`. If the actual brightness is also `0` you see
`%percentage%` token as text, it’s not being replaced. Since
`m_brightness` is an `int` the initial value could be just `-1` since
the actual brightness is never goes below zero. Thus this bug will never
show up again because actual brightness on first render won’t match
the “old” `m_brightness` value.

See also for more detailed explanation of the bug:
https://github.com/polybar/polybar/discussions/3079#discussioncomment-8169932

* Add docs

---------

Co-authored-by: Viacheslav Lotsmanov <lotsmanov89@gmail.com>
2024-01-20 18:09:12 +01:00
patrick96
0ed669f049 fix(doc): Update vulnerable rtd search extension
Ref: https://github.com/readthedocs/readthedocs-sphinx-search/security/advisories/GHSA-xgfm-fjx6-62mj
2024-01-20 17:53:28 +01:00
Roddy Rappaport
11b522c313 doc: Added unmute-on-scroll to changelog and module descriptions 2024-01-17 18:01:10 +01:00
Roddy Rappaport
82a81ce07c feat(pulseaudio): Add unmute on scroll option (polybar#3067)
This will allow users to specify in their config if they want the mixers
to unmute if they use the scroll wheel on the module.

Closes: #3067
2024-01-17 18:01:10 +01:00
Roddy Rappaport
c2dd279bf7 feat(alsa): Add unmute on scroll option (polybar#3067)
This will allow users to specify in their config if they want the mixers
to unmute if they use the scroll wheel on the module.
2024-01-17 18:01:10 +01:00
patrick96
174ce34285 fix(doc): Update vulnerable rtd search extension
Ref: https://github.com/readthedocs/readthedocs-sphinx-search/security/advisories/GHSA-xgfm-fjx6-62mj
2024-01-16 22:37:15 +01:00
patrick96
b4d8be590b Update PKGBUILD for 3.7.1 2023-11-27 17:36:23 +01:00
patrick96
b25d00b159 fix(doc): Wrong header level in changelog 2023-11-27 17:29:31 +01:00
patrick96
367847ec3b Merge branch 'hotfix/3.7.1' 2023-11-27 17:20:39 +01:00
patrick96
91bd85cf50 Version 3.7.1 2023-11-27 17:15:23 +01:00
patrick96
ade2ee0981 build: Update i3ipcpp
Closes #3042
Includes polybar/i3ipcpp#16
2023-11-27 15:53:30 +01:00
Felix Yan
7ad51bed20 Update Arch Linux package URL in README.md
The old URL returns 404 now.
2023-11-21 14:23:25 +01:00
patrick96
9ea910d706 doc: Fix "Release Workflow" badge
The release workflow never runs on the master branch (it runs on the
release branch), so the badge would always show "no status"
2023-11-18 19:41:13 +01:00
patrick96
c552df3b66 fix: Modules did not validate tags used in formats
The 'value' variable that was used for validation, was empty because it
was used in a move at the beginning of the function.

Fixes #3043
2023-11-16 22:29:00 +01:00
patrick96
432e19df01 build: Add missing headers in common.hpp 2023-11-12 15:18:34 +01:00
patrick96
cbfbba0700 Remove tray_visibility signal
No longer needed since tray visibility is now controlled directly by the
enclosing module
2023-11-11 04:01:26 +01:00
patrick96
8566051336 fix(tray): Allow module to disappear for empty tray
Modules that don't produce any output are hidden by the controller
(don't have margins or separators).
The tray module should also do that for `format = <tray>` when there are
no icons.

This required the visibility handling to be tied to the module
visibility instead of being handled by the renderer.
Otherwise, the renderer would hide the tray (because the %{Pt} tag was
never sent) and the tray would not unhide when new icons appeared; it
can't differentiate between hidden because empty and hidden because the
module is hidden by the user (the latter is the reason the renderer does
hiding at all).

Fixes #3036
2023-11-11 04:01:26 +01:00
patrick96
7d7bf84e16 Update PKGBUILD for 3.7.0 2023-11-06 01:02:48 +01:00
patrick96
a7d9b7d912 doc: The Kelvin unit appears without "degrees" 2023-11-06 01:02:48 +01:00
patrick96
2471f3595c Version 3.7.0 2023-11-05 23:36:13 +01:00
patrick96
cd57c1252c Write migration guide for the content in custom/text 2023-11-05 22:53:09 +01:00
patrick96
ea3b47a65e Improve release workflow documentation 2023-11-05 22:05:43 +01:00
patrick96
70c400d20d doc: Specify boxes to check in GitHub release tool 2023-11-05 22:05:43 +01:00
patrick96
f8983e2bd3 Remove colon from download header 2023-11-05 22:05:40 +01:00
Tony Zorman
f7a755799c feat(xworkspaces): Add group-by-monitor flag
By default, we group workspaces by monitor with the help of
_NET_DESKTOP_VIEWPORT.  However, some users may experience this as an
unpredictable "shuffling" of workspaces.  While WMs could disable
advertising the property itself, it seems more sensible to handle this
at the level of polybar.  Hence, introduce a new group-by-monitor
flag—defaulting to true—which can be used to disable this behaviour.

Closes: https://github.com/polybar/polybar/issues/2603
Related: https://github.com/xmonad/xmonad-contrib/pull/791
Related: https://github.com/qtile/qtile/issues/3375

Co-authored-by: scaramangado <scaramangado@gmail.com>
2023-10-29 16:15:10 +01:00
patrick96
0a19c5e3d7 doc: Bump sphinx-rtd-theme to version 2
The notfound plugin (404 page) does not seem to work with older versions
of the theme.
2023-10-23 01:08:14 +02:00
patrick96
eaa3ba5f83 doc: Fix sphinx version 2023-10-23 00:32:46 +02:00
patrick96
7972c20fe9 fix(xpp): Allow for custom python executable
Includes polybar/xpp#34
2023-10-23 00:32:46 +02:00
patrick96
38f67f4269 doc: Add sphinx 404 page 2023-10-23 00:32:46 +02:00
patrick96
6a648c8ef7 doc: Update readthedocs URLs
There is a redirect setup that redirects anything to `/en/stable` (or
whatever the default version is).
This allows us to create version-agnostic direct links that always
redirect to the default version
2023-10-23 00:32:46 +02:00
patrick96
054b9f4d33 docs: Add banner for 'latest' version 2023-10-23 00:32:46 +02:00
patrick96
80aa2bade5 build: Fix cmake warnings in submodules
Includes polybar/xpp#33
Includes polybar/i3ipcpp#15
2023-10-22 15:40:33 +02:00
patrick96
aebdb5328a fix(backlight): Poll if necessary
The `backlight` file seems to not receive modification events for
inotify (it does receive other events though).
These other events still trigger an update, but the value read is still
the old value because the events arrive just slightly before the file is
updated.

The new `poll-interval` setting will inject an event every X seconds to
force an update.
If the actual_brightness file is used, the interval is set to 0 and thus
turned off.

This does not add any more wakeups to the module, the inotify modules
wake up every second anyway and during that time, the interval is
checked.

Fixes #2835
2023-10-21 20:32:11 +02:00
patrick96
278584fa27 feat(doc): Add rtd search extension
Provides real-time search on readthedocs

Ref: https://readthedocs-sphinx-search.readthedocs.io
2023-10-08 21:24:37 +02:00
patrick96
19e8d53320 doc: Explicitly specify sphinx rtd theme dependency
Since August 7, 2023, readthedocs will not install the rtd theme by
default anymore.

Ref: https://blog.readthedocs.com/python-core-requirements-changed/
2023-10-08 21:16:21 +02:00
patrick96
c9752598a5 fix(bspwm): Restack against topmost root window.
The ewmh strategy has to be dropped because the
`_NET_SUPPORTING_WM_CHECK` window may (at least in bspwm) appear
anywhere in the window stack.

To fix the overlapping monitors issue in #2873, we simply restack
against the topmost of these root windows.

Fixes #2972
Fixes #2873 (again)
2023-10-08 21:04:29 +02:00
patrick96
1bfe117c5d Document recommendations for nerd fonts 2023-09-30 19:32:48 +02:00
patrick96
16102c258a alsa: include asoundlib.h instead of all alsa headers
In alsa 1.2.10, the `alsa/control.h` header cannot be included on its
own because it does not include all symbols it uses.

We are basically duplicating asoundlib.h anyway and there is even a
macro variable to switch to it.

Ref: #3009
Ref: https://github.com/alsa-project/alsa-lib/issues/348
2023-09-28 19:30:49 +02:00
patrick96
53661e995a doc: Fix FreeBSD link 2023-08-20 11:59:43 +02:00
patrick96
1043354aec tray: Deprecate all legacy tray settings 2023-08-06 15:26:28 +02:00
patrick96
97ce1f6e7a Add inactive tray module to default config
Replaces the commented out `tray-position`
2023-08-06 15:26:28 +02:00
dvermd
b754790642 Cleanup base::tags (#2991) 2023-07-06 09:46:33 +02:00
Andrew Tran
c747599ef5 fix(tray): check for visibility when docking (#2973)
Fixes #2968
2023-06-13 11:25:36 +02:00
Vincent Bernat
2cd0809a46 fix(randr): avoid querying hardware to get current configuration (#2470)
When using `get_screen_resources`, XRandR will query the hardware to
detect any change. This takes some time.
`get_screen_resources_current` uses the cached information and is
pretty fast.

In my case, the information is always already present in cache because
it was set by the program that did configure the screens (autorandr in
my case, but this applies to most frontends). As polybar is not used
to configure stuff, I think this is fine. There should be something
configuring the screen before polybar is able to use it.

However, maybe some people are using `polybar --list-monitors` just
after plugging a screen. It won't display the new screen in this case.
So, maybe this is not a good idea. It makes polybar starts
faster (500ms faster in my case when there are 3 screens plugged).
Also, I did this change because running `polybar --list-monitor` in
parallel with starting `polybar` (in a for loop for example), I get
some curious bug where my screens disappear and reappear. I don't need
this change as this was easy to fix by avoiding the parallel access to
XRandR properties, but maybe this would avoid other people running
into the same problem.

Your take!
2023-05-18 11:29:30 +02:00
dvermd
06a3de0b89 Refactor config::dereference* (#2963)
* Refactor config::dereference*

* move config::deprecated* implementation to cpp file

* config: move more functions implementation to cpp file
2023-05-18 09:47:45 +02:00
patrick96
ea3eb6eaa4 ci: Update ubuntu version 2023-05-15 14:44:50 +02:00
patrick96
4d1bba2c4e Add changelog 2023-05-15 14:44:50 +02:00
patrick96
2c23f7a87f restack: Make bspwm first try ewmh strategy 2023-05-15 14:44:50 +02:00
patrick96
4f9f07eefd restack: Add ewmh restacking strategy
Positions the bar window above the _NET_SUPPORTING_WM_CHECK window

The generic restacking strategy now first tries the ewmh strategy, the
the bottom strategy.
2023-05-15 14:44:50 +02:00
patrick96
b11a2ff653 restack: Add bottom restacking strategy
For now this is the same as the generic one
2023-05-15 14:44:50 +02:00
patrick96
59acb4150b Clean up restacking code
Restacking algorithms now only need to provide the sibling window and
stacking mode.
2023-05-15 14:44:50 +02:00
patrick96
76c7ee3bf6 Introduce restacking utilities
Aim is to clean up restacking logic and remove some duplicated code
2023-05-15 14:44:50 +02:00
patrick96
f78ec80df3 Add changelog entry 2023-05-10 17:06:00 +02:00
patrick96
425d4dc338 Cleanup 2023-05-10 17:06:00 +02:00
patrick96
32c78aa63a Cleanup ucs4_to_utf8 2023-05-10 17:06:00 +02:00
patrick96
40bc8c7955 Test utf8_to_ucs4 error correction 2023-05-10 17:06:00 +02:00
patrick96
5b1fae4fc1 Make utf8_to_ucs4 take a string reference 2023-05-10 17:06:00 +02:00
patrick96
5e5a0a7c4d Make unicode_charlist a vector 2023-05-10 17:06:00 +02:00
patrick96
c86519f077 test: utf8_to_ucs4 with invalid strings 2023-05-10 17:06:00 +02:00
patrick96
3a27e891d2 fix(renderer): Drop strings with invalid UTF8 2023-05-10 17:06:00 +02:00
patrick96
63443f82d5 Refactor utf8_to_ucs4 2023-05-10 17:06:00 +02:00
patrick96
270c0a340c Add tests for utf8_to_ucs4 2023-05-10 17:06:00 +02:00
patrick96
71c65447f8 Move utf8 conversion code to string utils 2023-05-10 17:06:00 +02:00
patrick96
6e716296ff Formatting 2023-05-10 17:06:00 +02:00
patrick96
d74a4fab77 i3: Better error reporting when connection fails
Prints the output and exit code of 'i3 --get-socketpath' if it fails and
prints the socket path if the connection fails.

Ref polybar/i3ipcpp#13
Ref #2942
2023-05-10 09:42:05 +02:00
dvermd
f5169abde2 Remove unsupported.hpp (#2956)
* Remove unsupported.hpp

* Rename names.hpp to types.hpp

* Replace macro by function

* Add missing cassert include in controller.cpp
2023-05-08 19:36:12 +02:00
Patrick Ziegler
031a29332a doc: Use readthedocs config file (#2957)
This is the recommended way to configure the project instead of using
the website.

It should also help fix readthedocs/readthedocs.org#10290
2023-05-08 19:13:02 +02:00
dvermd
0caa30683c Remove config singleton (#2951)
* Remove unused function

* Refactor deprecation warning

* Modules take config as parameter instead of using the singleton

* Bar take config as parameter instead of using the singleton

* Renderer take config as parameter instead of using the singleton

* Legacy Tray Manager take config as parameter instead of using the singleton

* Screen take config as parameter instead of using the singleton

* Controller take config as parameter instead of using the singleton

* Remove the config singleton

* Apply review suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Apply style suggestion

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

---------

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2023-05-01 14:58:52 +02:00
patrick96
61f0e9dd5d fix(tray): Vertically center in inner bar area
The tray should be vertically centered in the inner area of the bar.
Unequal top and bottom borders should not affect the alignment relative
to other text.

Fixes #2950
2023-04-29 14:45:01 +02:00
patrick96
7bc673b8f2 fix(doc): %s in extlinks caption before sphinx 4.0
There is no way to support extlinks with a custom caption in both sphinx
< 4 and >= 4 at the same time without implementing different behavior
per version.
2023-04-20 01:24:02 +02:00
patrick96
89ca0255f1 doc: Fix extlinks %s substitution in caption
Substitutions in the caption are only supported in version 4 of
sphinx.
However, RTD uses sphinx 1.8.6

Just letting it append the value seems to work in both 1.8.6 and newer
versions.
2023-04-18 15:48:38 +02:00
patrick96
cf802ad431 doc: Mention errors and warnings in migration guide 2023-04-18 15:48:38 +02:00
patrick96
dbac7d8ae8 doc: Finish tray migration guide 2023-04-18 15:48:38 +02:00
patrick96
fcef90be24 doc: Start tray migration guide 2023-04-18 15:48:38 +02:00
patrick96
6148bb7f14 doc: Add empty migration page 2023-04-18 15:48:38 +02:00
patrick96
30bb1584fc doc: Add page about default config 2023-04-18 15:48:38 +02:00
patrick96
f3c911991c doc: Document custom directive in python script 2023-04-18 15:48:38 +02:00
patrick96
44b5f87884 doc: Use issue directive to link to issue 2023-04-18 15:48:38 +02:00
patrick96
006e971dad doc: Add module links 2023-04-18 15:48:38 +02:00
patrick96
6e0cff97ff doc(tray): Add type at the beginning 2023-04-18 15:48:38 +02:00
patrick96
fc422b1107 doc: Style external links in RTD theme 2023-04-18 15:48:38 +02:00
patrick96
81684a6c9d doc: Show version in alabaster theme (local builds) 2023-04-18 15:48:38 +02:00
patrick96
0032f27686 doc: Use extlinks for linking to issues and PRs 2023-04-18 15:48:38 +02:00
patrick96
234e606b41 doc: Replace custom domain with add_object_type
Less overhead and doesn't require a new dependency
2023-04-18 15:48:38 +02:00
patrick96
c48aa1998c fix(doc): Setup function not always running
If the sphinx version was below 1.8.5, no setup function was defined at
all.
2023-04-18 15:48:38 +02:00
patrick96
98d58b6f27 doc: Reformat conf.py 2023-04-18 15:48:38 +02:00
patrick96
c6eb3f88ea doc(tray): Initial experiments 2023-04-18 15:48:38 +02:00
patrick96
df32703a22 tray: Rework tray spacing
tray-padding determines space added before and after each icon
tray-spacing determines space added between icons (but not at the edge)

Both are an extent value and accept both pixel and point values.
2023-04-01 21:04:58 +02:00
patrick96
7fbd2d175c tray: Cleanup position calculation 2023-04-01 21:04:58 +02:00
patrick96
b5f8466117 tray: Replace tray-maxsize module setting with tray-size
The size accepts a percentage with offset relative to the bar height and
determines the width and height of tray icons.

Defaults to 66%

Does not affect spacing
2023-04-01 21:04:58 +02:00
patrick96
4e66b1f4b8 tray: Remove tray-scale module setting 2023-04-01 21:04:58 +02:00
patrick96
921e2d0670 Merge remote-tracking branch 'upstream/master' into tray-child-window 2023-03-25 22:04:21 +01:00
patrick96
04fefa0a0e fix(tray): Correct y-position with border
The border size was not taken into account when calculating the tray
icon's y-position
2023-03-25 20:17:22 +01:00
patrick96
11746455ee tray: Cleanup & documentation 2023-03-25 20:17:02 +01:00
patrick96
f3ce047c52 tray: Remove delayed notifications
Unclear why it is needed, neither i3bar, nor stalonetray do delayed
notifications
2023-03-25 19:28:43 +01:00
patrick96
23153c3a23 tray: Address rendering related TODOs
Currently, we don't support 32-bit visuals and don't set
_NET_SYSTEM_TRAY_VISUAL

It is unclear what happens if the default visual (which is used as a
fallback if _NET_SYSTEM_TRAY_VISUAL is not set) is 32-bit.
In that case, we may need to explicitly use a 24-bit visual.
2023-03-25 19:19:09 +01:00
patrick96
3e3a380069 tray: Remove option TODOs
They are noted in #2689
2023-03-25 19:18:34 +01:00
patrick96
ac589b32dd Remove TODOs
Not doign this. Using the desired background as the X window background
color would require us to always first check before using the pixmap or
cairo context.
2023-03-25 17:31:52 +01:00
patrick96
616b3fe3e7 color: fix tests 2023-03-23 23:15:21 +01:00
patrick96
47f6d9c25d renderer: documentation 2023-03-23 23:12:50 +01:00
patrick96
58e0911ac6 tray: Disable pseudo-transparency for opaque bgs 2023-03-23 23:03:45 +01:00
patrick96
89f29fa12e tray: documentation 2023-03-23 22:41:40 +01:00
patrick96
f6172e1459 Remove tray client gc
Not actually used anywhere
2023-03-23 22:27:43 +01:00
patrick96
1aeac226a6 Delete tray client pixmap and gc in destructor 2023-03-23 22:27:11 +01: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
b3cbf0a644 ci: Update codecov and checkout actions
The coverage job fails because of the outdated codecov action and the
checkout v2 action uses a deprecated version of nodejs
2023-02-13 22:00:43 +01:00
patrick96
fc423c0921 fix(i3): Deal with negative coordinates
Pulls in fix in i3ipcpp repo: https://github.com/polybar/i3ipcpp/pull/12

Fixes https://github.com/polybar/polybar/issues/2888
Ref https://github.com/i3/i3/discussions/5352
2023-01-05 22:11:08 +01:00
patrick96
e8870d6537 tray: Prevent crash when no wallpaper is found 2022-12-21 23:47:57 +01:00
patrick96
edf37385cb script: Bump poll timeout to 250ms
The module has a poll timeout because it needs to periodically check if
it is shutting down. Otherwise, it would be stuck polling and the bar
couldn't shut down until the script produces a new line.

However, this causes the bar to wake up intermittently (currently
~40/s) due to the 25ms timeout.
Bumping this to 250ms still gives us timely shut downs and caps the
number of wake ups to 4/s.

This is only a stop-gap solution, ideally the script runner is
integrated into the main event loop and uses its polling handles which
don't have to wake up to check for a shutdown.

Ref #1778
Ref #2337
2022-12-12 00:52:13 +01:00
patrick96
65279883c3 Replace wait_for_response with handle callback
The poll-loop could in theory swallow events which would not be seen by
the main eventloop
2022-11-30 15:06:17 +01:00
patrick96
aadd4ce1c8 Remove screen realloc argument
Replaced with explicit reset function
2022-11-30 13:41:25 +01:00
patrick96
d5498c8a8a script: Require zero exit code to show empty module.
Showing an empty module if the script failed but produced no output does
not make too much sense.

Ref #2857
2022-11-05 12:43:43 +01:00
patrick96
d296d67953 Merge remote-tracking branch 'upstream/master' into tray-child-window 2022-10-31 23:30:07 +01:00
patrick96
f5d16891dd tray: Cleanup 2022-10-31 23:21:00 +01:00
patrick96
ca25b5685c tray: Add back legacy tray implementation
Is used for trays defined through tray-position and nothing else.
2022-10-31 23:05:23 +01:00
patrick96
cfe9a81f55 clang-format: Only indent inner namespaces 2022-10-31 23:04:57 +01:00
tnixeu
ed6a0e90fb fix code in order to support cmake unity builds 2022-10-29 15:09:03 +02:00
patrick96
10cdec3b9f build: Fix deprecation errors 2022-10-23 15:20:21 +02:00
patrick96
87750c064e build: Bump C++ to C++17
Now requires gcc8 or clang7
2022-10-23 15:20:21 +02:00
patrick96
291a4844bc fix(ipc): Crash when sending to multiple instances
In polybar-msg, the connection handle was captured as a reference to a
shared_ptr, but the shared_ptr went out of scope right after.

This probably always caused UB, but was only noticeable for two or more
instances.
2022-10-23 14:19:26 +02:00
Madhav Prabhu C M
30e1cc2595 feat(ipc): <label> support (#2841)
* Label = %output% working

* build fix

* Output as deprecated, Label as default

* Corrections

 * Corrections Simplified

* Changelog updated
2022-10-23 10:47:22 +02:00
Ashwin
1e582accb8 moved warnings near config options 2022-10-22 13:06:06 +02:00
Ashwin
cbf5439e80 changelog 2022-10-22 13:06:06 +02:00
Ashwin
cbfb417dce option to turn off struts 2022-10-22 13:06:06 +02:00
patrick96
7049c755c5 --wip-- [skip ci] tray experiments 2022-10-16 21:31:25 +02:00
patrick96
6d74ae51e7 Merge remote-tracking branch 'upstream/master' into tray-child-window 2022-10-16 21:31:07 +02:00
patrick96
31bdacb3d7 Remove never used systray module
Not the same as the new tray module
2022-10-16 21:25:48 +02:00
patrick96
b0e33053f9 Use debug flags for sanitizer builds 2022-10-16 21:25:48 +02:00
patrick96
3561fd3ad1 Templatify module factory
Saves us a lot of code duplication by generating module type-indexed map
and factory functions from the module class names.
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
d6997659fa cleanup 2022-10-12 23:34:38 +02:00
Madhav Prabhu C M
54b75f23ab feat(ipc). Per hook format (#2810)
* Added format-x support for ipc_module, tested with demo config

* Certain cases not working

* Certain cases not working, build

* Changed label to output tag, Mixing of default formats wont work

* created changelog
2022-10-09 18:42:36 +02:00
patrick96
3cfa01233c tray: Fix infinite update loop
tray_client::clear_window is called on expose events for the wrapper
window, thus it must not produce expose events for itself again.
2022-10-09 17:47:39 +02:00
Patrick Ziegler
e9713185cb backlight: Remove actual_brightness amdgpu check (#2839)
The issue has been fixed in the linux kernel version 5.9 and above so we
are removing our workaround for this from polybar.
Users with older versions can still work around this by explicitly
setting `use-actual-brightness` to false, it is just not done by default
anymore.

Closes #2835
Ref https://bugzilla.kernel.org/show_bug.cgi?id=203905
Ref 69d9f4278d
2022-10-08 15:52:47 +02:00
Ron0Studios
303015244e feat: longest match ws-icon fuzzy matching (#2831)
* better fuzzy matching

Improved fuzzy matching so that it finds the longest matching icon instead of the first possible match

* Update CHANGELOG.md

* removed debug output

* added tests and improved fuzzy finder

- added return statements to the fuzzy finder
- added tests to check whether the fuzzy finder works.

* minor style changes

* minor change to iconset.cpp

* Delete tasks.json
2022-10-05 23:05:44 +02:00
patrick96
0096fea839 Merge remote-tracking branch 'upstream/master' into tray-child-window 2022-10-05 23:02:18 +02:00
patrick96
2e902fee04 Add .cache to gitignore
Used by clangd
2022-10-05 23:01:54 +02:00
Ashwin Rajesh
03987b19a5 fix(xwindow): Crash when no tag is set in format (#2833)
* xwindow works without tag

* changelog
2022-10-05 21:39:02 +02:00
patrick96
5719d130fd feat(xwindow): %instance%, %class% from WM_CLASS 2022-10-02 20:57:29 +02:00
patrick96
ae3deab0db Remove unused operator== 2022-10-01 22:28:08 +02:00
patrick96
463ef963a1 Add pseudo transparency back to tray icons 2022-10-01 22:24:23 +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
patrick96
def2682b8c tray: Set _NET_SYSTEM_TRAY_VISUAL 2022-09-26 21:39:10 +02:00
patrick96
5c38d5cb17 tray: Store clients in unique_ptr 2022-09-24 13:20:02 +02:00
patrick96
3da2662022 xwindow: Also listen for WM_NAME changes 2022-09-19 22:54:41 +02:00
Patrick Ziegler
918bc212ee doc: Remove sphinx language setting (#2822)
Sphinx now emits a warning if `language` is set to `None`
2022-09-19 22:49:03 +02:00
patrick96
0c223ae2bb fix(tray): Too many printf directives 2022-09-19 21:39:11 +02:00
patrick96
627d43dad2 tray: Set _NET_SYSTEM_TRAY_ORIENTATION 2022-09-19 21:23:22 +02:00
patrick96
63c6b13cbf tray: Cleanup client state handling 2022-09-15 19:38:45 +02:00
patrick96
5fd62edfca tray: Cleanup logging 2022-09-14 21:53:02 +02:00
patrick96
8ec9807145 Merge remote-tracking branch 'upstream/master' into tray-child-window 2022-09-13 14:24:59 +02:00
Patrick Ziegler
1d4e30c4be fix: Handle X events before polling for IO (#2820)
* Use m_connection.poll_for_event

* fix: Handle X events before polling for IO

Polling the XCB file descriptor for X events doesn't detect events that
are already in XCB's event queue but not yet handled.

If this happens, the eventloop polls for IO and the queued events wait
until another event arrives, causing some desyncs in the bar.

This can easily happen if something (e.g. a click event) triggers some
xcb calls, which as a consequence buffer some incoming events.

We "fix" this by adding a libuv prepare handle (which runs right before
polling for IO) that processes pending X events.
2022-09-13 14:21:36 +02:00
patrick96
60173e5042 tray: Better lifecycle handling 2022-09-11 21:51:08 +02:00
patrick96
ea5ffdd6b1 Merge remote-tracking branch 'upstream/master' into tray-child-window 2022-09-11 19:32:29 +02:00
Patrick Ziegler
053a7eb2d8 fix: Crash on root pixmap and window depth mismatch (#2813)
The background_manager used the root window depth for creating its
pixmaps, but when the root pixmap has a different depth, this causes the
copy_area_checked call to fail and crash the bar.

We now load the root pixmap before finding the visual and creating the
slice pixmaps.

Fixes #2798
2022-09-05 09:58:12 +02:00
patrick96
3b9ff04f40 tray: Fix build error 2022-09-04 12:00:45 +02:00
patrick96
fe9660254c Merge remote-tracking branch 'upstream/master' into tray-child-window 2022-09-04 11:46:32 +02:00
patrick96
901183a60a tray: Fix tray not updating after (un)map_notify
The issue was that the event was for the wrapper window and that the
tray_client's move constructors didn't correctly copy over all data and
so when the m_clients vector grew, it corrupted the state of all
existing clients.
2022-09-03 22:34:00 +02:00
patrick96
1127792ccf tray: Update module using callback 2022-09-03 21:33:22 +02:00
patrick96
b72458a6b0 tray: Load settings from module section 2022-09-03 20:56:32 +02:00
patrick96
03a2e6bb17 tray: Read width directly from tray_manager 2022-08-28 15:29:36 +02:00
patrick96
ffcdf7d690 tray: Start tray from module 2022-08-28 15:15:48 +02:00
patrick96
1dcff9396a tray: Stop listening to ui::visibility_change
If the bar window (un)maps, the tray icons are automatically (un)mapped
2022-08-28 15:05:22 +02:00
patrick96
de560fe810 tray: Remove mutex 2022-08-28 14:56:56 +02:00
patrick96
d658c07177 tray: Cleanup tray settings 2022-08-28 14:49:09 +02:00
patrick96
ef06472a6d tray: Remove tray window
Each tray client is directly reparented to the bar window. This saves us
the hassle of having to configure a basically useless tray window and
keeping its background pixmap in sync.

The only disadvantages are having to (un)map each client window
individually and calculating its position relative to the bar window
(which changes all the time) instead of relative to the tray window
(which only changes when clients are added/removed).
2022-08-27 23:02:34 +02:00
Patrick Ziegler
d817080ee8 fix(renderer): Small gaps when rendering emojis (#2802)
If any rendered text uses a non-integer number of pixels (often emojis),
rendering of subsequent text blocks will start between pixels which
results in small gaps in the background and over/underline colors caused
by cairo only rendering at fractional-intensity in the beginning and end
pixel.

Simply rounding up text width can solve this.

Fixes #2785
2022-08-25 00:55:16 +02:00
Ashwin Rajesh
7838241a77 feat(tokens): Negative minimum length adds right padding (#2801)
* negative minimum length adds right padding

* missing else statement

* updated changelog
2022-08-25 00:36:38 +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
Quantenzitrone
708bd9c891 feat(temperature): %temperature-k% token for Kelvin (#2784)
* added kelvin option for module/temperature

* changelog for the changes i made

* fixed typos

* fixed the temperature conversion to be more precise

* Update CHANGELOG.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* changed the calculation of the different temperatures

it now uses float as a initial value and makes m_temp temp_k and temp_f by converting and rounding with std::round

* std::lround makes more sense to use than std::round

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-08-21 19:10:48 +02:00
patrick96
dca9e15339 tray: Store position relative to inner area 2022-07-26 21:33:28 +02:00
patrick96
9c759549c6 tray: Remove background_manager
The tray window uses the pixmap of the bar window and clears window
content on every update.
2022-07-26 00:01:21 +02:00
patrick96
4bbb28baaf Merge remote-tracking branch 'upstream/master' into tray-child-window 2022-07-25 23:40:45 +02:00
Patrick Ziegler
b5764c8a93 Use CMAKE_INSTALL_SYSCONFDIR instead of /etc (#2770)
Some distro's build infrastructure (e.g. gentoo) can use
CMAKE_INSTALL_PREFIX to install to a different location.
When the config path is hardcoded to /etc, CMAKE_INSTALL_PREFIX has no
effect.

Ref: https://bugs.gentoo.org/858797
2022-07-19 23:26:11 +02:00
Patrick Ziegler
f4d0ba9186 config_parser: Pass barname as argument to parse() (#2765)
Doesn't need to be a class field
2022-07-09 13:12:37 +02:00
patrick96
841b799299 Add include-file reload fix to changelog 2022-07-09 12:26:07 +02:00
Tuur Vanhoutte
98d584c8fe Also monitor include-files for changes when --reload is set (#2759)
* fixes #675

* feat(configwatcher): method to create config monitor handler

* cleanup

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2022-07-09 12:24:21 +02:00
raffael0
a20f76d7e5 fix: tray flickers due to excessive redrawing/visibility changing (#2747)
Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-07-09 09:09:55 +02:00
raffael0
9f4e88c07d fix: tray isn't visible when a module updates (#2742) 2022-07-09 08:45:09 +02:00
sysek
a42e533089 doc: change openSUSE description (#2749)
* change openSUSE description

* Update README.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-06-23 06:38:04 +02:00
raffael0
f3e27a205e backlight: auto-detect default card (#2728)
* auto-detect a default backlight

* Implemented suggestions

* added changelog

* Implemented suggestions

* Fix changelog formatting

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2022-06-16 12:54:38 +02:00
raffael0
b2c5d8e0e2 tray: implement hiding functionality (#2723)
* tray hiding works

* clang-format

* Implemented suggestions
2022-06-16 12:53:49 +02:00
raffael0
86f2baa550 tray: remove tray-position = adaptive (#2726)
The tray is automatically started if there is a tray module. In addition, `tray-position` and the tray module conflict.

Ref #2689
2022-06-15 11:09:13 +02:00
raffael0
6a43758b5b tray is no longer pushed off the bar (#2727) 2022-06-14 15:35:49 +02:00
Franklin Timóteo
ca06be1d0e Updated instructions for installing on Debian (#2732)
Current version backports is bullseye.
2022-06-12 19:28:18 +02:00
Maxim Kolesnikov
0331a5fda4 fix: error reporting for deprecated config values (#2725) 2022-06-12 16:31:11 +02:00
Patrick Ziegler
1ee11f7c9e Adapt release workflow to produce signed releases (#2720) 2022-05-09 17:00:14 +02:00
Patrick Ziegler
1f55eaf73d Adapt to official Arch Linux package (#2719)
Now that polybar is in the official repos, we only need the polybar-git
PKGBUILD.
2022-05-09 16:36:54 +02:00
Leonidas Spyropoulos
8a4fc1f4f7 Update Arch Linux installation instructions (#2717)
polybar is now available in official repos
2022-05-09 15:17:13 +02:00
Patrick Ziegler
f0dbb4cc63 Add darkmode banner (#2712)
Ref #2706
2022-05-04 21:31:25 +02:00
Patrick Ziegler
80bcf55844 Update PKGBUILD for 3.6.3 (#2711) 2022-05-04 11:39:06 +02:00
patrick96
46358792e0 fix(build): Changes in inotify module 2022-05-04 11:09:55 +02:00
patrick96
7a1824a9b9 Merge remote-tracking branch 'origin/hotfix/3.6.3' 2022-05-04 11:08:12 +02:00
patrick96
a962a2658d Version 3.6.3 2022-05-04 09:07:06 +02:00
Patrick Ziegler
f653c3a738 fix(pulse): Hanging during connection setup (#2709)
If context_state_callback is called before we call
pa_threaded_mainloop_wait in the main thread, the signal is lost and we
wait forever.

Fixes #2707
Ref #2699
Ref #2697
2022-05-04 08:58:53 +02:00
Mathis Weber
423cc1720f fs: fallback if no mountpoints specified (#2705)
Ref #2572
2022-05-02 12:54:03 +02:00
Patrick Ziegler
f9fc02e69c Add backup directive to PKGBUILD (#2704)
This way changes to the default config made by users are preserved if
polybar ever changes the default config

Ref: https://aur.archlinux.org/packages/polybar-git#comment-863283
2022-04-30 23:03:00 +02:00
Patrick Ziegler
efbd8e394f fix(bar): Update struts when hiding (#2702)
When the bar is hidden, the struts should be 0 so that WMs can resize
their windows and not leave a gap.

Ref #2701
2022-04-27 21:09:59 +02:00
marxlaml
6a2d7b5dde feat(backlight): Add scroll-interval (#2700)
Closes #2696

* Added `scroll-interval` option to `internal/backlight`

* Added PR to CHANGELOG.md

* Fixed indentation
2022-04-27 19:53:06 +02:00
Patrick Ziegler
bc9dda266f fix(xworkspaces): Update on _NET_DESKTOP_VIEWPORT (#2698)
Fixes #2693
2022-04-25 17:46:53 +02:00
Mathis Weber
b5292791ef fix: check if double click action associated (#2695)
When a module is clicked, only wait for the double click interval if a
double click action is associated with that module. Otherwise trigger
the click right away.

Fixes: #2663
2022-04-25 12:59:40 +02:00
patrick96
d743a22817 --wip-- [skip ci] 2022-04-16 00:20:00 +02:00
patrick96
9ad73da05f tray: Remove calculate_client_x 2022-04-16 00:16:50 +02:00
patrick96
bdfe655556 tray: Reuse bar visual 2022-04-16 00:16:50 +02:00
patrick96
81d1f74b7b Move client configuration into tray_client 2022-04-16 00:16:50 +02:00
patrick96
48d8187f90 Collect bar window, visual, and depth in bar_settings 2022-04-16 00:16:50 +02:00
patrick96
b5c742a63e Use connection.root() to get root window 2022-04-16 00:16:50 +02:00
patrick96
6043f856b6 controller: Keep only eventloop in try-catch
If an exception is thrown earlier, stopping the eventloop produces an
error.
2022-04-16 00:16:49 +02:00
patrick96
9b1afe7369 Cleanup selection of visual for bar window 2022-04-16 00:16:49 +02:00
patrick96
b8c275d6ac Fix BadMatch error for wrapper window
The wrapper window must define a border background if the depth doesn't
match the parent window.
2022-04-16 00:16:49 +02:00
patrick96
3711e999ba Use individual wrapper window for each tray client 2022-04-16 00:16:49 +02:00
patrick96
9544130b9c Fix screen messing up if client docking fails
The client window has to be added to the save set after it has been
reparented. Otherwise if the reparenting fails weird stuff happens
(windows in the save set have to be child windows of windows created by
the current connection).
2022-04-16 00:16:49 +02:00
patrick96
ab7612ea4a tray: Make m_clients exclusive owner of clients 2022-04-16 00:16:49 +02:00
patrick96
ab2b5f603c Use bar window depth for tray pixmap 2022-04-16 00:16:49 +02:00
patrick96
6fa85d2ce8 Remove unused parameter 2022-04-16 00:16:48 +02:00
patrick96
7acd4c703c xcb: Cleanup value packing 2022-04-16 00:16:48 +02:00
patrick96
ba0e478026 Cleanup tray position handling 2022-04-16 00:16:44 +02:00
patrick96
3244b10ce3 Make tray window a bar subwindow
Currently requires a dirty workaround to prevent tray icons with
different depths from crashing
2022-04-16 00:13:53 +02:00
patrick96
18485d00c2 Cleanup tray code 2022-04-16 00:00:30 +02:00
raffael0
4961a7dcfc feat(tray): Position using a module (#2595)
Closes: #1526
Closes: #314

* debug log

* semi-working prototype. works on the left and the center but not on the right

* fixes formatting

* fixes tests

* - fixed tray_width_change signal
- implements suggestions

* - fixes error with tray positioning

* - tries to fix tests. Does not work

* - fixes tests

* - implemented suggestions

* reverted formatting in comake and doc

* - changed unique_ptr to const reference

* - fixed formatting errors in code

* - actually fixed formatting(ran clang-format)

* - implemented suggestions

* - Added CHANGELOG.md entry(not sure about wording)

* - removed bar_settings from tray_manager::setup

* - fixed issue from rebase

* - fixed issue with tests from rebase

* implemented suggestions

* Update CHANGELOG.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-04-15 23:50:04 +02:00
Patrick Ziegler
4f923ededc doc: Fix menu module action migration example (#2687)
The label-open was missing, making the snippet not work as-is.
In addition, backgrounding programs is no longer necessary

Ref #2686
2022-04-13 10:47:01 +02:00
Patrick Ziegler
ab206a5f8e fix: No overlines/underlines being drawn when using offsets (#2685) 2022-04-11 21:30:24 +02:00
Patrick Ziegler
146c1ac1d7 fix(ipc): Fallback folder not being user-specific (#2684)
If two users start a bar with IPC and don't have XDG_RUNTIME_DIR set,
polybar will create the fallback directory `/tmp/polybar`.
However, that directory is only accessible by the user that created it
and so polybar running under the second user will fail to open its
socket there.

We add the UID to the fallback directory to prevent this.

Fixes #2683
2022-04-07 15:33:56 +02:00
Patrick Ziegler
7d9227cb08 fix(battery): polling-interval not working (#2677)
Fixes #2649
2022-04-07 15:24:14 +02:00
Maxim Kolesnikov
9b28ba7a5e fix(script): clear output when exec-if fails (#2675)
Fixes #2674
2022-04-04 12:49:13 +02:00
patrick96
973b1fa3d3 feat(text): Add standard format with label
Closes #1331
Closes #1342
Fixes #2673
2022-04-04 12:01:06 +02:00
patrick96
652652f943 Update PKGBUILD for 3.6.2 2022-04-03 20:24:02 +02:00
patrick96
49b18fb3b7 Merge branch 'hotfix/3.6.2' 2022-04-03 20:11:19 +02:00
patrick96
77d611c03d Version 3.6.2 2022-04-03 19:05:45 +02:00
patrick96
8363b20793 doc: Disable collapse_navigation in rtd_theme 2022-04-03 14:32:15 +02:00
patrick96
80173c6413 Add section about distro specific setups 2022-04-03 14:32:15 +02:00
patrick96
61c4976bb5 doc: Add getting started for developers 2022-04-03 14:32:15 +02:00
patrick96
e1856cf8ec Move testing page to repo 2022-04-03 14:32:15 +02:00
patrick96
f6651d58d0 Move style guide to repo 2022-04-03 14:32:15 +02:00
Patrick Ziegler
aaac4c45ff Fix changelog entry for interval-fail (#2669)
It was mistakenly added to the 3.6 changelog
2022-04-03 13:11:28 +02:00
Maxim Kolesnikov
41d41ca8df fix(script): output timing inconsistencies (#2667)
Fixes #2650
2022-04-03 13:11:13 +02:00
Farseen
a2c1392c12 feat(pulseaudio): define reverse-scroll option (#2664)
* pulseaudio: define reverse-scroll option

When we enable natural scrolling option in libinput,
it sends scroll down event when we swipe up on the touchpad.
This makes the pulseaudio module feel weird.
This option fixes that.

* Update CHANGELOG.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-04-02 23:45:54 +02:00
indev
36d19d372d fix(script): do not hide failing scripts with constant output 2022-04-02 23:24:05 +02:00
patrick96
abfc6b7f91 fix(xworkspaces): Crash if number of desktops too small
Fixes #2660
2022-03-23 14:21:26 +01:00
patrick96
f2ce3a45c5 controller: Print when modules are loaded. 2022-03-23 14:21:26 +01:00
patrick96
ff6ac9fefc Make ewmh_connection act as xcb_ewmh_connection_t*
This way, we don't have to explicitly get the xcb_ewmh_connection_t
pointer from the object and can simply derference the ewmh instance
itself.
2022-03-21 21:37:12 +01:00
patrick96
9b7bfae33d Make exceptions in X event handlers non-fatal 2022-03-20 20:18:00 +01:00
patrick96
d018adcf91 Move current cursor value to bar class
It doesn't really belong to bar_settings
2022-03-20 20:18:00 +01:00
patrick96
ae32b5ff29 Update changelog 2022-03-20 20:18:00 +01:00
patrick96
f77a725751 Print XCB event ID if error occurs
Makes it much easier to debug from error messages.
2022-03-20 20:18:00 +01:00
patrick96
b8a7b6a605 Cleanup cursor code 2022-03-20 20:18:00 +01:00
patrick96
3f89d73374 fix mouseover error when only one cursor is defined
If only cursor-click or cursor-scroll is defined, but not the other, the
bar could try to set the cursor to the empty string which resulted in an
error.
2022-03-20 20:18:00 +01:00
patrick96
cea9949be1 Warning when cursor is defined without xcursor support 2022-03-20 20:18:00 +01:00
patrick96
b05b3a4c74 xworkspaces: Deal with disappearing windows
Because the X server is asynchronous, there is no guarantee that after
reading _NET_CLIENT_LIST, all windows still exist.
For that reason we need to handle XCB_WINDOW errors appropriately.
2022-03-20 18:31:02 +01:00
patrick96
b8075c9b4d Add polybar-msg same-user restriction to changelog 2022-03-19 12:26:53 +01:00
patrick96
8173eaf90a fix: Positioning in awesomeWM
Since polybar sets WM_NORMAL_HINTS, awesomeWM for some reason no longer
respect the position set by polybar before mapping.

reconfiguring the window position once again after mapping the window,
again positions it correctly.
2022-03-15 22:09:36 +01:00
patrick96
4556a4a7a8 fix: Support negative struts
Fixed #2642
2022-03-15 00:11:46 +01:00
patrick96
705845e5d3 Comment units functions 2022-03-14 22:58:01 +01:00
patrick96
11a644548b builder: Use unordered_set for attribute activations 2022-03-14 22:58:01 +01:00
patrick96
7fb5f165db Udpate changelog 2022-03-14 22:58:01 +01:00
patrick96
e904b408d1 fix(builder): ignored offsets
The builder::offset function returned immediately if a valid extent was
passed instead of when an invalid one was passed.
2022-03-14 22:58:01 +01:00
patrick96
6fdc3114f3 builder: Never enable over/underline without color
You cannot make polybar emit only the %{+o} tag without a color so that
codepath was unused.
2022-03-14 22:58:01 +01:00
patrick96
325ef4c3b3 Cleanup builder
Removes unused methods and fields
2022-03-14 22:58:01 +01:00
patrick96
3079acb34c Remove YCM config
Not clear if it even works anymore.
We suggest maintaining your own YCM config or using a language server
like CCLS in combination with the generated compile_commands.json
2022-03-13 21:26:54 +01:00
patrick96
39a640d5d0 Move banner to doc folder 2022-03-13 21:26:54 +01:00
patrick96
b8af14fa8c Move codecov.yml to .github folder 2022-03-13 21:26:54 +01:00
Ishaan Bhimwal
6e4ef632eb readme: add manjaro (#2638) 2022-03-13 21:19:26 +01:00
patrick96
880fbc242d Expand support page 2022-03-07 22:34:16 +01:00
patrick96
9badbd00f3 Update maintainers in README 2022-03-07 22:34:16 +01:00
patrick96
245878e91c Update markdown files to point to discussions 2022-03-07 22:34:16 +01:00
patrick96
67fb58c993 Move features request and build issues to Discussions 2022-03-07 22:34:16 +01:00
patrick96
60eb7b522a Issue template typo 2022-03-07 22:34:16 +01:00
Frank Großgasteiger
638a57379b Redraw tray on wallpaper change, only if transparent (#2604)
The tray manager of polybar listens on multiple atoms for the background of the root window. On change of these atoms, it will redraw its window-background and message its tray-client to redraw also.

On fast changes of of background, this leads to immense messaging and eventual flickering of the systray.

This patch tries to soften the issue in a way, that tray-window and its client will only redraw, if the bar has transparency. If not, there should be no reason to redraw on wallpaper-change.

* Redraw on background change only if transparent

* Replace tab with spaces
2022-03-07 19:16:07 +01:00
indev
5b2de60353 feat(script): add repeat interval for script failure and exec-if 2022-03-07 15:44:55 +01:00
patrick96
50eac859fd Cleanup use of pointers in util code 2022-03-06 18:28:26 +01:00
patrick96
8ddf9d2cdf Stop using unique_ptr for on_exit 2022-03-06 18:28:26 +01:00
patrick96
b66f920308 Cleanup xcb stuff 2022-03-06 18:28:26 +01:00
patrick96
8db3e04727 Update PKGBUILD for 3.6.1 2022-03-05 14:38:09 +01:00
patrick96
1a4ad828c6 Merge branch 'hotfix/3.6.1' 2022-03-05 14:30:38 +01:00
patrick96
4a61d3157f Release 3.6.1 2022-03-05 14:21:35 +01:00
patrick96
b04f636bab doc: Mention XDG_RUNTIME_DIR for IPC 2022-03-05 13:59:27 +01:00
patrick96
f37124f5af renderer: Enforce valid alignment
No renderer_interface function (except change_alignment) should be
called with a NONE alignment in the context.
2022-03-05 13:37:28 +01:00
patrick96
fdaecdb113 tests: Use fake renderer for dispatch test 2022-03-05 13:37:28 +01:00
Nathanaël Houn
8820cc73cd Fix hint message when using deprecated polybar-msg hook 2022-03-05 09:41:00 +01:00
patrick96
c655adea93 fix(script): Prevent stalling during shutdown
If a script module is waiting on a non-tailed script to finish, polybar
cannot shut down until the script has terminted.
To remedy this, we use the same polling loop as for tailed scripts which
checks if it needs to terminate after every iteration.
2022-03-03 23:51:41 +01:00
patrick96
0b24080336 fix: Allow negative values for tray and bar offset 2022-03-03 22:44:35 +01: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
Samuel Henrique
40cbe7ed97 Skip manpage and html doc installation if they weren't generated
Otherwise we get errors like this:

 CMake Error at doc/cmake_install.cmake:46 (file):
  file INSTALL cannot find
  "/<<PKGBUILDDIR>>/build/doc/html": No such file or
  directory.
 Call Stack (most recent call first):
  cmake_install.cmake:59 (include)
2022-03-02 23:46:46 +01:00
patrick96
24e079afef build: Add missing includes
Fixes #2614
Ref: https://gcc.gnu.org/gcc-12/porting_to.html
2022-03-02 15:09:52 +01:00
patrick96
4350e356a7 Documentation update for 3.6 2022-03-02 14:58:49 +01:00
Nicholas-Baron
2322493ac8 Fix a Clang 13 warning
`-Wdeprecated-copy` found this copy-assignment operator, which it
complains about. Since it is just `= default`, we should be able to
remove both it and the default constructor, making the struct just its
data members.
2022-03-02 10:48:14 +01:00
patrick96
219171cf79 Update PKGBUILD for 3.6.0 2022-03-01 20:44:54 +01:00
patrick96
57589ee896 Update PKGBUILD for 3.6.0 2022-03-01 19:47:50 +01:00
patrick96
fce5c4445f Release 3.6.0 2022-02-26 21:42:34 +01:00
patrick96
e30453da99 More precisely specify desired changelog format 2022-02-25 04:38:07 +01:00
patrick96
eb535998da Cleanup Changelog 2022-02-25 04:38:07 +01:00
patrick96
f1490a13ca Use points in default config
Allows people to better scale by setting the dpi
2022-02-25 04:38:07 +01:00
patrick96
34664f62c9 Remove AUR install scripts 2022-02-25 04:38:07 +01:00
Maxim Kolesnikov
f5bfbccfc8 feat(script): add formatting for script failure (#2596)
Closes #2588

* feat(script): add formatting for script failure

* refactor: address review comments

* doc: add changelog entry

* refactor: minor cleanup
2022-02-23 15:01:28 +01:00
patrick96
dc46251571 fix: Handling for actions with negative offsets
If any action block contains a negative offset, it can cause text to be
theoretically be rendered outside of the block, making that text not
clickable.
To fix this, we ensure that an action block starts at the lowest
observed position while the block is open and ends at the highest
observed position while it is open.

Fixes #1814
2022-02-22 18:00:58 +01:00
patrick96
74067c52c3 fix: Set WM_SIZE_HINTS to fix position in openbox
When polybar is remapped (either through IPC or something like xdo
show), openbox positions it somewhere on the screen using the same
positioning algorithm as it would for regular windows.

If the position and size is set in the WM_SIZE_HINTS atom, openbox will
respect the position and size declared by the window.

Fixes #2021
2022-02-21 21:40:33 +01:00
patrick96
59a581a39e Emit error when workspace mapping has invalid format
Closes #2024
2022-02-21 20:04:12 +01:00
patrick96
ae7686d24b fix(battery): Replace tokens for all labels
Otherwise we have to replicate the fallback logic for LOW -> DISCHARGING
in multiple places.

Fixes #2379
2022-02-21 17:54:19 +01:00
Patrick Ziegler
62da14e30d Use @ for doxygen commands (#2597) 2022-02-20 21:40:48 +01:00
Patrick Ziegler
ce93188a4a Add units support (POINT, PIXEL, SPACE) (#2578)
* add units support (POINT, PIXEL, SPACE) for polybar

- add a size_with_unit struct
- add a geometry_format_values struct
- move dpi initialisation from renderer.cpp to bar.cpp
- add a string to size_with_unit converter
- add point support (with pt)
- add pixel support (with px)

* Fix unit test compilation

* clang-format

* Better names

The old names didn't really capture the purpose of the structs and
function.

space_type -> spacing_type
space_size -> spacing_val

size_type -> extent_type
geometry -> extent_val

geometry_format_values -> percentage_with_offset

* Remove parse_size_with_unit

No longer needed. The convert<spacing_val> function in config.cpp
already does all the work for us and always setting the type to pixel
was wrong.

In addition, line-size should not be of type spacing_val but extent_val.

* Cleanup

I tried to address most of my comments on the old PR

* Fix renderer width calculation

We can't just blindly add the x difference to the width because for
example the width should increase if x < width and the increase keeps
x < width.

Similarly, we can't just add the offset to the width.

* Rename geom_format_to_pixels to percentage_with_offset_to_pixel

* Cleanup

* Apply suggested changes from Patrick on GitHub

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update src/components/bar.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update src/components/config.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update src/components/builder.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update src/components/builder.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* config: Use stod for parsing percentage

* Use stof instead of strtof

* units: Fix test edge cases

* Remove unnecessary clang-format toggle

* Use percentage_with_offset for margin-{top,bottom}

* Support negative extent values

* Rename unit to units and create a cpp file

* Move percentage_with_offset_to_pixel unit test to units

* Add unit tests for units_utils

* Clarify when and how negative spacing/extent is allowed

Negative spacing is never allowed and produces a config error.

Extents allow negative values in theory, but only a few use-cases accept
it.
Only the extent value used for the `%{O}` tag and the offset value in
percentage_with_offset can be negative. Everything else is capped below
at 0.

The final pixel value of percentage_with_offset also caps below at 0.

* Fix parsing errors not being caught in config

* Print a proper error message for uncaught exceptions

* Cleanup module::get_output

All changes preserve the existing semantics

* Stop using remove_trailing_space in module::get_output

Instead, we first check if the current tag is built, and only if it is,
the spacing is prepended.

* Remove unused imports

* Restore old behavior

If there are two tags and the second one isn't built (module::build
returns false), the space in between them is removed.
For example in the mpd module:

format-online = <toggle> <label-song> foo

If mpd is not running, the mpd module will return false when trying to
build the `<label-song>` tag. If we don't remove the space between
`<toggle>` and `<label-song>`, we end up with two spaces between
`<toggle>` and `foo`.

This change is to match the old behavior where at least one trailing
space character was removed from the builder.

* Add changelog entry

* Remove unused setting

* Use percentage with offset for tray-offset

Co-authored-by: Jérôme BOULMIER <jerome.boulmier@outlook.fr>
Co-authored-by: Joe Groocock <github@frebib.net>
2022-02-20 21:08:57 +01:00
Prateek Sunal
ab915fb724 feat(net): %netspeed% token to show combined up+download speed (#2590)
Closes #1083 

* Add netspeed parameter (#1083)

* Update net.cpp

* Update net.hpp

* Update network.cpp

* Update CHANGELOG.md
2022-02-06 21:12:38 +01:00
Michał Górny
a33e8de922 doc: Defer parsing version_txt to fix an obscure bug
Defer parsing the version read from version.txt until it's about
to be used, in order to fix an obscure bug involving indirect
pkg_resources.

When pkg_resources are imported, they override packaging with their own
pkg_resources.extern.packaging.  Depending on the system, this could
either wrap the vendored pkg_resources._vendor.packaging or system
packaging.  For some reason, in the latter case the Version objects
created prior to the wrapping are incompatible with the objects created
afterwards.  This causes the doc build to fail with:

```
Exception occurred:
  File "/tmp/polybar/build/doc/conf.py", line 249, in run
    if directive_version > version_txt:
TypeError: '>' not supported between instances of 'Version' and 'Version'
```

This happens because apparently pkg_resources are imported indirectly
somewhere between conf.py processing and running VersionDirective.
Deferring version parsing until the latter guarantees that both objects
are constructed at the same point in program flow and therefore use
the same packaging package.
2022-01-31 01:20:18 +01:00
patrick96
69a2bf211a polybar-msg: Better error messages
If a single connection fails, other connections are kept intact.
2022-01-29 17:57:41 +01:00
patrick96
a8035a7f68 Add extra space to polybar-msg error message 2022-01-29 17:57:41 +01:00
patrick96
28af6bb493 Fix race condition when creating socket folder
If two processes call `mkdir` at the same time, the second one will fail
and wrongly assume the folder wasn't created properly.

We now first check if the folder really doesn't exist and we also catch
any IPC initialization errors and disable IPC instead of crashing the
whole bar.
2022-01-25 00:24:22 +01:00
patrick96
f428b7bb2f Install manpage for polybar-msg 2022-01-24 13:47:49 +01:00
Jouni
52992c588a Replace math_util min and max with std::min and std::max (#2579) 2022-01-23 21:14:55 +01:00
Patrick Ziegler
c2f087225c Eventloop cleanup (#2577)
* eventloop: Use eventloop namespace in cpp files

* changelog: Add missing deprecated hook message

* Make eventloop and ipc classes non-copyable and non-movable

* Remove functional.hpp

* eventloop: Don't close handles in error cases

Client should be responsible for closing handles.

* eventloop: Address invalidation of handle references
2022-01-22 22:00:26 +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
H. James Zhao
8a9cad2792 net: prefer running interface for auto-detection (#2557)
Improve the find_interface() to return a interface name
that is currently running if any interface of given type
is currently running, else just return the first one found.

This will allow the interface-type to work with multiple net interface
of the same type, and prefer to one that is currently connect to
a network. This works great HW with multiple ethernet port and user
expect to occasonally swap between the two.
2022-01-18 19:53:19 +01:00
Stefano Volpe
d995a39da8 feat(alsa): add middle and right mouse button events (#2573)
* Add events to alsa module

* Update CHANGELOG

* Update CHANGELOG.md

Closes #2566 

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2022-01-18 19:51:49 +01:00
Qntn
968d9c753f fix(battery): More accurate battery state (#2556)
Fixes #2563 
Closes #2363

* Get battery status before adapter. (#2363)

* changelog: Move to Fixed section

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2022-01-17 23:07:07 +01:00
Patrick Ziegler
e549527d3e Clean up changelog (#2571) 2022-01-16 05:12:45 +01:00
Cameron
195a0d94df feat(network): Add mac address token (#2569)
* Add mac address option

* Add error handling

* Address changes

* Move outside of for loop

* Update changelog
2022-01-16 02:39:55 +01:00
llenck
6e34265d7b Replace system_clock with steady_clock (#2559)
This fixes #857 and #1932. Also replaces PR #1725, since we don't need
our own implementation of condition_variable anymore since people who
update their polybar should have GCC 10 by now.

The m_updated_at field of the mpd module was removed instead of having
its clock change because it became unused in commit 645a3142a1.
2022-01-12 23:06:29 +01:00
Jeremy Fleischman
f488a889bc Add support for a tray-foreground setting. (#2552)
This adds a new `tray-foreground` config option, and uses it instead of
the `tray-background` setting to build up the `_NET_SYSTEM_TRAY_COLORS`
property. I'm pretty sure that the previous behavior was a mistake (this
was introduced in 94298741b6 which is a
pretty large diff).  For me and some other people, this results in a
black icon being drawn on top of a black background, which is pretty
useless! I would say that this diff fixes
https://github.com/polybar/polybar/issues/2235. Note: the old code dealt
with `unsigned int` and maxed values out at 0xff. The new code deals
with `uint16_t` and maxes values out at 0xffff. I haven't found the
relevant documentation to justify this change, but from manually
testing, I'm pretty confident this is the right change.

This all matches pretty closely with this code from i3:
[`i3bar/src/xcb.c::init_tray_colors`
code](43e805a00d/i3bar/src/xcb.c (L1490-L1522)),
which you can see also uses the bar's foreground color and maxes values
out at 0xffff, not 0xff.

If you merge this up, I think we should also update
https://github.com/polybar/polybar/wiki/Configuration#bar-settings to
mention the new settings.

Fixes #2235
2021-11-17 11:41:40 +01:00
Jeremy Fleischman
a3b5e3e7ed Make it possible to run tests. (#2553)
I followed the instructions on
https://github.com/polybar/polybar/wiki/Testing, and this happened to
me:

    $ cmake .. -DBUILD_TESTS=ON
    ...
    [ 11%] Creating directories for 'googletest'
    [ 22%] Performing download step (git clone) for 'googletest'
    Cloning into 'googletest-src'...
    fatal: invalid reference: master
    CMake Error at googletest-download/googletest-prefix/tmp/googletest-gitclone.cmake:40 (message):
      Failed to checkout tag: 'master'

    make[2]: *** [CMakeFiles/googletest.dir/build.make:99: googletest-prefix/src/googletest-stamp/googletest-download] Error 1
    make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/googletest.dir/all] Error 2
    make: *** [Makefile:91: all] Error 2
    CMake Error at tests/CMakeLists.txt:19 (message):
      Build step for googletest failed: 2

It looks like the problem is that
[googletest](https://github.com/google/googletest/) changed their branch from
`master` to `main` at some point.

I also fixed a broken link
https://github.com/polybar/polybar/wiki/Testing. Hopefully it's
intentional that random members of the public such as myself are allowed
to do that?
2021-11-17 11:14:18 +01:00
Jean-Luc Bastarache
542f70efa3 fix(ipc): don't format empty strings (#2549)
* fix(ipc): don't format empty strings

* Add a description of the change to `CHANGELOG.md`

* Rephrasing
2021-11-04 16:55:16 +01:00
Patrick Ziegler
9b5611af3f Fix message for deprecated config name (#2548) 2021-10-31 11:53:23 +01:00
Patrick Ziegler
3c5b2b61a6 ipc: Move running initial hook to update function (#2547) 2021-10-30 21:00:52 +02:00
Patrick Ziegler
9e3b537817 feat: Support reading config from non-regular files (#2545)
We had a check that restricted config files to "regular files".
This check was to restrictive as it didn't allow for things like:

```
polybar -c <(gen_config)
gen_config | polybar -c /dev/stdin
```

Now, polybar can easily read config data from stdin.
2021-10-24 11:25:05 +02:00
TheDoctor314
6d1ff41d37 Handle relative includes (#2535)
* Handle relative includes

We change to the directory of the given config file before parsing.
This allows us to handle relative includes.
TODO: Maybe improve the name of the change_dir() function.

* Fix unused result warning

* Add `relative_to` parameter to expand()

If the path is relative, we resolve it by prepending
dirname(config) to the path.

Add dirname() - Returns the parent directory of the file or an empty
string.

* Resolve relative paths

Handle paths relative to the current file being parsed.

* Remove unneeded change_dir()

* Fix expand()

`is_absolute` is calculated after we expand the path.
`relative_to` must be a directory.

Add test for expand() with relative paths

* Recalculate `is_absolute` after expanding `path`

* Add more file_util::expand tests

* Add changelog

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2021-10-20 12:31:15 +02:00
Patrick Ziegler
b5fb44220d ci: Use new codecov uploader (#2541)
* ci: Use new codecov uploader

The bash uploader is deprecated

Ref: https://about.codecov.io/blog/codecov-uploader-deprecation-plan/

* Collect coverage report using lcov

* Remove branch coverage

There are a lot of hidden branches in the C++ code which doesn't make it
very useful
2021-10-16 19:58:34 +02:00
Patrick Ziegler
4d90ac2f4c fix(net): Use canonical interface name (#2540)
One can define an 'altname' for an interface. That name is valid of
if_nametoindex but it doesn't appear in `/sys/class/net`:

```
sudo ip link property add dev enp0s31f6 altname eno
```

This creates an altname eno for the existing interface enp0s31f6

Before, using eno, would lead to an error in `realpath`.

Ref: https://www.reddit.com/r/Polybar/comments/q8f0ye/error_disabling_module_network_reason_realpath/hgqpq1m/?context=3
2021-10-15 17:36:32 +02:00
Patrick Ziegler
abd96eb089 Enable module in start funcion (#2538)
Before it was enabled by default. That means if the constructor fails,
the destructor will complain that the module was not stopped before
deconstructing.

We can't just call stop if module creation fails because the module is
only partially initialized.
2021-10-15 10:33:10 +02:00
Patrick Ziegler
76ae61f892 xkb: Use xpp for xcb calls (#2536) 2021-10-14 15:57:46 +02:00
Patrick Ziegler
b1c97e42cc Include fd_stream in command.hpp (#2533)
On older gcc versions, the incomplete type can lead to a compilation
error because unique_ptr requires the complete type for its destructor.
2021-10-12 19:33:15 +02:00
Tim Schumacher
281fdf6382 The xworkspaces module should wait for EWMH to become available (#2429)
* The xworkspaces module should wait for EWMH to become available

Before this change if EWMH wasn't available the xworkspaces module was
permanently disabled. When polybar was started alongside the window
manager e.g. from .xinitrc this caused a race condition between polybar
and the window manager and the xworkspaces module may or may not be
displayed. After this change polybar will wait for EWMH to become
available. This change closes #1915, see that issue for more details.

Curiously this only required the removal of the error condition which
used the be raised when EWMH wasn't available. The xworkspaces module
will show up on the bar as soon as the first EWMH event is processed by
the existing event handling code. I can't argue much about the
correctness of this patch but it seems to work flawlessly in my testing
with xmonad. I didn't test any other window managers. Note that removing
the error condition below which checks that _NET_DESKTOP_VIEWPORT is
available might make this work with pin-workspaces=true. I couldn't test
the effects of that change because I only tested with xmonad and xmonad
doesn't support _NET_DESKTOP_VIEWPORT, so I didn't make that change.

* xworkspaces: Remove check fo _NET_DESKTOP_VIEWPORT

Implementations that don't support it will just return an empty list for
get_desktop_viewports and pin-workspaces won't do anything.

* Update changelog

Fixes #1915

Co-authored-by: Tim Schumacher <tim@timakro.de>
Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2021-10-11 14:40:14 +02:00
dvermd
231af35354 feat(ipc): hook, prev, next, reset module actions (#2528)
* WIP ipc actions

* feat(ipc): Add hook, prev, next and reset actions

Closes: #2464

* ipc: format code

* ipc: fix comparison

* Apply suggestions from code review

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* ipc: make index 0-based

* ipc: add 0-based indexing breaking change to Changelog

* ipc: restore 1-based index for  and  message

* ipc: fix initial=0 throwing an error

Co-authored-by: Martin Terneborg <martinterneborg@protonmail.com>
Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-10-10 20:22:24 +02:00
Patrick Ziegler
22014c70c4 Use the new GitHub issue forms (#2530)
* Use the new GitHub issue forms

This now automatically adds labels and marks certain information as
mandatory. It also automatically formats some fields (e.g. polybar
config).

Ref: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/syntax-for-issue-forms

* Update bug_report issue link

* Fix bug_report description
2021-10-10 14:00:18 +02:00
dvermd
47b5910eda Allow running polybar without BAR argument (#2526)
* Allow running polybar without BAR argument

The configuration file must declare a single bar to be able to not name
it.

* Check barname not in config and improve error message

* Revert README changes

* Add no bar in config file error detection
2021-10-07 14:48:47 +02: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
dvermd
98dffc292a feat(xkeyboard): Icon matching using variant (#2521)
* feat(string_util): add contains_nocase

* feat(xkeyboard): Enable icon by variant

* Cleanup

* string_util: add some cases to string test

* string_util: rename contains_nocase -> contains_ignore_case

* layouticonset: use contains_ignore_case

* layouticonset: apply renamings and remove dead code

* remove VARIANT_NONE and use empty string instead

* use emplace_back and add assert

* layouticonset: precompute condition

* xkeyboard: restore missing continue

* Cleanup parse_icons

* Always choose the first case-insensitive match

* Cleanup layouticonset.get

* update the changelog

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2021-10-05 12:12:47 +02:00
dvermd
a2968127d1 fix typos (#2524) 2021-10-04 23:46:38 +02:00
Georgiy Komarov
40ae9b210b config_parser: Improve error messages (#2522)
* config_parser: Improve error messages

This commit adds an additional context with configuration file name and
line number to some error messages in the config_parser.

* config_parser: Add file name and line number to invalid_name_error

* config_parser: Update unit tests to avoid crashes on regressions
2021-10-03 20:46:16 +02:00
Jérôme BOULMIER
2b1eb5337c fix(modules): move join in a new method 2021-10-03 12:00:41 +02:00
Madhav Prabhu C M
e5ab7e1c00 Notification string to a queue of strings (#2517)
Fixes #2469

* made inputdata to queue<string>

* changed back to front

* fixed move semantics issue while popping queue

* Removed ide file

* commented test lines

* review changes

* review changes

* Update CHANGELOG.md

* Cleanup

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2021-10-03 11:24:24 +02:00
patrick96
1a59599388 fix(modules): Avoid downcast in module constructor
The previous CAST_MOD(Impl) for the action_router constructor was
illegal because `this` is not yet of type Impl (because the subclass
constructor has not run yet).

The action_router now accepts std::function for its callbacks.

Fixes #2519
2021-10-03 03:18:39 +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
patrick96
4f8f076714 Remove atomic members from static modules 2021-09-30 15:38:18 +02:00
patrick96
6b6bcf5080 Stop ipc_module subclassing static_module 2021-09-30 15:38:18 +02:00
patrick96
f55f584ef7 Remove main thread from static_module
This removes the need for any kind of synchronization because static
modules are completely running in the controller thread.
2021-09-30 15:38:18 +02:00
patrick96
626c55f8e5 Template value type for get_with_prefix 2021-09-28 22:16:07 +02:00
TheDoctor314
c7ffa60866 Update CHANGLELOG.md 2021-09-28 22:16:07 +02:00
TheDoctor314
e798ed57a2 Implement 'env-*' option in script_module
This stores the key-value pairs specified for the script module.
The command to be executed must pass on this argument.
2021-09-28 22:16:07 +02:00
TheDoctor314
37cd63a356 Add env parameter in command::exec() 2021-09-28 22:16:07 +02:00
TheDoctor314
a7b978412c Add env parameter to exec_sh()
Before passing the cmd to exec() we set the required environment
variables.

Also add the test for it.
2021-09-28 22:16:07 +02:00
TheDoctor314
1e0e50266b Add get_with_prefix()
Returns a list of key-value pairs starting with a prefix.
If you have in config:
```
env-FOO = bar
env-CAT = dog
```

then `get_with_prefix("env-")` will return
`[{"FOO", "bar"}, {"CAT", "dog"}]`
2021-09-28 22:16:07 +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
TheDoctor314
55eb19fdc7 feat(ramp): Allow specifying ramp weights (#2505)
* feat(ramp) Implement ramp weights

*Add test for ramp weights

*[drawtypes/ramp] Implement ramp weights

Simply clone `label_t` weight no. of times in the icon list
This helps us not to change any of the calculations.

*Fix silly bug

Forgot to add a hyphen for the `weight` parameter.

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

*doc: add #1750 to CHANGELOG

* Fix compile error in ramp test

Use std::make_shared.
2021-09-22 21:46:20 +02:00
patrick96
98d9a882ea Fix polybar-msg compilation 2021-09-21 21:43:27 +02:00
patrick96
fa1240f4b6 Remove unused file_ptr 2021-09-21 21:43:27 +02:00
patrick96
3b6a950380 Remove unused factory.hpp imports 2021-09-21 21:43:27 +02:00
patrick96
fabce6a493 Add tests for env_util 2021-09-21 21:43:27 +02:00
patrick96
0d1db206c6 Remove factory_util unique and shared
Equivalent to std::make_unique and std::make_shared
2021-09-21 21:43:27 +02:00
patrick96
560065540b Fix wrong assertion on network interface 2021-09-21 21:43:27 +02:00
patrick96
98919cbb77 Remove unused moodycamel concurrentqueue 2021-09-21 21:43:27 +02:00
patrick96
c922a94b67 Remove unused spin_lock 2021-09-21 21:43:27 +02:00
patrick96
0f72a2e0ea Remove unused throttle_util 2021-09-21 21:43:27 +02:00
patrick96
069036fa5a Add libuv to polybar-git PKGBUILD 2021-09-21 20:36:23 +02:00
patrick96
c29e4837df clang-format 2021-09-21 20:36:23 +02:00
patrick96
21f6f7818a Update CHANGELOG.md 2021-09-21 20:36:23 +02:00
patrick96
85d308cec8 Use libuv >= 1.3.0 2021-09-21 20:36:23 +02:00
patrick96
386eb57ba7 Reopen pipe path on EOF 2021-09-21 20:36:23 +02:00
patrick96
77b9cffaf8 Cleanup 2021-09-21 20:36:23 +02:00
patrick96
a158f0d7ec Add error callback for ipc handle 2021-09-21 20:36:23 +02:00
patrick96
52a3961602 Poll for X events in while loop
Otherwise we would only read a single event, even if multiple were
available causing delays.
2021-09-21 20:36:23 +02:00
patrick96
895c1a6b51 Handle fs_event and poll errors in handle wrapper 2021-09-21 20:36:23 +02:00
patrick96
db52106934 Support receiving IPC messages in multiple parts 2021-09-21 20:36:23 +02:00
patrick96
dd4088910e Deprecate throttle-output and throttle-output-for
The eventloop no longer uses them. libuv will coalesces multiple
uv_async_send if they happen one after another and this also leads to
coalescing of updates.
2021-09-21 20:36:23 +02:00
patrick96
511e73b3b5 Close handles in destructor 2021-09-21 20:36:23 +02:00
patrick96
91759a4c96 Store all handles inside eventloop
This is needed because the handle's lifetime has to be at least the
lifetime of the eventloop since the eventloop requires the handle's
memory during shutdown (for closing the handles).
2021-09-21 20:36:23 +02:00
patrick96
2551ea0205 Add wrapper for uv_async_t 2021-09-21 20:36:23 +02:00
patrick96
7b5285b51e Add wrapper for uv_timer_t 2021-09-21 20:36:23 +02:00
patrick96
309fd8221a Create wrapper for uv_pipe_t 2021-09-21 20:36:23 +02:00
patrick96
86f02a3ebe controller: Fix missing import 2021-09-21 20:36:23 +02:00
patrick96
6d3bb2211e Only trigger async once eventloop has been setup 2021-09-21 20:36:23 +02:00
patrick96
2c7af2a60c Store reload flag in controller 2021-09-21 20:36:23 +02:00
patrick96
ce63305c1d Better way to notify controller 2021-09-21 20:36:23 +02:00
patrick96
e3cb94ef88 Use uv timer for delayed screenshot 2021-09-21 20:36:23 +02:00
patrick96
6ac5b7ebdd Remove config inotify_watch
We use libuv now for watching the file
2021-09-21 20:36:23 +02:00
patrick96
ba50bf0bc6 controller: Remove m_process_events field 2021-09-21 20:36:23 +02:00
patrick96
75ff5c3b14 Remove exit_terminate signal 2021-09-21 20:36:23 +02:00
patrick96
07da1a2967 Stop using sigabbrev_np
GNU extension
2021-09-21 20:36:23 +02:00
patrick96
b9642e4cf3 Move update events to eventloop
We can now completely remove the eventqueue thread
2021-09-21 20:36:23 +02:00
patrick96
f36224eaab Move quit event to eventloop 2021-09-21 20:36:23 +02:00
patrick96
ba341f584e Remove CHECK event
Not used
2021-09-21 20:36:23 +02:00
patrick96
c89fc7f73b Handle click commands in eventloop 2021-09-21 20:36:23 +02:00
patrick96
88cd525dc8 Add wrapper for uv_pipe_t 2021-09-21 20:36:23 +02:00
patrick96
9d9fe8bffb Better error handling 2021-09-21 20:36:23 +02:00
patrick96
53ce1ae414 Move config watcher into eventloop 2021-09-21 20:36:23 +02:00
patrick96
f9d434052a Make UV handle wrappers more generic 2021-09-21 20:36:23 +02:00
patrick96
60ee63c0db eventloop: Throw exception for libuv errors 2021-09-21 20:36:23 +02:00
patrick96
3cc17a0e57 Move signal handling to eventloop class 2021-09-21 20:36:23 +02:00
patrick96
a2f50f3b90 Use uv_pipe_t for ipc 2021-09-21 20:36:23 +02:00
patrick96
74d8cf281c cmake: Fix FindLibUV 2021-09-21 20:36:23 +02:00
patrick96
ba118477e0 ci: Add libuv dependency 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
0bf45f3bd6 Update PKGBUILD for 3.5.7 2021-09-21 18:37:22 +02:00
patrick96
2512123a6c Merge remote-tracking branch 'origin/hotfix/3.5.7' 2021-09-21 18:22:57 +02:00
patrick96
92722e05c2 Release 3.5.7 2021-09-21 18:12:57 +02:00
patrick96
a8cba9c43c fix(ipc): Replace all %pid% tokens
Fixes #2500
2021-09-13 14:18:18 +02:00
patrick96
6136c08d42 tray: Properly handle missing _XEMBED_INFO
The icon not supporting XEMBED is not fatal, we just treat is as always
mapped.

Fixes #2479
Fixes #2442
2021-09-13 00:12:33 +02:00
Samuel Henrique
6816891cf1 Update Debian installation instructions (#2499) 2021-09-12 01:13:51 +02:00
Patrick Ziegler
5011e66346 fix(net): Check if interface is valid first. (#2497)
Fixes #2496
2021-09-09 21:47:23 +02:00
Patrick Ziegler
9f828800fb fix(xworkspaces): Fix scrolling (#2492)
The scroll handler had two issues:

* It did not respect the order the desktops where displayed in
* It would not wrap around on the first desktop because of an integer
  underflow

Fixes #2491
2021-09-04 14:36:01 +02:00
Luca Maltagliati
ddabe3f0f4 feat(memory): Tokens that switch between MiB and GiB (#2488)
* feat:add tokens to display memory in MiB when GiB val <= 1.0 (#2472)

* fix: correct swap_used calculation

* fix: pass variable by reference rather than by value

* fix: add precision arguments to filesize_gib_mib(); better condition

* doc: add #2472 to CHANGELOG

* fix: missing default argument values

* Apply suggestions from code review

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-09-04 13:14:13 +02:00
Patrick Ziegler
a520fead94 doc: Update description of polybar -m/-M (#2487)
It should be clear that `polybar -M` represents all valid monitor names.
2021-09-02 18:18:52 +02:00
Vincent Bernat
151a263654 fix(monitor): do not include outputs when monitors are supported (#2485)
* fix(monitor): do not include outputs when monitors are supported

Previously, when splitting an output into two monitors, `polybar -m`
would report both the splitted monitors and the output. This was not
caught by the the clone detection as the detection works by removing
monitors contained into another monitors (and monitors were excluded
from that logic) and we want the other way around: outputs covered by
monitors should be ignored.

Instead of trying to detect covered outputs, the solution is quite
simple: when monitors are supported, do not consider outputs, unless
we request all outputs. A monitor can be set primary (and RandR
reports primary outputs as primary monitors). The only information we
would miss from monitors are things like refresh rate and EDID. We
don't need that, so we are fine.

As monitors are only created for connected output (and they are in
this case "active") or disconnected output if they are mapped (and
they are in this case "inactive"), I am a bit unsure if we have
exactly the same behaviour as previously when `connected_only` is set
to `false`.

As some modules require an output, we keep the output in the
`monitor_t` structure and we ensure it is correctly set when using
monitors. A monitor can have 0 or several outputs. We only handle the
0 and 1 cases. When a monitor has more outputs, only the first one is
used. AFAIK, only the xbacklight module needs that and I think we are
fine waiting for a user needing this module and merging monitors.

The C++ binding fail to expose the `outputs()` method to iterate over
the outputs of a monitor. This seems to be a bug in XPP. The field is
correctly defined in the RandR XML file and it works with the Python
binding.

```xml
	<struct name="MonitorInfo">
		<field type="ATOM" name="name" />
		<field type="BOOL" name="primary" />
		<field type="BOOL" name="automatic" />
		<field type="CARD16" name="nOutput" />
		<field type="INT16" name="x" />
		<field type="INT16" name="y" />
		<field type="CARD16" name="width" /> <!-- pixels -->
		<field type="CARD16" name="height" /> <!-- pixels -->
		<field type="CARD32" name="width_in_millimeters" />
		<field type="CARD32" name="height_in_millimeters" />
		<list type="OUTPUT" name="outputs">
		    <fieldref>nOutput</fieldref>
		</list>
	</struct>
```

Falling back to C only to access the list of outputs is not enough
because the list is appended to the structure and not visible through
the public API. When copied, the structure loses the list of monitors.

Also, change the mention "XRandR monitor" to "no output" when there is
no output attached. People using monitors know what it means and it is
useful to catch a future regression where we don't have an output at
all (which would break the brightness plugin).

Fix #2481

* Update CHANGELOG.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-09-02 18:07:21 +02:00
Vincent Bernat
5f3462240c feat(ipc): allow receiving arbitrary text on IPC socket (#2463)
This adds the 'send' action to the ipc module that can be used to send arbitrary text to the module:

    polybar-msg action "#ipc.send.%{F#4444ff}hello%{F-}"

* feat(ipc): allow receiving arbitrary text on IPC socket

Instead of just allowing hook numbers to be executed, the user can
send arbitrary text and the IPC module will put it in the bar. The IPC
payload format is extended to accept an arbitrary string if the first
character after the module name is ':'.

    polybar-msg hook test :'%{F#4444ff}hello%{F-}'

Fix #2455

* Use actions for sending data to ipc module

* ipc: Don't use exceptions when no hooks are defined

* Update src/modules/ipc.cpp

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2021-07-11 20:42:28 +02:00
patrick96
523e4d6313 fix(fs): Only add spacing between shown mountpoints
Fixes #2458
2021-07-11 14:51:15 +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
55509efa1d doc: Add version to module visibility actions 2021-07-10 21:22:17 +02:00
Nolan Prochnau
06932007a0 Universal Visibility Action (#2320 cont'd) (#2426)
* Add toggle_visible action

* Add set_visible and set_invisible actions

* Rename toggle_visible method to match

`action_toggle_visible` -> `action_toggle_visibility`

Matches with `EVENT_TOGGLE_VISIBILITY`

* Update CHANGELOG

* Revert #2320 IPC commands

IPC commands are no longer necessary now that the actions are
implemented. Changed some method permissions as well to reflect this.

* Add logging and change action names

- `module_toggle`
- `module_show`
- `module_hide`

Delineate common actions to all modules with a `module_` prefix (for
future actions too)

* Update documentation
2021-07-07 21:43:49 +02:00
Patrick Ziegler
dcd33057fd Use master branch for googletest (#2451)
gtest recommends using the `master` branch as it follows the "Live at
Head" philosophy.

[1]: https://github.com/google/googletest#live-at-head
2021-06-16 17:46:53 +02:00
Patrick Ziegler
3247a57a63 Change over all IRC mentions to libera (#2450) 2021-06-16 17:02:58 +02:00
Carlos Gonzalez
bfa9b5d53e Adding case to ignore T@ in bspwm (#2439)
* Adding case to ignore T@ in bspwm

* Adding entry to changelog for issue #2371
2021-05-27 20:05:37 +02:00
patrick96
e66a678c12 Update PKGBUILD for 3.5.6
We can now remove the temporary fix for the i3 crash
2021-05-24 01:23:57 +02:00
patrick96
c65f6857e1 Merge branch 'hotfix/3.5.6' 2021-05-24 01:07:24 +02:00
patrick96
eb9c192d04 Release 3.5.6 2021-05-24 01:00:50 +02:00
patrick96
d8f4d56a95 Fix i3 module assertion failure
This brings #2417 into the hotfix release

Ref #2417
2021-05-24 00:57:57 +02:00
patrick96
cbe4521737 tray: Do not swallow clear_window exceptions 2021-05-24 00:47:22 +02:00
patrick96
ad987098ff fix(tray): Support clients with different depths
XCB_BACK_PIXMAP_PARENT_RELATIVE requires that the client has the same
depth as the tray window.

There was an issue with dropbox having a depth of 32 and the tray window
having a depth of 24 that caused the configuration of the icon to fail.
It would then be displayed outside of the bar because the catch block
was not hit (different exception).

We now just don't configure XCB_CW_BACK_PIXMAP. This seems to work and
is also what stalonetray does.

This does not fix the issue with dropbox having an arbitrary background.

Fixes #1679
Fixes #2430
2021-05-24 00:47:22 +02:00
Flexlolo
735a08ba7c feat(bspwm): Option to scroll through occupied desktops only (#2428)
* Implement option occupied-scroll to bspwm module

* update changelog

* change default value of the setting
2021-05-13 12:59:13 +02: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
10bbec4451 Fix abort in i3 module with new ArchLinux flags
Fixes #2416
Ref: https://github.com/polybar/i3ipcpp/pull/11
2021-04-25 13:37:00 +02:00
Tim Schumacher
2901e1e476 Add wm-restack=generic option that lowers polybar to the bottom of the stack (#2404)
* Add wm-restack=generic to lower polybar to the bottom of the stack

Previously wm-restack only supported bspwm and i3. Both have a special
top-level window that polybar detects and places itself directly above.
This patch adds wm-restack=generic which simply lowers polybar to the
very bottom of the stack. This option was tested and confirmed to work
with xmonad which doesn't have a special top-level window and therefore
doesn't require special handling like bspwm and i3.

Fixes #2205

* Update src/components/bar.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-04-02 00:48:48 +02:00
Ian Welker
97759ce585 Fixed issues with border corner radii 2021-03-29 20:17:48 +02:00
patrick96
d3797acedd Update README to trigger GitHub TOC 2021-03-26 15:20:19 +01:00
patrick96
93ab639c8a fix: unbounded_percentage always rounded down
For example if lower / upper = 0.019 (1.9%), it would return 1% instead
of 2%

Fixes #2399
2021-03-03 22:48:17 +01:00
patrick96
2fd6d20999 fix(xworkspaces): Segfault for wrong _NET_CURRENT_DESKTOP
While it shouldn't happen with compliant WMs, it was possibe to crash
polybar with _NET_CURRENT_DESKTOP >= _NET_NUMBER_OF_DESKTOPS and this
should not be possible.

Includes polybar/xpp#31
Fixes #2398
2021-03-03 22:34:38 +01:00
patrick96
c197cff511 PKGBUILD: Add python-packaging as build dependency 2021-03-02 00:34:28 +01:00
patrick96
ac01d8b5c0 Update PKGBUILD for 3.5.5 2021-03-01 21:54:27 +01:00
patrick96
8ca154caaa Merge branch 'hotfix/3.5.5' 2021-03-01 21:39:16 +01:00
patrick96
1d033edaae Release 3.5.5 2021-03-01 21:33:03 +01: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
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
3f03b671bb fix(color): Rename type() function to get_type
In gcc5, this caused compilation errors because the type enum has the
same name.
2021-03-01 00:05:44 +01:00
patrick96
cf2653c8bd cmake: Do not use TARGET_EXISTS generator exprs
The TARGET_EXISTS generator expression was introduced only in cmake 3.12
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
Simon
cd71b96cf8 feat: Rounded bar border (#2359)
* Added rounded border

* Added feature to the changelog

* Changed implementation for better customisation

* Bugfixes

* Removed commented code

* Removed unused method

* Removed duplicate lines

* Moved degree to be a private constant

Co-authored-by: Simon <simondergruber@gmail.com>
2021-02-16 23:17:16 +01:00
the
698b96d17b feat(backlight): add use-actual-brightness option (#2380)
* add use-actual-brightness option

* added to changelog

* added to changelog 2

* added to changelog 3
2021-02-16 10:02:33 +01:00
Patrick Ziegler
4f16a4fb6d alsa: Call action_epilogue (#2381) 2021-02-15 23:49:21 +01:00
Jérôme BOULMIER
529843b6ba Remove undefined behaviors and clean code (#1769)
* fix: avoid memory leaks in case of exceptions.

* fix(fs): remove undefined behavior when removing mounts in m_mounts

* cleanup: remove double checks

* fix: remove memory leaks

* cleanup(xresources): capture exception by reference

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-02-15 23:32:56 +01:00
zappolowski
99900323b7 feat(conf): Option to always show urgent workspaces in i3 (#2378)
When `pin-workspaces` is set to true using `show-urgent` will show
urgent workspaces on the bar even when the workspace is not associated
with the current monitor.
2021-02-15 21:31:34 +01:00
patrick96
50f127f1bc Cleanup 2021-02-12 20:01:22 +01:00
patrick96
5caae186e0 Add more dispatch tests 2021-02-12 20:01:22 +01:00
patrick96
2017ba38f3 Add tests for dispatch 2021-02-12 20:01:22 +01:00
patrick96
cfc6f3b45f Finish action_context tests 2021-02-12 20:01:22 +01:00
patrick96
c4fbf0023e Move action_context into separate file 2021-02-12 20:01:22 +01:00
patrick96
7a9f301830 Throw exception for unclosed action tags 2021-02-12 20:01:22 +01:00
patrick96
cd1d4fa183 Stop tracking action blocks in renderer
Dispatch can now directly get the current position from the renderer and
create action blocks with the proper coordinates.
2021-02-12 20:01:22 +01:00
patrick96
b5bdbdf6cb Add action_context tests 2021-02-12 20:01:22 +01:00
patrick96
d89096c191 Remove tag headers from signal.hpp 2021-02-12 20:01:22 +01:00
patrick96
7a569c4b98 Remove mousebtn argument from action_open 2021-02-12 20:01:22 +01:00
patrick96
8fcd514168 dispatch: Add simple test 2021-02-12 20:01:22 +01:00
patrick96
464bedb33c Store all action info in action_context
The renderer is responsible for setting the start and end positions
while dispatch does the rest
2021-02-12 20:01:22 +01:00
patrick96
f359540b5d renderer: Move change_alignment into interface 2021-02-12 20:01:22 +01:00
patrick96
f0ee5ab8cd renderer: fix highlight_clickable_areas 2021-02-12 20:01:22 +01:00
patrick96
96239597ed Move most action state out of renderer
The renderer now only stores the positions of the actions because that
is specific to the renderer and because the actual position can only be
finalized after all the rendering is done because intitially the
positions are relative to the alignment and not the bar.
2021-02-12 20:01:22 +01:00
patrick96
0a474bb2f2 Move trivial formatting state into tags::context
The variables storing the current colors, attribute activations and font
were only used in a single place and can easily also be read from the
context.

This allows us to remove a lot of the state of the renderer.
2021-02-12 20:01:22 +01:00
patrick96
5d518e171e renderer: Use interface to render offset 2021-02-12 20:01:22 +01:00
tchici
c676d7e6f5 add reverse-scroll option for xworkspaces module (#2365)
* add reverse-scroll option for xworkspaces module

* move use of reverse-scroll option to when producing scroll action

* documented xworkspaces reverse-scroll option in changelog
2021-01-28 10:11:33 +01:00
Filip Banák
4ded401aab Add initial support for an escape character (#2361)
Add a config parser method which, for now, deals only with escaping the
literal backslash character and logs an error message to inform the user
of the coming change.

The error message includes a properly escaped value for the user.

As a result of introducing an escape character('\'):

  - Warn the user of any unescaped backslashes, as they will not be
    treated as a literal character in the future

  - For now, still treat a single backslash as a literal character

  - Treat two consecutive backslashes as a single properly escaped
    literal backslash

Also:
  - Add documentation about the escape character to polybar(5) manpage
  - Add info about the escape character to changelog
  - Add testcases for ParseLineKeyTest
  - Add new test ParseEscapedValueTest

Resolves: First step in #2354

Improve value parsing

 - Take value arg in as an rvalue reference and move parsed value back
 - Remove unnecessary if statement
 - Rename function
 - Improve error message
 - Improve function description
 - Format

Add escape character documentation to manpages

Add information about the escape character to the polybar(5) manpage.

Add info about the esacape character to changelog

Add test cases for ParseLineKeyTest

Fix ParseLineKeyTest test cases

Also make config parser method parse_escaped_value private.

Add tests for escaped_value_parser method

Also remove unsued include statement

Simplify parse_escaped_value in config_parser

Remove unnecessary escaped value generation, so we do not have to keep
track of index differences.

Fix ParseEscapedValueTest test cases

Fix parse_escaped_value

Add more test cases for ParseLineKeyTest

Update CHANGELOG.md

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

Adress review

 - Adjust documentation
 - Small code changes

Improve parse_escaped_value

Add initial support for an escape character

Add a config parser method which, for now, deals only with escaping the
literal backslash character and logs an error message to inform the user
of the coming change.

The error message includes a properly escaped value for the user.

As a result of introducing an escape character('\'):

 - Warn the user of any unescaped backslashes, as they will not be
   treated as a literal character in the future

 - For now, still treat a single backslash as a literal character

 - Treat two consecutive backslashes as a single properly escaped
   literal backslash

Resolves: First step in #2354

Improve value parsing

 - Take value arg in as an rvalue reference and move parsed value back
 - Remove unnecessary if statement
 - Rename function
 - Improve error message
 - Improve function description
 - Format

Add info about the esacape character to changelog

Add test cases for ParseLineKeyTest

Fix ParseLineKeyTest test cases

Also make config parser method parse_escaped_value private.

Add tests for escaped_value_parser method

Also remove unsued include statement

Simplify parse_escaped_value in config_parser

Remove unnecessary escaped value generation, so we do not have to keep
track of index differences.

Fix ParseEscapedValueTest test cases

Add more test cases for ParseLineKeyTest

Adress review

 - Adjust documentation
 - Small code changes

Remove duplicate testcase from ParseLineKeyTest

Add initial support for an escape character

Add a config parser method which, for now, deals only with escaping the
literal backslash character and logs an error message to inform the user
of the coming change.

The error message includes a properly escaped value for the user.

As a result of introducing an escape character('\'):

 - Warn the user of any unescaped backslashes, as they will not be
   treated as a literal character in the future

 - For now, still treat a single backslash as a literal character

 - Treat two consecutive backslashes as a single properly escaped
   literal backslash

Resolves: First step in #2354

Improve value parsing

 - Take value arg in as an rvalue reference and move parsed value back
 - Remove unnecessary if statement
 - Rename function
 - Improve error message
 - Improve function description
 - Format

Fix ParseLineKeyTest test cases

Also make config parser method parse_escaped_value private.

Remove duplicate testcase from ParseLineKeyTest
2021-01-26 19:16:29 +01:00
patrick96
eaa50691fc fix(config_parser): UB in logger
Because we passed a temporary as the logger, it gets destroyed after the
config_parser constructor returns and when the logger is called in
config_parser it operates on a dangling reference.

Ref: https://stackoverflow.com/q/35770357/5363071
2021-01-26 16:20:25 +01:00
patrick96
04344aa0e7 CI: apt update before installing doc dependencies
Caused a 404 not found error
2021-01-24 16:05:31 +01:00
patrick96
4154943f69 fix(xworkspaces): Handle -1 value for _NET_WM_DESKTOP
Fixes #2352
2021-01-15 20:34:15 +01:00
patrick96
68ce23cbd3 Remove polybar spec file
Polybar is now available as a native package in the major rpm-based
distros.

Ref: #1633
2021-01-15 16:17:28 +01:00
patrick96
ad2d3652f9 Add items for milestones and readthedocs to release workflow 2021-01-07 20:48:04 +01:00
patrick96
3ac93845fc Install changelog file as part of the documentation 2021-01-07 20:48:04 +01:00
patrick96
50b567f070 sphinx: Turn on nit-picky mode 2021-01-07 20:48:04 +01:00
patrick96
ca8fbe5c86 doc: Exclude .buildinfo file from installation
The file contains information about the build itself (hashed) and is not
really useful.
2021-01-07 20:48:04 +01:00
Patrick Ziegler
0cfdd88ad0 Update PKGBUILD for 3.5.4 (#2347) 2021-01-07 14:52:01 +01:00
patrick96
74dcb4649d Merge branch 'hotfix/3.5.4' 2021-01-07 13:52:28 +01:00
patrick96
fdc670a9dd Release 3.5.4 2021-01-07 13:44:30 +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
Patrick Ziegler
26be83f893 module: Implement action router (#2336)
* module: Implement proof of concept action router

Action implementation inside module becomes much cleaner because each
module just registers action names together with a callback (pointer to
member function) and the action router does the rest.

* Make input function final

This forces all modules to use the action router

* modules: Catch exceptions in action handlers

* Use action router for all modules

* Use action_ prefix for function names

The mpd module's 'stop' action overwrote the base module's stop function
which caused difficult to debug behavior.

To prevent this in the future we now prefix each function that is
responsible for an action with 'action_'

* Cleanup

* actions: Throw exception when re-registering action

Action names are unique inside modules. Unfortunately there is no way to
ensure this statically, the next best thing is to crash the module and
let the user know that this is a bug.

* Formatting

* actions: Ignore data for actions without data

This is the same behavior as before.

* action_router: Write tests
2021-01-04 10:25:52 +01:00
Bruno Cooper
7521da900f Add support for %nwin% in xworkspaces label (#2329)
%nwin% tells the number of windows in a workspace
2021-01-04 10:17:27 +01:00
devsnek
f7c2d83ef2 feat(net): interface discovery (#2025) 2021-01-03 11:48:15 +01:00
Nolan Prochnau
eb302f96ff Add config option for visiblity (#2320 cont'd) (#2342)
* Add option

* Undo my havoc on the example config

* Update CHANGELOG
2021-01-03 02:43:50 +01:00
Patrick Ziegler
412f4c723f feat(xworkspaces): Persistent urgent hint (#2340)
* add urgent hint

* feat(xworkspaces): Fully implement urgency hint

Co-authored-by: Jérôme BOULMIER <jerome.boulmier@outlook.fr>
2020-12-31 15:49:39 +01:00
Patrick Ziegler
80a50874fd Cleanup Getting Started Section (#2339) 2020-12-31 12:51:56 +01:00
Patrick Ziegler
11f76a1710 Update googletest (#2338)
This fixes the cmake deprecation warnings

Ref: https://github.com/google/googletest/pull/3094
2020-12-29 17:40:13 +01:00
Nolan Prochnau
8e46e54cb3 feat: Module Visibility (#2320)
Modules can now also be shown and hidden using ipc commands:

    $ polybar-msg [-p PID] cmd hide.mymodule # Hides module mymodule
    $ polybar-msg [-p PID] cmd show.mymodule # Shows module mymodule
    $ polybar-msg [-p PID] cmd toggle.mymodule # Toggles visibility of mymodule

* Hopefully implement visibility checking

* Implement hide command

* Implement `show` and `toggle` commands

* Refactor and add some logging

* Run style checks and update CHANGELOG

* Get around unused parameter warnings

* Change `set_visible` to return nothing

* Make errors more informative

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update bar when changing module visibility

- Called in the module to maintain dependence on the signal emitter
- Update CHANGELOG to make changes more verbose

* wrong var

* Update include/modules/unsupported.hpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-12-27 16:05:26 +01:00
patrick96
e30d2c4c1f Remove tag compaction "optimizations"
The intention was to remove tags that won't have an effect and join
together consecutive tags.
However the patterns used can just as well appear in regular text, so
this can replace characters inside user defined text and not just
formatting tags.

Fixes #2331
2020-12-25 00:33:32 +01:00
patrick96
b49f325e1e doc: Add language to code-blocks 2020-12-24 12:46:02 +01:00
patrick96
6479ebc83f ci: Make sphinx warnings errors 2020-12-24 12:46:02 +01: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
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
c3fbd1e3e8 ci: Add job for polybar-msg 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
20c88ca977 ci: Use libnl 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
Patrick Ziegler
7d1b265ef4 Update PKGBUILD for 3.5.3 (#2327) 2020-12-23 17:56:48 +01:00
Kamui
89a723a4d9 feat(config): Try to load config.ini (#2324)
* Added .ini extension check to default config

* Added change to changelog and man page

* Added change to changelog and man page

* removed .vscode folder

* removed new lines in changelog
2020-12-23 17:52:30 +01:00
patrick96
218911c463 Merge remote-tracking branch 'origin/hotfix/3.5.3' 2020-12-23 17:42:12 +01:00
patrick96
64649a1e47 Release 3.5.3 2020-12-23 17:36:20 +01:00
Patrick Ziegler
eee22cb351 Create FUNDING.yml 2020-12-23 17:27:36 +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
374716d329 cmake: Remove unused variables 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
patrick96
4f2a145f4f cmake: Update list of source files 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
cb47512871 feat(cmake): removing warnings in dependencies. 2020-12-22 00:37:07 +01:00
Jérôme BOULMIER
cb728ac7c4 fix(cmake): restoring output directory 2020-12-22 00:37:07 +01:00
Jérôme BOULMIER
bb5cf0113e fix(x11): Don't include composite when disabled 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
Patrick Ziegler
9d52408cad Add links to polybar collective (#2318) 2020-12-21 16:27:04 +01:00
Patrick Ziegler
35f3d7a2cb readme: Add downloads badge (#2317) 2020-12-19 23:24:23 +01:00
Nolan Prochnau
0d2838fcd5 feat(xkeyboard): Add variant support to layout label (#2163)
* Add variant support to xkeyboard layout label

Solves #316

* Run style checks, I guess?

* Add comment

* Return nothing if there is no variant

* Update CHANGELOG
2020-12-19 18:22:27 +01:00
Patrick Ziegler
33e691301d fix(config): Don't treat an empty value as invalid (#2315)
An empty color value in the config should be treated as if no color was
specified (explicitly). This is the same behavior as before.
2020-12-18 23:33:03 +01:00
Filip Banák
6f13fe93a3 xkeyboard: Fix indicator spacing (#2306)
* Fix xkeyboard module spacing between the layout and indicators when indicators are empty.

* Simplify the empty label check.

* Remove permanently enabled SCROLL_LOCK, sorry.

* Another mistake.

* Update src/modules/xkeyboard.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update src/modules/xkeyboard.cpp

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>

* Update.

* Fix xkeyboard module spacing between the layout and indicators, when indicators are empty. And fix the spacing between indicators when some are empty.

* Add issue #2292 to fixed.

* Update CHANGELOG.md

Co-authored-by: Filip Banák <6111455-Filip62@users.noreply.gitlab.com>
Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-12-17 20:49:10 +01:00
Patrick Ziegler
fd556525a8 New Tag Parser (#2303)
* refactor(color): Use enum class for color type

* Add testcases for tag parser

* Make tag parser a pull-style parser

Being able to parse single elements at a time gives us more fine-grained
error messages, we can also parse as much as possible and only stop
after an exception.

* fix(color): Parser did not check for invalid chars

* tag parser: First full implementation

* tag parser: Fix remaining failing tests

* tag parser: Replace old parser

* tag parser: Treat alignment as formatting tag

Makes the structure less complex and the alignment tags really are
formatting tags, they are structurally no different from the %{R} tag.

* tag parser: Cleanup type definitions

All type definitions for tags now live in tags/types.hpp, the parser.hpp
only contains the definitions necessary for actually calling the parser,
this shouldn't be included in many places (only places that actually do
parsing). But many places need the definitions for the tags themselves.

* Rename components/parser to tags/dispatch

* tag parser: Cleanup

* Add changelog
2020-12-17 20:37:28 +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
Patrick Ziegler
c07cc09a5f doc: Add changelog to CONTRIBUTING.md TOC (#2310) 2020-12-17 02:17:56 +01:00
Patrick Ziegler
d63bf294b7 Adopt "keep a changelog" (#2308)
* Adopt keep a changelog

Ref: https://keepachangelog.com/en/1.0.0/

* Add changelog to release and contributing docs

* Use H2 for automatically added Download section

The individual changelog subsections use H3 and the changelog section
uses H2, so the Download section should use the same heading

* Add already present changes to changelog

* Mention changelog issue references in CONTRIBUTING.md
2020-12-16 16:04:10 +01:00
patrick96
680bb2d5e4 codecov: Disable pull request annotations
Codecov would add code comments (annotations) to PR diffs whenever a
line was not covered by tests. This isn't really useful to us right now
and just produces noise.
2020-12-16 00:06:10 +01:00
patrick96
433a313782 codecov: Recursively ignore test and lib folder
It seems that tests/* and lib/* don't actually exclude all the files in
codecov
2020-12-15 01:47:32 +01:00
patrick96
6afe6581e1 aur: Update PKGBUILD for 3.5.2 release 2020-12-14 11:10:27 +01:00
patrick96
4d2bdaa0bd Merge branch 'hotfix/3.5.2' 2020-12-14 10:53:13 +01:00
patrick96
3eda8832b9 Release 3.5.2
Changelog

**Fixes**

Legacy action name support was accidentally broken in 3.5.1 (#2296), see #2299
2020-12-14 10:45:29 +01:00
patrick96
3225c11d2a tests: Update gtest to newest commit 2020-12-13 17:41:38 +01:00
Bjoern Hiller
7c662ec44f feat(conf) Properties for {bottom,top}-{left,right} radius 2020-12-13 17:02:23 +01:00
patrick96
94e1c64dff fix: Module type always empty string
The change in #2270 accidentally broke how we access module types.
module<Impl>::TYPE always points to the module superclass and it thus
accesses its empty TYPE field.

This mainly broke legacy action handling.

Ref #2270
2020-12-13 15:57:03 +01:00
patrick96
7493639889 aur: Update PKGBUILD for 3.5.1 release 2020-12-12 13:42:37 +01:00
patrick96
1c554dd0e0 Merge branch 'hotfix/3.5.1' 2020-12-12 13:28:57 +01:00
patrick96
9ba805d78f Release 3.5.1
Changelog

**Features**

* config: Multiple inheritance (#2271), see #2269

**Fixes**

* (#2285), see #770, #2289
* Timer module: Polybar crash when interval is set to 0 (#2274), see #2273
* `custom/menu`: Wrong level numbers in error messages (#2264)
* `internal/xworkspaces`: Ignored certain workspace updates (#2275), see #2272
* Logger: Undefined behavior (#2284)
* build:
    * Build issues in older clang versions (#2270, #2279, #2280)
2020-12-12 13:02:47 +01:00
quandangv
ae1c6ca1b7 Fix 2283: Replace tokens at build() instread of update() 2020-12-12 12:33:21 +01:00
patrick96
47483a94f1 fix(process): fork_detached created zombie processes
Since the forked processes are still our children, we need to wait on
them, otherwise they become zombie processes.

We now fork twice, let the first fork immediately return and wait on it.
This reparents the second fork, which runs the actual code, to the init
process which then collects it.

Ref #770
2020-12-12 02:37:21 +01:00
patrick96
ccf14d9816 Fix CI badge 2020-12-12 02:03:30 +01:00
patrick96
d6148e3288 Remove travis 2020-12-12 01:43:12 +01:00
patrick96
95537f458d ci: Add manual trigger 2020-12-12 01:43:12 +01:00
patrick96
cf739ed295 ci: Use github actions 2020-12-12 01:43:12 +01:00
patrick96
54e2490aa5 fix(logger): Wrong conversion function called
For some reason when passing some non-const strings to convert, the
convert(T&& arg) method was used instead of the one specialized for
strings.

This caused an error in clang because you can't pass objects with
non-trivial types to varargs functions.

The best solution I found was to just add a specialized function for
non-const strings.
2020-12-12 01:43:12 +01:00
patrick96
a45b5d0424 fix(build): UB when converting strings in logger
The memory returned was no longer valid because arg is destructed after
the function returns.
2020-12-12 01:43:12 +01:00
Vlad Glagolev
d665634484 Fix build with clang++ 3.4 (#2279) 2020-12-12 01:07:51 +01:00
Vlad Glagolev
f6231f351f Add missing header (#2280) 2020-12-12 01:07:13 +01:00
patrick96
df485f0a60 fix(module_formatter): Remove double moves 2020-12-07 15:35:38 +01:00
patrick96
bc87eb3b69 fix(battery): Crash when format-low not defined
This was a backwards-incompatible change introduced in #2199, however it
was caused because `module_formatter.has` throws an exception when the
format doesn't exist instead of just returning false.

Fixes #2262
Ref #2199
2020-12-07 15:35:38 +01:00
Patrick Ziegler
1168ef36a0 github: Add action to create release archive (#2277)
Whenever a release is published, this action will create a release
archive and update the release body with a download section.

This also integrates the suggestions from #2276

Resolves #2276
2020-12-06 18:16:17 +01:00
Patrick Ziegler
037f6e6c45 fix(xworkspaces): Never swallow updates (#2275)
If two WM events arrive withing 25ms of one-another, the second one does
not trigger a bar update.
The module state is still correct, it is just not reflected in the bar.

This somehow caused updates being swallowed in fluxbox, but only after
PR #882 was merged, even though that 25ms restriction existed long
before that.

Fixes #2272
2020-12-05 23:28:48 +01:00
Patrick Ziegler
82ebad5e7a fix(timer_module): Ensure that interval > 0 (#2274)
Since 3.5.0, we use m_interval for a modulo operation, this crashes the
bar if the interval is 0. A non-positive interval shouldn't be allowed
anyway, so we now throw an exception in that case.

Fixes #2273
2020-12-05 22:58:38 +01:00
Patrick Ziegler
b2c515c73c fix(config): Reintroduce multiple inheritance (#2271)
Pre 3.5.0, any key starting with 'inherit' was treated as an inherit
directive. This allowed for multiple inheritance even though it was
never inteded in that way.
3.5.0 removed that bug/feature by doing a strict check against 'inherit'

It seems people were relying on this behavior, so we are adding it back.
However multiple inheritance with multiple keys is also deprecated in
favor of the `inherit` key now supporting multiple space separated
sections.

This is because the config doesn't have a key order, but inheritance
does depend on the order the different section keys are copied over (if
multiple inherited sections define the same key).

Fixes #2269
2020-12-05 02:48:18 +01:00
Vlad Glagolev
3d6a7ffd4d Fix linking when built with clang++ 3.4 (#2270) 2020-12-05 01:07:12 +01:00
Patrick Ziegler
c198859cd5 fix(menu): Wrong printf token in error message (#2264)
'level' is a string, not an integer
2020-12-03 15:12:59 +01:00
Patrick Ziegler
4e576f6572 travis: Disable notifications for passed builds (#2265)
Generates a bit of spam in IRC when making releases, because each branch
created will trigger a message.
2020-12-03 14:38:15 +01:00
Patrick Ziegler
d6ce8c9a46 aur: Update PKGBUILD for 3.5.0 release (#2261) 2020-12-02 22:00:15 +01:00
patrick96
11d1c2c5c7 Merge branch 'release/3.5.0' 2020-12-02 18:12:53 +01:00
Quan
39c73a8234 feat: Warn state for cpu, memory, fs, battery modules (#2199)
* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps

* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps

* Fix minor error

* Added WARN state for cpu module

* Implement WARN state for CPU, Memory modules, working on fs module

* Implement WARN state for fs module

* Simplify WARN state implementation for cpu and memory

* explicitly check percentage in get_by_percentage_with_borders

* Fixed silly error

* implement warn state on battery module, standardize the implementation on other modules

* minor fixes

* fix annoying error

* use more intuitive param name

* Fix percentage with borders bug

* Make requested changes
Hide the effect of warn states when unused

* Backward Compat: use no format instead of fallback label

* Reformat

* Refactor

* Reformat

* Reformat: convert tabs to spaces

* Reformat
2020-12-02 15:55:13 +01:00
Patrick Ziegler
078aa3c8cb github: Typo in build issue template (#2260) 2020-12-02 15:16:15 +01:00
Jan Palus
9f2459be8c net: increase speedrate precision (#2054)
more granular units need lower precision, while less granular need
higher precision. assume sane default of:

unit | precision
KB   | 0
MB   | 1
GB   | 2

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-12-01 17:54:54 +01:00
Patrick Ziegler
26a9bc5964 fix(doc): Typo (#2257)
Thanks to u/TheNextPoetician for reporting on reddit

Ref: https://www.reddit.com/r/Polybar/comments/k4llsx/typo_in_the_man_page/
2020-12-01 17:12:02 +01:00
Vlad Glagolev
5f67a8a12b Respect interval default for tail = true (#2240) 2020-12-01 16:35:48 +01:00
patrick96
62638a5833 Release 3.5.0
Breaking Changes:

* The new config parser imposes some restrictions on which characters can be
  used in section and key names. Users shouldn't be affected by, this unless
  they use one of the following characters in any section or key name: `"'=;#[](){}:.$\%`
  Please consult [`man 5 polybar`](https://polybar.readthedocs.io/en/latest/man/polybar.5.html) for a full reference of the new config rules.
* `internal/temperature`: The first and last ramp element are now only used for
  `base-temperature` and below and `warn-temperature` and above respectively.
  This only slightly changes the ranges for which the different ramp levels are
  responsible for.
  (#2197)

Changelog

**Deprecations**

* `[settings]`: `throttle-input-for` has been removed. It wasn't a useful option
  and could cause certain actions (e.g. click commands) to be ignored. (#2117)

* All action names used by modules to handle click and scroll events are
  deprecated (#1907). This change mainly affects users of the menu module.
  Please read the [documentation](https://polybar.readthedocs.io/en/latest/user/actions.html) for instructions on how to migrate.

**New Config Options**

The `include-directory` key can be used the same as `include-file` and includes
all regular files in the given directory.

In labels:

* `label-NAME-minlen`, `label-NAME-alignment` can be used to pad labels with
  spaces to the right (alignment set to `left`), left (alignment set to
  `right`), and both sides (alignment set to `center`).

In `internal/backlight`:

* `enable-scroll` enables changing the brightness through scrolling.

In `internal/github`:

* `format-offline` is used when the module cannot connect to the server.
* `label-offline` can be used in `format-offline`.
* `api-url` can be used to connect to a custom github enterprise instance

In `internal/pulseaudio`:

* `click-right` and `click-middle` can be used to execute commands when
  right/middle clicking.
* `%decibels%` token can be used in `label-volume` and `label-muted` to show the
  volume in decibels.

**Changes To The Build System**

* Allow users to specify python executable when building. (polybar/xpp#27,
  #2125)
* The i3ipcpp submodule no longer rebuilds jsoncpp and just uses whatever
  version is available. (#2015, polybar/i3ipcpp#9)

**Features**

* New commandline argument: `-M` / `--list-all-monitors`.
    Will display all available monitors (even cloned ones).
* New log level: `notice`.
    Used as the default and is used for non-warning messages the user should
    nevertheless be aware of. (#2027)
* config:
    * New config parser (#1377)
    * `include-directory` key (#2196), see #1946
    * Add error message when an entire section is missing. (#2195)
    * `-minlen` and `-alignment` properties for labels. (#1546)
    * Make the `seperator` key in the bar section a label. (#1918)
    * Better color validation. (#1290)
* timer modules: Schedule module updates to be aligned with the update interval.
  For example, the date module now updates on the minute instead of in the
  middle of a minute if the interval is set to 60 seconds. (#2123), see #2064
* `custom/menu`: Multiple menu modules per bar (#1907)
* `internal/backlight`: Support for changing the brightness through scrolling.
  This may require additional changes to the system running polybar. (#1957)
* `internal/github`:
    * `format-offline` for when the module cannot connect to the server (#1825),
    see #1815
    * Support for github enterprise instances. (#1841), see #1812
* `internal/network`: Support `Gbit/s` for `%linkspeed%` token. (#2055)
* `internal/pulseaudio`:
    * `click-right` and `click-middle` keys (#1941)
    * `%decibels%` token (#1894), see #1886
* `internal/xworkspaces`: Proper implementation for `label-occupied`. (#822),
  see #874, #1444, #1033

**Fixes**

* Polybar not executing commands that produce output. (#1680), see #916
* Polybar froze until click commands finished executing (#2248)
* Polybar not properly working with mirrored monitors. (#1823), see #1192 and
  #1794
* Unstable animation framerate (#1683), see #568
* Multiple modules of the same type caused click events not to be delivered to
  the rigth one (#1907), see #1172
* config:
    * Seemingly unrelated error messages when BOM character appears in config.
    (#2166), see #2075
    * Fall back to next possible config location if config file doesn't exist
      (except if `--config` was used). (#2026), see #2016
* iconset: `fuzzy-match` chose first match, even if exact match was available.
  (#2042), see #2041
* `custom/menu`: Spacing issue (#1656)
* `internal/alsa`: Volume didn't go over 100% (#2184), see #2173
* `internal/backlight`: Use amdgpu workaround for all devices starting with
  `amdgpu_bl`. (#2122)
* `internal/battery`: Battery not marked as full if over `full-at` percent.
  (#2019), see #1622
* `internal/cpu`: More accurate cpu load calculation. (#1955)
* `internal/github`: Outdated GitHub API authentication. (#2029), see #2002
* `internal/memory`: Use the correct size prefixes (#2211), see #2023
* `internal/network`:
    * Wrong up- and downspeed values for non-integer intervals. (#2219)
    * tun/tap interfaces didn't query their IP addresses. (#1990), see #1986
    * Don't crash module if linkspeed cannot be queried. (#1772), see #1211
* `internal/temperature`:
    * `format-warn` was not used if the temperature was *exactly*
      `warn-temperature`. (#1897)
* `internal/xworkspaces`:
    * Multi-monitor issue (#1929), see #1764, #1849
    * Module sometimes showed too many workspaces (#1984), see #1983
* build:
    * xpp submodule doesn't work with python 3.9 (polybar/xpp#26)
    * CMake 3.17+ developer warnings (#2089, polybar/xpp#24, polybar/xpp#25)
    * gtest compilation failure (#1993), see google/googletest#2678
    * Compilation issue in GCC 6. (#1953)
2020-12-01 14:53:41 +01:00
patrick96
e89da58940 fix(builder): Properly apply alpha for fg and bg
It was not quite clear how try_apply_alpha should behave if the given
color was not ALPHA_ONLY. The implementation just returned 'this'.
However, the build relied on it returning the given color.

This broke all bg and fg settings in the entire bar.

To clear this up, we switch this around take the alpha channel of 'this'
and also return 'this' if it isn't ALPHA_ONLY.

Fixes #2255
2020-12-01 14:53:41 +01:00
Thibaut CHARLES
50d8a1ba06 feat(network): Ability to change speed unit text (B/s) (#2068)
New config option `speed-unit = B/s` will be used to suffix the upload and download speeds.

* mod::network: udspeed-unit to set network speed unit suffix

* Changed udspeed-unit to speed-unit
2020-11-29 14:15:27 +01:00
patrick96
52eee95bf8 controller: Detach shell commands from polybar
Shell commands triggered from action tags used to block polybar until
they finished.

Since we are not actually interested in the output of the commands, it
makes sense to run them completely detached from polybar and have
polybar not block when executing these commands.

Now the spawned child processes no longer get killed when polybar
exits. This is fine because polybar is not responsible for these
processes since they were explicitly started by the user through click
commands.

Ref: #770
Ref: #1680
2020-11-29 03:53:59 +01:00
Michał Drozd
0416093edc Display correct(binary) unit prefixes in memory module (#2211) 2020-11-27 23:30:09 +01:00
patrick96
5007dae35a If bar bg, fg, border, or line color is alpha only, apply to default 2020-11-27 22:08:03 +01:00
patrick96
53c6f3b042 refactor(color): Better channel function names
(alpha|red|green|blue)_(d|i) are used for the four channels using
doubles or integers, respectively.
2020-11-27 22:08:03 +01:00
patrick96
477189e443 Cleanup 2020-11-27 22:08:03 +01:00
patrick96
4dfbba11c4 Make rgba class immutable 2020-11-27 22:08:03 +01:00
patrick96
cc1efe12cd Add tests for apply_alpha 2020-11-27 22:08:03 +01:00
patrick96
413c911cd1 Move apply_alpha functionality into rgba 2020-11-27 22:08:03 +01:00
patrick96
eeab4f0d45 Print error message for invalid color strings 2020-11-27 22:08:03 +01:00
patrick96
c9efd09f71 Load rgba from config instead of strings. 2020-11-27 22:08:03 +01:00
patrick96
8e10c046fa Move all channel functions into rgba class
Since we use rgba everywhere, extracting channels from uint32_t directly
is not necessary anymore.
2020-11-27 22:08:03 +01:00
patrick96
3655106a14 Adapt the renderer side to always use rgba 2020-11-27 22:08:03 +01:00
patrick96
64fa6469ab Remove unused hex function
This allows us to also remove the cache class which was only used here
2020-11-27 22:08:03 +01:00
patrick96
b238ec3403 Move most color_util functions into rgba class
The intent is for every color to be stored in a rgba instance

The rgba class now stores the color in a 32 bit integer to save space

This also removes the unused class rgb and moves everything else into a
cpp file.

Many functions also had weird template parameters. For example
alpha_channel<unsigned short int> would give a 2 byte number with the
alpha channel byte in both bytes.
color_util::hex would return a hex string with alpha channel if unsigned
short int was given and without if unsigned char was given. Even more
curiously those parameters were passed to *_channel and the result
nevertheless truncated to 8bits.
2020-11-27 22:08:03 +01:00
patrick96
75eb41f5ad config: Better error messages when opening files
If a config file is a directory, ifstream would just read it as an empty
file without any errors.

Failing early here is a good idea.
2020-11-26 21:06:35 +01:00
patrick96
9d31b51a63 github: Cleanup issue templates
We no longer allow people to create issues from a blank template.

The templates for bug reports and build issues are also much more
explicit in what they want from the user.
2020-11-26 21:00:40 +01:00
patrick96
2f549575c7 github: Add PR template
Gives structure to pull requests and make it easier for us to review.
2020-11-26 21:00:40 +01:00
patrick96
874c9527be Add debugging guide to SUPPORT.md 2020-11-26 21:00:40 +01:00
patrick96
f28de58134 readme: Add contributing guideline 2020-11-26 21:00:40 +01:00
patrick96
0b67f67440 readme: Move installation instructions to wiki
All the information in the README was already duplicated on the wiki, it
makes sense to keep the README small and point the user to the wiki.
2020-11-26 21:00:40 +01:00
patrick96
36aa1d08d6 Add contributing guidelines
Only describes bug reports and PRs for now, should include things like
"How to contribute" in the future
2020-11-26 21:00:40 +01:00
patrick96
ff3340e062 controller: Cleanup process_inputdata 2020-11-26 20:53:53 +01:00
patrick96
1afb333858 doc(actions): Point user to doc when using legacy actions 2020-11-26 20:53:53 +01:00
patrick96
191fb2972c actions: Integrate input_handler into module
Only modules can now be action handlers.
This also slightly simplifies the controller because we don't need to
keep track of input handlers, we can just use the module list.
2020-11-26 20:53:53 +01:00
patrick96
0a1b58a2ed doc(actions): Finish migration documentation 2020-11-26 20:53:53 +01:00
patrick96
c427ec06d7 doc(actions): Finish list of available actions 2020-11-26 20:53:53 +01:00
patrick96
658ed6974d Do not use reverse-scroll for prev/next actions
The next action should always select the next workspace, the same for
prev.

reverse-scroll should be directly used when setting the scroll actions.

This changes the behavior of `prev` and `next` actions in the i3 and
bspwm module.
But I don't think the impact will be significant and the old behavior
was misleading anyway.
2020-11-26 20:53:53 +01:00
patrick96
5e64361ed8 doc(actions): Start supported actions table 2020-11-26 20:53:53 +01:00
patrick96
d45ae7954a doc: Finish legacy action migration table 2020-11-26 20:53:53 +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
patrick96
1193b78e43 controller: Use unordered_map for legacy actions 2020-11-26 20:53:53 +01:00
patrick96
41ffc3607d controller: Make action shell command local 2020-11-26 20:53:53 +01:00
patrick96
9fb75779f3 Incorporate reviews 2020-11-26 20:53:53 +01:00
patrick96
5ddb6fc0c5 Move legacy action handling to separate function 2020-11-26 20:53:53 +01:00
patrick96
c60b488501 clang-format 2020-11-26 20:53:53 +01:00
patrick96
507004df87 actions: Move parsing to utility file 2020-11-26 20:53:53 +01:00
patrick96
0db8376222 menu: Emit exec actions
Now the menu closes properly again if any actions on it are clicked
2020-11-26 20:53:53 +01:00
patrick96
ef8f7c9d94 feat(menu): Add exec action to menu module
Can be used to execute menu actions through ipc and will also be used to
make sure the menu closes when an action on it is clicked.
2020-11-26 20:53:53 +01:00
patrick96
af5af1e497 Fix unused argument warning 2020-11-26 20:53:53 +01:00
patrick96
a30ac5f4a3 fix(actions): Separate data from action properly 2020-11-26 20:53:53 +01:00
patrick96
6618320947 actions: Use #name.action[.data] format
This looks a bit nicer than #name#action[.data]
2020-11-26 20:53:53 +01:00
patrick96
bc1b86c584 actions: Separate data from action string
Modules now no longer need to manually parse the action string and
extract data from it.
2020-11-26 20:53:53 +01:00
patrick96
8acedeef87 modules: Fix resolving of type of disabled modules 2020-11-26 20:53:53 +01:00
patrick96
002112df64 actions: Forward data of legacy actions
Some actions have data attached (e.g. xworkspaces-focus=N), the
forwarding logic now matches the keys in the legacy_actions map as
prefixes and everything afterwards is considered additional data and
appended to the new action string.
2020-11-26 20:53:53 +01:00
patrick96
a2b312cc84 actions: Add mapping for all legacy action names 2020-11-26 20:53:53 +01:00
patrick96
ae2350167b actions: Switch all modules over to new system
All modules now expose their actions as public static constants

Issues: The menu module no longer closes when an item is clicked (before
it would intercept any executed command and look if it matches one of
its exec commands)
2020-11-26 20:53:53 +01:00
patrick96
816b73a95f actions: Add utility functions to produce action tags 2020-11-26 20:53:53 +01:00
patrick96
b2ba21c75d actions: Forward legacy actions to the right module
All the information about which action has to be delivered to which
module is kept in once place to make cleanup easier once the deprecated
actions are removed.

Right now only the date module is added as a proof of concept.
2020-11-26 20:53:53 +01:00
patrick96
d592eea966 refactor: Move module type string into modules
This allows us to identify module by their type and it is also better to
store the module type as part of the module instead of having it
hardcoded in factory.hpp
2020-11-26 20:53:53 +01:00
patrick96
06012af3aa controller: Deliver inputs to all input handlers
This is more natural, especially if the same module appears twice in the
module list
2020-11-26 20:53:53 +01:00
patrick96
4b5007294b refactor(modules): Make all modules input handlers
By default they will return false for calls to `input`
2020-11-26 20:53:53 +01:00
patrick96
457e37faaf fix: add name_raw to unsupported modules 2020-11-26 20:53:53 +01:00
patrick96
a287fb5e8c fix: Use module name in action string
Action strings now have the form '#MODULE#ACTION'

For example to trigger the action 'toggle' in the 'module/date' module
one would now use '%{A1:#date#toggle:}'

With this action strings can now be uniquely assigned to one module.

Fixes #1172
2020-11-26 20:53:53 +01:00
patrick96
22d0f0a38c refactor(builder): Remove unused arguments 2020-11-26 20:53:53 +01:00
patrick96
c34f013e5f doc: Reflect config fallback in config
This should reflect the changes from #2026
2020-11-23 13:16:37 +01:00
patrick96
df15a4062a doc: Write new release workflow
We now use OneFlow [1] for releases 3.5.0 and onwards.

Closes #1780

[1]: https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow
2020-11-22 23:32:41 +01:00
patrick96
bb3647ff8d Add script to create release archives 2020-11-22 23:32:41 +01:00
patrick96
14a948d75d aur: Use Release mode in cmake
This is already the default but our packaging guidelines recommend this,
so we should also follow them.
2020-10-31 10:53:32 +01:00
patrick96
5dc6e7a7aa refactor(config): Throw missing section error
Makes error messages less confusing if for some reason a key in an
non-existent section is requested.
2020-10-29 23:13:04 +01:00
sysek
b11fa81f19 doc: Add versions to openSUSE (#2231) 2020-10-29 22:43:06 +01:00
patrick96
e309253fc8 clang-format 2020-10-19 10:32:41 +02:00
patrick96
4944a5179c fix(net): Float interval for network speed
Before the time difference between two measurements was always an
integer number, so for intervals < 1, you would always get 0 and for any
other non-integer interval you would get skewed results.
2020-10-19 10:32:41 +02:00
Quan
3895ace12a temp: Use first/last ramp only for edge temps (#2197)
ramp-0 is used for everything <= base-temperature and ramp-N is used for everything >= warn-temperature

* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps

* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps

* Fix minor error

* explicitly check percentage in get_by_percentage_with_borders

* Fixed silly error
2020-10-09 14:05:50 +02:00
Guilherme Silva
8dbd1740a7 feat(config): include-directory directive (#2196)
Closes #1946
2020-10-08 17:44:29 +02:00
patrick96
31096de5e5 travis: Update to focal
Bionic still has and old sphinx version which breaks our doc build
2020-10-03 15:37:17 +02:00
patrick96
91e31317a7 doc: Set SPHINX_BUILD in standalone doc builds
If we build only the documentation by invoking `cmake` on the `doc`
folder, the `SPHINX_BUILD` variable is not set and instead of

```
sphinx-build -b html ...
```

it will just execute

```
-b html ...
```

This produces an error but doesn't fail the build because apparently if
the command starts with a dash an error is non-fatal.

Fixes #2191
2020-10-03 15:37:17 +02:00
joaquin garmendia
bb15e33a2a fix(alsa): Remove upper bound to get_volume (#2184)
Fixes #2173 

* feat(alsa): Remove upper bound to get_volume

* Add tests. Trim unnecessary function.
2020-09-20 14:26:17 +02:00
Nolan Prochnau
2f4cffc0fb fix(config_parser): Gracefully handle BOM (#2166)
* fix(config_parser): Gracefully handle BOM

* Move check to parse_line function

And clarify the error message

Closes #2075
2020-08-15 12:02:23 +02:00
Mihir Lad
a4dd2a93d6 Disable modernize-use-trailing-return-type warning 2020-08-12 11:01:44 +02:00
Malte Bargholz
a625e2b79a fix(timer_module): sleep until next full interval (#2123)
Any timer_module based module would sleep for the set interval and then
continue running. Depending on the start time of polybar this
sleep pattern might not be aligned, which causes such modules to always
update in a shifted manner.
Consider the date module as an example. If the update interval is set to
60 seconds and polybar was started at 13:37:37, polybar would update the
clock at 13:38:37, 13:39:37 and so on.
To make matters worse, if a module would perform lengthy checks this
interval might drift over time, causing even more inconsistent updating.

This patch extends the base module with a sleep_until method that calls
the corresponding function on the sleephandler. Additionally the
timer_module is extended to compute the remaining time until the next
interval passes and sleep accordingly.

Closes #2064

Co-developed-by: Dominik Töllner <dominik.toellner@stud.uni-hannover.de>

Co-authored-by: Malte Bargholz <malte@screenri.de>
2020-06-20 22:15:25 +02:00
Patrick Ziegler
2b6abb9b8f xpp: Update submodule (#2125)
* xpp: Update submodule

* aur: Force system python in polybar-git

This should resolve problems on systems with conda or pyenv enabled that
would otherwise not pick up xcbgen properly
2020-06-10 21:00:18 +02:00
Richard
be64da3bda battery: Prioritize full-at over state (#2019)
* Prioritize battery full-at over state

The `full-at` option should take priority 
over the charging state of the battery.

Closes #1622 (issue for Thinkpad laptops)

* Remove typo from clamp_percentage
2020-06-09 21:15:36 +02: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
nicey0
b8a1354117 backlight: Just match amdgpu_bl prefix (#2122)
Some devices can have "amdgpu_bl1" or "amdgpu_bl2", but the code hardcoded in the value "amdgpu_bl0". This change tests based on the first characters: "amdgpu_bl".
2020-06-05 21:48:17 +02:00
patrick96
55b7533ed1 xpp: Update submodule:
Replaces cElementTree with ElementTree

Ref: polybar/xpp#26
2020-06-04 22:14:24 +02:00
Patrick Ziegler
ba0a156bbe refactor: Deprecate throttle-input-for setting (#2117)
If an input is enqueued as a response to an input, the new input will be
swallowed because it will likely be enqueued less than 30ms after the
original event.
This is not something that is an issue right now but it is required to
finish #1907 where, in order to close the menu after a click, the menu
module gets an exec action that closes the menu and adds a command to
the event queue.

The setting also isn't too useful since it will just break polybar input
handling if inputs arrive too fast instead of (possibly) slowing down
the bar.
2020-05-30 22:45:36 +02:00
Justin R. St-Amant
5cd7295a41 fix(menu) wrong spacing for left expansion (#1656)
* Fixed minor menu item-spacing issue

* Changes to menu-item spacing as requested

* refactor: Remove redundant else-if condition

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2020-05-16 23:19:12 +02:00
patrick96
4e9598f09b build: Update i3ipcpp submodule
Fixes a possible memory leak

Ref: polybar/i3ipcpp#10
2020-05-15 14:52:48 +02:00
patrick96
f7dd5041fb aur: Update PKGBUILD for 3.4.3 2020-05-15 14:52:37 +02:00
Jérôme BOULMIER
78b5f88c5f Fix gcc compilation 2020-05-14 22:45:40 +02:00
Jérôme BOULMIER
f016b99e08 Redirect process output to dev null 2020-05-08 23:24:29 +02:00
Jérôme BOULMIER
e9d2f022cd add command unit tests 2020-05-08 23:24:29 +02:00
Jérôme BOULMIER
5e5d8faf04 fix(command): broken pipe when ignoring output. 2020-05-08 23:24:29 +02:00
patrick96
92181fd237 build: Update xpp module
Fixes developer warnings in cmake 3.17+

Ref: polybar/xpp#24
Ref: polybar/xpp#25
2020-05-06 23:25:56 +02:00
patrick96
0dffca98cb xworkspaces: Remove desktop offset member 2020-05-01 18:46:02 +02:00
patrick96
7658c1b9f1 fix(xworkspaces): Assign desktops to correct viewport
Before the module would just try to evenly distribute desktops
(workspaces) among the viewports.

But since `_NET_DESKTOP_VIEWPORT` actually maps desktops to viewports,
we can use that information to assign workspaces to the right viewport.

Fixes #1849
Fixes #1764
2020-05-01 18:46:02 +02:00
Utkarsh Gupta
fc42da812a doc: Add Debian installation instructions (#2072)
* Add installation instructions for polybar on Debian

Closes: #1054

* Add instructions for stable backports
2020-04-24 22:45:56 +02:00
patrick96
b2613fa269 logger: Use notices for config file and fonts
It is useful for people to see what config file polybar loaded.

For debugging font issues people almost always need to check what fonts
polybar loaded, for that they need to run polybar with info logging. Now
this information is always provided. This requires an update in the font
wiki page.
2020-04-22 00:38:31 +02:00
patrick96
3f60561ae3 logger: Downgrade some warning messages
A warning implies something went wrong and (possibly) the user should do
something about it. However, warnings are not always used this way.

For example:

* When a fallback value for a `${..}` reference is used, this shouldn't
  produce a warning (or notice) since using fallbacks is not something
  bad.
* pulse telling you that it uses the default sink because no sink was
  specified also does not warrant a warning (even notice may be too
  high).
* Whenever polybar shuts down it produces a "Termination signal
  received..." warning. Since there isn't a more proper way to shut down
  polybar, it should not produce a warning. Same argument for a
  `screenchange-reload`
2020-04-22 00:38:31 +02:00
patrick96
cae3848030 logger: Add default logging level 'notice'
Between info and warning. Should be for things the user should be aware
of but not imply anything has to be done about it.
2020-04-22 00:38:31 +02:00
patrick96
ecbe77bbda fix(monitor): Reload when any monitor changes
Before it would only reload if the size changed and even that was
reliable since the method relied on the order of the monitor list.

Now if the monitor list differs in any way (pos, dimension, primary,
output, name) a reload is issued
2020-04-21 23:59:01 +02:00
patrick96
18fc64f881 monitor: Remove sort in get_monitors
The lambda returns the wrong values and sorting isn't really necessary
2020-04-21 23:59:01 +02:00
patrick96
fbbb5922da doc: Reword -m and -M description 2020-04-21 23:59:01 +02:00
patrick96
33b68ec7cb fix(randr): Undefined behavior when removing clones
Because of how monitors are removed inside the loop and depending on the
monitor order a cloned monitor may be assigned a width of 0 but is never
actually removed resulting in polybar saying the bar is out of bounds

Fixes #1794
2020-04-21 23:59:01 +02:00
patrick96
9f7363c9ee bash: Remove tabs 2020-04-21 23:59:01 +02:00
patrick96
52000c194a fix(xrandr): Fetch cloned monitors where possible
Removing monitors is not really necessary when selecting the monitor
where to render the bar or choosing the backlight. Since both monitors
occupy the same coordinates rendering can be done on both and it's
better to give people felxibility for the backlight.

Fixes #1191
2020-04-21 23:59:01 +02:00
patrick96
2edd8275ff Add -M CLI argument to display cloned monitors
Works the same as -m but doesn't purge cloned monitors
2020-04-21 23:59:01 +02:00
patrick96
cc36350849 xrandr: Allow not to purge cloned monitors 2020-04-21 23:59:01 +02:00
patrick96
b5e7078d93 fix(monitor): Remove realloc from get_monitors
Premature optimization that tried to cache monitors but the cache did
not take into account the parameter values.

The call `get_monitors(..., ..., false, true);` would get all connected
and unconncected monitors a subsequent call
`get_monitors(..., ..., true, false);` would get back the same list of
monitors even though it requested only connected monitors.

Additionally `get_monitors` is never called periodically so the
optimization really didn't help much.
2020-04-21 23:59:01 +02:00
Jan Palus
61dfe739d5 net: allow shortening of linespeed to Gbit/s 2020-04-14 01:32:21 +02:00
Lucas Araújo
15496bfb4a Update: Using another way to authenticate github module (#2029)
The github module only authenticate by query string, and this method is deprecated:
https://developer.github.com/changes/2019-11-05-deprecated-passwords-and-authorizations-api/#authenticating-using-query-parameters


There is no reason to remove it before the method stop working, so I've made possible to the user choose which authentication method he will use:

* The parameter token remain unchanged.
* If the parameter user is passed then the module will use the not deprecated method, passing user and token on the body of the requisition. Otherwise the module will use the deprecated method.

Co-authored-by: Lucas <araujo.lucasvale@gmail.com>

Fixes #2002
2020-03-26 12:50:42 +01:00
patrick96
15e79b09d3 fix(iconset): Try exact match before fuzzy match
If an exact match was possible, fuzzy matching could still return a
non-exact match if it appeared before the exact match in the list of
icons.

Fixes #2041
2020-03-19 20:52:41 +01:00
patrick96
3f7eb1b2aa test(iconset): Add failing fuzzy match test
Ref: #2041
2020-03-19 20:52:41 +01:00
patrick96
853ea994bb build: Update xpp submodule
Fixes #2031

Ref: polybar/xpp#22
Ref: polybar/xpp#23
2020-03-11 09:46:26 +01:00
Lucas Araújo
512c519f25 config: Check if config path exists (#2026)
Closes: #2016

* update: Checks if the configuration file exists

* Update: Removing the logic of the config file search from main.cpp
2020-03-01 22:03:17 +01:00
patrick96
f02fb67020 travis: Add jsoncpp dependency 2020-02-22 18:02:13 +01:00
patrick96
6975c0ec26 build: Update i3ipcpp submodule
With this we no longer distribute the jsoncpp 1.7.7 source with polybar.
It is possible that polybar will no longer build on older systems that
have an ancient version of jsoncpp (>= 5 years).

Ref: polybar/i3ipcpp#9
2020-02-22 18:02:13 +01:00
patrick96
fab8437ff1 doc: Write syntax definition in polybar.5 2020-02-21 16:17:12 +01:00
patrick96
0b713047aa doc: Allow custom SPHINX_BUILD 2020-02-21 16:17:12 +01:00
patrick96
0276d11fd9 config_parser: Improve message for invalid names 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
Cooper Pierce
683cfc0738 feat(github): offline label (#1825)
Adds `format-offline` and `label-offline`

* feat(github): offline label & fixes

* Clear label if there are no notifications and empty-notifications = false

* clang-format

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-02-21 13:58:23 +01:00
patrick96
8d2b0d2747 build: Update xpp submodule
Ref: polybar/xpp#21
2020-02-08 17:37:15 +01:00
patrick96
8d07f2aa23 build: Update xpp submodule
PR #1683 downgraded the xpp submodule
2020-01-31 07:12:21 +01:00
patrick96
3854fc91b5 fix(xworkspaces): Show _NET_NUMBER_OF_DESKTOPS desktops
In the case where _NET_NUMBER_OF_DESKTOPS > |_NET_DESKTOP_NAMES|
the last branch of the get_desktop_names method would return a vector
with _NET_NUMBER_OF_DESKTOPS + 1 elements because we iterate until
_NET_NUMBER_OF_DESKTOPS + 1.

Fixes #1983
2020-01-24 16:56:38 +01:00
Jérôme BOULMIER
51f9f35599 cleanup(logger): use universal references to avoid useless copies 2020-01-24 16:32:26 +01:00
Jérôme BOULMIER
982a22cd62 use steady clock instead of system clock 2020-01-23 23:45:56 +01:00
Jérôme BOULMIER
e6e010e45b fix(battery): animation framerate 2020-01-23 23:45:56 +01:00
Christoph Schiessl
d3844c40b6 refactor(battery): simplify animation subthread 2020-01-23 23:45:56 +01:00
patrick96
4ef2bd5575 fix(test): Gtest compilation failure
In master gtest fails to build with the error

/home/travis/build/polybar/polybar/build/googletest-src/googlemock/include/gmock/gmock-more-actions.h:138:1: error: ISO C++11 requires at least one argument for the "..." in a variadic macro [-Werror]
 ACTION_P(ReturnPointee, pointer) { return *pointer; }

We had a lot of failed builds because gtest often breaks stuff in
master. From now on we will just use a release tag. Whenever there is a
new release, we manually update this file.

Ref: google/googletest#2678
2020-01-22 00:33:07 +01:00
Artem Polishchuk
34bb35ca96 Add Fedora installation instructions (#1976) 2020-01-20 11:36:28 +01:00
Gus Caplan
068bf5a311 feat(backlight): Add enable-scroll (#1957)
* backlight: enable changing via scroll

* squash! feedback

* Update src/modules/backlight.cpp

Co-Authored-By: Jérôme BOULMIER <jerome.boulmier@outlook.fr>

Co-authored-by: Jérôme BOULMIER <jerome.boulmier@outlook.fr>
2020-01-15 16:32:17 +01:00
patrick96
0dbcb28a2c fix(net): Query IP addresses for tun/ tap devices
Before tuntap devices would never call the generic `network::query`
method and just return true.

Fixes #1986
2020-01-12 15:03:18 +01:00
patrick96
e43ba9bd3a controller: Stop printing errors for non-unique modules
Functionality-wise reverts the changes from #1534

In #1907 we have decided to allow the same module to appear multiple
times (and deliver actions to all matching modules). But since that PR
will likely take longer to get merged, I want to remove the error from
polybar because the message it prints isn't really true anymore.
2020-01-12 13:08:45 +01:00
Nicholas Baron
8db9c89e0b build: Add -j to build.sh (#1961)
* Added -j and --jobs as command line options

* Added parallelizing option to the set_build_opts function

* Aligned parallel option to the previous options
2020-01-07 16:35:48 +01:00
patrick96
98187debfb font: Show context in unmatched character warning
As suggested by @kronn.

This is a slightly modified patch introduced by @ayosec in their repo
for packaging polybar .deb packages.

Ref: https://github.com/ayosec/polybar-debian
Ref: https://github.com/ayosec/polybar-debian/blob/master/patches/0001-Show-full-contents-when-an-unmatched-character-is-fo.patch
2020-01-07 16:28:07 +01:00
Jérôme BOULMIER
d93a50836d update xpp submodule 2020-01-05 20:20:15 +01:00
patrick96
85721d3d10 doc: Write page for package maintainers. 2019-12-28 21:53:44 +01:00
patrick96
d3d868a08c aur: Update PKGBUILD for 3.4.2 2019-12-28 10:22:34 +01:00
patrick96
5eb293cb71 doc: Add gitter room to issue template chooser 2019-12-27 17:21:14 +01:00
Jeremy Ong
34e742e000 Add missing <stdexcept> header
This is dependent on a PR to xpp that does the same. Newer compilers
(GCC10 in particular) are stricter about which headers provide the
std exception types.
2019-12-25 01:00:29 +01:00
Patrick Ziegler
fdf4d0c1a5 Revert "fix(aur): Add xorgproto package as make dependency"
This reverts commit a902b5a449.
2019-12-25 00:53:21 +01:00
patrick96
1fe679d6b3 fix(ipc): Clear content if no output is produced
Before, if the command produced no output, the `m_output` field would
not have been overwritten and the old output was displayed.

But since this is an explicit trigger of the hook, the user would expect
the output to be updated to whatever the script produces (even if that
is nothing).

Ref: https://www.reddit.com/r/Polybar/comments/e9a8ww
2019-12-23 01:23:40 +01:00
patrick96
a902b5a449 fix(aur): Add xorgproto package as make dependency
xorgproto always was a make dependency (I think) but it was
automatically included indirectly by another dependency.
Arch recently cleaned up some xorg related packages which made xorgproto
no longer an indirect dependency of polybar which spams cmake with
messages like:

```
Package 'xproto', required by 'xau', not found
Package 'xproto', required by 'xdmcp', not found
Package 'xproto', required by 'xau', not found
Package 'xproto', required by 'xdmcp', not found
Package 'xproto', required by 'xau', not found
Package 'xproto', required by 'xdmcp', not found
Package 'xproto', required by 'xau', not found
Package 'xproto', required by 'xdmcp', not found
```

And during `make` finally completely fails the build because some
library's include directories are not honored because the xproto.pc file
cannot be found:

```
In file included from /home/patrick96/Projects/github.com/patrick96/polybar/include/cairo/utils.hpp:3,
                 from /home/patrick96/Projects/github.com/patrick96/polybar/src/cairo/utils.cpp:3:
/usr/include/cairo/cairo-ft.h:46:10: fatal error: ft2build.h: No such file or directory
   46 | #include <ft2build.h>
      |          ^~~~~~~~~~~~
```

Ref: https://bugs.archlinux.org/task/64892
2019-12-22 17:12:49 +01:00
patrick96
63cb05d35d fix(renderer): make center position more robust
The old code didn't really work when the right block was pushing against
the center block. Also `fixed-center` wasn't properly defined. I have
now fixed it to the following:

* `fixed-center = true`: The center block stays at the center of the bar
whenever possible. It can be pushed to the left if the right block takes
too much space and to the right if the left block takes too much space
* `fixed-center = false`: The center block will be in the middle between
the left and right block whenever possible. If there is not enough space
between those two, the center block will be directly to the right of the
left block and pushes out the right block
2019-12-21 15:43:31 +01:00
patrick96
00274c57a9 fix(renderer): Falloff gradient
Before it did not take into account borders or a tray on the left.
It also sometimes rendered the gradient way to large
2019-12-21 15:43:31 +01:00
patrick96
ec2bad004a fix(renderer): Correctly position right block if center is empty
The issue was that it used the position of the center module to
calculate the leftmost possible position of the block. However, if the
center module is empty that position is disastrously wrong.

Fixes #591
Fixes #1903
2019-12-21 15:43:31 +01:00
patrick96
4bc7a09c7e refactor(builder): Remove unused condition parameter
Same as in #1952, the methods are never called with the optional
parameter, except once where it is called with the default value.

Ref: #1952
2019-12-18 21:22:47 +01:00
Tudor Brindus
bc560952e0 cpu: Consider steal time for load calculation (#1955)
* Add steal time to cpu_time struct

* Consider steal time as part of load calculations

* Typo fix
2019-12-16 17:05:18 +01:00
Tudor Brindus
ad3960e050 fix(build): GCC 6.3 discarded qualifiers (#1953)
This fixes the below error:

     /code/polybar/src/components/controller.cpp:110:117:   required from here
     /code/polybar/src/components/controller.cpp:100:60: error: passing ‘const volatile std::shared_ptr<polybar::modules::module_interface>’ as ‘this’ argument discards qualifiers [-fpermissive]
          auto equal_predicate = [](auto& m1, auto& m2) { return m1->name() == m2->name(); };
2019-12-13 00:04:27 +01:00
patrick96
37628f8691 refactor(builder): Remove unused add_space parameter
the `node` and `node_repeat` were never called with the optional
parameter add_space. And its default value is false, so the
corresponding code was never used.

I think in general it is better to just have the user of those functions
call `builder::space` when they need to instead of adding more
complexity to the `node*` functions.
2019-12-12 22:08:34 +01:00
infokiller
fb6e874235 feat(label): Add minlen with alignment (#1546)
* Add label minlen and alignment.

Fix build

* Update src/drawtypes/label.cpp

Co-Authored-By: infokiller <infokiller@users.noreply.github.com>

* Use existing alignment type.

* Remove redundant max_len handling in label::get.

* Fix shadowing.

* Add label alignment tests.

* Handle minlen/maxlen and alignment in same function.

Also add a test for a test case brought up in the PR discussion.

* Format files with clang-format

* Move builder::get_label_text tests into label tests

builder::get_label_text doesn't really do anything anymore

* builder: remove get_label_text

* label: Clean up label::get()

* Fix comment style.

* Set default label alignment to left.

* Update src/drawtypes/label.cpp

Co-Authored-By: Patrick Ziegler <p.ziegler96@gmail.com>

* Update include/drawtypes/label.hpp

Co-Authored-By: Patrick Ziegler <p.ziegler96@gmail.com>
2019-12-01 01:28:41 +01:00
Justin Dubs
70bf0339b8 feat(pulse): Add click-(middle|right) keys (#1941) 2019-11-28 17:36:14 +01:00
patrick96
7f09784548 doc: Add Gitter room
The Gitter room https://gitter.im/polybar/polybar should serve a similar
purpose as the IRC room with the benefit that messages persist and can
be received when offline.

From now on gitter should be the place where the polybar community
lives. Reddit is great for asking longer questions in the style of a
forum but not so great for quick back and forth conversations. IRC is
better in that aspect but has the serious downside that you have to stay
connected to get an answer and messages are not logged (only by your
client).

Both reddit and IRC are here to stay and I will still check them
regularly, but we should encourage people to join gitter.
2019-11-28 11:12:22 +01:00
Jérôme BOULMIER
e5783d4113 Include empty tokens when splitting if necessary (#1893)
Fixes #1881
2019-11-21 22:26:53 +01:00
patrick96
8d3dedc2bd github: Add subreddit as contact link
This is yet another way to steer people towards reddit for questions
instead of using the github issue tracker

Ref: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
2019-11-03 12:55:32 +01:00
patrick96
7ee6093a6e aur: Update maintainer 2019-11-01 14:06:02 +01:00
patrick96
54381fd554 Update PKGBUILD for 3.4.1 2019-11-01 14:06:02 +01:00
patrick96
51184c7ead ipc: Remove unused global setting
None of the payload fields seem to be used. They were the only place
where EVENT_SIZE was used and why it had to be a macro (no variable
length arrays).
2019-11-01 11:12:40 +01:00
patrick96
3ea7600412 build: Move all possible variables into settings.cpp
Anything that doesn't have to be used as a macro
2019-11-01 11:12:40 +01:00
patrick96
100632cce3 fix(http): Pass char* as CURLOPT_USERAGENT 2019-11-01 11:12:40 +01:00
patrick96
6f882ba3b2 build: Move non-macro variables into settings.cpp
Since APP_VERSION is different for every commit and almost all file
include settings.hpp, the whole project has to be rebuilt for every
commit. With this, hopefully, this can be greatly reduced and only
changed files need to be rebuilt. This will also help ccache
2019-11-01 11:12:40 +01:00
Michael Vetter
c6194c06eb Update spec file
Adjust version number.
Add new dependencies.
Explicitly ask for Python 3.
2019-10-31 16:07:00 +01:00
patrick96
6849b8a56b clang-format 2019-10-27 16:02:33 +01:00
patrick96
587dc6c84d bar: Make module separator a label
Some people use text modules instead of the `separator` key in the bar
section to better configure the separator (colors, fonts).
Since we disallowed the same module being used multiple times in #1534,
this will now print an error message.

This should help with this a bit.

Ref #1913
2019-10-27 16:02:33 +01:00
patrick96
a77923ea96 build: drop python2
Ref: https://github.com/polybar/xpp/pull/17
Fixes #1892
2019-10-26 22:29:04 +02:00
patrick96
8b310cc05d fix(build): Ignore noexcept-type for malloc_ptr_t
Since all of polybar is built at once, there is no chance that this is
ever linked to an object that was compiled with another `-std=`

Ref: https://stackoverflow.com/a/46857525/5363071
2019-10-26 22:28:47 +02:00
patrick96
bffec3d8f2 travis: update to bionic
Now we don't have to build xcb-xrm ourselves since it's available in the
repos
2019-10-26 22:28:47 +02: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
fea579ec85 fix(bar): Configure window before remapping
Some WMs like i3 discard position information when unmapping the bar and
because of that the bar would be at the wrong position after being
remapped.

Fixes #1484
Ref: https://github.com/i3/i3/pull/3834
2019-10-21 13:22:51 +02:00
Patrick Ziegler
a119c3386b controller: Print error for duplicate modules (#1534)
* refactor: Use flat module list if possible

Before if you wanted to iterate over all loaded modules you had to first
iterate over all blocks and then over their modules even if you didn't
care about alignment.

* refactor: setup modules in separate function

* controller: Print error for duplicate modules

You can't use the same name twice inside the module lists

E.g.

  modules-left = a b c
  modules-center = a
  modules-right = b

would print an error.

We only print an error for now because we don't want to break existing
configs. But in the future this should be properly enforced.
2019-10-21 10:20:45 +02:00
Matthias Viehweger
52f0623315 feat(xworkspaces): Support occupied workspaces (#882)
A workspace is occupied if it is not active and there is at least one window managed by the WM (`_NET_CLIENT_LIST`) that has set `_NET_WM_DESKTOP` to that workspace.

The behavior when `_NET_WM_DESKTOP` is not set is not yet clear but this is unlikely to happen since most WMs will position windows on some desktop.

Closes #874
Fixes #1444
Fixes #1033 

* Set Desktop OCCUPIED if a window moves there

This covers more of an edge-case. I did this first by accident, it might
vanish later on.

* Replace tracking change of WS with currently used WS

* Untrack occupied workspaces

* Track windows and their desktops in pairs

* Match type of occupied_desktops with current_desktop

Because the index needs to be matched later on, type mismatches would be non-ideal.

* Recreate the occupied desktops everytime and remove duplicates

* Readd support for moving windows to other desktops

* Use less characters to empty the vector

* Rename variable storing the desktops

* Recount windows on every occasion

This alone simplifies the management and the lookup for occupation of a
workspace

* Keep track of number of windows in every workspace

* Add debugging output that shall be removed before merging

* Remove obsolete TODO

* m_client_list should always be diff'd, since the desktop may change

Therefore we update the desktop-count tally every time the client_list
changes. It may just be a desktop-change without a change of
clients.size()...

* Add more logging-spam to understand window/desktop lifecycle

* Lock event-handler to serialize handling of events

* Fix occupied workspace counting and change to bool array

Also, performance improvements when diffing new and old client lists

* Fix crash when all clients are removed

* Conform to linter and styleguide

* Shorten conditional as it is standard enough

Since this only guards against 0-divisions, it can be shortened
without risking too much confusion down the road.

* Guard against multiple threads accessing and modifying data

Fixes #1444

Modification of internal data happens through the handle-method, while
the build-method tries to access the data structures for display. Since
some modifications clear e.g. the m_viewports, references may become
invalid between looping over them an accessing them.

The mutex should guard against this simultanuous access.

* Do not 'adopt_lock', because calls come from very different threads

To my understanding, adopt_lock has some dependency on the mutex-ownership. Since
the lock is once called from the inside (in handle) and once from the outside (in
build), there might be a problem. After brief testing, the segfaults happened fewer
times.

See #1444

* Also listen to _NET_WM_DESKTOP

In order to move a window from one desktop to another, it is sufficient
to set the desktop-property of that window. xmonad fires a lot of events
in the case of moving a window, herbstluftwm only updates the
_NET_WM_DESKTOP-atom of the window.

This change reloads the clientlist in order to correctly set the
desktop state "occupied".

* Describe need and use of mutex

It might be possible to relieve the guard in xworkspaces_module::handle,
but I am unsure about this. Since xmonad emits a lot of events on almost
every minor change, I would let the guard keep its post, avoiding
race-conditions in event-handling.

* Give temporary variables better names

* Clarify purpose of loop

About 80% of this comment are taken from
https://github.com/jaagr/polybar/pull/882#discussion_r255317363

* Remove merge-remainder

* Use a simpler method to list occupied desktops.

Co-authored-by: Jérôme Boulmier <jerome.boulmier@outlook.fr>

* Document m_clients field
2019-10-21 10:00:38 +02:00
Jake Howard
4ab251f33c temperature: Use format-warn at warn-temperature not after (#1897) 2019-10-16 18:45:49 +02:00
julio-b
751c21cd37 feat(pulse): Show volume in decibels (#1894)
Adds `%decibels%` token to the pulseaudio module
2019-10-09 02:13:57 +02:00
patrick96
1fc6942482 fix(ipc): Update bar when making bar visible
While an update was forced whenever polybar was made visible, the
`m_lastinput` variable was still set to the same value as when the bar
became hidden because updates to it were prevented.

Fixes #1875
2019-10-03 22:49:19 +02:00
Matthias Viehweger
b162e17583 Add Code Triage-Badge
I added the repo to code triage to get regular mails about open issues of polybar.
2019-09-28 13:51:30 +02:00
Hayden Sartoris
3e83fb9fb2 net: Don't disable when linkspeed not detected (#1772)
Shows "N/A" instead.

Fixes #1211
2019-09-27 17:01:45 +02:00
patrick96
99e823bd0a fix(file): Don't add slash to relative path
This fixes a regression introduced in
56e24992df where relative config file
paths weren't recognized because file_util::expand just added a slash
to the beginning.

That is calling `polybar -c config example` would try to load the config
file at `/config` instead of using the relative path as before.

In all other cases where expand is used this change shouldn't matter
because polybar only accepts absolute paths everyhwere else.
Theoretically this would now allow relative paths (relative to the cwd
where polybar was called) but this shouldn't used (or documented)
because that behavior will change when merging #1523 which would make
paths relative to the polybar config.

Ref #1523
Ref 56e24992df
2019-09-27 16:58:03 +02:00
patrick96
5a309f0e33 fix(aur): Add sphinx as a build dependency 2019-09-18 16:22:23 +02:00
patrick96
4ea188b3f9 fix(modules): Only add reset tag on non-empty modules
Adding the reset tag to empty modules makes polybar add margins and
separators for that empty module.

Fixes #1857

Ref #1596
2019-08-22 22:42:30 +02:00
patrick96
211b0bbfd8 Incorporate Reviews 2019-08-06 21:36:20 +02:00
patrick96
57d364a2fc Reset all tags at the end of a module
The %{PR} tag is introduced for this. It resets all colors as well as
the activation of the underline and overline and font.

This has become necessary because we don't track what raw tags a user
injects into the formatting string and otherwise their raw tags could
bleed through.

This doesn't touch action tags because even before raw action tags
weren't being tracked. Action tags also have the requirement that they
have to be used in pairs, so closing them prematurely could break things
(for example with click actions for the entire bar)
2019-08-06 21:36:20 +02:00
patrick96
928cd92a4f refactor(builder): Don't track raw tags
When adding a string to the builder directly, it would parse the string
for formatting tags, delete them and readd them with the methods in the
builder that keep track of open tags so that we can properly close them
when flushing.

This parser has a bug, it parses multiple formatting tags in a single
block as a single tag, e.g.

  %{F#000000 u#FFFFFF +u}

would be parsed as an `F` tag with value `#000000 u#FFFFFF +u` which is
of course wrong.

Removing the parsing step fixes this problem in the simplest way
possible. This has two benefits:
* Building of modules is sped up because we don't have to do the parsing
step in the builder and many modules use this function to add strings
from a progressbar (which already has properly closed tags).
* We don't have parser logic in two places. Until now both `parser.cpp`
and `builder.cpp` actually parsed formatting tags. This leads to a lot
of code duplication and, as we've seen, bugs.

All of the modules that use this function to add text already make sure
that they properly close formatting tags (mostly by using the builder to
generate the strings)

NOTE: This change slightly changes polybar's behavior. Raw tags (tags
added by the user through the config) can now have their effects reach
neighboring modules because the builder doesn't track and thus doesn't
close them on each flush. This can (and will) be resolved by resetting
all tags at module borders.

Fixes #1555
2019-08-06 21:36:20 +02:00
patrick96
ddb40db490 builder: Cleanup label over-/underline handling
There really is no reason to also close over/underline tags when we have
a right margin and a non-black over/underline color.
The git blame for these lines also doesn't give us any insights as to
why it was done this way.
2019-08-06 21:36:20 +02:00
patrick96
3ebb0b0b03 builder: Simplify open tag tracking
Using a bit vector to track the active attributes does not really give a
significant speed increase, especially for only two attributes

Checking if a syntaxtag or an attribute exists in the map just adds
unnecessary code
2019-08-06 21:36:20 +02:00
patrick96
f967cd5f59 builder: remove BUILDER_SPACE_TOKEN
Was around since the first commit but no documentation why. It was only
used in the text module and doesn't appear in any public documentation,
so this doesn't break anything.
2019-08-06 21:36:20 +02:00
Patrick Ziegler
56e24992df config_parser: Introduce stricter syntax conventions (#1377)
This is the next step to merge #1237 in stages.

Currently there are barely any restrictions on how the config can be
written. This causes things like config files with DOS line endings to
not be parsed properly (#1366) because polybar splits by `\n` and when
parsing section headers, it can't deal with the `\r` at the end of the
line and thus doesn't recognize any section headers.

With this PR we introduce some rules as to what characters are allowed
in section names and keys.
Note: When talking about spaces I refer to any character for which
`isspace()` returns `true`.

The rules are as follows:
* A section name or a key name cannot contain any spaces as well as any
of there characters:`"'=;#[](){}:.$\%`
* Spaces at the beginning and end of lines are always ignored when
parsing
* Comment lines start with `;` or `#` and last for the whole line. The
whole line will be ignored by the parser. You cannot start a comment at
the end of a line.
* Section headers have the following form `[HEADER_NAME]`
* Key-value lines look like this:
`KEY_NAME{SPACES}={SPACES}VALUE_STRING` where `{SPACES}` represents any
number of spaces. `VALUE_STRING` can contain any characters. If it is
*surrounded* with double quotes (`"`), those quotes will be removed,
this can be used to add spaces to the beginning or end of the value
* Empty lines are lines with only spaces in them
* If the line has any other form, it is a syntax error

This will introduce the following breaking changes because of how
underdefined the config syntax was before:
* `key = ""` will get treated as an empty string instead of the literal
* string `""`
* Any section or key name with forbidden characters will now be syntax
errors.
* Certain strings will be forbidden as section names: `self`, `root`,
* `BAR`. Because they have a special meaning inside references and so a
* section `[root]` can never be referenced.

This replaces the current parser implementation with a new more robust
one that will later be expanded to also check for dependency cycles and
allow for values that contain references mixed with other strings.

This PR also now expands the config paths given over the command line so
that `--config=~/.config/polybar/config` resolves properly.

Closes #1032
Closes #1694

* config_parser: Add skeleton with tests

First step in the config_parser develoment. Only tests functions that
are easily testable without many outside dependencies. Integration tests
will follow.

* config_parser: Implement parse_header

* config_parser: Implement get_line_type

* feat(string): Add trim functions with predicate

Not only trimming based on single character matching but based on a
freely specifiable predicate. Will be used to trim all spaces (based on
isspace)

* config_parser: Implement parse_key

* config_parser: Implement parse_line for valid lines

* config_parser: Throw exception on invalid lines

* config_parser: Remove line_no and file_index from parse_line

Cleaner to let the caller catch and fill in the line number and file
path

* string: Clear up misleading description of trim

Before, trim would remove all characters that *didn't* match the
predicate and thus the predicate isspace wouldn't work correctly. But
because we used the inverse (isnospace_pred) it all worked out, but if
the function was used with any other function, it wouldn't have given
the desired output

* config_parser: Implement parse_file

* config_parser: Switch operation to config_parser

This changes the way the config is invoked. Now main.cpp creates a
config_parser object which then returns the singleton config object from
the parse method. Subsequent calls to config::make will return the
already created config object as before

The config_parser does not yet have all the functionality of the old
parser: `inherit` directives are not yet resolved. Other than that all
the old functionality is implemented (creating sectionmap and applying
include-file)

Any sort of dependency detection (except for include-file) are still
missing

* config: Move xrm initialization to constructor

config_parser handles the detection of xrdb references and passes that
info to the config object.

This finally allows us to delete the config::parse_file function because
everything in it has been implemented (except for xrdb detection and
file error handling)

* refactor(config_parser): Cleanup

* config_parser: Set config data after initialization

Looks much cleaner this way

* config_parser: Expand include-file paths

* config_parser: Init xrm if the config uses %{xrdb references

* config_parser: Use same type of maps as in old impl

Polybar has some weird, not yet fixed, inheriting behaviour and it
changes depending on the order in which the config stores its data.
Using the same type of maps ensures that the behaviour stays the same.

* refactor(config_parser): Clearer invalid name error message

* config_parser: Don't allow reserved section names

Sections with the names 'self', 'BAR', 'root' could never be referenced
because those strings have a special meaning inside references

* config_parser: Handle inherit directives

This uses the old copy_inherited function, so this still suffers from
crashes if there are cyclic dependencies.
This also fixes the behaviour where any key that starts with 'inherit'
would be treated as an inherit directive

* config_parser: Clearer dependency cycle error message

* refactor(config_parser): Handle file errors when parsing

This removes the need to check if the file exists separately

* fix(config): expand config file path

Now paths using ~ and environment variables can be used as the config
path

* fix(config): Properly recognize xrdb references

* config_parser: Make messages more informative

* doc(config): Improve commenting

Comments now describe what the config_parser actually does instead of
what it will do.

We also now follow the rule that single line comments inside functions
should use `//` comments

* refactor: Move else on same line as curly braces

* fix(config_parser): Don't duplicate paths in `files`

* refactor(config_parser): Use else if for clarity

* fix(config): Undefined behavior in syntax_error

Before the custom what() method produced undefined behavior because the
returned string became invalid once the function returned.

* refactor(config): descriptive name for useless lines

is_valid could easily be confused as meaning syntactically invalid
without it being clarified in a comment

* refactor(config): Use separate strings instead of key_value

Takes just as much space and is much better to read

* fix(config_parser): TestCase -> TestSuite and fix macro call

Ref: #1644

* config_parser: use const string& in method args

* config_parser: Improve comments

* config_parser: Incorporate review comments
2019-08-06 19:41:31 +02:00
Jérôme BOULMIER
58d72c4f19 feat(github): add support for github enterprise (#1841) 2019-08-04 20:58:25 +02:00
x70b1
12a47fe72e travis: create an irc one-liner (#1846) 2019-08-04 17:39:05 +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
patrick96
2b691af41e aur: Make feature deps hard deps
In the AUR optdepends means that the package can run without optdepends
installed. In polybar most features, if enabled at compile time, cannot
run without their dependencies and will crash polybar. Now the
optdepends only contains truly optional dependencies.

Polybar can run without the i3-wm package because it only relies on the
`i3` executable and is not dynamically linked against any library in i3.
2019-07-31 00:37:05 +02:00
patrick96
fe7dc28b07 Update PKGBUILDs for 3.4.0 2019-07-24 20:57:39 +02:00
patrick96
91652736ae Release 3.4.0
Breaking Changes:

* In the `internal/memory` module all of the megabyte values no longer have decimal places (#1606).

Changelog

**New Config Options**
The following config options were added:

In the `[bar/*]` section:

* `monitor-exact`, use exact name matching for monitors otherwise ignore dashes.

In formats:

* `format-NAME-font` to set the font for that format (same as `label-NAME-font`)

In `internal/bspwm`:

* `label-marked` for the new `marked` node flag introduced in baskerville/bspwm@d0138af

In `internal/xkeyboard`:

* `label-indicator-(on|off)` is used once for every indicator (caps lock, etc.), supports `%name%` and `%icon%`
* `label-indicator-(on|off)-(capslock|numlock|scrolllock)` overwrites `label-indicator-(on|off)` for the given indicator
* `layout-icon-*` is a list that maps layout names to icons to be used with the `%icon%` token in `label-layout`
* `indicator-icon-*` is a list that maps indicator names to icons to be used with the `%icon%` token in `label-indicator-*`

In `internal/temperature`:

* `base-temperature` is the counterpart to `warn-temperature` and controls the lower bound for the ramp.

**Deprecations**

* xkeyboard: `label-indicator` is deprecated in favor of the new `label-indicator-on`

**Features**

* bar:
    * make exact monitor matching configurable (#1533), see #1532
    * `border-size` now supports the same mixed percentage/pixel sizes as `width` and `height` (#1592), see #1567
    * Use primary monitor if no monitor is specified (#1426), #1412
* bspwm: Support for the new `marked` node flag. (#1557), see #1552
* format: Formats now support the `-font` property just as labels (#1602), see #19
* network: Support for all tokens in all labels (#1597)
* xkeyboard: Indicator names can be customized. Also adds icon mappings for layouts and indicators (#1559, #1048), see #1558
* temperature: The ramp now starts at `base-temperature` instead of 0°C (#1706), see #1703
* battery: `%percentage_raw%` token that displays the real percentage regardless of `full-at` (#1756), see #1753

**Fixes**

* network: Display `N/A` when no IPv4 address can be found (#1597)
* xworkspaces: Properly handle when desktops are removed from `_NET_DESKTOP_NAMES` (#1713), see #1710
* backlight: Read the right brightness value (#1689), see #1180
* pulseaudio: Allow volume increase when it is close to the maximum. Before it did not allow that when adding `interval` would go over the max. (#1765)
* i3: fix workspace change for workspaces with special characters in the name  (#1798), see #1797
* font: Characters no longer vanish when the `size` or `pixelsize` property is 0 (#1646)
* build:
    * Compilation error under gcc9 (#1729), see #1728
    * Compilation no longer fails when new flags are introduced that produce new warnings (#1735)
2019-07-24 15:42:04 +02:00
Patrick Ziegler
f0c65e6cf0 fix(config): Allow empty string as ref fallback (#1831) 2019-07-01 23:33:01 +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
Brice Waegeneire
0740382851 fix(msg): use stdout when exiting with code 0 2019-06-19 16:09:56 +02:00
Jérôme BOULMIER
c650513b67 fix(i3): Surround ws names with quotes (#1798)
Fixes #1797
2019-06-04 23:34:16 +02:00
patrick96
5be532c51b refactor(font): More robust font size calculation
Originally the size function returned the scaled `size` property for
scalable fonts and the non-scaled `pixelsize` property for non-scalable
fonts. This caused lots of issues when that property was 0 (empty bars,
characters not drawn without warning, see references at the bottom).
This behavior was mostly observed on debian where `size` is set to 0 if
`pixelsize` is set.

We now try to use both properties for both types, but prefering `size`
for scalable fonts and `pixelsize` for non-scalable ones.

This behavior doesn't break existing correct behavior but now never
returns 0. It will always try to fall back to the other property or to
some fallback value if both properties are 0.

I originally thought this could also make font patterns more expressive
by being able to specify the size of scalable fonts directly in pixels
like so:

  Unifont:size=0:pixelsize=20

or to scale non-scalable fonts by forcing polybar to fall back to the
`size` property (which is always scaled):

  Wuncon Siji:pixelsize=0:size=20

But how these two patterns are matched by `fc-match` depends both on the
font and on the distro/fontconfig setup.

Ref #706
Ref #1450
Ref #1257
2019-06-03 00:49:48 +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
patrick96
2b0bf463b1 config: Remove bspwm variable references
This confuses lots of people when removing the bspwm module from the
sample config and trying to use the i3 module
2019-06-02 15:36:26 +02: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
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
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
Sebastian Graf
cb75857ff6 pulse: Set volume to max when the increase was too huge (#1765)
Previously, when volume was in close proximity to n_max_volume, a larger
increase would not do anything. After this patch, volume is set to
m_max_volume in such scenarios. If the volume already is at
n_max_volume, we mirror the old behavior and emit a warning.

So, for example, consider m_max_volume was 100%, but the volume prior
to the increase was 96%. An increase of 5% would do nothing (emit a
warning, even) instead of setting the volume to 100%.

Note that this might happen even if the volume is at 95% according to
%percentage% due to rounding errors.
2019-05-14 22:06:14 +02:00
Roberto Santalla
b2b73b5d91 feat(battery): add %percentage_raw% token (#1756)
Displays real percentage instead of being set to 100 if percentage > full-at

* battery: added percentage_raw token, which ignores full-at

* battery: current_percentage returns raw, added clamping function instead

* battery: clamp percentage used by build()
Made clamp_percentage() const to allow its usage inside build()

* battery: read and return percentage in one line
2019-05-14 15:01:54 +02:00
patrick96
65e72fd71e travis: Build documentation 2019-05-10 08:14:02 +02:00
patrick96
4c0117528e build: Allow doc to build as its own project
We can now build the docs without having to have installed all
dependencies for polybar.
2019-05-10 08:14:02 +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
37a7ad9c44 migration: Update submodule URLs 2019-05-08 12:20:33 +02:00
patrick96
4cc836fa66 migration: Update URLs
jaagr/polybar -> polybar/polybar

Travis changed their url for new projects to travis-ci.com
2019-05-08 12:20:33 +02:00
Sergi Jimenez
9f7840c7d6 fix(build): Uninitialized local variable (#1759)
Fixes #1758
2019-05-05 22:09:03 +02:00
patrick96
f1061e1217 doc: add rtd badge 2019-04-24 08:11:27 +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
f68a5e6ccf build: Add build type specific flags to -vvv 2019-04-24 08:11:13 +02:00
patrick96
d5112c9b66 git: Remove include .gitignore
The settings.hpp file is now generated in the build folder and doesn't
need to be included in the gitignore

Ref #1726
2019-04-08 09:01:48 +02:00
patrick96
0ab9fcdc38 refactor: Remove all mentions of icon_t
Is exactly the same label_t
2019-04-08 09:01:48 +02:00
patrick96
148d46b65b build: Remove Makefile from root
Does basically the same as build.sh
2019-04-08 09:01:48 +02:00
patrick96
d1fe97b90f git: Clean up gitignore
Each directory is responsible for ignoring files
2019-04-08 09:01: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
Kazufumi NOTO
7414e98008 feat(temp): Configurable lower bound for ramp (#1706)
Similar to warn-temperature, temps below `base-temperature` will use the first ramp icon.

Closes #1703
2019-04-07 18:36:09 +02:00
Jérôme BOULMIER
fca4151f36 fix(window): remove useless operator= and add default copy cstr (#1729)
Fixes compilation under GCC 9

The default copy constructor implicit generation is deprecated by C++ standard.

The window& operator=(const xcb_window_t win); operator seems to be useless.

Fixes #1728
Ref jaagr/xpp#16
2019-04-07 17:32:55 +02:00
Jérôme BOULMIER
627c4ac2af fix(brightness): reading brightness in actual_brightness (#1689)
As the kernel documentation said:
https://www.kernel.org/doc/Documentation/ABI/stable/sysfs-class-backlight

    This file will also show the brightness level stored in the driver, which may not be the actual brightness (see actual_brightness).

Therefore the brightness value should be read in the actual_brightness file.

Fix #1180
2019-04-07 17:04:55 +02:00
patrick96
7d0c6300f6 cmake: put version string into version.txt 2019-04-05 23:43:37 +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
3111bee143 doc: Remove sphinx theme from readme
For local previews the sphinx_rtd_theme is not used, only in read the
docs.
2019-04-05 23:43:37 +02:00
patrick96
aec34c11f1 aur: Add python-sphinx to polybar-git makedepends
Not yet to 'polybar' package that will be done in the next release
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
73de9257a1 refactor(cmake): Remove unused querybin 2019-04-05 23:43:37 +02:00
patrick96
1ed8ddd251 travis: Disable doc generation
Travis doesn't have sphinx installed by default and it's also the wrong
version for our documentation
2019-04-05 23:43:37 +02:00
patrick96
a1cccef251 refactor(doc): Use default theme for local builds
The sphinx_rtd_theme takes up about 7.8MB because it includes a lot of
fonts. The default theme only takes 600KB
2019-04-05 23:43:37 +02:00
patrick96
754673bff8 refactor(cmake): Make documentation optional 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
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
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
800d24c92f doc: Add readme with local preview instructions 2019-04-05 23:43:37 +02:00
patrick96
166f704e58 doc: Install rst based man pages 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
c841bd512c doc: Build doc with cmake
Run `make doc` inside the cmake build folder.

The html output is installed to
${CMAKE_INSTALL_PREFIX}/share/doc/polybar
2019-04-05 23:43:37 +02:00
patrick96
7809be8d58 doc: Setup in-repo documentation 2019-04-05 23:43:37 +02:00
Jérôme BOULMIER
57b8fcc7cd refactor(cmake): move generated files in build directory (#1726) 2019-04-04 22:53:54 +02:00
Patrick Ziegler
cff13214ff fix(aur): Patch release in polybar-git package (#1724)
The polybar-git PKGBUILD should not be updated for patch releases
2019-04-03 08:07:47 +02:00
Patrick Ziegler
253f44caaa aur: Update to 3.3.1 (#1723) 2019-04-03 07:53:34 +02:00
DrunkenChicken
25f99c0a61 fix(xworkspaces): active ws upon ws deletion (#1713)
Active desktop was tracked via it's index, but when desktops are removed from `_NET_DESKTOP_NAMES` that index may become invalid.

Fixes #1710
2019-04-01 18:04:44 +02:00
Jérôme BOULMIER
31a25af3d3 fix(tray): fix offset for negative percentage (#1669)
tray-offset-{x,y} were clamped between [0, max_value] rather than [-max_value, max_value]. Therefore negative percentage were ignored.

Fixes #1666
2019-03-22 09:55:08 +01:00
Kazufumi NOTO
82b9ea8a09 fs: Fix incorrect size report on 32bit machines (#1699)
Cast before multiplication to avoid overflow.

Fixes #743
2019-03-18 18:16:42 +01:00
patrick96
5995a8dace readme: Feature subreddit and irc more prominently 2019-03-13 21:03:28 +01:00
patrick96
07913058fb Clearly separate issue and bug reports
The issue tracker should be for bugs only. Right now actual bugs can
easily fall through the cracks because we get stuck answering questions
and basically providing tech support.

This move is also intended to have more traffic to our subreddit and IRC
channel with the hope that the community can also help itself out.
2019-03-13 21:03:28 +01:00
patrick96
914ec3e102 github: Add distro to bug report template 2019-03-13 21:03:28 +01:00
Jérôme BOULMIER
e3b84c9595 fix(controller): ignore SIGUSR1 until polybar is fully reloaded. (#1678)
To avoid polybar from being killed by SIGUSR1 during reloading, SIGUSR1 is ignored until the signal is registered in the new polybar process.

As stated in signal(7) man page, the ignored signals are still ignored after a call to a function of the execvX family.

    During an execve(2), the dispositions of handled signals are reset to the default;
    the dispositions of ignored signals are left unchanged.

Fixes #428
2019-03-13 07:55:02 +01:00
patrick96
b3f7cd08e9 fix(xkeyboard): Only update indicators when used
Was causing a segfault if `format = <label-layout>`
2019-03-06 20:29:12 -08:00
patrick96
de3240b861 fix(xkeyboard): Print deprecation message
`config::warn_deprecated` does not accept keys of the form `<...>` and
strips the surrounding brackets like `load_label` does
2019-03-06 20:29:12 -08:00
patrick96
fbd870c343 fix(xkeyboard): Use correct indicator label field
Fixes #1660
2019-03-06 20:29:12 -08:00
Jérôme BOULMIER
25ef0299cb fix(tray_client): remove copy ctor & assignment operator (#1675)
tray_client class contains a reference so copy assignment operator is implicitly deleted.
the dtor unembed the window so copying the class could lead to bug so the copy ctor is also deleted.

Fixes #1674
2019-03-06 09:00:11 +01:00
Gilad Naaman
db9a83a83b feat(xkeyboard): Customizable indicators and layouts (#1559)
* `layout-icon-*` list that maps layouts to icons.
* `indicator-icon-*` list that maps indicators to off and on icons
* `label-indicator-off`
* `label-indicator-on` which replaces the now deprecated `label-indicator`
* `label-indicator-[on|off]-*` for each indicator. Overrides `label-indicator-on` and `label-indicator-off` 

Fixes #1558 
Closes #1048

* add icon support for xkeyboard layouts

* removed unneeded #include

* add sperate %icon% token that can be used in <label-layout>

* removed unneeded #include

* added caps lock indicator (was mentioned in wiki, but not actually implememnted) and support for indicator icons

* a few more fixes to make sure existing user configs are not broken

* ready to go

* Added an option to replace xkb indicator names

* Added labels for each indicator state

* Removed print left on accident

* Fixed review comments

* Update src/modules/xkeyboard.cpp

Co-Authored-By: Gilnaa <gilad@naaman.io>
2019-02-24 22:35:39 +01:00
Patrick Ziegler
7d4e62f6d3 git: Remove pre-commit hook (#1659)
The README no longer contains version information and we are moving away
from using scripts and tooling to update the version string in various
places, see #1540
2019-02-23 08:55:30 +01:00
Zack Craig
e1e27dfcad readme: Mention sample config location (#1658)
* Update readme on installing example config

IF you isntall via a package manager, it's a bit trickier to get the default config, I found myself reading the sourcecode for the makefile to figure out where it came from.

On arch, at least, a copy is stored in `/usr/share/doc/polybar/config`, I assume this is the same for most distros, so I figured i'd add that snippet to the readme

* Make requested changes
2019-02-20 19:19:56 +01:00
Patrick Ziegler
ea7399decc git(xpp): Update submodule ref (#1647)
This fixes the link failure when configured with -DBUILD_SHARED_LIBS=ON
as reported in #1628. xpp will now always build a static lib

Ref jaagr/xpp#15
2019-02-18 15:52:34 +01:00
striker.sh
ca4426a962 fix(xworkspace): Fully support _NET_DESKTOP_NAMES spec (#1579)
Ref https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472706208

Fixes #1491
Fixes #248
Closes #904
2019-02-08 13:32:31 +01:00
patrick96
6d3b323f16 refactor(gtest): TestCase->TestSuite
googletest deprecated the TEST_CASE terminology in
3a460a26b7a91abf87af7f31b93d29f930e25c82
2019-02-07 10:20:08 +01:00
patrick96
9e595d388e fix(gtest): INSTANTIATE_TEST_CASE_P with zero variadic arguments
Due to google/googletest#1419 [1], we had to add a comma after the last
argument of INSTANTIATE_TEST_CASE_P.

This was "fixed" in a backwards incompatible way in the googletest
project in 7c4164bf404d899b6d4c74beb1070da5647f55a2

[1]: https://github.com/google/googletest/issues/1419
2019-02-07 10:20:08 +01:00
patrick96
b636baf082 signal_emitter: Don't swallow exceptions
If any signal receiver throws an exception for any reason after
receiving a signal, no one would find out about it because the signal
emitter just ignored exceptions

Also actually delivering the signal caused some exceptions because not
all signals have a receiver.

Resolves #1593
2019-02-05 11:50:57 +01:00
patrick96
b3ceedde76 refactor(bar): Remove bar_settings.center
Not used anywhere
2019-02-05 11:50:25 +01:00
sysek
f148f16da7 readme: Change openSUSE link to official url (#1636) 2019-01-31 09:04:25 +01:00
Michael Vetter
0ec4e54c6c contrib: Add rpm spec file (#1633) 2019-01-29 20:10:31 +01:00
Joost Sijm
8ca36d9e16 typo: replace 'alot' with 'a lot' (#1634)
This is bothering me alot
2019-01-29 17:54:38 +01:00
Patrick Ziegler
a7ad68da31 fix(randr): Check if there is a primary monitor (#1621)
* fix(randr): Check if there is a primary monitor

primary_info.name() throws an error if get_output_info is called with
XCB_NONE

Fixes #1620
2019-01-24 21:17:35 +01:00
NBonaparte
1145681cf5 feat(monitor): use primary monitor as default (#1426)
If the monitor option isn't set, the primary monitor (if connected) is chosen as the default display.
2019-01-20 11:20:30 -08:00
patrick96
b03f14400a fix(net): buffer overflow when gathering ipv6 addr 2019-01-20 15:12:22 +01:00
patrick96
9aefbd5d34 build: Add UndefinedBehaviorSanitizer 2019-01-20 15:12:22 +01:00
patrick96
286eac393c tests: Build and run all tests with make check
Simplifies the building and running of tests

Also exports the proper env variables so that the googletest output is
colored

ctest can use env variables for some of its options so we can for
example run
  CTEST_PROGRESS_OUTPUT=1 make check
to run ctest with the --progress flag

This also makes the travis test.sh script obsolete
2019-01-20 15:11:14 +01:00
Benno Fünfstück
f74c524fff fix(renderer): Handling of missing root pixmap (#1608)
Polybar had issues when there is no background set or set by a tool like imagemagick which doesn't add the root pixmap to the root window properties.

There's not much we can do about it, but at least polybar doesn't crash anymore.

Fixes #1582 
Fixes #1585 

* fix(tray_manager): only enable transparency if neccessary

Previously, we always enabled transparency

* fix(background_manager): avoid needless fetching

* fix(renderer): move logging message to correct place

* fix(background_manager): handle dummy pixmap (_XSETROOT_ID) right

* fix(background_manager): more initialization + don't free on error

Freeing on error is incorrect, since we could still be called again later in
which case we still need the resources.

* fix(background_manager): add more infos to trace logs

* fix(background): correct typo (XROOTMAP -> XROOTPMAP)

* fix(background_manager): do not report "no background" as error

* style(background_manager): use braces for if

Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>

* fix(background_manager): better error message for dummy pixmap

Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>

* style(background): some more style fixes

* fix(connection): initialize pixmap in all cases in root_pixmap()

* style(connection): improve readability using early return
2019-01-17 14:22:48 +01:00
patrick96
01be9b3504 feat(net): All tokens for all labels
If you have `accumulate-stats = true` it is useful to be able to display
the current network speed even if the interface is disconnected.
2019-01-17 08:35:49 +01:00
patrick96
014606294c fix(net): Display N/A when no ipv4 address 2019-01-17 08:35:49 +01:00
Patrick Ziegler
921658f331 memory: Remove decimal places for megabytes (#1606)
As requested in #1598

Two decimal places for megabytes gives you precision at the scale of tenths of kilobytes, which is quite unnecessary for RAM
2019-01-17 08:32:42 +01:00
patrick96
a0b888b5e6 fix(fs): Calculate free bytes properly
Seems this was missed in a682d2af91

This is now also consistent with what df does

Closes #743
2019-01-17 08:31:48 +01:00
patrick96
67f1ceaaca feat: format-font
Resolves #19
2019-01-17 08:31:14 +01:00
Ddone
46b8bb84ed feat(border): Percentage and pixel offset (#1592)
Uses the same X%:Z format as width, height and offset-*

Resolves #1567
2019-01-12 11:48:09 +01:00
Ddone
b728fea5be fix(i3): crash without <label-state> (#1591)
Fixes #975
2019-01-09 18:38:44 +01:00
patrick96
4a506d429d xbacklight: Use monitor-strict from bar settings
monitor-strict in the xbacklight module was never documented anywhere so
it's fine to remove it.
2019-01-08 17:23:28 +01:00
patrick96
e793082008 randr: Add separate key for exact monitor matching
This adds `monitor-exact = true` in the bar section

This also properly does best-match instead of first-match if multiple
matches exists. For example if there are two monitors HDMI2 and HDMI-2
and we try to match HDMI-2 with monitor-exact = false, until now HDMI2
would be matched. Now exact matches are always preferred.

Fixes #1532
2019-01-08 17:23:28 +01:00
patrick96
ea5fc22c7d travis: Upgrade to xenial
This travis environment contains more up-to-date versions of clang and
gcc (namely 7.0.0 and 5.4.0). This allows us to remove all the code used
to get those newer versions in trusty.

Ref: https://docs.travis-ci.com/user/reference/xenial/
2019-01-08 17:15:06 +01:00
patrick96
fe0b072dd0 feat(bspwm): Support marked flag for focused nodes
This adds a new label in the bspwm module `label-marked`

This flag for focused nodes of a focused desktop was introduced in [1]
and released with bspwm 0.9.4

It adds the `M` flag to `G` type items in bspwm's report format

Resolves #1552

[1]: d0138af475
2019-01-08 17:14:39 +01:00
patrick96
21188bca24 aur: fix tar url 2019-01-08 17:08:32 +01:00
patrick96
b22efd1fd9 build: Add build instructions for tar file 2019-01-08 17:00:53 +01:00
patrick96
8bca79f561 aur: Use tar file for polybar package
We provide the polybar.tar as part of our release process so it is more
efficient to let users build directly from the uploaded archive
2019-01-08 17:00:53 +01:00
Patrick Ziegler
84a92d2a1c github: Ask about regressions in bug reports (#1587)
Often it would be useful to know if something broke after an update or
if the bug was there from the beginning
2019-01-08 16:59:44 +01:00
Benno Fünfstück
7256366112 fix(tray): correctly handle transparency when using offset (#1571)
This patch adds support for observing multiple slices of the desktop background.
This is used for the tray so that it doesn't have to rely on the bar's rect to
get the desktop background. In particular, it now handles the case where the
tray is not contained fully within the bar's outer rect (for example, when using tray-offset-{x,y})

Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>
2019-01-05 01:08:18 +01:00
Matthias Viehweger
dec801a114 fix(xworkspaces): FPE when no _NET_DESKTOP_NAMES (#1576)
Fixes #1462
2019-01-03 18:59:55 +01:00
Patrick Ziegler
c3ef99b719 Release 3.3.0 (#1543)
### Breaking Changes:
None

### Changelog

**New Config Options**
The following config options were added

In the `[settings]` section:
* `pseudo-transparency`

In `internal/cpu`:
* `ramp-coreload-spacing`, spacing between elements in `<ramp-coreload>` elements
* `%percentage-sum%` in `label`. Shows sum of all percentages

In `custom/script`:
* `double-click-left`
* `double-click-middle`
* `double-click-right`

In `internal/pulseaudio`:
* `interval`, volume increase and decrease steps in percentage points

In `internal/memory`:
* `bar-swap-used`
* `bar-swap-free`
* `ramp-swap-used`
* `ramp-swap-free`

**Deprecations**
* `tray-transparent` in the bar section is no longer used. The tray now always uses pseudo-transparency

**Features**
* volume: adjustable volume steps (#1364), see #1361
* memory: Add progress bars and ramps for swap (#1325)
* render: pseudo-transparency (always used in the tray)  (#595)
* cpu: 
    * Configurable spacing in between coreloads (#1472), see #1389
    * Non-normalized cpu load (#1517), see #1516
* script: Double click actions (#1442)
* net: Support for bridge interfaces (#1528), see #1522
* token: zero pad tokens when min-width value starts with a `0` (#1341), see #1332

**Fixes**
* config: Use font patterns detected on system in sample config (#1350)
* net: Disconnected module when SSID is only an emoji (#1371), see #1367
* tray: Tray overlapping with bar (#1392), see #591
* build: Several build errors (#1395, #1454, #1470, jaagr/xpp#12, #1493), see #1447, #1469, #750, #1492
* mpd: format-online-prefix not working (#1402), see #1399
* font: Crash for some font-patterns (#1451), see #1435
* script: 
    * Only `%counter%` or `%pid%` token usable, never both (#1456)
    * click actions with colons in them (#1457), see #984
* renderer: Bar locks up when xorg composite extension is disabled (#1430), see #1425
2018-12-23 21:36:30 +01:00
infokiller
bc9eddfcae fix(git): Don't ignore build.sh (#1545) 2018-12-12 21:27:46 +01:00
Sergey
cc8947ac01 feat(cpu): Add percentage-sum token (#1517)
Adds `%percentage-sum%` token to cpu label that contains the cumulative load of all cores.
2018-12-03 01:48:18 +01:00
NBonaparte
35c0c4a343 fix(xcb): check for composite extension (#1430)
* fix(xcb): check for composite extension

* fix(travis): add xcb-composite to deps

* fix(xcb): always include composite when building
2018-12-02 16:39:14 +01:00
patrick96
9725f8fb04 coverage: Allow small drops in coverage
Most PRs change code where no tests have been written so far and where
adding tests is difficult. Codecov fails all those PRs.

These values should be adjusted once we have better integrated testing
into our workflow and have written better testing infrastructure for
modules and very tightly coupled components
2018-11-30 11:55:31 -08:00
patrick96
6f88fe11a9 fix(man): Add correct date and version to manpage
The previous approach relied on manually updating the version and date
using a Makefile

This approach dynamically gathers the correct version from git and uses
the date of the latest commit in the branch
2018-11-30 11:50:40 -08:00
patrick96
669469f149 man: Remove manpages Makefile
Wasn't used in the build process
2018-11-30 11:50:40 -08:00
sunil
22af69545a feat(net): Support bridge interfaces (#1528)
Bridge interfaces don't provide linkspeed via ethtool but everything else works the same as with ethernet links.

Fixes #1522
2018-11-28 16:09:00 +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
f8e4a5932a refactor: Unescape action cmd before emitting 2018-11-16 18:12:26 -08:00
patrick96
38f551f884 test(parser): Add tests for parse_action_cmd 2018-11-16 18:12:26 -08:00
patrick96
18e2609f11 fix(builder): Escape all colons in action command
Fixes #984
2018-11-16 18:12:26 -08:00
Denis Kasak
fa693aecf8 feat(script): Add double-click to script module (#1442) 2018-11-16 16:06:04 +01:00
Matthew Treadwell
bf0b663549 Center logo and badges (#1420) 2018-11-11 15:18:36 +01:00
patrick96
6ca4f06785 doc: Convert @ to \ doxygen commands
Ref #1377
2018-11-04 19:28:27 -08:00
NBonaparte
07d35df538 fix(net): make sure WITH_LIBNL is defined before checking 2018-11-01 19:50:33 +01:00
patrick96
01f4957485 fix(font): Check FcNameParse return value
If FcNameParse returns NULL FcDefaultSubstitute segfaults

We log and throw an error here because the signal emitter swallows all
exceptions so if that exception was thrown, the bar would stop rendering
without any indication as to why.

Fixes #1435
2018-10-31 17:13:57 -07:00
patrick96
3c504bb913 fix(build): remove side-effects of iwlib.h
wireless_tools 29 redefines inline in iwlib.h as:
    #define inline inline __attribute__((always_inline))

which conflicts with POLYBAR_NS, which is defined as:

    #define POLYBAR_NS    \
      namespace polybar { \
        inline namespace APP_VERSION_NAMESPACE {

In version 30.pre9 this #define is moved into a source file and thus
cannot conflict.

The error only occurs when building with clang, so it seems gcc and
clang handle this differently

Fixes #1492
2018-10-31 17:00:13 -07:00
patrick96
152125dce9 git(xpp): Update submodule ref
This contains the fix for the xml proto file directory on exherbo

Fixes #750
2018-10-17 23:07:05 -07:00
patrick96
3b32f5899a fix: Move return value of parse_layout_symbol
Fixes #1469
2018-10-16 11:05:14 -07:00
Matthias Viehweger
5f23114cab Accept a locally existing build-directory (#1476)
A message is emitted and there the '--force' is still honored. However,
if people want to reuse the build-directory to reduce recompile-times,
this give them the rope they ask for.
2018-10-16 18:14:03 +02:00
Patrick Ziegler
b80023fd41 feat(cpu): Add ramp-coreload-spacing (#1472)
Resolves #1389
2018-10-16 01:11:05 +02:00
Patrick Ziegler
6d0cfbdfde Revert "feat(cpu): Add ramp-coreload-spacing (#1472)"
This reverts commit 06adef1055.
2018-10-16 01:01:11 +02:00
Ryan Geary
06adef1055 feat(cpu): Add ramp-coreload-spacing (#1472)
Resolves #1389
2018-10-16 00:59:45 +02:00
patrick96
abdd5f9233 fix(script): Avoid duplicate action tags for tailed
If a tailed command is used polybar would generate two action tags, one
with %counter% replaced and one with %pid% replaced, but never both

This is a bug that was introduced in #934
2018-10-08 21:38:25 -07:00
patrick96
13b0ee7454 tray: Properly deprecate tray-transparent 2018-10-04 15:52:03 +02:00
Benno Fünfstück
70807a5a9f fix(renderer): remove debug code, add comment 2018-10-04 15:52:03 +02:00
Benno Fünfstück
6237e2d419 fix(renderer): fix pseudo-transparency wrong compositing
The idea is that pseudo-transparency should behave like real transparency as
much as possible. To achieve this, we now render the bar the same way in both
cases. The only part where pseudo-transparency differs is at the very end, where
the rendered bar is captured and composited against the desktop background
image. This should ensure that both modes behave the same.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
9a92772617 fix(renderer): default m_comp_bg to OVER if pseudo-transparent 2018-10-04 15:52:03 +02:00
Benno Fünfstück
b20ad041e9 docs(signal): document newly added signals 2018-10-04 15:52:03 +02:00
Benno Fünfstück
2d385150bd fix(background_manager): more cleanup in deactivate
This has no effects on bar behaviour, as `deactivate` is currently not used anywhere.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
15b84dda07 docs(background_manager): add comments 2018-10-04 15:52:03 +02:00
Benno Fünfstück
4221da71bf fix(renderer): render transparent blocks correctly
This reverts some behaviour differences introduced by the pseudo-transparency
implementation. The new implementation is much closer to the
non-pseudo-transparent case and thus keeps original behaviour.

For the new method we simply fill the bar with the background image fetched from
the root window if in pseudo-transparent mode, otherwise we do nothing. This
means that everything will work as in the fully-transparent mode.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
35aca5b368 fix(tray): correctly compute background for tray if bar pos != (0,0)
We need to use positions relative to the position of the bar for indexing into
the background image slice, but the code used absolute ones.

This worked fine as long as absolute positions are the same as relative
positions (this is the case for a bar located at (0,0), so if bottom = false).
But for bottom bars (where the bar position is not (0,0)) this was wrong which
caused the tray background to be black (out of bounds for the background slice).
2018-10-04 15:52:03 +02:00
Benno Fünfstück
eacf5ce5ba fix(tray): fix transparency after background manager changes
The systray only supports pseudo transparency (real transparency would require
much larger changes) so the real transparency should only be used for the bar itself.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
061fe83b2f feat(background_manager): option to disable pseudo-transparency
This adds a new config option to select between pseudo transparency and real transparency.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
59c0ccef50 fix(tray): remove tray-transparent option
This option is no longer necessary because the tray background color can now
simply be set to any (semi-)transparent color (just like the bar background).
2018-10-04 15:52:03 +02:00
Benno Fünfstück
66cf9b8b99 docs(renderer): fix stale comment 2018-10-04 15:52:03 +02:00
Benno Fünfstück
e4b0a5445f style(background_manager): use brace initialization 2018-10-04 15:52:03 +02:00
Benno Fünfstück
51d58e7518 fix(render): support stacked bars
We now take the bar position that the window manager gives us instead of trying
to calculate it ourselves. This is more correct when multiple bars are attached
to the same edge, as the window manager may move some of them in that
case (assuming override redirect is not enabled)
2018-10-04 15:52:03 +02:00
Benno Fünfstück
eb742e228b fix(render): correctly handle semi-transparency for borders
We need to fetch the outer area from the root window, not just the inner area
because we paint the background below the borders as well.

This has the nice effect of supporting semi-transparency for borders as well.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
3de914abca feat(render): support pseudo-transparency
This adds pseudo-transparency for the background of the bar and the
background of the systray.
2018-10-04 15:52:03 +02:00
james9837
654c667698 fix(build): replace caddr_t with char* (#1454)
caddr_t isn't defined on all systems

Fixes #1447
2018-10-03 16:35:31 +02:00
Vasili Karaev
2fba443f56 fix(cpu): Replace %percentage-cores% normally (#1282) 2018-09-19 19:58:09 -07:00
patrick96
a881d49d9d doc(net): Indicate the wireless library used
This helps us to more easily debug network issues because before it
wasn't clear if a user had built polybar with the libnl or libiw
adapter
2018-09-18 15:29:05 -07:00
patrick96
fbc5a9fb7f doc: List xcb-xkb as optional dependency 2018-09-17 23:22:27 -07:00
patrick96
b9777a48c5 readme: format dependencies 2018-09-17 23:22:27 -07:00
patrick96
6df18fc8b3 readme: Remove GetDeb mention
GetDeb.net has been offline for a month and isn't looking like coming
back up. Now there isn't even a DNS record anymore.
2018-09-16 20:21:10 -07:00
Roel Postelmans
11d66ee78d feat(mem): Add ramp and bar for swap (#1325)
Now all the tokens in the memory module also have ramp and bar counterparts.

These can be used exactly the same as `bar-used` and `ramp-used`, they are named `<bar-swap-used>`, `<bar-swap-free>`, `<ramp-swap-used>`, and `<ramp-swap-free>`
2018-09-14 20:42:04 +02:00
Vasili Karaev
a2ab4699ab refactor(temperature): Do not use 'm_' prefix with local variable 2018-09-04 14:07:22 -07:00
Vasili Karaev
68ae7a869a fix(mpd): Get format-online-{prefix,suffix} explicitly (#1399) 2018-09-01 00:46:06 -07:00
patrick96
e794fe0d01 fix(gtest): prefer target_link_libraries
From commit 880896c6f4814f4c7798355a652dc6167be2b75f in googletest cmake
test configuration fails with errors like

CMake Error: install(EXPORT "gtestConfigInternal" ...) includes target
  "gtest" which requires target "i3ipc++" that is not in the export set.

The issue was that link_libraries also affected the googletest internal
targets that came after it making the whole thing fail.

This could also have been solved by moving link_libraries after the
configuration of googletest but according to the cmake documentation [1]
target_link_libraries should be prefered over link_libraries anyways.

[1]: https://cmake.org/cmake/help/latest/command/link_libraries.html

Fixes #1393
2018-08-31 13:17:19 -07:00
Dalton Barreto
2268136971 readme: add link to polybar config examples 2018-08-29 16:11:28 -07:00
patrick96
e4b7c96e3f readme: Add release badge 2018-08-26 23:04:59 +02:00
Yukio Siraichi
0ae4de7d1e fix(compiling): map variable without namespace. (#1395)
If polybar is compiled with `-xkb +xcursor`, `cursor.hpp` doesn't include `using std::map`, which is located in `xkb.hpp`
2018-08-24 13:37:45 +02:00
Patrick Ziegler
676d9d7e1a fix(tray): Reconfigure tray on error (#1392)
This will fix the issue of the tray container not being
properly reconfigured when a tray client fails to be added
or removed.
2018-08-21 21:06:58 +02:00
Patrick Ziegler
b32e48a440 github: Custom issue templates (#1388)
* github: Add template for bug or issue reports

* github: Add template for build issues

* github: Add tempalte for feature requests

* github: Change 'New Issue' links to issue chooser

Github provides an issue chooser dialog when custom issue templates are
used.
2018-08-17 23:34:00 +02:00
BO41
238f8fb592 refactor: Simplify if statements (#1381) 2018-08-14 23:31:44 +02:00
patrick96
2a3b2b2b99 refactor(logger): Use better contrast for trace
The current colors are barely legible
2018-08-13 12:21:14 -07:00
taschenb
0daae86fc9 fix(net): Allow all characters for the SSID
Don't filter out any character that is not part of the current C
locale, since it might drop some wanted characters
2018-08-09 14:09:50 -07:00
sysek
e7e24e9979 readme: Package for openSUSE Leap 15 and Tumbleweed (#1370) 2018-08-09 21:00:36 +02:00
Andre Schröder
b632e7da38 fix(cmake): Use name of found font (#1350)
Before queryfont would never change the name of the font, this ensure that it is propery updated in the caller's scope
2018-08-07 17:04:42 +02:00
NBonaparte
fba87227c7 feat(pulseaudio): add volume interval option 2018-08-07 11:52:38 +02:00
NBonaparte
83784fde14 feat(alsa): add volume interval option 2018-08-07 11:52:38 +02:00
laur89
c6afe4881b feat(build.sh): extend build.sh
* extend build.sh

- add option flags;
  - among others, flag --auto allows executing
    script in a non-interactive mode, where all
    unset options are defaulted automaticaly;
- add help/usage;

* post-review: --pulse-audio -> --pulseaudio

* post-review: do not install config by default
2018-08-06 20:31:37 -07:00
patrick96
0421b5b05f refactor: Remove unnecessary quote trim operations
Trimming the quotes in labels and the date module are not needed at all,
because surrounding quotes are removed when loading the values from the
config.

Removing the quotes in the builder also doesn't seem to serve any
purpose at all.
2018-08-05 08:50:54 +02:00
patrick96
58e269b2d6 refactor(test): Remove old testing harness
Now all tests have been converted to gtest and the old testing utility
code is not used anywhere
2018-07-31 13:20:27 -07:00
patrick96
9ec6682777 tests: Convert string tests to gtest
The sstream test was removed because it only tested standard library
behvaior
2018-07-30 14:12:22 +02:00
patrick96
491d9ecfab ycm: Remove -Werror from ycm flags
This way warnings are colored differently from actual errors in vim
2018-07-30 14:12:22 +02:00
patrick96
a3786be26a tests: Disable -Werror for tests
This way we can still run tests with some compiler warnings
2018-07-30 14:12:22 +02:00
NBonaparte
4cb0b18389 fix(controller): don't draw window if writing to stdout (#1322)
fixes #1314.
2018-07-24 19:39:32 +02:00
Tim Smith
01fc545e09 fix(i3): Play nice with workspace_auto_back_and_forth (#1312)
This makes polybar play nice with the i3wm feature `workspace_auto_back_and_forth`, and it is harmless when that option isn't set.
2018-07-23 15:51:42 +02:00
memeplex
1d6d44f4e9 feat(token): Zero pad when min val starts with '0' (#1341)
Closes #1332
2018-07-23 15:49:02 +02:00
memeplex
1808ca3c51 fix(ramp): Evenly distribute states (#1340)
Fixes #1328
2018-07-23 15:42:42 +02:00
Patrick Ziegler
934e277ccd Release 3.2.0 (#1338)
Breaking Changes:

* `0 < label-NAME-maxlen < 3` will now throw an exception and disable the containing module, if ellipsis is enabled for that label. (#1198)

Changelog:

Deprecations:
* `internal/volume` is now called `internal/alsa` (#967)
* temperature: The `%temperature%` is deprecated in favor of `%temperature-c%`(#897)
* mpd: `icon-repeatone` is deprecated in favor of `icon-single` (#1295), see #1279

Features:
* feat(mpd): Add support for icon-consume (#861)
* feat(bspwm): Add workspace separator (#942) 
* feat(i3): Add workspace separator (#938), see #929
* feat(build): Make polybar build on FreeBSD (#931, jaagr/xpp#8), see #239
* feat(volume): Add pulseaudio backend (#779)
* feat(script): Add %pid% token for tail commands (#934)
* feat(temp): Add temperature tokens without unit (#897)
* feat(memory): Add memory used/free ramp (#1038), see #1037
* feat(memory): Add swap tokens (#1018) 
* feat(net): Add unknown-as-up option (#1077), see #457
* feat(config): Support fractional size and offset (#972), see #953
* feat(xwindow): Add label-empty (#1136)
* feat(battery): Add animation-discharging (analog to animation-charging) (#1190)
* feat(config): Support pixel offset for bar size and offset values (#1224)
* feat(mpd): Add `%album-artist%` token (#1263)
* feat(net): Add local_ip6 token (#1239), see #1234
* feat(net): Add nl80211 support (#1009), see #277

Fixes:
* fix(mpd): Wrong elapsed time when after standby (#921), see #915
* fix(config): Wrong min, maxlen when using the same token multiple times (#974), see #971
* fix(battery): use power_now correctly (#958), see #928
* fix(mpd): Crash when mpd isn't running (#983), see #979
* fix(xworkspaces): Respect 'enable-scroll' (#1002)
* fix(xbacklight): Respect 'enable-scroll' (#1014)
* fix(build): support xcb-proto >=1.13 (jaagr/xpp#11), see #973
* fix(mpd): Respect MPD_HOST env variable (#1025), see #1007
* fix(i3): Reconnect i3 IPC socket on restart/error (#1099), see #762
* fix(cursor): Occasional crash on mouseover (#1124), see #1117
* fix(net): Mark 'not connected' on querying failure (#1171), see #1163
* fix(gcc): Fix -Wstringop-truncation warning (#1216, jaagr/i3ipcpp#7), see #1215
* fix(builder): Don't truncate colors with same channels (#1217), see #1183
* fix(bspwm): Consistent behavior when scrolling through multiple desktops (#986), see #981
* fix(builder): Respect label-ellipsis option (#1198), see #1194
2018-07-23 15:17:29 +02:00
patrick96
4a494e61e1 refactor(label): Throw exception with small maxlen
This now makes label-maxlen < len(ellipsis) (= 3) a fatal error
disabling the whole module that uses the offending label
2018-07-22 14:02:15 -07:00
patrick96
0346a965a7 refactor(builder): No exception when maxlen < 3
The check of the maxlen and ellipsis condition was also moved to the
label creation, this way get_label_text doesn't need to care about the
restrictions placed on maxlen and ellipsis
2018-07-22 14:02:15 -07:00
patrick96
7dc42f543f fix(builder): Respect label-ellipsis option
This slightly changes the existing behavior of maxlen. Before with a
maxlen of 4 'abcde' used to yield 'abcd...' now it yields 'a...'
2018-07-22 14:02:15 -07:00
patrick96
973f925ad7 fix(travis): Fail tests if build fails 2018-07-22 14:02:15 -07:00
patrick96
4b83468eb9 refactor(builder): Add failing test for ellipsis
Adds failing tests for the bug described in #1194
2018-07-22 14:02:15 -07:00
patrick96
028b1413ef refactor(mpd): Replace icon-repeatone with icon-single
The repeatone button doesn't influence repeating behaviour at all, so
the name is misleading.

This deprecates icon-repeatone for now, until we can completely remove
it

Fixes #1279
2018-06-23 10:14:30 +02:00
patrick96
a06eb8cdac doc: Specify where to run make userconfig 2018-06-20 08:12:35 +02:00
patrick96
e849a55567 doc: Link to Compiling page in 'Building from source' 2018-06-20 08:12:35 +02:00
patrick96
415ecebe52 doc: Add introduction to 'Getting Started' 2018-06-20 08:12:35 +02:00
patrick96
a7e2173c6f doc: Update links for Void Linux, FreeBSD, Gentoo 2018-06-20 08:12:35 +02:00
patrick96
f98552f87c doc: Mention cmake and git dependency 2018-06-20 08:12:35 +02:00
patrick96
820279279e aur: Add libnl as optional dependency 2018-06-19 09:42:45 -07:00
taschenb
3afc341c7b feat(net): Add nl80211 support (#1009)
This patch enables support for nl80211. In case the libnl-genl-3.0
library isn't found, it will fall back to Wext instead.
The library to use can also be manually set with the CMake option
WITH_LIBNL.

The Wireless-Extensions (WE or Wext) are deprecated and long replaced
by cfg80211.

Although Wext isn't used by WiFi drivers anymore, CFG80211_WEXT allows
old tools to communicate with modern drivers by providing a wrapper
API.
2018-06-18 20:16:09 -07:00
patrick96
d43a4a8d9d refactor(travis): Remove Debug build configurations
They're not really any different from the release builds and only
elongate the build process. Also now that we have a minimal build, we
would have more than five build configurations which would make travis
limit itself to five concurrent builds, letting the last build wait on
the others.

Also it's just unnecessary load on the travis servers
2018-06-18 11:49:31 +02:00
patrick96
747cdfe7f5 refactor(travis): Add minimal build configuration
Uses none of the optional dependencies. This ensures that polybar can
build without any of the supposedly optional dependencies. This would
have detected the cause of the xrm build failure before it was merged
2018-06-18 11:49:31 +02:00
patrick96
5d350dead8 refactor(travis): Use anchor for apt packages
This allows use to pick and choose apt packages for each of our build
configurations

This makes the definition of a new build configuration more verbose but
it gives us greater flexibility and it's also a preparation for a new
build configuration with minimal number of packages
2018-06-18 11:49:31 +02:00
patrick96
e33ac7be10 doc: List xcb-util-xrm as optional
Since polybar compiles without it, it's not necessary to actually run
polybar
2018-06-18 11:49:31 +02:00
patrick96
6157c697bc refactor(build): List xkeyboard in cmake and polybar -v 2018-06-18 11:49:31 +02:00
patrick96
f7a6e5ba98 refactor(build): Build wihtout xkb
The only reason polybar couldn't build without xkb is because the
xkeyboard module's source file was not removed during compilation.
xkeyboard already has an entry in unsupported.hpp

This effectively makes xcb-util-xkb optional
2018-06-18 11:49:31 +02:00
patrick96
943fd1aaec fix(build): Build without xrm
When xrm was disabled, main.cpp was missing the complete defintion of
connection from connection.hpp, which was included xresources.hpp when
xrm was enabled.
2018-06-18 11:49:31 +02:00
x70b1
4b8cd8f616 config: Add figlet polybar banner (#1281) 2018-06-14 00:05:36 +02:00
sqwishy
d1d307d500 feat(net): Add local_ip6 token (#1239)
It's queried the same way ipv4 addresses are queried, but here it displays globally routable addresses. If there are multiple such addresses, it picks one (same as with ipv4). It's possible that an address discovered this way is not in fact globally reachable but still marked as global.
2018-06-10 22:51:43 +02:00
patrick96
1965498e20 tests: Convert color test to gtest 2018-06-10 16:42:07 +02:00
patrick96
78680a6832 tests: Convert file test to gtest 2018-06-10 16:42:07 +02:00
patrick96
53c87558c9 tests: Convert scope test to gtest 2018-06-10 16:42:07 +02:00
patrick96
f983bb63bb tests: Convert math test to gtest 2018-06-10 16:42:07 +02:00
NBonaparte
067aac1ac7 fix(bspwm): use monitor focus only when pinned 2018-06-06 17:38:17 +02: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
tamago
b70d5b55d8 feat(mpd): add support for MPD_TAG_ALBUM_ARTIST 2018-05-31 20:12:23 -07:00
NBonaparte
2e198ec9c2 fix(README): remove colon between name and username 2018-05-30 07:19:49 +02:00
patrick96
fb27cdf7f7 doc: List main contributors in README 2018-05-29 22:21:17 +02:00
tobaloidee
e828cbd2ce Add polybar banner 2018-05-27 09:37:56 +02:00
Alex Mayer
73e4b4ac08 Fix Color Hex Values 2018-05-22 17:01:18 -07:00
patrick96
3708d4139a refactor(clang-tidy): Clean up .clang-tidy 2018-05-20 16:37:18 -07:00
patrick96
72948dbc97 fix(clang): Search for files in right places
Before, because of [ -d "$search" ] || search="$(dirname "$search")",
clang-format.sh would search for files to format in the whole repo
(even in the build directory and the submodules)

This now also looks for source files in the tests folder

I have removed the clang-format from clang-tidy.sh because one may want
to run clang-tidy without reformatting
2018-05-20 16:37:18 -07:00
Doron Behar
da9372fb70 refactor(build.sh): Add gcc over clang option(#1249)
There was no way to build with gcc when clang was installed using build.sh
2018-05-20 10:30:33 +02:00
patrick96
3c0732ac2a fix(travis): no xrm build failure
install_xcb_xrm.sh takes advantage of the travis cache but it doesn't
actually install the libraries on the system when it finds that the
compilation has been cached.
2018-05-18 22:17:42 -07:00
patrick96
930be72c89 refactor(tray): Log restack failure as error
I suspect that people that are seeing the tray above their fullscreen
windows get this exception
2018-05-15 16:01:07 -07:00
patrick96
77d36b959d fix(doc): Use proper license badge URL 2018-05-09 16:44:24 -07:00
patrick96
22542afc73 bar: Add comment to geom_format_to_pixels 2018-05-10 00:05:18 +02:00
patrick96
4e5628dd5f bar: Use strtod instead of strtof
This makes the function more consistent, since it actually returns a
double and it also fixes the tests that use EXPECT_DOUBLE_EQ
2018-05-10 00:05:18 +02:00
patrick96
cc9423e682 bar: Add geom_format_to_pixels tests 2018-05-10 00:05:18 +02:00
patrick96
20f3d9a141 refactor: Don't initialize forward declared members
Using brace initialization here causes bar.hpp to not compile when
included on its own, forcing all clients to also include
tray_manager.hpp and so on, which defeats the purpose of forward
declaring those classes.

This also allows us to remove the tray_manager.hpp, renderer.hpp and
parser.hpp includes from the clients of bar.hpp
2018-05-10 00:05:18 +02:00
lukediamond
c2ac93db55 Added support for mixed percent/pixel geometry. 2018-05-10 00:05:18 +02:00
patrick96
0dddb0be4a fix(aur): Backport gcc fix 2018-05-07 19:39:05 -07:00
patrick96
3408db3475 fix(builder): Don't truncate colors with same channels
The builder would convert bg and fg colors like #00000000 to #000 which
would make it loose its alpha channel.

Fixes #1183
2018-05-07 00:12:29 +02:00
patrick96
758dbb85ed fix(codecov): Ignore lib folder for coverage 2018-05-06 14:30:34 -07:00
patrick96
8173a6473e fix(gcc): Fix -Wstringop-truncation warning
As mentioned in #1215, gcc >=8 will complain, if strncpy truncates the
source string or gcc can prove there is no NUL terminating byte.

This also updates the i3ipcpp submodule where there was a similar error

Fixes #1215
2018-05-06 14:17:10 -07:00
NBonaparte
f2010edf94 fix(pulseaudio): fix max_volume naming 2018-05-05 10:57:01 +02:00
NBonaparte
4bf73ddd81 fix(pulseaudio): listen for default sink changes, and use @DEFAULT_SINK@
Using @DEFAULT_SINK@ macro avoids having to retrieve default sink name
2018-05-05 10:57:01 +02:00
Kajzer
45b39b0fbd Add Gentoo install instructions 2018-05-05 10:11:09 +02:00
patrick96
095d68fad0 fix: Stop using ato* for string to num conversion
atoi, atof and so on have undefined behavior if anything goes wrong. We
now use strto*, but without error checking. In most places overflows and
the like *should* not happen. String to number conversions are only used
when reading data from other applications or from the config, if another
application gives unparsable strings or too large numbers, then most
likely there is something wrong with that application. If the error
comes from the user config, then the user has to live with values
provided by strto* on error (which are very reasonable)

Fixes #1201
2018-05-03 11:07:37 -07:00
Christoph Schiessl
cc334e5040 fix(battery): check current state to decide which framerate to use 2018-05-02 11:44:55 +02:00
Christoph Schiessl
2a9d5db179 feat(battery): implement animation-discharging 2018-05-02 11:44:55 +02:00
Christoph Schiessl
ee5dfbbf59 feat(battery): add animation-discharging 2018-05-02 11:44:55 +02:00
patrick96
553fde9499 fix(tests): Add forgotten scope test 2018-05-01 20:14:23 -07:00
Matthias Gamsjager
ff39c9d09f Add Freebsd install instructions 2018-04-18 21:15:55 +02:00
patrick96
7eb1f61080 fix(net): Mark not connected on querying failure
Fixes #1163
2018-04-18 09:27:12 +02:00
NBonaparte
4dfa4079be feat(travis): switch to codecov for code coverage (#1165) 2018-04-16 20:03:34 +02:00
patrick96
6cee262225 travis: Move MAKEFLAGS to .travis.yml 2018-04-11 19:37:50 -07:00
patrick96
c900a9958d travis: Don't fetch as many git commits 2018-04-11 19:37:50 -07:00
patrick96
0394172cc3 travis: Enable ccache and apt caching
Will massively decrease build time
2018-04-11 19:37:50 -07:00
patrick96
a8234ddd4e travis: Don't install specific compilers
clang is already installed in travis' trusty environment

Should decrease build time quite a bit because we don't need to download
and compule libc++
2018-04-11 19:37:50 -07:00
patrick96
7b7498bde1 travis: Remove custom cmake
Travis provides cmake 3.9.2 ([1])

[1]:
https://docs.travis-ci.com/user/build-environment-updates/2017-12-12/
2018-04-11 19:37:50 -07:00
patrick96
be2d05a4bc cmake: Print module versions in summary
Makes helping with build issues easier as we readily see what versions
are being used.
Cmake already prints the version but only when run the first time and
not on subsequent calls, so the information is often lost
2018-04-10 22:22:22 -07:00
Kajzer
688658c306 (pulseaudio) Add max volume configuration 2018-04-09 20:27:55 -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
fce313f3ef tests: Fix clang build
Compiling gtest with clang fails with -Wmissing-field-initializers as
reported in [1]
[1]: https://github.com/google/googletest/issues/1521
2018-04-10 00:56:51 +02:00
patrick96
0e5584920b tests: Use local gtest headers
This makes sure the headers and the compiled gtest library are
compatible
2018-04-10 00:56:51 +02:00
patrick96
fa99be63a0 tests: Don't include src dir
Since we now link source files instead of including them, this is not
necessary anymore
2018-04-10 00:56:51 +02:00
patrick96
56413aa7a8 coverage: Add badge 2018-04-10 00:56:51 +02:00
patrick96
eb6159767b tests: Remove log message 2018-04-10 00:56:51 +02:00
patrick96
cacd161ed7 travis: Send data to coveralls.io after tests
The PYTHONPATH env variable needed to be removed because it was messing
with pip and cpp-coveralls

Unfortunately adding the '-e build' to coveralls doesn't work to exclude
source files in the build directory, as it won't collect any data then.
If at some point, we have source files that are used by the tests
somewhere inside the build folder that isn't covered by the exclusion
rules, we'll need to add it here
2018-04-10 00:56:51 +02:00
patrick96
d768c49980 travis: Separate compiling and testing 2018-04-10 00:56:51 +02:00
patrick96
eed4d3ffc8 fix(tests): Compile gtest at configure time
Ubuntu (and thus travis CI) doesn't have the gtest library in its repos,
only the header files and according to [1], gtest should be compiled in
every project anyways

[1]: https://github.com/google/googletest/blob/master/googletest/docs/FAQ.md#why-is-it-not-recommended-to-install-a-pre-compiled-copy-of-google-test-for-example-into-usrlocal
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
patrick96
1d20df00e8 fix(ycm): Fix ycm error
All files that include base.inl also include base.hpp but technically
it's required for it to compile
2018-04-08 02:30:04 +02:00
patrick96
aaf49c302f fix(ycm): Use compilation db for all possible files
This is basically a major rewrite of the .ycm_extra_conf.py file that
ycm uses to determine what compile commands it should use for a file.
But the basic purpose is for it to use the generated flags in
build/compile_commands.json that is generated by cmake for as many files
as possible.

Before it always used the hardcoded default flags which would not always
work for all files.

Now it gets the proper flags for all files I tested.
In the src and tests folder the flags are already generated by cmake
In the include folder it tries to use the flags of the corresponding
source files in the src folder
2018-04-08 02:30:04 +02:00
patrick96
36ea6fbff8 Revert "fix(pulseaudio): add mutex for queue"
This reverts commit d430174f0b.
Mutual exclusion is already guaranteed by the lock on
pa_threaded_mainloop

Fixes #1139
2018-04-07 13:52:48 -07:00
patrick96
428e54e0f6 log(mpd): typo 2018-04-07 12:10:10 -07:00
patrick96
ddb1fb4c3a log(mpd): Use __func__ instead of __FUNCTION__ 2018-04-07 12:10:10 -07:00
patrick96
57a2f95ff9 log(mpd): Log mpd input events 2018-04-07 12:10:10 -07:00
patrick96
bbe5769bb0 log(mpd): trace log setting boolean options 2018-04-07 12:10:10 -07:00
Keno Goertz
d31570fe2f feat(xwindow): Add label-empty
Allows for custom text, when window title is empty
2018-04-02 00:00:16 +02:00
patrick96
8f75e685cc fix(log): Actually enable trace logging by default 2018-03-31 13:40:06 -07:00
NBonaparte
10632178a8 fix(pulseaudio): add fallthrough marking 2018-03-31 00:52:17 +02:00
NBonaparte
d430174f0b fix(pulseaudio): add mutex for queue 2018-03-31 00:52:17 +02:00
NBonaparte
5f88cd44c7 fix(pulseaudio): get default sink on new events when using default 2018-03-31 00:52:17 +02:00
Jon Gjengset
224ffa97c1 feat(config): Support fractional size and offset
Fixes #953.
2018-03-28 10:59:22 -07:00
NBonaparte
39c12edc8a fix(cursor): add lock to motion handler 2018-03-27 22:03:38 +02:00
patrick96
3ea60ace91 fix(pulse): Use distinct event names
volup, voldow, volmute, are caught by the alsa module, if there is an
alsa module on the bar.
2018-03-27 11:28:54 -07:00
NBonaparte
d007539a6b fix: remove .exrc 2018-03-26 07:27:05 +02:00
Jan Holthuis
a2ce4ed725 fix(i3): Reconnect i3 IPC socket on restart/error (#762) 2018-03-25 23:06:03 +02: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
patrick96
eb9c8e66f2 aur: Add i3-wm dependency
The actual i3 package is also needed to build polybar with i3 support.
2018-03-20 17:59:54 -07:00
patrick96
258f55a5ff fix(aur): Use newest xpp commit to build with xcb-proto
xcb-proto 1.13 finally introduces the eventstruct key that made polybar
not compile. The fix isn't in any release yet, this checks out the
newest xpp commit with the fix during compilation until we release 3.2.0

Fixes #1090
2018-03-11 13:49:11 -07:00
NBonaparte
0a8a326730 feat(net): Add unknown-as-up option
Fixes #457
2018-03-04 23:09:18 +01:00
patrick96
1ebb49da0a refactor(aur): Remove unused i3ipc-glib dependency
Polybar includes no header files from this library and doesn't use any
i3ipc_* functions
2018-03-03 23:47:35 +01:00
Florian Brinker
692e6d9b4a Loglevel info for "No matching input area" (#1059) 2018-02-27 17:45:24 +01:00
patrick96
f2bc6d1844 logger: Enable trace logging by default
Often we may need information from the user that is only available if
-l trace is used which requires most users to recompile polybar in debug
mode.
2018-02-27 00:19:29 -08:00
patrick96
29aa2487b9 refactor(lib): Remove jsoncpp tarball
Polybar itself doesn't depend on jsoncpp at all, only i3ipcpp does and
it has the jsoncpp 1.7.7 source code in its repo, if a too low jsoncpp
version is found.
2018-02-26 10:58:12 -08:00
Alexander
4f6e37449b feat(memory): Add swap tokens (#1018) 2018-02-25 12:12:38 +01:00
patrick96
2f62a6fbad feat(memory): Add memory used/free ramp
Closes #1037
2018-02-19 14:30:30 -08:00
patrick96
0fd614b0a9 refactor(controller): Print error message on select fail 2018-02-15 19:26:35 -08:00
patrick96
c30159abc6 feat(temp): Add units option
Avoids having lots of tokens
2018-02-15 18:50:59 -08:00
patrick96
a9014e31dc refactor(temp): Mark %temperature% token as deprecated 2018-02-15 18:50:59 -08:00
patrick96
e4634ce95f feat(temp): Add temperature tokens without unit 2018-02-15 18:50:59 -08:00
Patrick Ziegler
0849d05469 fix(docs): Use correct alsa module name (#1030) 2018-02-15 18:49:04 -08:00
patrick96
078bcd5e7d Respect MPD_HOST env variable
Fixes #1007
2018-02-15 17:45:41 -08:00
patrick96
295297500d docs: Add pulseaudio sample config 2018-02-15 17:43:47 -08:00
sysek
031f58c522 docs: Add information for openSUSE (#1031) 2018-02-15 12:29:16 +01:00
kokan
cb4111383f fix(github): libcurl stuck at curl_easy_perform
Signed-off-by: kokan <peter.kokai@balabit.com>
2018-02-15 10:50:05 +01:00
patrick96
482876b63a refactor(config): Print filename at very beginning
There have now been several instances of people reporting that their
bars are not found and polybar not printing the config file name because
the error is thrown first, making it very difficult to debug
2018-02-15 08:43:19 +01:00
patrick96
9db3e7f251 git(xpp): Update submodule ref
This contains the fix for the eventstruct key in newer xcb-proto
versions

Fixes #973
2018-02-14 17:36:24 -08:00
patrick96
d2a7b0269c refactor(mpd): Print error on mpd_exception 2018-02-14 14:27:25 -08:00
patrick96
81d2d09ba9 fix(mpd): Clear mpd error after getting error info
Before, polybar would crash, trying to throw a server error because
mpd_connection_get_server_error asserts that the error is of type server
error, but it isn't because it was cleared
2018-02-14 14:27:25 -08:00
patrick96
f531613723 fix(alsa): Use proper speaker mixer name and soundcard
The old code causes a segmentation fault, if the speaker and headphone
soundcards differ.
2018-02-13 09:44:16 -08:00
patrick96
802a27177c fix(doc): GetDeb packages not Debian compatible
There is no Debian release in GetDeb and according to [1] packages
from Ubuntu repositories can break a Debian system.

Fixes #1000

[1]: https://wiki.debian.org/DontBreakDebian#Don.27t_make_a_FrankenDebian
2018-02-13 09:43:10 -08:00
NBonaparte
4d48ffed83 fix(battery): check without using path_battery 2018-02-11 20:21:43 +01:00
NBonaparte
539e2e09cf fix(cmake): look for and remove alsa.cpp if not used 2018-02-11 17:25:21 +01:00
NBonaparte
1ac5c23fd2 fix(xbacklight): respect enable-scroll 2018-02-11 17:22:44 +01:00
NBonaparte
989bc00082 fix(alsa): use correct module_name 2018-02-11 17:04:08 +01:00
Noah Murad
014ac82838 Fix #960 (#962)
* Fix #960

* Fix spacing

* Fix spacing pt. 2
2018-02-08 18:23:51 -08:00
Vlad Glagolev
a5b310872c Respect 'enable-scroll' setting for xworkspaces module 2018-02-03 14:43:34 -08:00
Vlad Glagolev
0dedb85721 Add Source Mage package for polybar 2018-02-02 10:44:11 -08:00
Kareem El-Faramawi
2f113446c0 fix(battery): capture path_battery by copy (#992)
path_battery goes out of scope, so the stack reference becomes garbage

Fixes #985
2018-02-02 10:42:20 +01:00
patrick96
26abd0f6c4 fix(mpd): Check m_status before dereferencing it
This bug was introduced in 645a3142a1

Fixes #979
2018-01-31 22:17:25 -08:00
NBonaparte
2a056d5b23 fix(power): add comments to explain current/power_now 2018-01-30 21:24:51 +01:00
NBonaparte
95d3b4f1eb fix(battery): use power_now correctly 2018-01-30 21:24:51 +01:00
patrick96
5c7ff09ed6 fix(config): Use proper token object
When using the same token multiple times in the same label with
different length properties, polybar would always use the settings for
the first token. This now replaces the tokens one by one, so that a new
token object is used for the length settings each time a token is used
again. Because the token objects are added in order, the replacement
always uses the right token object for the token that is replaced.

Fixes #971
2018-01-27 23:40:19 -08:00
NBonaparte
5ca1940629 fix(alsa): use correct name for deprecation 2018-01-27 09:12:09 +01:00
NBonaparte
06dee3dedd fix(volume): Warn instead of throw 2018-01-23 14:33:11 +01:00
NBonaparte
83e523518e fix(aur): Update PKGBUILDs 2018-01-23 14:33:11 +01:00
NBonaparte
e16227ca43 refactor(alsa): rename and move volume -> alsa 2018-01-23 14:33:11 +01:00
NBonaparte
818bcbd0b5 volume: use internal/alsa instead of internal/volume 2018-01-23 14:33:11 +01:00
patrick96
1d9dd719bc refactor(script): Loop over buttons and replace tokens 2018-01-21 14:41:52 -08:00
patrick96
f79aeac872 feat(script): Add %pid% token for tail commands
Is replaced with the pid of the exec command
2018-01-21 14:41:52 -08:00
patrick96
1739e4490d doc(pulse): Mention pulseaudio dependency 2018-01-20 14:04:03 -08:00
NBonaparte
3af3aea534 fix(pulseaudio): warn only if default sink is not same as specified sink 2018-01-20 12:37:41 -08:00
NBonaparte
10656a94cb fix(pulseaudio): prevent nonresponsiveness and remove redundant getters 2018-01-20 12:37:41 -08:00
NBonaparte
1f35b9dc89 fix(pulseaudio): Add logging 2018-01-20 12:37:41 -08:00
NBonaparte
0eac7f5d04 fix(pulseaudio): use PA_VOLUME_UI_MAX 2018-01-20 12:37:41 -08:00
NBonaparte
8be5427c33 refactor(pulseaudio): remove headphone ramp 2018-01-20 12:37:41 -08:00
NBonaparte
1792090d66 refactor(pulseaudio): remove wait timeout, fix indents 2018-01-20 12:37:41 -08:00
NBonaparte
6e8b9dea29 fix(pulseaudio): Move pulseaudio to separate module 2018-01-20 12:37:41 -08:00
NBonaparte
83976a6c5b fix(travis): Add libpulse-dev 2018-01-20 12:37:41 -08:00
NBonaparte
9b0ff59b56 fix(build): Check for pulseaudio binary 2018-01-20 12:37:41 -08:00
NBonaparte
a08c5c710a fix(pulseaudio): fix get_name(), cleanup 2018-01-20 12:37:41 -08:00
NBonaparte
5c6b56614e fix(pulseaudio): Rewrite error checking 2018-01-20 12:37:41 -08:00
NBonaparte
916c7b6852 refactor(pulseaudio): Use index instead of name to track sinks 2018-01-20 12:37:41 -08:00
NBonaparte
23ee9afb6f fix(pulseaudio): Use inc_volume() instead of set_volume() 2018-01-20 12:37:41 -08:00
NBonaparte
318a6d83cf refactor(pulseaudio): Move loop to inline function 2018-01-20 12:37:41 -08:00
NBonaparte
4f15f42f2c fix(build): Only use one volume backend 2018-01-20 12:37:41 -08:00
NBonaparte
81913cf181 wip(pulseaudio): create pulseaudio backend 2018-01-20 12:37:41 -08:00
patrick96
6ed4838738 fix(mpd): Update on MPD_IDLE_QUEUE events
MPD_IDLE_PLAYLIST is deprecated since 2009, it has the same value as
MPD_IDLE_QUEUE, so we are now using that
2018-01-15 19:32:02 +01:00
patrick96
645a3142a1 fix(mpd): Always update mpd data
Only updating when an mpd event occurred would cause issues when mpd was
playing and the machine was put to sleep because the elapsed time was
calculated by taking the time difference of the last update and now
which would give you wrong numbers, if the machine was in standby in
between.

Since the update function on the module is only called once a second (or
when an event happens), we can just update the data every time without a
huge performance hit.

Fixes #915
2018-01-15 19:32:02 +01:00
Le Baron d'Merde
bb0f68aef0 git(xpp): Update submodule ref (#955) 2018-01-14 10:23:41 +01:00
NBonaparte
7c41719da5 contrib: Remove void package 2018-01-08 23:10:15 +01:00
Patrick Ziegler
d8414c6ec5 feat(i3): Add workspace separator (#938)
Puts a label-separator node between workspaces on the bar. Since the
separator uses a label it can be configured like any other label

Closes: #929
2018-01-06 16:19:02 -08:00
Patrick Ziegler
a7eb7b3576 feat(bspwm): Add workspace separator (#942)
Same as the i3 workspace separator
2018-01-06 16:18:09 -08:00
Patrick Ziegler
e3c44983ce docs: Add xcb cursor dependency to README (#895) 2017-12-17 00:25:49 -08:00
Jens Henniges
d3abcc97f6 feat(mpd): Add support for icon-consume (#861) 2017-12-04 11:38:17 -08:00
NBonaparte
17f1f19012 fix(bump.sh): remove references to .SRCINFO (#884) 2017-12-03 15:35:30 -08:00
NBonaparte
b30e224130 fix(aur): update to 3.1.0 (#883) 2017-12-03 15:29:44 -08:00
Patrick Ziegler
066ee35fc3 fix(AUR): Remove failing call to version.sh (#877)
version.sh is supposed to set the GIT_TAG macro in version.hpp to the
output of 'git describe ...', however it uses relative paths and can't
find 'include/version.hpp'

'include/CMakeLists.txt' already has the same functionality so this is
not needed
2017-12-03 15:25:08 -08:00
Patrick Ziegler
bf16a4d415 Release 3.1.0 (#863)
Breaking Changes:

* Date module no longer supports non-padded specifiers (i.e. `%-d`) and potentially other specifiers, see #792
  - Check http://en.cppreference.com/w/cpp/io/manip/put_time to see supported specifiers
* Setting background color to `background-0` with gradients (refer to https://github.com/jaagr/polybar/wiki/Known-Issues)

Changelog:

Features:
* Feat(mpd): State-specific formats (`format-playing`, `format-paused`, `format-stopped`) (#567), see #524 
* Feat(ipc): Visibility commands (show, hide, toggle, restart, quit) (b6c5563)
* Feat(shell): Bash completion (#588)
* Feat(menu): `expand-right` option (#658), see #655
* Feat(temperature): hwmon sysfs support (#688), see #404 
* Feat(cursor): Change cursors over clickable/scrollable areas (#727), see #721  
* Feat(temperature): Fahrenheit and Celsius tokens (#804)
* Feat(mpd): Use mpd name tag or URI as fallback for title-less tracks (#823), see #815 

Fixes:
* Fix(i3): Clicking workspaces without index (#521), see #520 
* Fix(parser): Prefix options overriding format options (#729), see #544
* Fix(parser): Overline tags (eebf105)
* Fix(process_util): Prefix shell environment variable (`$POLYBAR_SHELL`) (86ff947), see #566 
* Fix(parser): `%{R}` tag (reverse colors) (0bd8f1f), see #585 
* Fix(renderer): Center block position with tray (389bae2 & #673), see #551 & #672 
* Fix(xworkpaces): Active workspace with XMonad (#587), see #411 & #535 
* Fix(config): Expand tilde, environment variable (d3b0670 & #724), see #603 & #719 
* Fix(build): Remove curlbuild.h (#648), see #647 
* Fix(renderer): Off by one error for actions (#663), see #661 
* Fix(gcc): GCC 7.1 ([jaagr/xpp/#6](https://github.com/jaagr/xpp/pull/6))
* Fix(fs): Use `bytes_available` for `percentage_used` (138f5fa), see #710
* Fix(fs): Use `f_frsize` for calculations (a682d2a)
* Fix(date): Remove date string length limitation (#745), see #754 
* Fix(renderer): Nested actions (#772), see #760 and #758
* Fix(i3): Check and warn if current workspace not found (#826), see #824 
* Fix(github): Prevent module disappearing with no connection (#811), see #810 
* Fix(renderer): Module gradients (#831), see #759 
* Fix(build): Update deprecated jsoncpp Reader
2017-12-03 18:03:49 +01:00
patrick96
e90d5f6a6e fix(build): Update deprecated jsoncpp Reader
Actual fix was made in https://github.com/jaagr/i3ipcpp/pull/4 this only
updates the submodule

Fixes #741
Fixes #871
2017-12-03 17:27:52 +01:00
NBonaparte
c348c3e917 fix(mpd): get format-online options for format-{playing,paused,stopped} (#868) 2017-11-30 21:58:34 +01:00
Kókai Péter
fbc361bcd7 feat(build): help target to list all targets (#870) 2017-11-30 21:42:11 +01:00
concatime
1158d5d889 fix(contrib): Wrong config path in xbps (#842) 2017-11-14 09:59:23 +01:00
Vasili Karaev
5d2deb1a99 fix(renderer): Only draw text bg if color differs from bar bg (#831)
Fixes #759 by only drawing text background when its color is different from the background color of the bar itself.

Explicitly setting a module's background to `background-0` now stops working.
2017-11-12 09:53:54 +01:00
NBonaparte
3092a1b18f feat(mpd): Get name and/or uri if title not found (#823) 2017-11-08 21:12:44 -08:00
Kókai Péter
3f9f2dc37f fix(github): Handle curl exceptions and bad status codes (#811)
If any error occurs, a warning is logged and -1 
is displayed as the number of notifications
2017-11-07 23:29:44 +01:00
Vasili Karaev
dc0edfb994 fix(i3): Check whether current ws is found (#826)
Fixes dereference of end() iterator in case current workspace is not found (#824).

Fixes #824
2017-11-01 16:47:07 +01:00
Patrick Ziegler
a3e9bb9847 Add SUPPORT.md (#803)
Adding this file to the root of the project will make a note appear when
opening a new issue, asking the user to first read this document.

As proposed in #802
2017-10-28 23:17:46 +02:00
patrick96
83610461f9 git: Update i3ipcpp
Fixes gcc build if a jsoncpp version less than 1.7.7 is installed and
jsoncpp has to be built from the source coming with i3ipcpp

Fixes #753
2017-10-28 23:08:00 +02:00
NBonaparte
d4d571425d refactor(mpd): Keep tag getters consistent 2017-10-23 15:07:03 -07:00
Chris Snell
5737156ae5 feat(temperature): Fahrenheit and Celsius tokens (#804)
%temperature-f% and %temperature-c%
2017-10-18 22:29:53 +02:00
Pier
cbd87efc64 fix(build): pow10 not defined on Fedora Rawhide (#807)
pow10 is a GNU extension and not available everywhere
2017-10-15 19:16:07 +02:00
Patrick Ziegler
caeb8ddae4 Merge pull request #785 from roobre/patch-1
Add minimum width to CPU percentage in example config
2017-10-01 00:21:25 +02:00
Roberto Santalla
705f14c413 Add minimum width to CPU percentage
It's quite obscure where to find that you can set a minimum width for tokens, and CPU usage will oscillate between 0-9 and 10+ quite frequently. I think that adding this to the example config will help users to find out that this feature exists, and avoid this annoying default.
2017-09-30 20:20:41 +02:00
NBonaparte
5b7d7b8232 Merge pull request #729 from NBonaparte/fix-prefix-suffix
fix(modules): Separate prefix/suffix tags, revert tag stack
2017-09-24 14:00:34 -07:00
Patrick Ziegler
c6b5e3016e Merge pull request #773 from patrick96/editorconfig
Add .editorconfig
2017-09-24 16:05:07 +02:00
patrick96
ad4baf87cf Add trim_trailing_whitespace to .editorconfig 2017-09-24 08:31:42 +02:00
Patrick Ziegler
0a5ad9c76f Merge pull request #772 from patrick96/nested_actions
fix(renderer): Properly support nested actions
2017-09-24 08:26:37 +02:00
patrick96
16daefd609 Add .editorconfig
For editors that don't autodetect indent style and size
2017-09-23 17:06:56 +02:00
patrick96
c7cb5ebf94 fix(renderer): Handle nested actions events properly
For nested actions, the inner action should override the outer action.
But because the list of actions was not iterated in reverse the outer
action was matched first.

Fixes #760
2017-09-23 16:53:04 +02:00
patrick96
251c3e874a fix(renderer): Only close a single action
Before the renderer would close all active matching actions. That way
nested actions would also close their surrounding action block
2017-09-23 16:49:39 +02:00
NBonaparte
89fccde765 fix(modules): Apply format settings to pre/suffix 2017-09-22 23:40:31 -07:00
Patrick Ziegler
4663d01a51 Merge pull request #727 from NBonaparte/change-cursor
feat: Change cursors over clickable/scrollable areas
2017-09-17 22:33:32 +02:00
NBonaparte
27f53eb129 Merge pull request #745 from patrick96/issues/744
fix(date): date and time string limited to 63 chars
2017-09-17 13:20:55 -07:00
NBonaparte
60f8451b34 fix(docs): Add cursor options to example 2017-09-17 13:17:04 -07:00
NBonaparte
70023b07c1 refactor(cursor): Include double clicks and fix scroll to click changes 2017-09-16 19:48:38 -07:00
NBonaparte
81c83c4364 fix(aur): Add xcb-util-cursor as dep 2017-09-16 15:31:49 -07:00
NBonaparte
e612fe1624 refactor(cursor): use map for cursor list 2017-09-16 15:31:24 -07:00
NBonaparte
b7f1960a0a fix(cursor): change arrow_names to default_names 2017-09-16 15:31:24 -07:00
NBonaparte
1886cf97a8 fix: pass action by reference 2017-09-16 15:31:24 -07:00
NBonaparte
014a9f4c31 fix(travis): Install xcb-util-cursor 2017-09-16 15:31:24 -07:00
NBonaparte
1dc111c0fa fix: make xcb-cursor optional for now 2017-09-16 15:31:24 -07:00
NBonaparte
65edba3321 feat: add cursor change 2017-09-16 15:31:24 -07:00
patrick96
b6a2c575fd refactor(date): Use cpp string comparison 2017-09-16 00:09:26 +02:00
patrick96
0024e1e9e7 refactor(date): Remove obsolescent setlocale call 2017-09-15 14:22:42 +02:00
patrick96
1bc9933a88 refactor(date): Use single stringstream
Reduces code repetition and removes the need for setting the locale in
every update
2017-09-15 14:21:38 +02:00
patrick96
6e9e739d81 fix(date): Remove string length limitation
Fixes #744
2017-09-15 14:13:35 +02:00
Chase Geigle
a682d2af91 fix(fs): Use f_frsize in filesystem calculations
This is consistent with the documentation of
std::experimental::filesystem, so I think it is the more "correct"
thing to be doing here.
2017-09-14 19:02:55 -05:00
Patrick Ziegler
b12aec1a4c Remove AUR .SRCINFO files (#746)
The SRCINFO files should be generated from the PKGBUILDs using
`makepkg --printsrcinfo > .SRCINFO` anyways. It doesn't make sense to
keep a copy in this repo
2017-09-13 20:12:07 -07:00
patrick96
524bcc30e5 Update AUR polybar pkgrel 2017-09-13 13:23:49 +02:00
patrick96
ba1276cb7d Fix AUR build failure without git identity
The `git cherry-pick` command creates a commit and thus requires a git
identity (username and/or email), if those are not set in the git
config, it will fail.

Since we don't really need a commit, this now just applies the changes
without committing them.

Fixes #748
2017-09-13 13:18:21 +02:00
NBonaparte
69992223bd fix(aur): Match .SRCINFO pkgrel 2017-09-12 19:31:23 -07:00
NBonaparte
d29957833d fix(aur): Match .SRCINFO pkgrel 2017-09-12 19:30:01 -07:00
patrick96
ac355c3747 Build polybar-git with gcc
This commit only changes pkgrel because the version of this PKGBUILD
that used clang never made it into this repo.
2017-09-12 16:34:18 +02:00
Patrick Ziegler
6c883e2cc1 Merge pull request #737 from patrick96/curlbuild_PKGBUILD
Fix curl compile errors in aur polybar package
2017-09-12 16:14:56 +02:00
patrick96
911a207cfd Fix curl compile errors in aur polybar package
The `curl/curlbuild.h` header issue has been resolved after the last
release, as a consequence the AUR package doesn't build anymore without
altering the source before compiling.

This cherry-picks the fix commit to resolve the compile errors.
2017-09-09 22:39:41 +02:00
NBonaparte
9da06c0ec2 fix(modules): Remove redundant if statement 2017-09-06 20:16:08 -07:00
NBonaparte
3ce06585ab fix(parser): Revert tag stacks 2017-09-06 20:16:08 -07:00
NBonaparte
f3bddc5af4 fix(modules): Separate prefix and suffix from output 2017-09-06 20:15:28 -07:00
NBonaparte
138f5faed8 fix(fs): Calculate used, percentages according to df
Fixes #710.
2017-09-06 17:20:10 -07:00
Patrick Ziegler
a255a022a7 fix(renderer): Correct center module position (#673)
The changes introduced in 389bae2669 to
address #551 did not consider the left border

Now center modules are centered regardless of border (left or right)
settings or tray position

Fixes #672
2017-09-04 23:46:47 -07:00
NBonaparte
e329a8150a fix(config): Expand all environment variables and file references (#724) 2017-09-04 14:00:35 -07:00
Michael Carlberg
e381d76908 git: Update submodule versions 2017-08-30 17:33:38 +02: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
NBonaparte
ce05aa36a1 feat(temperature): Add hwmon sysfs support (#688) 2017-08-29 15:10:28 -07:00
Patrick Ziegler
8c1ba8358d feat(menu): Add expand-right option (#658)
expand-right defaults to true to preserve the current functionality
If set to false, the items in the menu will be added to the left of the
toggle label (instead of the right side)

Should resolve the issue discussed in #655
2017-08-29 13:25:41 -07:00
Patrick Ziegler
b0f34c4b55 Reuse caps_str (#656)
Just to be consistent with the num lock part
2017-08-29 12:06:49 -07:00
Patrick Ziegler
9b98b766b2 Fix off by one error for action area (#663)
If the mouse was at the leftmost edge of the screen and there was an
action area from 0 to N, the click wouldn't register

Before if an action area was defined from A to B it was from A exclusive
to B inclusive now it is from A inclusive to B exclusive. This is the
same way that the pixel addresses work, since a pixel's coordinate is
defined by the top-left corner.

Fixes #661
2017-08-29 11:58:23 -07:00
patrick96
2d1e3c215f Add textual indicator for module support
If color output was surpressed, there was no way to tell in the cmake
summary, if a module is actually enabled or not.
Now each module is prefixed with either a "[X]" to indicate it's enabled
or a "[ ]" to indicate it's not
2017-07-14 10:14:13 +02:00
patrick96
d35abc7620 Remove curlbuild include
Curl removed that header in 73a2fcea0b4adea6ba342cd7ed1149782c214ae3
([1])
http.cpp doesn't use anything from that header and compilation works for
fine with curl 7.54.1

Fixes #647
Ref:
[1]: 73a2fcea0b
2017-07-14 10:12:33 +02:00
Dmitry Marakasov
2314ca030c Add more information on packages 2017-07-11 14:41:33 +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
d3b0670f30 fix(config): Perform tilde expansion on include-file #603 2017-06-02 18:34:49 +02:00
Ingo Bürk
28431be67e Fixed a typo in the README. 2017-05-19 18:02:57 +02:00
rps
f581095cb7 Fixes #535 and #411. 2017-05-19 18:02:33 +02:00
Michael Carlberg
389bae2669 fix(renderer): Adjust center block position when using tray
Fixes #551
2017-05-19 17:25:04 +02:00
Olmo Kramer
3f5141bf22 bash completion 2017-05-19 17:02:47 +02:00
Michael Carlberg
2e8cc7f503 fix(parser): Ignore sequential duplicates in color stacks 2017-05-17 23:11:59 +02:00
Michael Carlberg
0bd8f1f69a fix(parser): Proper handling of %{R} #585 2017-05-17 23:11:06 +02:00
Michael Carlberg
5af5292808 Revert "fix(parser): Use value stacks for %{R} tag #585"
This reverts commit d141d8b5e4.
2017-05-17 22:20:38 +02:00
Michael Carlberg
d141d8b5e4 fix(parser): Use value stacks for %{R} tag #585 2017-05-17 22:06:12 +02:00
Michael Carlberg
86ff947e38 fix(process_util): Prefix shell env var
Fixes #566
2017-05-12 17:55:05 +02:00
Michael Carlberg
b6c5563b0b feat(ipc): Add visibility commands 2017-05-12 17:55:05 +02:00
Michael Carlberg
23a7717120 fix(controller): Remove unused function 2017-05-12 17:55:05 +02:00
Vasili Karaev
5c41e3d045 feat(mpd): Add state-specific formats #524 2017-05-09 14:56:29 +02:00
Michael Carlberg
b2f00cc08a feat(parser): Stack font indexes set with %{T} 2017-04-26 19:25:42 +02:00
Michael Carlberg
24b2de5534 refactor(parser): Naming of parse methods 2017-04-26 19:25:02 +02:00
Michael Carlberg
31ba2f38bd fix(parser): Make the %{U} tag use color stacks #544 2017-04-26 19:01:55 +02:00
Michael Carlberg
5c7e3cbbac fix(parser): Reset color stacks #544 2017-04-26 18:53:04 +02:00
Michael Carlberg
802e69abaf fix(docs): Distro packages 2017-04-26 18:41:41 +02:00
Michael Carlberg
eebf1055e5 fix(parser): Overline tags 2017-04-25 20:30:21 +02:00
Michael Carlberg
f754fa2710 feat(parser): Keep track of formatting colors #544 2017-04-25 20:26:56 +02:00
Michael Carlberg
d19b610109 Merge pull request #521 from TonCherAmi/520-fix-i3-ws-click
fix(i3): Use ws name for click handling
2017-04-06 18:14:11 +02:00
Vasili Karaev
863c510903 fix(i3): Use ws name for click handling #520 2017-04-06 06:22:11 +03:00
Michael Carlberg
4e2e2a7a5e build: Bump version to 3.0.5 2017-04-03 23:56:04 +02:00
Michael Carlberg
d6b0c5f003 fix(bspwm): Focus monitor before sending scroll cmd #503 2017-04-02 18:21:09 +02:00
Michael Carlberg
02833b7871 feat(volume): Optional event handling #84 2017-04-02 18:12:07 +02:00
Vasili Karaev
68beb8d744 fix(i3): Check whether current ws is focused before issuing scroll commands #503 2017-03-31 22:26:24 +02:00
Vasili Karaev
db0ab78d62 fix(i3): Handle scrolling internally #503 2017-03-31 22:26:24 +02:00
Michael Carlberg
f6ff8a0ca2 Merge pull request #501 from TonCherAmi/500-fix-mpd-crash
fix(mpd): Check state before calling playback controls
2017-03-27 22:53:23 +02:00
Vasili Karaev
7bb168679d fix(mpd): Check state before calling playback controls #500 2017-03-26 11:25:32 +03:00
Michael Carlberg
5c86842083 fix(renderer): Do not escape parsed action cmds #444 2017-03-21 16:21:53 +01:00
Michael Carlberg
f3089e88f2 feat(conf): Properties for top/bottom radius #445 2017-03-21 14:49:33 +01:00
Michael Carlberg
e303f5248a fix(xbps): Update package template
Closes #476
2017-03-16 11:35:33 +01:00
Michael Carlberg
23a8042411 fix(tray): Remove invalid clients #487 2017-03-15 23:52:59 +01:00
Michael Carlberg
f08e42856e Merge pull request #482 from nico202/master
fs: Fix wrong size report
2017-03-15 23:45:53 +01:00
Nicolò Balzarotti
84ee0d560c fs: Fix wrong size report 2017-03-13 10:21:21 +01:00
Michael Carlberg
9a72584680 Merge pull request #466 from jereksel/patch-1
Fix typo
2017-02-27 10:52:12 +01:00
Andrzej Ressel
c2629fb77a Fix typo 2017-02-26 23:22:00 +01:00
Michael Carlberg
3c3ebc92cc Merge pull request #442 from raidzero/master
Add battery usage/charge in watts token %consumption%
2017-02-26 14:56:56 +01:00
Michael Carlberg
57d98d6767 Merge pull request #461 from saboorian/master
fix(cmake): install_manifest has a .txt extension
2017-02-25 22:01:20 +01:00
Mohammad Saboorian
82dc7c895e install_manifest has a .txt extension 2017-02-25 11:01:19 +03:30
raidzero
50aba85ad0 Merge remote-tracking branch 'upstream/master' 2017-02-23 14:50:09 -07:00
raidzero
a00f052002 formatting changes 2017-02-23 09:04:49 -07:00
Alex Feldman-Crough
90fa9c8230 Mention NixOS with the other operating systems 2017-02-23 13:29:33 +01:00
Adam Ransom
47bc459742 fix(bspwm): Update when focusing urgent desktops
When focusing a desktop with the urgent flag, two events are received
from `bspc` simultaneously, separated by a newline character.

This was not handled correctly and the second event was discarded causing
the urgent style to be removed, but the focused style would remain on the
previously focused desktop.

This fixes the problem by handling any number of events that arrive at the
same time (separated by newlines).
2017-02-23 13:28:26 +01:00
Eivind Uggedal
98610461de fix(build): POSIX compliant command usage
Shells like dash do not support printing paths of more
than one argument with the builtin `command -vp`.
2017-02-23 13:26:18 +01:00
NBonaparte
44f12c6065 feat(xworkspaces): add urgent desktop detection 2017-02-23 13:20:26 +01:00
raidzero
93c425fdfe Add battery usage/charge in watts token %consumption% 2017-02-16 14:35:43 -07:00
Chase Geigle
bd8e748399 fix(builder): use unicode-aware truncation for label-maxlen 2017-02-16 09:19:26 +01:00
Chase Geigle
73faa18cf0 fix(label): Truncate label replacements based on codepoint count
This helps ensure that when a string is truncated it is not done in the
middle of a utf8 multi-byte sequence. This doesn't 100% correspond to
user-perceived characters, but it should be pretty close in most cases.
2017-02-15 14:19:47 +01:00
Michael Carlberg
1d06df25a9 fix(config): Use std::map to store sections #412 2017-02-07 14:56:56 +01:00
Michael Carlberg
1f31870d43 build: Bump version to 3.0.4 2017-02-05 14:09:43 +01:00
Michael Carlberg
384c12a896 fix(xwindow): Lock mutexes on update #416 2017-02-05 13:37:16 +01:00
Tudor Brindus
107bdb91e3 fix(memory): Implement memory updating for pre-3.4 kernels (#410)
Since 3.4, `/proc/meminfo` contains a `MemAvailable` field, which polybar uses to determine
`(gb|mb)_free` and `(gb|mb)_used`. This commit adds a fallback for when `MemAvailable` does
not exist, allowing a fairly-accurate approximation on older kernels.

This commit also removes the reliance on the exact order fields appear in `/proc/meminfo`.
2017-02-04 18:19:58 +01:00
Michael Carlberg
9ced7dbf73 fix(xcomposite): Disable extension query #406 2017-02-04 19:14:10 +01:00
Michael Carlberg
8146f65286 fix(xrender): Add header declarations #406 2017-02-04 19:13:08 +01:00
Michael Carlberg
6fa2d3943c fix(timer_module): Catch warmup exceptions
Refs #399
2017-01-31 12:38:38 +01:00
Michael Carlberg
82d360e634 fix(fs): Use available bytes to calculate free disk space
Refs #396
2017-01-30 14:39:06 +01:00
Michael Carlberg
9f1d9a14fd fix(renderer): Use correct width for top border
Refs #390
2017-01-29 15:25:31 +01:00
László Várady
701102d44b fix(cairo): Fix font prioritization
In the previous implementation, std::find() returned fns.end() several times,
which caused an "Address boundary error" in std::sort if the preferred
font-index was set to m_fonts.size() + 1.

This commit reimplements the font prioritization with a simple swap.

Reproduction steps:

- Start polybar with the following config:

  [bar/top]
  font-0 = NotoSans-Regular:size=8;0
  font-1 = MaterialIcons:size=10;0

  modules-left = date

  [module/date]
  type = internal/date
  date = %Y-%m-%d
  label-font = 3 ; invalid index
2017-01-29 15:16:00 +01:00
László Várady
8a98fb78b6 fix(version): Follow APP_VERSION in POLYBAR_NS 2017-01-29 15:16:00 +01:00
László Várady
7e7dc68e5a fix(github): Hide label if 'empty-notifications' is disabled
Before the first update(), the label should stay 'hidden'.
2017-01-29 15:16:00 +01:00
Michael Carlberg
501921ef12 build: Bump version to 3.0.3 2017-01-27 15:53:44 +01:00
Michael Carlberg
3e4a4ce78f fix(renderer): Alignment blocks 2017-01-27 15:36:37 +01:00
Michael Carlberg
beedc5ab84 fix(color_util): Parsing 2017-01-27 13:46:27 +01:00
Michael Carlberg
af5f129b76 fix(tray): Drop warning 2017-01-27 13:33:39 +01:00
Michael Carlberg
41f7f82bd0 fix(cmake): Debug check 2017-01-27 13:30:23 +01:00
Michael Carlberg
eb5c82a5c3 fix(modules): Warmup in runner thread to avoid block 2017-01-27 13:29:10 +01:00
Michael Carlberg
b241018786 fix(aur): Cleanup 2017-01-27 04:15:41 +01:00
Michael Carlberg
dc366079ae feat(build): Development tasks 2017-01-27 04:15:14 +01:00
Michael Carlberg
042d385015 fix(i3): Add state descriptions 2017-01-27 03:23:42 +01:00
Michael Carlberg
fb709aeab3 fix(i3): Workspace state when visible on unfocused monitor 2017-01-27 03:03:57 +01:00
Michael Carlberg
2912f0f3f2 fix(cmake): Require xcb-randr>=1.12 for monitors
Refs #344
2017-01-27 00:35:00 +01:00
Michael Carlberg
d5d941e663 build: Bump version to 3.0.2 2017-01-26 21:57:01 +01:00
Michael Carlberg
07cb5f134e fix(renderer): Cleanup 2017-01-26 21:55:42 +01:00
Michael Carlberg
73aa721f90 fix(config): Error message 2017-01-26 21:34:38 +01:00
Michael Carlberg
087ea4e087 fix(cmake): Add missing xcb prototype 2017-01-26 21:15:21 +01:00
Michael Carlberg
00d6fc9646 fix(cmake): Invalid path 2017-01-26 20:36:00 +01:00
Michael Carlberg
76c657db70 fix(cmake): Specify configure_file dest 2017-01-26 20:33:13 +01:00
Michael Carlberg
874e6b0d6c feat(config): Add directive for file inclusion 2017-01-26 20:10:33 +01:00
Michael Carlberg
febe6997b6 feat(config): Add fallback support to local value references 2017-01-26 19:33:14 +01:00
Michael Carlberg
ca64affa1a fix(cli): Trim -vv output 2017-01-26 17:41:16 +01:00
Michael Carlberg
43a17c3b36 refactor(cmake): Cleanup 2017-01-26 17:39:50 +01:00
Michael Carlberg
b97e4c56c5 fix(cmake): Properly check xcb-xrm
The default value of WITH_XRM was never calculated because
the "IF NOT DEFINED" check was done after the call to option()

Refs #381
2017-01-26 12:59:13 +01:00
Michael Carlberg
162e77793a fix(tray): Ignore if detached
Refs #383
2017-01-26 12:46:10 +01:00
Michael Carlberg
897b6e0221 build: Bump version to 3.0.1 2017-01-26 02:40:35 +01:00
Michael Carlberg
0c274709c0 fix(aur): Add git to makedepends 2017-01-26 02:37:58 +01:00
Michael Carlberg
5535a75bef docs: Update example config 2017-01-26 02:34:37 +01:00
Michael Carlberg
5283fbff01 fix(renderer): Fill background to the sub blocks
Paint the background on each sub block instead of the base surface.
Fixes the compositing ops.
2017-01-26 01:53:25 +01:00
Michael Carlberg
b16c105514 feat(modules): Move default format values to the config
Fallback values for all module formats can now be set
in the configuration. For example:

    [settings]
    format-padding = 2
    format-underline = #00f
2017-01-26 01:50:02 +01:00
Michael Carlberg
8138a12381 refactor(renderer): Cleanup 2017-01-25 23:38:51 +01:00
Michael Carlberg
09808e99f9 refactor(tray): Cleanup 2017-01-25 23:37:16 +01:00
Michael Carlberg
d8d007aa9c refactor(cairo): Cleanup 2017-01-25 23:37:13 +01:00
Michael Carlberg
37d0a0e57b refactor(cmake): Cleanup 2017-01-25 23:28:25 +01:00
Michael Carlberg
886d0f4ff3 fix(renderer): Round floatig point numbers
Refs #378
2017-01-25 21:46:18 +01:00
Michael Carlberg
8fa879c8d8 fix(cmake): Require xcb-proto>=1.12 for monitor support
Refs #344
2017-01-25 20:16:04 +01:00
Michael Carlberg
017abee679 fix(cmake): Require randproto>=1.5 for monitor support
Refs #344
2017-01-25 17:36:40 +01:00
Michael Carlberg
95d5b03fa2 refactor(file_util): Expand tilde manually 2017-01-25 17:07:55 +01:00
Michael Carlberg
9d589fa5a7 fix(docs): Update example config 2017-01-25 15:58:58 +01:00
Michael Carlberg
bfefbecfd9 fix(docs): Update manpage 2017-01-25 15:32:49 +01:00
Michael Carlberg
4d6dfd3e2c build: Bump version to 3.0.0 2017-01-25 15:26:44 +01:00
Michael Carlberg
214b3ddca8 fix(ci): Deps cache 2017-01-25 15:21:58 +01:00
Michael Carlberg
02ab1b9a81 fix: Allow explicit override with property shorthand
Refs #375
2017-01-25 15:13:03 +01:00
Michael Carlberg
eae612ce95 fix: Use correct name for padding shorthand
Refs #375
2017-01-25 15:03:57 +01:00
Michael Carlberg
f37ecfe959 fix(renderer): Falloff gradient 2017-01-25 15:00:34 +01:00
Michael Carlberg
1ca71ce401 fix(ci): Remove unused function 2017-01-25 12:20:06 +01:00
Michael Carlberg
14fb86ec70 refactor(cairo): Less greedy glyph matching
Only match glyphs for consecutive characters when
the default/preferred font is being tested.

Refs #374
2017-01-25 12:03:06 +01:00
Michael Carlberg
c7f33e2567 refactor(renderer): Use redirection groups instead of pixmaps 2017-01-25 09:54:18 +01:00
Michael Carlberg
d2eeac9b22 fix(cairo): Use font metrics as vertical baseline
Refs #372
2017-01-25 04:40:59 +01:00
Michael Carlberg
1a25be374f refactor(xworkspaces): Cleanup 2017-01-25 04:35:56 +01:00
Chase Geigle
6364bb4385 feature(renderer): Allow dpi-x and dpi-y configuration
Negative values for any of the DPI settings are used to mean "auto",
which will attempt to compute an appropriate DPI from monitor settings.
2017-01-25 04:35:35 +01:00
Chase Geigle
e7dc6b8bbb fix(renderer): Use proper font scaling based on DPI
This tries to mimic the old renderer's behavior as closely as possible.
In the absence of any information, DPI is assumed to be 96x96. DPI can
be configured on a per-bar basis using the configuration key "dpi".

To use the DPI configuration from Xresources (if built with support),
one can specify the following in the bar config:

dpi = ${xrdb:Xft.dpi:96}
2017-01-25 04:35:35 +01:00
Michael Carlberg
8d79b582ec fix(renderer): Default all comp. operators to OVER 2017-01-24 14:25:01 +01:00
Michael Carlberg
b521ec737d fix(ci): Cache directory 2017-01-24 14:02:54 +01:00
Michael Carlberg
681a4b7935 fix(docs): Update example config 2017-01-24 13:32:56 +01:00
Michael Carlberg
42a982a4a5 fix(ci): Cache cmake archive 2017-01-24 13:23:38 +01:00
Michael Carlberg
c656ccd701 fix(docs): Update example config font 2017-01-24 13:17:13 +01:00
Michael Carlberg
8147e2a511 fix(cmake): Font not found message 2017-01-24 13:02:55 +01:00
Michael Carlberg
9cafc50012 fix(aur): Replace pkgver 2017-01-24 12:45:53 +01:00
Michael Carlberg
c74a1647ab fix(color_util): Add missing header 2017-01-24 12:37:19 +01:00
Michael Carlberg
f974609fc5 fix(ci): Exit if make fails 2017-01-24 12:12:12 +01:00
Michael Carlberg
31cde9014a fix(x11): Add missing header 2017-01-24 12:09:09 +01:00
Michael Carlberg
e7b4b4992c build: Bump version to 3.0.0-alpha 2017-01-24 12:06:58 +01:00
Michael Carlberg
e126a669d8 fix(docs): Update example config 2017-01-24 11:59:10 +01:00
Michael Carlberg
1a5246e940 refactor(cairo): Use shared_ptr for font list 2017-01-24 11:50:26 +01:00
Michael Carlberg
e857a34f52 fix(aur): Replace libxft with cairo 2017-01-24 11:14:57 +01:00
Michael Carlberg
3e37b9ec8e fix(cairo): Increment textblock bg extents 2017-01-24 11:07:18 +01:00
Michael Carlberg
24a2d73ed1 git(xpp): Update submodule ref 2017-01-24 10:49:38 +01:00
Michael Carlberg
6692b4a8da refactor(x11): Cleanup 2017-01-24 10:49:14 +01:00
Michael Carlberg
a5d6670121 refactor(clang-tidy): Apply fixes 2017-01-24 08:01:04 +01:00
Michael Carlberg
8b9461e63e wip(refactor): Cairo drawing 2017-01-24 07:41:46 +01:00
Michael Carlberg
13633f715d fix(main): Exit on unrecognized positional arg 2017-01-24 07:11:14 +01:00
Michael Carlberg
d6a34717bf fix(ipc): Remove existing fifo file 2017-01-24 07:11:14 +01:00
Michael Carlberg
6cc7a2c093 fix(color_util): Use lambda 2017-01-24 07:11:14 +01:00
Michael Carlberg
4558893c37 docs: Update manpage 2017-01-24 07:11:14 +01:00
Michael Carlberg
a59e115622 wip(refactor): Cairo drawing 2017-01-24 07:11:14 +01:00
Michael Carlberg
452afcdc68 refactor: Integral types 2017-01-24 07:11:14 +01:00
Michael Carlberg
5e1886a312 wip(refactor): Cairo drawing 2017-01-24 07:11:14 +01:00
Chase Geigle
47a2cce03d fix: Ensure reloading when IN_IGNORED fired on config (#371)
This fixes a "bug" where polybar wouldn't reload on a configuration
file change on some configurations of vim, which don't actually issue
any IN_MODIFY events because they choose to move the file, replace it
with a new one, and then delete the file instead.

To work around this, we now also listen for IN_IGNORED which fires when
the file we are watching is destroyed. When this happens, we re-attach
the configuration file watcher to the new file and reload.
2017-01-24 07:10:55 +01:00
Daniel Lublin
b6661825ce fix(xrm): res_class==nullptr to properly get the resource (#368)
Not sure what "String" was supposed to do, my tests with xcb-xrm gives that
res_class==nullptr properly gets the resource value, =="String" does not.
2017-01-23 17:54:20 +01:00
Michael Carlberg
1fdc742606 fix(command): Decrease log verbosity
Refs #362
2017-01-23 17:11:07 +01:00
xd1le
a9759c128d docs: Fix some README typos 2017-01-23 17:02:40 +01:00
Patrick Yates
2dfdbd240e feat(bspwm,i3): Fuzzy-matching names for icons
Added support for fuzzy matching workspace names when assigning icons.
This feature is enabled/disabled through a new option, 'fuzzy-match'.
It is disabled by default.
2017-01-23 17:01:30 +01:00
Michael Carlberg
ca0d7345a1 fix(ci): Update travis 2017-01-20 05:15:58 +01:00
Michael Carlberg
f5adb8ace7 fix(ci): Remove xcb-xrm from apt-get packages 2017-01-20 03:33:54 +01:00
Michael Carlberg
20b196f5e0 fix(cmake): Typo 2017-01-20 03:32:44 +01:00
Michael Carlberg
f85e7c8f40 fix(ci): Build xcb-xrm 2017-01-20 03:30:03 +01:00
Michael Carlberg
9e83c55a70 fix: Revert removal of xcb-util-image 2017-01-20 02:54:06 +01:00
Michael Carlberg
aea5e3c9ff fix(ci): Install libxcb-xrm-dev 2017-01-20 02:43:12 +01:00
Michael Carlberg
7c662db95d fix(docs): Update dependency list 2017-01-20 02:33:41 +01:00
Michael Carlberg
48749b12d8 fix(bar): Improve error message for unparsable color 2017-01-20 02:32:52 +01:00
Michael Carlberg
892673c405 fix(config): Require value reference without fallback 2017-01-20 02:31:55 +01:00
Michael Carlberg
5ad0081e76 fix(command_line): Filter positional args 2017-01-20 02:30:05 +01:00
Michael Carlberg
e1483c3f65 refactor(xresources): Use xcb-util-xrm
Drop the Xlib version and handle X resource
lookups using xcb-util-xrm

Refs #356
2017-01-20 02:26:01 +01:00
Michael Carlberg
100c64a20c refactor: Make xresource_manager a singleton
Refs #356
2017-01-19 21:27:01 +01:00
Michael Carlberg
90d1fff4e2 fix(xresources): Avoid continuous reconstruction
Refs #356
2017-01-19 20:37:02 +01:00
Michael Carlberg
374ad655ae fix(xrsources): Safety check
Refs #356
2017-01-19 20:19:18 +01:00
Michael Carlberg
9e3a7cf06c fix(label): Add missing character 2017-01-17 15:38:28 +01:00
Michael Carlberg
e0e9cae2eb fix(label): Improve false positive token filtering 2017-01-17 15:28:52 +01:00
Michael Carlberg
0f87d37137 fix(fs): Set bytes_avail
Refs #343
2017-01-17 15:20:46 +01:00
Elohim Falcón
132b832c52 fix(xwindow): Give priority to _NET_WM_NAME (#342) 2017-01-17 14:59:32 +01:00
Michael Carlberg
826e125c80 fix(menu): Broadcast tree reset
Fixes #327
2017-01-15 03:46:31 +01:00
Michael Carlberg
40d482d039 fix: By-pass double click timers if no handlers are defined
Fixes #338
2017-01-15 02:00:35 +01:00
Michael Carlberg
084ff6d455 fix(aur): Use vercmp 2017-01-14 20:44:41 +01:00
Michael Carlberg
73df20dc75 fix(aur): Strip all non-digits when comparing versions 2017-01-14 19:59:01 +01:00
Michael Carlberg
a964e3bc7d build: Bump version to 2.5.2 2017-01-14 18:17:39 +01:00
Michael Carlberg
bdeb818718 aur: Add change notice about token update 2017-01-14 18:00:35 +01:00
Michael Carlberg
3292cea786 refactor(tokens): Move token suffix to configuration 2017-01-14 18:00:35 +01:00
Michael Carlberg
b395285a68 refactor(ipc): More state checks 2017-01-14 18:00:29 +01:00
Alexander Polynomdivision
d3d3f3e6fa Modify the 'volume' module to load the name of the soundcards of the master, speaker and headphone mixer 2017-01-14 17:59:47 +01:00
Alexander Polynomdivision
22e255747a Update the mixer class to support setting the name of the soundcard we want to get the mixer of 2017-01-14 17:59:47 +01:00
Michael Carlberg
497221b1ab docs: Update README 2017-01-14 13:16:20 +01:00
Michael Carlberg
bdd6569ef7 fix(build): Use full destination path for config install 2017-01-14 13:15:59 +01:00
Michael Carlberg
9ce384b7e8 fix(ci): Update test 2017-01-14 10:02:44 +01:00
Michael Carlberg
6250a2b746 fix(streambuf): Buffer size 2017-01-14 09:57:09 +01:00
Michael Carlberg
dceb3606b1 refactor(stringstream): Shorten to sstream 2017-01-14 06:11:51 +01:00
Michael Carlberg
977efd15e5 fix(ci): Compiler errors 2017-01-14 06:02:43 +01:00
Michael Carlberg
53772e9c32 feat(ipc): Add pid token 2017-01-14 00:56:43 +01:00
Michael Carlberg
480c2cb44b controller: Lower verbosity of uncaught event msg 2017-01-14 00:34:35 +01:00
Michael Carlberg
dacf36b981 refactor(ipc): Cleanup 2017-01-14 00:27:29 +01:00
Michael Carlberg
ed87a8924f fix(ipc): And double-click handlers 2017-01-14 00:10:55 +01:00
Michael Carlberg
e20150e6ca feat(cmake): Query fonts 2017-01-14 00:05:54 +01:00
Michael Carlberg
ef2ad7a504 fix(volume): Fixed action blocks
Refs #329
2017-01-13 17:08:16 +01:00
Michael Carlberg
2fea813c3d fix(github): Clear label on empty notifications
Fixes #278
2017-01-13 14:57:31 +01:00
Michael Carlberg
57e8914fa6 fix: Force update after running input command 2017-01-13 14:33:16 +01:00
Michael Carlberg
989e4c3039 cmake: MinSizeRel flags 2017-01-13 13:17:11 +01:00
Michael Carlberg
f52a3c1389 fix(ipc): Tool cleanup 2017-01-13 13:05:32 +01:00
Michael Carlberg
15f880eba4 fix(mpd): Handle broken connections 2017-01-13 13:02:51 +01:00
Michael Carlberg
22140f7db9 refactor(builder): Action wrapped labels 2017-01-13 13:01:46 +01:00
Michael Carlberg
e1dbd98c40 feat(string_util): Custom stringstream 2017-01-13 13:01:22 +01:00
Michael Carlberg
6fb48c8e6f feat(build): Add flag for drawing visible whitespace 2017-01-13 11:04:43 +01:00
Michael Carlberg
a26a15d485 fix(config): Type mismatch 2017-01-13 10:57:43 +01:00
Michael Carlberg
f56bb419d2 fix: Format whitespace handling
Refs #325
2017-01-13 10:54:41 +01:00
Michael Carlberg
cabdb4f8d5 feat(zsh): Compdef for polybar-msg 2017-01-13 07:28:21 +01:00
Michael Carlberg
99e432cae7 fix(zsh): Disable incompatible flags 2017-01-13 07:27:49 +01:00
Michael Carlberg
3714884660 fix(zsh): Add missing flags 2017-01-13 06:01:20 +01:00
Michael Carlberg
8d355f8255 fix(ipc): Avoid clearing module content
Refs #324
2017-01-13 05:33:34 +01:00
Michael Carlberg
184a1c5281 fix(zsh): Allow bar name at any pos 2017-01-13 05:02:41 +01:00
Michael Carlberg
cacc11e3a2 fix: Do not require bar name to list monitors
Refs #208
2017-01-13 04:50:33 +01:00
Michael Carlberg
b48a275235 feat(command_line): Properly handle positional args 2017-01-13 04:47:25 +01:00
Michael Carlberg
761b224f7c fix(xrandr): Merge outputs and 1-output monitors
Refs #280
2017-01-13 04:31:54 +01:00
Michael Carlberg
081578b168 fix(cmake): Require XRandR 1.5+ for monitor support
Refs #280
2017-01-13 04:13:46 +01:00
Michael Carlberg
506ac3e4ac fix(xrandr): Enable monitor support by default
Refs #280
2017-01-13 04:02:27 +01:00
Michael Carlberg
385572ec64 feat(xrandr): Support for monitors
Refs #280
2017-01-13 03:52:57 +01:00
Michael Carlberg
462e53d6c8 build: Bump version to 2.5.1 2017-01-13 01:15:52 +01:00
Michael Carlberg
40493497de fix: Allow size_t narrowing 2017-01-13 01:14:50 +01:00
Michael Carlberg
0a24dc4912 fix(cmake): Use target_compile_options for libflags
Refs #308
2017-01-13 01:05:10 +01:00
Michael Carlberg
f8d387c2c0 git(xpp): Update submodule ref 2017-01-13 00:55:04 +01:00
Michael Carlberg
07c0fbdcb3 fix(timer_module): Sleep at beginning since already warmed up 2017-01-12 23:33:36 +01:00
Michael Carlberg
6dd72aa6f7 refactor(fs): Read /proc/self/mountinfo
Refs #271
2017-01-12 23:33:32 +01:00
Michael Carlberg
c737493620 fix(mtab): Add missing header 2017-01-12 21:11:21 +01:00
Michael Carlberg
92cc4d6f40 fix(modules): Warmup module on start 2017-01-12 20:29:08 +01:00
Michael Carlberg
c2ac7fde67 refactor: Filesize strings 2017-01-12 20:28:44 +01:00
Michael Carlberg
9184a8b046 fix(memory): Safety check 2017-01-12 20:25:57 +01:00
Michael Carlberg
2cde3f31a0 fix(config): Comply to parameter naming scheme 2017-01-12 18:09:56 +01:00
Michael Carlberg
d49b1cacd3 fix(config): Rename parameter for individual border size
Rename `border-{left,top,right,bottom}` to `border-{left,top,right,bottom}-size`
to follow the naming scheme used for other size parameters
2017-01-12 17:55:56 +01:00
Michael Carlberg
16a355a2b7 fix(config): Remove default value for module-margin-right 2017-01-12 17:42:09 +01:00
Michael Carlberg
ca1aac2ed6 feat(config): Shorthand for {padding,module-margin}-{left,right} 2017-01-12 17:32:11 +01:00
Michael Carlberg
c26d6d3696 build: Bump version to 2.5.0 2017-01-12 16:37:33 +01:00
Michael Carlberg
f72ddf9294 refactor(signals): Use full namespace 2017-01-12 16:34:14 +01:00
Michael Carlberg
da9f1d90f4 fix(controller): Ensure module runstate 2017-01-12 16:33:41 +01:00
Michael Carlberg
f33d383726 refactor: Wait with tray initialization until ready 2017-01-12 16:12:54 +01:00
Michael Carlberg
ef6f649579 fix(fs): Make sure to match with correct mtab entry
Fixes #321
2017-01-12 15:30:47 +01:00
Michael Carlberg
5773b08cf8 fix(script): Poll file descriptors 2017-01-11 18:21:58 +01:00
Michael Carlberg
d7d0fbcae4 fix(battery): Safety check
Make sure returned label is valid before access.

Refs #318
2017-01-11 15:01:39 +01:00
Michael Carlberg
30201bac38 fix(env_util): Add missing header 2017-01-11 09:28:39 +01:00
Michael Carlberg
e441332f40 fix(xbacklight): Value type 2017-01-11 09:23:27 +01:00
Michael Carlberg
5b33ada576 refactor(common): Cleanup 2017-01-11 07:17:54 +01:00
Michael Carlberg
c2bee14d34 fix(test): Use correct namespace 2017-01-11 05:05:11 +01:00
Michael Carlberg
568837d06a fix(x11): Preload the _NET_WM_WINDOW_OPACITY atom 2017-01-11 05:00:23 +01:00
Michael Carlberg
5c9bfc147c fix(xbacklight): Lower inc/dec value to 5 and fix flooring 2017-01-11 04:40:10 +01:00
Michael Carlberg
e2480da8c6 fix(git): Remove generated file from index 2017-01-11 04:14:20 +01:00
Michael Carlberg
8cc885c316 refactor: Cleanup 2017-01-11 03:07:28 +01:00
Michael Carlberg
c1aa3319a1 fix(menu): Close tree when item commands are invoked 2017-01-11 02:44:44 +01:00
Michael Carlberg
30f516dd7d fix(formatting): Make formats parse specs as-is
This removes the spacing tinkering when parsing format specs.
The following example uses the old behavoir:

    format-test = <label-foo>  <label-bar>
    format-breaks = <label-foo><label-bar>/<bar-test>

`format-test` would replace all occurences of ' ' with the
a space string with defined `spacing` as its width. `format-breaks` would
not validate as the tags where split with ' ' as delimiter.

All that nonsense has been removed and each tag is extracted as is.
The `spacing` parameter can still be used to apply N extra whitespaces
between the tags, but it is now 0 by default.
2017-01-11 02:43:37 +01:00
Michael Carlberg
f4e8051e9e refactor(script): Merge back script handling 2017-01-10 05:12:53 +01:00
Michael Carlberg
946843ff59 feat(script): Configurable condition using exec-if
Add new config parameter `exec-if = cmd` that needs to
exit successfully before the main exec command will be invoked.

Closes #298
2017-01-10 03:02:00 +01:00
Michael Carlberg
79856d7ed2 feat(ipc): Add polybar-msg to facilitate ipc messaging 2017-01-10 02:09:33 +01:00
Michael Carlberg
0f0d786cbd fix(ipc): Always close file descriptor on receive 2017-01-09 23:09:16 +01:00
Michael Carlberg
7a26254844 feat(ipc): Initial exec of configured hook
Adds a new config parameter `initial = N` that will
make the hook at defined index N execute on start.
2017-01-09 23:06:41 +01:00
Michael Carlberg
56b89d5a44 docs: Add link to xbps template 2017-01-09 20:56:45 +01:00
Michael Carlberg
704efe05d2 fix(file_util): Explicit initialization of stream base
Clang 3.8 emits a compiler warning due to the deleted
default constructors of the base class.
2017-01-09 20:48:53 +01:00
Michael Carlberg
66131c807f build: Bump version to 2.4.8 2017-01-09 19:01:14 +01:00
Michael Carlberg
f4406783e2 fix(signals): Use pointer to value
Only pass pointers to emitted signal value since the signal receivers
will be called on the same thread as the signal emitter.

Refs #302
2017-01-09 18:52:04 +01:00
Michael Carlberg
5f6a1f5ae6 fix(xkeyboard): Use separate throttle timers 2017-01-09 16:40:26 +01:00
Michael Carlberg
3d6084f0c0 fix(controller): Always process forced update events 2017-01-09 16:35:28 +01:00
Michael Carlberg
3722ac1617 fix(label): Drop token close character from suffix substring
Refs #305
2017-01-09 15:23:51 +01:00
Michael Carlberg
eeaad512a9 fix(battery): Calculation of remaining dis-/charge seconds
- Optimize calculation
- Do not allow division by zero

Refs #303
2017-01-09 14:58:14 +01:00
Michael Carlberg
6925415501 fix(tray): Force bar update on change
Refs #295
2017-01-09 14:27:56 +01:00
Michael Carlberg
5458c433b6 build: Bump version to 2.4.7 2017-01-08 21:30:22 +01:00
Michael Carlberg
35f441cdde fix(fs): Mounted state
Fixes #271
2017-01-08 20:42:59 +01:00
Michael Carlberg
c39103a307 docs: add irc channel 2017-01-08 17:28:51 +01:00
Michael Carlberg
ef442025fa fix(battery): File contents comparison
Refs #297
2017-01-07 12:08:16 +01:00
Michael Carlberg
5c55beed7b fix(fs): Value type 2017-01-02 02:50:22 +01:00
Michael Carlberg
4c4cf87036 aur: Print post_install message 2017-01-02 02:32:16 +01:00
Michael Carlberg
e80f5f372f build: Bump version to 2.4.6 2017-01-01 21:42:14 +01:00
Michael Carlberg
b8545cbbd1 cmake: Install zsh compdef 2017-01-01 21:40:03 +01:00
Michael Carlberg
e0688307f3 wip(systray): Add module base 2017-01-01 21:28:28 +01:00
Michael Carlberg
6341c7ab25 refactor(config): Defer xrm initialization 2017-01-01 21:12:38 +01:00
Michael Carlberg
ce7faa9fe7 refactor(x11): Close xlib display 2017-01-01 21:11:01 +01:00
Michael Carlberg
a2bcb1a627 refactor(signals): Avoid reinterpret_cast 2017-01-01 20:31:09 +01:00
Michael Carlberg
d9c035381e refactor(i3): Restack above global root window
Refs #293
2017-01-01 19:34:48 +01:00
Michael Carlberg
0c39061c98 feat(bspwm): Add option to inline mode indicators 2017-01-01 16:39:25 +01:00
Michael Carlberg
796cdb52cc refactor: Rename restack function 2017-01-01 15:45:18 +01:00
Michael Carlberg
2ebaa0fb5f fix(i3): Put below root when restacking window
Refs #293
2017-01-01 15:37:50 +01:00
Michael Carlberg
9c191cb025 fix(net): Always close socket handle
Refs #283
2017-01-01 15:10:58 +01:00
Michael Carlberg
ccddf052ec refactor(script): Split non-/tail logic
Split the script module into one tailing output module and
one exec once module.

Refs #281
2017-01-01 09:05:18 +01:00
Michael Carlberg
611ed0e348 fix(battery): Cap value of full-at 2017-01-01 04:00:35 +01:00
Michael Carlberg
cc5a5ef25c fix(file_util): Type specification
Fixes #290
2017-01-01 01:23:50 +01:00
Michael Carlberg
0d7f040256 fix(xkb): Auto-deduce types
Fixes #291
2017-01-01 01:17:30 +01:00
Michael Carlberg
da08a0fbe0 build: Bump version to 2.4.5 2016-12-31 15:43:01 +01:00
Michael Carlberg
dd960cc5b5 refactor(fd_streambuf): Cleanup 2016-12-31 15:42:46 +01:00
Michael Carlberg
acb9ed910d fix(script): Unlock mutex before terminating command
Refs #281
2016-12-31 14:08:45 +01:00
Michael Carlberg
210695d377 refactor(x11): Merge xlib/xutils with connection 2016-12-31 10:02:32 +01:00
Michael Carlberg
22b93a1167 fix(battery): Use full namespace 2016-12-31 07:32:57 +01:00
Michael Carlberg
a4f77dd840 feat(zsh): Add completion script 2016-12-31 06:06:36 +01:00
Michael Carlberg
e3a51b235a refactor(clang-tidy): Apply fixes 2016-12-31 04:32:11 +01:00
Michael Carlberg
ad0af86a7b refactor(battery): Abstract value readers
Refs #263, #245
2016-12-31 04:20:48 +01:00
Michael Carlberg
14958bdd23 fix: Correct type for module interval 2016-12-31 03:04:01 +01:00
Michael Carlberg
a989d401d9 fix(renderer): Content shifting bounds 2016-12-31 03:01:22 +01:00
Michael Carlberg
a59d892d0b fix(connection): Address sanitizer patch 2016-12-31 01:28:48 +01:00
Michael Carlberg
31608bb706 refactor(renderer): Cast signal data 2016-12-31 01:27:37 +01:00
Michael Carlberg
78bb3695e6 refactor(config): Deduce return type from default value 2016-12-30 23:32:05 +01:00
Michael Carlberg
a0f1d97c2b fix(controller): UB sanitizer patch 2016-12-30 23:28:58 +01:00
Michael Carlberg
53f781f527 feat(fs): Add option to remove invalid/unmounted endpoints 2016-12-30 22:44:28 +01:00
Michael Carlberg
cb4e0e03f8 fix(docs): Remove reference to Void Linux package 2016-12-30 22:26:41 +01:00
Michael Carlberg
c36e2481bd build: Bump version to 2.4.4 2016-12-30 22:09:49 +01:00
Michael Carlberg
8d1ff28589 fix(connection): Include cstdlib for std::free 2016-12-30 21:14:22 +01:00
Michael Carlberg
e1c6a4e5a3 fix(command_line): End with empty line 2016-12-30 21:14:22 +01:00
Berk Ozbalci
2fdbb6af41 feat(bspwm): Add support for pseudo tiled nodes 2016-12-30 20:49:38 +01:00
Michael Carlberg
dffdc6a20b fix(builder): Sub-string check
Fixes #282
2016-12-30 20:34:23 +01:00
Michael Carlberg
18cf9df86c refactor: Cleanup 2016-12-27 04:58:41 +01:00
Michael Carlberg
f101a303bd fix(bar): Only initialize config values when using --print-wmname 2016-12-27 04:15:01 +01:00
Michael Carlberg
db7aa7c490 fix(format): Ignore empty contents 2016-12-27 04:03:46 +01:00
Michael Carlberg
4bc203dd1f fix(fs): Output error if statvfs() fails
Refs #271
2016-12-27 02:03:15 +01:00
Michael Carlberg
55934c12a3 fix(fs): Use avail bytes to calculate percentage
Refs #271
2016-12-27 01:32:33 +01:00
Michael Carlberg
e062170b1f fix(cmake): Use new config path 2016-12-26 17:07:02 +01:00
Michael Carlberg
7b780a3201 refactor(builder): Cleanup 2016-12-26 17:06:28 +01:00
Michael Carlberg
b7f16672ff feat: Add object cache container 2016-12-26 10:38:19 +01:00
Michael Carlberg
b9f9092bbe refactor: Cleanup 2016-12-26 10:37:14 +01:00
Michael Carlberg
baaba4adf9 refactor(ipc): Rename signals 2016-12-26 10:36:14 +01:00
Michael Carlberg
334c454eec concurrency_util: Mutex wrapper 2016-12-26 10:33:23 +01:00
Michael Carlberg
f80d8ebf5b file_util: File descriptor streams 2016-12-26 10:29:32 +01:00
Michael Carlberg
00ac4bea63 refactor(x11): Header cleanup 2016-12-26 10:27:30 +01:00
Michael Carlberg
11aabac227 refactor(connection: Use custom base 2016-12-26 09:46:48 +01:00
Michael Carlberg
3681247dc1 refactor(file_util): Move block mode helpers 2016-12-25 19:58:52 +01:00
Michael Carlberg
24aba14541 fix(battery): Safety check
Refs #269
2016-12-24 05:29:12 +01:00
Michael Carlberg
85c915d35b refactor(main): Parse args before connecting to X 2016-12-24 02:55:21 +01:00
Michael Carlberg
bb0d6f580d fix(xkeyboard): Wrap click handler around contents 2016-12-23 22:39:59 +01:00
Michael Carlberg
068d586757 build: Bump version to 2.4.3 2016-12-23 22:23:33 +01:00
Michael Carlberg
789800a68f refactor(signals): Simple types 2016-12-23 22:19:42 +01:00
Michael Carlberg
b422d1d1a4 refactor(modules): Input handling 2016-12-23 20:43:52 +01:00
Michael Carlberg
99764b930e git: Untrack generated config 2016-12-23 20:41:18 +01:00
Michael Carlberg
92424f0d49 refactor(cmake): Install components 2016-12-23 18:10:19 +01:00
Michael Carlberg
70bb6f61d4 fix(ci): Use default build type 2016-12-23 17:15:13 +01:00
Michael Carlberg
2dc8553dff fix(aur): Update package files 2016-12-23 17:04:38 +01:00
Michael Carlberg
5c561e3d77 fix(cmake): Use RelWithDebInfo as default build type 2016-12-23 16:58:05 +01:00
Michael Carlberg
248f00f55b fix(config): Change i3 label colors 2016-12-23 16:31:12 +01:00
Michael Carlberg
97fa7052fe refactor(clang-tidy): Apply fixes 2016-12-23 15:54:06 +01:00
Michael Carlberg
7c7e053e1f fix(cmake): Default to -O2 for Release builds 2016-12-23 15:52:55 +01:00
Michael Carlberg
f84ed1fafb fix(cmake): Less specialized defaults 2016-12-23 15:03:28 +01:00
Michael Carlberg
9c14531542 fix(config): Require wrapping quotes to trim 2016-12-23 14:39:12 +01:00
Michael Carlberg
f25830714c git(i3ipcpp): Update submodule ref 2016-12-23 13:34:02 +01:00
Michael Carlberg
077ec2b879 build: Bump version to 2.4.2 2016-12-23 13:03:42 +01:00
Michael Carlberg
1cb8e455fb fix(controller): Invalid move constructions
Refs #268, #265
2016-12-23 13:03:05 +01:00
Michael Carlberg
7ecd132610 fix(net): Convert dBm to percentage
Fixes #249
2016-12-23 08:13:40 +01:00
Michael Carlberg
e551dbfea9 fix(controller): Raise signal on quit from eventqueue 2016-12-23 05:51:33 +01:00
Michael Carlberg
e974ac1750 build: Bump version to 2.4.1 2016-12-23 05:26:05 +01:00
Michael Carlberg
ba757809d0 refactor(modules): Defer cache rebuild 2016-12-23 05:19:45 +01:00
Michael Carlberg
debb3534c7 concurrency_ytil: Thread id 2016-12-23 05:18:58 +01:00
Michael Carlberg
48438b2556 fix(github): Replace initial token 2016-12-23 05:12:33 +01:00
Michael Carlberg
8cc275ccd1 refactor(controller): Process eventqueue concurrently 2016-12-23 05:10:40 +01:00
Michael Carlberg
8cff01e3d8 refactor(event_handler): Abstract sink attaching 2016-12-23 05:08:19 +01:00
Michael Carlberg
b765094a29 refactor(string_util): Faster replace_all 2016-12-23 04:40:35 +01:00
Michael Carlberg
fa0d77f267 refactor(file_descriptor): Use unique_ptr 2016-12-23 01:07:00 +01:00
Michael Carlberg
d4e3891ab6 refactor(connection): Listen for property notify by default 2016-12-23 01:05:36 +01:00
Michael Carlberg
9479b5abe2 refactor(xwindow): Cleanup 2016-12-23 01:03:38 +01:00
Michael Carlberg
417d90f411 refactor(controller): Store module input handlers locally
Refs #265, #262
2016-12-23 00:54:14 +01:00
Michael Carlberg
e47e439954 refactor(modules): Replace callbacks with signals
Refs #265
2016-12-22 22:11:30 +01:00
Michael Carlberg
a914526949 fix(config): Use strtoul
Refs #267
2016-12-22 18:37:23 +01:00
Michael Carlberg
d9de16e888 fix(bspwm): Handle single char prefix clash 2016-12-22 02:17:26 +01:00
Michael Carlberg
e9d88d3173 fix(cmake): Check compiler version 2016-12-22 00:40:45 +01:00
Michael Carlberg
4b7bd7bcb6 fix(bump.sh): Read previous tag 2016-12-22 00:23:00 +01:00
Michael Carlberg
57656e81e4 build: Bump version to 2.4.0 2016-12-22 00:20:40 +01:00
Michael Carlberg
bc9b9f0d12 refactor: Cleanup 2016-12-21 23:22:02 +01:00
Michael Carlberg
185363056a refactor(x11): Cleanup 2016-12-21 15:04:16 +01:00
Michael Carlberg
788a7ca3a3 refactor(modules): Get rid of .inl files 2016-12-21 09:21:35 +01:00
Michael Carlberg
7979f5b3d4 refactor(modules): Handle events using signal_receiver 2016-12-21 08:38:44 +01:00
Michael Carlberg
c01f111e34 refactor(modules): Move setup to constructor 2016-12-21 08:00:09 +01:00
Michael Carlberg
81e6fb062f wip: Window autohide 2016-12-21 04:50:43 +01:00
Michael Carlberg
3aa7c3b106 fix(taskqueue): Type error 2016-12-20 18:14:43 +01:00
Michael Carlberg
abd30860e0 fix(button_press): Use correct double click button 2016-12-20 15:51:45 +01:00
Michael Carlberg
ff55421f52 feat(cpu): Load percentage per core
Display load percentage for individual cpu cores
or a concatenated string for all cores.

Example:

  label = %percentage-core1% %percentage-core4%
  label = %percentage-cores%

Refs #256
2016-12-20 15:24:42 +01:00
Michael Carlberg
c14c46b998 refactor: Font index cleanup 2016-12-20 15:09:11 +01:00
Michael Carlberg
8ef8900ca2 refactor: Defer buttonpress using taskqueue 2016-12-20 13:03:46 +01:00
Michael Carlberg
b8ff0da693 feat: Add taskqueue component 2016-12-20 12:54:17 +01:00
Michael Carlberg
3a01bcf308 fix: Apply x position once to action blocks 2016-12-20 08:00:08 +01:00
Michael Carlberg
ccbb38798d fix(bar): Action x values should not be volatile 2016-12-20 07:46:51 +01:00
Michael Carlberg
1cccd100bb fix(bar): Remove double click 2016-12-20 07:46:30 +01:00
Michael Carlberg
418dadf0b9 fix(xbacklight): Close cmd blocks 2016-12-20 07:04:13 +01:00
Michael Carlberg
f94eea1299 build: Include CMAKE_CXX_COMPILER in -vv 2016-12-20 06:08:24 +01:00
Michael Carlberg
de04fa3eac feat(github): Option to hide notification count if empty 2016-12-20 05:53:45 +01:00
Michael Carlberg
6ef1721b61 fix(label): Bool operator should check tokenized field 2016-12-20 05:52:59 +01:00
Michael Carlberg
cd31d92713 fix(controller): Check eventpipe reads/writes 2016-12-20 05:36:10 +01:00
Michael Carlberg
edafb52302 fix(build.sh): Prompt for libcurl support 2016-12-20 05:33:07 +01:00
Michael Carlberg
a89c4ef2dd refactor: Move all event handling to the controller 2016-12-20 05:16:04 +01:00
Michael Carlberg
8ed4de1dda fix: Use enum_hash for unordered_map 2016-12-20 02:29:18 +01:00
Michael Carlberg
b417c9f812 feat(github): New module
Module used to query the GitHub API for information.
Currently only supports notification count.

Ref #84
2016-12-19 22:12:31 +01:00
NBonaparte
e72f85079f feat(monitor): Add monitor-fallback option #243
Adds new parameter monitor-fallback, which allows the bar to revert to a
specified monitor. Polybar should now be compatible with dynamic
multi-monitor setups when using screenchange-reload = true (no need to
stop and restart the bar with a different environment variable).

Closes #243
2016-12-16 13:09:19 +01:00
Michael Carlberg
698814d17f fix(xkeyboard): Only wrap click around the label 2016-12-16 11:34:35 +01:00
Michael Carlberg
519172b6ec feat(xkeyboard): Switch layout group on click
When serveral layout groups are defined for the keyboard
they can be cycled when clicking on the module.

   For example:

   $ setxkbmap -layout us,sv,fr

Ref #84
2016-12-16 11:31:08 +01:00
Michael Carlberg
f50f43af02 refactor: Cleanup 2016-12-16 10:23:54 +01:00
Michael Carlberg
09ea07b750 refactor(battery): Use charge_{now,full} to calculate percentage 2016-12-16 09:58:54 +01:00
Michael Carlberg
697638db2b fix(tray): Follow window fade 2016-12-16 07:10:45 +01:00
Michael Carlberg
a7005be82c feat: Fade if unfocused and handle double clicks 2016-12-16 06:44:55 +01:00
Michael Carlberg
d94d8ccfd3 feat(debug_util): Scoped execution timer 2016-12-16 04:01:23 +01:00
Michael Carlberg
1d53e7f454 fix(ci): Update libc++ install script 2016-12-15 21:32:05 +01:00
Michael Carlberg
b692fb4a54 fix(ci): Remove debug prints 2016-12-15 21:01:38 +01:00
Michael Carlberg
faab627771 fix(tray): Ignore restack state 2016-12-15 21:00:17 +01:00
Michael Carlberg
140a3a6327 fix(config): Avoid double value lookup 2016-12-15 20:57:03 +01:00
Michael Carlberg
5b544e9581 fix(ci): Match any clang binary 2016-12-15 20:22:42 +01:00
Michael Carlberg
7a70ab8942 fix(ci): Capture exported environment variables 2016-12-15 20:10:16 +01:00
Michael Carlberg
6e53172739 fix(ci): Add build flags to summary output 2016-12-15 19:27:47 +01:00
Michael Carlberg
32fb7ad9bb fix(ci): Installpackages using the apt addon 2016-12-15 19:16:31 +01:00
Michael Carlberg
6ce1c9805e refactor(tests): Use new factory methods 2016-12-15 19:05:26 +01:00
Michael Carlberg
a227543da5 docs: update README 2016-12-15 18:22:50 +01:00
Michael Carlberg
b90856157b fix: Update font visual if depth changes 2016-12-15 18:22:34 +01:00
Michael Carlberg
b2e8428550 wip(refactor): Improve parsing and font glyph caching 2016-12-15 17:28:58 +01:00
Michael Carlberg
9f9f438fae refactor: Remove last usage of boost::optional
Since it's the only thing boost was used for at the moment
we drop it to be able to get rid of a dependency.
2016-12-15 17:13:16 +01:00
Michael Carlberg
a0d485f79d refactor: Initialize data 2016-12-15 09:30:31 +01:00
Michael Carlberg
f9062d031c refactor(clang-tidy): Apply fixes 2016-12-15 03:30:41 +01:00
Michael Carlberg
78b5f9651f fix(config): Remove tabs 2016-12-14 20:39:40 +01:00
Michael Carlberg
0fca9a0c6e git: Remove unused headers for boost::di 2016-12-14 20:18:55 +01:00
Michael Carlberg
52a6dfb42c refactor(config): Use defined fallback for environment refs 2016-12-14 20:14:31 +01:00
Michael Carlberg
3489ac7852 fix(build): Strip alsa sources when not building with alsalib 2016-12-14 20:12:50 +01:00
Michael Carlberg
4c36d65cbe fix(eventloop): Acquire lock guard 2016-12-14 19:04:33 +01:00
Michael Carlberg
e11798253a fix(controller): Module margin require surrounding text 2016-12-14 19:03:59 +01:00
Michael Carlberg
cdec06ee5a fix(tray): Remove default disable warning 2016-12-14 17:19:32 +01:00
Michael Carlberg
4870204b4f feat(bspwm,i3): Configurable scroll direction 2016-12-14 17:18:20 +01:00
Michael Carlberg
698c494068 refactor(cmake): Split memcheck command into summary/full 2016-12-14 15:11:37 +01:00
Michael Carlberg
0b949ee3bb fix(config): Allow empty values 2016-12-14 15:10:19 +01:00
Michael Carlberg
d3bc1f938f refactor(x11): Use shared_ptr for X pointers 2016-12-14 15:09:51 +01:00
Michael Carlberg
105e4437ff fix(memory_util): Initialize malloc ptr 2016-12-14 15:06:46 +01:00
Michael Carlberg
d8f69866cc refactor(alsa): Memory allocation 2016-12-14 15:04:10 +01:00
Michael Carlberg
16592ce514 fix(process_util): Memory leak 2016-12-14 15:02:56 +01:00
Michael Carlberg
b11a662d81 fix(tray): Re-activation 2016-12-14 11:34:09 +01:00
Michael Carlberg
8c3f40db5b refactor(eventloop): Use config wrapper 2016-12-14 11:01:44 +01:00
Michael Carlberg
b156d1bbf4 refactor(bspwm): Cleanup 2016-12-14 11:01:44 +01:00
Michael Carlberg
18597f8e1d fix(tray): Uninitialized value 2016-12-14 11:01:44 +01:00
Michael Carlberg
7822f912aa feat(socket): Utility function peek() 2016-12-14 11:01:44 +01:00
Michael Carlberg
4606c41577 fix(xkb): Memory leaks 2016-12-14 11:01:44 +01:00
Michael Carlberg
357e95335a fix(valgrind): Suppress Xrm warnings 2016-12-14 11:01:44 +01:00
Michael Carlberg
5077325044 refactor(string_util): Use rvalue references for *trim() 2016-12-14 11:01:44 +01:00
Michael Carlberg
eca870774f fix: Handle single input events 2016-12-14 11:01:44 +01:00
Michael Carlberg
c2caf4d7a6 fix(parser): Apply clang-tidy fixes 2016-12-14 11:01:44 +01:00
Michael Carlberg
7d07812fa6 fix(font_manager): Memory leak 2016-12-14 11:01:44 +01:00
Michael Carlberg
80a00bd596 refactor(config): Cleanup and minor tweaks 2016-12-14 11:01:44 +01:00
Michael Carlberg
060d198b8e feat(cmake): Valgrind memcheck command 2016-12-14 11:01:44 +01:00
Michael Carlberg
5e2a0bd298 refactor(alsa): Forward alsa structs and split classes 2016-12-14 11:01:44 +01:00
Michael Carlberg
a33c15b3ad fix(xresources): Deallocate memory 2016-12-14 11:01:44 +01:00
Michael Carlberg
83f7d2ce91 refactor: Cleanup 2016-12-14 11:01:44 +01:00
Michael Carlberg
bff119834a refactor: Pass singleton instance directly 2016-12-14 11:01:44 +01:00
Michael Carlberg
5d5542169b refactor(command_line): Cleanup 2016-12-14 11:01:44 +01:00
Michael Carlberg
683ce7acc6 refactor(logger): Cleanup 2016-12-14 11:01:44 +01:00
Michael Carlberg
540bcb9fd0 refactor(config): Load on instantiation 2016-12-14 11:01:44 +01:00
Michael Carlberg
4fca0c89b4 refactor: Object construction 2016-12-14 11:01:44 +01:00
Michael Carlberg
1a2a6e5fab refactor: Construction methods 2016-12-14 11:01:44 +01:00
Michael Carlberg
08be86fbe1 wip(refactor): Improve signal and event handling 2016-12-14 11:01:44 +01:00
Michael Carlberg
d45fd76dcd refactor(config): Drop boost::property_tree 2016-12-14 10:57:45 +01:00
Michael Carlberg
8da52af6a2 fix(tray): Attached offset relative to inner area 2016-12-14 10:55:40 +01:00
Michael Carlberg
24df9e30a3 fix(tray): Correct alignment coords 2016-12-14 10:55:40 +01:00
Michael Carlberg
4c2d710169 fix(tray): Adjust action coords
Ref #241
2016-12-14 10:55:36 +01:00
Michael Carlberg
3a6ca90fcb refactor(i3): Remove wsname-maxlen 2016-12-14 04:45:34 +01:00
Michael Carlberg
0ed173b96e refactor(i3): Output based wrapping 2016-12-14 04:45:31 +01:00
Michael Carlberg
80a5985344 build: Bump version to 2.3.13 2016-12-14 00:54:06 +01:00
Michael Carlberg
c57273e682 fix(alsa): Deallocate mixer element using wrapper 2016-12-14 00:53:49 +01:00
Michael Carlberg
f4529dde99 feat(i3): Conditional wrap around on scroll
Ref #242
2016-12-14 00:46:54 +01:00
Michael Carlberg
809e5748b6 build: Bump version to 2.3.12 2016-12-14 00:11:17 +01:00
Michael Carlberg
f3a52cee6b git: Update i3ipcpp ref 2016-12-14 00:01:15 +01:00
Michael Carlberg
1b00993cb9 fix(net): Initialize request struct 2016-12-13 14:33:06 +01:00
Michael Carlberg
b303492759 fix(alsa): Avoid dangling pointers 2016-12-13 14:31:17 +01:00
Michael Carlberg
cab2d49532 fix: Module margin
Only output module margin right when there are
preceeding modules.
2016-12-13 14:30:06 +01:00
Michael Carlberg
891ff6d80a fix(xkeyboard): Use current group number
Ref #230
2016-12-08 18:35:07 +01:00
Michael Carlberg
5571095537 fix(docs): Update list of apt-get packages 2016-12-08 17:34:43 +01:00
Michael Carlberg
e90f82afe3 build: Bump version to 2.3.11 2016-12-05 14:06:33 +01:00
Michael Carlberg
ebe1998b19 fix(bspwm): Change event strings 2016-12-05 14:02:16 +01:00
Michael Carlberg
60503734ac fix(bspwm): Send monitor local focus commands 2016-12-05 13:21:28 +01:00
Michael Carlberg
ec39859093 feat: Window click handlers
New parameters for defining fallback click handlers
that will be triggered for the whole window unless
a module action is matched.

Parameters added to all [bar/foo] sections:

- `click-left = ...`
- `click-middle= ...`
- `click-right= ...`
- `scroll-up= ...`
- `scroll-down= ...`

Ref #226
2016-12-05 13:17:15 +01:00
Michael Carlberg
3854515521 fix: Wrap format pre/suffix within cmd 2016-12-05 05:32:10 +01:00
Michael Carlberg
1a48f825d1 fix(progressbar): Pass label to builder
Ref #224
2016-12-05 05:04:43 +01:00
Michael Carlberg
7d1092db04 refactor(date): Add label and date/time tokens
Ref #225
2016-12-05 04:52:00 +01:00
Michael Carlberg
d561b9cb2d fix(builder): Remove surrounding quotes for raw strings
Ref #221
2016-12-05 04:15:21 +01:00
Michael Carlberg
7f5117b7cc fix(tray): Improve pseudo-transparency handling
- Make sure previously drawn content is cleared
- Redraw tray clients on XCB_EXPOSE
- Prevent void parts of the root pixmap being copied

Ref #187
2016-12-05 03:56:04 +01:00
Michael Carlberg
4c50853044 fix: Update example config 2016-12-05 03:56:04 +01:00
NBonaparte
a22e84204d fix(script): set default tag to label (#223) 2016-12-04 22:09:57 +01:00
Soham Chowdhury
16b7d09d63 feat(mpd): Add support for date (#222) 2016-12-04 19:33:04 +01:00
Michael Carlberg
d93bd635b4 fix(label): Remove surrounding quotes
Fixes #221
2016-12-04 17:28:58 +01:00
Michael Carlberg
9eee27544d fix(renderer): Improve precision when shifting action blocks
Fixes #220
2016-12-04 13:50:30 +01:00
NBonaparte
d888f1b331 feat: Add left and right padding and margins (#219)
* feat: Add left and right padding and margins

* fix: use side_values and change precedence

* fix: cast to uint16_t
2016-12-04 11:57:33 +01:00
Michael Carlberg
c870a9efa7 fix(tray): Do not reserve space when detached
Ref #218
2016-12-04 05:53:45 +01:00
Michael Carlberg
540e9f2735 build: Bump version to 2.3.10 2016-12-04 04:13:02 +01:00
Michael Carlberg
44da14755d refactor(clang-tidy): Apply fixes 2016-12-04 04:11:47 +01:00
Michael Carlberg
0cfddf7d72 feat(token): Add optional suffix to label tokens 2016-12-04 04:03:17 +01:00
Michael Carlberg
70bd235e9e fix: Update example config 2016-12-04 03:32:48 +01:00
NBonaparte
ffbedf4217 feat: Add support for prefix and suffix to formats 2016-12-04 02:33:38 +01:00
Michael Carlberg
fbca73a83b fix: Check ptr before accessing 2016-12-04 01:15:00 +01:00
Michael Carlberg
f60dd57092 fix: Update example config 2016-12-03 23:22:09 +01:00
Michael Carlberg
9f16e3fff7 refactor: Rename dock to override-redirect 2016-12-03 23:21:40 +01:00
Michael Carlberg
d6a0c84e0b refactor(tray): Update using eventloop 2016-12-03 23:01:21 +01:00
Michael Carlberg
df85a6492e refactor(eventloop): Typed events 2016-12-03 23:00:41 +01:00
Michael Carlberg
c94801a747 fix(docs): Remove previous name 2016-12-03 21:25:54 +01:00
Michael Carlberg
37b4f9454c build: Bump version to 2.3.9 2016-12-03 21:24:18 +01:00
Michael Carlberg
aca249727a fix(tray): Emit visibility state before activate 2016-12-03 21:19:39 +01:00
Michael Carlberg
604e926924 refactor(script): Format tag <label>
Mark <output> and maxlen as deprecated
2016-12-03 21:10:01 +01:00
Michael Carlberg
5f6d73a415 fix(command): Use execlp()
Ref #214
2016-12-03 20:52:43 +01:00
Michael Carlberg
bb0cfcf033 fix(tray): Visibility change 2016-12-03 20:26:29 +01:00
Michael Carlberg
a3f2e8aa51 fix: Reconfigure position after mapping
Ref #212
2016-12-03 18:38:35 +01:00
Michael Carlberg
87addebf6a build: Bump version to 2.3.8 2016-12-03 17:01:05 +01:00
Michael Carlberg
22f3af96b9 fix(tray): Handle visibility change
Ref #211
2016-12-03 17:00:19 +01:00
Michael Carlberg
6b51234f23 fix(screen): Only reload if changed 2016-12-03 16:44:37 +01:00
Michael Carlberg
ef9b37447b fix(xcb): Deallocate using deleter 2016-12-03 16:44:08 +01:00
Michael Carlberg
086e498388 fix: Replace process on reload 2016-12-03 15:46:48 +01:00
Michael Carlberg
0f91d3d8df fix(ewmh): Use deleter to deallocate atoms 2016-12-03 15:45:11 +01:00
Michael Carlberg
158d4dd515 fix(controller): Handle connection error 2016-12-03 15:12:11 +01:00
Michael Carlberg
91ee4c825b fix(xworkspaces): Safety check 2016-12-03 14:53:53 +01:00
Michael Carlberg
d4eaf21052 fix(xworkspaces): Correct desktop index for pinned workspaces
- Use the correct desktop index when only displaying
workspaces for the configured monitor/viewport.

- Wrapping scroll
2016-12-03 13:45:26 +01:00
Michael Carlberg
edbefbd8fa fix(controller): Check runstate when handling X event 2016-12-03 13:01:10 +01:00
Michael Carlberg
4776ec49df fix: Use defined event sink priority 2016-12-03 13:00:40 +01:00
Michael Carlberg
a1ad4de470 fix: Fill background for initial draw
Ref #179
2016-12-03 12:58:43 +01:00
Michael Carlberg
e9db3fab3a fix: Only escape delimiter within action blocks
Ref #197
2016-12-01 14:30:47 +01:00
Michael Carlberg
b15042dccb build: Bump version to 2.3.7 2016-12-01 13:26:56 +01:00
Michael Carlberg
570c30337b fix(cmake): Add legacy pragma
Ref #208
2016-12-01 13:11:58 +01:00
Michael Carlberg
0ef2615af2 fix(config): Boost error
Ref #208
2016-12-01 13:00:38 +01:00
Michael Carlberg
111bfc58e9 build: Bump version to 2.3.6 2016-12-01 10:12:10 +01:00
Michael Carlberg
c6540a8950 refactor: Signaling 2016-12-01 08:56:16 +01:00
Michael Carlberg
9f8dabfc8d refactor(xwindow): Cleanup 2016-12-01 08:35:59 +01:00
Michael Carlberg
121d367205 fix(config): Use KEY_INHERIT 2016-12-01 08:30:48 +01:00
Michael Carlberg
0c6937edae feat(config): Inheritance
Add support for basic inheritance. The parser will
look for `inherit = base/section` and copy all undefined
values from the base section.

Ref #84
2016-12-01 07:57:30 +01:00
Michael Carlberg
4f76d917f8 fix(build): GCC name error 2016-12-01 03:35:54 +01:00
Michael Carlberg
d34263d850 fix(progressbar): Generate less data
Build the format sub-strings (%fill%, %indicator%, %empty%)
before adding it to the builder to avoid having it generate
alot of duplicate content (tags, etc)
2016-11-30 22:17:55 +01:00
Michael Carlberg
be8805be1e fix(renderer): Draw under-/overline after glyph 2016-11-30 22:15:01 +01:00
Michael Carlberg
24a2febd59 fix(build): GCC name error 2016-11-30 21:17:30 +01:00
Michael Carlberg
6db66896bd refactor(bspwm): Cleanup states 2016-11-30 21:12:47 +01:00
Franklin Delehelle
466e9e212f feat(bspwm): Separate focused/unfocused states
Closes #201
2016-11-30 21:04:22 +01:00
Michael Carlberg
43350c484e fix(bspwm): Cleanup 2016-11-30 18:23:18 +01:00
Michael Carlberg
9cadb681d4 feat(i3): Add mode label 2016-11-30 18:23:11 +01:00
Michael Carlberg
a43309df9f cmake: Installation paths 2016-11-30 18:22:10 +01:00
Michael Carlberg
d5587bf6f6 fix(i3): Filter root window
Ref #207
2016-11-30 16:56:49 +01:00
Michael Carlberg
eddda10c23 fix(alsa): Replace full alsalib.h 2016-11-30 14:27:37 +01:00
Michael Carlberg
f6ae5bd191 fix(build): Optional XKB 2016-11-30 14:26:11 +01:00
Michael Carlberg
d67515d575 fix(xwindow): Look for unicode wm_name
Ref #205
2016-11-30 13:38:41 +01:00
Michael Carlberg
6aba583c3e refactor(build): Rename X extension flags 2016-11-30 12:48:13 +01:00
Michael Carlberg
2f3c2e952e fix(xkeyboard): Minor tweaks 2016-11-30 11:29:41 +01:00
Michael Carlberg
24c6e635a8 fix(ci): Update dependency list 2016-11-30 10:26:09 +01:00
Michael Carlberg
608519363d feat(xkeyboard): New module
New module that uses the X keyboard extension
to show keyboard layout and indicators.

Ref #84, #200
2016-11-30 10:08:44 +01:00
Michael Carlberg
6f6c5b7459 fix(string_util): Join vector of strings 2016-11-27 01:32:21 +01:00
Michael Carlberg
4852f2817c feat: Reload on XCB_RANDR_SCREEN_CHANGE_NOTIFY 2016-11-27 01:14:02 +01:00
Michael Carlberg
340add5c40 build: Bump version to 2.3.5 2016-11-26 17:27:59 +01:00
Michael Carlberg
c4822b713f fix(renderer): Remove superflous clear 2016-11-26 17:26:35 +01:00
Michael Carlberg
44f288742b git: Update xpp ref 2016-11-26 15:45:17 +01:00
Michael Carlberg
4fb7c98455 build: Optional X extensions 2016-11-26 15:42:48 +01:00
Michael Carlberg
ad772edc39 fix(build): Update version on configure 2016-11-26 15:30:08 +01:00
Michael Carlberg
c5bc338ae3 feat(math_util): Templated min/max 2016-11-26 13:09:29 +01:00
Michael Carlberg
12ff82e913 feat(xworkspaces): Change current desktop 2016-11-26 10:33:32 +01:00
Michael Carlberg
0d4a24ef8e fix(ewmh): Check success of reply 2016-11-26 09:51:06 +01:00
Michael Carlberg
3413c4a463 wip(xworkspaces): Monitor support 2016-11-26 09:38:55 +01:00
Michael Carlberg
6fe411ea9e fix(ewmh): Include last desktop name 2016-11-26 06:39:37 +01:00
Michael Carlberg
b25fa46ac2 wip(xworkspaces): EWMH desktops
Ref #84
2016-11-26 06:30:33 +01:00
Michael Carlberg
9f4638f42c refactor: Cleanup 2016-11-26 06:13:20 +01:00
Michael Carlberg
c2acdff7d4 feat(eventloop): Delayed enqueue
A new worker that will block the queue channel
until the delayed event has been processed.

This is used to limit the amount of X button events
within defined time frame and we can't block
the main X thread.
2016-11-25 21:58:51 +01:00
Michael Carlberg
ff9be848c7 refactor(clang-tidy): Apply fixes 2016-11-25 21:58:49 +01:00
Michael Carlberg
0128014d44 fix(cmake): Tidy and format commands 2016-11-25 14:17:57 +01:00
Michael Carlberg
19868041e1 fix(connection): Query atoms and extensions once 2016-11-25 14:17:57 +01:00
Michael Carlberg
20c00936a9 fix(bspwm_util): Memory leak 2016-11-25 14:17:57 +01:00
Michael Carlberg
6f2b437be3 fix(renderer): Destroy window on deconstruct 2016-11-25 14:17:56 +01:00
Michael Carlberg
4268817c51 fix(config): Trigger reload on correct event
Fixes #85
2016-11-25 14:17:56 +01:00
Michael Carlberg
8db3e79919 refactor(clang-format): Apply fixes 2016-11-25 14:17:41 +01:00
Michael Carlberg
1adb1be404 fix(docs): Update link to wiki 2016-11-25 07:32:57 +01:00
Michael Carlberg
1954f3f74c build: Bump version to 2.3.4 2016-11-25 07:21:29 +01:00
Michael Carlberg
d76003256f fix: Do not parse module tags twice
Ref #192
2016-11-25 07:14:27 +01:00
Michael Carlberg
c24dbbd9ce build: Bump version to 2.3.3 2016-11-25 04:46:10 +01:00
Michael Carlberg
9fdc22843b refactor: Cleanup rendering 2016-11-25 04:42:27 +01:00
Michael Carlberg
7018357e47 fix(tray): Add compton atom to exclude shadow 2016-11-25 04:34:24 +01:00
Michael Carlberg
84d58e7619 refactor: Cleanup handling of syntax tags 2016-11-25 04:34:24 +01:00
NBonaparte
199a825494 feat(mpd): Add stop toggle (#191) 2016-11-25 04:33:58 +01:00
Michael Carlberg
48c709eb58 fix(builder): Always close open tags on flush
Ref #186
2016-11-23 21:59:05 +01:00
Michael Carlberg
ad510eb768 fix(builder): Default to non-lazy mode
Ref #181
2016-11-22 23:31:08 +01:00
Michael Carlberg
4794ef653c refactor(renderer): Separate methods 2016-11-22 23:18:47 +01:00
Michael Carlberg
b14e55f729 fix(label): Do not erase false positives 2016-11-22 23:10:36 +01:00
Michael Carlberg
c6e861083b fix: Avoid unnecessary color change
Ref #181
2016-11-22 22:45:12 +01:00
Michael Carlberg
cd005a9ce6 fix(renderer): Avoid false positives
Ref #181
2016-11-22 22:44:28 +01:00
Michael Carlberg
0983167510 fix(builder): Erase full tag
Ref #180
2016-11-22 21:33:27 +01:00
Michael Carlberg
7c60998459 fix(label): Patch token extraction
Ref #182
2016-11-22 21:14:35 +01:00
Michael Carlberg
5028779528 fix(network): Change default value of udspeed_minwidth 2016-11-22 20:53:14 +01:00
Michael Carlberg
6e35bcd183 fix(bar): Draw empty window at launch
Ref #179
2016-11-22 20:52:07 +01:00
Michael Carlberg
4ef0c55dda fix(label): Support variable token order
Bound specifiers required the tokens to be
replaced in the same order they were defined.

This fixes that by storing and comparing
the token string.
2016-11-22 03:42:42 +01:00
Michael Carlberg
09e0ea1932 config: Print deprecation warnings 2016-11-22 03:01:50 +01:00
Michael Carlberg
733341d62b fix: Skip button events unless lock acquired 2016-11-22 02:06:25 +01:00
Michael Carlberg
3069202354 fix(tests): Patch color_util unit test 2016-11-22 01:38:03 +01:00
Michael Carlberg
ac654423aa build: Bump version to 2.3.2 2016-11-22 01:25:49 +01:00
Michael Carlberg
0c64b64ff8 refactor: Cleanup 2016-11-22 01:22:47 +01:00
Michael Carlberg
c442e47f93 config: Add under-/overline properties 2016-11-21 16:38:52 +01:00
Michael Carlberg
83ef8bcd0c fix(build): Size type 2016-11-21 16:32:56 +01:00
Michael Carlberg
ebf1bd1129 feat: Support different under-/overline
Make it possible to set different size
and color values for the two properties.

`overline-size = 2`
`overline-color = #f00`
`underline-size = 5`
`underline-size = #00f`
2016-11-21 16:16:06 +01:00
Michael Carlberg
25e33b6aab refactor: Separate render component 2016-11-21 16:16:02 +01:00
Michael Carlberg
c1162960cc fix(battery): Try several value files
Fixes #177
2016-11-21 08:30:25 +01:00
Michael Carlberg
48da703970 Merge pull request #163 from NBonaparte/padding
feat: add padding for values
2016-11-21 08:09:51 +01:00
NBonaparte
c658d22925 fix(token): more patches 2016-11-20 22:44:35 -08:00
NBonaparte
d66c16674c feat(tokens): added patch by @jaagr 2016-11-20 21:33:50 -08:00
Michael Carlberg
d1d34b339a fix(aur): Python 2 is required by xpp 2016-11-21 04:25:58 +01:00
NBonaparte
4179f8b7f9 feat: added max and min values to tokens 2016-11-20 16:37:48 -08:00
Michael Carlberg
d0915b82f4 fix: Only include optional module fallback if needed 2016-11-21 01:19:44 +01:00
Michael Carlberg
cf22468503 fix(build): Optional module fallback
Ref #176
2016-11-21 01:14:05 +01:00
Michael Carlberg
2266b8618e fix(aur): Arch requires python 3 for xcbgen 2016-11-21 00:46:01 +01:00
Michael Carlberg
d616a7d351 fix(build): Move chrono namespace to correct level
Ref #176
2016-11-21 00:19:22 +01:00
Michael Carlberg
2d66dc9a57 fix: Disable tests requiring X connection 2016-11-21 00:07:34 +01:00
Michael Carlberg
d6a5212ef3 fix(volume): Handle alsa playback range
Ref #174
2016-11-20 23:49:08 +01:00
Michael Carlberg
002eb08b20 fix(build): Explicit type for list initialization 2016-11-20 23:29:42 +01:00
Michael Carlberg
c6d85b2b92 refactor: Optimize build 2016-11-20 23:04:31 +01:00
Michael Carlberg
4b576bd23b feat(config): Try to guess interface names 2016-11-20 04:11:02 +01:00
Michael Carlberg
74c7f5f617 fix: Patch example config template
The last patch only updated the generated file
and not the CMake template

Remove the generated file and add it to
.gitignore to prevent future mistakes
2016-11-20 03:30:18 +01:00
Michael Carlberg
5cbdc58d10 fix(aur): Example config fonts as optional deps 2016-11-20 03:06:03 +01:00
Michael Carlberg
376c483dd4 build: Bump version to 2.3.1 2016-11-20 03:00:36 +01:00
Michael Carlberg
fd3c3775e4 git(aur): Add new packages 2016-11-20 03:00:31 +01:00
Michael Carlberg
e2dab8a398 fix: Patch example config
- Query for truetype version of Unifont since
  the BDF version doesn't render the glyphs properly
- Replace ${BAR.key} with new ${root.key}
- Do not define specific volume mixers
2016-11-20 02:47:39 +01:00
Michael Carlberg
510fe7261b fix(ci): Parallel build 2016-11-19 22:01:14 +01:00
Michael Carlberg
40fcabd644 fix(config): Proper dereference of ${self.key} 2016-11-19 19:18:28 +01:00
Michael Carlberg
88c8bbd940 refactor: Fwd declare drawtypes
Ref #164
2016-11-19 15:49:06 +01:00
Michael Carlberg
38f9ba81cd feat(battery): Estimated time remaining
Adds a new token %time% that will display an
estimate of the remaining time until fully
charged/discharged
2016-11-19 15:42:31 +01:00
Michael Carlberg
30c1cb3d50 fix(animation): Use defined base values 2016-11-19 12:23:31 +01:00
Michael Carlberg
489d429644 refactor(ci): Split into scripts 2016-11-19 12:23:02 +01:00
Michael Carlberg
7dedcf6526 fix(ci): Disable e-mail notifications 2016-11-19 08:31:06 +01:00
Michael Carlberg
b3df50082a fix(tests): Run unit tests on travis 2016-11-19 08:30:00 +01:00
Michael Carlberg
bf23086687 fix(builder): Always close raw syntax tags
The lazy closing doesn't work well with raw
syntax tags so ignore it when closing tags.
2016-11-19 08:11:18 +01:00
Michael Carlberg
a0097f9baa xbps: Update package 2016-11-19 07:59:27 +01:00
Michael Carlberg
3251543d6e build: Bump version to 2.3.0 2016-11-19 06:51:34 +01:00
Michael Carlberg
1d6e6815cd fix(docs): Add rename notice 2016-11-19 06:31:59 +01:00
Michael Carlberg
fd57ab0f3d fix: project rename 2016-11-19 06:26:07 +01:00
Michael Carlberg
6a6796160a build: Bump version to 2.2.8 2016-11-19 04:35:03 +01:00
Michael Carlberg
1b159786f0 fix(xwindow): Ignore xcb timestamp 2016-11-19 04:34:46 +01:00
Michael Carlberg
ab5666a7ea fix: Memory leak 2016-11-19 04:06:05 +01:00
Michael Carlberg
51d8f289fa feat(xwindow): New module "xwindow"
Add module to display title of active window.
Requires WM with support for the _NET_ACTIVE_WINDOW hint.

Ref #84
2016-11-19 04:05:13 +01:00
Michael Carlberg
b921225487 fix(docs): Update README 2016-11-18 18:56:15 +01:00
Michael Carlberg
2fd88c4f60 feat(ipc): New message type "action:"
Adds a new message type, prefixed "action:"
that will perform the same task as mouse actions.

This could be used to control menu modules:

  echo action:menu-open-1 > /tmp/lemonbuddy_mqueue.<pid>
  echo action:menu-close > /tmp/lemonbuddy_mqueue.<pid>

Ref #84
2016-11-18 18:37:53 +01:00
Michael Carlberg
0a1e9c86c4 fix: Add monitor y to strut top value 2016-11-18 18:04:43 +01:00
Michael Carlberg
2140e11369 fix: Do not require custom font list 2016-11-18 18:04:43 +01:00
Michael Carlberg
1b5979ba10 feat(config): Default reference values
- Add fallback values to env/xrdb references:

  ${env:UNEXISTING:fallback value}
  ${xrdb:UNEXISTING:fallback value}

- Replace ${BAR.key} with ${root.key} and display
  deprecation warning if the former is used
2016-11-18 18:04:24 +01:00
Wolf
95ddb84406 fix(docs): Typo in README 2016-11-18 18:02:53 +01:00
Michael Carlberg
8758206ba3 fix: Strut end values should be inclusive 2016-11-16 12:00:52 +01:00
Michael Carlberg
3d2b3179dd Merge pull request #167 from edgard/master
feat(bspwm): Additional dimmed states configuration
2016-11-16 00:15:54 +01:00
Edgard Castro
1ea39e562a feat(bspwm): Additional dimmed states configuration 2016-11-15 04:33:10 -02:00
Michael Carlberg
70a5f1d41e fix: Bottom strut relative to screen 2016-11-15 02:28:42 +01:00
Michael Carlberg
ffe76b0556 fix(tray): Avoid tray redraw on bar update 2016-11-15 01:00:51 +01:00
Michael Carlberg
7551a7d126 build: Bump version to 2.2.7 2016-11-14 18:36:08 +01:00
Michael Carlberg
2301de667b fix(temperature): Calculate percentage value 2016-11-14 17:56:29 +01:00
Michael Carlberg
e22ec91101 fix(network): Check for TUN/TAP devices
Ref #159
2016-11-14 17:55:35 +01:00
Michael Carlberg
7b293a42cd fix(network): Check for nullptr values
Ref #159
2016-11-14 14:54:49 +01:00
Michael Carlberg
983963d4e4 feat(network): Accumulate stats from all interfaces
Add config setting that will display accumulated
values for up-/downspeed (accumulate-stats = true)

Closes #144
2016-11-14 12:42:59 +01:00
Michael Carlberg
611dbcd6cd build: Bump version to 2.2.6 2016-11-14 12:06:08 +01:00
Michael Carlberg
39b4f50c65 fix: Terminate on X connection error 2016-11-14 10:37:13 +01:00
Michael Carlberg
e3065d0e6c feat(ipc): New ipc module
Add a new module that allow users to configure hooks
on received ipc messages. The hook will execute the defined
shell script and the output of the script will be used
as the module content.

Ref #84
2016-11-14 09:26:40 +01:00
Michael Carlberg
04fac96d78 fix(mpd): Hide module on empty playlist
Closes #149
2016-11-14 01:21:58 +01:00
Michael Carlberg
4b0e648cb8 refactor: Cleanup 2016-11-14 00:46:50 +01:00
Michael Carlberg
489f3ce480 wip: Inter-process messaging 2016-11-13 19:05:30 +01:00
Michael Carlberg
c480f6fd1e refactor: Move strut handling to window class 2016-11-13 16:10:20 +01:00
Michael Carlberg
4224d838a8 refactor(bar): Strut values based on EMWH spec 2016-11-13 13:25:57 +01:00
Michael Carlberg
c8f2a934b1 refactor(fs): Update naming to reflect actual usage
The module currently only handle mounted filesystem
and not block devices or partitions. Change naming
to be more clear.
2016-11-13 08:50:14 +01:00
Michael Carlberg
910baaecb2 fix(string_util): Use binary base for file sizes 2016-11-13 08:15:53 +01:00
Michael Carlberg
d2a6773c26 fix(fs): Remove unmounted format tags 2016-11-13 06:40:35 +01:00
Michael Carlberg
9a0df75a91 feat(fs): New filesystem module
Module that displays details about
mounted filesystems, #84

Closes #153
2016-11-13 06:14:34 +01:00
Michael Carlberg
ed5b7a508a fix(bspwm): Wrap the scroll handlers around workspaces 2016-11-13 01:13:41 +01:00
Michael Carlberg
4d7f6c14e6 fix(xrandr): Less strict monitor matching
Be less strict when matching randr outputs
against specified name. This is a workaround
to fix the output naming issue when switching
between graphic drivers.

On my system the output names include a dash
when using the nvidia drivers but the intel
driver does not.

   nvidia:
      HDMI-1
      eDP-1
   xf86-video-intel:
      HDMI1
      eDP1

When strict mode is disabled the matching
won't care about the connection state.

The user can re-enable exact matching and
connection state testing by setting the
config parameter `monitor-strict = true`
2016-11-12 20:42:56 +01:00
Michael Carlberg
2314b57bce fix(cmake): Default module flags based on libs 2016-11-12 17:25:44 +01:00
Michael Carlberg
3edd33be99 fix(build): Include poll.h instead of sys/poll.h
- Include <poll.h> to get rid of musl warnings
2016-11-12 15:50:18 +01:00
Michael Carlberg
fe1d0579ec fix(build): Handle empty list of bat/adp names 2016-11-12 15:03:45 +01:00
Michael Carlberg
d02e2a47fb build: Bump version to 2.2.5 2016-11-12 13:55:06 +01:00
Michael Carlberg
03b6e1197e docs: Update README 2016-11-12 13:54:27 +01:00
Michael Carlberg
42bcfd9fa1 feat(bspwm): Configurable scroll/click actions 2016-11-12 13:37:07 +01:00
Michael Carlberg
171e69bd30 fix: tray-position should be optional 2016-11-12 13:14:08 +01:00
Michael Carlberg
23996fdcdc refactor: Tray transparency and code cleaning
- Make pseudo-transparency work as intended, fixes #158
- Fill tray pixmap in case a root pixmap is not found
- Split up bar bootstrap routine
- Formatting (clang-format)
2016-11-12 13:09:50 +01:00
Michael Carlberg
f2bbd301f2 feat(xbacklight): Change value on scroll
- Add action handlers for scroll up/down (conf: enable-sroll = true)
- Use xcb_timestamps instead of the throttle util
2016-11-12 13:07:05 +01:00
Michael Carlberg
2740e69a38 refactor(i3): Cleanup and configurable actions
- Do not throw on handle_event failure
- Add settings to disable mouse scroll/click actions
- Add fold markers
- Misc cleanup
2016-11-12 13:07:05 +01:00
Michael Carlberg
d9e3f8a2a7 feat(build.sh): Prompt for build options 2016-11-12 13:07:05 +01:00
Michael Carlberg
05c318e97b feat(config): Generate config based on build 2016-11-12 13:07:05 +01:00
Michael Carlberg
d7be6b1bec clang-format: Increase column limit 2016-11-12 13:07:05 +01:00
Michael Carlberg
1e08aa455b feat(temperature): Support for <ramp> 2016-11-12 13:07:05 +01:00
Michael Carlberg
63b9c38435 Merge pull request #160 from NBonaparte/bspwm-scroll
feat(bspwm): added scrolling
2016-11-12 03:18:58 +01:00
NBonaparte
fbd957bf33 feat(bspwm): added scrolling 2016-11-11 10:55:37 -08:00
Michael Carlberg
dc2d33ceba fix(bspwm): Remove monitor property
- Use the bar settings stored in the base class.
- Add fold markers
2016-11-11 11:05:22 +01:00
Michael Carlberg
fd44bcd8f6 fix(bspwm): Do not print empty mode labels 2016-11-11 11:04:53 +01:00
Michael Carlberg
d9707068f9 fix(tray): Disable tray if nodraw is set 2016-11-11 10:23:21 +01:00
Michael Carlberg
07c6ce8966 Merge pull request #156 from NBonaparte/temperature
feat(temperature): Added temp module and examples
2016-11-11 10:03:22 +01:00
NBonaparte
a06b38f534 feat(temperature): Added temp module and examples 2016-11-10 22:54:07 -08:00
Michael Carlberg
ee68aea773 build: Bump version to 2.2.4 2016-11-08 13:56:40 +01:00
Michael Carlberg
a8e902c579 fix(progressbar): Safety check
Fixes #152
2016-11-08 13:55:21 +01:00
Michael Carlberg
22328c4b13 Merge pull request #147 from NBonaparte/volume_mapping
feat(volume): Added volume mapping
2016-11-08 10:53:32 +01:00
NBonaparte
dce81d4266 feat(volume): Added volume mapping 2016-11-05 14:32:09 -07:00
Michael Carlberg
b470337e0a build: Bump version to 2.2.3 2016-11-04 21:08:34 +01:00
Michael Carlberg
23a57b6226 fix(tray): Ensure minimum window width 2016-11-04 21:08:14 +01:00
Michael Carlberg
ccee2ba025 fix(travis): Install xcb-util-image 2016-11-04 20:57:22 +01:00
Michael Carlberg
70c3e55dba build: Bump version to 2.2.2 2016-11-04 20:43:45 +01:00
Michael Carlberg
20b347b81f git: Update xpp ref 2016-11-04 20:43:33 +01:00
Michael Carlberg
0fd89ec358 fix(tray): Reconfigure on re-activate 2016-11-04 20:41:24 +01:00
Michael Carlberg
e1f637dd4f build: Bump version to 2.2.1 2016-11-04 20:29:46 +01:00
Michael Carlberg
d446d14237 fix(build): Added xcb-util-image to dependency list 2016-11-04 20:29:37 +01:00
Michael Carlberg
a1d30ddee3 feat: Configurable _NET_WM_STRUT_PARTIAL
Bspwm just released support for _NET_WM_STRUT_PARTIAL
which can be used to fix the workspace padding

New config section:

[global/wm]
margin-top = 5
margin-bottom = 5
margin-left = 5
margin-right = 5
2016-11-04 20:23:15 +01:00
Michael Carlberg
7d2e8adf59 build: Bump version to 2.2.0 2016-11-04 19:37:04 +01:00
Michael Carlberg
de2ee4db1b fix(tray): Default to bar background rgb 2016-11-04 19:33:38 +01:00
Michael Carlberg
0814ed381f refactor: Group consecutive ascii chars and render string 2016-11-04 19:22:00 +01:00
Michael Carlberg
869c5fe718 refactor: Code cleanup 2016-11-04 19:21:56 +01:00
Michael Carlberg
ae501d6ae1 fix(tray): Support for pseudo transparency
Copy contents from the root pixmap onto the background

Fixes #125
2016-11-04 19:01:51 +01:00
Michael Carlberg
004d499ce3 fix: Make sure background colors are filled
Fixes a bug where alignment changes caused
the previous background to bleed over because
of the shift.

Fixes #141
2016-11-04 12:06:52 +01:00
Michael Carlberg
2a59236441 build: Bump version to 2.1.15 2016-11-03 19:02:12 +01:00
Michael Carlberg
d74dd7f3ef fix(build): Remove disabled libs 2016-11-03 19:01:45 +01:00
Michael Carlberg
37ad86fa1c fix(build): GCC warnings 2016-11-03 18:19:47 +01:00
Michael Carlberg
5f21d7d440 feat(bspwm): Support for multi monitors listing
- All available workspaces can now be listed, grouped
by monitor, by setting the module config `pin-workspaces`
to false

- Adds a new format tag <label-monitor>

- Treat <label-mode> as a normal format tag
2016-11-03 17:56:07 +01:00
Michael Carlberg
12a64bd3d6 fix(i3): Trim workspace names
Closes #126
2016-11-03 15:43:46 +01:00
Michael Carlberg
d71e5b909b build: Bump version to 2.1.14 2016-11-03 15:29:17 +01:00
Michael Carlberg
a1472dfd0f refactor(battery): Poll values by default
Fixes jaagr/lemonbuddy#140
2016-11-03 15:21:46 +01:00
Michael Carlberg
52c08675e6 fix(battery): Ignore the fake inotify event
Assume fake event if polling flag is set.

Fixes jaagr/lemonbuddy#140
2016-11-03 14:40:12 +01:00
Michael Carlberg
b9e4ee9b92 fix: Disable modules with error 2016-11-03 14:10:48 +01:00
Michael Carlberg
74a04ded80 fix(build): Add missing files 2016-11-03 13:06:33 +01:00
Michael Carlberg
f3b3db9854 build: Bump version to 2.1.13 2016-11-03 13:00:03 +01:00
Michael Carlberg
af2289e397 fix(battery): Poll until real inotify event occurs
Fixes jaagr/lemonbuddy#140
2016-11-03 12:56:35 +01:00
Michael Carlberg
e7cb345cec wip: Separate source from definitions 2016-11-03 12:54:32 +01:00
Michael Carlberg
566f33b8b2 build: Bump version to 2.1.12 2016-11-02 18:42:15 +01:00
Michael Carlberg
f83dbf19b1 fix(battery): Poll thread requires running module
Closes jaagr/lemonbuddy#140
2016-11-02 18:38:13 +01:00
Michael Carlberg
5d00f0bdce build: Bump version to 2.1.11 2016-11-01 01:26:29 +01:00
Michael Carlberg
de3e0458a6 fix(tray): Catch restack failure 2016-10-31 05:37:51 +01:00
Michael Carlberg
738fc2a216 feat: Offset window position using % 2016-10-31 05:13:59 +01:00
Michael Carlberg
fe03570b5a fix(tray): Target correct atom 2016-10-31 02:36:43 +01:00
Michael Carlberg
94298741b6 tray: Align center and extend configuration
- The tray can now be centered in the bar
- Set window atoms:
  * _NET_SYSTEM_TRAY_COLORS
  * _NET_SYSTEM_TRAY_VISUAL
- New parameters added:
  * tray-background: Define background color
  * tray-offset-x: X position offset
  * tray-offset-y: Y position offset
  * tray-padding: Add spacing on the side of each icon
  * tray-maxsize: Size limit for tray icons, default: 16
  * tray-scale: Icon zoom, default: 1.0
  * tray-detached: The bar will ignore tray updates
2016-10-31 01:41:15 +01:00
Michael Carlberg
dd7967dede fix(controller): Check for connection error in eventloop 2016-10-31 01:25:45 +01:00
Michael Carlberg
26c308cc19 feat(color_util): Utility functions for color handling 2016-10-31 01:25:19 +01:00
Michael Carlberg
e62b545d1c Revert "refactor: Dropping XInitThreads();"
This reverts commit d5515ebcb0.
2016-10-30 19:34:21 +01:00
Michael Carlberg
55c9bf27ba fix(controller): Uninstall sigmask on blocked term signal 2016-10-30 18:48:15 +01:00
Michael Carlberg
36d4ee0e67 refactor(battery): Cleanup 2016-10-30 18:47:01 +01:00
Michael Carlberg
2f7ec4ceee fix: Alpha channel out of line 2016-10-30 08:04:59 +01:00
Michael Carlberg
c9af239516 fix: Widen color channels 2016-10-30 07:46:28 +01:00
Michael Carlberg
d8c309ec35 fix(date): Do not override get_output 2016-10-30 06:18:33 +01:00
Michael Carlberg
d5515ebcb0 refactor: Dropping XInitThreads(); 2016-10-30 02:41:18 +01:00
Michael Carlberg
efba06dc2d fix(xft): Allocate xft color by value
- Solves the issue with transparency using Xft.
- X11 fonts are still affected by the alpha issue.

Closes jaagr/lemonbuddy#119
2016-10-30 02:37:56 +01:00
Michael Carlberg
41ba9beeee fix(fontmanager): Make sure font contains characters 2016-10-29 21:27:51 +02:00
Michael Carlberg
c3969e85ef fix(fontmanager): Add safety check 2016-10-29 21:06:56 +02:00
Michael Carlberg
7a790aa87d build: Bump version to 2.1.10 2016-10-29 19:49:03 +02:00
Michael Carlberg
5692e6d419 fix(bump.sh): Support multi digit patch versions 2016-10-29 19:49:00 +02:00
Michael Carlberg
c1be785be7 fix(progressbar): Add safety check
Fixes jaagr/lemonbuddy#132
2016-10-29 19:37:49 +02:00
Michael Carlberg
07b467cd38 fix(xbps): Update pkg template 2016-10-29 19:16:39 +02:00
Michael Carlberg
dfbed32287 git: Vim files 2016-10-29 16:41:29 +02:00
Michael Carlberg
26e38ad5a1 fix(aur): Add jsoncpp to optdepends 2016-10-29 12:42:33 +02:00
Michael Carlberg
f0eb7e00c6 build: Bump version to 2.1.9 2016-10-29 12:39:13 +02:00
Michael Carlberg
3c171aaf0e docs: Note about jsoncpp and compiler links
- Note about jsoncpp
- Links to supported compilers
2016-10-29 12:37:13 +02:00
Michael Carlberg
bba583422d git(i3ipcpp): Update submodule ref 2016-10-29 12:16:20 +02:00
Michael Carlberg
d8c64fbce1 build: Bump version to 2.1.8 2016-10-29 08:28:46 +02:00
Michael Carlberg
a3fecbc730 fix(aur): Update GIT_TAG when building git package 2016-10-29 08:11:08 +02:00
Michael Carlberg
2768041d7c fix(network): Connection state
Closes jaagr/lemonbuddy#118
2016-10-29 07:26:57 +02:00
Michael Carlberg
072f836a58 fix(ci): Update build script 2016-10-29 06:58:04 +02:00
Michael Carlberg
e21d084fdd fix(mpd): Connection state broadcasting 2016-10-29 06:52:48 +02:00
Michael Carlberg
1075144b00 refactor(eventloop): Use concurrent queue for events
Events are now enqueued using a thread safe concurrent queue
which makes the previous eventloop locking redundant.
2016-10-29 06:48:51 +02:00
Michael Carlberg
92900e78d6 fix(mpd): Wake up thread when stopping module 2016-10-28 19:52:20 +02:00
Michael Carlberg
d420fe3a0f build: Bump version to 2.1.7 2016-10-28 19:25:25 +02:00
Michael Carlberg
17921823e0 fix(controller): Change verbosity of shutdown logging 2016-10-28 18:58:55 +02:00
Michael Carlberg
fa7e3d4430 fix(script): Terminate running commands
Make sure the previous command has ended before
executing a new command.

This also fixes the execution block that was
caused by the tailing the command output of
action commands.

Fixes jaagr/lemonbuddy#131
2016-10-28 18:54:08 +02:00
Michael Carlberg
6923e0e288 build: Bump version to 2.1.6 2016-10-28 14:56:43 +02:00
Michael Carlberg
1e30e4254a fix(script): Make sure idle is called every iteration 2016-10-28 14:56:11 +02:00
Michael Carlberg
2cc6ef662a fix(config): ${self.key} references the current section 2016-10-28 13:36:53 +02:00
Michael Carlberg
cc253b069a build: Bump version to 2.1.5 2016-10-28 13:03:26 +02:00
Michael Carlberg
4c7943b9bb fix(build): Guess new version in bump.sh 2016-10-28 13:02:13 +02:00
Michael Carlberg
a04bdb31f0 git: Add .clang-tidy rules 2016-10-28 12:40:53 +02:00
Michael Carlberg
f2233cee2d fix(cmake): Require working C compiler
Closes jaagr/lemonbuddy#129
2016-10-28 11:54:00 +02:00
Michael Carlberg
2661e87d83 fix(tray): Synchrounous unmap of empty tray window 2016-10-26 15:17:33 +02:00
Michael Carlberg
a1c018193a fix(tray): Catch errors caused from invalid X windows 2016-10-26 13:42:40 +02:00
Michael Carlberg
f822865413 build: Bump version to 2.1.4 2016-10-26 12:22:08 +02:00
Michael Carlberg
660d06768b fix(script): Set 2s default interval for timed scripts 2016-10-26 12:20:55 +02:00
Michael Carlberg
4167c8c11c fix(bar): Allow true transparency
Fixes jaagr/lemonbuddy#119
2016-10-26 02:24:10 +02:00
Michael Carlberg
204ab89921 fix(bar): Use premultiplied rgb color for X fonts
Closes jaagr/lemonbuddy#119
2016-10-26 01:50:37 +02:00
Michael Carlberg
fb7a59c6d9 fix(bar): Properly flush xcb connection
Closes jaagr/lemonbuddy#114
2016-10-25 23:58:29 +02:00
Michael Carlberg
8b24847e05 git: Update submodule refs 2016-10-25 23:36:47 +02:00
Michael Carlberg
ec1326f950 build: Bump version to 2.1.3 2016-10-25 23:12:24 +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
2529ec0520 fix(logger): Add pragmas to silence GCC error 2016-10-25 22:47:31 +02:00
398 changed files with 40005 additions and 17203 deletions

View File

@@ -1,13 +1,14 @@
---
Language: Cpp
Standard: Cpp11
Standard: c++17
BasedOnStyle: Google
ColumnLimit: 100
NamespaceIndentation: All
ColumnLimit: 120
NamespaceIndentation: Inner
AlignAfterOpenBracket: DontAlign
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: false
BreakConstructorInitializersBeforeComma: true
DerivePointerAlignment: false
PointerAlignment: Left
SpacesBeforeTrailingComments: 1
---

48
.clang-tidy Normal file
View File

@@ -0,0 +1,48 @@
---
Checks: '
-*,
performance-*,
readability-*,
clang-analyzer-alpha.core*,
clang-analyzer-alpha.security*,
clang-analyzer-alpha.unix.cstring*,
clang-analyzer-core.uninitialized*,
clang-analyzer-cplusplus.*,
clang-analyzer-nullability*,
clang-analyzer-unix*,
cppcoreguidelines*,
modernize-use-*,
modernize-*,
-modernize-raw-string-literal,
-modernize-use-bool-literals,
-modernize-use-trailing-return-type,
-readability-identifier-length,
-readability-implicit-bool-cast,
-readability-else-after-return,
-readability-named-parameter,
-readability-implicit-bool-conversion,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-reinterpret-cast,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-owning-memory,
'
CheckOptions:
cppcoreguidelines-avoid-do-while.IgnoreMacros: true
modernize-loop-convert.NamingStyle: lower_case
readability-identifier-naming.ClassCase: lower_case
readability-identifier-naming.ClassConstantCase: UPPER_CASE
readability-identifier-naming.ClassMethodCase: lower_case
readability-identifier-naming.MemberCase: lower_case
readability-identifier-naming.ProtectedMemberPrefix: 'm_'
readability-identifier-naming.PrivateMemberPrefix: 'm_'
readability-simplify-boolean-expr.SimplifyDeMorgan: false
HeaderFilterRegex: ''
WarningsAsErrors: ''
AnalyzeTemporaryDtors: false
...

15
.editorconfig Normal file
View File

@@ -0,0 +1,15 @@
root = true
[*]
insert_final_newline = true
trim_trailing_whitespace = true
indent_style = space
indent_size = 2
charset = utf-8
[*.py]
indent_size = 4
[Makefile]
indent_style = tab
indent_size = 2

24
.exrc
View File

@@ -1,24 +0,0 @@
let &path.='include,src,'
let g:alternateSearchPath = ''
\ . 'sfr:../src'
\ . ',sfr:../../src/adapters'
\ . ',sfr:../../src/components'
\ . ',sfr:../../src/drawtypes'
\ . ',sfr:../../src/interfaces'
\ . ',sfr:../../src/modules'
\ . ',sfr:../../src/services'
\ . ',sfr:../../src/utils'
\ . ',sfr:../../src/x11'
\ . ',sfr:../include'
\ . ',sfr:../../include/adapters'
\ . ',sfr:../../include/components'
\ . ',sfr:../../include/drawtypes'
\ . ',sfr:../../include/interfaces'
\ . ',sfr:../../include/modules'
\ . ',sfr:../../include/services'
\ . ',sfr:../../include/utils'
\ . ',sfr:../../include/x11'
let g:alternateExtensions_cpp = 'hpp'
let tag_path='/home/jaagr/.local/src/c++/lemonbuddy/.tags'
set tags+=/home/jaagr/.local/src/c++/lemonbuddy/.tags

2
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1,2 @@
github: polybar
open_collective: polybar

112
.github/ISSUE_TEMPLATE/bug_report.yml vendored Normal file
View File

@@ -0,0 +1,112 @@
name: 🐞 Bug Report
description: Create a report for something that misbehaves
title: "[Bug]: "
labels: ["bug", "needs confirmation"]
body:
- type: checkboxes
id: checklist
attributes:
label: Checklist
description: Please carefully go through this checklist and check each option.
options:
- label: I have read the appropriate section in the [contributing guidelines](https://github.com/polybar/polybar/blob/master/CONTRIBUTING.md)
required: true
- label: I believe this issue is a problem with polybar itself and not a misconfiguration on my part
required: true
- label: I have searched for other open and closed [issues](https://github.com/polybar/polybar/issues?q=is%3Aissue) that may have already reported this problem
required: true
- label: I have checked the [known issues](https://github.com/polybar/polybar/wiki/Known-Issues) page for this problem.
required: true
- label: I have followed the [debugging guide](https://github.com/polybar/polybar/wiki/Debugging-your-Config) to narrow down the problem to a minimal config.
required: true
- type: textarea
id: reproduce
attributes:
label: Steps to reproduce
description: Any steps to take and commands to run to reproduce this issue.
placeholder: |
1. `polybar -c ... bar`
2. ...
validations:
required: true
- type: textarea
id: config
attributes:
label: Minimal config
description: A minimal but **complete** config with which the problem occurs.
render: dosini
placeholder: |
[bar/example]
...
[module/...]
...
validations:
required: true
- type: textarea
id: logs
attributes:
label: Polybar log
description: Post everything polybar prints to the terminal when you run it and the issue occurs. If possible, run polybar with a higher log level (e.g. `trace` or `info`).
render: text
placeholder: |
notice: Parsing config file: ...
...
- type: textarea
id: expected
attributes:
label: Expected behavior
description: A clear and concise description of what you expected to happen
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual behavior
description: What actually happens
validations:
required: true
- type: input
id: wm
attributes:
label: Window Manager and Version
placeholder: ex. i3-gaps 4.19.1
validations:
required: true
- type: input
id: distro
attributes:
label: Linux Distribution
placeholder: ex. Ubuntu 21.04
validations:
required: true
- type: textarea
id: version
attributes:
label: Polybar version
description: Output of `polybar -vvv`
render: text
placeholder: |
polybar 3.5.7
Features: +alsa +curl +i3 +mpd +network(libnl) +pulseaudio +xkeyboard
X extensions: +randr (+monitors) +composite +xkb +xrm +xcursor
Build type: Release
Compiler: /usr/bin/c++
Compiler flags: -D_FORTIFY_SOURCE=2 -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O3 -DNDEBUG -Wall -Wextra -Wpedantic -Wsuggest-override
Linker flags: -Wall -Wextra -Wpedantic -Wsuggest-override -Wall -Wextra -Wpedantic -Wsuggest-override
validations:
required: true
- type: textarea
id: context
attributes:
label: Additional Context / Screenshots
description: If applicable, add screenshots and additional context to explain your problem
validations:
required: false
- type: markdown
attributes:
value: |
Thanks for taking the time to fill out this bug report! :heart:

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: 🙋 Ask a question
url: https://github.com/polybar/polybar/blob/master/SUPPORT.md
about: Have a look at our support resources and channels
- name: 💡 Feature request
url: https://github.com/polybar/polybar/discussions/categories/ideas
about: Suggest your idea over in Discussions
- name: 🛠️ Build Issues
url: https://github.com/polybar/polybar/discussions/categories/build-support
about: Get support when building polybar from source

26
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,26 @@
<!-- Please read our contributing guide before opening a PR: https://github.com/polybar/polybar/blob/master/CONTRIBUTING.md -->
## What type of PR is this? (check all applicable)
* [ ] Refactor
* [ ] Feature
* [ ] Bug Fix
* [ ] Optimization
* [ ] Documentation Update
* [ ] Other: *Replace this with a description of the type of this PR*
## Description
<!--
Document user-facing changes in this PR (for example: new config options, changed behavior).
You can also motivate design decisions here.
-->
## Related Issues & Documents
<!-- For example: Fixes #1234, Closes #6789 -->
## Documentation (check all applicable)
* [ ] This PR requires changes to the Wiki documentation (describe the changes)
* [ ] This PR requires changes to the documentation inside the git repo (please add them to the PR).
* [ ] Does not require documentation changes

21
.github/codecov.yml vendored Normal file
View File

@@ -0,0 +1,21 @@
coverage:
status:
project:
default:
# Coverage can drop by 0.1% without failing the status
threshold: 0.1
patch:
default:
# Patches don't need test coverage
# TODO remove once we have proper testing infrastructure and documentation
target: 0
ignore:
- "tests/**/*"
- "lib/**/*"
comment:
require_changes: true
github_checks:
annotations: false

166
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,166 @@
name: CI
on:
workflow_dispatch:
inputs:
ref:
description: 'ref'
required: false
push:
pull_request:
jobs:
docs:
runs-on: ubuntu-22.04
env:
COLOR: "ON"
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.ref }}
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-sphinx
- name: Build Documentation
run: |
mkdir -p build
cd build
cmake -DDISABLE_ALL=ON -DBUILD_DOC=ON -DSPHINX_FLAGS="-W" ..
make doc
ipc:
runs-on: ubuntu-22.04
env:
COLOR: "ON"
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libxcb-composite0-dev \
libxcb-ewmh-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-randr0-dev \
libxcb-util0-dev \
libxcb1-dev \
libcairo2-dev \
python3-xcbgen \
libuv1-dev \
xcb-proto
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.event.inputs.ref }}
- name: Build polybar-msg
run: |
mkdir -p build
cd build
cmake -DDISABLE_ALL=ON -DBUILD_POLYBAR_MSG=ON ..
make polybar-msg
build:
runs-on: ubuntu-22.04
strategy:
matrix:
cxx: [g++, clang++]
polybar_build_type: ["full"]
build_type: ["Release"]
include:
- cxx: g++
polybar_build_type: "tests"
build_type: "Coverage"
- cxx: g++
polybar_build_type: "minimal"
build_type: "Release"
env:
CXX: ${{ matrix.cxx }}
BUILD_TYPE: ${{ matrix.build_type }}
POLYBAR_BUILD_TYPE: ${{ matrix.polybar_build_type }}
POLYBAR_DIR: ${{ github.workspace }}
BUILD_DIR: "${{ github.workspace}}/build"
MAKEFLAGS: "-j4"
COLOR: "ON"
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
libxcb-composite0-dev \
libxcb-ewmh-dev \
libxcb-icccm4-dev \
libxcb-image0-dev \
libxcb-randr0-dev \
libxcb-util0-dev \
libxcb1-dev \
libcairo2-dev \
python3-xcbgen \
libuv1-dev \
xcb-proto
if [ "$POLYBAR_BUILD_TYPE" != "minimal" ]; then
sudo apt-get install -y \
libxcb-xkb-dev \
libxcb-cursor-dev \
libxcb-xrm-dev \
i3-wm \
libcurl4-openssl-dev \
libjsoncpp-dev \
libasound2-dev \
libpulse-dev \
libnl-genl-3-dev \
libmpdclient-dev
fi
if [ "$POLYBAR_BUILD_TYPE" = "tests" ]; then
sudo apt-get install -y lcov
fi
- uses: actions/checkout@v4
with:
submodules: true
ref: ${{ github.event.inputs.ref }}
- name: Summary
run: ./common/ci/summary.sh
- name: Configure
run: ./common/ci/configure.sh
- name: Build
run: |
cd "$BUILD_DIR"
make
- name: Collect initial coverage
if: ${{ matrix.polybar_build_type == 'tests' }}
run: |
lcov --capture --initial --no-external --directory . -o cov_base.info
- name: Tests
if: ${{ matrix.polybar_build_type == 'tests' }}
run: |
cd "$BUILD_DIR"
make check
- name: Collect coverage
if: ${{ matrix.polybar_build_type == 'tests' }}
run: |
lcov --capture --no-external --directory . -o cov_tests.info
lcov --add-tracefile cov_base.info --add-tracefile cov_tests.info -o cov_total.info
lcov --remove cov_total.info "${PWD}/build/*" "${PWD}/tests/*" "${PWD}/lib/*" -o cov.info
- name: Upload Coverage
if: ${{ matrix.polybar_build_type == 'tests' }}
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unittests
# We provide our own coverage files
disable_search: true
# Disable all plugins, we handle all preparations ourselves
plugins: noop
files: ./cov.info
fail_ci_if_error: true
verbose: true
- name: Upload Logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: cmake
path: |
build/CMakeFiles/CMakeError.log
build/CMakeFiles/CMakeOutput.log
retention-days: 5

105
.github/workflows/release.yml vendored Normal file
View File

@@ -0,0 +1,105 @@
# Workflow For Releases
#
# Automatically creates and uploads a complete release archive for the given
# release.
name: Release Workflow
# Is triggered when a new release is published or by hand
# If triggered by hand, the release tag that this should target has to be
# specified.
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: 'Release Tag'
required: true
jobs:
upload:
runs-on: ubuntu-latest
steps:
- name: Get Version
if: ${{ github.event.inputs.tag }} != ''
run: |
if [ ${{ github.event_name }} == 'workflow_dispatch' ]; then
echo "Manual Release Triggered"
RELEASE_TAG=${{ github.event.inputs.tag }}
else
echo "Automatic Release Triggered"
RELEASE_TAG=${GITHUB_REF#refs/tags/}
fi
echo "Publishing Version $RELEASE_TAG"
{
echo "RELEASE_TAG=$RELEASE_TAG"
echo "POLYBAR_DIR=polybar-$RELEASE_TAG"
echo "POLYBAR_ARCHIVE=polybar-$RELEASE_TAG.tar.gz"
} >> "$GITHUB_ENV"
# Checks out the target tag
- uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_TAG }}
submodules: true
path: ${{ env.POLYBAR_DIR }}
- name: Create Release Archive
run: |
find "$DIR" -type d -name ".git" -exec rm -rf {} \+
tar czf "$ARCHIVE" "$DIR"
echo "SHA256SUM=$(sha256sum "$ARCHIVE" | cut -d ' ' -f 1)" >> "$GITHUB_ENV"
env:
DIR: ${{ env.POLYBAR_DIR }}
ARCHIVE: ${{ env.POLYBAR_ARCHIVE }}
- name: Get Upload URL
id: get_upload_url
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const tag = '${{ env.RELEASE_TAG }}';
console.log(`Getting Upload URL for '${tag}'`);
const release = await github.rest.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
});
core.exportVariable('UPLOAD_URL', release.data.upload_url);
core.exportVariable('RELEASE_ID', release.data.id);
core.exportVariable('RELEASE_BODY', release.data.body);
- name: Upload Release Archive
id: upload_archive
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.UPLOAD_URL }}
asset_path: "./${{ env.POLYBAR_ARCHIVE }}"
asset_name: ${{ env.POLYBAR_ARCHIVE }}
asset_content_type: application/gzip
# Adds a download section to the beginning of the release body
- name: Update Release Body
uses: actions/github-script@v7
env:
# Existing release body, fetched in the get_upload_url step.
RELEASE_BODY: ${{ env.RELEASE_BODY }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fname = '${{ env.POLYBAR_ARCHIVE }}'
const url = '${{ steps.upload_archive.outputs.browser_download_url }}'
const hash = '${{ env.SHA256SUM }}'
let body = "## Download\n\n"
body += `[${fname}](${url}) (**sha256**: \`${hash}\`)\n\n`
body += process.env.RELEASE_BODY;
const release = await github.rest.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: '${{ env.RELEASE_ID}}',
body: body
});

16
.gitignore vendored
View File

@@ -1,7 +1,17 @@
build*/
tags
/build
/tags
/compile_commands.json
*.bak
*.pyc
*.swp
*.tmp
include/config.hpp
.tags
*.user
# clangd
/.cache
polybar-*.tar
*.cache
.venv

8
.gitmodules vendored
View File

@@ -1,8 +1,8 @@
[submodule "lib/i3ipcpp"]
path = lib/i3ipcpp
url = https://github.com/jaagr/i3ipcpp
branch = v0.5.0
url = https://github.com/polybar/i3ipcpp
branch = master
[submodule "lib/xpp"]
path = lib/xpp
url = https://github.com/jaagr/xpp
branch = 1.3.0
url = https://github.com/polybar/xpp
branch = master

View File

@@ -1,27 +0,0 @@
#!/bin/sh
# Pass if the README.md isn't staged for commit
test "$(git diff --staged README.md)" || exit 0
# Redirect all output to stderr
exec 1>&2
# shellcheck disable=SC2016
tag_prev=$(git tag -l | tail -2 | head -1)
tag_curr=$(git tag -l | tail -1)
# Pass if tags aren't defined
[ "$tag_prev" ] || exit 0
[ "$tag_curr" ] || exit 0
sed -n "/${tag_prev}/q1" README.md
# Pass if the previous tag wasn't found
[ $? -eq 1 ] || exit 0
echo
echo "\033[36;1mNOTICE \033[37;1m**\033[0m Updating README.md with latest tag (\033[1m${tag_prev}\033[0m => \033[1m${tag_curr}\033[0m)"
echo " The change will be staged for commit..."
echo
sed -i "s/${tag_prev}/${tag_curr}/g" README.md

22
.readthedocs.yaml Normal file
View File

@@ -0,0 +1,22 @@
---
# .readthedocs.yaml
# Read the Docs configuration file
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
# Set the version of Python and other tools you might need
build:
os: ubuntu-22.04
tools:
python: "3"
# Build documentation in the docs/ directory with Sphinx
sphinx:
configuration: doc/conf.py
fail_on_warning: true
python:
install:
- requirements: doc/requirements.txt

View File

@@ -1,112 +0,0 @@
sudo: required
dist: trusty
language: cpp
compiler:
- clang
# - gcc
addons:
apt:
sources:
- ubuntu-toolchain-r-test
- llvm-toolchain-precise-3.8
packages:
- gcc-5
- g++-5
- clang-3.8
env:
global:
- BUILD_TYPE="Release"
- LLVM_VERSION="3.8.1"
- LLVM_URL="http://llvm.org/releases/${LLVM_VERSION}/llvm-${LLVM_VERSION}.src.tar.xz"
- LIBCXX_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxx-${LLVM_VERSION}.src.tar.xz"
- LIBCXXABI_URL="http://llvm.org/releases/${LLVM_VERSION}/libcxxabi-${LLVM_VERSION}.src.tar.xz"
- CMAKE_URL="https://cmake.org/files/v3.6/cmake-3.6.2-Linux-x86_64.tar.gz"
cache:
directories:
- ${TRAVIS_BUILD_DIR}/deps/cmake
- ${TRAVIS_BUILD_DIR}/deps/llvm-3.8.1/install
before_install:
- sudo apt-add-repository -y "ppa:george-edison55/george-edison"
- sudo apt-get -qq update
# Install packages : core
#--------------------------------------------------------------------------x
- sudo apt-get install -y cmake cmake-data libboost-dev
# Install packages : xcb
#--------------------------------------------------------------------------x
- sudo apt-get install -y libxcb1-dev libxcb-util0-dev libxcb-randr0-dev libxcb-ewmh-dev libxcb-icccm4-dev xcb-proto python-xcbgen libfreetype6-dev
# Install packages : optional
#--------------------------------------------------------------------------x
- sudo apt-get install -y i3-wm libiw-dev libasound2-dev libmpdclient-dev
install:
# Install dependencies in ${TRAVIS_BUILD_DIR}/deps
#--------------------------------------------------------------------------x
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
- LLVM_ROOT="${DEPS_DIR}/llvm-${LLVM_VERSION}"
- mkdir -p "${DEPS_DIR}"
# Update python path to make sure we find the xcbgen module
#--------------------------------------------------------------------------x
- export PYTHONPATH="/usr/lib/python2.7/dist-packages:${PYTHONPATH}"
# Install a later version of cmake
#--------------------------------------------------------------------------x
- |
cd "${DEPS_DIR}"
if [[ -z "$(ls -A ${DEPS_DIR}/cmake/bin 2>/dev/null)" ]]; then
mkdir -p cmake && travis_retry wget --no-check-certificate --quiet -O - "${CMAKE_URL}" | tar --strip-components=1 -xz -C cmake
fi
- export PATH="${DEPS_DIR}/cmake/bin:${PATH}"
# Install LLVM libc++
#--------------------------------------------------------------------------x
- |
if [[ "${CXX}" == "clang++" ]] && [[ -z "$(ls -A ${LLVM_ROOT}/install/include 2>/dev/null)" ]]; then
mkdir -p "${LLVM_ROOT}" "${LLVM_ROOT}/build" "${LLVM_ROOT}/projects/libcxx" "${LLVM_ROOT}/projects/libcxxabi"
travis_retry wget --quiet -O - "${LLVM_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}"
travis_retry wget --quiet -O - "${LIBCXX_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxx"
travis_retry wget --quiet -O - "${LIBCXXABI_URL}" | tar --strip-components=1 -xJ -C "${LLVM_ROOT}/projects/libcxxabi"
(cd "${LLVM_ROOT}/build" && cmake .. -DCMAKE_CXX_COMPILER=clang++ && make cxxabi cxx -j2)
(cd "${LLVM_ROOT}/build/projects/libcxx" && make install)
(cd "${LLVM_ROOT}/build/projects/libcxxabi" && make install)
export CXXFLAGS="${CXXFLAGS} -I${LLVM_ROOT}/install/include"
export CXXFLAGS="${CXXFLAGS} -I${LLVM_ROOT}/install/include/c++/v1"
export CXXFLAGS="${CXXFLAGS} -stdlib=libc++"
export LDFLAGS="${LDFLAGS} -L${LLVM_ROOT}/install/lib"
export LDFLAGS="${LDFLAGS} -lc++"
export LDFLAGS="${LDFLAGS} -lc++abi"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LLVM_ROOT}/install/lib"
fi
# Set compiler's
#--------------------------------------------------------------------------x
- if [[ "${CXX}" == "clang++" ]]; then export CXX="clang++-3.8" CC="clang-3.8"; fi
# - if [[ "${CXX}" == "g++" ]]; then export CXX="g++-5" CC="gcc-5"; fi
before_script:
- eval "${CXX} --version"
- eval "${CC} --version"
- cmake --version
- mkdir -p "${TRAVIS_BUILD_DIR}/build"
- cd "${TRAVIS_BUILD_DIR}/build"
- cmake -DCMAKE_C_COMPILER="${CC}" -DCMAKE_CXX_COMPILER="${CXX}" -DCMAKE_CXX_FLAGS="${CXXFLAGS}" -DCMAKE_BUILD_TYPE="${BUILD_TYPE}" -DENABLE_CCACHE=OFF ..
script: make
notifications:
irc:
channels:
- "irc.freenode.net#lemonbuddy"
template:
- "%{author} pushed #%{commit} \"%{commit_subject}\" -> %{repository_name}/%{branch}"
- "Build #%{build_number}: %{result} // Compare at %{compare_url}"
use_notice: true
skip_join: true

101
.valgrind-suppressions Normal file
View File

@@ -0,0 +1,101 @@
{
xft/fontconfig
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:FcPatternCreate
fun:FcFontRenderPrepare
fun:FcFontMatch
fun:XftFontMatch
fun:XftFontOpenName
...
...
...
...
...
...
}
{
xft/fontconfig
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
obj:/usr/lib/libfontconfig.so.*
obj:/usr/lib/libfontconfig.so.*
fun:FcPatternAddDouble
obj:/usr/lib/libXft.so.*
obj:/usr/lib/libXft.so.*
obj:/usr/lib/libXft.so.*
obj:/usr/lib/libXft.so.*
fun:XftDefaultHasRender
fun:XftDefaultSubstitute
fun:XftFontMatch
fun:XftFontOpenName
}
{
xft/fontconfig
Memcheck:Leak
match-leak-kinds: definite
fun:malloc
fun:XftFontCheckGlyph
fun:XftGlyphRender
fun:XftDrawGlyphs
fun:XftDrawString16
...
...
...
...
...
...
...
}
{
xft/fontconfig
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
obj:/usr/lib/libfontconfig.so.*
obj:/usr/lib/libfontconfig.so.*
fun:FcFontRenderPrepare
fun:FcFontMatch
fun:XftFontMatch
fun:XftFontOpenName
...
...
...
...
...
}
{
xresource manager
Memcheck:Leak
match-leak-kinds: definite
fun:realloc
obj:/usr/lib/libX11.so.*
obj:/usr/lib/libX11.so.*
obj:/usr/lib/libX11.so.*
fun:_XlcCreateLC
fun:_XlcDefaultLoader
fun:_XOpenLC
fun:_XrmInitParseInfo
obj:/usr/lib/libX11.so.*
fun:XrmGetStringDatabase
...
...
}
{
xft conditional jump
Memcheck:Cond
obj:/usr/lib/libfreetype.so.*
obj:/usr/lib/libfreetype.so.*
fun:FT_Outline_Decompose
obj:/usr/lib/libfreetype.so.*
obj:/usr/lib/libfreetype.so.*
obj:/usr/lib/libfreetype.so.*
obj:/usr/lib/libfreetype.so.*
obj:/usr/lib/libfreetype.so.*
fun:XftFontLoadGlyphs
fun:XftGlyphExtents
...
...
}

View File

@@ -1,143 +0,0 @@
# Here's the license text for this file:
#
# This is free and unencumbered software released into the public domain.
#
# Anyone is free to copy, modify, publish, use, compile, sell, or
# distribute this software, either in source code form or as a compiled
# binary, for any purpose, commercial or non-commercial, and by any
# means.
#
# In jurisdictions that recognize copyright laws, the author or authors
# of this software dedicate any and all copyright interest in the
# software to the public domain. We make this dedication for the benefit
# of the public at large and to the detriment of our heirs and
# successors. We intend this dedication to be an overt act of
# relinquishment in perpetuity of all present and future rights to this
# software under copyright law.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
# OTHER DEALINGS IN THE SOFTWARE.
#
# For more information, please refer to <http://unlicense.org/>
import os
import ycm_core
flags = [
'-std=c++14',
'-Wall',
'-Wextra',
]
compilation_database_folder = ''
if os.path.exists( compilation_database_folder ):
database = ycm_core.CompilationDatabase( compilation_database_folder )
else:
database = None
SOURCE_EXTENSIONS = ['.cpp', '.cxx', '.cc', '.c', '.m', '.mm']
def DirectoryOfThisScript():
return os.path.dirname( os.path.abspath( __file__ ) )
flags.append('-I'+ DirectoryOfThisScript() +'/src')
flags.append('-I'+ DirectoryOfThisScript() +'/include')
flags.append('-I'+ DirectoryOfThisScript() +'/lib/gsl')
flags.append('-I'+ DirectoryOfThisScript() +'/lib/cpp_freetype/include')
flags.append('-I'+ DirectoryOfThisScript() +'/lib/i3ipcpp/include')
flags.append('-I'+ DirectoryOfThisScript() +'/lib/xpp/include')
flags.append('-I'+ DirectoryOfThisScript() +'/lib/lemonbar/include')
flags.append('-I'+ DirectoryOfThisScript() +'/lib/fastdelegate/include')
flags.append('-I'+ DirectoryOfThisScript() +'/lib/boost/include')
flags.append('-I'+ DirectoryOfThisScript() +'/tests')
flags.append('-I/usr/include/freetype2')
flags.append('-I/usr/include/pango-1.0')
flags.append('-I/usr/include/cairomm-1.0')
flags.append('-I/usr/include/pangomm-1.4')
flags.append('-I/usr/include/glibmm-2.4')
flags.append('-I/usr/lib/cairomm-1.0/include')
flags.append('-I/usr/include')
def MakeRelativePathsInFlagsAbsolute( flags, working_directory ):
if not working_directory:
return list( flags )
new_flags = []
make_next_absolute = False
path_flags = [ '-isystem', '-I', '-iquote', '--sysroot=' ]
for flag in flags:
new_flag = flag
if make_next_absolute:
make_next_absolute = False
if not flag.startswith( '/' ):
new_flag = os.path.join( working_directory, flag )
for path_flag in path_flags:
if flag == path_flag:
make_next_absolute = True
break
if flag.startswith( path_flag ):
path = flag[ len( path_flag ): ]
new_flag = path_flag + os.path.join( working_directory, path )
break
if new_flag:
new_flags.append( new_flag )
return new_flags
def IsHeaderFile( filename ):
extension = os.path.splitext( filename )[ 1 ]
return extension in [ '.h', '.hxx', '.hpp', '.hh' ]
def GetCompilationInfoForFile( filename ):
# The compilation_commands.json file generated by CMake does not have entries
# for header files. So we do our best by asking the db for flags for a
# corresponding source file, if any. If one exists, the flags for that file
# should be good enough.
if IsHeaderFile( filename ):
basename = os.path.splitext( filename )[ 0 ]
for extension in SOURCE_EXTENSIONS:
replacement_file = basename + extension
if os.path.exists( replacement_file ):
compilation_info = database.GetCompilationInfoForFile(
replacement_file )
if compilation_info.compiler_flags_:
return compilation_info
return None
return database.GetCompilationInfoForFile( filename )
def FlagsForFile( filename, **kwargs ):
# if database:
# # Bear in mind that compilation_info.compiler_flags_ does NOT return a
# # python list, but a "list-like" StringVec object
# compilation_info = GetCompilationInfoForFile( filename )
# if not compilation_info:
# return None
#
# final_flags = MakeRelativePathsInFlagsAbsolute(
# compilation_info.compiler_flags_,
# compilation_info.compiler_working_dir_ )
#
# # NOTE: This is just for YouCompleteMe; it's highly likely that your project
# # does NOT need to remove the stdlib flag. DO NOT USE THIS IN YOUR
# # ycm_extra_conf IF YOU'RE NOT 100% SURE YOU NEED IT.
# try:
# final_flags.remove( '-stdlib=libc++' )
# except ValueError:
# pass
# else:
relative_to = DirectoryOfThisScript()
final_flags = MakeRelativePathsInFlagsAbsolute( flags, relative_to )
return {
'flags': final_flags,
'do_cache': True
}

293
CHANGELOG.md Normal file
View File

@@ -0,0 +1,293 @@
# Changelog
All notable changes to this project will be documented in this file.
Each release should have the following subsections, if entries exist, in the
given order: `Breaking`, `Build`, `Deprecated`, `Removed`, `Added`, `Changed`,
`Fixed`, `Security`.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
- An option `unmute-on-scroll` for `internal/pulseaudio` and `internal/alsa` to unmute audio when the user scrolls on the widget.
- `internal/battery`: Added `ramp-charging` tag.
([`#3172`](https://github.com/polybar/polybar/pull/3172))
by [@stringlapse](https://github.com/stringlapse).
- Added tray-reversed = false option to tray module. Makes tray icons order reversed. ([`#3181`](https://github.com/polybar/polybar/discussions/3181))
### Changed
- `internal/pulseaudio`: Volume adjustments now preserve balance instead of volume ratios ([`#3123`](https://github.com/polybar/polybar/issues/3123), [`#3169`](https://github.com/polybar/polybar/pull/3169)) by [`@parmort`](https://github.com/parmort)
- When the `-r` flag is provided, and RandR reports zero connected active screens, polybar will not restart. This fixes polybar dying on some laptops when the lid is closed. ([`#3078`](https://github.com/polybar/polybar/pull/3078))).
## [3.7.2] - 2024-08-17
### Fixed
- `custom/script`: When a script with `tail = true` received multiple lines quickly, only the first would get displayed ([`#3117`](https://github.com/polybar/polybar/issues/3117), [`#3119`](https://github.com/polybar/polybar/pull/3119)) by [@Isak05](https://github.com/Isak05)
- Token min-length calculations would behave differently when non-ASCII characters appear in the token ([`#3074`](https://github.com/polybar/polybar/issues/3074), [`#3087`](https://github.com/polybar/polybar/pull/3087)) by [@nklloyd](https://github.com/nklloyd)
- i3: Fix duplicated rendering for non-full-width bars ([`#3091`](https://github.com/polybar/polybar/pull/3091), [`#3060`](https://github.com/polybar/polybar/issues/3060))
- `internal/backlight`: Module could display the literal `%percentage%` token if the backlight reports a value of 0 at startup ([`#3081`](https://github.com/polybar/polybar/pull/3081)) by [@unclechu](https://github.com/unclechu)
- `internal/tray`: Fix crash during restarting, when tray icons were not removed proberly ([`#3111`](https://github.com/polybar/polybar/issues/3111), [`#3112`](https://github.com/polybar/polybar/pull/3112))
- `custom/ipc`: Module would display the literal `%output%` token before the initial hook finished executing ([`#3131`](https://github.com/polybar/polybar/issues/3131), [`#3140`](https://github.com/polybar/polybar/pull/3140))
- renderer: Pseudo-transparency rendering artifacts when wallpaper does not fill entire screen ([`#3096`](https://github.com/polybar/polybar/pull/3096), [`#3041`](https://github.com/polybar/polybar/issues/3041))
## [3.7.1] - 2023-11-27
### Build
- Fixed missing header when using `libc++` in clang 15 and below
### Changed
- `internal/tray`: The module must use the `<tray>` tag (this is the default) ([`#3037`](https://github.com/polybar/polybar/pull/3037))
### Fixed
- Modules did not validate that all tags (e.g. `<label>`) used in a format were valid for that format ([`#3043`](https://github.com/polybar/polybar/issues/3043), [`#3045`](https://github.com/polybar/polybar/pull/3045))
- `internal/tray`: Fixed `module-margin` and `separator` being applied to completely empty tray module ([`#3036`](https://github.com/polybar/polybar/issues/3036), [`#3037`](https://github.com/polybar/polybar/pull/3037))
## [3.7.0] - 2023-11-05
### Breaking
- `custom/script`:
- No longer hides the module if the `exec` command failed and did not change the output from the previous run ([`#2636`](https://github.com/polybar/polybar/issues/2636)). Somewhat similar original behaviour can be imitated with `format-fail`, if necessary.
- If the `exec` command produced no output and exited with a non-zero exit code the module is no longer completely empty, but just has an empty `%output%` token. If you relied on this behavior to hide the module under certain circumstances, make sure the script exits with an exit code of zero. ([`#2857`](https://github.com/polybar/polybar/discussions/2857), [`#2861`](https://github.com/polybar/polybar/pull/2861))
### Build
- Respect `CMAKE_INSTALL_PREFIX` when installing default config ([`#2770`](https://github.com/polybar/polybar/pull/2770), [`#2917`](https://github.com/polybar/polybar/pull/2917))
- Change default `CMAKE_INSTALL_PREFIX` to `/usr`. Installations with default flags will now go into `/usr` instead of `/usr/local` ([`#2917`](https://github.com/polybar/polybar/pull/2917))
- Bump C++ version to C++17 ([`#2847`](https://github.com/polybar/polybar/pull/2847))
### Deprecated
- `custom/text`: The `content` setting and all its properties are deprecated in favor of `format` with the same functionality. ([`#2676`](https://github.com/polybar/polybar/pull/2676))
- tray: All tray-related settings in the bar section are deprecated. They are replaced by the new tray module ([`#3002`](https://github.com/polybar/polybar/pull/3002))
- `tray-position`, `tray-detached`, `tray-maxsize`, `tray-scale`, `tray-transparent`, `tray-background`, `tray-foreground`, `tray-padding`, `tray-offset-x`, `tray-offset-y`
### Added
- A tray module with type `internal/tray` for positioning the tray like a module ([`#2689`](https://github.com/polybar/polybar/issues/2689))
- `internal/temperature`: `%temperature-k%` token displays the temperature in Kelvin ([`#2774`](https://github.com/polybar/polybar/discussions/2774), [`#2784`](https://github.com/polybar/polybar/pull/2784))
- `internal/pulseaudio`: `reverse-scroll` option ([`#2664`](https://github.com/polybar/polybar/pull/2664))
- `custom/script`: Repeat interval for script failure (`interval-fail`) and `exec-if` (`interval-if`) ([`#943`](https://github.com/polybar/polybar/issues/943), [`#2606`](https://github.com/polybar/polybar/issues/2606), [`#2630`](https://github.com/polybar/polybar/pull/2630))
- `custom/ipc`:
- Added support for `<label>` in `format` ([`#2841`](https://github.com/polybar/polybar/pull/2841)) by [@madhavpcm](https://github.com/madhavpcm).
- Added support for `format-i` for each defined `hook-i` ([`#2775`](https://github.com/polybar/polybar/issues/2775), [`#2810`](https://github.com/polybar/polybar/pull/2810)) by [@madhavpcm](https://github.com/madhavpcm).
- `custom/text`: Loads the `format` setting, which supports the `<label>` tag, if the deprecated `content` is not defined ([`#1331`](https://github.com/polybar/polybar/issues/1331), [`#2673`](https://github.com/polybar/polybar/pull/2673), [`#2676`](https://github.com/polybar/polybar/pull/2676))
- `internal/backlight`:
- `scroll-interval` option ([`#2696`](https://github.com/polybar/polybar/issues/2696), [`#2700`](https://github.com/polybar/polybar/pull/2700))
- `poll-interval` setting controls how often the module is updated (in case it does not happen when the brightness changes) ([`#2835`](https://github.com/polybar/polybar/issues/2835), [`#3028`](https://github.com/polybar/polybar/pull/3028))
- `internal/temperature`: Added `zone-type` setting ([`#2572`](https://github.com/polybar/polybar/issues/2572), [`#2752`](https://github.com/polybar/polybar/pull/2752)) by [@xphoniex](https://github.com/xphoniex)
- `internal/xwindow`: `%class%` and `%instance%` tokens, which show the contents of the `WM_CLASS` property of the active window ([`#2830`](https://github.com/polybar/polybar/pull/2830))
- Added `enable-struts` option in bar section to enable/disable struts ([`#2769`](https://github.com/polybar/polybar/issues/2769), [`#2844`](https://github.com/polybar/polybar/pull/2844)) by [@VanillaViking](https://github.com/VanillaViking).
- `wm-restack`:
- `bottom`: lowers polybar to the bottom of the window stack (same as the previous behavior of `generic`) ([`#2961`](https://github.com/polybar/polybar/pull/2961))
- `ewmh`: Tries to use the `_NET_SUPPORTING_WM_CHECK` hint to position the bar ([`#2961`](https://github.com/polybar/polybar/pull/2961))
- `internal/xworkspaces`: `group-by-monitor` setting to decide whether `_NET_DESKTOP_VIEWPORT` should be used to group workspaces by monitor; ([`#2603`](https://github.com/polybar/polybar/issues/2603), [`#2926`](https://github.com/polybar/polybar/pull/2926)) by [@slotThe](https://github.com/slotThe/).
### Changed
- `custom/script`:
- No longer produces a completely empty module if the `exec` command failed. It only produces an empty module if the script had a zero exit code. ([`#2857`](https://github.com/polybar/polybar/discussions/2857), [`#2861`](https://github.com/polybar/polybar/pull/2861))
- Bumped the script polling interval (not related to the `interval` setting) to decrease wakeups. Polybar may take slightly longer to shut down. [`#2879`](https://github.com/polybar/polybar/pull/2879)
- `internal/fs`: Use `/` as a fallback if no mountpoints are specified ([`#2572`](https://github.com/polybar/polybar/issues/2572), [`#2705`](https://github.com/polybar/polybar/pull/2705))
- `internal/backlight`:
- Detect backlight if none specified ([`#2572`](https://github.com/polybar/polybar/issues/2572), [`#2728`](https://github.com/polybar/polybar/pull/2728))
- `use-actual-brightness` now always defaults to `true` (even for `amdgpu` backlights) ([`#2835`](https://github.com/polybar/polybar/issues/2835), [`2839`](https://github.com/polybar/polybar/pull/2839))
- Providing a negative min-width to a token adds right-padding ([`#2789`](https://github.com/polybar/polybar/issues/2789), [`#2801`](https://github.com/polybar/polybar/pull/2801)) by [@VanillaViking](https://github.com/VanillaViking).
- Changed fuzzy match option on i3 and bspwm modules to find longest match instead of the first match ([`#2831`](https://github.com/polybar/polybar/pull/2831), [`#2829`](https://github.com/polybar/polybar/issues/2829)) by [@Ron0Studios](https://github.com/ron0studios/).
- `wm-restack`
- `generic`: Is now a best effort combination of other restacking strategies. First tries `ewmh` and then the `bottom` strategy ([`#2961`](https://github.com/polybar/polybar/pull/2961))
- `bspwm`: Will restack above the topmost bspwm root window instead of the root window associated with the monitor polybar is on ([`#3019`](https://github.com/polybar/polybar/pull/3019))
### Fixed
- Waiting for double click interval on modules that don't have a double click action ([`#2663`](https://github.com/polybar/polybar/issues/2663), [`#2695`](https://github.com/polybar/polybar/pull/2695))
- renderer:
- Small gaps when rendering emojis ([`#2785`](https://github.com/polybar/polybar/issues/2785), [`#2802`](https://github.com/polybar/polybar/pull/2802))
- Crash when using pseudo-transparency with certain wallpapers ([`#2798`](https://github.com/polybar/polybar/issues/2798), [`#2813`](https://github.com/polybar/polybar/pull/2813))
- Crash when invalid UTF-8 text is encountered ([`#2091`](https://github.com/polybar/polybar/issues/2091), [`#2958`](https://github.com/polybar/polybar/pull/2958))
- config:
- Error reporting for deprecated config values ([`#2724`](https://github.com/polybar/polybar/issues/2724))
- Also monitor include-files for changes when --reload is set ([`#675`](https://github.com/polybar/polybar/issues/675), [`#2759`](https://github.com/polybar/polybar/pull/2759))
- `internal/xwindow`: module does not crash when a tag is not provided in format ([`#2826`](https://github.com/polybar/polybar/issues/2826), [`#2833`](https://github.com/polybar/polybar/pull/2833)) by [@VanillaViking](https://github.com/VanillaViking)
- `internal/i3`: module errors when i3 has negative gaps ([`#2888`](https://github.com/polybar/polybar/issues/2888), [`#2889`](https://github.com/polybar/polybar/pull/2889))
- `internal/backlight`: Fix module being one step behind every update ([`#2835`](https://github.com/polybar/polybar/issues/2835), [`#3028`](https://github.com/polybar/polybar/pull/3028))
- `wm-restack = bspwm`: bar may become unclickable if there are overlapping monitors ([`#2873`](https://github.com/polybar/polybar/issues/2873), [`#2961`](https://github.com/polybar/polybar/pull/2961))
## [3.6.3] - 2022-05-04
### Fixed
- `custom/script`: Output clearing when `exec-if` fails ([`#2674`](https://github.com/polybar/polybar/issues/2674))
- `internal/battery`: `poll-interval` not working ([`#2649`](https://github.com/polybar/polybar/issues/2649), [`#2677`](https://github.com/polybar/polybar/pull/2677))
- ipc: Polybar failing to open IPC channel after another user already ran polybar, if `XDG_RUNTIME_DIR` is not set ([`#2683`](https://github.com/polybar/polybar/issues/2683), [`#2684`](https://github.com/polybar/polybar/pull/2684))
- No overlines/underlines being drawn when using offsets ([`#2685`](https://github.com/polybar/polybar/pull/2685))
- Update struts (`_NET_WM_STRUT_PARTIAL`) when hiding the bar ([`#2702`](https://github.com/polybar/polybar/pull/2702))
- `internal/pulseaudio`: Hanging during startup ([`#2707`](https://github.com/polybar/polybar/issues/2707), [`#2709`](https://github.com/polybar/polybar/pull/2709))
- `internal/xworkspaces`: Updates of `_NET_DESKTOP_VIEWPORT` being ignored ([`#2693`](https://github.com/polybar/polybar/issues/2693), [`#2698`](https://github.com/polybar/polybar/pull/2698))
## [3.6.2] - 2022-04-03
### Fixed
- `format-offset` being ignored ([`#2643`](https://github.com/polybar/polybar/pull/2643))
- Negative struts (`margin-bottom`, `margin-top`) being ignored ([`#2642`](https://github.com/polybar/polybar/issues/2642), [`#2644`](https://github.com/polybar/polybar/pull/2644))
- Positioning in awesomeWM ([`#2651`](https://github.com/polybar/polybar/pull/2651))
- `internal/xworkspaces`: The module sometimes crashed polybar when windows were closed. ([`#2655`](https://github.com/polybar/polybar/pull/2655))
- Mouseover error when only one cursor is defined ([`#2656`](https://github.com/polybar/polybar/pull/2656))
- `custom/script`: Timing inconsistencies ([`#2650`](https://github.com/polybar/polybar/issues/2650), first described at [`#2630`](https://github.com/polybar/polybar/pull/2630))
## [3.6.1] - 2022-03-05
### Build
- Fixed compiler warning in Clang 13 ([`#2613`](https://github.com/polybar/polybar/pull/2613))
- Fixed compiler error in GCC 12 ([`#2616`](https://github.com/polybar/polybar/pull/2616), [`#2614`](https://github.com/polybar/polybar/issues/2614))
- Fixed installation of docs when some are not generated (man, html...) ([`#2612`](https://github.com/polybar/polybar/pull/2612))
- Fix `LDFLAGS` not being respected ([`#2619`](https://github.com/polybar/polybar/pull/2619))
### Fixed
- `tray-offset-x`, `tray-offset-y`, `offset-x`, and `offset-y` were mistakenly capped below at 0 ([`#2620`](https://github.com/polybar/polybar/pull/2620))
- `custom/script`: Polybar shutdown being stalled by hanging script ([`#2621`](https://github.com/polybar/polybar/pull/2621))
- `polybar-msg`: Wrong hint when using deprecated `hook` ([`#2624`](https://github.com/polybar/polybar/pull/2624))
## [3.6.0] - 2022-03-01
### Breaking
- We added the backslash escape character (\\) for configuration values. This means that the literal backslash character now has special meaning in configuration files, therefore if you want to use it in a value as a literal backslash, you need to escape it with the backslash escape character. The parser logs an error if any unescaped backslashes are found in a value. This affects you only if you are using two consecutive backslashes in a config value, which will now be interpreted as a single literal backslash. ([`#2354`](https://github.com/polybar/polybar/issues/2354))
- We rewrote our formatting tag parser. This shouldn't break anything, if you experience any problems, please let us know. The new parser now gives errors for certain invalid tags where the old parser would just silently ignore them. Adding extra text to the end of a valid tag now produces an error. For example, tags like `%{T-a}`, `%{T2abc}`, `%{rfoo}`, and others will now start producing errors. This does not affect you unless you are producing your own invalid formatting tags (for example in a script).
- For security reasons, the named pipe at `/tmp/polybar_mqueue.<PID>` had its permission bits changed from `666` to `600` to prevent sending ipc messages to polybar processes running under a different user.
- Also for security reasons, the `polybar-msg` command will now only send messages to polybar processes running under the same user. See the [IPC documentation](https://polybar.readthedocs.io/user/ipc.html) for what exactly this means.
### Build
- New dependency: [libuv](https://github.com/libuv/libuv). At least version 1.3 is required.
- Bump the minimum cmake version to 3.5
- The `BUILD_IPC_MSG` option has been renamed to `BUILD_POLYBAR_MSG`
- Building the documentation is now enabled by default and not just when `sphinx-build` is found.
- Users can control exactly which targets should be available with the following cmake options (together with their default value):
- `BUILD_POLYBAR=ON` - Builds the `polybar` executable
- `BUILD_POLYBAR_MSG=ON` - Builds the `polybar-msg` executable
- `BUILD_TESTS=OFF` - Builds the test suite
- `BUILD_DOC=ON` - Builds the documentation
- `BUILD_DOC_HTML=BUILD_DOC` - Builds the html documentation (depends on `BUILD_DOC`)
- `BUILD_DOC_MAN=BUILD_DOC` - Builds the manpages (depends on `BUILD_DOC`)
- `BUILD_CONFIG=ON` - Generates the default config
- `BUILD_SHELL=ON` - Generates shell completion files
- `DISABLE_ALL=OFF` - Disables all above targets by default. Individual targets can still be enabled explicitly.
- The documentation can no longer be built by directly configuring the `doc` directory.
- The `POLYBAR_FLAGS` cmake variable can be used to pass extra C++ compiler flags.
- The sample config file has been removed.
- Polybar now ships a default config that is installed to `/etc/polybar/config.ini`, it lives in `doc/config.ini`. It will also be placed in the `examples` directory in the documentation folder. ([`#2405`](https://github.com/polybar/polybar/issues/2405))
- The `userconfig` target has been removed, you can no longer use `make userconfig`. As an alternative, you can copy the default config from `/etc/polybar/config.ini`.
- The `DEBUG_SHADED` cmake variable and its associated functionality has been removed.
### Deprecated
- `[settings]`: `throttle-output` and `throttle-output-for` have been removed. The new event loop already does a similar thing where it coalesces update triggers if they happen directly after one another, leading to only a single bar update.
- When not specifying the config file with `--config`, naming your config file `config` is deprecated. Rename your config file to `config.ini`.
- Directly writing ipc messages to `/tmp/polybar_mqueue.<PID>` is deprecated, users should always use `polybar-msg`. As a consequence the message format used for IPC is deprecated as well.
- `polybar-msg hook` is deprecated in favor of using the hook action. `polybar-msg` will tell you the correct command to use.
### Added
- Support `px` and `pt` units everyhwere where before only a number of spaces or pixels could be specified. ([`#2578`](https://github.com/polybar/polybar/pull/2578), [`#1651`](https://github.com/polybar/polybar/issues/1651), [`#951`](https://github.com/polybar/polybar/issues/951))
- `internal/alsa`: Right and middle click settings. ([`#2566`](https://github.com/polybar/polybar/issues/2566), [`#2573`](https://github.com/polybar/polybar/pull/2573))
- `internal/network`:
- New token `%mac%` shows MAC address of selected interface ([`#2568`](https://github.com/polybar/polybar/issues/2568), [`#2569`](https://github.com/polybar/polybar/pull/2569))
- New token `%netspeed%` that provides the total speed of the internet (up + down speed) ([`#2590`](https://github.com/polybar/polybar/pull/2590), [`#1083`](https://github.com/polybar/polybar/issues/1083))
- `speed-unit = B/s` can be used to customize how network speeds are displayed. ([`#2068`](https://github.com/polybar/polybar/pull/2068))
- `interface-type` may be used in place of `interface` to automatically select a network interface ([`#2025`](https://github.com/polybar/polybar/pull/2025), [`#339`](https://github.com/polybar/polybar/issues/339))
- Polybar can now read config files from stdin: `polybar -c /dev/stdin`. ([`#2545`](https://github.com/polybar/polybar/pull/2545))
- `custom/script`:
- Setting environment variables using `env-*` config option. ([`#2090`](https://github.com/polybar/polybar/issues/2090), [`#2512`](https://github.com/polybar/polybar/pull/2512))
- Add formatting for script failure (`format-fail`, `label-fail`) ([`#2588`](https://github.com/polybar/polybar/issues/2588), [`#2596`](https://github.com/polybar/polybar/pull/2596))
- Support for ramp weights. ([`#1750`](https://github.com/polybar/polybar/issues/1750), [`#2505`](https://github.com/polybar/polybar/pull/2505))
- `internal/memory`: New tokens `%used%`, `%free%`, `%total%`, `%swap_total%`, `%swap_free%`, and `%swap_used%` that automatically switch between MiB and GiB when below or above 1GiB. ([`#2472`](https://github.com/polybar/polybar/issues/2472), [`#2488`](https://github.com/polybar/polybar/pull/2488))
- `internal/i3`: `show-urgent` option to always show urgent windows when `pin-workspace` is active ([`#2374`](https://github.com/polybar/polybar/issues/2374), [`#2378`](https://github.com/polybar/polybar/pull/2378))
- `internal/xworkspaces`:
- `reverse-scroll` can be used to reverse the scroll direction when cycling through desktops. ([`#2365`](https://github.com/polybar/polybar/pull/2365))
- `%nwin%` can be used to display the number of open windows per workspace ([`#604`](https://github.com/polybar/polybar/issues/604), [`#2329`](https://github.com/polybar/polybar/pull/2329))
- Initial support for the backslash escape character (\\) in configs. ([`#2354`](https://github.com/polybar/polybar/issues/2354), [`#2361`](https://github.com/polybar/polybar/pull/2361))
- Warn states for the cpu, memory, fs, and battery modules. ([`#570`](https://github.com/polybar/polybar/issues/570), [`#956`](https://github.com/polybar/polybar/issues/956), [`#1871`](https://github.com/polybar/polybar/issues/1871), [`#2141`](https://github.com/polybar/polybar/issues/2141), [`#2199`](https://github.com/polybar/polybar/pull/2199))
- `internal/battery`: `format-low`, `label-low`, `animation-low`, `low-at = 10`.
- `internal/cpu`: `format-warn`, `label-warn`, `warn-percentage = 80`
- `internal/fs`: `format-warn`, `label-warn`, `warn-percentage = 90`
- `internal/memory`: `format-warn`, `label-warn`, `warn-percentage = 90`
- `radius` now affects the bar border as well ([`#1566`](https://github.com/polybar/polybar/issues/1566), [`#2359`](https://github.com/polybar/polybar/pull/2359))
- Per-corner radius with `radius-{bottom,top}-{left,right}` ([`#2294`](https://github.com/polybar/polybar/issues/2294), [`#2297`](https://github.com/polybar/polybar/pull/2297))
- `internal/xkeyboard`:
- `%variant%` token to display the keyboard layout variant ([`#316`](https://github.com/polybar/polybar/issues/316), [`#2163`](https://github.com/polybar/polybar/pull/2163))
- Allow matching of variants in `layout-icon` ([`#2414`](https://github.com/polybar/polybar/issues/2414), [`#2521`](https://github.com/polybar/polybar/pull/2521))
- Config option to hide a certain module (`hidden = false`) ([`#2108`](https://github.com/polybar/polybar/issues/2108), [`#2342`](https://github.com/polybar/polybar/pull/2342))
- Actions to control visibility of modules (`module_toggle`, `module_show`, and `module_hide`) ([`#2108`](https://github.com/polybar/polybar/issues/2108), [`#2426`](https://github.com/polybar/polybar/pull/2426))
- `internal/backlight`: `use-actual-brightness` option to use the `actual_brightness` file to get the brightness ([`#2380`](https://github.com/polybar/polybar/pull/2380))
- `wm-restack = generic` option that lowers polybar to the bottom of the window stack. Fixes the issue where the bar is being drawn on top of fullscreen windows in xmonad. ([`#2205`](https://github.com/polybar/polybar/issues/2205), [`#2404`](https://github.com/polybar/polybar/pull/2404))
- `internal/bspwm`: `occupied-scroll = true` option allows scrolling through occupied desktops only. ([`#2427`](https://github.com/polybar/polybar/issues/2427), [`#2428`](https://github.com/polybar/polybar/pull/2428))
- `custom/ipc`:
- `send` action to send arbitrary strings to be displayed in the module. ([`#2455`](https://github.com/polybar/polybar/issues/2455), [`#2463`](https://github.com/polybar/polybar/pull/2463))
- `hook`, `next`, `prev`, `reset` actions to control the module through actions instead of the deprecated hook messages ([`#2464`](https://github.com/polybar/polybar/issues/2464), [`#2528`](https://github.com/polybar/polybar/pull/2528))
- Added `double-click-interval` setting to the bar section to control the time interval in which a double-click is recognized. Defaults to 400 (ms) ([`#1441`](https://github.com/polybar/polybar/issues/1441), [`#2510`](https://github.com/polybar/polybar/pull/2510))
- Added a new `tray-foreground` setting to give hints to tray icons about what color they should be. ([`#2235`](https://github.com/polybar/polybar/issues/2235), [`#2552`](https://github.com/polybar/polybar/pull/2552))
- `polybar-msg`:
- For module actions, you can now also specify the module name, action name, and optional data as separate arguments. ([`#2539`](https://github.com/polybar/polybar/pull/2539))
- Added man page: `man 1 polybar-msg` ([`#2539`](https://github.com/polybar/polybar/pull/2539))
### Changed
- Polybar now also reads `config.ini` when searching for config files. ([`#2323`](https://github.com/polybar/polybar/issues/2323), [`#2324`](https://github.com/polybar/polybar/pull/2324))
- Polybar additionally searches in `XDG_CONFIG_DIRS/polybar/config.ini` (or `/etc/xdg/polybar/config.ini` if it is not set) and `/etc/polybar/config.ini` for config files. ([`#2016`](https://github.com/polybar/polybar/issues/2016), [`#2511`](https://github.com/polybar/polybar/pull/2511))
- We rewrote polybar's main event loop. This shouldn't change any behavior for the user, but be on the lookout for X events, click events, or ipc messages not arriving and the bar not shutting down/restarting properly and let us know if you find any issues. ([`#2384`](https://github.com/polybar/polybar/pull/2384))
- Slight changes to the value ranges the different ramp levels are responsible for in the cpu, memory, fs, and battery modules. The first level is used for everything at and below the start of the value range and the last level for everything at and above the end of the value range. The other levels are evenly distributed over the value range as before. The value range is bounded by the new warning thresholds. ([`#2199`](https://github.com/polybar/polybar/pull/2199))
- `custom/script`: `interval` now defaults to 0 if `tail = true` as per the documentation. ([`#2240`](https://github.com/polybar/polybar/pull/2240))
- `internal/network`: Increased precision for upload and download speeds: 0 decimal places for KB/s (as before), 1 for MB/s and 2 for GB/s. ([`#2054`](https://github.com/polybar/polybar/pull/2054))
- Clicks arriving in close succession, no longer get dropped. Before polybar would drop any click that arrived within 5ms of the previous one. ([`#2510`](https://github.com/polybar/polybar/pull/2510))
- Increased the double click interval from 150ms to 400ms. ([`#2510`](https://github.com/polybar/polybar/pull/2510))
- Stop ignoring actions if they arrive while the previous one hasn't been processed yet. ([`#2469`](https://github.com/polybar/polybar/issues/2469), [`#2517`](https://github.com/polybar/polybar/pull/2517))
- Polybar can now be run without passing the bar name as argument given that the configuration file only defines one bar ([`#2525`](https://github.com/polybar/polybar/issues/2525), [`#2526`](https://github.com/polybar/polybar/pull/2526))
- `include-directory` and `include-file` now support relative paths. The paths are relative to the folder of the file where those directives appear. ([`#2523`](https://github.com/polybar/polybar/issues/2523), [`#2535`](https://github.com/polybar/polybar/issues/2535))
- `custom/ipc`: Empty output strings are no longer formatted. This prevents extraneous spaces and separators from appearing in the bar when the output of an ipc module is empty. ([`#2549`](https://github.com/polybar/polybar/pull/2549))
### Fixed
- Broken positioning in Openbox when the bar is hidden and shown again ([`#2021`](https://github.com/polybar/polybar/issues/2021), [`#2600`](https://github.com/polybar/polybar/pull/2600))
- Handling of action blocks that contain negative offsets ([`#1814`](https://github.com/polybar/polybar/issues/1814), [`#2601`](https://github.com/polybar/polybar/pull/2601))
- `polybar -m` used to show both physical outputs and RandR monitors, even if the outputs were covered by monitors. ([`#2481`](https://github.com/polybar/polybar/issues/2481), [`#2485`](https://github.com/polybar/polybar/pull/2485))
- Parser error if click command contained `}` ([`#2040`](https://github.com/polybar/polybar/issues/2040), [`#2303`](https://github.com/polybar/polybar/pull/2303))
- Some modules stop updating when system time moves backwards. ([`#857`](https://github.com/polybar/polybar/issues/857), [`#1932`](https://github.com/polybar/polybar/issues/1932), [`#2559`](https://github.com/polybar/polybar/pull/2559))
- `custom/script`: Concurrency issues with fast-updating tailed scripts. ([`#1978`](https://github.com/polybar/polybar/issues/1978), [`#2518`](https://github.com/polybar/polybar/pull/2518))
- `internal/alsa`: Slight imprecision when calculating percentages. This caused the volume reported to be off by one. ([`#2399`](https://github.com/polybar/polybar/issues/2399), [`#2401`](https://github.com/polybar/polybar/pull/2401))
- `internal/backlight`: With amdgpu backlights, the brightness indicator was slightly behind. ([`#2367`](https://github.com/polybar/polybar/issues/2367), [`#2380`](https://github.com/polybar/polybar/pull/2380))
- `internal/bspwm`: Warning message regarding T@ ([`#2371`](https://github.com/polybar/polybar/issues/2371), [`#2439`](https://github.com/polybar/polybar/pull/2439))
- `internal/xkeyboard`: Trailing space after the layout label when indicators are empty and made sure right amount of spacing is added between the indicator labels ([`#2292`](https://github.com/polybar/polybar/issues/2292), [`#2306`](https://github.com/polybar/polybar/pull/2306))
- `internal/xworkspaces`:
- Broken scroll-wrapping and order of workspaces when scrolling ([`#2491`](https://github.com/polybar/polybar/issues/2491), [`#2492`](https://github.com/polybar/polybar/pull/2492))
- Module would error if WM was not full started up. ([`#1915`](https://github.com/polybar/polybar/issues/1915), [`#2429`](https://github.com/polybar/polybar/pull/2429))
- Make the urgent hint persistent ([`#1081`](https://github.com/polybar/polybar/issues/1081), [`#2340`](https://github.com/polybar/polybar/pull/2340))
- Crash when the WM sets -1 for `_NET_WM_DESKTOP` ([`#2352`](https://github.com/polybar/polybar/issues/2352), [`#2353`](https://github.com/polybar/polybar/issues/2353))
- `internal/network`: The module now properly supports 'altnames' for interfaces. ([`#2540`](https://github.com/polybar/polybar/pull/2540))
- `internal/battery`: More accurate battery state ([`#2563`](https://github.com/polybar/polybar/issues/2563), [`#2556`](https://github.com/polybar/polybar/pull/2556))
- Offset tag does not respect current background color ([`#2578`](https://github.com/polybar/polybar/pull/2578), [`#1700`](https://github.com/polybar/polybar/issues/1700))
- Crash when negative margin or padding was specified ([`#2578`](https://github.com/polybar/polybar/pull/2578), [`#1265`](https://github.com/polybar/polybar/issues/1265))
## [3.5.7] - 2021-09-21
### Fixed
- The tray mistakenly removed tray icons that did not support XEMBED
([`#2479`](https://github.com/polybar/polybar/issues/2479),
[`#2442`](https://github.com/polybar/polybar/issues/2442))
- `custom/ipc`: Only the first appearance of the `%pid%` token was replaced
([`#2500`](https://github.com/polybar/polybar/issues/2500))
## [3.5.6] - 2021-05-24
### Build
- Support building documentation on sphinx 4.0 ([`#2424`](https://github.com/polybar/polybar/issues/2424))
### Fixed
- Tray icons sometimes appears outside of bar ([`#2430`](https://github.com/polybar/polybar/issues/2430), [`#1679`](https://github.com/polybar/polybar/issues/1679))
- Crash in the i3 module ([`#2416`](https://github.com/polybar/polybar/issues/2416))
## [3.5.5] - 2021-03-01
### Build
- Support older python sphinx versions again ([`#2356`](https://github.com/polybar/polybar/issues/2356))
## [3.5.4] - 2021-01-07
### Fixed
- Wrong text displayed if module text ends with `}` ([`#2331`](https://github.com/polybar/polybar/issues/2331))
## [3.5.3] - 2020-12-23
### Build
- Don't use `git` when building documentation ([`#2309`](https://github.com/polybar/polybar/issues/2309))
### Fixed
- Empty color values are no longer treated as invalid and no longer produce an error.
[Unreleased]: https://github.com/polybar/polybar/compare/3.7.2...HEAD
[3.7.2]: https://github.com/polybar/polybar/releases/tag/3.7.2
[3.7.1]: https://github.com/polybar/polybar/releases/tag/3.7.1
[3.7.0]: https://github.com/polybar/polybar/releases/tag/3.7.0
[3.6.3]: https://github.com/polybar/polybar/releases/tag/3.6.3
[3.6.2]: https://github.com/polybar/polybar/releases/tag/3.6.2
[3.6.1]: https://github.com/polybar/polybar/releases/tag/3.6.1
[3.6.0]: https://github.com/polybar/polybar/releases/tag/3.6.0
[3.5.7]: https://github.com/polybar/polybar/releases/tag/3.5.7
[3.5.6]: https://github.com/polybar/polybar/releases/tag/3.5.6
[3.5.5]: https://github.com/polybar/polybar/releases/tag/3.5.5
[3.5.4]: https://github.com/polybar/polybar/releases/tag/3.5.4
[3.5.3]: https://github.com/polybar/polybar/releases/tag/3.5.3

View File

@@ -1,199 +1,98 @@
#
# Build configuration
#
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
project(lemonbuddy CXX)
cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR)
project(polybar CXX)
option(CXXLIB_CLANG "Link against libc++" OFF)
option(CXXLIB_GCC "Link against stdlibc++" OFF)
# Extract version information from version.txt. The first line that looks like
# a version string is used, so the file supports comments
file(STRINGS version.txt version_txt REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+.*$" LIMIT_COUNT 1)
# Include local cmake modules
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/cmake/modules)
# Export compile commands used for custom targets
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
execute_process(COMMAND git rev-parse --show-toplevel
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE git_top_dir_result
OUTPUT_VARIABLE git_top_dir
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
# Load cmake utility functions
include(cmake/utils.cmake)
# Set fallback first, override if more information (from git) is found
set(APP_VERSION "${version_txt}")
# Set default build type if not specified
if(NOT CMAKE_BUILD_TYPE)
message_colored(STATUS "No build type specified; using Release" 33)
set(CMAKE_BUILD_TYPE "Release")
# Prevent formatting errors & resolve symlinks (REALPATH)
get_filename_component(resolved_project_source_dir ${PROJECT_SOURCE_DIR} REALPATH)
if(NOT ("${git_top_dir}" STREQUAL ""))
get_filename_component(git_top_dir ${git_top_dir} REALPATH)
endif()
# Generic compiler flags
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
if(git_top_dir_result EQUAL "0" AND git_top_dir STREQUAL resolved_project_source_dir)
# If we are in a git repo we can get the version information from git describe
execute_process(COMMAND git describe --tags --dirty=-dev
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE git_describe_result
OUTPUT_VARIABLE git_describe
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
# Debug specific compiler flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g2")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pedantic")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pedantic-errors")
if(git_describe_result EQUAL "0")
set(APP_VERSION "${git_describe}")
else()
message(STATUS "Could not detect version with git, falling back to built-in version information.")
endif()
# Release specific compiler flags
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3")
# Compiler specific flags
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL Clang)
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}" 32)
elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL GNU)
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}" 32)
else()
message_colored(WARNING "Using unsupported compiler ${CMAKE_CXX_COMPILER_ID} !" 31)
message(STATUS "CMake and git directory mismatch, falling back to built-in version information.") # Assuming that if git rev-parse doesn't return 0, git describe won't either
endif()
# Set compiler and linker flags for preferred C++ library
if(CXXLIB_CLANG)
message_colored(STATUS "Linking against libc++" 32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lc++ -lc++abi")
elseif(CXXLIB_GCC)
message_colored(STATUS "Linking against libstdc++" 32)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lstdc++")
else()
message_colored(STATUS "No preferred c++lib specified... linking against system default" 33)
# Set the default installation prefix to /usr
# Otherwise the default value is /usr/local which causes the default config
# file to be installed to /usr/local/etc, with /usr, cmake has special handling
# for this.
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Project-default installation prefix" FORCE)
endif()
# Project settings {{{
list(APPEND CMAKE_MODULE_PATH
${PROJECT_SOURCE_DIR}/cmake
${PROJECT_SOURCE_DIR}/cmake/common
${PROJECT_SOURCE_DIR}/cmake/modules)
# Set default option values based on current environment
find_package(ALSA QUIET)
find_package(Libiw QUIET)
find_package(LibMPDClient QUIET)
find_program(I3_BINARY i3)
if(I3_BINARY)
set(I3_FOUND ON)
include(GNUInstallDirs)
include(utils)
include(01-core)
include(02-opts)
include(04-targets)
if(BUILD_DOC)
add_subdirectory(doc)
endif()
option(BUILD_TESTS "Build testsuite" OFF)
option(ENABLE_CCACHE "Enable ccache support" OFF)
option(ENABLE_ALSA "Enable alsa support" ${ALSA_FOUND})
option(ENABLE_I3 "Enable i3 support" ${I3_FOUND})
option(ENABLE_MPD "Enable mpd support" ${LIBMPDCLIENT_FOUND})
option(ENABLE_NETWORK "Enable network support" ${LIBIW_FOUND})
if(ENABLE_ALSA)
set(SETTING_ALSA_SOUNDCARD "default"
CACHE STRING "Name of the ALSA soundcard driver")
endif()
set(SETTING_CONNECTION_TEST_IP "8.8.8.8"
CACHE STRING "Address to ping when testing network connection")
set(SETTING_PATH_BACKLIGHT_VAL "/sys/class/backlight/%card%/brightness"
CACHE STRING "Path to file containing the current backlight value")
set(SETTING_PATH_BACKLIGHT_MAX "/sys/class/backlight/%card%/max_brightness"
CACHE STRING "Path to file containing the maximum backlight value")
set(SETTING_PATH_BATTERY_CAPACITY "/sys/class/power_supply/%battery%/capacity"
CACHE STRING "Path to file containing the current battery capacity")
set(SETTING_PATH_ADAPTER_STATUS "/sys/class/power_supply/%adapter%/online"
CACHE STRING "Path to file containing the current adapter status")
set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket"
CACHE STRING "Path to bspwm socket")
set(SETTING_BSPWM_STATUS_PREFIX "W"
CACHE STRING "Prefix prepended to the bspwm status line")
set(SETTING_PATH_CPU_INFO "/proc/stat"
CACHE STRING "Path to file containing cpu info")
set(SETTING_PATH_MEMORY_INFO "/proc/meminfo"
CACHE STRING "Path to file containing memory info")
if(ENABLE_CCACHE)
require_binary(ccache)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${BINPATH_ccache})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${BINPATH_ccache})
if (BUILD_SHELL)
add_subdirectory(contrib/bash)
add_subdirectory(contrib/zsh)
endif()
# }}}
# Add subdirectories {{{
add_subdirectory(${PROJECT_SOURCE_DIR}/man)
add_subdirectory(${PROJECT_SOURCE_DIR}/src ${PROJECT_BINARY_DIR}/bin)
add_subdirectory(${PROJECT_SOURCE_DIR}/examples ${PROJECT_BINARY_DIR}/examples)
# Setup everything that uses a C++ compiler (polybar, polybar-msg, tests)
if(HAS_CXX_COMPILATION)
include(cxx)
if(BUILD_LIBPOLY)
include(libpoly)
add_subdirectory(lib)
endif()
add_subdirectory(include)
add_subdirectory(src bin)
endif()
# We need to enable testing in the root folder so that 'ctest' and 'make test'
# can be run in the build directory
if(BUILD_TESTS)
add_subdirectory(${PROJECT_SOURCE_DIR}/tests ${PROJECT_BINARY_DIR}/tests)
else()
add_subdirectory(${PROJECT_SOURCE_DIR}/tests ${PROJECT_BINARY_DIR}/tests EXCLUDE_FROM_ALL)
enable_testing()
add_subdirectory(tests)
endif()
# }}}
# Build summary {{{
message(STATUS "---------------------------")
message(STATUS " Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS " Compiler C: ${CMAKE_C_COMPILER}")
message(STATUS " Compiler C++: ${CMAKE_CXX_COMPILER}")
message(STATUS " Compiler flags: ${CMAKE_CXX_FLAGS}")
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
message(STATUS " + debug flags:: ${CMAKE_CXX_FLAGS_DEBUG}")
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
message(STATUS " + release flags:: ${CMAKE_CXX_FLAGS_RELEASE}")
elseif(CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
message(STATUS " + minsizerel flags:: ${CMAKE_CXX_FLAGS_MINSIZEREL}")
elseif(CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
message(STATUS " + relwithdebinfo flags:: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
endif()
if(CXXLIB_CLANG)
message(STATUS "Linking C++ library: libc++")
elseif(CXXLIB_GCC)
message(STATUS "Linking C++ library: libstdc++")
else()
message(STATUS "Linking C++ library: system default")
endif()
message(STATUS "---------------------------")
message(STATUS " Build testsuite ${BUILD_TESTS}")
message(STATUS " Enable ccache support ${ENABLE_CCACHE}")
message(STATUS " Enable alsa support ${ENABLE_ALSA}")
message(STATUS " Enable i3 support ${ENABLE_I3}")
message(STATUS " Enable mpd support ${ENABLE_MPD}")
message(STATUS " Enable network support ${ENABLE_NETWORK}")
if(DISABLE_MODULES)
message(STATUS " Disable modules ON")
endif()
if(DISABLE_TRAY)
message(STATUS " Disable systray ON")
endif()
if(DISABLE_DRAW)
message(STATUS " Disable drawing ON")
endif()
message(STATUS "---------------------------")
# }}}
# Custom target: uninstall {{{
configure_file(
${PROJECT_SOURCE_DIR}/cmake/uninstall.cmake.in
${PROJECT_BINARY_DIR}/cmake/uninstall.cmake
IMMEDIATE @ONLY)
add_custom_target(uninstall COMMAND ${CMAKE_COMMAND}
-P ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake)
# }}}
# Custom target: clang-format {{{
find_program(CLANG_FORMAT "clang-format")
if(CLANG_FORMAT)
file(GLOB_RECURSE HEADERS ${PROJECT_SOURCE_DIR}/include/*.hpp)
file(GLOB_RECURSE SOURCES ${PROJECT_SOURCE_DIR}/src/*.cpp)
add_custom_target(clang-format COMMAND ${CLANG_FORMAT}
-i -style=file ${HEADERS} ${SOURCES})
if(BUILD_CONFIG)
install(FILES ${CMAKE_SOURCE_DIR}/doc/config.ini
DESTINATION ${CMAKE_INSTALL_FULL_SYSCONFDIR}/${PROJECT_NAME}
COMPONENT config)
endif()
find_program(CLANG_TIDY "clang-tidy")
# }}}
# Custom target: clang-tidy {{{
if(CLANG_TIDY)
add_custom_target(clang-tidy COMMAND ${CLANG_TIDY}
-p ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/main.cpp)
endif()
# }}}
include(05-summary)

169
CONTRIBUTING.md Normal file
View File

@@ -0,0 +1,169 @@
# Contributing
First of all, thank you very much for considering contributing to polybar. You
are awesome! :tada:
**Table of Contents:**
* [Bug Reports](#bug-reports)
* [Pull Requests](#pull-requests)
+ [Testing](#testing)
+ [Changelog](#changelog)
+ [Documentation](#documentation)
+ [Style](#style)
* [Donations](#donations)
## Bug Reports
Bugs should be reported at the polybar issue tracker, using the [bug report
template](https://github.com/polybar/polybar/issues/new?template=bug_report.yml).
Make sure you fill out all the required sections.
Before opening a bug report, please search our [issue
tracker](https://github.com/polybar/polybar/issues?q=is%3Aissue) and [known
issues page](https://github.com/polybar/polybar/wiki/Known-Issues) for your
problem to avoid duplicates.
If your issue has already been reported but is already marked as fixed and the
version of polybar you are using includes this supposed fix, feel free to open a
new issue.
You should also go through our [debugging
guide](https://github.com/polybar/polybar/wiki/Debugging-your-Config) to confirm
what you are experiencing is indeed a polybar bug and not an issue with your
configuration.
This will also help you narrow down the issue which, in turn, will help us
resolve it, if it turns out to be a bug in polybar.
If this bug was not present in a previous version of polybar and you know how
to, doing a `git bisect` and providing us with the commit ID that introduced the
issue would be immensely helpful.
## Pull Requests
If you want to start contributing to polybar, a good place to start are issues
labeled with
[help wanted](https://github.com/polybar/polybar/labels/help%20wanted)
or
[good first issue](https://github.com/polybar/polybar/labels/good%20first%20issue).
Except for small changes, PRs should always address an already open and accepted
issue.
Otherwise you run the risk of spending time implementing something and then the
PR being rejected because the feature you implemented was not actually something
we want in polybar.
Issues with any of the following labels are generally safe to start working on,
unless they also have the `needs confirmation` label or someone else has
already claimed them:
* [bug](https://github.com/polybar/polybar/labels/bug)
* [confirmed](https://github.com/polybar/polybar/labels/confirmed)
* [good first issue](https://github.com/polybar/polybar/labels/good%20first%20issue)
* [help wanted](https://github.com/polybar/polybar/labels/help%20wanted)
* [hacktoberfest](https://github.com/polybar/polybar/labels/Hacktoberfest) (can also be worked on outside of October :wink:)
For anything else, it's a good idea to first comment under the issue to ask
whether it is something that can/should be worked on right now.
This is especially true for issues labeled with `feature` (and none of the
labels listed above), here a feature may depend on some other things being
implemented first or it may need to be split into many smaller features, because
it is too big otherwise.
In particular, this means that you should not open a feature request and
immediately start working on that feature, unless you are very sure it will be
accepted or accept the risk of it being rejected.
Things like documentation changes or refactorings, don't necessarily need an
issue associated with them.
These changes are less likely to be rejected since they don't change the
behavior of polybar.
Nevertheless, for bigger changes or when in doubt, open an issue and ask whether
such changes would be desirable.
To claim an issue, comment under it to let others know that you are working on
it.
Feel free to ask for feedback about your changes at any time.
Especially when implementing features, this can be very useful because it allows
us to make sure you are going in the direction we had envisioned for that
feature and you don't lose time on something that ultimately has to be
rewritten.
In that case, a [draft PR](https://github.blog/2019-02-14-introducing-draft-pull-requests/)
is a useful tool.
When creating a PR, please fill out the PR template.
### Testing
Your PR must pass all existing tests.
If possible, you should also add tests for the things you write.
However, this is not always possible, for example when working on modules.
But at least isolated components should be tested.
See the [testing
page](https://polybar.readthedocs.io/en/latest/dev/testing.html) in the
documentation.
Also don't hesitate to ask for help, testing isn't that mature in polybar yet
and some things may be harder/impossible to test right now.
### Changelog
We use the [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) format for
keeping track of changes in a release.
If your PR introduces notable changes to polybar, please add them the correct
subsection in the `Unreleased` section in the `CHANGELOG.md` file at the root
of this repository.
Notable changes are any user-visible changes, like bug fixes, new config
options, changes to the build, etc., but not, for example, code cleanup that
doesn't change polybar's behavior or minor documentation changes.
One thing that also should not be added to the changelog are bugfixes for
unreleased features.
An entry in the changelog should include a link to the issue(s) that the PR
addresses, to the PR itself, and to your username:
```
- A short description of the change
([`#XYZ`](https://github.com/polybar/polybar/issues/XYZ),
[`#UVW`](https://github.com/polybar/polybar/pull/UVW))
by [@yourname](https://github.com/yourname).
```
You will first need to open the PR before you can link to it though :wink:.
If you are unsure whether something is a notable change, just add it to the
changelog and we can determine whether it is a notable change when reviewing.
### Documentation
Right now, documentation for polybar lives in two places: The GitHub wiki and
the git repo itself.
Ultimately, most of the documentation is supposed to live in the repo itself.
For now, if your PR requires documentation changes in the repo, those changes
need to be in the PR as well.
Changes on the wiki should not be made right away because the wiki should
reflect the currently released version and not the development version.
In that case, outline the documentation changes that need to be made (for
example, which new config options are available).
If your PR would introduce a lot of new documentation on the wiki, let us know
and we can decide if we want to put some of the documentation directly into the
repo.
### Style
Please read our [style
guide](https://polybar.readthedocs.io/en/latest/dev/style-guide.html).
## Donations
Donations support the sustained development of polybar.
We accept donations through [our open collective page](
https://opencollective.com/polybar).
This can be either a one time or a recurring donation.
Our [blog post](https://polybar.github.io/2020/12/21/Polybar-Funding.html) lays
out the why and how behind our decision to accept donations.

287
README.md
View File

@@ -1,42 +1,61 @@
# Lemonbuddy
[![Build Status](https://travis-ci.org/jaagr/lemonbuddy.svg?branch=master)](https://travis-ci.org/jaagr/lemonbuddy)
[![MIT License](https://img.shields.io/github/license/mashape/apistatus.svg?maxAge=2592000?style=plastic)](https://github.com/jaagr/lemonbuddy/blob/master/LICENSE)
<p align="center">
<img src="doc/_static/banner.png#gh-light-mode-only" alt="Polybar">
<img src="doc/_static/banner-dark-mode.png#gh-dark-mode-only" alt="Polybar">
</p>
<p align="center">
A fast and easy-to-use tool for creating status bars.
</p>
**Lemonbuddy** aims to help users build beautiful and highly customizable status bars
<p align="center">
<a href="https://github.com/polybar/polybar/releases"><img src="https://img.shields.io/github/release/polybar/polybar.svg"></a>
<a href="https://github.com/polybar/polybar/releases"><img alt="GitHub All Releases" src="https://img.shields.io/github/downloads/polybar/polybar/total" /></a>
<a href="https://github.com/polybar/polybar/actions?query=workflow%3ACI"><img src="https://github.com/polybar/polybar/workflows/CI/badge.svg"></a>
<a href="https://github.com/polybar/polybar/actions?query=workflow%3A%22Release+Workflow%22"><img src="https://github.com/polybar/polybar/workflows/Release%20Workflow/badge.svg"></a>
<a href="https://polybar.readthedocs.io"><img src="https://readthedocs.org/projects/polybar/badge/?version=latest"></a>
<a href="https://gitter.im/polybar/polybar"><img src="https://badges.gitter.im/polybar/polybar.svg"></a>
<a href="https://codecov.io/gh/polybar/polybar/branch/master"><img src="https://codecov.io/gh/polybar/polybar/branch/master/graph/badge.svg"></a>
<a href="https://github.com/polybar/polybar/blob/master/LICENSE"><img src="https://img.shields.io/github/license/polybar/polybar.svg"></a>
<a href="https://www.codetriage.com/polybar/polybar"><img src="https://www.codetriage.com/polybar/polybar/badges/users.svg"></a>
<a href="https://opencollective.com/polybar"><img src="https://opencollective.com/polybar/tiers/badge.svg"></a>
</p>
**[Documentation](https://github.com/polybar/polybar/wiki/) | [Installation](#installation) | [Support](SUPPORT.md) | [Donate](#donations)**
**Polybar** aims to help users build beautiful and highly customizable status bars
for their desktop environment, without the need of having a black belt in shell scripting.
Heres a few screenshots showing you what it can look like:
[![sample screenshot](http://i.imgur.com/xvlw9iHt.png)](http://i.imgur.com/xvlw9iH.png)
[![sample screenshot](http://i.imgur.com/cYQOuRrt.png)](http://i.imgur.com/cYQOuRr.png)
[![sample screenshot](http://i.imgur.com/A6spiZZt.png)](http://i.imgur.com/A6spiZZ.png)
[![sample screenshot](http://i.imgur.com/TY5a5r9t.png)](http://i.imgur.com/TY5a5r9.png)
Please note that the project still is in early development, so please report any
problems by [creating an issue ticket](https://github.com/jaagr/lemonbuddy/issues/new).
![default configuration screenshot](doc/_static/default.png)
## Table of Contents
* [Introduction](#introduction)
* [Getting Help](#getting-help)
* [Contributing](#contributing)
* [Getting started](#getting-started)
* [Dependencies](#dependencies)
* [Building from source](#building-from-source)
* [Configuration](#configuration)
* [Running](#running)
* [Installation](#installation)
* [First Steps](#first-steps)
* [Community](#community)
* [Contributors](#contributors)
* [Donations](#donations)
* [Sponsors](#sponsors)
* [Backers](#backers)
* [License](#license)
* [Signatures](#signatures)
## Introduction
The main purpose of **Lemonbuddy** is to help users create awesome status bars.
It has built-in functionality to generate content for the most commonly used widgets, such as:
The main purpose of **Polybar** is to help users create awesome status bars.
It has built-in functionality to display information about the most commonly used services.
Some of the services included so far:
- Systray icons
- Window title
- Playback controls and status display for [MPD](https://www.musicpd.org/) using [libmpdclient](https://www.musicpd.org/libs/libmpdclient/)
- [ALSA](http://www.alsa-project.org/main/index.php/Main_Page) volume controls
- [ALSA](https://www.alsa-project.org/main/index.php/Main_Page) and [PulseAudio](https://www.freedesktop.org/wiki/Software/PulseAudio/) volume controls
- Workspace and desktop panel for [bspwm](https://github.com/baskerville/bspwm) and [i3](https://github.com/i3/i3)
- Workspace module for [EWMH compliant](https://specifications.freedesktop.org/wm-spec/wm-spec-1.3.html#idm140130320786080) window managers
- Keyboard layout and indicator status
- CPU and memory load indicator
- Battery display
- Network connection details
@@ -45,87 +64,177 @@ It has built-in functionality to generate content for the most commonly used wid
- Time-based shell script execution
- Command output tailing
- User-defined menu tree
- Inter-process messaging
- And more...
Each bar contains a set of modules, which in turn defines a set of formatting rules and options.
Read more about [how the configuration works](#configuration).
[See the wiki for more details](https://github.com/polybar/polybar/wiki).
## Getting Help
If you find yourself stuck, have a look at our [Support](SUPPORT.md) page for resources where you can find help.
## Contributing
Read our [contributing guidelines](CONTRIBUTING.md) for how to get started with contributing to polybar.
## Getting started
If you are using **Arch Linux**, you can install the AUR package [lemonbuddy-git](https://aur.archlinux.org/packages/lemonbuddy-git/) to get the latest version, or
[lemonbuddy](https://aur.archlinux.org/packages/lemonbuddy/) for the latest stable release.
### Installation
If you create a package for any other distribution, please consider contributing the template so that we can make the application
available for more people.
<a href="https://repology.org/metapackage/polybar">
<img src="https://repology.org/badge/vertical-allrepos/polybar.svg" alt="Packaging status" align="right">
</a>
Polybar is already available in the package manager for many repositories.
We list some of the more prominent ones here.
Also click the [image on the
right](https://repology.org/project/polybar/versions) to see a more complete
list of available polybar packages.
If you are using **Debian** (bullseye/11/stable) or later, you can install [polybar](https://tracker.debian.org/pkg/polybar)
using `sudo apt install polybar`. Newer releases of polybar are sometimes provided in the [backports](https://wiki.debian.org/Backports)
repository for stable users, you need to enable [backports](https://wiki.debian.org/Backports) and then install using
`sudo apt -t bullseye-backports install polybar`.
If you are using **Ubuntu** 20.10 (Groovy Gorilla) or later, you can install polybar
using `sudo apt install polybar`.
If you are using **Arch Linux**, you can install
[polybar](https://archlinux.org/packages/extra/x86_64/polybar/) to get the
latest stable release using `sudo pacman -S polybar`. The latest unstable
changes are also available in the
[`polybar-git`](https://aur.archlinux.org/packages/polybar-git) package in the
AUR.
If you are using **Manjaro**, you can install [polybar](https://software.manjaro.org/package/polybar) to get the latest stable release using `sudo pacman -S polybar`.
If you are using **Void Linux**, you can install [polybar](https://github.com/void-linux/void-packages/blob/master/srcpkgs/polybar/template) using `xbps-install -S polybar`.
If you are using **NixOS**, polybar is available in both the stable and unstable channels and can be installed with the command `nix-env -iA nixos.polybar`.
If you are using **Slackware**, polybar is available from the [SlackBuilds](https://slackbuilds.org/repository/14.2/desktop/polybar/) repository.
If you are using **Source Mage GNU/Linux**, polybar spell is available in test grimoire and can be installed via `cast polybar`.
If you are using **openSUSE Leap** polybar is available from the
[X11:Utilities](https://build.opensuse.org/package/show/X11:Utilities/polybar) repository or **openSUSE Tumbleweed** `polybar` is available from the official repositories and can be installed via `zypper`.
The package is available for openSUSE Leap 15.5 and above.
If you are using **FreeBSD**, [polybar](https://www.freshports.org/x11/polybar) can be installed using `pkg install polybar`. Make sure you are using the `latest` package branch.
If you are using **Gentoo**, both release and git-master versions are available in the [main](https://packages.gentoo.org/packages/x11-misc/polybar) repository.
If you are using **Fedora**, you can install [polybar](https://src.fedoraproject.org/rpms/polybar) using `sudo dnf install polybar`.
If you can't find your distro here, you will have to [build from source](https://github.com/polybar/polybar/wiki/Compiling).
### First Steps
[See the wiki for details on how to run and configure polybar](https://github.com/polybar/polybar/wiki).
## Community
Want to get in touch?
* Visit our [Discussion page](https://github.com/polybar/polybar/discussions)
* Join our Gitter room at [`gitter.im/polybar/polybar`](https://gitter.im/polybar/polybar)
* We have our own subreddit at [`r/polybar`](https://www.reddit.com/r/polybar)
* Chat with us in the `#polybar` IRC channel on the [`irc.libera.chat:6697`](https://libera.chat/) server
## Contributors
### Maintainers
* Patrick Ziegler [**@patrick96**](https://github.com/patrick96)
### Owner
* Michael Carlberg [**@jaagr**](https://github.com/jaagr/)
### Former Maintainers
* [**@Lomadriel**](https://github.com/Lomadriel)
* [**@NBonaparte**](https://github.com/NBonaparte)
* Chase Geigle [**@skystrife**](https://github.com/skystrife)
### Logo Design by
* [**@Tobaloidee**](https://github.com/Tobaloidee)
### Dependencies
### [All Contributors](https://github.com/polybar/polybar/graphs/contributors)
A compiler with c++14 support. For example [`clang`](http://clang.llvm.org/get_started.html).
## Donations
- cmake
- boost
- xcb-util-wm
- libXft
- python2
Polybar accepts donations through [open collective](https://opencollective.com/polybar).
Optional dependencies for module support:
[Become a backer](https://opencollective.com/polybar) and support polybar!
### Sponsors
- wireless_tools (required for `internal/network` support)
- alsa-lib (required for `internal/volume` support)
- libmpdclient (required for `internal/mpd` support)
<a href="https://opencollective.com/polybar/sponsor/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/0/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/1/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/2/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/3/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/4/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/5/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/6/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/7/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/8/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/9/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/10/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/10/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/11/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/11/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/12/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/12/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/13/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/13/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/14/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/14/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/15/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/15/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/16/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/16/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/17/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/17/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/18/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/18/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/19/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/19/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/20/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/20/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/21/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/21/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/22/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/22/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/23/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/23/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/24/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/24/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/25/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/25/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/26/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/26/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/27/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/27/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/28/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/28/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/sponsor/29/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/sponsor/29/avatar.svg?requireActive=false"></a>
~~~ sh
$ pacman -S cmake python2 boost xcb-util-wm libxft wireless_tools alsa-lib libmpdclient
$ apt-get install cmake cmake-data libboost-dev libfreetype6-dev libxcb1-dev libx11-xcb-dev libxcb-util0-dev libxcb-randr0-dev libxcb-ewmh-dev libxcb-icccm4-dev xcb-proto python-xcbgen i3-wm libiw-dev libasound2-dev libmpdclient-dev
~~~
### Building from source
Please [report any problems](https://github.com/jaagr/lemonbuddy/issues/new) you run into when building the project.
~~~ sh
$ git clone --branch 2.1.2 --recursive https://github.com/jaagr/lemonbuddy
$ mkdir lemonbuddy/build
$ cd lemonbuddy/build
$ cmake -DCMAKE_BUILD_TYPE=Release ..
$ sudo make install
~~~
### Configuration
*Details on how to setup and configure the bar and each module have been moved to [the wiki](https://github.com/jaagr/lemonbuddy/wiki/Configuration).*
Before customizing the bar, make sure everything works as expected by trying
out one of the example configurations installed with the application.
The following code will get you started:
~~~ sh
# Create the config root directory
$ mkdir -p ${XDG_CONFIG_HOME:-$HOME/.config}/lemonbuddy
$ cd ${XDG_CONFIG_HOME:-$HOME/.config}/lemonbuddy
# Copy sample config for the running wm (uses a wm agnostic config as fallback)
$ __wm=$(pgrep -l -x "(bspwm|i3)"); __prefix=$(which lemonbuddy)
$ cp "${__prefix%%/bin*}/share/examples/lemonbuddy/config${__wm:+.${__wm##* }}" config
# Launch the bar
# (where "example" is the name of the bar as defined by [bar/NAME] in the config)
$ lemonbuddy example
~~~
**NOTE:** If the bar output looks odd, it's probably because you're
missing he fonts defined in the config. Update the config or install the
missing fonts.
### Running
See the wiki page on [how to launch the bar when starting your WM](https://github.com/jaagr/lemonbuddy/wiki/Running-the-app).
### Backers
<a href="https://opencollective.com/polybar/backer/0/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/0/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/1/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/1/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/2/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/2/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/3/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/3/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/4/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/4/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/5/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/5/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/6/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/6/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/7/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/7/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/8/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/8/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/9/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/9/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/10/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/10/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/11/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/11/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/12/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/12/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/13/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/13/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/14/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/14/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/15/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/15/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/16/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/16/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/17/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/17/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/18/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/18/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/19/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/19/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/20/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/20/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/21/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/21/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/22/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/22/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/23/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/23/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/24/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/24/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/25/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/25/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/26/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/26/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/27/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/27/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/28/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/28/avatar.svg?requireActive=false"></a>
<a href="https://opencollective.com/polybar/backer/29/website?requireActive=false" target="_blank"><img src="https://opencollective.com/polybar/backer/29/avatar.svg?requireActive=false"></a>
## License
Lemonbuddy is licensed under the MIT license. [See LICENSE for more information](https://github.com/jaagr/lemonbuddy/blob/master/LICENSE).
Polybar is licensed under the MIT license. [See LICENSE for more information](https://github.com/polybar/polybar/blob/master/LICENSE).
## Signatures
Release archives and tags are signed by a maintainer using GPG. Currently
everything is signed by [Patrick Ziegler](https://www.patrickziegler.ch/gpg)
with fingerprint `1D5791352D51A228D4DDDBA4521E5E03AEBCA1A7`

34
SUPPORT.md Normal file
View File

@@ -0,0 +1,34 @@
# Getting Help
If you need help or troubleshooting tips or just have a question:
* If applicable, go through our [debugging guide](https://github.com/polybar/polybar/wiki/Debugging-your-Config).
* Read the [Known Issues page](https://github.com/polybar/polybar/wiki/Known-Issues), maybe others had the same issue before.
* Read the [Wiki page](https://github.com/polybar/polybar/wiki) for the thing you have problems with.
* Ask your question on [GitHub Discussions](https://github.com/polybar/polybar/discussions)
* Join our Gitter room at [`gitter.im/polybar/polybar`](https://gitter.im/polybar/polybar)
* Ask in our reddit community at [`r/polybar`](https://www.reddit.com/r/polybar)
* Join the official IRC channel `#polybar` on the [`irc.libera.chat:6697`](https://libera.chat/) network. This is IRC, you will need to be connected to receive answers.
* Ask on [Unix & Linux StackExchange](https://unix.stackexchange.com/). Though not all questions may be suited over there, make sure you're [on topic](https://unix.stackexchange.com/help/on-topic).
**Do not** use the GitHub issue tracker to ask for help or if you have questions, it is meant for bug reports.
Issues will be closed and you will be referred to the above resources.
## Asking Quality Questions
Spending some time to precisely frame your question will save a lot of time.
You will better understand your problem and may be able to solve it yourself
and other will be able to better understand what you are asking.
Here are some tips:
* Be explicit and precise:
* What are you trying to achieve?
* What problems have you encountered while trying to achieve this?
* What is stopping you from overcoming these problems?
* If a problem is difficult to describe, screenshots can help. Do not make
screenshots of your config file or error messages, copy-paste them as text.
* Provide as much context as possible. In most cases this includes at least the following:
* Window Manager
* Polybar version
* Relevant portions of your config file. If you are not sure what is relevant, provide the whole thing.
* How you start polybar

267
build.sh
View File

@@ -1,37 +1,258 @@
#!/usr/bin/env bash
function msg_err {
printf "\033[41;30m err \033[0m %s\n" "$@"
readonly SELF=${0##*/}
declare -rA COLORS=(
[RED]=$'\033[0;31m'
[GREEN]=$'\033[0;32m'
[BLUE]=$'\033[0;34m'
[PURPLE]=$'\033[0;35m'
[CYAN]=$'\033[0;36m'
[WHITE]=$'\033[0;37m'
[YELLOW]=$'\033[0;33m'
[BOLD]=$'\033[1m'
[OFF]=$'\033[0m'
)
usage() {
echo "
Builds and installs polybar.
${COLORS[GREEN]}${COLORS[BOLD]}Usage:${COLORS[OFF]}
${COLORS[CYAN]}${SELF}${COLORS[OFF]} [options]
${COLORS[GREEN]}${COLORS[BOLD]}Options:${COLORS[OFF]}
${COLORS[GREEN]}-3, --i3${COLORS[OFF]}
Include support for internal/i3 (requires i3); disabled by default.
${COLORS[GREEN]}-a, --alsa${COLORS[OFF]}
Include support for internal/alsa (requires alsalib); disabled by default.
${COLORS[GREEN]}-p, --pulseaudio${COLORS[OFF]}
Include support for internal/pulseaudio (requires libpulse); disabled by default.
${COLORS[GREEN]}-n, --network${COLORS[OFF]}
Include support for internal/network (requires libnl/libiw); disabled by default.
${COLORS[GREEN]}-m, --mpd${COLORS[OFF]}
Include support for internal/mpd (requires libmpdclient); disabled by default.
${COLORS[GREEN]}-c, --curl${COLORS[OFF]}
Include support for internal/github (requires libcurl); disabled by default.
${COLORS[GREEN]}-i, --ipc${COLORS[OFF]}
Build polybar-msg used to send ipc messages; disabled by default.
${COLORS[GREEN]}--all-features${COLORS[OFF]}
Enable all abovementioned features;
equal to -3 -a -p -n -m -c -i
${COLORS[GREEN]}-g, --gcc${COLORS[OFF]}
Use GCC even if Clang is installed; disabled by default.
${COLORS[GREEN]}-j, --jobs${COLORS[OFF]}
Use make -j to use make jobs with $(nproc) jobs; disabled by default.
${COLORS[GREEN]}-f${COLORS[OFF]}
Remove existing build dir; disabled by default.
${COLORS[GREEN]}-I, --no-install${COLORS[OFF]}
Do not execute 'sudo make install'; enabled by default.
${COLORS[GREEN]}-A, --auto${COLORS[OFF]}
Automatic, non-interactive installation; disabled by default.
When set, script defaults options not explicitly set.
${COLORS[GREEN]}-h, --help${COLORS[OFF]}
Displays this help.
"
}
msg_err() {
echo -e "${COLORS[RED]}${COLORS[BOLD]}** ${COLORS[OFF]}$*\n"
exit 1
}
function msg {
printf "\033[36;1m info \033[0m%s\n" "$@"
msg() {
echo -e "${COLORS[GREEN]}${COLORS[BOLD]}** ${COLORS[OFF]}$*\n"
}
function main
{
[[ -d ./build ]] && msg_err "A build directory already exists"
[[ -d ./.git ]] && {
git submodule update --init --recursive || msg_err "Failed to clone submodules"
}
install() {
local p
mkdir ./build || msg_err "Failed to create build dir"
cd ./build || msg_err "Failed to enter build dir"
if [[ "$AUTO" == ON ]]; then
[[ -z "$INSTALL" ]] && INSTALL="ON"
fi
cmake -DCMAKE_INSTALL_PREFIX=/usr .. || \
msg_err "Failed to generate build... read output to get a hint of what went wrong"
if [[ -z "$INSTALL" ]]; then
read -r -p "$(msg "Execute 'sudo make install'? [Y/n] ")" -n 1 p && echo
[[ "${p^^}" != "N" ]] && INSTALL="ON" || INSTALL="OFF"
fi
make || msg_err "Failed to build project"
echo -e "\n"
read -N1 -p "Do you want to execute \"sudo make install\"? [Y/n] " -r choice
echo
if [[ "${choice^^}" == "Y" ]]; then
if [[ "$INSTALL" == ON ]]; then
sudo make install || msg_err "Failed to install executables..."
fi
}
main "$@"
set_build_opts() {
local p
msg "Setting build options"
if [[ "$AUTO" == ON ]]; then
[[ -z "$USE_GCC" ]] && USE_GCC="OFF"
[[ -z "$ENABLE_I3" ]] && ENABLE_I3="OFF"
[[ -z "$ENABLE_ALSA" ]] && ENABLE_ALSA="OFF"
[[ -z "$ENABLE_PULSEAUDIO" ]] && ENABLE_PULSEAUDIO="OFF"
[[ -z "$ENABLE_NETWORK" ]] && ENABLE_NETWORK="OFF"
[[ -z "$ENABLE_MPD" ]] && ENABLE_MPD="OFF"
[[ -z "$ENABLE_CURL" ]] && ENABLE_CURL="OFF"
[[ -z "$ENABLE_IPC_MSG" ]] && ENABLE_IPC_MSG="OFF"
[[ -z "$JOB_COUNT" ]] && JOB_COUNT=1
fi
if [[ -z "$USE_GCC" ]]; then
read -r -p "$(msg "Use GCC even if Clang is installed ----------------------------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && USE_GCC="OFF" || USE_GCC="ON"
fi
if [[ -z "$ENABLE_I3" ]]; then
read -r -p "$(msg "Include support for \"internal/i3\" (requires i3) ---------------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_I3="OFF" || ENABLE_I3="ON"
fi
if [[ -z "$ENABLE_ALSA" ]]; then
read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) --------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_ALSA="OFF" || ENABLE_ALSA="ON"
fi
if [[ -z "$ENABLE_PULSEAUDIO" ]]; then
read -r -p "$(msg "Include support for \"internal/pulseaudio\" (requires libpulse) -- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_PULSEAUDIO="OFF" || ENABLE_PULSEAUDIO="ON"
fi
if [[ -z "$ENABLE_NETWORK" ]]; then
read -r -p "$(msg "Include support for \"internal/network\" (requires libnl/libiw) -- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_NETWORK="OFF" || ENABLE_NETWORK="ON"
fi
if [[ -z "$ENABLE_MPD" ]]; then
read -r -p "$(msg "Include support for \"internal/mpd\" (requires libmpdclient) ----- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_MPD="OFF" || ENABLE_MPD="ON"
fi
if [[ -z "$ENABLE_CURL" ]]; then
read -r -p "$(msg "Include support for \"internal/github\" (requires libcurl) ------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_CURL="OFF" || ENABLE_CURL="ON"
fi
if [[ -z "$ENABLE_IPC_MSG" ]]; then
read -r -p "$(msg "Build \"polybar-msg\" used to send ipc messages ------------------ [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_IPC_MSG="OFF" || ENABLE_IPC_MSG="ON"
fi
if [[ -z "$JOB_COUNT" ]]; then
read -r -p "$(msg "Parallelize the build using make -j$(nproc) --------------------------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && JOB_COUNT=1 || JOB_COUNT=$(nproc)
fi
CXX="c++"
if [[ "$USE_GCC" == OFF ]]; then
if command -v clang++ >/dev/null; then
msg "Using compiler: clang++/clang"
CXX="clang++"
elif command -v g++ >/dev/null; then
msg "Using compiler: g++/gcc"
CXX="g++"
fi
else
CXX="g++"
fi
}
main() {
[[ -d ./.git ]] && {
msg "Fetching submodules"
git submodule update --init --recursive || msg_err "Failed to clone submodules"
}
[[ -d ./build ]] && {
if [[ "$REMOVE_BUILD_DIR" == ON ]]; then
msg "Removing existing build dir (-f)"
rm -rf ./build >/dev/null || msg_err "Failed to remove existing build dir"
else
msg "A build dir already exists (pass -f to replace)"
fi
}
mkdir -p ./build || msg_err "Failed to create build dir"
cd ./build || msg_err "Failed to enter build dir"
set_build_opts
msg "Executing cmake command"
cmake \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DENABLE_ALSA:BOOL="${ENABLE_ALSA}" \
-DENABLE_PULSEAUDIO:BOOL="${ENABLE_PULSEAUDIO}"\
-DENABLE_I3:BOOL="${ENABLE_I3}" \
-DENABLE_MPD:BOOL="${ENABLE_MPD}" \
-DENABLE_NETWORK:BOOL="${ENABLE_NETWORK}" \
-DENABLE_CURL:BOOL="${ENABLE_CURL}" \
-DBUILD_POLYBAR_MSG:BOOL="${ENABLE_IPC_MSG}" \
.. || msg_err "Failed to generate build... read output to get a hint of what went wrong"
msg "Building project"
if [ -z ${JOB_COUNT} ]; then
make || msg_err "Failed to build project"
else
make -j$JOB_COUNT || msg_err "Failed to build project"
fi
install
msg "Build complete!"
exit 0
}
#################
###### Entry
#################
while [[ "$1" == -* ]]; do
case "$1" in
-3|--i3)
ENABLE_I3=ON; shift ;;
-a|--alsa)
ENABLE_ALSA=ON; shift ;;
-p|--pulseaudio)
ENABLE_PULSEAUDIO=ON; shift ;;
-n|--network)
ENABLE_NETWORK=ON; shift ;;
-m|--mpd)
ENABLE_MPD=ON; shift ;;
-c|--curl)
ENABLE_CURL=ON; shift ;;
-i|--ipc)
ENABLE_IPC_MSG=ON; shift ;;
--all-features)
ENABLE_I3=ON
ENABLE_ALSA=ON
ENABLE_PULSEAUDIO=ON
ENABLE_NETWORK=ON
ENABLE_MPD=ON
ENABLE_CURL=ON
ENABLE_IPC_MSG=ON
shift ;;
-g|--gcc)
USE_GCC=ON; shift ;;
-j|--jobs)
JOB_COUNT=$(nproc); shift ;;
-f)
REMOVE_BUILD_DIR=ON; shift ;;
-I|--no-install)
INSTALL=OFF; shift ;;
-A|--auto)
AUTO=ON; shift ;;
-h|--help)
usage
exit 0
;;
--) shift; break ;;
*)
usage
[[ "$1" =~ ^-[0-9a-zA-Z]{2,}$ ]] && msg_err "don't combine options: ie do [-c -i] instead of [-ci]" || msg_err "unknown option [$1]"
;;
esac
done
main

27
bump.sh
View File

@@ -1,27 +0,0 @@
#!/bin/sh
# Use passed argument as new tag
[ $# -eq 1 ] && {
git tag "$@" || exit 1
}
# shellcheck disable=SC2016
tag_prev=$(git tag -l | tail -2 | head -1)
tag_curr=$(git tag -l | tail -1)
./version.sh "$tag_curr"
sed -r "s/${tag_prev}/${tag_curr}/g" -i \
README.md CMakeLists.txt \
contrib/lemonbuddy.aur/PKGBUILD contrib/lemonbuddy.aur/.SRCINFO \
contrib/lemonbuddy-git.aur/PKGBUILD contrib/lemonbuddy-git.aur/.SRCINFO
git add -u README.md CMakeLists.txt \
contrib/lemonbuddy.aur/PKGBUILD contrib/lemonbuddy.aur/.SRCINFO \
contrib/lemonbuddy-git.aur/PKGBUILD contrib/lemonbuddy-git.aur/.SRCINFO \
include/version.hpp
git commit -m "build: Bump version to ${tag_curr}"
# Recreate the tag to include the last commit
[ $# -eq 1 ] && git tag -f "$@"

45
cmake/01-core.cmake Normal file
View File

@@ -0,0 +1,45 @@
#
# Core setup
#
option(DISABLE_ALL "Set this to ON disable all targets. Individual targets can be enabled explicitly." OFF)
# If all targets are disabled, we set the default value for options that are on
# by default to OFF
if (DISABLE_ALL)
set(DEFAULT_ON OFF)
else()
set(DEFAULT_ON ON)
endif()
option(BUILD_POLYBAR "Build the main polybar executable" ${DEFAULT_ON})
option(BUILD_POLYBAR_MSG "Build polybar-msg" ${DEFAULT_ON})
option(BUILD_TESTS "Build testsuite" OFF)
option(BUILD_DOC "Build documentation" ${DEFAULT_ON})
option(BUILD_CONFIG "Generate default configuration" ${DEFAULT_ON})
option(BUILD_SHELL "Generate shell completion files" ${DEFAULT_ON})
include(CMakeDependentOption)
CMAKE_DEPENDENT_OPTION(BUILD_DOC_HTML "Build HTML documentation" ON "BUILD_DOC" OFF)
CMAKE_DEPENDENT_OPTION(BUILD_DOC_MAN "Build manpages" ON "BUILD_DOC" OFF)
if (BUILD_POLYBAR OR BUILD_TESTS OR BUILD_POLYBAR_MSG)
set(BUILD_LIBPOLY ON)
else()
set(BUILD_LIBPOLY OFF)
endif()
if (BUILD_POLYBAR OR BUILD_POLYBAR_MSG OR BUILD_TESTS)
set(HAS_CXX_COMPILATION ON)
else()
set(HAS_CXX_COMPILATION OFF)
endif()
# Export compile commands used for custom targets
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Set default build type if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
message_colored(STATUS "No build type specified; using ${CMAKE_BUILD_TYPE}" 33)
endif()
string(TOUPPER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_UPPER)

24
cmake/02-opts.cmake Normal file
View File

@@ -0,0 +1,24 @@
set(SETTING_ALSA_SOUNDCARD "default"
CACHE STRING "Name of the ALSA soundcard driver")
set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket"
CACHE STRING "Path to bspwm socket")
set(SETTING_BSPWM_STATUS_PREFIX "W"
CACHE STRING "Prefix prepended to the bspwm status line")
set(SETTING_CONNECTION_TEST_IP "8.8.8.8"
CACHE STRING "Address to ping when testing network connection")
set(SETTING_PATH_ADAPTER "/sys/class/power_supply/%adapter%"
CACHE STRING "Path to adapter")
set(SETTING_PATH_BACKLIGHT "/sys/class/backlight/%card%"
CACHE STRING "Path to backlight sysfs folder")
set(SETTING_PATH_BATTERY "/sys/class/power_supply/%battery%"
CACHE STRING "Path to battery")
set(SETTING_PATH_CPU_INFO "/proc/stat"
CACHE STRING "Path to file containing cpu info")
set(SETTING_PATH_MEMORY_INFO "/proc/meminfo"
CACHE STRING "Path to file containing memory info")
set(SETTING_PATH_MESSAGING_FIFO "/tmp/polybar_mqueue.%pid%"
CACHE STRING "Path to file containing the current temperature")
set(SETTING_PATH_TEMPERATURE_INFO "/sys/class/thermal/thermal_zone%zone%/temp"
CACHE STRING "Path to file containing the current temperature")
set(SETTING_PATH_THERMAL_ZONE_WILDCARD "/sys/class/thermal/thermal_zone*"
CACHE STRING "Wildcard path to different thermal zones")

74
cmake/04-targets.cmake Normal file
View File

@@ -0,0 +1,74 @@
#
# Custom targets
#
# Target: uninstall {{{
configure_file(
${PROJECT_SOURCE_DIR}/cmake/templates/uninstall.cmake.in
${PROJECT_BINARY_DIR}/cmake/uninstall.cmake
ESCAPE_QUOTES @ONLY)
add_custom_target(uninstall
COMMAND ${CMAKE_COMMAND} -P ${PROJECT_BINARY_DIR}/cmake/uninstall.cmake)
# }}}
# folders where the clang tools should operate
set(CLANG_SEARCH_PATHS ${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/include ${PROJECT_SOURCE_DIR}/tests)
# Runs clang-format on all source files
add_custom_target(
clangformat
COMMAND ${PROJECT_SOURCE_DIR}/common/file-runner.py
--dirs ${CLANG_SEARCH_PATHS}
-- clang-format -style=file -i --verbose
)
# Dry-runs clang-format on all source files
# Useful for CI since it will exit with an error code
add_custom_target(
clangformat-dryrun
COMMAND ${PROJECT_SOURCE_DIR}/common/file-runner.py
--dirs ${CLANG_SEARCH_PATHS}
-- clang-format -style=file --dry-run -Werror --verbose
)
# Target: codecheck (clang-tidy) {{{
add_custom_target(codecheck)
add_custom_command(TARGET codecheck
COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh
${PROJECT_BINARY_DIR} ${CLANG_SEARCH_PATHS})
# }}}
# Target: codecheck-fix (clang-tidy + clang-format) {{{
add_custom_target(codecheck-fix)
add_custom_command(TARGET codecheck-fix
COMMAND ${PROJECT_SOURCE_DIR}/common/clang-tidy.sh
${PROJECT_BINARY_DIR} -fix ${CLANG_SEARCH_PATHS})
# }}}
# Target: memcheck (valgrind) {{{
add_custom_target(memcheck)
add_custom_command(TARGET memcheck
COMMAND valgrind
--leak-check=summary
--suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
example --config=${PROJECT_SOURCE_DIR}/doc/config)
add_custom_target(memcheck-full)
add_custom_command(TARGET memcheck-full
COMMAND valgrind
--leak-check=full
--track-origins=yes
--track-fds=yes
--suppressions=${PROJECT_SOURCE_DIR}/.valgrind-suppressions
${PROJECT_BINARY_DIR}/${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}
example --config=${PROJECT_SOURCE_DIR}/doc/config)
# }}}

60
cmake/05-summary.cmake Normal file
View File

@@ -0,0 +1,60 @@
#
# Output build summary
#
message(STATUS " Build:")
message_colored(STATUS " Version: ${APP_VERSION}" "32;1")
message_colored(STATUS " Type: ${CMAKE_BUILD_TYPE}" "37;2")
if (HAS_CXX_COMPILATION)
message_colored(STATUS " CXX: ${CMAKE_CXX_COMPILER} ${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}} ${cxx_flags_str}" "37;2")
message_colored(STATUS " LD: ${CMAKE_LINKER} ${CMAKE_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE_UPPER}} ${cxx_linker_flags_str}" "37;2")
endif()
if (BUILD_DOC)
message_colored(STATUS " sphinx-build: ${BIN_SPHINX} ${SPHINX_FLAGS}" "37;2")
endif()
message(STATUS " Install Paths:")
message_colored(STATUS " PREFIX: ${CMAKE_INSTALL_PREFIX}" "32")
message_colored(STATUS " BINDIR: ${CMAKE_INSTALL_FULL_BINDIR}" "32")
message_colored(STATUS " DATADIR: ${CMAKE_INSTALL_FULL_DATADIR}" "32")
message_colored(STATUS " DOCDIR: ${CMAKE_INSTALL_FULL_DOCDIR}" "32")
message_colored(STATUS " MANDIR: ${CMAKE_INSTALL_FULL_MANDIR}" "32")
message_colored(STATUS " SYSCONFDIR: ${CMAKE_INSTALL_FULL_SYSCONFDIR}" "32")
message(STATUS " Targets:")
colored_option(" polybar" BUILD_POLYBAR)
colored_option(" polybar-msg" BUILD_POLYBAR_MSG)
colored_option(" testsuite" BUILD_TESTS)
colored_option(" documentation" BUILD_DOC)
colored_option(" html" BUILD_DOC_HTML)
colored_option(" man" BUILD_DOC_MAN)
colored_option(" default config" BUILD_CONFIG)
colored_option(" shell files" BUILD_SHELL)
if (BUILD_LIBPOLY)
message(STATUS " Module support:")
colored_option(" alsa" ENABLE_ALSA ALSA_VERSION)
colored_option(" curl" ENABLE_CURL CURL_VERSION)
colored_option(" i3" ENABLE_I3)
colored_option(" mpd" ENABLE_MPD MPD_VERSION)
colored_option(" network (${WIRELESS_LIB})" ENABLE_NETWORK NETWORK_LIBRARY_VERSION)
colored_option(" pulseaudio" ENABLE_PULSEAUDIO PULSEAUDIO_VERSION)
colored_option(" xkeyboard" WITH_XKB Xcb_XKB_VERSION)
message(STATUS " X extensions:")
colored_option(" xcb-randr" Xcb_RANDR_FOUND Xcb_RANDR_VERSION)
colored_option(" xcb-randr (monitor support)" WITH_XRANDR_MONITORS Xcb_RANDR_VERSION)
colored_option(" xcb-composite" Xcb_COMPOSITE_FOUND Xcb_COMPOSITE_VERSION)
colored_option(" xcb-xkb" WITH_XKB Xcb_XKB_VERSION)
colored_option(" xcb-xrm" WITH_XRM Xcb_XRM_VERSION)
colored_option(" xcb-cursor" WITH_XCURSOR Xcb_CURSOR_VERSION)
message(STATUS " Log options:")
colored_option(" Trace logging" DEBUG_LOGGER)
if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
message(STATUS " Debug options:")
colored_option(" Trace logging (verbose)" DEBUG_LOGGER_VERBOSE)
colored_option(" Draw clickable areas" DEBUG_HINTS)
colored_option(" Print fc-match details" DEBUG_FONTCONFIG)
endif()
endif()

116
cmake/common/utils.cmake Normal file
View File

@@ -0,0 +1,116 @@
#
# Collection of cmake utility functions
#
# message_colored {{{
function(message_colored message_level text color)
string(ASCII 27 esc)
message(${message_level} "${esc}[${color}m${text}${esc}[0m")
endfunction()
# }}}
# colored_option {{{
function(colored_option text flag)
if(ARGC GREATER 2 AND NOT "${${ARGV2}}" STREQUAL "")
set(text "${text} (${${ARGV2}})")
endif()
if(${flag})
message_colored(STATUS "[X]${text}" "32;1")
else()
message_colored(STATUS "[ ]${text}" "37;2")
endif()
endfunction()
# }}}
# find_package_impl {{{
# Uses PkgConfig to search for pkg_config_name
#
# Defines the following variables:
# ${find_pkg_name}_FOUND - True if the package has been found
# ${find_pkg_name}_INCLUDE_DIR - <...>_INCLUDE_DIRS exported by pkg_check_modules
# ${find_pkg_name}_INCLUDE_DIRS - Same as ${find_pkg_name}_INCLUDE_DIR
# ${find_pkg_name}_LIBRARY - <...>_LIBRARIES exported by pkg_check_modules
# ${find_pkg_name}_LIBRARIES - Same as ${find_pkg_name}_LIBRARY
# ${find_pkg_name}_VERSION - <...>_VERSION exported by pkg_check_modules
#
macro(find_package_impl pkg_config_name find_pkg_name header_to_find)
find_package(PkgConfig REQUIRED)
include(FindPackageHandleStandardArgs)
pkg_check_modules(PC_${find_pkg_name} REQUIRED ${pkg_config_name})
if (NOT ${header_to_find} STREQUAL "")
find_path(PC_${find_pkg_name}_INCLUDE_DIRS_
NAMES "${header_to_find}"
HINTS "${PC_${find_pkg_name}_INCLUDE_DIRS}"
)
set(PC_${find_pkg_name}_INCLUDE_DIRS ${PC_${find_pkg_name}_INCLUDE_DIRS_})
endif()
set(${find_pkg_name}_INCLUDE_DIR ${PC_${find_pkg_name}_INCLUDE_DIRS})
set(${find_pkg_name}_INCLUDE_DIRS ${${find_pkg_name}_INCLUDE_DIR})
set(${find_pkg_name}_LIBRARY ${PC_${find_pkg_name}_LIBRARIES})
set(${find_pkg_name}_VERSION ${PC_${find_pkg_name}_VERSION})
set(${find_pkg_name}_LIBRARIES ${${find_pkg_name}_LIBRARY})
find_package_handle_standard_args(${find_pkg_name}
REQUIRED_VARS
${find_pkg_name}_INCLUDE_DIRS
${find_pkg_name}_LIBRARIES
VERSION_VAR
${find_pkg_name}_VERSION
)
mark_as_advanced(${find_pkg_name}_INCLUDE_DIR ${find_pkg_name}_LIBRARY)
endmacro()
# }}}
# create_imported_target {{{
function(create_imported_target library_name includes libraries)
add_library(${library_name} INTERFACE IMPORTED)
set_target_properties(${library_name} PROPERTIES
INTERFACE_LINK_LIBRARIES "${libraries}"
INTERFACE_INCLUDE_DIRECTORIES "${includes}"
)
endfunction()
# }}}
# checklib {{{
function(checklib flag type pkg)
if(NOT DEFINED ${flag})
if(${type} STREQUAL "cmake")
find_package(${pkg} QUIET)
set(${flag} ${${pkg}_FOUND} CACHE BOOL "")
elseif(${type} STREQUAL "pkg-config")
find_package(PkgConfig REQUIRED)
pkg_check_modules(PKG_${flag} QUIET ${pkg})
set(${flag} ${PKG_${flag}_FOUND} CACHE BOOL "")
elseif(${type} STREQUAL "binary")
find_program(BIN_${flag} ${pkg})
set(${flag} ${BIN_${flag}} CACHE BOOL "")
else()
message(FATAL_ERROR "Invalid lookup type '${type}'")
endif()
mark_as_advanced(${flag})
endif()
endfunction()
function(get_include_dirs output)
get_filename_component(generated_sources_dir ${CMAKE_BINARY_DIR}/generated-sources ABSOLUTE)
get_filename_component(include_dir ${CMAKE_SOURCE_DIR}/include ABSOLUTE)
set(${output} ${include_dir} ${generated_sources_dir} PARENT_SCOPE)
endfunction()
function(get_sources_dirs output)
get_filename_component(src_dir ${CMAKE_SOURCE_DIR}/src ABSOLUTE)
set(${output} ${src_dir} PARENT_SCOPE)
endfunction()
# }}}

108
cmake/cxx.cmake Normal file
View File

@@ -0,0 +1,108 @@
option(ENABLE_CCACHE "Enable ccache support" ON)
if(ENABLE_CCACHE)
find_program(BIN_CCACHE ccache)
mark_as_advanced(BIN_CCACHE)
if(NOT BIN_CCACHE)
message_colored(STATUS "Couldn't locate ccache, disabling ccache..." "33")
else()
# Enable only if the binary is found
message_colored(STATUS "Using compiler cache ${BIN_CCACHE}" "32")
set(CMAKE_CXX_COMPILER_LAUNCHER ${BIN_CCACHE} CACHE STRING "")
endif()
endif()
option(CXXLIB_CLANG "Link against libc++" OFF)
option(CXXLIB_GCC "Link against stdlibc++" OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(POLYBAR_FLAGS "" CACHE STRING "C++ compiler flags used for compiling polybar")
list(APPEND cxx_base -Wall -Wextra -Wpedantic -Wdeprecated-copy-dtor)
list(APPEND cxx_debug -DDEBUG -g2 -Og)
list(APPEND cxx_minsizerel "")
list(APPEND cxx_sanitize ${cxx_debug} -O0 -fsanitize=address -fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls)
list(APPEND cxx_coverage ${cxx_debug} --coverage)
list(APPEND cxx_linker_base "")
list(APPEND cxx_linker_minsizerel "")
# Compiler flags
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag("-Wsuggest-override" HAS_SUGGEST_OVERRIDE)
if (HAS_SUGGEST_OVERRIDE)
list(APPEND cxx_base -Wsuggest-override)
endif()
unset(HAS_SUGGEST_OVERRIDE)
if (CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
# Need dprintf() for FreeBSD 11.1 and older
# libinotify uses c99 extension, so suppress this error
list(APPEND cxx_base -D_WITH_DPRINTF -Wno-c99-extensions)
# Ensures that libraries from dependencies in LOCALBASE are used
list(APPEND cxx_linker_base -L/usr/local/lib)
endif()
# Check compiler
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
list(APPEND cxx_base -Wno-error=parentheses-equality -Wno-zero-length-array)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.4.0")
message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31)
else()
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32)
endif()
elseif(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
list(APPEND cxx_minsizerel -fdata-sections -ffunction-sections -flto)
list(APPEND cxx_linker_minsizerel -Wl,--gc-sections)
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.1.0")
message_colored(FATAL_ERROR "Compiler not supported (Requires clang-3.4+ or gcc-5.1+)" 31)
else()
message_colored(STATUS "Using supported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION}" 32)
endif()
else()
message_colored(WARNING "Using unsupported compiler ${CMAKE_CXX_COMPILER_ID}-${CMAKE_CXX_COMPILER_VERSION} !" 31)
endif()
# Set compiler and linker flags for preferred C++ library
if(CXXLIB_CLANG)
message_colored(STATUS "Linking against libc++" 32)
list(APPEND cxx_base -stdlib=libc++)
list(APPEND cxx_linker_base -lc++ -lc++abi)
elseif(CXXLIB_GCC)
message_colored(STATUS "Linking against libstdc++" 32)
list(APPEND cxx_linker_base -lstdc++)
endif()
SET(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_DEBUG} ${CMAKE_CXX_FLAGS_COVERAGE}")
SET(CMAKE_EXE_LINKER_FLAGS_COVERAGE "${CMAKE_EXE_LINKER_FLAGS_DEBUG} ${CMAKE_EXE_LINKER_FLAGS_COVERAGE}")
SET(CMAKE_SHARED_LINKER_FLAGS_COVERAGE "${CMAKE_SHARED_LINKER_FLAGS_DEBUG} ${CMAKE_SHARED_LINKER_FLAGS_COVERAGE}")
list(APPEND cxx_flags ${cxx_base})
list(APPEND cxx_linker_flags ${cxx_linker_base})
if (CMAKE_BUILD_TYPE_UPPER STREQUAL "DEBUG")
list(APPEND cxx_flags ${cxx_debug})
elseif (CMAKE_BUILD_TYPE_UPPER STREQUAL "MINSIZEREL")
list(APPEND cxx_flags ${cxx_minsizerel})
list(APPEND cxx_linker_flags ${cxx_linker_minsizerel})
elseif (CMAKE_BUILD_TYPE_UPPER STREQUAL "SANITIZE")
list(APPEND cxx_flags ${cxx_sanitize})
elseif (CMAKE_BUILD_TYPE_UPPER STREQUAL "COVERAGE")
list(APPEND cxx_flags ${cxx_coverage})
endif()
string(REPLACE " " ";" polybar_flags_list "${POLYBAR_FLAGS}")
list(APPEND cxx_flags ${polybar_flags_list})
list(APPEND cxx_linker_flags ${cxx_flags})
string(REPLACE ";" " " cxx_flags_str "${cxx_flags}")
string(REPLACE ";" " " cxx_linker_flags_str "${cxx_linker_flags}")
# TODO use target_link_options once min cmake version is >= 3.13
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${cxx_linker_flags_str}")

107
cmake/libpoly.cmake Normal file
View File

@@ -0,0 +1,107 @@
# Sets up options and dependencies for libpoly
# Automatically enable all optional dependencies that are available on the machine
checklib(ENABLE_ALSA "pkg-config" alsa)
checklib(ENABLE_CURL "pkg-config" libcurl)
checklib(ENABLE_I3 "binary" i3)
checklib(ENABLE_MPD "pkg-config" libmpdclient)
checklib(WITH_LIBNL "pkg-config" libnl-genl-3.0)
if(WITH_LIBNL)
checklib(ENABLE_NETWORK "pkg-config" libnl-genl-3.0)
set(WIRELESS_LIB "libnl")
else()
checklib(ENABLE_NETWORK "cmake" Libiw)
set(WIRELESS_LIB "wireless-tools")
endif()
checklib(ENABLE_PULSEAUDIO "pkg-config" libpulse)
checklib(WITH_XKB "pkg-config" xcb-xkb)
checklib(WITH_XRM "pkg-config" xcb-xrm)
checklib(WITH_XRANDR_MONITORS "pkg-config" "xcb-randr>=1.12")
checklib(WITH_XCURSOR "pkg-config" "xcb-cursor")
option(ENABLE_ALSA "Enable alsa support" ON)
option(ENABLE_CURL "Enable curl support" ON)
option(ENABLE_I3 "Enable i3 support" ON)
option(ENABLE_MPD "Enable mpd support" ON)
option(WITH_LIBNL "Use netlink interface for wireless" ON)
option(ENABLE_NETWORK "Enable network support" ON)
option(ENABLE_XKEYBOARD "Enable xkeyboard support" ON)
option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON)
option(WITH_XRANDR_MONITORS "xcb-randr monitor support" ON)
option(WITH_XKB "xcb-xkb support" ON)
option(WITH_XRM "xcb-xrm support" ON)
option(WITH_XCURSOR "xcb-cursor support" ON)
option(DEBUG_LOGGER "Trace logging" ON)
if(CMAKE_BUILD_TYPE_UPPER MATCHES DEBUG)
option(DEBUG_LOGGER_VERBOSE "Trace logging (verbose)" OFF)
option(DEBUG_HINTS "Debug clickable areas" OFF)
option(DEBUG_WHITESPACE "Debug whitespace" OFF)
option(DEBUG_FONTCONFIG "Debug fontconfig" OFF)
endif()
# Load all packages for enabled components
find_package(Threads REQUIRED)
find_package(CairoFC REQUIRED)
find_package(Freetype REQUIRED)
find_package(LibUV 1.3.0 REQUIRED)
if (ENABLE_ALSA)
find_package(ALSA REQUIRED)
endif()
if (ENABLE_CURL)
find_package(CURL REQUIRED)
endif()
if (ENABLE_MPD)
find_package(LibMPDClient REQUIRED)
set(MPD_VERSION ${LibMPDClient_VERSION})
endif()
if (ENABLE_NETWORK)
if(WITH_LIBNL)
find_package(LibNlGenl3 REQUIRED)
set(NETWORK_LIBRARY_VERSION ${LibNlGenl3_VERSION})
else()
find_package(Libiw REQUIRED)
endif()
endif()
if (ENABLE_PULSEAUDIO)
find_package(LibPulse REQUIRED)
set(PULSEAUDIO_VERSION ${LibPulse_VERSION})
endif()
# xcomposite is required
list(APPEND XORG_EXTENSIONS COMPOSITE)
if (WITH_XKB)
list(APPEND XORG_EXTENSIONS XKB)
endif()
if (WITH_XCURSOR)
list(APPEND XORG_EXTENSIONS CURSOR)
endif()
if (WITH_XRM)
list(APPEND XORG_EXTENSIONS XRM)
endif()
# Set min xrandr version required
if (WITH_XRANDR_MONITORS)
set(XRANDR_VERSION "1.12")
else ()
set(XRANDR_VERSION "")
endif()
# Randr is required. Searches for randr only because we may do a version check
find_package(Xcb ${XRANDR_VERSION} REQUIRED COMPONENTS RANDR)
find_package(Xcb REQUIRED COMPONENTS ${XORG_EXTENSIONS})
# FreeBSD Support
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
find_package(LibInotify REQUIRED)
endif()

View File

@@ -0,0 +1,14 @@
# This module defines an imported target `ALSA::ALSA` if alsa is found
#
# Defines the following Variables (see find_package_impl for more info):
# ALSA_FOUND
# ALSA_INCLUDE_DIR
# ALSA_INCLUDE_DIRS
# ALSA_LIBRARY
# ALSA_LIBRARIES
# ALSA_VERSION
find_package_impl("alsa" "ALSA" "alsa/asoundlib.h")
if(ALSA_FOUND AND NOT TARGET ALSA::ALSA)
create_imported_target("ALSA::ALSA" "${ALSA_INCLUDE_DIR}" "${ALSA_LIBRARY}")
endif()

View File

@@ -0,0 +1,14 @@
# This module defines an imported target `CURL::libcurl` if libcurl is found
#
# Defines the following Variables (see find_package_impl for more info):
# CURL_FOUND
# CURL_INCLUDE_DIR
# CURL_INCLUDE_DIRS
# CURL_LIBRARY
# CURL_LIBRARIES
# CURL_VERSION
find_package_impl("libcurl" "CURL" "curl/curl.h")
if(CURL_FOUND AND NOT TARGET CURL::libcurl)
create_imported_target("CURL::libcurl" "${CURL_INCLUDE_DIR}" "${CURL_LIBRARY}")
endif()

View File

@@ -0,0 +1,14 @@
# This module defines an imported target `Cairo::CairoFC` if cairo-fc is found
#
# Defines the following Variables (see find_package_impl for more info):
# CairoFC_FOUND
# CairoFC_INCLUDE_DIR
# CairoFC_INCLUDE_DIRS
# CairoFC_LIBRARY
# CairoFC_LIBRARIES
# CairoFC_VERSION
find_package_impl("cairo-fc" "CairoFC" "")
if(CairoFC_FOUND AND NOT TARGET Cairo::CairoFC)
create_imported_target("Cairo::CairoFC" "${CairoFC_INCLUDE_DIR}" "${CairoFC_LIBRARY}")
endif()

View File

@@ -1,54 +0,0 @@
#
# Find the CppUnit includes and library
#
# This module defines
# CPPUNIT_INCLUDE_DIR, where to find tiff.h, etc.
# CPPUNIT_LIBRARIES, the libraries to link against to use CppUnit.
# CPPUNIT_FOUND, If false, do not try to use CppUnit.
# also defined, but not for general use are
# CPPUNIT_LIBRARY, where to find the CppUnit library.
# CPPUNIT_DEBUG_LIBRARY, where to find the CppUnit library in debug
# mode.
SET(CPPUNIT_FOUND "NO")
FIND_PATH(CPPUNIT_INCLUDE_DIR cppunit/TestCase.h /usr/local/include /usr/include)
# With Win32, important to have both
IF(WIN32)
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunitd
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
ELSE(WIN32)
# On unix system, debug and release have the same name
FIND_LIBRARY(CPPUNIT_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
FIND_LIBRARY(CPPUNIT_DEBUG_LIBRARY cppunit
${CPPUNIT_INCLUDE_DIR}/../lib
/usr/local/lib
/usr/lib)
ENDIF(WIN32)
IF(CPPUNIT_INCLUDE_DIR)
IF(CPPUNIT_LIBRARY)
SET(CPPUNIT_FOUND "YES")
SET(CPPUNIT_LIBRARIES ${CPPUNIT_LIBRARY} ${CMAKE_DL_LIBS})
SET(CPPUNIT_DEBUG_LIBRARIES ${CPPUNIT_DEBUG_LIBRARY} ${CMAKE_DL_LIBS})
ELSE (CPPUNIT_LIBRARY)
IF (CPPUNIT_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could not find library CppUnit.")
ENDIF (CPPUNIT_FIND_REQUIRED)
ENDIF(CPPUNIT_LIBRARY)
ELSE(CPPUNIT_INCLUDE_DIR)
IF (CPPUNIT_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could not find library CppUnit.")
ENDIF(CPPUNIT_FIND_REQUIRED)
ENDIF(CPPUNIT_INCLUDE_DIR)

View File

@@ -0,0 +1,14 @@
# This module defines an imported target `LibInotify::LibInotify` if libinotify is found
#
# Defines the following Variables (see find_package_impl for more info):
# LibInotify_FOUND
# LibInotify_INCLUDE_DIR
# LibInotify_INCLUDE_DIRS
# LibInotify_LIBRARY
# LibInotify_LIBRARIES
# LibInotify_VERSION
find_package_impl("libinotify" "LibInotify" "")
if(LibInotify_FOUND AND NOT TARGET LibInotify::LibInotify)
create_imported_target("LibInotify::LibInotify" "${LibInotify_INCLUDE_DIR}" "${LibInotify_LIBRARY}")
endif()

View File

@@ -1,31 +1,14 @@
# - Try to find LibMPDClient
# Once done, this will define
# This module defines an imported target `LibMPDClient::LibMPDClient` if libmpdclient is found
#
# LIBMPDCLIENT_FOUND - System has LibMPDClient
# LIBMPDCLIENT_INCLUDE_DIRS - The LibMPDClient include directories
# LIBMPDCLIENT_LIBRARIES - The libraries needed to use LibMPDClient
# LIBMPDCLIENT_DEFINITIONS - Compiler switches required for using LibMPDClient
# Defines the following Variables (see find_package_impl for more info):
# LibMPDClient_FOUND
# LibMPDClient_INCLUDE_DIR
# LibMPDClient_INCLUDE_DIRS
# LibMPDClient_LIBRARY
# LibMPDClient_LIBRARIES
# LibMPDClient_VERSION
find_package_impl("libmpdclient" "LibMPDClient" "mpd/player.h")
find_package(PkgConfig)
pkg_check_modules(PC_LIBMPDCLIENT QUIET libmpdclient)
set(LIBMPDCLIENT_DEFINITIONS ${PC_LIBMPDCLIENT_CFLAGS_OTHER})
find_path(LIBMPDCLIENT_INCLUDE_DIR
NAMES mpd/player.h
HINTS ${PC_LIBMPDCLIENT_INCLUDEDIR} ${PC_LIBMPDCLIENT_INCLUDE_DIRS}
)
find_library(LIBMPDCLIENT_LIBRARY
NAMES mpdclient
HINTS ${PC_LIBMPDCLIENT_LIBDIR} ${PC_LIBMPDCLIENT_LIBRARY_DIRS}
)
set(LIBMPDCLIENT_LIBRARIES ${LIBMPDCLIENT_LIBRARY})
set(LIBMPDCLIENT_INCLUDE_DIRS ${LIBMPDCLIENT_INCLUDE_DIR})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibMPDClient DEFAULT_MSG
LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR
)
mark_as_advanced(LIBMPDCLIENT_LIBRARY LIBMPDCLIENT_INCLUDE_DIR)
if(LibMPDClient_FOUND AND NOT TARGET LibMPDClient::LibMPDClient)
create_imported_target("LibMPDClient::LibMPDClient" "${LibMPDClient_INCLUDE_DIR}" "${LibMPDClient_LIBRARY}")
endif()

View File

@@ -0,0 +1,14 @@
# This module defines an imported target `LibNlGenl3::LibNlGenl3` if libnl-genl-3.0 is found
#
# Defines the following Variables (see find_package_impl for more info):
# LibNlGenl3_FOUND
# LibNlGenl3_INCLUDE_DIR
# LibNlGenl3_INCLUDE_DIRS
# LibNlGenl3_LIBRARY
# LibNlGenl3_LIBRARIES
# LibNlGenl3_VERSION
find_package_impl("libnl-genl-3.0" "LibNlGenl3" "")
if(LibNlGenl3_FOUND AND NOT TARGET LibNlGenl3::LibNlGenl3)
create_imported_target("LibNlGenl3::LibNlGenl3" "${LibNlGenl3_INCLUDE_DIR}" "${LibNlGenl3_LIBRARY}")
endif()

View File

@@ -0,0 +1,14 @@
# This module defines an imported target `LibPulse::LibPulse` if libpulse is found
#
# Defines the following Variables (see find_package_impl for more info):
# LibPulse_FOUND
# LibPulse_INCLUDE_DIR
# LibPulse_INCLUDE_DIRS
# LibPulse_LIBRARY
# LibPulse_LIBRARIES
# LibPulse_VERSION
find_package_impl("libpulse" "LibPulse" "pulse/version.h")
if(LibPulse_FOUND AND NOT TARGET LibPulse::LibPulse)
create_imported_target("LibPulse::LibPulse" "${LibPulse_INCLUDE_DIR}" "${LibPulse_LIBRARY}")
endif()

View File

@@ -0,0 +1,13 @@
# This module defines
# LibUV_FOUND
# LibUV_INCLUDE_DIR
# LibUV_INCLUDE_DIRS
# LibUV_LIBRARY
# LibUV_LIBRARIES
# LibUV_VERSION
find_package_impl("libuv" "LibUV" "uv.h")
if(LibUV_FOUND AND NOT TARGET LibUV::LibUV)
create_imported_target("LibUV::LibUV" "${LibUV_INCLUDE_DIR}" "${LibUV_LIBRARY}")
endif()

View File

@@ -6,7 +6,7 @@
find_library(LIBIW_LIBRARY iw)
if(LIBIW_LIBRARY)
set(LIBIW_LIBRARIES ${LIBIW_LIBRARY})
set(LIBIW_LIBRARIES ${LIBIW_LIBRARY})
endif(LIBIW_LIBRARY)
find_path(LIBIW_INCLUDE_DIR NAMES iwlib.h)
@@ -15,3 +15,7 @@ include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Libiw DEFAULT_MSG LIBIW_LIBRARY LIBIW_INCLUDE_DIR)
mark_as_advanced(LIBIW_INCLUDE_DIR LIBIW_LIBRARY)
if(Libiw_FOUND AND NOT TARGET Libiw::Libiw)
create_imported_target("Libiw::Libiw" "${LIBIW_INCLUDE_DIR}" "${LIBIW_LIBRARIES}")
endif()

View File

@@ -1,31 +0,0 @@
# - Try to find libX11-xcb
# Once done this will define
#
# X11_XCB_FOUND - system has libX11-xcb
# X11_XCB_LIBRARIES - Link these to use libX11-xcb
# X11_XCB_INCLUDE_DIR - the libX11-xcb include dir
# X11_XCB_DEFINITIONS - compiler switches required for using libX11-xcb
# Copyright (c) 2011 Fredrik Höglund <fredrik@kde.org>
# Copyright (c) 2008 Helio Chissini de Castro, <helio@kde.org>
# Copyright (c) 2007 Matthias Kretz, <kretz@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
IF (NOT WIN32)
# use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
FIND_PACKAGE(PkgConfig)
PKG_CHECK_MODULES(PKG_X11_XCB QUIET x11-xcb)
SET(X11_XCB_DEFINITIONS ${PKG_X11_XCB_CFLAGS})
FIND_PATH(X11_XCB_INCLUDE_DIR NAMES X11/Xlib-xcb.h HINTS ${PKG_X11_XCB_INCLUDE_DIRS})
FIND_LIBRARY(X11_XCB_LIBRARIES NAMES X11-xcb HINTS ${PKG_X11_XCB_LIBRARY_DIRS})
include(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(X11_XCB DEFAULT_MSG X11_XCB_LIBRARIES X11_XCB_INCLUDE_DIR)
MARK_AS_ADVANCED(X11_XCB_INCLUDE_DIR X11_XCB_LIBRARIES)
ENDIF (NOT WIN32)

View File

@@ -1,244 +0,0 @@
# Try to find XCB on a Unix system
#
# This will define:
#
# XCB_FOUND - True if xcb is available
# XCB_LIBRARIES - Link these to use xcb
# XCB_INCLUDE_DIRS - Include directory for xcb
# XCB_DEFINITIONS - Compiler flags for using xcb
#
# In addition the following more fine grained variables will be defined:
#
# XCB_XCB_FOUND XCB_XCB_INCLUDE_DIR XCB_XCB_LIBRARY
# XCB_UTIL_FOUND XCB_UTIL_INCLUDE_DIR XCB_UTIL_LIBRARY
# XCB_COMPOSITE_FOUND XCB_COMPOSITE_INCLUDE_DIR XCB_COMPOSITE_LIBRARY
# XCB_DAMAGE_FOUND XCB_DAMAGE_INCLUDE_DIR XCB_DAMAGE_LIBRARY
# XCB_XFIXES_FOUND XCB_XFIXES_INCLUDE_DIR XCB_XFIXES_LIBRARY
# XCB_RENDER_FOUND XCB_RENDER_INCLUDE_DIR XCB_RENDER_LIBRARY
# XCB_RANDR_FOUND XCB_RANDR_INCLUDE_DIR XCB_RANDR_LIBRARY
# XCB_SHAPE_FOUND XCB_SHAPE_INCLUDE_DIR XCB_SHAPE_LIBRARY
# XCB_DRI2_FOUND XCB_DRI2_INCLUDE_DIR XCB_DRI2_LIBRARY
# XCB_GLX_FOUND XCB_GLX_INCLUDE_DIR XCB_GLX_LIBRARY
# XCB_SHM_FOUND XCB_SHM_INCLUDE_DIR XCB_SHM_LIBRARY
# XCB_XV_FOUND XCB_XV_INCLUDE_DIR XCB_XV_LIBRARY
# XCB_SYNC_FOUND XCB_SYNC_INCLUDE_DIR XCB_SYNC_LIBRARY
# XCB_XTEST_FOUND XCB_XTEST_INCLUDE_DIR XCB_XTEST_LIBRARY
# XCB_ICCCM_FOUND XCB_ICCCM_INCLUDE_DIR XCB_ICCCM_LIBRARY
# XCB_EWMH_FOUND XCB_EWMH_INCLUDE_DIR XCB_EWMH_LIBRARY
# XCB_IMAGE_FOUND XCB_IMAGE_INCLUDE_DIR XCB_IMAGE_LIBRARY
# XCB_RENDERUTIL_FOUND XCB_RENDERUTIL_INCLUDE_DIR XCB_RENDERUTIL_LIBRARY
# XCB_KEYSYMS_FOUND XCB_KEYSYMS_INCLUDE_DIR XCB_KEYSYMS_LIBRARY
#
# Copyright (c) 2011 Fredrik Höglund <fredrik@kde.org>
# Copyright (c) 2013 Martin Gräßlin <mgraesslin@kde.org>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
set(knownComponents XCB
COMPOSITE
DAMAGE
DRI2
EWMH
GLX
ICCCM
IMAGE
KEYSYMS
RANDR
RENDER
RENDERUTIL
SHAPE
SHM
SYNC
UTIL
XFIXES
XTEST
XV
XINERAMA)
unset(unknownComponents)
set(pkgConfigModules)
set(requiredComponents)
if (XCB_FIND_COMPONENTS)
set(comps ${XCB_FIND_COMPONENTS})
else()
set(comps ${knownComponents})
endif()
# iterate through the list of requested components, and check that we know them all.
# If not, fail.
foreach(comp ${comps})
list(FIND knownComponents ${comp} index )
if("${index}" STREQUAL "-1")
list(APPEND unknownComponents "${comp}")
else()
if("${comp}" STREQUAL "XCB")
list(APPEND pkgConfigModules "xcb")
elseif("${comp}" STREQUAL "COMPOSITE")
list(APPEND pkgConfigModules "xcb-composite")
elseif("${comp}" STREQUAL "DAMAGE")
list(APPEND pkgConfigModules "xcb-damage")
elseif("${comp}" STREQUAL "DRI2")
list(APPEND pkgConfigModules "xcb-dri2")
elseif("${comp}" STREQUAL "EWMH")
list(APPEND pkgConfigModules "xcb-ewmh")
elseif("${comp}" STREQUAL "GLX")
list(APPEND pkgConfigModules "xcb-glx")
elseif("${comp}" STREQUAL "ICCCM")
list(APPEND pkgConfigModules "xcb-icccm")
elseif("${comp}" STREQUAL "IMAGE")
list(APPEND pkgConfigModules "xcb-image")
elseif("${comp}" STREQUAL "KEYSYMS")
list(APPEND pkgConfigModules "xcb-keysyms")
elseif("${comp}" STREQUAL "RANDR")
list(APPEND pkgConfigModules "xcb-randr")
elseif("${comp}" STREQUAL "RENDER")
list(APPEND pkgConfigModules "xcb-render")
elseif("${comp}" STREQUAL "RENDERUTIL")
list(APPEND pkgConfigModules "xcb-renderutil")
elseif("${comp}" STREQUAL "SHAPE")
list(APPEND pkgConfigModules "xcb-shape")
elseif("${comp}" STREQUAL "SHM")
list(APPEND pkgConfigModules "xcb-shm")
elseif("${comp}" STREQUAL "SYNC")
list(APPEND pkgConfigModules "xcb-sync")
elseif("${comp}" STREQUAL "UTIL")
list(APPEND pkgConfigModules "xcb-util")
elseif("${comp}" STREQUAL "XFIXES")
list(APPEND pkgConfigModules "xcb-xfixes")
elseif("${comp}" STREQUAL "XTEST")
list(APPEND pkgConfigModules "xcb-xtest")
elseif("${comp}" STREQUAL "XV")
list(APPEND pkgConfigModules "xcb-xv")
elseif("${comp}" STREQUAL "XINERAMA")
list(APPEND pkgConfigModules "xcb-xinerama")
endif()
endif()
endforeach()
if(DEFINED unknownComponents)
set(msgType STATUS)
if(XCB_FIND_REQUIRED)
set(msgType FATAL_ERROR)
endif()
if(NOT XCB_FIND_QUIETLY)
message(${msgType} "XCB: requested unknown components ${unknownComponents}")
endif()
return()
endif()
macro(_XCB_HANDLE_COMPONENT _comp)
set(_header )
set(_lib )
if("${_comp}" STREQUAL "XCB")
set(_header "xcb/xcb.h")
set(_lib "xcb")
elseif("${_comp}" STREQUAL "COMPOSITE")
set(_header "xcb/composite.h")
set(_lib "xcb-composite")
elseif("${_comp}" STREQUAL "DAMAGE")
set(_header "xcb/damage.h")
set(_lib "xcb-damage")
elseif("${_comp}" STREQUAL "DRI2")
set(_header "xcb/dri2.h")
set(_lib "xcb-dri2")
elseif("${_comp}" STREQUAL "EWMH")
set(_header "xcb/xcb_ewmh.h")
set(_lib "xcb-ewmh")
elseif("${_comp}" STREQUAL "GLX")
set(_header "xcb/glx.h")
set(_lib "xcb-glx")
elseif("${_comp}" STREQUAL "ICCCM")
set(_header "xcb/xcb_icccm.h")
set(_lib "xcb-icccm")
elseif("${_comp}" STREQUAL "IMAGE")
set(_header "xcb/xcb_image.h")
set(_lib "xcb-image")
elseif("${_comp}" STREQUAL "KEYSYMS")
set(_header "xcb/xcb_keysyms.h")
set(_lib "xcb-keysyms")
elseif("${_comp}" STREQUAL "RANDR")
set(_header "xcb/randr.h")
set(_lib "xcb-randr")
elseif("${_comp}" STREQUAL "RENDER")
set(_header "xcb/render.h")
set(_lib "xcb-render")
elseif("${_comp}" STREQUAL "RENDERUTIL")
set(_header "xcb/xcb_renderutil.h")
set(_lib "xcb-render-util")
elseif("${_comp}" STREQUAL "SHAPE")
set(_header "xcb/shape.h")
set(_lib "xcb-shape")
elseif("${_comp}" STREQUAL "SHM")
set(_header "xcb/shm.h")
set(_lib "xcb-shm")
elseif("${_comp}" STREQUAL "SYNC")
set(_header "xcb/sync.h")
set(_lib "xcb-sync")
elseif("${_comp}" STREQUAL "UTIL")
set(_header "xcb/xcb_util.h")
set(_lib "xcb-util")
elseif("${_comp}" STREQUAL "XFIXES")
set(_header "xcb/xfixes.h")
set(_lib "xcb-xfixes")
elseif("${_comp}" STREQUAL "XTEST")
set(_header "xcb/xtest.h")
set(_lib "xcb-xtest")
elseif("${_comp}" STREQUAL "XV")
set(_header "xcb/xv.h")
set(_lib "xcb-xv")
elseif("${_comp}" STREQUAL "XINERAMA")
set(_header "xcb/xinerama.h")
set(_lib "xcb-xinerama")
endif()
find_path(XCB_${_comp}_INCLUDE_DIR NAMES ${_header} HINTS ${PKG_XCB_INCLUDE_DIRS})
find_library(XCB_${_comp}_LIBRARY NAMES ${_lib} HINTS ${PKG_XCB_LIBRARY_DIRS})
if(XCB_${_comp}_INCLUDE_DIR AND XCB_${_comp}_LIBRARY)
list(APPEND XCB_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR})
list(APPEND XCB_LIBRARIES ${XCB_${_comp}_LIBRARY})
if (NOT XCB_FIND_QUIETLY)
message(STATUS "XCB[${_comp}]: Found component ${_comp}")
endif()
endif()
if(XCB_FIND_REQUIRED_${_comp})
list(APPEND requiredComponents XCB_${_comp}_FOUND)
endif()
find_package_handle_standard_args(XCB_${_comp} DEFAULT_MSG XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR)
mark_as_advanced(XCB_${_comp}_LIBRARY XCB_${_comp}_INCLUDE_DIR)
# compatibility for old variable naming
set(XCB_${_comp}_INCLUDE_DIRS ${XCB_${_comp}_INCLUDE_DIR})
set(XCB_${_comp}_LIBRARIES ${XCB_${_comp}_LIBRARY})
endmacro()
IF (NOT WIN32)
include(FindPackageHandleStandardArgs)
# Use pkg-config to get the directories and then use these values
# in the FIND_PATH() and FIND_LIBRARY() calls
find_package(PkgConfig)
pkg_check_modules(PKG_XCB QUIET ${pkgConfigModules})
set(XCB_DEFINITIONS ${PKG_XCB_CFLAGS})
foreach(comp ${comps})
_xcb_handle_component(${comp})
endforeach()
if(XCB_INCLUDE_DIRS)
list(REMOVE_DUPLICATES XCB_INCLUDE_DIRS)
endif()
find_package_handle_standard_args(XCB DEFAULT_MSG XCB_LIBRARIES XCB_INCLUDE_DIRS ${requiredComponents})
# compatibility for old variable naming
set(XCB_INCLUDE_DIR ${XCB_INCLUDE_DIRS})
ENDIF (NOT WIN32)

View File

@@ -0,0 +1,59 @@
# Loads multiple XCB components
# Version checks will be made against all requested components
#
# For each component ${comp} it does the following:
#
# Defines an imported target `Xcb::${comp}` if xcb-${comp} is found
#
# Defines the following Variables (see find_package_impl for more info):
# Xcb_${comp}_FOUND
# Xcb_${comp}_INCLUDE_DIR
# Xcb_${comp}_INCLUDE_DIRS
# Xcb_${comp}_LIBRARY
# Xcb_${comp}_LIBRARIES
# Xcb_${comp}_VERSION
# This script only supports the following components of XCB
set(XCB_known_components
XCB
RANDR
COMPOSITE
XKB
XRM
CURSOR)
# Deducing header from the name of the component
foreach(_comp ${XCB_known_components})
string(TOLOWER "${_comp}" _lc_comp)
set(XCB_${_comp}_pkg_config "xcb-${_lc_comp}")
set(XCB_${_comp}_header "xcb/${_lc_comp}.h")
endforeach()
# Exception cases
set(XCB_XRM_header "xcb/xcb_xrm.h")
set(XCB_CURSOR_header "xcb/xcb_cursor.h")
foreach(_comp ${Xcb_FIND_COMPONENTS})
if (NOT ${_comp} IN_LIST XCB_known_components)
message(FATAL_ERROR "Unknow component \"${_comp}\" of XCB")
endif()
# Forward the different find options set for FindXcb to the individual
# components. This is required because find_package_handle_standard_args in
# find_package_impl uses these variables for version checks and other things.
set(Xcb_${_comp}_FIND_VERSION ${Xcb_FIND_VERSION})
set(Xcb_${_comp}_FIND_QUIETLY ${Xcb_FIND_QUIETLY})
set(Xcb_${_comp}_FIND_REQUIRED ${Xcb_FIND_REQUIRED})
# Bypass developer warning that the first argument to
# find_package_handle_standard_args (Xcb_...) does not match the name of the
# calling package (Xcb)
# https://cmake.org/cmake/help/v3.17/module/FindPackageHandleStandardArgs.html
set(FPHSA_NAME_MISMATCHED TRUE)
find_package_impl(${XCB_${_comp}_pkg_config} "Xcb_${_comp}" "${XCB_${_comp}_header}")
if(Xcb_${_comp}_FOUND AND NOT TARGET Xcb::${_comp})
create_imported_target("Xcb::${_comp}" "${Xcb_${_comp}_INCLUDE_DIRS}" "${Xcb_${_comp}_LIBRARIES}")
elseif(NOT Xcb_${_comp}_FOUND AND Xcb_FIND_REQUIRED)
message(FATAL_ERROR "Xcb: Required component \"${_comp}\" was not found")
endif()
endforeach()

View File

@@ -0,0 +1,23 @@
set(INSTALL_MANIFEST "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
if(NOT EXISTS ${INSTALL_MANIFEST})
message(FATAL_ERROR "Cannot find install manifest: ${INSTALL_MANIFEST}")
endif()
file(READ ${INSTALL_MANIFEST} files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach(file ${files})
message(STATUS "Uninstalling $ENV{DESTDIR}${file}")
if(EXISTS "$ENV{DESTDIR}${file}")
execute_process(COMMAND "@CMAKE_COMMAND@"
-E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}")
endif()
else()
message(STATUS "File $ENV{DESTDIR}${file} does not exist")
endif()
endforeach()

View File

@@ -1,26 +0,0 @@
set(INSTALL_MANIFEST "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
if (NOT EXISTS ${INSTALL_MANIFEST})
message(FATAL_ERROR
"Cannot find install manifest:
\"${INSTALL_MANIFEST}\"")
endif(NOT EXISTS ${INSTALL_MANIFEST})
file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
string(REGEX REPLACE "\n" ";" files "${files}")
list(REVERSE files)
foreach (file ${files})
message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
if (EXISTS "$ENV{DESTDIR}${file}")
execute_process(
COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
OUTPUT_VARIABLE rm_out
RESULT_VARIABLE rm_retval)
if(NOT ${rm_retval} EQUAL 0)
message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
endif (NOT ${rm_retval} EQUAL 0)
else (EXISTS "$ENV{DESTDIR}${file}")
message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
endif (EXISTS "$ENV{DESTDIR}${file}")
endforeach(file)

View File

@@ -1,162 +0,0 @@
#
# Collection of cmake utility functions
#
# message_colored : Outputs a colorized message {{{
function(message_colored message_level text color)
string(ASCII 27 esc)
message(${message_level} "${esc}[${color}m${text}${esc}[0m")
endfunction()
# }}}
# require_binary : Locates binary by name and exports its path to BINPATH_${name} {{{
function(require_binary binary_name)
find_program(BINPATH_${binary_name} ${binary_name})
if(NOT BINPATH_${binary_name})
message_colored(FATAL_ERROR "Failed to locate ${binary_name} binary" 31)
endif()
endfunction()
# }}}
# make_executable : Builds an executable target {{{
function(make_executable target_name)
set(zero_value_args)
set(one_value_args PACKAGE)
set(multi_value_args SOURCES INCLUDE_DIRS PKG_DEPENDS CMAKE_DEPENDS TARGET_DEPENDS RAW_DEPENDS)
cmake_parse_arguments(BIN
"${zero_value_args}" "${one_value_args}"
"${multi_value_args}" ${ARGN})
# add defined INCLUDE_DIRS
include_directories(${BIN_INCLUDE_DIRS})
# add INCLUDE_DIRS for all external dependencies
foreach(DEP ${BIN_TARGET_DEPENDS} ${BIN_PKG_DEPENDS} ${BIN_CMAKE_DEPENDS})
string(TOUPPER ${DEP} DEP)
include_directories(${${DEP}_INCLUDE_DIRS})
include_directories(${${DEP}_INCLUDEDIR})
endforeach()
# create target
add_executable(${target_name} ${BIN_SOURCES})
# set the output file basename the same for static and shared
set_target_properties(${target_name}
PROPERTIES OUTPUT_NAME ${target_name})
# link libraries from pkg-config imports
foreach(DEP ${BIN_PKG_DEPENDS})
string(TOUPPER ${DEP} DEP)
target_link_libraries(${target_name} ${${DEP}_LDFLAGS})
endforeach()
# link libraries from cmake imports
foreach(DEP ${BIN_CMAKE_DEPENDS})
string(TOUPPER ${DEP} DEP)
target_link_libraries(${target_name} ${${DEP}_LIB}
${${DEP}_LIBRARY}
${${DEP}_LIBRARIES})
endforeach()
# link libraries that are build as part of this project
target_link_libraries(${target_name} ${BIN_TARGET_DEPENDS}
${BIN_RAW_DEPENDS})
# install targets
install(TARGETS ${target_name}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endfunction()
# }}}
# make_library : Builds a library target {{{
function(make_library target_name)
set(zero_value_args SHARED STATIC)
set(one_value_args PACKAGE HEADER_INSTALL_DIR)
set(multi_value_args SOURCES HEADERS INCLUDE_DIRS PKG_DEPENDS CMAKE_DEPENDS TARGET_DEPENDS RAW_DEPENDS)
cmake_parse_arguments(LIB
"${zero_value_args}" "${one_value_args}"
"${multi_value_args}" ${ARGN})
# make the header paths absolute
foreach(HEADER ${LIB_HEADERS})
set(LIB_HEADERS_ABS ${LIB_HEADERS_ABS} ${PROJECT_SOURCE_DIR}/include/${HEADER})
endforeach()
# add defined INCLUDE_DIRS
foreach(DIR ${LIB_INCLUDE_DIRS})
string(TOUPPER ${DIR} DIR)
include_directories(${DIR})
include_directories(${${DIR}_INCLUDE_DIRS})
endforeach()
# add INCLUDE_DIRS for all external dependencies
foreach(DEP ${LIB_TARGET_DEPENDS} ${LIB_PKG_DEPENDS} ${LIB_CMAKE_DEPENDS})
string(TOUPPER ${DEP} DEP)
include_directories(${${DEP}_INCLUDE_DIRS} ${${DEP}_INCLUDEDIRS})
endforeach()
if(LIB_SHARED)
list(APPEND library_targets ${target_name}_shared)
endif()
if(LIB_STATIC)
list(APPEND library_targets ${target_name}_static)
endif()
foreach(library_target_name ${library_targets})
message(STATUS "${library_target_name}")
add_library(${library_target_name} ${LIB_HEADERS_ABS} ${LIB_SOURCES})
# link libraries from pkg-config imports
foreach(DEP ${LIB_PKG_DEPENDS})
string(TOUPPER ${DEP} DEP)
target_link_libraries(${library_target_name} ${${DEP}_LDFLAGS})
endforeach()
# link libraries from cmake imports
foreach(DEP ${LIB_CMAKE_DEPENDS})
string(TOUPPER ${DEP} DEP)
target_link_libraries(${library_target_name} ${${DEP}_LIB}
${${DEP}_LIBRARY}
${${DEP}_LIBRARIES})
endforeach()
# link libraries that are build as part of this project
foreach(DEP ${LIB_TARGET_DEPENDS})
string(TOUPPER ${DEP} DEP)
if(LIB_BUILD_SHARED)
target_link_libraries(${library_target_name} ${DEP}_shared)
endif()
if(LIB_BUILD_STATIC)
target_link_libraries(${library_target_name} ${DEP}_static)
endif()
endforeach()
if(${LIB_RAW_DEPENDS})
if(LIB_BUILD_STATIC)
target_link_libraries(${library_target_name} ${LIB_RAW_DEPENDS})
endif()
endif()
# set the output file basename
set_target_properties(${library_target_name} PROPERTIES OUTPUT_NAME ${target_name})
# install headers
install(FILES ${LIBRARY_HEADERS} DESTINATION include/${LIB_HEADERS_ABS})
# install targets
install(TARGETS ${LIBRARY_TARGETS}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
endforeach()
endfunction()
# }}}

45
common/ci/configure.sh Executable file
View File

@@ -0,0 +1,45 @@
#!/usr/bin/env bash
set -eo pipefail
if [ -d "$BUILD_DIR" ]; then
rm -Rf "$BUILD_DIR"
fi
mkdir -p "${BUILD_DIR}"
cd "${BUILD_DIR}"
if [ "$POLYBAR_BUILD_TYPE" != "minimal" ]; then
ENABLE_PULSEAUDIO=ON
ENABLE_NETWORK=ON
ENABLE_MPD=ON
ENABLE_CURL=ON
ENABLE_ALSA=ON
ENABLE_I3=ON
WITH_XRM=ON
WITH_XKB=ON
WITH_XRANDR_MONITORS=ON
WITH_XCURSOR=ON
fi
if [ "$POLYBAR_BUILD_TYPE" = "tests" ]; then
BUILD_TESTS=ON
fi
cmake \
-DCMAKE_CXX_COMPILER="${CXX}" \
-DPOLYBAR_FLAGS="${CXXFLAGS} -Werror" \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" \
-DBUILD_DOC:BOOL=OFF \
-DENABLE_PULSEAUDIO="${ENABLE_PULSEAUDIO:-OFF}" \
-DENABLE_NETWORK="${ENABLE_NETWORK:-OFF}" \
-DENABLE_MPD="${ENABLE_MPD:-OFF}" \
-DENABLE_CURL="${ENABLE_CURL:-OFF}" \
-DENABLE_ALSA="${ENABLE_ALSA:-OFF}" \
-DENABLE_I3="${ENABLE_I3:-OFF}" \
-DWITH_XRM="${WITH_XRM:-OFF}" \
-DWITH_XKB="${WITH_XKB:-OFF}" \
-DWITH_XRANDR_MONITORS="${WITH_XRANDR_MONITORS:-OFF}" \
-DWITH_XCURSOR="${WITH_XCURSOR:-OFF}" \
..

19
common/ci/summary.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -eo pipefail
set -x
"${CXX}" --version
cmake --version
set +x
echo "PATH=${PATH}"
echo "CXX=${CXX}"
echo "CXXFLAGS=${CXXFLAGS}"
echo "LDFLAGS=${LDFLAGS}"
echo "LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
echo "MAKEFLAGS=${MAKEFLAGS}"
echo "POLYBAR_BUILD_TYPE=${POLYBAR_BUILD_TYPE}"
echo "CMAKE_BUILD_TYPE=${BUILD_TYPE}"

26
common/clang-tidy.sh Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/sh
main() {
if [ $# -lt 2 ]; then
echo "$0 build_path [-fix] DIR..." 1>&2
exit 1
fi
args="-p $1"; shift
if [ "$1" = "-fix" ]; then
args="${args} -fix"; shift
fi
# Search paths
search="${*:-.}"
echo "$0 in $search"
# shellcheck disable=2086
find $search -iname "*.cpp" \
-exec printf "\\033[32;1m** \\033[0mProcessing %s\\n" {} \; \
-exec clang-tidy $args {} \;
}
main "$@"

50
common/file-runner.py Executable file
View File

@@ -0,0 +1,50 @@
#!/usr/bin/env python3
from pathlib import Path
import sys
import os
import argparse
import subprocess
EXTENSIONS = set('.' + ext for ext in ['c', 'h', 'cpp', 'hpp', 'inl'])
def get_files(dirs):
"""
Generator which yields all files in the given directories with any of the
EXTENSIONS.
"""
for dir in dirs:
for root, _, files in os.walk(dir):
for file in files:
path = Path(os.path.join(root, file))
if path.suffix in EXTENSIONS:
yield path
def main():
parser = argparse.ArgumentParser(
description="""
Run command on all C/C++ source files in the given directories
""")
parser.add_argument('--dirs', type=Path, nargs='+',
help='Directories to search in')
parser.add_argument('command', nargs='+',
help='Command to which to pass found files')
args = parser.parse_args()
all_files = list(str(file) for file in get_files(args.dirs))
if not all_files:
print("No files found")
sys.exit(1)
result = subprocess.run(args.command + all_files)
print(f'Formatted {len(all_files)} files')
if result.returncode != 0:
sys.exit(result.returncode)
if __name__ == '__main__':
main()

379
config
View File

@@ -1,379 +0,0 @@
;
; this config is written for an unreleased version (lemonbuddy "2.0-beta" branch)
; it might need some tweaking to run on the latest released version... try for yourself
;
[bar/top]
monitor = HDMI-1
width = 100%
height = 27
offset-x = 0
offset-y = 0
background = #ee222222
foreground = #ccfafafa
linecolor = #666
border-bottom = 2
border-bottom-color = #333
spacing = 1
lineheight = 1
padding-left = 0
padding-right = 2
module-margin-left = 1
module-margin-right = 2
font-0 = tamzen:size=9;1
font-1 = unifont:size=6;-1
font-2 = siji:pixelsize=10;0
modules-left = bspwm
modules-center = mpd
modules-right = volume memory cpu date
tray-position = right
wm-restack = bspwm
[bar/bottom]
monitor = HDMI-1
bottom = true
width = 100%
height = ${bar/top.height}
offset-y = 0
background = ${bar/top.background}
foreground = ${bar/top.foreground}
linecolor = ${bar/top.linecolor}
border-top = 2
border-top-color = #333
spacing = ${bar/top.spacing}
lineheight = ${bar/top.lineheight}
padding-right = ${bar/top.padding-right}
module-margin-left = 0
module-margin-right = ${bar/top.module-margin-right}
font-0 = ${bar/top.font-0}
font-1 = ${bar/top.font-1}
font-2 = ${bar/top.font-2}
modules-left = bspwm
modules-right = date powermenu
wm-restack = ${bar/top.wm-restack}
[module/bspwm]
type = internal/bspwm
format = <label-state> <label-mode>
; ws-icon-0 = term;
; ws-icon-1 = web;
; ws-icon-2 = code;
; ws-icon-3 = music;
; ws-icon-4 = irssi;
; ws-icon-default = 
ws-icon-default = x
label-active = o
label-active-background = #ee333333
label-active-underline= #cc333333
label-active-padding = 2
label-occupied = %{O-1}⏺%{O-1}
label-occupied-padding = 2
label-urgent = !
label-urgent-background = #bd2c40
label-urgent-padding = 2
label-empty = x
label-empty-foreground = #444
label-empty-padding = 2
; label-monocle = 
; label-monocle-padding = 2
; label-monocle-background = #171717
; label-monocle-foreground = #e60053
; label-floating = 
; label-floating-padding = 2
; label-floating-background = #171717
; label-floating-foreground = #e60053
[module/cpu]
type = internal/cpu
interval = 2
format = <label> <bar-load>
label = CPU
; ramp-coreload-0 = ▁
; ramp-coreload-0-font = 2
; ramp-coreload-0-foreground = #55aa55
; ramp-coreload-1 = ▂
; ramp-coreload-1-font = 2
; ramp-coreload-1-foreground = #55aa55
; ramp-coreload-2 = ▃
; ramp-coreload-2-font = 2
; ramp-coreload-2-foreground = #55aa55
; ramp-coreload-3 = ▄
; ramp-coreload-3-font = 2
; ramp-coreload-3-foreground = #55aa55
; ramp-coreload-4 = ▅
; ramp-coreload-4-font = 2
; ramp-coreload-4-foreground = #f5a70a
; ramp-coreload-5 = ▆
; ramp-coreload-5-font = 2
; ramp-coreload-5-foreground = #f5a70a
; ramp-coreload-6 = ▇
; ramp-coreload-6-font = 2
; ramp-coreload-6-foreground = #ff5555
; ramp-coreload-7 = █
; ramp-coreload-7-font = 2
; ramp-coreload-7-foreground = #ff5555
bar-load-width = 20
bar-load-foreground-0 = #55aa55
bar-load-foreground-1 = #55aa55
bar-load-foreground-2 = #f5a70a
bar-load-foreground-3 = #ff5555
bar-load-gradient = false
bar-load-indicator = │
bar-load-indicator-font = 2
bar-load-indicator-foreground = #ff
bar-load-fill = ━
bar-load-fill-font = 2
bar-load-empty = ━
bar-load-empty-font = 2
bar-load-empty-foreground = #444444
[module/memory]
type = internal/memory
interval = 2
format = <label> <bar-used>
label = RAM
bar-used-width = 20
bar-used-foreground-0 = #55aa55
bar-used-foreground-1 = #55aa55
bar-used-foreground-2 = #f5a70a
bar-used-foreground-3 = #ff5555
bar-used-gradient = false
bar-used-indicator = │
bar-used-indicator-font = 2
bar-used-indicator-foreground = #ff
bar-used-fill = ━
bar-used-fill-font = 2
bar-used-empty = ━
bar-used-empty-font = 2
bar-used-empty-foreground = #444444
[module/wifi]
type = internal/network
interface = net1
interval = 3.0
;udspeed-minwidth = 3
format-connected = <ramp-signal> <label-connected>
;label-connected = %essid% %{F#66}%local_ip%
;label-connected = %{F#666}%{F#cc} %upspeed% %{F#666}%{F#cc} %downspeed%
label-connected = %{O-6 F#666}%{O2 F#cc}%downspeed%
label-disconnected = %{F#666}%{F#cc} not connected
label-disconnected-foreground = #66
ramp-signal-0 = 
ramp-signal-1 = 
ramp-signal-2 = 
ramp-signal-3 = 
ramp-signal-4 = 
ramp-signal-foreground = #666
[module/wired]
type = internal/network
interface = net0
interval = 3.0
label-connected = %{T3}%local_ip%%{T-}
label-disconnected = %{T3}Not connected%{T-}
label-disconnected-foreground = #66
[module/date]
type = internal/date
date = %%{F#666}%{F#cc} %Y-%m-%d %%{F#e60053}%%{F#cc} %H:%M
date-alt = %%{F#666}%{F#cc} %Y-%m-%d %%{F#e60053}%%{F#cc} %H:%M:%S
interval = 5
[module/backlight]
type = internal/backlight
card = intel_backlight
format = <ramp> <label>
ramp-0 = 
ramp-1 = 
ramp-2 = 
ramp-foreground = #666
[module/volume]
type = internal/volume
speaker-mixer = Speaker
headphone-mixer = Headphone
headphone-id = 9
; format-volume = <ramp-volume> <label-volume>
format-volume = <label-volume> <bar-volume>
label-volume = VOL
label-volume-foreground = ${BAR.foreground}
label-muted = %{F#66} sound muted
;ramp-volume-0 = 
;ramp-volume-1 = 
;ramp-volume-2 = 
;ramp-volume-3 = 
;ramp-volume-foreground = #666
;ramp-headphones-0 = 
;ramp-headphones-1 = 
bar-volume-width = 20
bar-volume-foreground-0 = #55aa55
bar-volume-foreground-1 = #55aa55
bar-volume-foreground-2 = #55aa55
bar-volume-foreground-3 = #55aa55
bar-volume-foreground-4 = #55aa55
bar-volume-foreground-5 = #f5a70a
bar-volume-foreground-6 = #ff5555
bar-volume-gradient = false
bar-volume-indicator = │
bar-volume-indicator-font = 2
bar-volume-indicator-foreground = #ff
bar-volume-fill = ━
bar-volume-fill-font = 2
bar-volume-empty = ━
bar-volume-empty-font = 2
bar-volume-empty-foreground = #444444
[module/battery]
type = internal/battery
full-at = 98
format-charging = <animation-charging> <label-charging>
format-discharging = <ramp-capacity> <label-discharging>
format-full = %{F#666}%{F#cc} <label-full>
ramp-capacity-0 = 
ramp-capacity-1 = 
ramp-capacity-2 = 
ramp-capacity-foreground = #666
animation-charging-0 = 
animation-charging-1 = 
animation-charging-2 = 
animation-charging-foreground = #666
animation-charging-framerate = 750
[module/mpd]
type = internal/mpd
format-online = <label-time> <bar-progress> <label-song> <icon-prev> <icon-seekb> <icon-stop> <toggle> <icon-seekf> <icon-next> <icon-repeat> <icon-random>
format-online-background = #ee333333
format-online-underline = #cc333333
format-online-padding = 3
format-offline = <label-offline>
format-offline-foreground = #66
label-offline = mpd is off
label-song-maxlen = 45
label-song-ellipsis = true
icon-prev = 
icon-seekb = 
icon-stop = 
icon-play = 
icon-pause = 
icon-next = 
icon-seekf = 
; icon-prev = ⏮
; icon-seekb = ⏪
; icon-stop = ⏹
; icon-play = ⏵
; icon-pause = ⏸
; icon-seekf = ⏩
; icon-next = ⏭
icon-random = 
icon-repeat = 
toggle-on-foreground = #e60053
toggle-off-foreground = #66
bar-progress-width = 15
bar-progress-indicator = 
bar-progress-indicator-foreground = #bb
bar-progress-fill = ─
bar-progress-fill-foreground = #bb
bar-progress-fill-font = 3
bar-progress-empty = ─
bar-progress-empty-foreground = #44
bar-progress-empty-font = 3
label-time-foreground = #77
[module/powermenu]
type = custom/menu
label-open = 
label-close = 
label-separator = /
menu-0-0 = Terminate WM
menu-0-0-foreground = #e60053
menu-0-0-exec = bspc quit -1
menu-0-1 = Reboot
menu-0-1-foreground = #e60053
menu-0-1-exec = menu-open-1
menu-0-2 = Power off
menu-0-2-foreground = #e60053
menu-0-2-exec = menu-open-2
menu-1-0 = Cancel
menu-1-0-foreground = #e60053
menu-1-0-exec = menu-open-0
menu-1-1 = Reboot
menu-1-1-foreground = #e60053
menu-1-1-exec = sudo reboot
menu-2-0 = Power off
menu-2-0-foreground = #e60053
menu-2-0-exec = sudo poweroff
menu-2-1 = Cancel
menu-2-1-foreground = #e60053
menu-2-1-exec = menu-open-0
[module/counter]
type = internal/counter
format = <counter>
interval = 0.1
; vim:ft=dosini

View File

@@ -0,0 +1,6 @@
#
# Bash completion template
#
install(FILES polybar
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
COMPONENT tools)

107
contrib/bash/polybar Normal file
View File

@@ -0,0 +1,107 @@
_polybar_default_file() {
local suffix=/polybar/config.ini
local home_path=${XDG_CONFIG_HOME:-$HOME/.config}${suffix}
local etc_xdg_path=${XDG_CONFIG_DIRS:-/etc/xdg}${suffix}
local etc_path=/etc${suffix}
if [ -r "$home_path" ]; then
echo "$home_path"
elif [ -r "$etc_xdg_path" ]; then
echo "$etc_xdg_path"
elif [ -r "$etc_path" ]; then
echo "$etc_path"
fi
}
_polybar_config_file() {
for ((i = 0; i < COMP_CWORD; i++)); do
case ${COMP_WORDS[i]} in
--config)
echo "${COMP_WORDS[i + 2]}"
return
;;
-c)
echo "${COMP_WORDS[i + 1]}"
return
;;
esac
done
_polybar_default_file
}
_polybar_bars() {
local config_file=$(_polybar_config_file)
if [ -r "$config_file" ]; then
sed -nE 's|[[:space:]]*\[bar/([^\]+)\][[:space:]]*$|\1|p' "$config_file"
fi
}
_polybar() {
local options='-h --help
-v --version
-l --log=
-q --quiet
-c --config=
-r --reload
-d --dump=
-m --list-monitors
-M --list-all-monitors
-w --print-wmname
-s --stdout
-p --png='
local log_levels='error
warning
notice
info
trace'
COMPREPLY=()
local cur=${COMP_WORDS[COMP_CWORD]}
case "$cur" in
-*)
COMPREPLY=( $(compgen -W "$options" -- "$cur") )
;;
*)
local prev=${COMP_WORDS[COMP_CWORD - 1]}
if [ "$prev" = "=" ]; then
prev=${COMP_WORDS[COMP_CWORD - 2]}
fi
case "$prev" in
-l|--log)
COMPREPLY=( $(compgen -W "$log_levels" -- "$cur") )
return 0
;;
-c|--config)
COMPREPLY=( $(compgen -f "$cur") )
return 0
;;
-p|--png)
COMPREPLY=( $(compgen -f -X "!*.png" "$cur") )
return 0
;;
-d|--dump)
return 0
;;
*)
COMPREPLY=( $(compgen -W "$options $(_polybar_bars)" -- "$cur") )
;;
esac
esac
for ((i = 0; i < ${#COMPREPLY[@]}; i++)); do
case ${COMPREPLY[i]} in
--*=) ;;
-*) COMPREPLY[i]+=" "
esac
done
return 0
}
complete -o filenames -o noquote -o nospace -F _polybar polybar

View File

@@ -1,25 +0,0 @@
pkgbase = lemonbuddy-git
pkgdesc = A fast and easy-to-use status bar
pkgver = 2.1.2
pkgrel = 1
url = https://github.com/jaagr/lemonbuddy
arch = i686
arch = x86_64
license = MIT
makedepends = cmake
makedepends = python2
makedepends = pkg-config
makedepends = boost
depends = libxft
depends = xcb-util-wm
optdepends = alsa-lib: volume module support
optdepends = libmpdclient: mpd module support
optdepends = wireless_tools: network module support
optdepends = i3ipc-glib-git: i3 module support
provides = lemonbuddy
conflicts = lemonbuddy
source = lemonbuddy::git+https://github.com/jaagr/lemonbuddy.git
md5sums = SKIP
pkgname = lemonbuddy-git

View File

@@ -1,44 +0,0 @@
# Maintainer: Michael Carlberg <c@rlberg.se>
# Contributor: Michael Carlberg <c@rlberg.se>
_pkgname=lemonbuddy
pkgname="${_pkgname}-git"
pkgver=2.1.2
pkgrel=1
pkgdesc="A fast and easy-to-use tool for Lemonbar"
arch=("i686" "x86_64")
url="https://github.com/jaagr/lemonbuddy"
license=("MIT")
depends=("libxft" "xcb-util-wm")
optdepends=("alsa-lib: volume module support"
"libmpdclient: mpd module support"
"wireless_tools: network module support"
"i3ipc-glib-git: i3 module support")
makedepends=("cmake" "python2" "pkg-config" "boost")
provides=("lemonbuddy")
conflicts=("lemonbuddy")
source=("${_pkgname}::git+${url}.git")
md5sums=("SKIP")
pkgver() {
cd "$_pkgname" || exit
git describe --long --tags | sed "s/-/.r/;s/-/./g"
}
prepare() {
cd "$_pkgname" || exit
git submodule update --init --recursive
mkdir build
}
build() {
cd "${_pkgname}/build" || exit
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
make
}
package() {
cd "${_pkgname}/build" || exit
make DESTDIR="$pkgdir/" install
cd .. || exit
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}

View File

@@ -1,24 +0,0 @@
pkgbase = lemonbuddy
pkgdesc = A fast and easy-to-use status bar
pkgver = 2.1.2
pkgrel = 1
url = https://github.com/jaagr/lemonbuddy
arch = i686
arch = x86_64
license = MIT
makedepends = cmake
makedepends = python2
makedepends = pkg-config
makedepends = boost
depends = libxft
depends = xcb-util-wm
optdepends = alsa-lib: volume module support
optdepends = libmpdclient: mpd module support
optdepends = wireless_tools: network module support
optdepends = i3ipc-glib-git: i3 module support
conflicts = lemonbuddy-git
source = lemonbuddy::git+https://github.com/jaagr/lemonbuddy.git#tag=2.1.2
md5sums = SKIP
pkgname = lemonbuddy

View File

@@ -1,37 +0,0 @@
# Maintainer: Michael Carlberg <c@rlberg.se>
# Contributor: Michael Carlberg <c@rlberg.se>
pkgname=lemonbuddy
pkgver=2.1.2
pkgrel=1
pkgdesc="A fast and easy-to-use tool for Lemonbar"
arch=("i686" "x86_64")
url="https://github.com/jaagr/lemonbuddy"
license=("MIT")
depends=("libxft" "xcb-util-wm")
optdepends=("alsa-lib: volume module support"
"libmpdclient: mpd module support"
"wireless_tools: network module support"
"i3ipc-glib-git: i3 module support")
makedepends=("cmake" "python2" "pkg-config" "boost")
conflicts=("lemonbuddy-git")
source=("${pkgname}::git+${url}.git#tag=${pkgver}")
md5sums=("SKIP")
prepare() {
cd "$pkgname" || exit
git submodule update --init --recursive
mkdir build
}
build() {
cd "${pkgname}/build" || exit
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr ..
make
}
package() {
cd "${pkgname}/build" || exit
make DESTDIR="${pkgdir}/" install
cd .. || exit
install -D -m644 LICENSE "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}

View File

@@ -1,48 +0,0 @@
# Template file for 'lemonbuddy'
pkgname=lemonbuddy
version=1.4.4
revision=1
_i3ipcpp_version=0.3.0
_xpp_version=1.0.0
build_style=cmake
configure_args="
-DENABLE_ALSA=$(vopt_if alsa ON OFF)
-DENABLE_I3=$(vopt_if i3 ON OFF)
-DENABLE_MPD=$(vopt_if mpd ON OFF)
-DENABLE_NETWORK=$(vopt_if network ON OFF)"
hostmakedepends="clang pkg-config xcb-proto"
makedepends="libX11-devel libxcb-devel boost-devel
${build_option_alsa:+alsa-lib-devel}
${build_option_i3:+i3-devel i3ipc-glib-devel libsigc++-devel jsoncpp-devel}
${build_option_mpd:+libmpdclient-devel}
${build_option_network:+wireless_tools-devel}"
short_desc="A fast and easy-to-use tool for Lemonbar"
maintainer="Michael Carlberg <c@rlberg.se>"
license="MIT"
homepage="https://github.com/jaagr/lemonbuddy"
distfiles="
https://github.com/jaagr/lemonbuddy/archive/${version}.tar.gz
https://github.com/jaagr/xpp/archive/${_xpp_version}.tar.gz
${build_option_i3:+https://github.com/jaagr/i3ipcpp/archive/v${_i3ipcpp_version}.tar.gz}"
checksum="
09de151bea68bcb3d646e65628b1ce5c3bb89a2a1426bb69996976468e9c13e8
a0f0f7b3f007e6302835fe7dfb7b935df8c4ab8c9f76b30afb652a04199158e9
${build_option_i3:+85b588f957740f89a275b4b2acc27cab78ee2606f5e68e62ce61b9c1278bb366}"
build_options="alsa i3 mpd network"
build_options_default="$build_options"
post_extract() {
[ -d ../i3ipcpp-${_i3ipcpp_version} ] && \
mv ../i3ipcpp-${_i3ipcpp_version}/* lib/i3ipcpp/ || true
[ -d ../xpp-${_xpp_version} ] && \
mv ../xpp-${_xpp_version}/* lib/xpp/ || true
}
pre_build() {
./version.sh ${version}
}
post_install() {
vlicense LICENSE
}

View File

@@ -0,0 +1,42 @@
# Maintainer: Patrick Ziegler <p.ziegler96@gmail.com>
_pkgname=polybar
pkgname="${_pkgname}-git"
pkgver=3.7.2
pkgrel=1
pkgdesc="A fast and easy-to-use status bar"
# aarch64 is not officially supported by polybar, it is only listed here for convenience
arch=("i686" "x86_64" "aarch64")
url="https://github.com/polybar/polybar"
license=("MIT")
depends=("libuv" "cairo" "xcb-util-image" "xcb-util-wm" "xcb-util-xrm"
"xcb-util-cursor" "alsa-lib" "libpulse" "libmpdclient" "libnl"
"jsoncpp" "curl")
optdepends=("i3-wm: i3 module support")
makedepends=("cmake" "git" "python" "pkg-config" "python-sphinx"
"python-packaging" "i3-wm")
backup=("etc/polybar/config.ini")
provides=("polybar")
conflicts=("polybar")
source=("${_pkgname}::git+${url}.git")
sha256sums=("SKIP")
pkgver() {
git -C "${_pkgname}" describe --long --tags | sed "s/-/.r/;s/-/./g"
}
prepare() {
git -C "${_pkgname}" submodule update --init --recursive
mkdir -p "${_pkgname}/build"
}
build() {
cd "${_pkgname}/build" || exit 1
# Force cmake to use system python (to detect xcbgen)
cmake -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE=/usr/bin/python3 ..
cmake --build .
}
package() {
cmake --build "${_pkgname}/build" --target install -- DESTDIR="${pkgdir}"
install -Dm644 "${_pkgname}/LICENSE" "${pkgdir}/usr/share/licenses/${_pkgname}/LICENSE"
}

View File

@@ -0,0 +1,19 @@
"
" Get the filename of the swap file
"
func! ft#cpphpp#GetFilename()
let ext = expand('%:e')
let root = expand('%:p:r')
if (ext == 'cpp')
return fnameescape(substitute(root, '\(src/.*/\)\?src/', '\1include/', '') . '.hpp')
elseif (ext == 'hpp')
return fnameescape(substitute(root, '\(include/.*/\)\?include/', '\1src/', '') . '.cpp')
endif
endfunc
"
" Swap between source/header using given cmd
"
func! ft#cpphpp#Swap(cmd)
execute a:cmd . ' ' . ft#cpphpp#GetFilename()
endfunc

View File

@@ -0,0 +1,8 @@
" Swap between source/header
nnoremap <silent> <leader>af :call ft#cpphpp#Swap('edit')<cr>
nnoremap <silent> <leader>as :call ft#cpphpp#Swap('new')<cr>
nnoremap <silent> <leader>av :call ft#cpphpp#Swap('vnew')<cr>
" Code formatting using clang-format
set formatprg=/usr/bin/clang-format
nmap <f1> :ClangFormat<cr>

View File

@@ -0,0 +1,6 @@
#
# Zsh completion template
#
install(FILES _polybar _polybar_msg
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
COMPONENT tools)

61
contrib/zsh/_polybar Normal file
View File

@@ -0,0 +1,61 @@
#compdef polybar
#
# Completion for polybar (https://github.com/polybar/polybar)
# jaagr <c@rlberg.se>
#
_polybar() {
local L='-l --log'
local Q='-q --quiet'
local C='-c --config'
local R='-r --reload'
local D='-d --dump'
local M='-m --list-monitors'
local MM='-M --list-all-monitors'
local W='-w --print-wmname'
local S='-s --stdout'
_arguments -n : \
'(-)'{-h,--help}'[Display help text and exit]' \
'(-)'{-v,--version}'[Display build details and exit]' \
"($L $Q)"{-l,--log=}'[Set the logging verbosity (default: notice)]:verbosity level:(error warning notice info trace)' \
"($L $Q)"{-q,--quiet}'[Be quiet (will override -l)]' \
"($C)"{-c,--config=}'[Path to the configuration file]:configuration file:_files' \
"($R)"{-r,--reload}'[Reload when the configuration has been modified]' \
"($D $R $M $W $S)"{-d,--dump=}'[Print parameter value in bar section and exit]:parameter name' \
"($MM $M $D $R $W $S)"{-m,--list-monitors}'[Print list of available monitors (Excluding cloned monitors) and exit]' \
"($MM $M $D $R $W $S)"{-M,--list-all-monitors}'[Print list of all available monitors (Including cloned monitors) and exit]' \
"($W $R $D $M $S)"{-w,--print-wmname}'[Print the generated WM_NAME and exit]' \
"($S)"{-s,--stdout}'[Output data to stdout instead of drawing the X window]' \
'::bar name:_polybar_list_names'
}
(( $+functions[_polybar_default_file] )) || _polybar_default_file() {
local suffix=/polybar/config.ini
local home_path=${XDG_CONFIG_HOME:-$HOME/.config}${suffix}
local etc_xdg_path=${XDG_CONFIG_DIRS:-/etc/xdg}${suffix}
local etc_path=/etc${suffix}
if [ -r "$home_path" ]; then
echo "$home_path"
elif [ -r "$etc_xdg_path" ]; then
echo "$etc_xdg_path"
elif [ -r "$etc_path" ]; then
echo "$etc_path"
fi
}
(( $+functions[_polybar_list_names] )) || _polybar_list_names() {
local conf
if (( $+opt_args[-c] )); then
conf=${(e)opt_args[-c]}
elif (( $+opt_args[--config] )); then
conf=${(e)opt_args[--config]}
else
conf=$(_polybar_default_file)
fi
local names; names=(${(f)"$(sed -nE 's|[[:space:]]*\[bar/([^\]+)\][[:space:]]*$|\1|p' ${conf} 2>/dev/null)"})
_describe -t names 'configuration name' names
}
_polybar "$@"

32
contrib/zsh/_polybar_msg Normal file
View File

@@ -0,0 +1,32 @@
#compdef polybar-msg
#
# Completion for polybar-msg (https://github.com/polybar/polybar)
# jaagr <c@rlberg.se>
#
_polybar_msg() {
integer ret=1
_arguments -n : \
'-p[Process id of target instance]:process id:_polybar_msg_pids' \
'(-p)1:message type:(action cmd hook)' \
'*:: :->args'
case $state in
args)
case $words[1] in
hook) _arguments ':module name:' ':hook index:'; ret=0 ;;
action) _arguments ':action payload:'; ret=0 ;;
cmd) _arguments ':command payload:(show hide toggle restart quit)'; ret=0 ;;
esac
;;
esac
return $ret
}
(( $+functions[_polybar_msg_pids] )) || _polybar_msg_pids() {
local pids; pids=(${(f)"$(ls -1 /tmp/polybar_mqueue.* | egrep -o '[0-9]+$')"})
_describe -t pids 'process id of target instance' pids
}
_polybar_msg "$@"

1
doc/.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
build

80
doc/CMakeLists.txt Normal file
View File

@@ -0,0 +1,80 @@
set(SPHINX_BUILD "sphinx-build" CACHE STRING "Name/Path of the sphinx-build executable to use.")
set(SPHINX_FLAGS "" CACHE STRING "Flags to pass to sphinx-build")
find_program(BIN_SPHINX "${SPHINX_BUILD}")
if(NOT BIN_SPHINX)
message(FATAL_ERROR "sphinx-build executable '${SPHINX_BUILD}' not found.")
endif()
separate_arguments(sphinx_flags UNIX_COMMAND "${SPHINX_FLAGS}")
set(doc_path "${CMAKE_CURRENT_SOURCE_DIR}")
# Configures conf.py in the current folder and puts it in the build folder
configure_file(conf.py conf.py @ONLY)
# We want to run `sphinx-build` with the following builders
if (BUILD_DOC_HTML)
list(APPEND doc_builders "html")
endif()
if (BUILD_DOC_MAN)
list(APPEND doc_builders "man")
endif()
# Name of all documentation targets
set(doc_targets "")
foreach(builder ${doc_builders})
set(doc_target "doc_${builder}")
set(builder_log "builder-${builder}.log")
add_custom_target(${doc_target}
COMMAND ${BIN_SPHINX}
-b ${builder}
# conf.py dir
-c "${CMAKE_CURRENT_BINARY_DIR}"
-d "${CMAKE_CURRENT_BINARY_DIR}/doctrees"
-n
${sphinx_flags}
# Documentation source file dir
"${CMAKE_CURRENT_SOURCE_DIR}"
# Output dir
"${CMAKE_CURRENT_BINARY_DIR}/${builder}" > ${builder_log}
COMMENT "sphinx-build ${builder}: see doc/${builder_log}")
list(APPEND doc_targets ${doc_target})
endforeach()
# Dummy target that depends on all documentation targets
add_custom_target(doc ALL DEPENDS ${doc_targets})
if (BUILD_DOC_HTML)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT doc
PATTERN ".buildinfo" EXCLUDE)
endif()
install(FILES ${CMAKE_SOURCE_DIR}/CHANGELOG.md
DESTINATION ${CMAKE_INSTALL_DOCDIR}
COMPONENT doc)
install(FILES ${CMAKE_CURRENT_LIST_DIR}/config.ini
DESTINATION ${CMAKE_INSTALL_DOCDIR}/examples
COMPONENT doc)
if (BUILD_DOC_MAN)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT doc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar-msg.1
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
COMPONENT doc)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/man/polybar.5
DESTINATION ${CMAKE_INSTALL_MANDIR}/man5
COMPONENT doc)
endif()

19
doc/README.md Normal file
View File

@@ -0,0 +1,19 @@
Polybar Manual
==============
The official polybar documentation lives here.
The html documentation and man pages are built automatically when you build with cmake (cmake creates the custom
target `doc`).
## Preview Locally
The documentation uses [Sphinx](https://www.sphinx-doc.org/en/stable/) to generate the documentation, so you will need to
have that installed.
If you build polybar normally while having Sphinx installed during configuration, the documentation will be enabled and
built as well. Building the documentation can be disabled by passing `-DBUILD_DOC=OFF` to `cmake`.
Once configured, all of the documentation can be generated with `make doc` or use `make doc_html` or `make doc_man` to
only generate the html documentation or the man pages respectively.
The HTML documentation is in `doc/html/index.html` in your build directory and the man pages are in `doc/man`.

0
doc/_static/.gitignore vendored Normal file
View File

BIN
doc/_static/banner-dark-mode.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

BIN
doc/_static/banner.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

BIN
doc/_static/default.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

BIN
doc/_static/nerd-fonts/bad.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

BIN
doc/_static/nerd-fonts/good.png vendored Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.1 KiB

26
doc/_templates/layout.html vendored Normal file
View File

@@ -0,0 +1,26 @@
{% extends "!layout.html" -%}
{# Refer to https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html #}
{%- block document %}
{#
Adds a warning message on the 'latest' version.
The warning is only added on readthedocs, if the version is 'latest'.
For the 'dev' folder, no warning is shown since the 'latest' version is
usually the most up-to-date.
#}
{% if READTHEDOCS and polybar_is_latest and not pagename.startswith('dev/') %}
<div class="admonition important">
<p class="admonition-title">Development Version</p>
<p>
This is the <code class="docutils literal notranslate"><span class="pre">latest</span></code>
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of polybar.
</p>
<p>
See the <a href="https://polybar.readthedocs.io/{{ pagename }}.html">stable version</a> of this documentation page instead.
</p>
</div>
{% endif %}
{{ super() }}
{%- endblock %}

354
doc/conf.py Normal file
View File

@@ -0,0 +1,354 @@
# -*- coding: utf-8 -*-
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# https://www.sphinx-doc.org/en/master/config
# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
from pathlib import Path
import datetime
import sphinx
import packaging.version
from sphinx.util.docfields import Field
from sphinx.locale import _
def get_version(root_path):
"""
Reads the polybar version from the version.txt at the root of the repo.
"""
path = Path(root_path) / "version.txt"
with open(path, "r") as f:
for line in f.readlines():
if not line.startswith("#"):
# NB: we can't parse it yet since sphinx could import
# pkg_resources later on and it could patch packaging.version
return line
raise RuntimeError("No version found in {}".format(path))
sphinx_version = packaging.version.parse(sphinx.__version__)
# -- Project information -----------------------------------------------------
project = 'Polybar User Manual'
copyright = '2016-{}, Michael Carlberg & contributors'.format(
datetime.datetime.now().year
)
author = 'Polybar Team'
# is whether we are on readthedocs.io
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
if on_rtd:
# On readthedocs, cmake isn't run so the version string isn't available
version = os.environ.get('READTHEDOCS_VERSION', None)
else:
# The short X.Y version
version = '@APP_VERSION@'
# The full version, including alpha/beta/rc tags
release = version
# Set path to documentation
if on_rtd:
# On readthedocs conf.py is already in the doc folder
doc_path = '.'
else:
# In all other builds conf.py is configured with cmake and put into the
# build folder.
doc_path = '@doc_path@'
# The version from the version.txt file. Since we are not always first
# configured by cmake, we don't necessarily have access to the current version
# number
version_txt = get_version(Path(doc_path).absolute().parent)
# -- General configuration ---------------------------------------------------
# If your documentation needs a minimal Sphinx version, state it here.
#
# needs_sphinx = '1.0'
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
"sphinx.ext.extlinks",
]
if on_rtd:
extensions += [
# The custom 404 page is only needed
"notfound.extension",
# The search extension works only on readthedocs
# See https://readthedocs-sphinx-search.readthedocs.io
"sphinx_search.extension",
]
# Add any paths that contain templates here, relative to this directory.
templates_path = [doc_path + '/_templates']
# The suffix(es) of source filenames.
# You can specify multiple suffix as a list of string:
#
# source_suffix = ['.rst', '.md']
source_suffix = '.rst'
# The master toctree document.
master_doc = 'index'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
# language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []
# The name of the Pygments (syntax highlighting) style to use.
pygments_style = None
highlight_language = 'none'
smartquotes = False
# Quickly link to issues or PRs using :issue:`...` or :pull:`...`
if sphinx_version >= packaging.version.parse("4.0.0"):
extlinks = {
"issue": ("https://github.com/polybar/polybar/issues/%s", "#%s"),
"pull": ("https://github.com/polybar/polybar/pull/%s", "PR #%s"),
}
else:
# Versions before 4.0 (e.g. on readthedocs) do not support %s in the
# caption and simply append the value
extlinks = {
"issue": ("https://github.com/polybar/polybar/issues/%s", "#"),
"pull": ("https://github.com/polybar/polybar/pull/%s", "PR #"),
}
extlinks_detect_hardcoded_links = True
# -- Options for HTML output -------------------------------------------------
# Theme options are theme-specific and customize the look and feel of a theme
# further. For a list of options available for each theme, see the
# documentation.
#
html_theme_options = {}
html_context = {
'polybar_is_latest': version == 'latest',
}
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
if on_rtd or os.environ.get('USE_RTD_THEME', '0') == '1':
html_theme = 'sphinx_rtd_theme'
html_theme_options['collapse_navigation'] = False
html_theme_options['style_external_links'] = True
else:
html_theme = 'alabaster'
html_theme_options['description'] = version
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = [doc_path + '/_static']
# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}
# -- Options for HTMLHelp output ---------------------------------------------
# Output file base name for HTML help builder.
htmlhelp_basename = 'polybardoc'
# -- Options for LaTeX output ------------------------------------------------
latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#
# 'papersize': 'letterpaper',
# The font size ('10pt', '11pt' or '12pt').
#
# 'pointsize': '10pt',
# Additional stuff for the LaTeX preamble.
#
# 'preamble': '',
# Latex figure (float) alignment
#
# 'figure_align': 'htbp',
}
# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title,
# author, documentclass [howto, manual, or own class]).
latex_documents = [
(master_doc, 'polybar.tex', 'polybar Documentation',
'Polybar Team', 'manual'),
]
# -- Options for manual page output ------------------------------------------
# One entry per manual page. List of tuples
# (source start file, name, description, authors, manual section).
man_pages = [
(
'man/polybar.1', 'polybar',
'A fast and easy-to-use tool status bar', [], 1
),
(
'man/polybar-msg.1', 'polybar-msg',
'Send IPC messages to polybar', [], 1
),
(
'man/polybar.5', 'polybar',
'configuration file for polybar(1)', [], 5
)
]
man_make_section_directory = False
# -- Options for Texinfo output ----------------------------------------------
# Grouping the document tree into Texinfo files. List of tuples
# (source start file, target name, title, author,
# dir menu entry, description, category)
texinfo_documents = [
(master_doc, 'polybar', 'polybar Documentation',
author, 'polybar', 'One line description of project.',
'Miscellaneous'),
]
# -- Options for Epub output -------------------------------------------------
# Bibliographic Dublin Core info.
epub_title = project
# The unique identifier of the text. This can be a ISBN number
# or the project homepage.
#
# epub_identifier = ''
# A unique identification for the text.
#
# epub_uid = ''
# A list of files that should not be packed into the epub file.
epub_exclude_files = ['search.html']
# The 'versionadded' and 'versionchanged' directives are overridden.
suppress_warnings = ['app.add_directive']
def setup(app):
# Adds a new directive for document a polybar config setting
# Inside goes the description of the option as well as custom roles to
# document the type, default value, etc:
# .. poly-setting:: NAME
#
# Description
# :type: ...
# :default: ...
app.add_object_type(
'poly-setting',
'poly-setting',
objname='configuration value',
indextemplate='pair: %s; configuration value',
doc_field_types=[
Field('type',
label=_("Type"),
names=['type'],
has_arg=False,
),
Field('tags',
label=_("Available Tags"),
names=['tags'],
has_arg=False,
),
Field('tokens',
label=_("Supported Tokens"),
names=['tokens'],
has_arg=False,
),
Field('default',
label=_("Default Value"),
names=['default'],
has_arg=False,
),
]
)
try:
inject_version_directives(app)
except NameError:
# Function was not defined because sphinx version was too low
pass
# It is not exactly clear in which version the VersionChange class was
# introduced, but we know it is available in at least 1.8.5.
# This feature is mainly needed for the online docs on readthedocs for the docs
# built from master, documentation built for proper releases should not even
# mention unreleased changes. Because of that it's not that important that this
# is added to local builds.
if sphinx_version >= packaging.version.parse("1.8.5"):
from typing import List
from docutils.nodes import Node
from sphinx.domains.changeset import VersionChange
def inject_version_directives(app):
app.add_directive('deprecated', VersionDirective)
app.add_directive('versionadded', VersionDirective)
app.add_directive('versionchanged', VersionDirective)
class VersionDirective(VersionChange):
"""
Overwrites the Sphinx directive for versionchanged, versionadded, and
deprecated and adds an unreleased tag to versions that are not yet
released
"""
def run(self) -> List[Node]:
directive_version = packaging.version.parse(self.arguments[0])
parsed_version_txt = packaging.version.parse(version_txt)
if directive_version > parsed_version_txt:
self.arguments[0] += " (unreleased)"
return super().run()

184
doc/config.ini Normal file
View File

@@ -0,0 +1,184 @@
;==========================================================
;
;
; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗
; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗
; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝
; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗
; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║
; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝
;
;
; To learn more about how to configure Polybar
; go to https://github.com/polybar/polybar
;
; The README contains a lot of information
;
;==========================================================
[colors]
background = #282A2E
background-alt = #373B41
foreground = #C5C8C6
primary = #F0C674
secondary = #8ABEB7
alert = #A54242
disabled = #707880
[bar/example]
width = 100%
height = 24pt
radius = 6
; dpi = 96
background = ${colors.background}
foreground = ${colors.foreground}
line-size = 3pt
border-size = 4pt
border-color = #00000000
padding-left = 0
padding-right = 1
module-margin = 1
separator = |
separator-foreground = ${colors.disabled}
font-0 = monospace;2
modules-left = xworkspaces xwindow
modules-right = filesystem pulseaudio xkeyboard memory cpu wlan eth date
cursor-click = pointer
cursor-scroll = ns-resize
enable-ipc = true
; wm-restack = generic
; wm-restack = bspwm
; wm-restack = i3
; override-redirect = true
; This module is not active by default (to enable it, add it to one of the
; modules-* list above).
; Please note that only a single tray can exist at any time. If you launch
; multiple bars with this module, only a single one will show it, the others
; will produce a warning. Which bar gets the module is timing dependent and can
; be quite random.
; For more information, see the documentation page for this module:
; https://polybar.readthedocs.io/en/stable/user/modules/tray.html
[module/systray]
type = internal/tray
format-margin = 8pt
tray-spacing = 16pt
[module/xworkspaces]
type = internal/xworkspaces
label-active = %name%
label-active-background = ${colors.background-alt}
label-active-underline= ${colors.primary}
label-active-padding = 1
label-occupied = %name%
label-occupied-padding = 1
label-urgent = %name%
label-urgent-background = ${colors.alert}
label-urgent-padding = 1
label-empty = %name%
label-empty-foreground = ${colors.disabled}
label-empty-padding = 1
[module/xwindow]
type = internal/xwindow
label = %title:0:60:...%
[module/filesystem]
type = internal/fs
interval = 25
mount-0 = /
label-mounted = %{F#F0C674}%mountpoint%%{F-} %percentage_used%%
label-unmounted = %mountpoint% not mounted
label-unmounted-foreground = ${colors.disabled}
[module/pulseaudio]
type = internal/pulseaudio
format-volume-prefix = "VOL "
format-volume-prefix-foreground = ${colors.primary}
format-volume = <label-volume>
label-volume = %percentage%%
label-muted = muted
label-muted-foreground = ${colors.disabled}
[module/xkeyboard]
type = internal/xkeyboard
blacklist-0 = num lock
label-layout = %layout%
label-layout-foreground = ${colors.primary}
label-indicator-padding = 2
label-indicator-margin = 1
label-indicator-foreground = ${colors.background}
label-indicator-background = ${colors.secondary}
[module/memory]
type = internal/memory
interval = 2
format-prefix = "RAM "
format-prefix-foreground = ${colors.primary}
label = %percentage_used:2%%
[module/cpu]
type = internal/cpu
interval = 2
format-prefix = "CPU "
format-prefix-foreground = ${colors.primary}
label = %percentage:2%%
[network-base]
type = internal/network
interval = 5
format-connected = <label-connected>
format-disconnected = <label-disconnected>
label-disconnected = %{F#F0C674}%ifname%%{F#707880} disconnected
[module/wlan]
inherit = network-base
interface-type = wireless
label-connected = %{F#F0C674}%ifname%%{F-} %essid% %local_ip%
[module/eth]
inherit = network-base
interface-type = wired
label-connected = %{F#F0C674}%ifname%%{F-} %local_ip%
[module/date]
type = internal/date
interval = 1
date = %H:%M
date-alt = %Y-%m-%d %H:%M:%S
label = %date%
label-foreground = ${colors.primary}
[settings]
screenchange-reload = true
pseudo-transparency = true
; vim:ft=dosini

View File

@@ -0,0 +1,41 @@
Getting Started
===============
Setting up polybar for development is basically the same process as `compiling
it from source <https://github.com/polybar/polybar/wiki/Compiling>`_.
However, we recommend using the ``Debug`` or ``Sanitize`` cmake build type when
configuring the project:
.. code-block:: shell
cmake -DCMAKE_BUILD_TYPE=Debug ..
# Or
cmake -DCMAKE_BUILD_TYPE=Sanitize ..
This will give you debug symbols in the executable and the ``Sanitize`` build
type will also enable the ``AddressSanitizer`` and
``UndefinedBehaviorSanitizer``, which can give you very useful information
about crashes and undefined behavior at runtime.
Editors
-------
Since this is a cmake project, most IDEs will have built-in support or a plugin
to automatically setup this project.
In addition, the ``cmake`` command creates a ``compile_commands.json`` file in
the build folder, which can be used by many `language servers
<https://microsoft.github.io/language-server-protocol/>`_.
If you are using a C++ language server in your editor, it should be as easy as
symlinking the ``compile_commands.json`` into the repo root directory:
.. code-block:: shell
ln -s build/compile_commands.json .
Distro-Specific Setup
---------------------
The wiki contains user-contributed `setup tips
<https://github.com/polybar/polybar/wiki/Distro-Specific-Setup>`_ for some
distros.

87
doc/dev/packaging.rst Normal file
View File

@@ -0,0 +1,87 @@
Packaging Polybar
=================
Do you want to package polybar for a distro? Great! Read this page to get
started.
First Steps
-----------
Before you get started, have a look at the `Packaging Label
<https://github.com/polybar/polybar/issues?q=label%3APackaging>`_ on our GitHub
repo and `Repology <https://repology.org/project/polybar/versions>`_ to see if
polybar is already packaged for that distro or if there are efforts to do so.
Even if a package already exists, it might still make sense for you to package
polybar in some cases. Some of these cases are:
- The existing package is out-of-date and the packager is no longer able/willing
to continue maintaining the package (or they are simply not reachable
anymore).
- The existing package exist in some non-official repository and you are able to
introduce the package into the official package repository for the
distro/package manager. For example if there is a PPA providing polybar for
Ubuntu and you can add polybar to the official Ubuntu repositories, please do
:)
The list above is not exhaustive, if you are unsure, feel free to ask in a new
GitHub issue or on `Gitter <https://gitter.im/polybar>`_. Please also ask if you
run into any polybar related issues while packaging.
Packaging
---------
If you haven't already, carefully read the `Compiling
<https://github.com/polybar/polybar/wiki/Compiling>`_ wiki page to make sure you
fully understand all the dependencies involved and how to build polybar
manually.
We can't really tell you how to create a package for your distro, you need to
figure that out yourself. But we can give you some guidance on building polybar
for a package
Gathering the Source Code
^^^^^^^^^^^^^^^^^^^^^^^^^
Unless you are creating a package that tracks the ``master`` branch, don't clone
the git repository. We provide a tarball with all the required source code on
our `Release Page <https://github.com/polybar/polybar/releases>`_, use that in
your build.
Configuring and Compiling
^^^^^^^^^^^^^^^^^^^^^^^^^
.. note::
Do not use the ``build.sh`` script for building polybar for your package. The
usage and flags of the script may change without notice and we don't consider
that a breaking change.
You can mostly follow the instructions on the `wiki
<https://github.com/polybar/polybar/wiki/Compiling#compiling>`_ for how to
compile polybar, but there are some additional ``cmake`` arguments you might
want to use:
- ``-DCMAKE_BUILD_TYPE=Release``: As of writing this is already the default, but
use it just to be on the safe side.
- ``-DCMAKE_INSTALL_PREFIX=/usr``: Without this all the polybar files will be
installed under ``/usr/local``. However, for packages it is often recommended
they directly install to ``/usr``. So this flag will install polybar to
``/usr/bin/polybar`` instead of ``/usr/local/bin/polybar``. The packaging
guidelines for your distro may disagree with this, in that case be sure to
follow your distro's guidelines.
Instead of ``sudo make install``, you will most likely want to use
``DESTDIR=<dir> make install``. That way the files will be installed into
``<dir>`` instead of your filesystem root.
Finishing Up
------------
Finally, subscribe to our :issue:`GitHub thread for package maintainers <1971>`
to get notified about new releases and changes to how polybar is built.
If you want to, you can also open a PR to add your package to the `Getting
Started <https://github.com/polybar/polybar#getting-started>`_ section of our
README.
Thank you very much for maintaining a polybar package! 🎉

View File

@@ -0,0 +1,273 @@
Release Workflow
================
We try to follow `Semantic Versioning <https://semver.org/>`_ in this project.
Patch releases (e.g. ``3.3.X``) contain only bug fixes. Minor releases (e.g.
``3.X.0``) can have backwards-compatible features. And major releases (
``X.0.0``) can introduce incompatible changes.
.. note::
This document replaces the "`Release Guidelines
<https://github.com/polybar/polybar/wiki/Release-Guidelines>`_" on the wiki
that we used between 3.2.0 and 3.4.3. Starting with 3.5.0, we will follow
the workflow described here to publish releases.
Polybar uses the `OneFlow
<https://www.endoflineblog.com/oneflow-a-git-branching-model-and-workflow>`_
branching model for publishing new releases and introducing hotfixes.
The way we accept code from contributors does not change: Contributors fork
polybar, commit their changes to a new branch and open a PR to get that branch
merged.
After reviewing and approving the changes, a maintainer "merges" the PR.
"Merging" is done in the GitHub UI by either rebasing or squashing the
changes.
Regular merging is disabled because we do not want merge a merge commit for
every PR.
This document is mainly concerned with how to properly release a new version of
polybar.
For that reason this might not be of interest to you, if you are not a
maintainer, but feel free to read on anyway.
Drafting a new Release
----------------------
There a two processes for how to draft a new release. The process for major and
minor versions is the same as they both are "regular" releases.
Patch releases are triggered by bugfixes that cannot wait until the next regular
release and have a slightly different workflow.
Regular Releases (Major, Minor)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Regular releases are created once we find that ``master`` is in a stable state
and that there are enough new features to justify a new release.
A release branch ``release/X.Y.0`` is branched off of a commit on ``master``
that contains all the features we want in the release, this branch is pushed to
the official repository.
For example for version ``3.5.0`` the branch ``release/3.5.0`` would be created:
.. code-block:: shell
git checkout -b release/3.5.0 <commit>
The release branch should typically only exist for at most a few days.
Hotfix Releases (Patch)
~~~~~~~~~~~~~~~~~~~~~~~
A hotfix release is created whenever we receive a fix for a bug that we believe
should be released immediately instead of it only being part of the next regular
release.
Generally any bugfix qualifies, but it is up to the maintainers to decide
whether a hotfix release should be created.
The hotfix release branch ``hotfix/X.Y.Z`` is created by branching off at the
previous release tag (``X.Y.Z-1``).
For example, if the latest version is ``3.5.2``, the next hotfix will be on
branch ``hotfix/3.5.3``:
.. code-block:: shell
git checkout -b hotfix/3.5.3 3.5.2
Since the PRs for such bugfixes are often not created by maintainers, they will
often not be based on the latest release tag, but just be branched off
``master`` because contributors don't necessarily know about this branching
model and also may well not know whether a hotfix will be created for a certain
bugfix.
.. TODO create contributor page that describes where to branch off. And link to
that page.
In case a PR containing a bugfix that is destined for a patch release is not
branched off the previous release, a maintainer creates the proper release
branch and cherry-picks the bugfix commits.
.. note::
Alternatively, the contributor can also ``git rebase --onto`` to base the
branch off the previous release tag. However, in most cases it makes sense for
a maintainer to create the release branch since they will also need to create
a `Release PR`_ for it.
Once the release branch is created and contains the right commits, the
maintainer should follow `Publishing a new Release`_ to finish this patch
release.
If multiple bugfixes are submitted in close succession, they can all be
cherry-picked onto the same patch release branch to not create many individual
release with only a single fix.
The maintainer can also decide to leave the release branch for this patch
release open for a week in order to possibly combine multiple bugfixes into a
single release.
Publishing a new Release
------------------------
The process for publishing a release is the same for all release types. It goes
as follows:
* A `Release PR`_ is created for the release. This PR MUST NOT be merged in
GitHub's interface, it is only here for review, merging happens at the
commandline.
* After approval, a signed git tag without message is created locally at the
tip of the release branch and pushed:
.. code-block:: shell
git tag -m "" -s X.Y.Z <release-branch>
git push --tags
* A `draft release`_ targetting the new tag is created in GitHub's release
publishing tools and published.
* After the tag is created, the release branch is manually merged into
``master``.
Here it is vitally important that the history of the release branch does not
change and so we use ``git merge``. We do it manually because using ``git
merge`` is disabled on PRs.
.. code-block:: shell
git checkout master
git merge <release-branch>
git push origin
* After the tag is created, the release branch can be deleted with ``git push
origin :<release-branch>``.
* Work through the `After-Release Checklist`_.
Here ``<release-branch>`` is either a ``release/X.Y.0`` branch or a
``hotfix/X.Y.Z`` branch.
Release PR
~~~~~~~~~~
The final state of the release branch is prepared as a draft PR on
GitHub.
That PR is not merged from the GitHub interface though.
The release PR must do the following things:
* Write any missing migration guides for:
* Deprecated or removed options
* New features that it might be worth migrating to
* Have a release commit at its tip with the message ``Version X.Y.Z`` and the following changes
* Finalizes the `Changelog`_ for this release
* Updates the version number in ``version.txt``
Changelog
~~~~~~~~~
The ``CHANGELOG.md`` file at the root of the repo should already contain all the
changes for the upcoming release in a format based on
`keep a changelog <https://keepachangelog.com/en/1.0.0/>`_.
For each release those changes should be checked to make sure we did not miss
anything.
For all releases, a new section of the following form should be created below
the ``Unreleased`` section:
.. code-block:: md
## [X.Y.Z] - YYYY-MM-DD
In addition, the reference link for the release should be added and the
reference link for the unreleased section should be updated at the bottom of the
document:
.. code-block:: md
[Unreleased]: https://github.com/polybar/polybar/compare/X.Y.Z...HEAD
[X.Y.Z]: https://github.com/polybar/polybar/releases/tag/X.Y.Z
Since the release tag doesn't exist yet, both of these links will be invalid
until the release is published.
All changes from the ``Unreleased`` section that apply to this release should be
moved into the new release section.
For regular releases this is generally the entire ``Unreleased`` section, while
for patch releases it will only be a few entries.
The contents of the release section can be copied into the draft release in
GitHub's release tool with a heading named ``## Changelog``.
Since major releases generally break backwards compatibility in some way, their
changelog should also prominently feature precisely what breaking changes were
introduced. If suitable, maybe even separate documentation dedicated to the
migration should be written.
Draft Release
~~~~~~~~~~~~~
On `GitHub <https://github.com/polybar/polybar/releases/new>`_ a new release
should be drafted.
The release targets the git tag that was just pushed, the name of the release
and the tag is simply the release number.
The content of the release message should contain the changelog copied from
``CHANGELOG.md`` under the heading ``## Changelog``.
In addition using GitHub's "Auto-generate release notes" feature, the list of
new contributors should be generated and put at the end of the release notes.
The generated list of PRs can be removed.
For minor and major releases, add a link to the migration guide directly under
the ``## Changelog`` header:
.. code-block:: markdown
**[Migration Guide](https://polybar.readthedocs.io/en/stable/migration/X.Y/index.html)**
At the bottom, check the two boxes "Set as the latest release" and "Create a
discussion for this release" (select the category "Announcements").
After-Release Checklist
~~~~~~~~~~~~~~~~~~~~~~~
* Verify the release archive (see `Verify Release`_)
* Update the Wiki
* Make sure all the new functionality is documented
* Mark deprecated features appropriately (see `Deprecations`_)
* Remove all "unreleased" notes (not for patch releases)
* Inform packagers of new release in :issue:`1971`. Mention any dependency
changes and any changes to the build workflow. Also mention any new files are
created by the installation.
* Create a PR that updates the AUR ``PKGBUILD`` file for the ``polybar-git``
package (push after the release archive is uploaded).
* Close the `GitHub Milestone <https://github.com/polybar/polybar/milestones>`_
for the new release and move open issues (if any) to a later release.
* Activate the version on `Read the Docs
<https://readthedocs.org/projects/polybar/versions/>`_ and deactivate all
previous versions for the same minor release (e.g. for 3.5.4, deactivate all
other 3.5.X versions).
Verify Release
~~~~~~~~~~~~~~
Confirm that the release archive was added to the release.
We have a GitHub action workflow called 'Release Workflow' that on every
release automatically creates a release archive, uploads it to the release,
and adds a 'Download' section to the release body.
If this fails for some reason, it should be triggered manually.
Afterwards, download the archive, verify its hash, and sign it:
.. code-block:: shell
gpg --armor --detach-sign polybar-X.Y.Z.tar.gz
Finally, upload the generated ``polybar-X.Y.Z.tar.gz.asc`` to the GitHub
release.
Deprecations
~~~~~~~~~~~~
If any publicly facing part of polybar is being deprecated, it should be marked
as such in the code, through warnings/errors in the log, and by comments in the
wiki. Every deprecated functionality is kept until the next major release and
removed there, unless it has not been deprecated in a minor release before.

75
doc/dev/style-guide.rst Normal file
View File

@@ -0,0 +1,75 @@
Style Guide
===========
There is a ``.editorconfig`` and a ``.clang-format`` file in the project root
that defines some basic guidelines, mainly relating to indentation.
Code Formatting
---------------
We use ``clang-format`` for code formatting, the style rules are defined in
``.clang-format``, before submitting a PR, make sure to run the following command
on all the C++ files you changed:
.. code-block:: shell
clang-format -style=file -i <FILES>
**Note:** Depending on which file you change, this may produce a lot of changes
because we have not run ``clang-format`` on all files in the project. This is
fine.
Indentation
~~~~~~~~~~~
Files use 2 spaces for indentation.
Line Width
~~~~~~~~~~
Lines should not be longer than 120 characters, ``clang-format`` will enforce
this when run. However, try to keep lines under 80 characters if it seems
reasonable in the current situation.
In some cases it makes sense to have lines longer than 80 characters for
readability. But long lines can just the same be unreadable, for example if you
have long if-conditions or use complex expressions as function parameters. Make
sure you only use longer lines if keeping it under 80 would be less readable.
Comments
--------
Use Doxygen ``/** */`` comments in front of functions, methods, types, members and
classes:
.. code-block:: cpp
/**
* @brief Generates a config object from a config file
*
* For modularity the parsing and storing of the config is separated
*/
class config_parser {
...
/**
* @brief Is used to resolve ${root...} references
*/
string m_barname;
...
}
For all other comments use ``//`` for single-line and ``/* */`` for multi-line comments.
Your comments should describe the intent and purpose of your code, not necessarily what it does.
Header Files
------------
Header files should end in ``.hpp``.
We use pragmas instead of include guards to guarantee header files are included
only once:
.. code-block:: cpp
#pragma once

26
doc/dev/testing.rst Normal file
View File

@@ -0,0 +1,26 @@
Testing
=======
Polybar uses `googletest <https://google.github.io/googletest/>`_ as its
testing and mocking framework.
Tests live in the ``tests/`` directory; they can be enabled during cmake with
``-DBUILD_TESTS=ON`` and compiled with ``make all_unit_tests``.
Each test gets its own executable in ``build/tests``, which can be executed to run
a specific test.
Running all tests is preferably done with the following command:
.. code-block:: shell
make check
This runs all available tests and prints the output in color for failed tests
only.
Adding New Tests
----------------
All new tests need to be added to the ``tests/CMakeLists.txt`` file. Have a look
at the other unit tests in ``tests/unit_tests`` to see how to write tests for your
code.

52
doc/index.rst Normal file
View File

@@ -0,0 +1,52 @@
Polybar Documentation
=====================
.. note:: This is still very much a work-in-progress. Most information is still
to be found on our `GitHub Wiki <https://github.com/polybar/polybar/wiki>`_.
We will migrate the wiki content step-by-step.
Welcome to the official polybar documentation.
.. toctree::
:maxdepth: 1
:caption: Content:
user/actions
user/ipc
user/modules/index
user/fonts/index
user/default-config
migration/index
.. toctree::
:maxdepth: 1
:caption: Manual Pages:
man/polybar.1
man/polybar-msg.1
man/polybar.5
.. toctree::
:maxdepth: 1
:caption: For Contributors:
dev/packaging
.. toctree::
:maxdepth: 1
:caption: Developer Documentation:
dev/getting-started
dev/style-guide
dev/testing
dev/release-workflow
Getting Help
============
* `Polybar Wiki <https://github.com/polybar/polybar/wiki>`_
* `Gitter <https://gitter.im/polybar/polybar>`_
* `/r/polybar <https://reddit.com/r/polybar>`_ on reddit
* ``#polybar`` on `irc.libera.chat:6697 <https://libera.chat/>`_

75
doc/man/polybar-msg.1.rst Normal file
View File

@@ -0,0 +1,75 @@
polybar-msg(1)
==============
SYNOPSIS
--------
| **polybar-msg** [*OPTIONS*] **action** *action-string*
| **polybar-msg** [*OPTIONS*] **action** *module* *action* [*data*]
| **polybar-msg** [*OPTIONS*] **cmd** *command*
DESCRIPTION
-----------
Polybar allows external control through *actions* and *commands*.
Actions control individual modules and commands control the bar itself.
The full IPC documentation is linked at the end of this document.
The available actions depend on the target module.
For actions, the payload is either a single action string or the module name,
the action name, and the optional data string specified separately.
In order for **polybar-msg** being able to send a message to a running
**polybar** process, the bar must have IPC enabled and both **polybar-msg** and
**polybar** must run under the same user.
OPTIONS
-------
.. program:: polybar-msg
.. option:: -h, --help
Display help text and exit
.. option:: -p PID
Send message only to **polybar** process running under the given process ID.
If not specified, the message is sent to all running **polybar** processes.
EXAMPLES
--------
**polybar-msg** **cmd** *quit*
Terminate all running **polybar** instances.
**polybar-msg** **action** *mymodule* *module_hide*
**polybar-msg** **action** "*#mymodule.module_hide*"
Hide the module named *mymodule*.
The first variant specifies the module and action names separately, the second uses an action string.
AUTHORS
-------
| Polybar was created by Michael Carlberg and is currently maintained by Patrick Ziegler.
| Contributors can be listed on GitHub.
REPORTING BUGS
--------------
Report issues on GitHub <https://github.com/polybar/polybar>
SEE ALSO
--------
.. only:: man
:manpage:`polybar`\(1),
:manpage:`polybar`\(5)
| IPC documentation: <https://polybar.rtfd.org/en/stable/user/ipc.html>
.. only:: not man
:doc:`polybar.1`,
:doc:`polybar.5`
:doc:`/user/ipc`

92
doc/man/polybar.1.rst Normal file
View File

@@ -0,0 +1,92 @@
polybar(1)
==========
SYNOPSIS
--------
**polybar** [*OPTIONS*]... [*BAR*]
DESCRIPTION
-----------
Polybar aims to help users build beautiful and highly customizable status bars for their desktop environment, without the need of having a black belt in shell scripting.
If the *BAR* argument is not provided and the configuration file only contains one bar definition, polybar will display this bar.
OPTIONS
-------
.. program:: polybar
.. option:: -h, --help
Display help text and exit
.. option:: -v, --version
Display build details and exit
.. option:: -l, --log=LEVEL
| Set the logging verbosity (default: **notice**)
| *LEVEL* is one of: error, warning, notice, info, trace
.. option:: -q, --quiet
Be quiet (will override -l)
.. option:: -c, --config=FILE
Specify the path to the configuration file. By default, the configuration file is loaded from:
* ``$XDG_CONFIG_HOME/polybar/config``
* ``$XDG_CONFIG_HOME/polybar/config.ini``
* ``$HOME/.config/polybar/config``
* ``$HOME/.config/polybar/config.ini``
* ``$XDG_CONFIG_DIRS/polybar/config.ini``
* ``/etc/xdg/polybar/config.ini`` (only if ``XDG_CONFIG_DIRS`` is not set)
* ``/etc/polybar/config.ini``
.. option:: -r, --reload
Reload the application when the config file has been modified
.. option:: -d, --dump=PARAM
Print the value of the specified parameter *PARAM* in bar section and exit
.. option:: -m, --list-monitors
| Print list of available monitors and exit.
| If some monitors are cloned, this will exclude all but one of them.
| If polybar was compiled with RandR monitor support, only monitors are listed and not physical outputs.
.. option:: -M, --list-all-monitors
| Print list of all available monitors and exit.
| This includes cloned monitors as well as both physical outputs and RandR monitors (if supported).
| Only the names listed here can be used as monitor names in polybar.
.. option:: -w, --print-wmname
Print the generated *WM_NAME* and exit
.. option:: -s, --stdout
Output the data to stdout instead of drawing it to the X window
.. option:: -p, --png=FILE
Save png snapshot to *FILE* after running for 3 seconds
AUTHORS
-------
| Polybar was created by Michael Carlberg and is currently maintained by Patrick Ziegler.
| Contributors can be listed on GitHub.
REPORTING BUGS
--------------
Report issues on GitHub <https://github.com/polybar/polybar>
SEE ALSO
--------
.. only:: man
:manpage:`polybar-msg`\(1),
:manpage:`polybar`\(5)
.. only:: not man
:doc:`polybar-msg.1`,
:doc:`polybar.5`
| Full documentation at: <https://github.com/polybar/polybar>
| Project wiki: <https://github.com/polybar/polybar/wiki>

184
doc/man/polybar.5.rst Normal file
View File

@@ -0,0 +1,184 @@
.. highlight:: ini
polybar(5)
==========
Description
-----------
The polybar configuration file defines the behavior and look of polybar. It uses
a variant of the `INI <https://en.wikipedia.org/wiki/INI_file>`_ file format.
The exact syntax is described below but first a small snippet to get familiar
with the syntax:
::
[section_name]
; A comment
# Another comment
background = #ff992a
width = 90%
monitor = HDMI-0
screenchange-reload = false
; Use double quotes if you want to keep the surrounding space.
text = " Some text "
When started ``polybar`` will search for the config file in one of several
places in the following order:
* If the ``-c`` or ``--config`` command line argument is specified, it will use
the path given there.
* ``$XDG_CONFIG_HOME/polybar/config``
* ``$XDG_CONFIG_HOME/polybar/config.ini``
* ``$HOME/.config/polybar/config``
* ``$HOME/.config/polybar/config.ini``
* ``$XDG_CONFIG_DIRS/polybar/config.ini``
* ``/etc/xdg/polybar/config.ini`` (only if ``XDG_CONFIG_DIRS`` is not set)
* ``/etc/polybar/config.ini``
Syntax
------
The entire config is line-based so everything is constrained to a single line.
This means there are no multiline values or other multiline constructs (except
for sections).
Each line has one of four types:
* Empty
* Comment
* Section Header
* Key
Spaces at the beginning and end of each line will be ignored.
.. note::
In this context "spaces" include the regular space character as well as the
tab character and any other character for which :manpage:`isspace(3)` returns
``true`` (e.g. ``\r``).
Any line that doesn't fit into one of these four types is a syntax error.
.. note::
It is recommended that `section header` names and `key` names only use
alphanumeric characters as well as dashes (``-``), underscores (``_``) and
forward slashes (``/``).
In practice all characters are allowed except for spaces and any of these:
``"'=;#[](){}:.$\%``
Section Headers
^^^^^^^^^^^^^^^
Sections are used to group config options together. For example each module is
defined in its own section.
A section is defined by placing the name of the section in square brackets
(``[`` and ``]``). For example:
::
[module/wm]
This declares a section with the name ``module/wm`` and all keys defined after
this line will belong to that section until a new section is declared.
.. warning::
The first non-empty and non-comment line in the main config file must be a
section header. It cannot be a key because that key would not belong to any
section.
.. note::
The following section names are reserved and cannot be used inside the config:
``self``, ``root``, and ``BAR``.
Keys
^^^^
Keys are defined by assigning a value to a name like this:
::
name = value
This assigns ``value`` to the key ``name`` in whatever section this line is in.
Key names need to be unique per section.
If the value is enclosed by double-quotes (``"``), the quotes will be ignored.
So the following still assigns ``value`` to ``name``:
::
name = "value"
Spaces around the equal sign are ignored, the following are all equivalent:
::
name=value
name = value
name = value
Because spaces at the beginning and end of the line are also ignored, if you
want your value to begin and/or end with a space, the value needs to be enclosed
in double-quotes:
::
name = " value "
Here the value of the ``name`` key has a leading and trailing whitespace.
To treat characters with special meaning as literal characters, you need to
prepend them with the backslash (``\``) escape character:
::
name = "value\\value\\value"
Value of this key ``name`` results in ``value\value\value``.
.. note::
The only character with a special meaning right now is the backslash character
(``\``), which serves as the escape character.
More will be added in the future.
Empty Lines & Comments
^^^^^^^^^^^^^^^^^^^^^^
Empty lines and comment lines are ignored when reading the config file, they do
not affect polybar's behavior. Comment lines start with either the ``;`` or the
``#`` character.
.. note::
Inline comments are not supported. For example the following line does not end
with a comment, the value of ``name`` is actually set to ``value ; comment``:
::
name = value ; comment
AUTHORS
-------
| Polybar was created by Michael Carlberg and is currently maintained by Patrick Ziegler.
| Contributors can be listed on GitHub.
SEE ALSO
--------
.. only:: man
:manpage:`polybar`\(1),
:manpage:`polybar-msg`\(1)
.. only:: not man
:doc:`polybar.1`,
:doc:`polybar-msg.1`

View File

@@ -0,0 +1,40 @@
Migrating From Version 3.6 to 3.7
=================================
Text Module (``custom/text``)
-----------------------------
Using ``content`` to specify the text of the module is deprecated in favor of
using the same concepts as all other modules (formats and labels).
For example, the following text module:
.. code-block:: dosini
[module/text]
type = custom/text
content = Hello World
content-foreground = #ff0000
Should now look like this:
.. code-block:: dosini
[module/text]
type = custom/text
label = Hello World
label-foreground = #ff0000
Because it is set to its default value, the ``format`` setting can also be
completely left out.
In general, all properties on ``content`` also apply the same on ``label``
(e.g. ``background``, ``font``), except for ``offset``,
``prefix``, ``suffix`` (and their sub-properties).
Those three properties have to instead be applied to ``format`` (e.g.
``format-offset``).
System Tray
-----------
.. include:: tray.rst

View File

@@ -0,0 +1,57 @@
..
File included directly in other pages describing migrating to the new tray module
Polybar version 3.7 introduced the new tray module and deprecated the legacy
tray implementation which uses ``tray-position`` to position the tray.
You should switch over to the tray module as soon as possible.
The legacy tray was configured in the `bar section
<https://github.com/polybar/polybar/wiki/Configuration#bar-settings>`_, the
setting for the module live in that module's section of the config file.
The settings in the bar section don't always directly correspond to an
equivalent setting in the module section for the new tray module.
The following lists how each old setting in the bar section should be migrated:
``tray-position``
The tray is now positioned as a module and so its positioning is done by
placing it where you want it to appear in one of the three module lists
``modules-left``, ``modules-center``, ``modules-right``.
``tray-detached``
This setting does not have an equivalent, detaching the tray is no longer
possible.
``tray-maxsize``
The :poly-setting:`tray-size` setting now determines the size of tray icons.
``tray-transparent``
Was already deprecated and does not exist in the tray module.
Transparency is enabled automatically if a transparent background is used.
``tray-background``
Also exists in the module section (see :poly-setting:`tray-background`). Now,
the setting only applies to the icons themselves and no longer to the space
around them.
``tray-foreground``
Also exists in the module section with the same functionality (see
:poly-setting:`tray-foreground`).
``tray-offset-x``, ``tray-offset-y``
Has no direct equivalent in the module settings. Horizontally, the tray can
be moved in the same way other module content can be moved; by reordering the
modules or using things like ``format-offset``, ``format-margin``, or
``format-padding``.
The tray can't be moved vertically.
In any case, the tray can no longer be moved outside of the bar window.
``tray-padding``
Spacing between tray icons works a bit different now and needs to be
completely reconfigured (see :poly-setting:`tray-padding` and
:poly-setting:`tray-spacing`).
``tray-scale``
No longer exist. The size of the icons is solely determined by
:poly-setting:`tray-size`.

24
doc/migration/index.rst Normal file
View File

@@ -0,0 +1,24 @@
Polybar Migration Guides
========================
Updating polybar to the newest version often requires updating your
configuration files to use the newest features and replace outdated settings.
Starting from version 3.7, we include a small guide here for how to migrate
from the previous version.
If you are upgrading over multiple versions (e.g. from 3.5 to 3.7), also read
the migration guides for all versions in between.
For migration guides before version 3.7, please look at our `release blog posts
<https://polybar.github.io/blog/>`_.
When upgrading make sure to run polybar from the terminal and look for errors,
warnings, and deprecation messages.
This can save you a lot of issues in the future when deprecated settings and
features are removed.
.. toctree::
:maxdepth: 1
:caption: Guides
3.7/index

7
doc/requirements.txt Normal file
View File

@@ -0,0 +1,7 @@
# Installing these packages is only really needed on readthedocs, building
# locally works as long as sphinx is installed.
# For local development, you may want to install some of these though.
sphinx~=7.2.6
sphinx-rtd-theme~=2.0.0rc2
sphinx-notfound-page~=1.0.0
readthedocs-sphinx-search~=0.3.2

463
doc/user/actions.rst Normal file
View File

@@ -0,0 +1,463 @@
Actions
=======
.. versionadded:: 3.5.0
.. contents:: Table of Contents
:local:
"Actions" are used to trigger certain behavior in modules.
For example, when you click on your volume module (pulseaudio or alsa), polybar
internally sends an action to that module that tells it to mute/unmute the
audio.
These actions are not only used internally, but users can also send these
actions to polybar through `Inter Process Communication
<https://github.com/polybar/polybar/wiki/Inter-process-messaging>`_ (IPC) to
trigger certain behavior in polybar modules.
.. _action-string-format:
Action String Format
--------------------
An action string follows the following format:
::
#NAME.ACTION[.DATA]
Where ``NAME`` is the name of the target module (not the type!) and ``ACTION``
is the name of the action in that module. ``DATA`` is optional data attached to
an action (for example to say which menu level should be opened).
For example the
`date module <https://github.com/polybar/polybar/wiki/Module:-date>`_ supports
the ``toggle`` action to toggle between the regular and the alternative time and
date format.
If you have the following date module:
.. code-block:: ini
[module/mydate]
type = internal/date
...
The action string for toggling between the date formats would look like this:
::
#mydate.toggle
Note that we use the name of the module (``mydate``) and not the type.
As an example for an action string with additional data, take the menu module:
.. code-block:: ini
[module/powermenu]
type = custom/menu
menu-0-0 = Poweroff
menu-0-0-exec = poweroff
menu-0-1 = Suspend
menu-0-1-exec = systemctl suspend
The action name to open a certain menu level is ``open``, so to open level 0
(`menu-0`), the action string additionally has the level attached to it:
::
#powermenu.open.0
Triggering Actions
------------------
Most modules already use action strings to trigger actions when you click on or
scroll over a module.
But in some cases you may want or need to manually send action strings to
polybar to trigger a certain behavior.
Everywhere where you can specify a command to run on click or scroll, you can
also specify an action string.
For example, in the bar section, you can specify a command that is triggered
when you click anywhere on the bar (where there isn't another click action):
.. code-block:: ini
[bar/mybar]
...
click-left = #mydate.toggle
...
This will then trigger the ``toggle`` action on the ``mydate`` module when you
click anywhere on the bar.
Similarly, we can use action strings in ``%{A}``
`formatting tags <https://github.com/polybar/polybar/wiki/Formatting#action-a>`_
just as we would regular commands:
::
%{A1:firefox:}%{A3:#mydate.toggle:}Opens firefox on left-click and toggles the
date on right-click %{A}%{A}
Finally, polybar's `Inter Process Communication
<https://github.com/polybar/polybar/wiki/Inter-process-messaging>`_ (IPC) can
also be used to trigger actions:
.. code-block:: bash
polybar-msg action "#mydate.toggle"
.. note::
The quotes around the action string are necessary, otherwise your shell may
interpret the ``#`` as the beginning of the comment and ignore the rest of the
line.
Available Actions
-----------------
The following modules have actions available. Most of them are already used by
the module by default for click and scroll events.
All Modules
^^^^^^^^^^^
These actions are available to all modules and are prefixed with ``module_``.
:``module_show``, ``module_hide``:
Shows/Hides a module. The module is still running in the background when
hidden, it is just not drawn. The starting state can be configured with the
`hidden` configuration option.
.. versionadded:: 3.6.0
:``module_toggle``:
Toggles the visibility of a module.
.. versionadded:: 3.6.0
internal/date
^^^^^^^^^^^^^
:``toggle``:
Toggles the date/time format between ``date``/``time`` and
``date-alt``/``time-alt``
internal/alsa
^^^^^^^^^^^^^
:``inc``, ``dec``:
Increases/Decreases the volume by ``interval`` percentage points, where
``interval`` is the config setting in the module. Volume changed like this
will never go above 100%.
if ``unmute-on-scroll`` is turned on, the sound will also be unmuted when
this action is called.
:``toggle``:
Toggles between muted and unmuted.
internal/pulseaudio
^^^^^^^^^^^^^^^^^^^
:``inc``, ``dec``:
Increases/Decreases the volume by ``interval`` percentage points, where
``interval`` is the config setting in the module. Volume changed like this
will never go above ~153% (if ``use-ui-max`` is set to ``true``) or 100% (if
not).
if ``unmute-on-scroll`` is turned on, the sound will also be unmuted when
this action is called.
:``toggle``:
Toggles between muted and unmuted.
internal/xbacklight
^^^^^^^^^^^^^^^^^^^
:``inc``, ``dec``:
Increases/Decreases screen brightness 5 percentage points.
internal/backlight
^^^^^^^^^^^^^^^^^^
:``inc``, ``dec``:
Increases/Decreases screen brightness 5 percentage points.
internal/xkeyboard
^^^^^^^^^^^^^^^^^^
:``switch``:
Cycles through configured keyboard layouts.
internal/mpd
^^^^^^^^^^^^
:``play``: Starts playing the current song.
:``pause``: Pauses the current song.
:``stop``: Stops playing.
:``prev``: Starts playing the previous song.
:``next``: Starts playing the next song.
:``repeat``: Toggles repeat mode.
:``single``: Toggles single mode.
:``random``: Toggles random mode.
:``consume``: Toggles consume mode.
:``seek``: *(Has Data)* Seeks inside the current song.
The data must be of the form ``[+-]N``, where ``N`` is a number
between 0 and 100.
If either ``+`` or ``-`` is used, it will seek forward or backward
from the current position by ``N%`` (relative to the length of the
song).
Otherwise it will seek to ``N%`` of the current song.
internal/xworkspaces
^^^^^^^^^^^^^^^^^^^^
:``focus``: *(Has Data)* Switches to the given workspace.
The data is the index of the workspace that should be selected.
:``next``: Switches to the next workspace. The behavior of this action is
affected by the ``pin-workspaces`` setting.
:``prev``: Switches to the previous workspace. The behavior of this action is
affected by the ``pin-workspaces`` setting.
internal/bspwm
^^^^^^^^^^^^^^
:``focus``: *(Has Data)* Switches to the given workspace.
The data has the form ``N+M``, where ``N`` is the index of the
monitor and ``M`` the index of the workspace on that monitor.
Both indices are 0-based and correspond to the position the monitor
and workspace appear in the output of ``bspc subscribe report``.
:``next``: Switches to the next workspace. The behavior of this action is
affected by the ``pin-workspaces`` setting.
:``prev``: Switches to the previous workspace. The behavior of this action is
affected by the ``pin-workspaces`` setting.
internal/i3
^^^^^^^^^^^
:``focus``: *(Has Data)* Switches to the given workspace.
The data is the name of the workspace defined in the i3 config.
:``next``: Switches to the next workspace. The behavior of this action is
affected by the ``pin-workspaces`` setting.
:``prev``: Switches to the previous workspace. The behavior of this action is
affected by the ``pin-workspaces`` setting.
custom/menu
^^^^^^^^^^^
:``open``: *(Has Data)* Opens the given menu level
The data is a single number specifying which menu level should be
opened.
:``close``: Closes the menu
:``exec``: *(Has Data)* Executes the command at the given menu element.
The data has the form ``N-M`` and the action will execute the command
in ``menu-N-M-exec``.
.. _actions-ipc:
custom/ipc
^^^^^^^^^^
.. versionadded:: 3.6.0
:``send``: *(Has Data)* Replace the contents of the module with the data passed in this action.
:``hook``: *(Has Data)* Trigger the given hook.
The data is the 0-based index of the hook to trigger.
:``next``: Switches to the next hook and wrap around when the last hook was displayed.
:``prev``: Switches to the previous hook and wrap around when the first hook was displayed.
:``reset``: Reset the module to its startup state: either empty or according to the ``initial`` setting.
Deprecated Action Names
-----------------------
.. deprecated:: 3.5.0
In earlier versions (< 3.5.0) action strings only included information about the
module type.
This meant in bars that contained multiple different modules of the same type,
actions for these modules were sometimes processed by the wrong module with the
same type.
Since version 3.5.0, this no longer happens. However, this also means we had to
change what actions are recognized by polybar modules.
If you explicitly use any polybar action names in your config or any of your
scripts, you are advised to change them, as they may stop working at some point
in the future.
For now polybar still supports the old action names, will convert them to the
appropriate new action name, and will print a warning to help you find old
action names in your config.
If you use the `menu module
<https://github.com/polybar/polybar/wiki/Module:-menu>`_, you most likely use
old action names to open and close the menu (for example ``menu-open-1`` or
``menu-close``).
The ``i3wm-wsnext``, ``i3wm-wsprev``, ``bspwm-desknext``, and ``bspwm-deskprev``
actions, to switch workspaces in i3 and bspwm, may also appear in your config.
Migration
^^^^^^^^^
Updating your config to use the new action names is quite straightforward.
For each action name, consult the table below to find the new action name.
Afterwards build the complete action string as described in
:ref:`action-string-format`.
Please see :ref:`below <menu-example>` for an example of migrating a typical menu module.
+-------------------------+-----------------------+---------------+
|Module Type |Deprecated Action Name |New Action Name|
+=========================+=======================+===============+
|``internal/date`` |``datetoggle`` |``toggle`` |
+-------------------------+-----------------------+---------------+
|``internal/alsa`` |``volup`` |``inc`` |
| +-----------------------+---------------+
| |``voldown`` |``dec`` |
| +-----------------------+---------------+
| |``volmute`` |``toggle`` |
+-------------------------+-----------------------+---------------+
|``internal/pulseaudio`` |``pa_volup`` |``inc`` |
| +-----------------------+---------------+
| |``pa_voldown`` |``dec`` |
| +-----------------------+---------------+
| |``pa_volmute`` |``toggle`` |
+-------------------------+-----------------------+---------------+
|``internal/xbacklight`` |``xbacklight+`` |``inc`` |
| +-----------------------+---------------+
| |``xbacklight-`` |``dec`` |
+-------------------------+-----------------------+---------------+
|``internal/backlight`` |``backlight+`` |``inc`` |
| +-----------------------+---------------+
| |``backlight-`` |``dec`` |
+-------------------------+-----------------------+---------------+
|``internal/xkeyboard`` |``xkeyboard/switch`` |``switch`` |
+-------------------------+-----------------------+---------------+
|``internal/mpd`` |``mpdplay`` |``play`` |
| +-----------------------+---------------+
| |``mpdpause`` |``pause`` |
| +-----------------------+---------------+
| |``mpdstop`` |``stop`` |
| +-----------------------+---------------+
| |``mpdprev`` |``prev`` |
| +-----------------------+---------------+
| |``mpdnext`` |``next`` |
| +-----------------------+---------------+
| |``mpdrepeat`` |``repeat`` |
| +-----------------------+---------------+
| |``mpdsingle`` |``single`` |
| +-----------------------+---------------+
| |``mpdrandom`` |``random`` |
| +-----------------------+---------------+
| |``mpdconsume`` |``consume`` |
| +-----------------------+---------------+
| |``mpdseekN`` |``seek.N`` |
+-------------------------+-----------------------+---------------+
|``internal/xworkspaces`` |``xworkspaces-focus=N``|``focus.N`` |
| +-----------------------+---------------+
| |``xworkspaces-next`` |``next`` |
| +-----------------------+---------------+
| |``xworkspaces-prev`` |``prev`` |
+-------------------------+-----------------------+---------------+
|``internal/bspwm`` |``bspwm-deskfocusN`` |``focus.N`` |
| +-----------------------+---------------+
| |``bspwm-desknext`` |``next`` |
| +-----------------------+---------------+
| |``bspwm-deskprev`` |``prev`` |
+-------------------------+-----------------------+---------------+
|``internal/i3`` |``i3wm-wsfocus-N`` |``focus.N`` |
| +-----------------------+---------------+
| |``i3-wsnext`` |``next`` |
| +-----------------------+---------------+
| |``i3-wsprev`` |``prev`` |
+-------------------------+-----------------------+---------------+
|``custom/menu`` |``menu-open-N`` |``open.N`` |
| +-----------------------+---------------+
| |``menu-close`` |``close`` |
+-------------------------+-----------------------+---------------+
.. note::
Some deprecated action names are suffixed with ``N``, this means that that
action has some additional data (represented by that ``N``), in the new
action names this data will appear in exactly the same way, after a period.
.. _menu-example:
Menu Module Example
"""""""""""""""""""
The menu module is the only module where we have to explicitly use actions for
it to work. Because of this, almost everyone will need to update their menu
module to use the new action format.
Below you can see an example of a menu module:
.. code-block:: ini
[module/apps]
type = custom/menu
label-open = Apps
menu-0-0 = Browsers
menu-0-0-exec = menu-open-1
menu-0-1 = Multimedia
menu-0-1-exec = menu-open-2
menu-1-0 = Firefox
menu-1-0-exec = firefox
menu-1-1 = Chromium
menu-1-1-exec = chromium
menu-2-0 = Gimp
menu-2-0-exec = gimp
menu-2-1 = Scrot
menu-2-1-exec = scrot
This module uses two actions: ``menu-open-1`` and ``menu-open-2``.
These are actions with data, the data specifies which level of the menu should
be opened.
Looking at the table, we see that the new action name for ``menu-open-N`` is
``open.N``, where ``.N`` is the data attached to the action.
Putting this together with the name of the module gives us ``#apps.open.1`` and
``#apps.open.2`` as action strings.
Since your menu module likely has a different name, your action strings will
likely not use ``apps``, but the name of your module.
.. code-block:: ini
[module/apps]
type = custom/menu
label-open = Apps
menu-0-0 = Browsers
menu-0-0-exec = #apps.open.1
menu-0-1 = Multimedia
menu-0-1-exec = #apps.open.2
menu-1-0 = Firefox
menu-1-0-exec = firefox
menu-1-1 = Chromium
menu-1-1-exec = chromium
menu-2-0 = Gimp
menu-2-0-exec = gimp
menu-2-1 = Scrot
menu-2-1-exec = scrot

View File

@@ -0,0 +1,16 @@
Default Configuration
=====================
.. versionadded:: 3.6.0
Polybar's default configuration lives in ``/etc/polybar/config.ini`` and is
loaded if no other configuration file can be found.
.. image:: ../_static/default.png
:alt: Screenshot of default polybar configuration
.. literalinclude:: ../config.ini
:language: ini
:linenos:
:caption: :download:`Download <../config.ini>`

8
doc/user/fonts/index.rst Normal file
View File

@@ -0,0 +1,8 @@
Fonts
=====
.. toctree::
:maxdepth: 1
Wiki <https://github.com/polybar/polybar/wiki/Fonts>
Nerd Fonts <nerd-fonts>

View File

@@ -0,0 +1,54 @@
Nerd Fonts
==========
`Nerd Fonts <https://www.nerdfonts.com/>`_ (`GitHub
<https://github.com/ryanoasis/nerd-fonts/>`_) is a project that patches
together a textual font with font icons (or glyphs) from other projects (e.g.
`Font Awesome <https://github.com/FortAwesome/Font-Awesome>`_, `Material Design
Icons <https://github.com/Templarian/MaterialDesign>`_, etc.) into a single
font.
In polybar, just using nerd fonts can lead to some issues:
* Cut-off Characters
* Overlapping
* No Spacing
These look something like this:
.. image:: /_static/nerd-fonts/bad.png
:alt: Showcase of the three issues listed above.
This behavior is intrinsic to Nerd Fonts and is described in more detail `here
<https://github.com/ryanoasis/nerd-fonts/issues/442#issuecomment-1263358904>`_.
Also see :issue:`991` for more information.
**To resolve these issues, we recommend using Nerd Fonts like this:**
The monospaced variants of the different Nerd Fonts (all characters have the
same width) don't have this issue.
However, then you often have the problem that the icons are too small and that
their size cannot be set independently of the text.
Due to that, we recommend using ``Symbols Nerd Font Mono`` (available for
`download <https://github.com/ryanoasis/nerd-fonts/releases/>`_ as
``NerdFontsSymbolsOnly.zip``).
This font only contains the nerd font icons and no text.
For the text, simply use any non-Nerd Font:
.. code-block:: ini
font-0 = "Liberation Mono:size=20"
font-1 = "Symbols Nerd Font Mono:size=26"
Now the icon sizes can be adjusted separately to get the best experience.
This solves all three problems shown above:
.. image:: /_static/nerd-fonts/good.png
:alt: The same config as in the previous screenshot but using ``Symbols Nerd
Font Mono`` for the font icons
.. note::
In the overlap example, there is no space between the icon and text, that's
why they're so close together.

120
doc/user/ipc.rst Normal file
View File

@@ -0,0 +1,120 @@
Inter-process-messaging
=======================
Polybar supports controlling parts of the bar and its modules from the outside
through inter-process-messaging (IPC).
IPC is disabled by default and can be enabled by setting ``enable-ipc = true``
in the bar section.
By default polybar ships with the ``polybar-msg`` tool that is needed to send
messages to polybar.
.. note:: Starting with version 3.6.0, the underlying IPC mechanism has been
completely changed.
Writing directly to the named pipe to send IPC messages has been
deprecated, ``polybar-msg`` should be used exclusively
Everything you could do by directly writing to the named pipe, you
can also do using ``polybar-msg``.
In addition, hook messages are also deprecated; they are replaced by
actions on the :ref:`ipc module <actions-ipc>`.
Unless noted otherwise, everything in this guide is still valid for
older versions.
Sending Messages
----------------
``polybar-msg`` can be called on the commandline like this:
.. code-block:: shell
polybar-msg [-p <pid>] <type> <payload>
If the ``-p`` argument is specified, the message is only sent to the running
polybar instance with the given process ID.
Otherwise, the message is sent to all running polybar processes that have IPC
enabled.
.. note:: IPC messages are only sent to polybar instances running under the
same user as ``polybar-msg`` is running as.
Concretely, ``polybar`` and ``polybar-msg`` use the
``$XDG_RUNTIME_DIR`` environment variable in accordance with the `XDG
Base Directory Specification`_ to determine where to find the socket
to communicate.
If ``polybar`` and ``polybar-msg`` don't have the same value for
``$XDG_RUNTIME_DIR``, they will likely not be able to communicate.
The variable may not be set if you use ``su`` or ``sudo`` to execute
``polybar-msg`` as a different user, often a full user session is
required.
.. _XDG Base Directory Specification: https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
The ``<type>`` argument is either :ref:`action <ipc-actions>` or
:ref:`cmd <ipc-commands>`.
The allowed values for ``<payload>`` depend on the type.
Message Types
-------------
.. _ipc-commands:
Commands
^^^^^^^^
Using ``cmd`` for ``<type>``, you can control certain aspects of the bar.
Available values for ``<payload>`` are:
* ``quit``: Terminates the bar
* ``restart``: Restarts the bar in-place
* ``hide``: Hides the bar
* ``show``: Makes the bar visible again, if it was hidden
* ``toggle``: Toggles between the hidden and visible state.
.. _ipc-actions:
Module Actions
^^^^^^^^^^^^^^
For the ``<type>`` ``action``, ``polybar-msg`` can execute
:doc:`module actions <actions>` in the bar.
An action consists of the name of the target module, the name of the action and an optional data string:
::
#<modulename>.<actionname>[.<data>]
More information about action strings and available actions can be found in
:doc:`actions`
For example, if you have a date module named ``date``, you can toggle between
the regular and alternative label with:
.. code-block:: shell
polybar-msg action "#date.toggle"
As an example for an action with data, say you have a menu module named
``powermenu``, you can open the menu level 0 using:
.. code-block:: shell
polybar-msg action "#powermenu.open.0"
.. note::
For convenience, ``polybar-msg`` also allows you to pass the module name,
action name, and data as separate arguments:
.. code-block:: shell
polybar-msg action date toggle
polybar-msg action powermenu open 0
.. versionadded:: 3.6.0

13
doc/user/modules/defs.rst Normal file
View File

@@ -0,0 +1,13 @@
.. highlight:: ini
..
Substitutions for quickly referencing different config value types
.. |type-format| replace:: `format <type-format_>`_
.. |type-extent| replace:: `extent <type-extent_>`_
.. |type-pwo| replace:: `percentage with offset <type-pwo_>`_
.. |type-color| replace:: color
.. _type-format: https://github.com/polybar/polybar/wiki/Formatting#formats
.. _type-extent: https://github.com/polybar/polybar/wiki/Formatting#extent
.. _type-pwo: https://github.com/polybar/polybar/wiki/Formatting#percentage-with-offset

View File

@@ -0,0 +1,31 @@
Modules
=======
.. toctree::
:maxdepth: 1
System Tray <tray>
Alsa <https://github.com/polybar/polybar/wiki/Module:-alsa>
Backlight <https://github.com/polybar/polybar/wiki/Module:-backlight>
Battery <https://github.com/polybar/polybar/wiki/Module:-battery>
bspwm <https://github.com/polybar/polybar/wiki/Module:-bspwm>
CPU <https://github.com/polybar/polybar/wiki/Module:-cpu>
Date and Time <https://github.com/polybar/polybar/wiki/Module:-date>
Filesystem <https://github.com/polybar/polybar/wiki/Module:-filesystem>
GitHub <https://github.com/polybar/polybar/wiki/Module:-github>
i3 <https://github.com/polybar/polybar/wiki/Module:-i3>
Inter-process-messaging (IPC) <https://github.com/polybar/polybar/wiki/Module:-ipc>
Memory <https://github.com/polybar/polybar/wiki/Module:-memory>
Menu <https://github.com/polybar/polybar/wiki/Module:-menu>
MPD <https://github.com/polybar/polybar/wiki/Module:-mpd>
Network <https://github.com/polybar/polybar/wiki/Module:-network>
PulseAudio <https://github.com/polybar/polybar/wiki/Module:-pulseaudio>
Script <https://github.com/polybar/polybar/wiki/Module:-script>
Temperature <https://github.com/polybar/polybar/wiki/Module:-temperature>
Text <https://github.com/polybar/polybar/wiki/Module:-text>
XBacklight <https://github.com/polybar/polybar/wiki/Module:-xbacklight>
XKeyboard <https://github.com/polybar/polybar/wiki/Module:-xkeyboard>
XWindow <https://github.com/polybar/polybar/wiki/Module:-xwindow>
XWorkspaces <https://github.com/polybar/polybar/wiki/Module:-xworkspaces>
User contributed modules <https://github.com/polybar/polybar/wiki/User-contributed-modules>

118
doc/user/modules/tray.rst Normal file
View File

@@ -0,0 +1,118 @@
.. include:: defs.rst
Tray Module
===========
.. poly-setting:: type = internal/tray
.. versionadded:: 3.7.0
The tray module displays system tray application icons on the bar.
This module is a bit different from the other modules.
The tray icons (also called clients) are individual windows managed by their
respective application (e.g. the Dropbox tray icon is created and managed by
the Dropbox application).
Polybar is only responsible for embedding the windows in the bar and
positioning them correctly.
.. attention::
Only a single instance of this module can be active at the same time (across
all polybar instances in the same graphical session).
The way the `system tray protocol <systray-spec_>`_ works, at most one tray
can exist at any time.
Polybar will produce a warning if additional tray instances are created.
This also applies when another tray application (e.g. ``stalonetray``) is
active.
For transparent background colors, the tray will use pseudo-transparency, true
transparency is not possible for the tray icons.
Formats
-------
The module only has a single format:
.. poly-setting:: format
:type: |type-format|
:tags: ``<tray>``: Shows tray icons
:default: ``<tray>``
Settings
--------
.. poly-setting:: tray-spacing
Space added between tray icons
:type: |type-extent|, non-negative
:default: ``0px``
.. poly-setting:: tray-padding
Space added before and after each tray icon
:type: |type-extent|, non-negative
:default: ``0px``
.. poly-setting:: tray-size
Size of individual tray icons
:type: |type-pwo|, relative to bar height, non-negative
:default: 66%
.. poly-setting:: tray-background
Background color of tray icons
.. note::
This only affects the color of the individual icons and not the space in
between, changing this setting to anything else than the bar background
will likely not look good unless the background color is also changed for
the rest of the tray module (e.g. with ``format-background``).
:type: |type-color|
:default: ``${root.background}``
.. poly-setting:: tray-foreground
Tray icon color
This serves as a hint to the tray icon application for which color to use for
the icon.
This is not guaranteed to have any effect (likely only in GTK3) because it
targets a non-standard part of the `system tray protocol <systray-spec_>`_ by
setting the ``_NET_SYSTEM_TRAY_COLORS`` atom on the tray window.
:type: |type-color|
:default: ``${tray-foreground}``
Example
-------
::
[module/tray]
type = internal/tray
format-margin = 8px
tray-spacing = 8px
Migrating From Legacy Tray Implementation
-----------------------------------------
.. include:: /migration/3.7/tray.rst
References
----------
* `System Tray Protocol Specification <systray-spec_>`_
* `XEmbed Protocol Specification <xembed_>`_
.. _systray-spec: https://specifications.freedesktop.org/systemtray-spec/systemtray-spec-latest.html
.. _xembed: https://specifications.freedesktop.org/xembed-spec/xembed-spec-latest.html

Some files were not shown because too many files have changed in this diff Show More