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

Implement icon that can be swallowed into mlvwm menu bar to open xsndiomenu #1

Open
morgant opened this issue Nov 19, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@morgant
Copy link
Owner

morgant commented Nov 19, 2023

Since I primarily use MLVWM with the mlvwmrc configuration, I'd like a more Mac-like way to open xsndiomenu. Preferably, a MenuExtra-like icon that can be 'swallowed' into the mlvwm menu bar.

My wishlist includes:

  • Monotone & color icon options
  • The icon should represent the sndio server device's output level or mute status
  • Clicking on the icon should open the xnsdiomenu menu positioned at the bottom-left of the icon
@morgant morgant self-assigned this Nov 19, 2023
@morgant morgant added the enhancement New feature or request label Nov 19, 2023
@morgant
Copy link
Owner Author

morgant commented Nov 19, 2023

I discovered that Lucas de Sena, the developer of xmenu which xsndiomenu uses to render its X11 menu, also has a utility named wmlaunchbutton which can render an pixmap (XPM) that clicking on will launch a command. There's not currently a packaged port for OpenBSD, but it builds and runs successfully using the included Makefile.

In my testing, it can easily be swallowed into the mlvwm menu bar, supports different icons for normal/hover/active state, and launches xsndiomenu on each click. It also sets an BUTTON_GEOMETRY environment variable with the icon's width, height, and x/y offset, which would likely make it possible to position xsndiomenu's menu at the bottom-left of the icon.

I was able to track down the FamFamFam Silk icons (circa 2006) and it has nice, color, 16x16 PNGs of full/low/none/muted speaker. They were easily converted to XPM using ImageMagick's convert and look good enough for initial use. Plus, they're released under a Creative Commons by-attribution license.

The one thing I'm not currently sure about is whether I can dynamically change the wmlaunchbutton icon while it's swallowed into the mlvwm menu bar. OpenBSD's sndioctl(1) has a -m option that will keep running and print controls as they change, so that should allow me to easily detect when to change the icon, but wmlaunchbutton itself doesn't appear to have a way to change the icon post-launch. I can easily relaunch wmlaunchbutton with a different icon, but since the X11 window will close, I'm expecting that it will disappear from the mlvwm menu bar.

@morgant morgant added this to the 0.2 milestone Nov 19, 2023
@morgant
Copy link
Owner Author

morgant commented Nov 19, 2023

I've got a WIP xsndioicon script which watches & parses sndioctl -m output and relaunches wmlaunchbutton with the appropriate icon. I've got to get it tested w/swallowing into the mlvwm menu bar to see if it works.

morgant added a commit that referenced this issue Nov 19, 2023
…ut and shows a sndio status icon using wmlaunchbutton. Issue #1
@morgant
Copy link
Owner Author

morgant commented Nov 19, 2023

I've now committed the initial version of an xsndioicon utility which watches sndioctl -m output and displays the clickable status icon via wmlaunchbutton.

I'm still experimenting with getting mlvwm to even swallow the wmlaunchbutton window.

morgant added a commit that referenced this issue Nov 29, 2023
@morgant
Copy link
Owner Author

morgant commented Nov 29, 2023

I've been testing a bit more with swallowing wmlaunchbutton into the menu bar with mlvwm and have it working directly. I've added an mlvwmrc MenuExtra configuration, plus install-mlvwmrc-menuextra & uninstall-mlvwmrc-menuextra targets in the Makefile.

Since I'm using wmlaunchbutton & xsndiomenu directly, instead of the experimental xsndioicon which relaunches wmlaunchbutton as a background process, I'm currently using just a static sound icon. I did have a discussion with Lucas de Sena on Mastodon regarding dynamically changing wmlaunchbutton icons via X resources, so will be opening an issue and trying to implement that soon. In the meantime, I'll likely strip the fancy functionality out of xnsdioicon for a release, then reintroduce it in a later version.

@morgant
Copy link
Owner Author

morgant commented Nov 18, 2024

I've been continuing to run the aforementioned changes locally, but have been trying to track down an annoying issue with the initial click on the xsndiomenu icon in mlvwm;s menu bar sometimes (often) not registering, so it takes multiple clicks to activate. I've finally tracked it down to an issue with mlvwm's OneClickMenu implementation.

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

No branches or pull requests

1 participant