all repos — quickshell @ e5e7d5b81d5680177d3d337f5ff234e2f703c681

A desert-witch desktop shell

bar/modules/OldVolume.qml (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
import QtQuick
import Quickshell
import QtQuick.Controls.Basic
import QtQuick.Layouts
import Quickshell.Services.Pipewire
import "../classes" as Class
import "../../"

Button {
  PwObjectTracker {
    objects: [ Pipewire.defaultAudioSink ]
  }
  property var muted: Pipewire.defaultAudioSink?.audio.muted
  padding: 0
  background: Rectangle {
    color: Resources.palette.bg
  }
contentItem: Class.RightRowLayout {
  id: volume_module
  Layout.alignment: Qt.AlignVCenter
    Class.TopbarText {
      id: volume_indicator
      property var vol: Math.round((Pipewire.defaultAudioSink?.audio.volume ?? 0) * 100)
      text:
        (muted)
        ? ""
        : vol + "%"
      color: Resources.palette.fg
    }
    Class.TopbarIcon {
      text: muted
        ? ""
        : (volume_indicator.vol == 0)
        ? ""
        : (volume_indicator.vol <= 50)
        ? "󰺕"
        : (volume_indicator.vol > 50)
        ? ""
        : Icons.volume.low
      color: muted
        ? Resources.palette.scarlet
        : Resources.palette.orange
        anchors.verticalCenter: parent
      }
      Class.TopSep{}
  }
}