Definitely one of the best use cases of KDE Connect is this: Watching a movie while laying in bed or on the couch and controlling your unreachable computer from your phone without needing to stand up. Thanks to our new media control notification you can pause and skip without even unlocking your phone. But what if the movie is too silent? If your media player is implementing the MPRIS2 specifications you are already lucky and can control your players volume from KDE Connect. Plasma Browser Integration even adds that for Browsers. But what if your player doesn’t support it (looking at you, Spotify)? Or you want to control your system volume? Then you are out of luck. Until soon. We are adding a plugin to KDE Connect that enables you to control your system volume from the phone. How cool is that? Another neat little trick is tapping on the volume icon to (un)mute the system.
The idea for this has been around for a while, but it was not until fall 2017 that I actually started implementing it. The implementation relies on PulseAudio. We are aware that not everyone is using it, so we don’t require it and hope that packagers do not make KDE Connect depend on PulseAudio. The first implementation was using the command line tool pactl to set the volume. Assuming you only have one sink it was working pretty well, except there was no easy way to ask for the current volume, so our volume slider would be wrong pretty often. I got around this by parsing the output of pactl in a horrible, horrible line of bash, but it was clear that this was not stable enough to actually go into prod. Also it was still not working with multiple sinks. The logical step was to make use of the libpulse. For some reasons there are a great deal of people that like the C programming language, but I don’t. Especially not the library style that comes with it. What I really didn’t like was the idea of mixing low-level libpulse C code with high-level Qt code. Luckily, the Plasma guys thought the same. The Plasma Volume Applet contains code that was acting as a bridge between the two worlds. So I “borrowed’ that code (isn’t free software amazing?) and after some intense head-against-the-table banging (turns out both KDE Connect and Plasma PA both have a class ‘Device’ with the same include guard) it was working like a breeze, now even with multiple sinks.
Birth of a Framework
It was working really good, but the thought of having 20 files of duplicate code in two KDE projects wasn’t particularly appealing. We decided it would be best to extract the common code into a library that both projects can use. To make this possible the code needed quite some polish. The original author probably didn’t have in mind that it might become a library someday. After some work we now believe that the API can be declared stable and it can be released on KDE Extragear. We aim to make it an official KDE Framework once the code has matured enough. Extracting and releasing it as a library makes it easier for us to maintain it, but it also means that you can use it in your project! Furthermore, since it covers more use cases than just volume control it’s also possible to integrate more PulseAudio related features into KDE Connect easily. We are looking forward to your suggestions!
16 | System & Utilities | https://nicolasfella.wordpress.com/2018/04/30/volume-control-in-kde-connect/ | Planet KDE |
Смотрите также связанные темы
24.05.2011 New Articles Published for Week Ending 5/21/11 New Articles Published for Week Ending 5/21/11 Apache Tomcat Determining your version of Tomcat (1033932) Date Published: 5/19/2011 VMware Converter VMware Converter fails with the error: Unable to create a VSS snapshot of the source volume(s) (1039087) Date Published: 5/20/2011 VMware ESX Cursor fails to interact with any objects in the bottom 3 inches of the screen of a full screen virtual machine. (1000467) Date Published: 5/20/2011 Exporting system logs fail for ESX/ESXi host fails with the error: A general system error occurred: internal error (1000558) Date Published: 5/20/2011 Wi...27.06.2011 New Articles Published for Week Ending 6/25/11 New Articles Published for Week Ending 6/25/11 Apache Tomcat 7 How can Tomcat redirect to a secure connection when behind a reverse proxy web server? (1037406) Date Published: 6/22/2011 Eclipse Virgo Enabling the YourKit Profiler with Eclipse Virgo (2000979) Date Published: 6/24/2011 VMware Converter Setting the minimum vCenter Server permissions required to perform VMware Converter operations (2000123) Date Published: 6/21/2011 VMware Data Recovery Backing up a virtual machine using VMware Data Recovery fails with the error: Trouble writing to destination store, -1115 ( disk full) (...16.08.2012 Freescale and partners launch reference platform to streamline development of programmable logic controllers Freescale, QNX Software Systems, ISaGRAF, and koenig-pa KPA collaborate to accelerate the development of industrial control systems-- QNX Partner News Release --BEIJING Freescale Technology Forum Aug. 14, 2012 Freescale Semiconductor NYSE: FSL has collaborated with industrial technology partners to develop an advanced programmable logic controller PLC reference platform based on Freescales dual-core QorIQ P1025 processor. The reference platform integrates well-established EtherCAT protocol software from KPA, PLC Firmware from ISaGRAF, and the QNX Neutrino real-time operating system RTOS to bo...18.11.2010 VMworld 2010 Online Sessions VMworld 2010 Online Sessions Now that VMworld 2010 has concluded, it's time to digest and consume sessions that were offered. If you attended VMworld 2010 in either San Francisco or Copenhagen, you have been granted full access. If you were not an attendee, you will need a VMworld 2010 Subscription. However, VMworld 2010 General Sessions + Super Sessions AND all content from previous VMworld conferences is free to all VMworld.com visitors. All Super Sessions and Breakout Sessions that were captured from VMworld 2010 in San Francisco have been posted. Selected Breat...20.12.2010 New articles published for week ending 12/18/2010 New articles published for week ending 12/18/2010 SUSE Linux Enterprise Server (SLES) for VMware Error when attempting to update SUSE Linux Enterprise Server (SLES) for VMware: No update repository configured (1031668) Date Published: 12/15/2010 VMware Consolidated Backup File level backups fail if a BCD store exists on the Windows 2003 virtual machine (1031734) Date Published: 12/17/2010 VMware Data Recovery VMware Data Recovery backups do not start on time (1019139) Date Published: 12/14/2010 VMware ESX What is the syntax for vmware-cmd createsnapshot? (738107) Date Published: 12/16/20...16.05.2011 New Articles Published for Week Ending 5/14/11 New Articles Published for Week Ending 5/14/11 VMware ACE Applying a policy update package in ACE fails with the error: Setup has detected that this ACE package requires a newer version of VMware Workstation (1038992) Date Published: 5/9/2011 VMware Converter Converting a physical or virtual machine with VMware Converter takes longer than expected (1038454) Date Published: 5/12/2011 Starting a virtual machine that was converted using VMware Converter fails with the error: STOP 0x79 MISMATCHED_HAL (1038576) Date Published: 5/11/2011 Unable to log in to a Windows virtual machine after it h...25.10.2011 New Articles Published for Week Ending 10/22/11 New Articles Published for Week Ending 10/22/11 Apache HTTP Server Writing a support request for Apache HTTP Server (2003727) Date Published: 10/19/2011 VMware ESX Settings are lost after installing patch ESX410-201104001 on an ESX 4.1 Update1 host (2004745) Date Published: 10/20/2011 Hardware Status tab sensors are missing after applying Patch ESX410-201104401 (2005853) Date Published: 10/21/2011 NFS storage space details in vCenter Server appear blank (2007059) Date Published: 10/21/2011 Upgrading Cisco Nexus 1000V before upgrading to ESXi 5.0 (2007959) Date Published: 10/17/2011 Daylight...08.11.2011 New Articles Published for Week Ending 11/5/11 New Articles Published for Week Ending 11/5/11 Apache Active MQ Securing ActiveMQ queues created during runtime (2004786) Date Published: 11/2/2011 ActiveMQ network of brokers error: java.lang.SecurityException: User anonymous is not authorized to read (2004787) Date Published: 11/2/2011 Socialcast Creating SSL certificates for Socialcast On Premise (2008649) Date Published: 10/31/2011 Socialcast Dedicated Cloud Socialcast support resources (2008604) Date Published: 10/31/2011 Logging in to Single Sign-On enabled Socialcast domains fails for the Socialcast Desktop Application on OSX (200867...22.11.2011 New Articles Published for Week Ending 11/19/11 New Articles Published for Week Ending 11/19/11 Apache HTTP Server Logging user defined cookies with Apache 2.0 and the usertrack module (2008211) Date Published: 11/14/2011 Checking the modules that are compiled into Apache HTTP Server and vFabric Enterprise Server (2009272) Date Published: 11/17/2011 Installing mod_fcgid on Apache HTTP Server 2.0.x configurations under Linux/Unix (2009475) Date Published: 11/17/2011 Apache Tomcat Setting up Tomcat in the Windows platform for monitoring by jconsole or jvisualvm (2008410) Date Published: 11/15/2011 Enabling garbage collection logging with T...07.03.2011 New Articles Published for week ending 3/5/11 New Articles Published for week ending 3/5/11 VMware Alive Enterprise Setting multiple FSDB locations in VMware Alive (1034899) Date Published: 3/1/2011 Connecting to the VMware Alive Enterprise SCOM adapter using Windows Authentication (1035184) Date Published: 3/3/2011 VMware Data Recovery More than 0 virtual machines were selected. A maximum of 0 virtual machines can be backed up by one Data Recovery appliance (1033813) Date Published: 2/28/2011 VMware Data Recovery File Level Restore: Installing FUSE on a Debian-based Linux 64bit OS (1035231) Date Published: 3/3/2011 VMware ESX vMotio...