Skip to content

Commit 1d3e227

Browse files
authored
Recorder: Set application info for monitor apps (#293)
1 parent 8fb2e1f commit 1d3e227

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/Application.vala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ public class Application : Adw.Application {
145145
Intl.bind_textdomain_codeset (Config.GETTEXT_PACKAGE, "UTF-8");
146146
Intl.textdomain (Config.GETTEXT_PACKAGE);
147147

148+
// Set human-readable string to the application name that can be used in monitor apps
149+
// e.g. pavucontrol or gnome-system-monitor
150+
Environment.set_application_name (Config.APP_NAME);
151+
148152
// Load and setup styles
149153
unowned var display = Gdk.Display.get_default ();
150154

src/Config.vala.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
namespace Config {
22
public const string LOCALEDIR = @LOCALEDIR@;
33
public const string GETTEXT_PACKAGE = @GETTEXT_PACKAGE@;
4+
public const string APP_NAME = @APP_NAME@;
45
public const string APP_ID = @APP_ID@;
56
public const string APP_VERSION = @APP_VERSION@;
67
public const string RESOURCE_PREFIX = @RESOURCE_PREFIX@;

src/Model/Recorder.vala

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,16 @@ namespace Model {
151151

152152
sys_sound.set ("device", monitor_name);
153153
debug ("sound source (system): \"Monitor of %s\"", default_sink.display_name);
154+
155+
// Set properties that can be used in monitor apps e.g. pavucontrol or gnome-system-monitor
156+
var pa_props = new Gst.Structure.from_string (
157+
"props" + ",media.role=music"
158+
+ ",application.id=" + Config.APP_ID
159+
+ ",application.icon_name=" + Config.APP_ID
160+
, null
161+
);
162+
sys_sound.set ("stream-properties", pa_props);
163+
154164
pipeline.add (sys_sound);
155165
sys_sound.get_static_pad ("src").link (mixer.request_pad_simple ("sink_%u"));
156166
}
@@ -165,6 +175,16 @@ namespace Model {
165175
}
166176

167177
debug ("sound source (microphone): \"%s\"", microphone.display_name);
178+
179+
// Set properties that can be used in monitor apps e.g. pavucontrol or gnome-system-monitor
180+
var pa_props = new Gst.Structure.from_string (
181+
"props" + ",media.role=music"
182+
+ ",application.id=" + Config.APP_ID
183+
+ ",application.icon_name=" + Config.APP_ID
184+
, null
185+
);
186+
mic_sound.set ("stream-properties", pa_props);
187+
168188
pipeline.add (mic_sound);
169189
mic_sound.get_static_pad ("src").link (mixer.request_pad_simple ("sink_%u"));
170190
}

src/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
config_data = configuration_data()
22
config_data.set_quoted('LOCALEDIR', get_option('prefix') / get_option('localedir'))
33
config_data.set_quoted('GETTEXT_PACKAGE', meson.project_name())
4+
config_data.set_quoted('APP_NAME', app_name)
45
config_data.set_quoted('APP_ID', app_id)
56
config_data.set_quoted('APP_VERSION', app_version)
67
config_data.set_quoted('RESOURCE_PREFIX', '/' + meson.project_name().replace('.', '/'))

0 commit comments

Comments
 (0)