qubes-issues icon indicating copy to clipboard operation
qubes-issues copied to clipboard

qubes-i3status - json invalid

Open neowutran opened this issue 10 months ago • 10 comments

Qubes OS release

R4.2, testing repositories, latest update

Brief summary

after a dom0 update today, "qubes-i3status" started to generate invalid json causing issue with the i3 bar The result of amixer sget Master in dom0 has changed. The AWK command doesn't retrieve the correct thing now https://github.com/QubesOS/qubes-desktop-linux-i3-settings-qubes/blob/main/qubes-i3status#L138 (and it match multiple line, so it add control character in the json, making it invalid.

Didn't had time to check what got modified

neowutran avatar Apr 07 '24 10:04 neowutran

I usually have to make a local copy and edit it. Currently, I have:

    local volume=$(echo "$volcmd" | awk '/%/ {gsub(/[\[\]]/,""); print $4; exit; }')
    local playback=$(echo "$volcmd" | awk '/%/ {gsub(/[\[\]]/,""); print $7; exit; }')

Been that way for years.

I also have some tweaks so that the volume change feedback is more responsive. Once the volume changes, it goes to polling volume once per second, so you can hit UP and wait for it to register, then you can hit UP each subsequent second.

BetoHydroxyButyrate avatar Apr 18 '24 12:04 BetoHydroxyButyrate

Here's the main loop. you still have to wait up to 5 seconds for the first volume change to register, but then it becomes more responsive.

main() {
    echo '{"version":1}'
    echo '['
    echo '[]'
    local n
    local vol_mod=1
    local last_vol=''

    for ((n=0; ; ++n)); do
        if (( n % 10 == 0 )); then
            local qubes=$(status_qubes)
            # network status disabled by default as it's dangerous to run a
            # command on a qube from dom0
            # local net=$(status_net)
            local disk=$(status_disk)
            local bat=$(status_bat)
            local load=$(status_load)
        fi
        if (( n % ${vol_mod} == 0 )); then
            local volume=$(status_volume)
            if [[ ${volume} == ${last_vol} ]]; then
                if (( ${vol_mod} < 5 )); then
                    let vol_mod+=1
                fi
            else
                last_vol=${volume}
                vol_mod=1
            fi
        fi
        # echo "n: $n vol_mod: $vol_mod last_vol: $last_vol vol: $volume"
        local time=$(status_time)
        echo ",[$qubes$disk$bat$load$volume$time]"
        sleep 1
    done
}

BetoHydroxyButyrate avatar Apr 18 '24 12:04 BetoHydroxyButyrate

In my i3 config i changed status_command to "qubes-i3status 2> /dev/null"

daktak avatar Apr 30 '24 02:04 daktak

@daktak @neowutran @BetoHydroxyButyrate - Thank you for testing i3 on Qubes and offering potential solutions. Your work and knowledge helped me fix this issue and increased my knowledge in several areas.

Ok, my errors stem from the 4.2 update causing issues with my sound

daktak avatar May 07 '24 04:05 daktak

Updated qubes-i3status with below

volcmd=$(pactl list sinks)
local volume=$(echo "$volcmd" | grep Volume | awk '/%/ {gsub(/[\[\]]/,""); print $5; exit; }')
local playback=$(echo "$volcmd" | grep Mute | cut -f 2 -d \ )
if [[ $playback == yes ]]; then

daktak avatar May 07 '24 05:05 daktak

@andrewdavidwong Any updates here? I hope that will get fixed soon. I never used testing releases but instead of important information (like date, time, battery, volume etc) my whole status bar just shows this big red json format error and that already since this issue exists (so over two months).

mpas97 avatar Jun 29 '24 10:06 mpas97

@andrewdavidwong Any updates here? I hope that will get fixed soon. I never used testing releases but instead of important information (like date, time, battery, volume etc) my whole status bar just shows this big red json format error and that already since this issue exists (so over two months).

This is absolutely not a priority. Feel free to fix it and open a PR.

fepitre avatar Jun 29 '24 13:06 fepitre

I leave that to @daktak @BetoHydroxyButyrate as they are familiar with the code and already proposed some solutions.

mpas97 avatar Jun 29 '24 13:06 mpas97

I took some extra time for reworking the whole in Python. Feel free to test it, give me some feedback before we merge it please.

fepitre avatar Jun 30 '24 14:06 fepitre

Tested qubes-i3status.py on my side, work fine. For a future update probably need to find a way on how to handle "audiovm" once it is officially supported

neowutran avatar Aug 05 '24 06:08 neowutran

For a future update probably need to find a way on how to handle "audiovm" once it is officially supported

Please open a separate issue for that.

andrewdavidwong avatar Aug 09 '24 18:08 andrewdavidwong

Automated announcement from builder-github

The package desktop-linux-i3-settings-qubes has been pushed to the r4.3 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing bookworm-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Aug 11 '24 21:08 qubesos-bot

Automated announcement from builder-github

The component desktop-linux-i3-settings-qubes (including package desktop-linux-i3-settings-qubes) has been pushed to the r4.3 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.3-current-testing

Changes included in this update

qubesos-bot avatar Aug 11 '24 21:08 qubesos-bot

Automated announcement from builder-github

The component desktop-linux-i3-settings-qubes (including package desktop-linux-i3-settings-qubes) has been pushed to the r4.3 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.3-current-testing

Changes included in this update

qubesos-bot avatar Aug 11 '24 21:08 qubesos-bot

Automated announcement from builder-github

The package desktop-linux-i3-settings-qubes has been pushed to the r4.3 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing trixie-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Aug 11 '24 22:08 qubesos-bot

Automated announcement from builder-github

The package desktop-linux-i3-settings-qubes has been pushed to the r4.2 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing bookworm-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Sep 03 '24 13:09 qubesos-bot

Automated announcement from builder-github

The package desktop-linux-i3-settings-qubes has been pushed to the r4.2 testing repository for the Debian template. To test this update, first enable the testing repository in /etc/apt/sources.list.d/qubes-*.list by uncommenting the line containing trixie-testing (or appropriate equivalent for your template version), then use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Sep 03 '24 13:09 qubesos-bot

Automated announcement from builder-github

The component desktop-linux-i3-settings-qubes (including package desktop-linux-i3-settings-qubes) has been pushed to the r4.2 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Sep 03 '24 14:09 qubesos-bot

Automated announcement from builder-github

The component desktop-linux-i3-settings-qubes (including package desktop-linux-i3-settings-qubes) has been pushed to the r4.2 testing repository for the Fedora template. To test this update, please install it with the following command:

sudo dnf update --enablerepo=qubes-vm-r4.2-current-testing

Changes included in this update

qubesos-bot avatar Sep 03 '24 15:09 qubesos-bot

Automated announcement from builder-github

The package desktop-linux-i3-settings-qubes has been pushed to the r4.2 stable repository for the Debian template. To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Sep 17 '24 01:09 qubesos-bot

Automated announcement from builder-github

The package desktop-linux-i3-settings-qubes has been pushed to the r4.2 stable repository for the Debian template. To install this update, please use the standard update command:

sudo apt-get update && sudo apt-get dist-upgrade

Changes included in this update

qubesos-bot avatar Sep 17 '24 01:09 qubesos-bot