Closed clemencyworld1 closed 3 weeks ago
This sounds like it would be a good fit for pywayfire. You can receive events and play sounds however you'd like.
Please, what's pywayfire and how do i get it? Have not heard about it.
if ur ok with a bit of scripting, pywayfire would be good i think. its a python binding for the wayfire ipc(it communicates with wayfire to tell it to do things, and it can listen to special events from wayfire, like closing windows or minimising or opening…) just read github.com/wayfireWM/pywayfire
Please, what's pywayfire and how do i get it? Have not heard about it.
I will try and go through it. But i have only little scripting knowledge.
I will try and go through it. But i have only little scripting knowledge.
I put together this python script that can help get you started. It just prints a messages on key events. You would have to open and play a sound file instead. It requires ipc plugin to be enabled.
EDIT: It might be easiest at first, to call an external utility like aplay
, with subprocess.Popen()
or the like.
yeah, so
I will try and go through it. But i have only little scripting knowledge.
I put together this python script that can help get you started. It just prints a messages on key events. You would have to open and play a sound file instead. It requires ipc plugin to be enabled.
EDIT: It might be easiest at first, to call an external utility like
aplay
, withsubprocess.Popen()
or the like.
Just put import playsound
at the start of your code and then replace the print statements with playsound('path_to_sound_file')
Since there are event pairs such as open/close, I found it convenient to be able to play sound files in reverse. This way, you get two comparable sounds with only one file. You can do with with play $file reverse
from sox.
Thanks for your replies and assistance. This is what i have done so far:
× This environment is externally managed ╰─> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install.
If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.
If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.
See /usr/share/doc/python3.12/README.venv for more information.
note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages. hint: See PEP 668 for the detailed specification. "
From the instruction above i created a virtual env for python
python3 -m pip install . Then got this error "(venv) clemency@debian:~/pywayfire$ python3 -m pip install . Processing /home/clemency/pywayfire Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [14 lines of output] error: Multiple top-level packages discovered in a flat-layout: ['path', 'wayfire'].
To avoid accidental inclusion of unwanted files or directories, setuptools will not proceed with this build.
If you are trying to create a single distribution with multiple packages on purpose, you should not rely on automatic discovery. Instead, consider the following options:
find
directive with include
or exclude
)src-layout
explicitly set py_modules
or packages
with a list of names
To find more information, look for "package discovery" on setuptools docs. [end of output]
note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.
note: This error originates from a subprocess, and is likely not a problem with pip. "
What if you try pip3 install --user .
?
Finally i did "pip install wayfire" and it seem to have installed.
What if you try
pip3 install --user .
?
No such option '--user'. I changed "user" to my name
i believe i see the problem. you say you enabled ipc protocol in the wayfire config manager. however, you also need to have ipc-rules enabled, and that only shows up in the config file. ~/.config/wayfire.ini. u have to add ipc-rules to the end of the plugins line
@clemencyworld1 If you need further help, please join #wayfire on IRC, matrix or discord.
I am closing this issue mostly because the IPC system can do that and I don't plan on adding a plugin for sound, especially since it is so easily doable with IPC. Feel free to ask more questions in the support channels that were mentioned in the previous comment ;)
Specifically, i will like to play some sounds for some wayfire events like window open, close, minimize, maximize etc and probably other system events like in gnome and some x11 window managers (sawfish). I don't know if such functionality exists, if so i need direction on adding it to my wayfire.ini. If not, i kindly request that such be considered in future release even as a plugin just the way we set keybindings for commands.
Thanks