Commit Graph

959 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
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
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
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
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
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
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
0276d11fd9 config_parser: Improve message for invalid names 2020-02-21 16:17:12 +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
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
e6e010e45b fix(battery): animation framerate 2020-01-23 23:45:56 +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
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
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
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
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
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
Jérôme BOULMIER
e5783d4113 Include empty tokens when splitting if necessary (#1893)
Fixes #1881
2019-11-21 22:26:53 +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
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
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
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
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
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
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
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
Patrick Ziegler
f0c65e6cf0
fix(config): Allow empty string as ref fallback (#1831) 2019-07-01 23:33:01 +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
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
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
Sergi Jimenez
9f7840c7d6 fix(build): Uninitialized local variable (#1759)
Fixes #1758
2019-05-05 22:09:03 +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
d1fe97b90f git: Clean up gitignore
Each directory is responsible for ignoring files
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
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
Jérôme BOULMIER
57b8fcc7cd refactor(cmake): move generated files in build directory (#1726) 2019-04-04 22:53:54 +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
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
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
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
Joost Sijm
8ca36d9e16 typo: replace 'alot' with 'a lot' (#1634)
This is bothering me alot
2019-01-29 17:54:38 +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
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
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
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
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
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
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
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
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
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
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
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
Benno Fünfstück
b20ad041e9 docs(signal): document newly added signals 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
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
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
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
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
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
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
memeplex
1d6d44f4e9 feat(token): Zero pad when min val starts with '0' (#1341)
Closes #1332
2018-07-23 15:49:02 +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
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
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
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
6157c697bc refactor(build): List xkeyboard in cmake and polybar -v 2018-06-18 11:49:31 +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
tamago
b70d5b55d8 feat(mpd): add support for MPD_TAG_ALBUM_ARTIST 2018-05-31 20:12:23 -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
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
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
Christoph Schiessl
2a9d5db179 feat(battery): implement animation-discharging 2018-05-02 11:44:55 +02:00
Kajzer
688658c306 (pulseaudio) Add max volume configuration 2018-04-09 20:27:55 -07: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
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
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
d430174f0b fix(pulseaudio): add mutex for queue 2018-03-31 00:52:17 +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
Kyle Cook
0f34178104 Add FreeBSD Support (#931) 2018-03-21 23:35:10 +01:00
NBonaparte
0a8a326730 feat(net): Add unknown-as-up option
Fixes #457
2018-03-04 23:09:18 +01: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
c30159abc6 feat(temp): Add units option
Avoids having lots of tokens
2018-02-15 18:50:59 -08:00
patrick96
078bcd5e7d Respect MPD_HOST env variable
Fixes #1007
2018-02-15 17:45:41 -08:00
NBonaparte
989bc00082 fix(alsa): use correct module_name 2018-02-11 17:04:08 +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
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
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
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
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
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
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
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
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
Jens Henniges
d3abcc97f6 feat(mpd): Add support for icon-consume (#861) 2017-12-04 11:38:17 -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
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
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
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
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
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
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
NBonaparte
3ce06585ab fix(parser): Revert tag stacks 2017-09-06 20:16:08 -07:00
NBonaparte
e329a8150a fix(config): Expand all environment variables and file references (#724) 2017-09-04 14:00:35 -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
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
Michael Carlberg
d3b0670f30 fix(config): Perform tilde expansion on include-file #603 2017-06-02 18:34:49 +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
b6c5563b0b feat(ipc): Add visibility commands 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
f754fa2710 feat(parser): Keep track of formatting colors #544 2017-04-25 20:26:56 +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
02833b7871 feat(volume): Optional event handling #84 2017-04-02 18:12:07 +02:00
Michael Carlberg
f3089e88f2 feat(conf): Properties for top/bottom radius #445 2017-03-21 14:49:33 +01:00
raidzero
50aba85ad0 Merge remote-tracking branch 'upstream/master' 2017-02-23 14:50:09 -07: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
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
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
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
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
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
eb5c82a5c3 fix(modules): Warmup in runner thread to avoid block 2017-01-27 13:29:10 +01:00
Michael Carlberg
042d385015 fix(i3): Add state descriptions 2017-01-27 03:23:42 +01:00
Michael Carlberg
d5d941e663 build: Bump version to 3.0.2 2017-01-26 21:57:01 +01:00
Michael Carlberg
73aa721f90 fix(config): Error message 2017-01-26 21:34:38 +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
897b6e0221 build: Bump version to 3.0.1 2017-01-26 02:40:35 +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
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
95d5b03fa2 refactor(file_util): Expand tilde manually 2017-01-25 17:07:55 +01:00
Michael Carlberg
4d6dfd3e2c build: Bump version to 3.0.0 2017-01-25 15:26:44 +01:00
Michael Carlberg
f37ecfe959 fix(renderer): Falloff gradient 2017-01-25 15:00:34 +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
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
c74a1647ab fix(color_util): Add missing header 2017-01-24 12:37:19 +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
1a5246e940 refactor(cairo): Use shared_ptr for font list 2017-01-24 11:50:26 +01:00
Michael Carlberg
3e37b9ec8e fix(cairo): Increment textblock bg extents 2017-01-24 11:07:18 +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
6cc7a2c093 fix(color_util): Use lambda 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
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
892673c405 fix(config): Require value reference without fallback 2017-01-20 02:31:55 +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
40d482d039 fix: By-pass double click timers if no handlers are defined
Fixes #338
2017-01-15 02:00:35 +01:00