The segfaults were happening on GTK icon theme functions, which are
called via the C++ interface functions such as Gtk::IconTheme::has_icon.
There are multiple modules and threads using this functions on the default
icon theme by calling Gtk::IconTheme::get_default(), which returns the same
object for all callers, and was causing concurrent access to the same internal
data structures on the GTK lib. Even a seemingly read-only function such as
has_icon can cause writes due to the internal icon cache being updated.
To avoid this issues, a program wide global mutex must be used to ensure
a single thread is accessing the default icon theme instance.
This commit implements wrappers for the existing IconTheme function calls,
ensuring the global lock is held while calling the underling GTK functions.
After upgrading to the latest release of Waybar the bar will crash
whenever I close the laptop lid. After some debugging I believe it is
because the watching added by watch_name is not being correctly canceled
using unwatch_name. After the Tray object and Host object are destroyed,
additional callbacks will become use-after-free.
Looks like commit 3af1853260 removed the
unwatch_name. I'm not sure why it did that, but it seemed dangerous.
Additionally, bus_name_id_ is created by own_name. According to that
function's documentation, the correct inverse operation is unown_name.
This commit allows better handling of ordering and exclusion of the tags in Dynamics tags.
It also becomes possible to choose the separator between the tags.
The option is generally useful when scrolling is used, when configuring
input devices to use "natural scroll direction".
Both backlight and pulseaudio were using different implementations, this
unifies and documents them.
Signed-off-by: Robert Günzler <r@gnzler.io>
In waybar::modules::Battery::~Battery(), store a copy of the batteries_
iterator before calling erase(), as erase() invalidates the iterator.
Prior to this change, disconnecting outputs resulted in a SEGFAULT when
using the battery module; e.g.,
[debug] Received SIGCHLD in signalThread
[debug] Cmd exited with code 0
[debug] Received SIGCHLD in signalThread
[debug] Cmd exited with code 0
[debug] Received SIGCHLD in signalThread
[debug] Cmd exited with code 0
[debug] Output removed: AU Optronics 0x2336
[info] Bar configured (width: 1280, height: 25) for output: eDP-1
[info] Bar configured (width: 1280, height: 25) for output: eDP-1
zsh: segmentation fault (core dumped) ./build/waybar -l trace
Signed-off-by: Lukas Fleischer <lfleischer@lfos.de>
Checking against names for volume changes seems a bit weird to me and
also didn't really work, so I've made use of node_id_ to check against
this instead and also fixed an issue, where the volume update would
refuse to do its thing despite it being the same id that was used on launch.
Covers the use case where needing to exclude more than 1 output but
still include all other displays.
e.g. I have 3 monitors: laptop + HD + 4K; and 3 bar types:
- The main bar is on the laptop. `output: "laptop-monitor-id"`
- The 4K has a specific waybar bar-1 configuration. `output: "4K-monitor-id"`
- I want all other displays (3rd HD monitor / any HDMI output when presenting)
to have a plain bar: `output: ["!laptop-monitor-id", "!4k-monitor-id", "*"]`
some users (maybe only myself) may want to sort the task bar by app_id
which then places occurrences of the same task next to each other.
Signed-off-by: Louis DeLosSantos <louis.delos@gmail.com>
When freeing the `default_node_name_` pointer using `free`, the `&`
operator was used to try to free the reference rather than the pointer.
This caused a core dump. In order to fix this, the pointer is freed
instead (ie the `&` operator is no longer used).
Second argument of substr is the length of the substring, _not_ the position. With positions, it's better to do like this.
Example:
```sh
[2023-01-29 13:08:00.927] [debug] hyprland IPC received activelayout>>ITE Tech. Inc. ITE Device(8910) Keyboard,Russian (with Ukrainian-Belorussian layout)
[2023-01-29 13:08:00.927] [debug] kbName is ITE Tech. Inc. ITE Device(8910) Keyboard,Russian (with
```
After the fix it's correct:
```sh
[2023-01-29 13:11:11.408] [debug] hyprland IPC received activelayout>>ITE Tech. Inc. ITE Device(8910) Keyboard,Russian (with Ukrainian-Belorussian layout)
[2023-01-29 13:11:11.408] [debug] kbName is ITE Tech. Inc. ITE Device(8910) Keyboard
```
In order to fix the issue, the default node name is cached rather than
the default node id. This is due to ids being unstable. So now when the
object manager is installed (ie ready), the default node name is
retrieved and stored for later.
Now when the mixer changed signal is emitted, the id of the changed node
is used to get the node from the object manager. The nodes name is
grabbed off that node and compared against the default node name, if
they match the volume is updated. Some safeguarding has been added such
that if the node cannot be found off the object manager, it's ignored.
Additionally, the "changed" signal on the default nodes api is now
utilized to update the default node name if it has changed. This way if
the default node changes, the module will be updated with the correct
volume and node.nick.
This adds additional debug logging for helping diagnose wireplumber
issues.
This also adds the wireplumber man page entry to the main waybar
supported section.
adds the set-tags and toggle-tags setting so it's possible to have
different tags set vs toggled. This enables the use of e.g. sticky tags
Also clean-up the code a bit.
Provides CSS classes empty, floating, tabbed, tiled, solo, stacked and
app_id.
Adds offscreen-css bool option (default false), only effective when
"all-outputs" is true. This adds styles on outputs without focused
node, according to its focused workspaces window situation.
Adds an "offscreen-css-text" string option (default empty), only
effective when "all-outputs" and "offscreen-style" are set. This
is shown as a text on outputs without a focused node.
Adds a "show-focused-workspace" bool option (default false) to indicate
the workspace name if the whole workspace is focused when nodes are
also present. If not set, empty text is shown, but css classes
according to nodes in the workspace are still applied.
Limitation:
When the top level layout changes, there is no sway event so the
module cannot react. Perhaps in the future recurring polling can
be added to go around this limitation.
for users who do not utilize any form of "workspace prev/next" commands,
it can be very handle to sort the workspaces alphabetically.
this commit adds a new "alphabetical_sort" to the `sway/workspaces`
module which allows the module to alway sort workspaces alphabetically.
this docs are updated to warn the user of the implications involved.
Signed-off-by: Louis DeLosSantos <louis.delos@gmail.com>
1. Calendar. Weeks. Fix right paddings when first days of the week is
Monday
2. Fix small perfomrance penalty(avoid of defining parameter in the
month loop)
3. Small name convention for format string variables
1. Let's do code simplier
2. Week format using regexp. Needs when user provide additional
characters in format string and need to align week days according
3. Week format has got default formats: ":%U",":%V"
4. Week number is based on the first day of the week now. The output is
the same as of date library now.
5. Avoiding of unnecessary operations
fix their format to correct
fix last number hide if the last day of the month is the last day of the week
some refactoring(mostly renaming abbreviations to the full phrases)
Linux power_supply sysfs interface allows checking if the battery powers
the whole system or a specific device/tree of devices with `scope`
attribute[1]. We can use it to skip the non-system power supplies in the
battery module and avoid adding HIDs or other peripheral devices to the
total.
The logic is based on UPower, where it is assumed that "Unknown" devices
or devices without a `scope` are system power supplies.
[1]: https://lore.kernel.org/lkml/alpine.LNX.2.00.1201031556460.24984@pobox.suse.cz/T/
The current output form of `hyprctl devices` is like this:
```
Keyboard at 6f80ad70:
ITE Tech. Inc. ITE Device(8910) Keyboard
rules: r "", m "", l "us,ru", v "", o "grp:alt_shift_toggle"
active keymap: Russian
main: no
```
That is, `Keyboard at` goes _before_ the keyboard name, so looking for `Keyboard at` only makes it skip to the keyboard _after_ the one that the user specified.
This fixes#1811 by falling back to `node.description` if `node.nick` is
not available. This can happen for bluetooth devices that do not have a
`node.nick`.
Adds basic icon support for the wireplumber module.
This can be achieved by using `{icon}` in the `format` config and
pairing it with the `format-icons` config as well.
Example:
```
"wireplumber": {
"format": "{volume}% {icon}",
"format-icons": ["", "", ""]
}
```
The first crash occurs when trying to parse the
ID of a workspace as an uint, since named
workspaces has negative IDs. This is fixed by
using ints for workspace IDs instead of uints.
The second crash occurs when converting a
workspace name that isn't a number to an integer.
This is fixed by wrapping std::stoi in a try
block and only sorting by number, when both names
can successfully be converted to integers.
Adds basic support for showing volume via wireplumber. Allows specifying
the node-id or falling back to the default Audio/Sink node id if node-id
is not set. If tooltip on hover is enabled, will show `{node_name}` by
default otherwise `tooltip-format`.
Format replacements:
`{volume}` - Volume in percentage
`{node_name}` - The node's nickname (`node.nick` property)