Commit Graph

927 Commits

Author SHA1 Message Date
patrick96
cd1d4fa183 Stop tracking action blocks in renderer
Dispatch can now directly get the current position from the renderer and
create action blocks with the proper coordinates.
2021-02-12 20:01:22 +01:00
patrick96
b5bdbdf6cb Add action_context tests 2021-02-12 20:01:22 +01:00
patrick96
d89096c191 Remove tag headers from signal.hpp 2021-02-12 20:01:22 +01:00
patrick96
7a569c4b98 Remove mousebtn argument from action_open 2021-02-12 20:01:22 +01:00
patrick96
464bedb33c Store all action info in action_context
The renderer is responsible for setting the start and end positions
while dispatch does the rest
2021-02-12 20:01:22 +01:00
patrick96
f359540b5d renderer: Move change_alignment into interface 2021-02-12 20:01:22 +01:00
patrick96
96239597ed Move most action state out of renderer
The renderer now only stores the positions of the actions because that
is specific to the renderer and because the actual position can only be
finalized after all the rendering is done because intitially the
positions are relative to the alignment and not the bar.
2021-02-12 20:01:22 +01:00
patrick96
0a474bb2f2 Move trivial formatting state into tags::context
The variables storing the current colors, attribute activations and font
were only used in a single place and can easily also be read from the
context.

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

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

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

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

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

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

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

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

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

Resolves: First step in #2354

Improve value parsing

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

Add escape character documentation to manpages

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

Add info about the esacape character to changelog

Add test cases for ParseLineKeyTest

Fix ParseLineKeyTest test cases

Also make config parser method parse_escaped_value private.

Add tests for escaped_value_parser method

Also remove unsued include statement

Simplify parse_escaped_value in config_parser

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

Fix ParseEscapedValueTest test cases

Fix parse_escaped_value

Add more test cases for ParseLineKeyTest

Update CHANGELOG.md

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

Adress review

 - Adjust documentation
 - Small code changes

Improve parse_escaped_value

Add initial support for an escape character

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

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

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

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

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

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

Resolves: First step in #2354

Improve value parsing

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

Add info about the esacape character to changelog

Add test cases for ParseLineKeyTest

Fix ParseLineKeyTest test cases

Also make config parser method parse_escaped_value private.

Add tests for escaped_value_parser method

Also remove unsued include statement

Simplify parse_escaped_value in config_parser

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

Fix ParseEscapedValueTest test cases

Add more test cases for ParseLineKeyTest

Adress review

 - Adjust documentation
 - Small code changes

Remove duplicate testcase from ParseLineKeyTest

Add initial support for an escape character

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

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

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

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

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

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

Resolves: First step in #2354

Improve value parsing

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

Fix ParseLineKeyTest test cases

Also make config parser method parse_escaped_value private.

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

