Commit Graph

952 Commits

Author SHA1 Message Date
dvermd
231af35354
feat(ipc): hook, prev, next, reset module actions (#2528)
* WIP ipc actions

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

Closes: #2464

* ipc: format code

* ipc: fix comparison

* Apply suggestions from code review

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

* ipc: make index 0-based

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

* ipc: restore 1-based index for  and  message

* ipc: fix initial=0 throwing an error

Co-authored-by: Martin Terneborg <martinterneborg@protonmail.com>
Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-10-10 20:22:24 +02:00
dvermd
47b5910eda
Allow running polybar without BAR argument (#2526)
* Allow running polybar without BAR argument

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

* Check barname not in config and improve error message

* Revert README changes

* Add no bar in config file error detection
2021-10-07 14:48:47 +02:00
Patrick Ziegler
282b0f4e73
Create default config (#2511)
* Create default config and install to /etc/polybar

Closes #2405

* Search for config in /etc

We search in XDG_CONFIG_DIRS, /etc/xdg, and /etc but only for config.ini

Closes #2016

* Remove config installation from build.sh

* Remove userconfig cmake file

* Cleanup

* Cleanup default config

* Update CHANGELOG.md

Co-authored-by: dvermd <315743+dvermd@users.noreply.github.com>

* Update src/main.cpp

Co-authored-by: dvermd <315743+dvermd@users.noreply.github.com>

* Add tests for string functions

* Support loading bars from fallbacks in /etc

* Combine duplicate string_util::contains test

Co-authored-by: dvermd <315743+dvermd@users.noreply.github.com>
2021-10-05 13:07:19 +02:00
dvermd
98dffc292a
feat(xkeyboard): Icon matching using variant (#2521)
* feat(string_util): add contains_nocase

* feat(xkeyboard): Enable icon by variant

* Cleanup

* string_util: add some cases to string test

* string_util: rename contains_nocase -> contains_ignore_case

* layouticonset: use contains_ignore_case

* layouticonset: apply renamings and remove dead code

* remove VARIANT_NONE and use empty string instead

* use emplace_back and add assert

* layouticonset: precompute condition

* xkeyboard: restore missing continue

* Cleanup parse_icons

* Always choose the first case-insensitive match

* Cleanup layouticonset.get

* update the changelog

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

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

* config_parser: Add file name and line number to invalid_name_error

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

* made inputdata to queue<string>

* changed back to front

* fixed move semantics issue while popping queue

* Removed ide file

* commented test lines

* review changes

* review changes

* Update CHANGELOG.md

* Cleanup

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

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

Fixes #2519
2021-10-03 03:18:39 +02:00
Patrick Ziegler
444120e664
script: Fix concurrency issues (#2518)
Fixes #1978

* Move tail and non-tail handler to method

Defining them in the constructor is ugly.

* script: Iterate over defined actions instead of fixed list

* Separate running logic and lock m_output

* Include POLYBAR_FLAGS in linker flags

* Stop using m_prev in script_runner

* Join module threads in stop function

Joining in the destructor may lead to UB because the subclass is already
deconstructed but the threads may still require it to be around (e.g.
for calling any functions on the instance)

* Cleanup script module

* Update changelog

* Remove AfterReturn class

* Remove m_stopping from script module

* Fix polybar not reading the entire line from child process.

For every `readline` call we created a new fd_streambuf. This means once
`readline` returns, the streambuf is destructed and and pending data in
its temporary buffer discarded and we never actually read it.

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

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

then `get_with_prefix("env-")` will return
`[{"FOO", "bar"}, {"CAT", "dog"}]`
2021-09-28 22:16:07 +02:00
Patrick Ziegler
8afd5b71df
Integrate bar taskqueue into eventloop (#2510)
* Remove DEBUG_SHADED

Was disabled by default AND behind an #if 0

* Make TimerHandle expose more libuv functions

* Prepare for moving double clicks into eventloop

* Make eventloop available to bar

* Remove bar mutex

Everything in the bar is now in the same thread

* Move double-click handling to eventloop

* Extract double click deferred function into method

* Stop throttling clicks

* Increase double click interval to 400 and add option

double-click-interval in the bar section

Closes #1441

* Implement dimming using timer handles

* Remove taskqueue

* Remove unused dependencies

* Cleanup & Comments
2021-09-27 17:35:45 +02:00
TheDoctor314
55eb19fdc7
feat(ramp): Allow specifying ramp weights (#2505)
* feat(ramp) Implement ramp weights

*Add test for ramp weights

*[drawtypes/ramp] Implement ramp weights

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

*Fix silly bug

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

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

*doc: add #1750 to CHANGELOG

* Fix compile error in ramp test

Use std::make_shared.
2021-09-22 21:46:20 +02:00
patrick96
fa1240f4b6 Remove unused file_ptr 2021-09-21 21:43:27 +02:00
patrick96
3b6a950380 Remove unused factory.hpp imports 2021-09-21 21:43:27 +02:00
patrick96
0d1db206c6 Remove factory_util unique and shared
Equivalent to std::make_unique and std::make_shared
2021-09-21 21:43:27 +02:00
patrick96
98919cbb77 Remove unused moodycamel concurrentqueue 2021-09-21 21:43:27 +02:00
patrick96
c922a94b67 Remove unused spin_lock 2021-09-21 21:43:27 +02:00
patrick96
0f72a2e0ea Remove unused throttle_util 2021-09-21 21:43:27 +02:00
patrick96
386eb57ba7 Reopen pipe path on EOF 2021-09-21 20:36:23 +02:00
patrick96
77b9cffaf8 Cleanup 2021-09-21 20:36:23 +02:00
patrick96
a158f0d7ec Add error callback for ipc handle 2021-09-21 20:36:23 +02:00
patrick96
895c1a6b51 Handle fs_event and poll errors in handle wrapper 2021-09-21 20:36:23 +02:00
patrick96
db52106934 Support receiving IPC messages in multiple parts 2021-09-21 20:36:23 +02:00
patrick96
dd4088910e Deprecate throttle-output and throttle-output-for
The eventloop no longer uses them. libuv will coalesces multiple
uv_async_send if they happen one after another and this also leads to
coalescing of updates.
2021-09-21 20:36:23 +02:00
patrick96
511e73b3b5 Close handles in destructor 2021-09-21 20:36:23 +02:00
patrick96
91759a4c96 Store all handles inside eventloop
This is needed because the handle's lifetime has to be at least the
lifetime of the eventloop since the eventloop requires the handle's
memory during shutdown (for closing the handles).
2021-09-21 20:36:23 +02:00
patrick96
2551ea0205 Add wrapper for uv_async_t 2021-09-21 20:36:23 +02:00
patrick96
7b5285b51e Add wrapper for uv_timer_t 2021-09-21 20:36:23 +02:00
patrick96
309fd8221a Create wrapper for uv_pipe_t 2021-09-21 20:36:23 +02:00
patrick96
86f02a3ebe controller: Fix missing import 2021-09-21 20:36:23 +02:00
patrick96
6d3bb2211e Only trigger async once eventloop has been setup 2021-09-21 20:36:23 +02:00
patrick96
2c7af2a60c Store reload flag in controller 2021-09-21 20:36:23 +02:00
patrick96
ce63305c1d Better way to notify controller 2021-09-21 20:36:23 +02:00
patrick96
e3cb94ef88 Use uv timer for delayed screenshot 2021-09-21 20:36:23 +02:00
patrick96
6ac5b7ebdd Remove config inotify_watch
We use libuv now for watching the file
2021-09-21 20:36:23 +02:00
patrick96
ba50bf0bc6 controller: Remove m_process_events field 2021-09-21 20:36:23 +02:00
patrick96
75ff5c3b14 Remove exit_terminate signal 2021-09-21 20:36:23 +02:00
patrick96
b9642e4cf3 Move update events to eventloop
We can now completely remove the eventqueue thread
2021-09-21 20:36:23 +02:00
patrick96
f36224eaab Move quit event to eventloop 2021-09-21 20:36:23 +02:00
patrick96
ba341f584e Remove CHECK event
Not used
2021-09-21 20:36:23 +02:00
patrick96
c89fc7f73b Handle click commands in eventloop 2021-09-21 20:36:23 +02:00
patrick96
88cd525dc8 Add wrapper for uv_pipe_t 2021-09-21 20:36:23 +02:00
patrick96
9d9fe8bffb Better error handling 2021-09-21 20:36:23 +02:00
patrick96
53ce1ae414 Move config watcher into eventloop 2021-09-21 20:36:23 +02:00
patrick96
f9d434052a Make UV handle wrappers more generic 2021-09-21 20:36:23 +02:00
patrick96
60ee63c0db eventloop: Throw exception for libuv errors 2021-09-21 20:36:23 +02:00
patrick96
3cc17a0e57 Move signal handling to eventloop class 2021-09-21 20:36:23 +02:00
patrick96
a2f50f3b90 Use uv_pipe_t for ipc 2021-09-21 20:36:23 +02:00
patrick96
249c3ec141 Use libuv for the controller's event loop 2021-09-21 20:36:23 +02:00
patrick96
2512123a6c
Merge remote-tracking branch 'origin/hotfix/3.5.7' 2021-09-21 18:22:57 +02:00
patrick96
6136c08d42 tray: Properly handle missing _XEMBED_INFO
The icon not supporting XEMBED is not fatal, we just treat is as always
mapped.

Fixes #2479
Fixes #2442
2021-09-13 00:12:33 +02:00
Patrick Ziegler
5011e66346
fix(net): Check if interface is valid first. (#2497)
Fixes #2496
2021-09-09 21:47:23 +02:00
Luca Maltagliati
ddabe3f0f4
feat(memory): Tokens that switch between MiB and GiB (#2488)
* feat:add tokens to display memory in MiB when GiB val <= 1.0 (#2472)

* fix: correct swap_used calculation

* fix: pass variable by reference rather than by value

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

* doc: add #2472 to CHANGELOG

* fix: missing default argument values

* Apply suggestions from code review

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

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

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

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

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

Fix #2455

* Use actions for sending data to ipc module

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

* Update src/modules/ipc.cpp

Co-authored-by: patrick96 <p.ziegler96@gmail.com>
2021-07-11 20:42:28 +02:00
Nolan Prochnau
06932007a0
Universal Visibility Action (#2320 cont'd) (#2426)
* Add toggle_visible action

* Add set_visible and set_invisible actions

* Rename toggle_visible method to match

`action_toggle_visible` -> `action_toggle_visibility`

Matches with `EVENT_TOGGLE_VISIBILITY`

* Update CHANGELOG

* Revert #2320 IPC commands

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

* Add logging and change action names

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

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

* Update documentation
2021-07-07 21:43:49 +02:00
Flexlolo
735a08ba7c
feat(bspwm): Option to scroll through occupied desktops only (#2428)
* Implement option occupied-scroll to bspwm module

* update changelog

* change default value of the setting
2021-05-13 12:59:13 +02:00
Ian Welker
97759ce585 Fixed issues with border corner radii 2021-03-29 20:17:48 +02:00
patrick96
93ab639c8a fix: unbounded_percentage always rounded down
For example if lower / upper = 0.019 (1.9%), it would return 1% instead
of 2%

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

Includes polybar/xpp#31
Fixes #2398
2021-03-03 22:34:38 +01:00
patrick96
3f03b671bb fix(color): Rename type() function to get_type
In gcc5, this caused compilation errors because the type enum has the
same name.
2021-03-01 00:05:44 +01:00
Simon
cd71b96cf8
feat: Rounded bar border (#2359)
* Added rounded border

* Added feature to the changelog

* Changed implementation for better customisation

* Bugfixes

* Removed commented code

* Removed unused method

* Removed duplicate lines

* Moved degree to be a private constant

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

* added to changelog

* added to changelog 2

* added to changelog 3
2021-02-16 10:02:33 +01:00
Jérôme BOULMIER
529843b6ba
Remove undefined behaviors and clean code (#1769)
* fix: avoid memory leaks in case of exceptions.

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

* cleanup: remove double checks

* fix: remove memory leaks

* cleanup(xresources): capture exception by reference

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-02-15 23:32:56 +01:00
zappolowski
99900323b7
feat(conf): Option to always show urgent workspaces in i3 (#2378)
When `pin-workspaces` is set to true using `show-urgent` will show
urgent workspaces on the bar even when the workspace is not associated
with the current monitor.
2021-02-15 21:31:34 +01:00
patrick96
cfc6f3b45f Finish action_context tests 2021-02-12 20:01:22 +01:00
patrick96
c4fbf0023e Move action_context into separate file 2021-02-12 20:01:22 +01:00
patrick96
7a9f301830 Throw exception for unclosed action tags 2021-02-12 20:01:22 +01:00
patrick96
cd1d4fa183 Stop tracking action blocks in renderer
Dispatch can now directly get the current position from the renderer and
create action blocks with the proper coordinates.
2021-02-12 20:01:22 +01:00
patrick96
b5bdbdf6cb Add action_context tests 2021-02-12 20:01:22 +01:00
patrick96
d89096c191 Remove tag headers from signal.hpp 2021-02-12 20:01:22 +01:00
patrick96
7a569c4b98 Remove mousebtn argument from action_open 2021-02-12 20:01:22 +01:00
patrick96
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