Skip to content
Open
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
ecc3bc6
Added wireplumber mixer widget
Nov 2, 2025
43f4a71
Added scroll control in full mixer
Nov 2, 2025
f8d67cd
Added middle click to mute
Nov 2, 2025
87a0307
add configuration options for wireplumber widget
Nov 2, 2025
4191389
uncrustify and style compliance
Nov 3, 2025
56e8150
uncrustify ?
Nov 3, 2025
81bfaf3
remove section of the code pending on pr 306 (extra options)
Nov 3, 2025
c1c89c0
uncrustify ; though i cannot agree oops lol
Nov 3, 2025
e3d2ec2
Revert "remove section of the code pending on pr 306 (extra options)"
Nov 3, 2025
4b1cc62
remove logic pertaining to pr 306 (vertical panel layouts)
Nov 3, 2025
025f524
fixed include in animated-scale.cpp
Nov 3, 2025
51a9ada
add popup on change option
Nov 3, 2025
4e8e892
added support for mute gestures to individual control
Nov 3, 2025
5cb1eda
added defaults, fallbacks and corrected compliance with config options
Nov 3, 2025
35f0f21
fix scroll gesture, malformed panel.xml
Nov 3, 2025
d1dca46
cleaned up a bit middle click to mute
Nov 3, 2025
d64f5ac
fixed improper naming of on -> handle_config_reload
Nov 3, 2025
fd41700
removed obsolete functions
Nov 3, 2025
679f144
fixed left click actions on widget ; comments
Nov 3, 2025
8f61bcc
added deselection guard for default + explanation
Nov 4, 2025
43281ba
adjust logic of updates in on_mixer_changed ; removed unused enum ; c…
Nov 4, 2025
1afacc0
cleaup
Nov 6, 2025
b006c9d
fix popover jank and incorrect settings reloading
Nov 6, 2025
6f8cd5b
uncrustify
Nov 6, 2025
4435efa
fixed gestures connection both in control and widget ; cleanup
Nov 6, 2025
af82be8
lil forgotten
Nov 6, 2025
5c91450
uncrustify
Nov 6, 2025
400e895
fixed doubling in existing widgets when catching up new one
Nov 16, 2025
a110040
de-duplicated icon_name_from_state
Nov 16, 2025
c51f510
removed non breaking space and french quotes from comments
Nov 16, 2025
22b4bdb
use std::string_view for string comparison
Nov 16, 2025
affc7b9
fixed configuration to use .value() missed it oops
Nov 16, 2025
b7ee367
unique instead of raw pointers
Nov 16, 2025
e048578
separators and labels not by new
Nov 16, 2025
c38b0b9
add autos, make construction less barbaric
Nov 16, 2025
a35d60b
cleanup
Nov 16, 2025
45342f0
exported volumelevel and icons to be common between volume and wirepl…
Nov 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ wfconfig = dependency('wf-config', version: '>=0.7.0') #TODO fallback submodule
epoxy = dependency('epoxy')
gtklayershell = dependency('gtk4-layer-shell')
libpulse = dependency('libpulse', required: get_option('pulse'))
wireplumber = dependency('wireplumber-0.5', required: get_option('wireplumber'))
dbusmenu_gtk = dependency('dbusmenu-glib-0.4')
libgvc = subproject('gvc', default_options: ['static=true'], required: get_option('pulse'))

Expand All @@ -33,6 +34,10 @@ if libpulse.found()
add_project_arguments('-DHAVE_PULSE=1', language: 'cpp')
endif

if wireplumber.found()
add_project_arguments('-DHAVE_WIREPLUMBER=1', language: 'cpp')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use spaces here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now, apologies if i am somehow getting this wrong, but it seems other indentation in this file uses tabs ? such as the above libpulse check

endif

needs_libinotify = ['freebsd', 'dragonfly'].contains(host_machine.system())
libinotify = dependency('libinotify', required: needs_libinotify)