Ref: https://stackoverflow.com/q/35770357/5363071
2021-01-26 16:20:25 +01:00
Patrick Ziegler
d5be8cad97
Add compiler warning for missing override specifier (#2341)
* build: Add -Wsuggest-override

We should always use the override specifier when overriding virtual
functions. This helps prevent errors when a subclass tries to create a
function with the same name as a virtual function in a super-class but
with a different purpose.

* clang-format

* Upload logs on failure

* Add override to unsupported.hpp

* cmake: Make -Wsuggest-override flag conditional
2021-01-04 10:38:43 +01:00
Patrick Ziegler
26be83f893
module: Implement action router (#2336)
* module: Implement proof of concept action router

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

* Make input function final

This forces all modules to use the action router

* modules: Catch exceptions in action handlers

* Use action router for all modules

* Use action_ prefix for function names

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

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

* Cleanup

* actions: Throw exception when re-registering action

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

* Formatting

* actions: Ignore data for actions without data

This is the same behavior as before.

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

* Undo my havoc on the example config

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

* feat(xworkspaces): Fully implement urgency hint

Co-authored-by: Jérôme BOULMIER <jerome.boulmier@outlook.fr>
2020-12-31 15:49:39 +01:00
Nolan Prochnau
8e46e54cb3
feat: Module Visibility (#2320)
Modules can now also be shown and hidden using ipc commands:

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

* Hopefully implement visibility checking

* Implement hide command

* Implement `show` and `toggle` commands

* Refactor and add some logging

* Run style checks and update CHANGELOG

* Get around unused parameter warnings

* Change `set_visible` to return nothing

* Make errors more informative

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

* Update bar when changing module visibility

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

* wrong var

* Update include/modules/unsupported.hpp

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

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2020-12-27 16:05:26 +01:00
patrick96
c24a6999a4 refactor(cmake): Allow targets to be enabled individually
Each major target of polybar can now be enabled/disabled while
configuring (even polybar itself).

The cmake code specific to each target will only run if the target is
enabled.

This allows us to for example just build the documentation without
having to run all the cmake code related to compilation or having the
polybar dependencies installed (other than sphinx).
2020-12-24 02:20:38 +01:00
patrick96
1dc8d2f30e cmake: Make xrandr and xcomposite required
They were required before, but could technically be deactived (the
compilation would fail, but configuration was possible).

The WITH_XRANDR and WITH_XCOMPOSITE now no longer appear in the cmake
part. It still appears in the source code, but is always set to 1

Fixes #1536
2020-12-22 00:37:07 +01:00
Jérôme BOULMIER
b143e43491 enhancement(cmake): remove all mentions of "dirs" variable 2020-12-22 00:37:07 +01:00
Jérôme BOULMIER
bb5cf0113e fix(x11): Don't include composite when disabled 2020-12-22 00:37:07 +01:00
Nolan Prochnau
0d2838fcd5
feat(xkeyboard): Add variant support to layout label (#2163)
* Add variant support to xkeyboard layout label

Solves #316

* Run style checks, I guess?

* Add comment

* Return nothing if there is no variant

* Update CHANGELOG
2020-12-19 18:22:27 +01:00
Patrick Ziegler
fd556525a8
New Tag Parser (#2303)
* refactor(color): Use enum class for color type

* Add testcases for tag parser

* Make tag parser a pull-style parser

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

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

* tag parser: First full implementation

* tag parser: Fix remaining failing tests

* tag parser: Replace old parser

* tag parser: Treat alignment as formatting tag

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

* tag parser: Cleanup type definitions

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

* Rename components/parser to tags/dispatch

* tag parser: Cleanup

* Add changelog
2020-12-17 20:37:28 +01:00
patrick96
4d2bdaa0bd
Merge branch 'hotfix/3.5.2' 2020-12-14 10:53:13 +01:00
Bjoern Hiller
7c662ec44f feat(conf) Properties for {bottom,top}-{left,right} radius 2020-12-13 17:02:23 +01:00
patrick96
94e1c64dff fix: Module type always empty string
The change in #2270 accidentally broke how we access module types.
module<Impl>::TYPE always points to the module superclass and it thus
accesses its empty TYPE field.

This mainly broke legacy action handling.

Ref #2270
2020-12-13 15:57:03 +01:00
patrick96
1c554dd0e0
Merge branch 'hotfix/3.5.1' 2020-12-12 13:28:57 +01:00
patrick96
47483a94f1 fix(process): fork_detached created zombie processes
Since the forked processes are still our children, we need to wait on
them, otherwise they become zombie processes.

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

Ref #770
2020-12-12 02:37:21 +01:00
patrick96
54e2490aa5 fix(logger): Wrong conversion function called
For some reason when passing some non-const strings to convert, the
convert(T&& arg) method was used instead of the one specialized for
strings.

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

The best solution I found was to just add a specialized function for
non-const strings.
2020-12-12 01:43:12 +01:00
patrick96
a45b5d0424 fix(build): UB when converting strings in logger
The memory returned was no longer valid because arg is destructed after
the function returns.
2020-12-12 01:43:12 +01:00
Vlad Glagolev
d665634484
Fix build with clang++ 3.4 (#2279) 2020-12-12 01:07:51 +01:00
Vlad Glagolev
f6231f351f
Add missing header (#2280) 2020-12-12 01:07:13 +01:00
Patrick Ziegler
037f6e6c45
fix(xworkspaces): Never swallow updates (#2275)
If two WM events arrive withing 25ms of one-another, the second one does
not trigger a bar update.
The module state is still correct, it is just not reflected in the bar.

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

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

Fixes #2273
2020-12-05 22:58:38 +01:00
Vlad Glagolev
3d6a7ffd4d
Fix linking when built with clang++ 3.4 (#2270) 2020-12-05 01:07:12 +01:00
patrick96
11d1c2c5c7
Merge branch 'release/3.5.0' 2020-12-02 18:12:53 +01:00
Quan
39c73a8234
feat: Warn state for cpu, memory, fs, battery modules (#2199)
* [Temperature, Ramp] fix wrong icon for temperatures near base and warn temps

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

* Fix minor error

* Added WARN state for cpu module

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

* Implement WARN state for fs module

* Simplify WARN state implementation for cpu and memory

* explicitly check percentage in get_by_percentage_with_borders

* Fixed silly error

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

* minor fixes

* fix annoying error

* use more intuitive param name

* Fix percentage with borders bug

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

* Backward Compat: use no format instead of fallback label

* Reformat

* Refactor

* Reformat

* Reformat: convert tabs to spaces

* Reformat
2020-12-02 15:55:13 +01:00
patrick96
e89da58940
fix(builder): Properly apply alpha for fg and bg
It was not quite clear how try_apply_alpha should behave if the given
color was not ALPHA_ONLY. The implementation just returned 'this'.
However, the build relied on it returning the given color.

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

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

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

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

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

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

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

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

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

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

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

Failing early here is a good idea.
2020-11-26 21:06:35 +01:00
patrick96
ff3340e062 controller: Cleanup process_inputdata 2020-11-26 20:53:53 +01:00
patrick96
191fb2972c actions: Integrate input_handler into module
Only modules can now be action handlers.
This also slightly simplifies the controller because we don't need to
keep track of input handlers, we can just use the module list.
2020-11-26 20:53:53 +01:00
patrick96
41ffc3607d controller: Make action shell command local 2020-11-26 20:53:53 +01:00
patrick96
9fb75779f3 Incorporate reviews 2020-11-26 20:53:53 +01:00
patrick96
5ddb6fc0c5 Move legacy action handling to separate function 2020-11-26 20:53:53 +01:00
patrick96
507004df87 actions: Move parsing to utility file 2020-11-26 20:53:53 +01:00
patrick96
ef8f7c9d94 feat(menu): Add exec action to menu module
Can be used to execute menu actions through ipc and will also be used to
make sure the menu closes when an action on it is clicked.
2020-11-26 20:53:53 +01:00
patrick96
bc1b86c584 actions: Separate data from action string
Modules now no longer need to manually parse the action string and
extract data from it.
2020-11-26 20:53:53 +01:00
patrick96
8acedeef87 modules: Fix resolving of type of disabled modules 2020-11-26 20:53:53 +01:00
patrick96
ae2350167b actions: Switch all modules over to new system
All modules now expose their actions as public static constants

Issues: The menu module no longer closes when an item is clicked (before
it would intercept any executed command and look if it matches one of
its exec commands)
2020-11-26 20:53:53 +01:00
patrick96
816b73a95f actions: Add utility functions to produce action tags 2020-11-26 20:53:53 +01:00
patrick96
d592eea966 refactor: Move module type string into modules
This allows us to identify module by their type and it is also better to
store the module type as part of the module instead of having it
hardcoded in factory.hpp
2020-11-26 20:53:53 +01:00
patrick96
06012af3aa controller: Deliver inputs to all input handlers
This is more natural, especially if the same module appears twice in the
module list
2020-11-26 20:53:53 +01:00
patrick96
4b5007294b refactor(modules): Make all modules input handlers
By default they will return false for calls to `input`
2020-11-26 20:53:53 +01:00
patrick96
457e37faaf fix: add name_raw to unsupported modules 2020-11-26 20:53:53 +01:00
patrick96
a287fb5e8c fix: Use module name in action string
Action strings now have the form '#MODULE#ACTION'

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

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

Fixes #1172
2020-11-26 20:53:53 +01:00
patrick96
22d0f0a38c refactor(builder): Remove unused arguments 2020-11-26 20:53:53 +01:00
patrick96
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