Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No audio detection (Pipewire support) #62

Open
Meister1593 opened this issue Feb 28, 2021 · 6 comments
Open

No audio detection (Pipewire support) #62

Meister1593 opened this issue Feb 28, 2021 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@Meister1593
Copy link

Meister1593 commented Feb 28, 2021

So issue is explained by title, xidlehook can't work with pipewire and simply does not detect any audio.
Pipewire has pulse module, most likely issue is that it haven't implemented 100% of pulse api.
I don't know exactly what would be better: to pipewire handle pulse methods properly or to implement pipewire support in xidlehook.
In first case, i think would be nice to know what part of libpulse has to be implemented to work properly with audio levels (or what is used inside xidlehook to detect audio)
In second case, there is two options: either to implement it through libpipewire, or to implement it through something that works with both pulse and with pipewire through libpulse (which is implemented in pipewire through pipewire-pulse).

Either way, it would be nice to have such support.

@jD91mZM2 jD91mZM2 added help wanted Extra attention is needed enhancement New feature or request labels Mar 1, 2021
@jD91mZM2
Copy link
Owner

jD91mZM2 commented Mar 1, 2021

Would be nice if someone who uses pipewire could implement a new module. The pulse module should be a useful template for how it could work

@Meister1593
Copy link
Author

It seems that pipewire now supports this correctly and while audio is playing caffeine activates automatically

@munkiwarra
Copy link

@Meister1593
But does it work for you with xidlehook as well now or just caffeine?
Since I switched to pipewire (I do not know if it does matter that I am using pipewire-pulse) --not-when-audio is unfortunately not working anymore.

@Meister1593
Copy link
Author

@Meister1593 But does it work for you with xidlehook as well now or just caffeine? Since I switched to pipewire (I do not know if it does matter that I am using pipewire-pulse) --not-when-audio is unfortunately not working anymore.

a lot of stuff happened in a while and unfortunately author of this tool passed away
i don't use xidlehook anymore (i use just gnome instead of setup i had) and if you're willing to use it, be mindful that it's unmaintained now

@munkiwarra
Copy link

Thank you. I just read the text from Jackpot51 about it. That is sad.

@cristianmiranda
Copy link

Very sad to hear about jD91mZM2 😢

For those who want to keep using xidlehook and are still struggling with pipewire support, I found a workaround that is not the most elegant solution but works for me.

xidlehook has a cool feature that allows you to use sockets to communicate (see https://github.com/jD91mZM2/xidlehook#socket-api), so you can manually reset the timer at any given time (sending a message to the same socket you're using for idle detection).

If you run xidlehook like so:

xidlehook --socket /tmp/xidlehook.sock --not-when-audio --timer 600 "$HOME/bin/lock-screen" "" &

... then you could reset the timer checking for running sinks manually:

#
# Abort if there are any kind of sinks running (music audio, meetings, etc.)
#
echo "Checking running sinks..."

RUNNING_SINKS=$(pactl list short sinks | grep -c RUNNING)
if [ $RUNNING_SINKS -gt 0 ]; then
    echo "There are $RUNNING_SINKS running sinks. Aborting lock screen."
    xidlehook-client --socket /tmp/xidlehook.sock reset-idle
else
    echo "No running sinks. Locking screen..."    
    # lock screen using i3lock or whatever program you would normally use 
fi

The important piece here is the use of --socket when running xidlehook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants