Commit Graph

454 Commits

Author SHA1 Message Date
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
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
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
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
b3ceedde76 refactor(bar): Remove bar_settings.center
Not used anywhere
2019-02-05 11:50:25 +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
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
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
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
patrick96
6ca4f06785 doc: Convert @ to \ doxygen commands
Ref #1377
2018-11-04 19:28:27 -08: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
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
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
66cf9b8b99 docs(renderer): fix stale comment 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
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
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
NBonaparte
4cb0b18389 fix(controller): don't draw window if writing to stdout (#1322)
fixes #1314.
2018-07-24 19:39:32 +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
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
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
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
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
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
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
Florian Brinker
692e6d9b4a Loglevel info for "No matching input area" (#1059) 2018-02-27 17:45:24 +01:00
patrick96
0fd614b0a9 refactor(controller): Print error message on select fail 2018-02-15 19:26:35 -08: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
NBonaparte
06dee3dedd fix(volume): Warn instead of throw 2018-01-23 14:33:11 +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
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
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
70023b07c1 refactor(cursor): Include double clicks and fix scroll to click changes 2017-09-16 19:48:38 -07:00
NBonaparte
e612fe1624 refactor(cursor): use map for cursor list 2017-09-16 15:31:24 -07:00
NBonaparte
1886cf97a8 fix: pass action by reference 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
NBonaparte
3ce06585ab fix(parser): Revert tag stacks 2017-09-06 20:16:08 -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
Michael Carlberg
d3b0670f30 fix(config): Perform tilde expansion on include-file #603 2017-06-02 18:34:49 +02:00
Michael Carlberg
389bae2669 fix(renderer): Adjust center block position when using tray
Fixes #551
2017-05-19 17:25:04 +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
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
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
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
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
Chase Geigle
bd8e748399 fix(builder): use unicode-aware truncation for label-maxlen 2017-02-16 09:19:26 +01:00
Michael Carlberg
1d06df25a9 fix(config): Use std::map to store sections #412 2017-02-07 14:56:56 +01:00
Michael Carlberg
9f1d9a14fd fix(renderer): Use correct width for top border
Refs #390
2017-01-29 15:25:31 +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
07cb5f134e fix(renderer): Cleanup 2017-01-26 21:55:42 +01:00
Michael Carlberg
874e6b0d6c feat(config): Add directive for file inclusion 2017-01-26 20:10:33 +01:00
Michael Carlberg
43a17c3b36 refactor(cmake): Cleanup 2017-01-26 17:39:50 +01:00
Michael Carlberg
162e77793a fix(tray): Ignore if detached
Refs #383
2017-01-26 12:46:10 +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
886d0f4ff3 fix(renderer): Round floatig point numbers
Refs #378
2017-01-25 21:46:18 +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
c7f33e2567 refactor(renderer): Use redirection groups instead of pixmaps 2017-01-25 09:54:18 +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
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
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
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
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
40d482d039 fix: By-pass double click timers if no handlers are defined
Fixes #338
2017-01-15 02:00:35 +01:00
Michael Carlberg
3292cea786 refactor(tokens): Move token suffix to configuration 2017-01-14 18:00:35 +01:00
Michael Carlberg
480c2cb44b controller: Lower verbosity of uncaught event msg 2017-01-14 00:34:35 +01:00
Michael Carlberg
57e8914fa6 fix: Force update after running input command 2017-01-13 14:33:16 +01:00
Michael Carlberg
22140f7db9 refactor(builder): Action wrapped labels 2017-01-13 13:01:46 +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
b48a275235 feat(command_line): Properly handle positional args 2017-01-13 04:47:25 +01:00
Michael Carlberg
385572ec64 feat(xrandr): Support for monitors
Refs #280
2017-01-13 03:52: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
ca1aac2ed6 feat(config): Shorthand for {padding,module-margin}-{left,right} 2017-01-12 17:32:11 +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
568837d06a fix(x11): Preload the _NET_WM_WINDOW_OPACITY atom 2017-01-11 05:00:23 +01:00
Michael Carlberg
8cc885c316 refactor: Cleanup 2017-01-11 03:07:28 +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
0f0d786cbd fix(ipc): Always close file descriptor on receive 2017-01-09 23:09:16 +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
3d6084f0c0 fix(controller): Always process forced update events 2017-01-09 16:35:28 +01:00
Michael Carlberg
6925415501 fix(tray): Force bar update on change
Refs #295
2017-01-09 14:27:56 +01:00
Michael Carlberg
6341c7ab25 refactor(config): Defer xrm initialization 2017-01-01 21:12:38 +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
796cdb52cc refactor: Rename restack function 2017-01-01 15:45:18 +01:00
Michael Carlberg
dd960cc5b5 refactor(fd_streambuf): Cleanup 2016-12-31 15:42:46 +01:00
Michael Carlberg
210695d377 refactor(x11): Merge xlib/xutils with connection 2016-12-31 10:02:32 +01:00
Michael Carlberg
e3a51b235a refactor(clang-tidy): Apply fixes 2016-12-31 04:32:11 +01:00
Michael Carlberg
a989d401d9 fix(renderer): Content shifting bounds 2016-12-31 03:01:22 +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
e1c6a4e5a3 fix(command_line): End with empty line 2016-12-30 21:14:22 +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
7b780a3201 refactor(builder): Cleanup 2016-12-26 17:06:28 +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
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
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
92424f0d49 refactor(cmake): Install components 2016-12-23 18:10:19 +01:00
Michael Carlberg
9c14531542 fix(config): Require wrapping quotes to trim 2016-12-23 14:39:12 +01:00
Michael Carlberg
1cb8e455fb fix(controller): Invalid move constructions
Refs #268, #265
2016-12-23 13:03:05 +01:00
Michael Carlberg
e551dbfea9 fix(controller): Raise signal on quit from eventqueue 2016-12-23 05:51:33 +01:00
Michael Carlberg
debb3534c7 concurrency_ytil: Thread id 2016-12-23 05:18:58 +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
d4e3891ab6 refactor(connection): Listen for property notify by default 2016-12-23 01:05:36 +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
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
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
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
1cccd100bb fix(bar): Remove double click 2016-12-20 07:46:30 +01:00
Michael Carlberg
cd31d92713 fix(controller): Check eventpipe reads/writes 2016-12-20 05:36:10 +01:00
Michael Carlberg
a89c4ef2dd refactor: Move all event handling to the controller 2016-12-20 05:16:04 +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
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
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
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
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
0b949ee3bb fix(config): Allow empty values 2016-12-14 15:10:19 +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
5077325044 refactor(string_util): Use rvalue references for *trim() 2016-12-14 11:01:44 +01:00