• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login
    1. Strawberry Music Player Forums
    2. nashoba
    N
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Best 2
    • Controversial 0
    • Groups 0

    nashoba

    @nashoba

    3
    Reputation
    3
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined Last Online

    nashoba Unfollow Follow

    Best posts made by nashoba

    • Power options - not inhibiting sleep

      First thing first, I must say: Kudos for excellent work (...and choosing Snowy White for screenshots 🤗 ).

      Now, the only problem on my Kubuntu laptop is that Strawberry don't implement any power options. To be precise, after time defined in OS settings my laptop will go to sleep, although Strawberry is still playing.

      Earlier, as a workaround, I could start Strawberry with .desktop file containing:

      Exec=bash -c 'inhibit_lock=$(qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.Inhibit "strawberry" "playing") ; /path/Strawberry-0.9.3-Qt5-x86_64.AppImage %U ; qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.UnInhibit $inhibit_lock'
      

      but since v0.9.3 that, for some reason, that will not work, nether for Qt5 nor Qt6 appimage. The same thing is with outdated 0.8.3 deb version. Well, you can imagine how annoying it is.

      Anyway, Godspeed and if I may a little advice.
      If you plan to get Strawberry viral, you really need to implement that modern album grid view for Collection sidebar as some have been requested it, maybe something like KDE's Elisa. Now, I don't promise to use it, but still, you get the point.
      Best of luck.

      posted in Technical Help
      N
      nashoba
    • RE: Power options - not inhibiting sleep

      Actual solution:
      Now this can be easily achieved by simple python script and as a result, Plasma will correctly recognise inhibition in it's default "Battery and Brightness" widget:

      #!/usr/bin/env python3
      
      import dbus, subprocess, sys
      
      session_bus = dbus.SessionBus()
      
      obj = session_bus.get_object('org.freedesktop.PowerManagement.Inhibit', 
                                   '/org/freedesktop/PowerManagement/Inhibit')
      iface = dbus.Interface(obj, dbus_interface='org.freedesktop.PowerManagement.Inhibit')
      data = iface.Inhibit(str(sys.argv[1]), '\nfor reason: playing music')
      
      # Output report
      print(f'''\n----------
      {sys.argv[0]}
          script inhibiting program: "{sys.argv[1]}"
          with cookie: {data}
          To release inhibit manually run:\n
          " qdbus org.freedesktop.PowerManagement.Inhibit
          /org/freedesktop/PowerManagement/Inhibit
          org.freedesktop.PowerManagement.Inhibit.UnInhibit {data} " 
      ----------\n''')
      
      process = subprocess.run(sys.argv[1:], stderr=subprocess.STDOUT)
      sys.exit(process.returncode)
      

      As a bonus, it will work with any other program, too. To use it, call script with program as arguments. For example, in desktop file:

      Exec=/pathToScript/inhibit_sleep.py    /path_to_executable/Strawberry-0.9.3-Qt5-x86_64.AppImage %U
      

      It will disable inhibition right after you exit Strawberry.

      @devs
      Well, it's not PyQt as an effort to be more portable, but from the top of my head, it can be easily achieved with QDBusConnection and QDBusInterface classes.

      posted in Technical Help
      N
      nashoba

    Latest posts made by nashoba

    • RE: Power options - not inhibiting sleep

      Actual solution:
      Now this can be easily achieved by simple python script and as a result, Plasma will correctly recognise inhibition in it's default "Battery and Brightness" widget:

      #!/usr/bin/env python3
      
      import dbus, subprocess, sys
      
      session_bus = dbus.SessionBus()
      
      obj = session_bus.get_object('org.freedesktop.PowerManagement.Inhibit', 
                                   '/org/freedesktop/PowerManagement/Inhibit')
      iface = dbus.Interface(obj, dbus_interface='org.freedesktop.PowerManagement.Inhibit')
      data = iface.Inhibit(str(sys.argv[1]), '\nfor reason: playing music')
      
      # Output report
      print(f'''\n----------
      {sys.argv[0]}
          script inhibiting program: "{sys.argv[1]}"
          with cookie: {data}
          To release inhibit manually run:\n
          " qdbus org.freedesktop.PowerManagement.Inhibit
          /org/freedesktop/PowerManagement/Inhibit
          org.freedesktop.PowerManagement.Inhibit.UnInhibit {data} " 
      ----------\n''')
      
      process = subprocess.run(sys.argv[1:], stderr=subprocess.STDOUT)
      sys.exit(process.returncode)
      

      As a bonus, it will work with any other program, too. To use it, call script with program as arguments. For example, in desktop file:

      Exec=/pathToScript/inhibit_sleep.py    /path_to_executable/Strawberry-0.9.3-Qt5-x86_64.AppImage %U
      

      It will disable inhibition right after you exit Strawberry.

      @devs
      Well, it's not PyQt as an effort to be more portable, but from the top of my head, it can be easily achieved with QDBusConnection and QDBusInterface classes.

      posted in Technical Help
      N
      nashoba
    • RE: Power options - not inhibiting sleep

      @nashoba
      Apparently, it's a change in powerdevil.
      If anyone interested for a MR it's explained here:

      https://www.reddit.com/r/kde/comments/hruubo/unable_to_inhibit_suspend/

      posted in Technical Help
      N
      nashoba
    • Power options - not inhibiting sleep

      First thing first, I must say: Kudos for excellent work (...and choosing Snowy White for screenshots 🤗 ).

      Now, the only problem on my Kubuntu laptop is that Strawberry don't implement any power options. To be precise, after time defined in OS settings my laptop will go to sleep, although Strawberry is still playing.

      Earlier, as a workaround, I could start Strawberry with .desktop file containing:

      Exec=bash -c 'inhibit_lock=$(qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.Inhibit "strawberry" "playing") ; /path/Strawberry-0.9.3-Qt5-x86_64.AppImage %U ; qdbus org.freedesktop.PowerManagement.Inhibit /org/freedesktop/PowerManagement/Inhibit org.freedesktop.PowerManagement.Inhibit.UnInhibit $inhibit_lock'
      

      but since v0.9.3 that, for some reason, that will not work, nether for Qt5 nor Qt6 appimage. The same thing is with outdated 0.8.3 deb version. Well, you can imagine how annoying it is.

      Anyway, Godspeed and if I may a little advice.
      If you plan to get Strawberry viral, you really need to implement that modern album grid view for Collection sidebar as some have been requested it, maybe something like KDE's Elisa. Now, I don't promise to use it, but still, you get the point.
      Best of luck.

      posted in Technical Help
      N
      nashoba