all repos — quickshell @ 85e31b0fda1b88a16553c75958e7c13ee9c0ed4f

A desert-witch desktop shell

bar/modules/Sunset.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
// Sunset.qml
import QtQuick
import Quickshell
import Quickshell.Io
import QtQuick.Layouts
import "../../"
import "../classes" as Class
import QtQuick.VectorImage

Class.RightRowLayout {
  id: sunset_module
  Class.TopbarText {
    id: sunset
    // Layout.alignment: Qt.AlignBottom
    // anchors.bottom: sunset_module.top
    Process {
      id: sunset_script
      command: ["bar/scripts/suntime.sh"]
      workingDirectory: Quickshell.shellDir
      running: true
      stdout: StdioCollector {
        onStreamFinished: {
          sunset.text = this.text.trim()
          sunset_indicator.data = this.data
        }
      }
    }

    Timer {
      interval: 1000
      running: true
      repeat: true
      onTriggered: sunset_script.running = true
    }
  }
  Class.TopbarIcon {
    id: sunset_indicator
    text:  sunset_indicator.data != "NIGHT" ? "𖡹" :"𖥸"
    font.pixelSize: Resources.fontsize.topbar_bamum
  }
  // Class.TopbarSVG {
  //   icon.source: "../../icons/phosphor/regular/sun-horizon.svg"
  // }
  Class.TopSep {}
}