mirror of
https://github.com/hensm/fx_cast.git
synced 2026-06-08 08:39:59 +00:00
Show stop button text regardless of receiver idle state
This commit is contained in:
@@ -75,15 +75,26 @@ class ReceiverView : NSStackView {
|
|||||||
self.addArrangedSubview(self.castButton)
|
self.addArrangedSubview(self.castButton)
|
||||||
|
|
||||||
self.distribution = .fill
|
self.distribution = .fill
|
||||||
|
|
||||||
|
|
||||||
|
var wasDisabled = false
|
||||||
|
|
||||||
NSEvent.addLocalMonitorForEvents(
|
NSEvent.addLocalMonitorForEvents(
|
||||||
matching: .flagsChanged) { event in
|
matching: .flagsChanged) { event in
|
||||||
|
|
||||||
if !self.receiver.status.application.isIdleScreen &&
|
if wasDisabled {
|
||||||
event.modifierFlags.contains(.option) {
|
self.castButton.isEnabled = false
|
||||||
|
}
|
||||||
|
|
||||||
|
if event.modifierFlags.contains(.option) {
|
||||||
self.castButton.title =
|
self.castButton.title =
|
||||||
InitDataProvider.shared.data.i18n_stopButtonTitle
|
InitDataProvider.shared.data.i18n_stopButtonTitle
|
||||||
self.castButton.action = #selector(ReceiverView.onStop)
|
self.castButton.action = #selector(ReceiverView.onStop)
|
||||||
|
if !self.castButton.isEnabled {
|
||||||
|
self.castButton.isEnabled =
|
||||||
|
!self.receiver.status.application.isIdleScreen
|
||||||
|
wasDisabled = self.castButton.isEnabled
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
self.castButton.title =
|
self.castButton.title =
|
||||||
InitDataProvider.shared.data.i18n_castButtonTitle
|
InitDataProvider.shared.data.i18n_castButtonTitle
|
||||||
|
|||||||
@@ -302,7 +302,7 @@ class ReceiverEntry extends Component<ReceiverEntryProps, ReceiverEntryState> {
|
|||||||
, (this.state.isLoading
|
, (this.state.isLoading
|
||||||
? this.state.ellipsis
|
? this.state.ellipsis
|
||||||
: ""))
|
: ""))
|
||||||
: !application.isIdleScreen && this.state.showAlternateAction
|
: this.state.showAlternateAction
|
||||||
? _("popupStopButtonTitle")
|
? _("popupStopButtonTitle")
|
||||||
: _("popupCastButtonTitle") }
|
: _("popupCastButtonTitle") }
|
||||||
</button>
|
</button>
|
||||||
|
|||||||
Reference in New Issue
Block a user