all repos — quickshell @ main

A desert-witch desktop shell

swaybar/modules/Volume.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
import QtQuick
import Quickshell
import QtQuick.Controls.Basic
import QtQuick.Layouts
import Quickshell.Services.Pipewire
import "../classes" as Class
import "../../"

RowLayout {
    spacing: 2
    layoutDirection: Qt.RightToLeft
  PwObjectTracker {
    objects: [ Pipewire.defaultAudioSink ]
  }
  property var muted: Pipewire.defaultAudioSink?.audio.muted
  id: volume_module
  Class.TopbarText {
    id: volume_indicator
    property var vol: Math.round((Pipewire.defaultAudioSink?.audio.volume ?? 0) * 100)
    text: (muted) 
      ? "" 
      : vol + "%"
    color: Style.fg
  }
  Class.TopbarIcon {
    text: (muted) 
      ? ""
      : (volume_indicator.vol == 0)
      ? ""
      : (volume_indicator.vol <= 50)
      ? "󰺕"
      : (volume_indicator.vol > 50)
      ? ""
      : Icons.volume.low
    color: (muted)
      ? Style.scarlet
      : Style.orange
    bottomPadding: 0.5
  }
  Class.Sep{}
}