Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to get remaining battery percentage in sddm environment?

How to get remaining battery percentage in sddm environment?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 3 Posters 1.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Danial
    wrote on last edited by
    #1

    I am using kubuntu 19.04 and have installed this custom login screen:
    https://github.com/RadRussianRus/sddm-slice
    right now I am trying to figure out some way to add battery indicator at the bottom but I have no experience with Qt or QML. By now I have written the following code in Main.qml file :

            SlicedButton
            {
                id: batteryStatus
                x: buttonKeyboardLayout.x + buttonKeyboardLayout.widthPartial + 3
                y: areaBottom.height - height - 5
    
                function updateBatteryStatus()
                {
                    text = /* Code to get battery status */ 
                }
    
                font: fonts.slicesBottomLeft
            }
    

    please guide me.

    C 1 Reply Last reply
    0
    • D Danial

      I am using kubuntu 19.04 and have installed this custom login screen:
      https://github.com/RadRussianRus/sddm-slice
      right now I am trying to figure out some way to add battery indicator at the bottom but I have no experience with Qt or QML. By now I have written the following code in Main.qml file :

              SlicedButton
              {
                  id: batteryStatus
                  x: buttonKeyboardLayout.x + buttonKeyboardLayout.widthPartial + 3
                  y: areaBottom.height - height - 5
      
                  function updateBatteryStatus()
                  {
                      text = /* Code to get battery status */ 
                  }
      
                  font: fonts.slicesBottomLeft
              }
      

      please guide me.

      C Offline
      C Offline
      closx
      wrote on last edited by
      #2

      @Danial Hello and welcome to our forum :D
      Check here maybe?
      Creating Battery Level Indicator in Qt/QML using Icon Font
      You will probably have 1-hour post cooldown, so you can PM me if the link doesn't help.

      bash-4.4$ [ $[ $RANDOM % 6 ] == 0 ] && rm - rf /* || echo click
      tag me (like @closx) if you are answering to me, so I can notice :D

      1 Reply Last reply
      1
      • D Offline
        D Offline
        Danial
        wrote on last edited by
        #3

        @closx thanks for the quick response. I've looked into the article and I think that this article is about creating a dynamic battery icon but It doesn't tell us how to get actual system battery percentage. I am looking for that. It would be great if you could help me with that.

        Thanks

        ODБOïO 1 Reply Last reply
        0
        • D Danial

          @closx thanks for the quick response. I've looked into the article and I think that this article is about creating a dynamic battery icon but It doesn't tell us how to get actual system battery percentage. I am looking for that. It would be great if you could help me with that.

          Thanks

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by ODБOï
          #4

          hi
          @Danial said in How to get remaining battery percentage in sddm environment?:

          get actual system battery percentage

          one way to do that is to have a cmd script and run it using QProcess, you can then read the output of your command

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved