Skip to content

Commit

Permalink
Merge pull request #584 from salihefee/feature/pause-on-sensor
Browse files Browse the repository at this point in the history
Feature: Pause playback if earbuds are taken off
  • Loading branch information
timschneeb authored Dec 31, 2024
2 parents c9fbbaf + 0b3eb2d commit 3d00bb8
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 2 deletions.
5 changes: 5 additions & 0 deletions GalaxyBudsClient/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,11 @@ private void OnStatusUpdate(object? sender, StatusUpdateDecoder e)
{
PlatformImpl.MediaKeyRemote.Play();
}
else if (_lastWearState != LegacyWearStates.None &&
e.WearState == LegacyWearStates.None && Settings.Data.PausePlaybackOnSensor)
{
PlatformImpl.MediaKeyRemote.Pause();
}

// Update dynamic tray icon
if (e is IBasicStatusUpdate status)
Expand Down
11 changes: 11 additions & 0 deletions GalaxyBudsClient/Interface/Pages/AdvancedPage.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
xmlns:i18N="clr-namespace:GalaxyBudsClient.Generated.I18N"
xmlns:config="clr-namespace:GalaxyBudsClient.Model.Config"
xmlns:platform="clr-namespace:GalaxyBudsClient.Platform;assembly=GalaxyBudsClient.Platform"
xmlns:icons="clr-namespace:FluentIcons.Common;assembly=FluentIcons.Common"
mc:Ignorable="d" d:DesignWidth="800"
x:Class="GalaxyBudsClient.Interface.Pages.AdvancedPage"
x:DataType="pages:AdvancedPageViewModel"
Expand Down Expand Up @@ -35,6 +36,16 @@
</Interaction.Behaviors>
</controls:SettingsSwitchItem>

<controls:SettingsSwitchItem Content="{ext:Translate {x:Static i18N:Keys.AdvPausePlayback}}"
Description="{ext:Translate {x:Static i18N:Keys.AdvPausePlaybackDesc}}"
IsChecked="{Binding PausePlaybackOnSensor, Source={x:Static config:Settings.Data}}"
Symbol="{x:Static icons:Symbol.Pause}"
IsClickEnabled="True">
<Interaction.Behaviors>
<ext:RequiresDesktopBehavior />
</Interaction.Behaviors>
</controls:SettingsSwitchItem>

<controls:SettingsSwitchItem Content="{ext:Translate {x:Static i18N:Keys.AdvSeamless}}"
Description="{ext:Translate {x:Static i18N:Keys.AdvSeamlessDesc}}"
IsChecked="{Binding IsSeamlessConnectionEnabled}"
Expand Down
1 change: 1 addition & 0 deletions GalaxyBudsClient/Model/Config/SettingsData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public class SettingsData : ReactiveObject
[Reactive] public bool FirmwareWarningAccepted { set; get; }
[Reactive] public Event BixbyRemapEvent { set; get; }
[Reactive] public bool ResumePlaybackOnSensor { set; get; }
[Reactive] public bool PausePlaybackOnSensor { set; get; }
[Reactive] public bool IsUsageReportHintHidden { set; get; }
[Reactive] public bool IsBatteryHistoryHintHidden { set; get; }
}
2 changes: 2 additions & 0 deletions GalaxyBudsClient/i18n/en.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@ You might need to manually reconnect your earbuds.</sys:String>
<sys:String x:Key="adv_header">Advanced settings</sys:String>
<sys:String x:Key="adv_seamless">Seamless earbud connection</sys:String>
<sys:String x:Key="adv_seamless_desc">Switch quickly to nearby devices without disconnecting your earbuds or turning on pairing mode</sys:String>
<sys:String x:Key="adv_pause_playback">Pause playback if earbuds are taken off</sys:String>
<sys:String x:Key="adv_pause_playback_desc">Sends a global play/pause state change event when both of the proximity sensors are uncovered (Desktop only)</sys:String>
<sys:String x:Key="adv_resume_playback">Resume playback if the earbuds are worn</sys:String>
<sys:String x:Key="adv_resume_playback_desc">Sends a global play/pause state change event when at least one of the proximity sensors is covered (Desktop only)</sys:String>
<sys:String x:Key="adv_sidetone">Use ambient sound during calls</sys:String>
Expand Down
6 changes: 4 additions & 2 deletions GalaxyBudsClient/i18n/tr.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -514,14 +514,16 @@ Devam etmeden önce her iki kulaklığın da açık olduğundan emin olun.</sys:
<sys:String x:Key="adv_required_firmware_later">{0} veya daha sonrası</sys:String>
<sys:String x:Key="adv_seamless">Kusursuz Kulaklık Bağlantısı</sys:String>
<sys:String x:Key="adv_seamless_desc">Kulaklığınızın bağlantısını kesmeden veya eşleştirme modunu açmadan yakındaki cihazlara hızlıca geçiş yapın.</sys:String>
<sys:String x:Key="adv_pause_playback">Kulaklıklar çıkarıldığında durdur</sys:String>
<sys:String x:Key="adv_pause_playback_desc">İki kulaklığın da yakınlık sensörleri kulaklıkların çıkarıldıklarını algılarsa, genel bir başlat/durdur işlemi gerçekleştirilir (Sadece Masaüstü)</sys:String>
<sys:String x:Key="adv_resume_playback">Kulaklıklar takıldığında başlat ya da devam et</sys:String>
<sys:String x:Key="adv_resume_playback_desc">En az bir kulaklığın yakınlık sensörü yakınlık algılarsa, genel bir başlat/durdur işlemi gerçekleştirilir (Sadece Masaüstü)</sys:String>
<sys:String x:Key="adv_resume_playback_desc">En az bir kulaklığın yakınlık sensörü kulaklığın takıldığını algılarsa, genel bir başlat/durdur işlemi gerçekleştirilir (Sadece Masaüstü)</sys:String>
<sys:String x:Key="adv_sidetone">Görüşmeler esnasında Ortam Sesini kullan</sys:String>
<sys:String x:Key="adv_sidetone_desc">Görüşme esnasında kendinizi daha temiz duymanızı sağlar</sys:String>
<sys:String x:Key="adv_callpath">Aramalarda kulak içi algılama</sys:String>
<sys:String x:Key="adv_callpath_desc">Kulaklıklarınız kulağınızdayken aramaları kulaklıklarınızdan, olmadığında bilgisayar hoparlörünüzden çalın</sys:String>
<sys:String x:Key="adv_extra_clear_call">Arama sesini netleştirin</sys:String>
<sys:String x:Key="adv_extra_clear_call_desc">Arama netliğini artırın. Gürültülü bir ortamda ve kulaklık kullanırken en faydalıdır. Daha fazla pil kullanır.</sys:String>
<sys:String x:Key="adv_sidetone_desc">Görüşme esnasında kendinizi daha temiz duymanızı sağlar</sys:String>
<sys:String x:Key="adv_passthrough">Ortam sesiyle basınçtan kurtulun</sys:String>
<sys:String x:Key="adv_passthrough_desc">Bu, aktif gürültü engellemeyi kullanmadığınızda tıkanıklık veya sıkıştırma hissini önleyebilir.</sys:String>
<sys:String x:Key="adv_gaming_mode">Oyun Modu</sys:String>
Expand Down

0 comments on commit 3d00bb8

Please sign in to comment.