GithubHelp home page GithubHelp logo

Comments (12)

MaxVerevkin avatar MaxVerevkin commented on August 17, 2024 1

Could you try #2049?

from i3status-rust.

alternateved avatar alternateved commented on August 17, 2024 1

This works great, I've tested with both wireless and wired headphones:

 $ RUST_LOG=sound=debug ~/.cargo/bin/i3status-rs 
{"version": 1, "click_events": true}
[
[2024-04-23T20:01:13Z DEBUG sound] form_factor = None
[],
[],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":" 0% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:13Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":" 0% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:13Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:24Z DEBUG sound] form_factor = None
[2024-04-23T20:01:24Z DEBUG sound] form_factor = None
[2024-04-23T20:01:24Z DEBUG sound] form_factor = None
[2024-04-23T20:01:24Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:24Z DEBUG sound] form_factor = Some("headset")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:32Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:32Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:32Z DEBUG sound] form_factor = None
[2024-04-23T20:01:32Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:32Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:32Z DEBUG sound] form_factor = Some("headset")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"31% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:32Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:48Z DEBUG sound] form_factor = None
[2024-04-23T20:01:48Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:01:48Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:02:00Z DEBUG sound] form_factor = None
[2024-04-23T20:02:00Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T20:02:00Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],

from i3status-rust.

alternateved avatar alternateved commented on August 17, 2024 1

Thanks a lot for your time and work! I really appreciate it.

from i3status-rust.

alternateved avatar alternateved commented on August 17, 2024

Hmm, I don't think that this fixes it, there is no change.

from i3status-rust.

MaxVerevkin avatar MaxVerevkin commented on August 17, 2024

It fixes it for me 😆

Let me add some debug prints...

from i3status-rust.

alternateved avatar alternateved commented on August 17, 2024

Is there any way that I could debug it?

from i3status-rust.

MaxVerevkin avatar MaxVerevkin commented on August 17, 2024

Try #2049 with RUST_LOG=sound=debug cargo r >/dev/null (I mean share the output)

from i3status-rust.

alternateved avatar alternateved commented on August 17, 2024
$ RUST_LOG=sound=debug ~/.cargo/bin/i3status-rs 
{"version": 1, "click_events": true}
[
[2024-04-23T19:44:21Z DEBUG sound] form_factor = None
[],
[],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":" 0% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:44:21Z DEBUG sound] form_factor = None
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":" 0% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:44:21Z DEBUG sound] form_factor = Some("analog-output-speaker")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:44:29Z DEBUG sound] form_factor = Some("analog-output-speaker")
[2024-04-23T19:44:29Z DEBUG sound] form_factor = Some("analog-output-speaker")
[2024-04-23T19:44:29Z DEBUG sound] form_factor = Some("analog-output-speaker")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:44:29Z DEBUG sound] form_factor = Some("analog-output-speaker")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:44:29Z DEBUG sound] form_factor = Some("headset-hf-output")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:44:29Z DEBUG sound] form_factor = Some("headset-hf-output")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],

Weird, we get headset-hf-output. Let me check wired headphones too (those were BT).

from i3status-rust.

alternateved avatar alternateved commented on August 17, 2024

Continuation:

[2024-04-23T19:44:29Z DEBUG sound] form_factor = Some("headset-hf-output")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:45:56Z DEBUG sound] form_factor = Some("analog-output-speaker")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:45:56Z DEBUG sound] form_factor = Some("analog-output-speaker")
[2024-04-23T19:45:56Z DEBUG sound] form_factor = Some("analog-output-speaker")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:45:56Z DEBUG sound] form_factor = Some("analog-output-speaker")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:45:56Z DEBUG sound] form_factor = Some("headset-output")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"31% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:45:56Z DEBUG sound] form_factor = Some("analog-output-speaker")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"75% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:46:13Z DEBUG sound] form_factor = Some("analog-output-headphones")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:46:13Z DEBUG sound] form_factor = Some("analog-output-headphones")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],
[2024-04-23T19:46:13Z DEBUG sound] form_factor = Some("analog-output-headphones")
[{"full_text":" ","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"  ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"},{"full_text":"40% ","name":"0","instance":"0:","separator":false,"separator_block_width":0,"markup":"pango"}],

So analog-output-headphones would be for wired ones.

from i3status-rust.

MaxVerevkin avatar MaxVerevkin commented on August 17, 2024

Waaait.

fn form_factor(&self) -> Option<&str> {
self.active_port.as_deref()
}

That should be self.form_factor.as_deref(). My mistake in 477f505.

from i3status-rust.

alternateved avatar alternateved commented on August 17, 2024
diff --git a/src/blocks/sound.rs b/src/blocks/sound.rs
index 9ad5e706..f8477ac9 100644
--- a/src/blocks/sound.rs
+++ b/src/blocks/sound.rs
@@ -156,6 +156,8 @@ pub async fn run(config: &Config, api: &CommonApi) -> Result<()> {
                 // https://docs.rs/libpulse-binding/2.25.0/libpulse_binding/proplist/properties/constant.DEVICE_FORM_FACTOR.html
                 Some("headset")
                 | Some("headphone")
+                | Some("headset-hf-output")
+                | Some("analog-output-headphones")
                 | Some("hands-free")
                 | Some("portable")
                 | Some("[Out] Headphones") => true,

That obviously works, but doesn't seem ideal.

from i3status-rust.

MaxVerevkin avatar MaxVerevkin commented on August 17, 2024

Can you test that PR now?

from i3status-rust.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.