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).
The scroll handler had two issues:
* It did not respect the order the desktops where displayed in
* It would not wrap around on the first desktop because of an integer
underflow
Fixes#2491
* 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>
* fix(monitor): do not include outputs when monitors are supported
Previously, when splitting an output into two monitors, `polybar -m`
would report both the splitted monitors and the output. This was not
caught by the the clone detection as the detection works by removing
monitors contained into another monitors (and monitors were excluded
from that logic) and we want the other way around: outputs covered by
monitors should be ignored.
Instead of trying to detect covered outputs, the solution is quite
simple: when monitors are supported, do not consider outputs, unless
we request all outputs. A monitor can be set primary (and RandR
reports primary outputs as primary monitors). The only information we
would miss from monitors are things like refresh rate and EDID. We
don't need that, so we are fine.
As monitors are only created for connected output (and they are in
this case "active") or disconnected output if they are mapped (and
they are in this case "inactive"), I am a bit unsure if we have
exactly the same behaviour as previously when `connected_only` is set
to `false`.
As some modules require an output, we keep the output in the
`monitor_t` structure and we ensure it is correctly set when using
monitors. A monitor can have 0 or several outputs. We only handle the
0 and 1 cases. When a monitor has more outputs, only the first one is
used. AFAIK, only the xbacklight module needs that and I think we are
fine waiting for a user needing this module and merging monitors.
The C++ binding fail to expose the `outputs()` method to iterate over
the outputs of a monitor. This seems to be a bug in XPP. The field is
correctly defined in the RandR XML file and it works with the Python
binding.
```xml
<struct name="MonitorInfo">
<field type="ATOM" name="name" />
<field type="BOOL" name="primary" />
<field type="BOOL" name="automatic" />
<field type="CARD16" name="nOutput" />
<field type="INT16" name="x" />
<field type="INT16" name="y" />
<field type="CARD16" name="width" /> <!-- pixels -->
<field type="CARD16" name="height" /> <!-- pixels -->
<field type="CARD32" name="width_in_millimeters" />
<field type="CARD32" name="height_in_millimeters" />
<list type="OUTPUT" name="outputs">
<fieldref>nOutput</fieldref>
</list>
</struct>
```
Falling back to C only to access the list of outputs is not enough
because the list is appended to the structure and not visible through
the public API. When copied, the structure loses the list of monitors.
Also, change the mention "XRandR monitor" to "no output" when there is
no output attached. People using monitors know what it means and it is
useful to catch a future regression where we don't have an output at
all (which would break the brightness plugin).
Fix#2481
* Update CHANGELOG.md
Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
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>
* 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