Expand Down
8 changes: 7 additions & 1 deletion meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ option(
value: 'auto',
description: 'Build pulseaudio volume widget',
)
option(
'wireplumber',
type: 'feature',
value: 'auto',
description: 'Build wireplumber and mixer widget',
)
option(
'wayland-logout',
type: 'boolean',
value: true,
description: 'Install wayland-logout',
)
)
88 changes: 88 additions & 0 deletions metadata/panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,94 @@
</option>
</group>
<group>
<_short>Wireplumber mixer</_short>
<option name="wp_popup_on_change" type="bool">
<_short>Pop up on change</_short>
<_long>
Wether to show a popup with the new values upon a change to the quick action target
</_long>
<default>true</default>
</option>
<option name="wp_display_timeout" type="double">
<_short>Display timeout</_short>
<default>2.5</default>
</option>
<option name="wp_scroll_sensitivity" type="double">
<_short>Scroll sensitivity</_short>
<default>1</default>
</option>
<option name="wp_invert_scroll" type="bool">
<_short>Invert scroll</_short>
<_long>
Inverts which scroll direction raises and lowers volume
</_long>
<default>false</default>
</option>
<option name="wp_face_choice" type="string">
<_short>Quick action target</_short>
<_long>
Which audio control will be the target of the "Quick action" (choice for the click action)
</_long>
<default>last_change</default>
<desc>
<value>last_change</value>
<_name>Last changed volume</_name>
</desc>
<desc>
<value>default_sink</value>
<_name>Default sink</_name>
</desc>
<desc>
<value>default_source</value>
<_name>Default source</_name>
</desc>
</option>
<option name="wp_left_click_action" type="string">
<_short>Left click action</_short>
<default>show_mixer</default>
<desc>
<value>show_mixer</value>
<_name>Show full mixer</_name>
</desc>
<desc>
<value>show_face</value>
<_name>Show quick action target</_name>
</desc>
</option>
<option name="wp_middle_click_action" type="string">
<_short>Middle click action</_short>
<default>mute_face</default>
<desc>
<value>show_mixer</value>
<_name>Show full mixer</_name>
</desc>
<desc>
<value>show_face</value>
<_name>Show quick action target</_name>
</desc>
<desc>
<value>mute_face</value>
<_name>Mute quick action target</_name>
</desc>
</option>
<option name="wp_right_click_action" type="string">
<_short>Right click action</_short>
<default>show_face</default>
<desc>
<value>show_mixer</value>
<_name>Show full mixer</_name>
</desc>
<desc>
<value>show_face</value>
<_name>Show quick action target</_name>
</desc>
<desc>
<value>mute_face</value>
<_name>Mute quick action target</_name>
</desc>
</option>
</group>
<group>
<_short>Notifications</_short>
<option name="notifications_autohide_timeout" type="double">
<_short>Notifications Display Timeout</_short>
Expand Down
7 changes: 6 additions & 1 deletion src/panel/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,14 @@ if libpulse.found()
deps += [libpulse, libgvc]
endif

if wireplumber.found()
widget_sources += 'widgets/wireplumber.cpp'
deps += wireplumber
endif

executable(
'wf-panel',
['panel.cpp'] + widget_sources,
dependencies: deps,
install: true,
)
)
14 changes: 14 additions & 0 deletions src/panel/panel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
#ifdef HAVE_PULSE
#include "widgets/volume.hpp"
#endif
#ifdef HAVE_WIREPLUMBER
#include "widgets/wireplumber.hpp"
#endif
#include "widgets/window-list/window-list.hpp"
#include "widgets/notifications/notification-center.hpp"
#include "widgets/tray/tray.hpp"
Expand Down Expand Up @@ -164,6 +167,17 @@ class WayfirePanel::impl
#endif
}

if (name == "wireplumber")
{
#ifdef HAVE_WIREPLUMBER
return Widget(new WayfireWireplumber());
#else
#warning "Wireplumber not found, mixer widget will not be available."
std::cerr << "Built without wireplumber support, mixer widget "
" is not available." << std::endl;
#endif
}

