mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
35 lines
1.1 KiB
QML
35 lines
1.1 KiB
QML
import Quickshell
|
|
import qs.Commons
|
|
import qs.Services.Media
|
|
import qs.Services.System
|
|
import qs.Services.UI
|
|
import qs.Widgets
|
|
|
|
// Screen Recording Indicator
|
|
NIconButton {
|
|
id: root
|
|
|
|
property ShellScreen screen
|
|
|
|
icon: "camera-video"
|
|
tooltipText: ScreenRecorderService.isRecording ? I18n.tr("tooltips.click-to-stop-recording") : I18n.tr("tooltips.click-to-start-recording")
|
|
tooltipDirection: BarService.getTooltipDirection()
|
|
density: Settings.data.bar.density
|
|
baseSize: Style.capsuleHeight
|
|
applyUiScale: false
|
|
colorBg: ScreenRecorderService.isRecording ? Color.mPrimary : (Settings.data.bar.showCapsule ? Qt.alpha(Color.mSurfaceVariant, Settings.data.bar.capsuleOpacity) : Color.transparent)
|
|
colorFg: ScreenRecorderService.isRecording ? Color.mOnPrimary : Color.mOnSurface
|
|
colorBorder: Color.transparent
|
|
colorBorderHover: Color.transparent
|
|
|
|
function handleClick() {
|
|
if (!ScreenRecorderService.isAvailable) {
|
|
ToastService.showError(I18n.tr("toast.recording.not-installed"), I18n.tr("toast.recording.not-installed-desc"));
|
|
return;
|
|
}
|
|
ScreenRecorderService.toggleRecording();
|
|
}
|
|
|
|
onClicked: handleClick()
|
|
}
|