Thanks, it's a good remark, I didn't know this widget. It has the advantage to not have to mimic the amixer ouput which is kind of weird.

To go further, we may even want to remove this "get_volume" method. Or to change it by using an import of this GenPollText widget.
It should be simplier for everyone.


Le 16/05/2021 à 15:10, el Paraguayo a écrit :
Haven't been following the text in this chain but if you're using a custom command which formats the output then you could just use GenPollText widget.

On Sun, 16 May 2021, 14:07 Fabien BERNARD, <[email protected] <mailto:[email protected]>> wrote:

    > Do you mind explaining me why bracket are needed ?

    The widget is based on amixer.

    The amixer output contains brackets (and "%") used by the widget
    to spot the volume via regular expression.

    So the output of customized commands (unknown by the widget) needs
    to be similar to be correctly processed by the widget.


    If you wish to contribute, you may just had the right experience
    to propose a more user-friendly documentation :)


    Le 16/05/2021 à 13:28, Seph IZ a écrit :
    final version to get the values >= 100%

    #!/bin/bash
    mute=$(pactl list sinks | grep "Description: WH-1000XM3" -A 6 |
    grep Mute | grep "yes")
    volume=$(pactl list sinks | grep "Description: WH-1000XM3" -A 6 |
    grep -E -m1 -o "...%" | head -n1 | tr -d " ")
    if [ ! -z "$mute" ]
    then
         echo "[M]"
    else
         echo "[$volume]"
    fi
    exit 0

    On Sunday, May 16, 2021 at 1:05:57 PM UTC+2 Seph IZ wrote:

        Oh ! You are right ! I didn't realised the format need
        brackets ! thank you very much.
        Do you mind explaining me why bracket are needed ?

        For future user with same issue, this is the final script to
        get the correct output when muted and when volume is changed

        #!/bin/bash
        mute=$(pactl list sinks | grep "Description: WH-1000XM3" -A 6
        | grep Mute | grep "yes")
        volume=$(pactl list sinks | grep "Description: WH-1000XM3" -A
        6 | grep % | cut -d " " -f 6)
        if [ -z $mute]
        then
                echo "[M]"
        else
               echo "[$volume]"
        fi

        exit 0

        On Sunday, May 16, 2021 at 12:36:40 PM UTC+2 Fabien-Bernard
        wrote:

            Ok, so the percent sign is already there, you are just
            missing the brackets.

            By adding them around the volume variable in the echo
            command it should be good.


            Le 16/05/2021 à 12:17, Seph IZ a écrit :
            to this script :

            #!/bin/bash
            volume=$(pactl list sinks | grep "Description:
            WH-1000XM3" -A 6 | grep % | cut -d " " -f 6)
            echo "$volume"
            exit 0


            I have the following result :

            35%
            On Sunday, May 16, 2021 at 11:55:25 AM UTC+2
            Fabien-Bernard wrote:

                I might have been wrong with my guess on the result
                of the command.

                What is the exact output of your command in the
                terminal?


                Le 16/05/2021 à 11:11, Seph IZ a écrit :
                Hello Fabien,

                I tried your solution, As a result the plugin print
                "M" I guess something is wrong M must be
                interpreted as Muted.

                On Friday, May 14, 2021 at 2:50:09 PM UTC+2
                Fabien-Bernard wrote:

                    Hello,

                    Have you tried to put your command in an
                    executable script that mimic the output of amixer?

                    Something like :

                        /#!/bin/bash/

                        /my_volume=$(pactl list sinks | grep
                        "Description: WH-1000XM3" -A 6 | grep % |
                        cut -d " " -f 6)/

                        /echo "["$my_volume"%]"/

                        /exit 0/

                    I don't know the output of pactl, so it's just
                    a guess that you only get a number with your
                    command.

                    Then you just have to replace your command by
                    the script in the get_volume_command assignment
                    of the widget :

                        /get_volume_command =
                        '/path/to/your_script.bash'/


                    Le 11/05/2021 à 10:15, Seph IZ a écrit :
                    Hi,

                    I'm using a bluetooth headset and try to get
                    the volume with Volume widget.
                    amixer seems not compatible with bluetooth
                    headset.

                    Therefore I'm trying to get the volume with
                    pactl piped to different commands :

                    pactl list sinks | grep "Description:
                    WH-1000XM3" -A 6 | grep % | cut -d " " -f 6

                    This command run in the terminal will success
                    to get the volume of my headset.
                    I try then to use this command in the widget :


                    widget.Volume(
                     foreground = colors[9],
                    background = colors[0],
                    padding = 5,
                    get_volume_command = 'pactl list sinks | grep
                    "Description: WH-1000XM3" -A 6 | grep % | cut
                    -d " " -f 6'
                    ),

                    Unfortunately it doesn't works.
                    Do you have a solution to get the volume of my
                    bluetooth headset ?
-- You received this message because you are
                    subscribed to the Google Groups "qtile-dev" group.
                    To unsubscribe from this group and stop
                    receiving emails from it, send an email to
                    [email protected].
                    To view this discussion on the web visit
                    
https://groups.google.com/d/msgid/qtile-dev/6c176ccd-951e-4958-9158-f66d6a881707n%40googlegroups.com
                    
<https://groups.google.com/d/msgid/qtile-dev/6c176ccd-951e-4958-9158-f66d6a881707n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- You received this message because you are
                subscribed to the Google Groups "qtile-dev" group.
                To unsubscribe from this group and stop receiving
                emails from it, send an email to
                [email protected].
                To view this discussion on the web visit
                
https://groups.google.com/d/msgid/qtile-dev/6cb70f6f-664f-493c-ad6f-c69e053eb50fn%40googlegroups.com
                
<https://groups.google.com/d/msgid/qtile-dev/6cb70f6f-664f-493c-ad6f-c69e053eb50fn%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- You received this message because you are subscribed to
            the Google Groups "qtile-dev" group.
            To unsubscribe from this group and stop receiving emails
            from it, send an email to [email protected].
            To view this discussion on the web visit
            
https://groups.google.com/d/msgid/qtile-dev/83ca12a8-b802-440e-8567-ef2fffa94091n%40googlegroups.com
            
<https://groups.google.com/d/msgid/qtile-dev/83ca12a8-b802-440e-8567-ef2fffa94091n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- You received this message because you are subscribed to the
    Google Groups "qtile-dev" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/qtile-dev/3e2cc60f-c114-44b6-91ce-7b8d73e7b4cbn%40googlegroups.com
    
<https://groups.google.com/d/msgid/qtile-dev/3e2cc60f-c114-44b6-91ce-7b8d73e7b4cbn%40googlegroups.com?utm_medium=email&utm_source=footer>.
-- You received this message because you are subscribed to the Google
    Groups "qtile-dev" group.
    To unsubscribe from this group and stop receiving emails from it,
    send an email to [email protected]
    <mailto:[email protected]>.
    To view this discussion on the web visit
    
https://groups.google.com/d/msgid/qtile-dev/c70458ff-bc6d-910d-8116-3864e24de0e4%40gmail.com
    
<https://groups.google.com/d/msgid/qtile-dev/c70458ff-bc6d-910d-8116-3864e24de0e4%40gmail.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups "qtile-dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected] <mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/qtile-dev/CADPQLhAONvTrVzK6Y%3DRM5zZ6LLJ%2B4UudMDgV8K%3DajKP4YROErw%40mail.gmail.com <https://groups.google.com/d/msgid/qtile-dev/CADPQLhAONvTrVzK6Y%3DRM5zZ6LLJ%2B4UudMDgV8K%3DajKP4YROErw%40mail.gmail.com?utm_medium=email&utm_source=footer>.

--
You received this message because you are subscribed to the Google Groups 
"qtile-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/qtile-dev/dbfad9de-e774-8f28-285a-8383440afa26%40gmail.com.

Reply via email to