if (name == "window-list")
{
return Widget(new WayfireWindowList(output));
Expand Down
44 changes: 1 addition & 43 deletions src/panel/widgets/volume.cpp
Original file line number Diff line number Diff line change
@@ -1,47 +1,6 @@
#include <gtkmm.h>
#include <iostream>
#include <glibmm.h>
#include "volume.hpp"
#include "launchers.hpp"
#include "gtk-utils.hpp"

WayfireVolumeScale::WayfireVolumeScale()
{
value_changed = this->signal_value_changed().connect([=] ()
{
this->current_volume.animate(this->get_value(), this->get_value());
if (this->user_changed_callback)
{
this->user_changed_callback();
}
});
}

void WayfireVolumeScale::set_target_value(double value)
{
this->current_volume.animate(value);
add_tick_callback(sigc::mem_fun(*this, &WayfireVolumeScale::update_animation));
}

gboolean WayfireVolumeScale::update_animation(Glib::RefPtr<Gdk::FrameClock> frame_clock)
{
value_changed.block();
this->set_value(this->current_volume);
value_changed.unblock();
// Once we've finished fading, stop this callback
return this->current_volume.running() ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
}

double WayfireVolumeScale::get_target_value() const
{
return this->current_volume.end;
}

void WayfireVolumeScale::set_user_changed_callback(
std::function<void()> callback)
{
this->user_changed_callback = callback;
}

enum VolumeLevel
{
Expand Down Expand Up @@ -195,8 +154,7 @@ void WayfireVolume::on_default_sink_changed()
volume_scale.set_increments(max_norm * scroll_sensitivity,
max_norm * scroll_sensitivity * 2);

/* Finally, update the displayed volume. However, do not show the
* popup */
/* Finally, update the displayed volume. However, do not show the popup */
set_volume(gvc_mixer_stream_get_volume(gvc_stream), VOLUME_FLAG_NO_ACTION);
}

Expand Down
37 changes: 5 additions & 32 deletions src/panel/widgets/volume.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,15 @@
#define WIDGETS_VOLUME_HPP

#include "../widget.hpp"
#include "wf-popover.hpp"
#include <gtkmm/image.h>
#include <gtkmm/scale.h>
#include "../../util/animated-scale.hpp"
#include <pulse/pulseaudio.h>
#include "gvc-mixer-control.h"
#include <wayfire/util/duration.hpp>

/**
* A custom scale which animates transitions when its value is
* changed programatically.
*/
class WayfireVolumeScale : public Gtk::Scale
{
wf::animation::simple_animation_t current_volume{wf::create_option(200)};
sigc::connection value_changed;
std::function<void()> user_changed_callback;

public:
WayfireVolumeScale();

/* Gets the current target value */
double get_target_value() const;
/* Set a target value to animate towards */
void set_target_value(double value);
/** Set the callback when the user changes the scale value */
void set_user_changed_callback(std::function<void()> callback);
/** Callback to animate volume control */
gboolean update_animation(Glib::RefPtr<Gdk::FrameClock> clock);
};

class WayfireVolume : public WayfireWidget
{
Gtk::Image main_image;
WayfireVolumeScale volume_scale;
WayfireAnimatedScale volume_scale;
Gtk::Button button;
Gtk::Popover popover;

Expand Down Expand Up @@ -71,9 +46,8 @@ class WayfireVolume : public WayfireWidget
};

/**
* Set the current volume level to volume_level.
* This updates both the popover scale and the real pulseaudio volume,
* depending on the passed flags.
* Set the current volume level to volume_level. This updates both the popover scale and the real
* pulseaudio volume, depending on the passed flags.
*
* Precondition: volume_level should be between 0 and max_norm
*/
Expand All @@ -94,8 +68,7 @@ class WayfireVolume : public WayfireWidget
void on_default_sink_changed();

/**
* Check whether the popover should be auto-hidden, and if yes, start
* a timer to hide it
* Check whether the popover should be auto-hidden, and if yes, start a timer to hide it
*/
void check_set_popover_timeout();
};
Expand Down
Loading