Commit Graph

2114 Commits

Author SHA1 Message Date
Madhav Prabhu C M
e5ab7e1c00
Notification string to a queue of strings (#2517)
Fixes #2469

* made inputdata to queue<string>

* changed back to front

* fixed move semantics issue while popping queue

* Removed ide file

* commented test lines

* review changes

* review changes

* Update CHANGELOG.md

* Cleanup

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

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

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

* Move tail and non-tail handler to method

Defining them in the constructor is ugly.

* script: Iterate over defined actions instead of fixed list

* Separate running logic and lock m_output

* Include POLYBAR_FLAGS in linker flags

* Stop using m_prev in script_runner

* Join module threads in stop function

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

* Cleanup script module

* Update changelog

* Remove AfterReturn class

* Remove m_stopping from script module

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

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

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

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

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

Was disabled by default AND behind an #if 0

* Make TimerHandle expose more libuv functions

* Prepare for moving double clicks into eventloop

* Make eventloop available to bar

* Remove bar mutex

Everything in the bar is now in the same thread

* Move double-click handling to eventloop

* Extract double click deferred function into method

* Stop throttling clicks

* Increase double click interval to 400 and add option

double-click-interval in the bar section

Closes #1441

* Implement dimming using timer handles

* Remove taskqueue

* Remove unused dependencies

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

*Add test for ramp weights

*[drawtypes/ramp] Implement ramp weights

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

*Fix silly bug

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

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

*doc: add #1750 to CHANGELOG

* Fix compile error in ramp test

Use std::make_shared.
2021-09-22 21:46:20 +02:00
patrick96
98d9a882ea Fix polybar-msg compilation 2021-09-21 21:43:27 +02:00
patrick96
fa1240f4b6 Remove unused file_ptr 2021-09-21 21:43:27 +02:00
patrick96
3b6a950380 Remove unused factory.hpp imports 2021-09-21 21:43:27 +02:00
patrick96
fabce6a493 Add tests for env_util 2021-09-21 21:43:27 +02:00
patrick96
0d1db206c6 Remove factory_util unique and shared
Equivalent to std::make_unique and std::make_shared
2021-09-21 21:43:27 +02:00
patrick96
560065540b Fix wrong assertion on network interface 2021-09-21 21:43:27 +02:00
patrick96
98919cbb77 Remove unused moodycamel concurrentqueue 2021-09-21 21:43:27 +02:00
patrick96
c922a94b67 Remove unused spin_lock 2021-09-21 21:43:27 +02:00
patrick96
0f72a2e0ea Remove unused throttle_util 2021-09-21 21:43:27 +02:00
patrick96
069036fa5a Add libuv to polybar-git PKGBUILD 2021-09-21 20:36:23 +02:00
patrick96
c29e4837df clang-format 2021-09-21 20:36:23 +02:00
patrick96
21f6f7818a Update CHANGELOG.md 2021-09-21 20:36:23 +02:00
patrick96
85d308cec8 Use libuv >= 1.3.0 2021-09-21 20:36:23 +02:00
patrick96
386eb57ba7 Reopen pipe path on EOF 2021-09-21 20:36:23 +02:00
patrick96
77b9cffaf8 Cleanup 2021-09-21 20:36:23 +02:00
patrick96
a158f0d7ec Add error callback for ipc handle 2021-09-21 20:36:23 +02:00
patrick96
52a3961602 Poll for X events in while loop
Otherwise we would only read a single event, even if multiple were
available causing delays.
2021-09-21 20:36:23 +02:00
patrick96
895c1a6b51 Handle fs_event and poll errors in handle wrapper 2021-09-21 20:36:23 +02:00
patrick96
db52106934 Support receiving IPC messages in multiple parts 2021-09-21 20:36:23 +02:00
patrick96
dd4088910e Deprecate throttle-output and throttle-output-for
The eventloop no longer uses them. libuv will coalesces multiple
uv_async_send if they happen one after another and this also leads to
coalescing of updates.
2021-09-21 20:36:23 +02:00
patrick96
511e73b3b5 Close handles in destructor 2021-09-21 20:36:23 +02:00
patrick96
91759a4c96 Store all handles inside eventloop
This is needed because the handle's lifetime has to be at least the
lifetime of the eventloop since the eventloop requires the handle's
memory during shutdown (for closing the handles).
2021-09-21 20:36:23 +02:00
patrick96
2551ea0205 Add wrapper for uv_async_t 2021-09-21 20:36:23 +02:00
patrick96
7b5285b51e Add wrapper for uv_timer_t 2021-09-21 20:36:23 +02:00
patrick96
309fd8221a Create wrapper for uv_pipe_t 2021-09-21 20:36:23 +02:00
patrick96
86f02a3ebe controller: Fix missing import 2021-09-21 20:36:23 +02:00
patrick96
6d3bb2211e Only trigger async once eventloop has been setup 2021-09-21 20:36:23 +02:00
patrick96
2c7af2a60c Store reload flag in controller 2021-09-21 20:36:23 +02:00
patrick96
ce63305c1d Better way to notify controller 2021-09-21 20:36:23 +02:00
patrick96
e3cb94ef88 Use uv timer for delayed screenshot 2021-09-21 20:36:23 +02:00
patrick96
6ac5b7ebdd Remove config inotify_watch
We use libuv now for watching the file
2021-09-21 20:36:23 +02:00
patrick96
ba50bf0bc6 controller: Remove m_process_events field 2021-09-21 20:36:23 +02:00
patrick96
75ff5c3b14 Remove exit_terminate signal 2021-09-21 20:36:23 +02:00
patrick96
07da1a2967 Stop using sigabbrev_np
GNU extension
2021-09-21 20:36:23 +02:00
patrick96
b9642e4cf3 Move update events to eventloop
We can now completely remove the eventqueue thread
2021-09-21 20:36:23 +02:00
patrick96
f36224eaab Move quit event to eventloop 2021-09-21 20:36:23 +02:00