doctorfree / MusicPlayerPlus

Featureful ncurses based MPD client inspired by ncmpc with integration for Beets, spectrum visualization,Bandcamp/Soundcloud, asciimatics, cantata, and more
https://musicplayerplus.dev
MIT License
69 stars 1 forks source link

Aur package and DWM #4

Closed se7en-x230 closed 1 year ago

se7en-x230 commented 1 year ago

System: arch Windows Manager: DWM Default terminal: st Xserver: default

If mpd is not running I can launch with mpplus the MAIN MENUE.

Following the instructions and launching via mpplus -M start prints exiting

Launching mppcava lauches cava in st.

wmctrl -l -G -x | grep kitty.kitty 0x04c0000e 0 63 65 1011 1033 kitty.kitty dellarch wmctrl -l -G -x | grep kitty.kitty

bash -x /usr/bin/mpplus

se7en-x230 commented 1 year ago

I am sure that DWM handles windows ID different.

I installed arch xfce and that launching musicplayerplus launches 2 windows

image

doctorfree commented 1 year ago

Yes, it appears DWM may not play nice with wmctrl and other external window management utilities. I'm reading up on this.

The quick workaround would be to simply provide an option to skip mpplus window placement. It's not necessary, it's only to center and align the visualizer with the player. Longer term I would prefer to either figure out how to do client window management with DWM (and maybe other window managers) or detect if DWM is being used and skip window placement.

Suckless is pointing out some things I would not have discovered. Good you are assisting.

Another issue in your testing is the activation of MPD. How did you have MPD setup prior to installing MusicPlayerPlus? How is it configured now? Is it running as a system service or as a user service? I probably make too many assumptions about the services MusicPlayerPlus attempts to manage. I want all of them to be user level systemd services. i should not be clobbering any existing service configuration but I may be reconfiguring the MPD service. I will re-examine that part of the code.

I will upload a workaround for DWM here, probably sometime later today or tomorrow.

doctorfree commented 1 year ago

@se7en-x230 what does the command wmctrl -m return when DWM is the window manager?

[EDIT] I am looking for some command I can run that will fail gracefully if the window manager is not EWMH compliant. The wmctrl command requires EWMH compliance. This is a relatively recent standard and several window managers do not implement it, DWM is not EWMH compliant. I am going to setup DWM and perform some tests. If you have time and still have DWM running somewhere, could you try running wmctrl -l to list the managed windows? Also try:

wmctrl -l > /dev/null 2>&1
echo $?

I am going to try this as well as other commands in an attempt to come up with a command that succeeds on EWMH compliant window managers but fails if not compliant.

se7en-x230 commented 1 year ago
  1. wmctrl -m ~ ❯ wmctrl -m Name: dwm Class: N/A PID: N/A Window manager's "showing the desktop" mode: N/A

  2. wmctrl -l ~ ❯ wmctrl -l 0x04e000b3 0 dellarch 08 - DP August.ods - LibreOffice Calc 0x03e00006 0 dellarch seven: wmctrl -l 0x04a00006 0 dellarch Telegram (4552) 0x01800002 0 dellarch Vieb - Aur package and DWM · Issue #4 · doctorfree/MusicPlayerPlus 0x03400003 0 dellarch N/A

  3. ~ ❯ wmctrl -l > /dev/null 2>&1

~ ❯ echo $?

0

doctorfree commented 1 year ago

@se7en-x230 it looks like DWM supports wmctrl just enough to prevent easy detection of EWMH support. I am currently looking at xprop as a way to check for a property that is not supposed to be present in EWMH non-compliant window managers.

The xprop utility is in the xorg-xprop package in AUR. On your system running DWM, what does the following command report:

xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}'

or just

xprop -root -notype | grep _NET_SUPPORTING_WM_CHECK

If something like the above works as a test for window manager support for positioning with wmctrl then I may add xorg-xprop as a dependency and implement this test. I spent quite a bit of time today googling for how to check if the running window manager is EWMH compliant but found nothing. Maybe it is not possible, probably very few people have the need for such a test. But they probably really do need such a test, I think people just use wmctrl and assume it works.

I also added a command line option to mpplus to disable use of extended window manager hints, thus disabling the attempt to position the terminal windows. If a test for EWMH compliance cannot be found, this is the workaround I've got thus far.

I plan on testing tomorrow and I will let you know when my changes to address DWM issues are ready to test.

Thanks

se7en-x230 commented 1 year ago

1 tag 3 windows image

2 tags, nr 1 with 3 as previous, nr2 with vieb browser image

se7en-x230 commented 1 year ago

~ ❯ xprop -root -notype | grep _NET_SUPPORTING_WM_CHECK _NET_SUPPORTED = _NET_SUPPORTED, _NET_WM_NAME, _NET_WM_STATE, _NET_SUPPORTING_WM_CHECK, _NET_WM_STATE_FULLSCREEN, _NET_ACTIVE_WINDOW, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_CLIENT_LIST _NET_SUPPORTING_WM_CHECK: window id # 0x400015

~ ❯ xprop -root -notype | awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}' 0x400015

doctorfree commented 1 year ago

Well, can't use that either. Tomorrow I will compare all the window manager properties between DWM and some EWMH compliant window manager. If I cannot find such a property then the command line option or some config value somewhere is going to have to suffice for now. I will continue to think and read about this.

doctorfree commented 1 year ago

I installed DWM from the AUR, without any changes to its config.h, and listed the window manager properties with xprop -root. I did the same on Ubuntu 20.03 running Gnome Shell as the window manager (with lots of extensions). The results indicate that DWM out of the box does not support very many window manager hints:

_NET_SUPPORTED(ATOM) = _NET_SUPPORTED, _NET_WM_NAME, _NET_WM_STATE, _NET_SUPPORTING_WM_CHECK, _NET_WM_STATE_FULLSCREEN, _NET_ACTIVE_WINDOW, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DIALOG, _NET_CLIENT_LIST

Notably missing from DWM window manager hints is _NET_WM_MOVERESIZE and _NET_WM_MOVERESIZE_WINDOW

Gnome Shell as I have it configured supports the following window manager hints:

_NET_SUPPORTED(ATOM) = _NET_WM_NAME, _NET_CLOSE_WINDOW, _NET_WM_STATE, _NET_WM_STATE_SHADED, _NET_WM_STATE_MAXIMIZED_HORZ, _NET_WM_STATE_MAXIMIZED_VERT, _NET_WM_DESKTOP, _NET_NUMBER_OF_DESKTOPS, _NET_CURRENT_DESKTOP, _NET_WM_WINDOW_TYPE, _NET_WM_WINDOW_TYPE_DESKTOP, _NET_WM_WINDOW_TYPE_DOCK, _NET_WM_WINDOW_TYPE_TOOLBAR, _NET_WM_WINDOW_TYPE_MENU, _NET_WM_WINDOW_TYPE_UTILITY, _NET_WM_WINDOW_TYPE_SPLASH, _NET_WM_WINDOW_TYPE_DIALOG, _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, _NET_WM_WINDOW_TYPE_POPUP_MENU, _NET_WM_WINDOW_TYPE_TOOLTIP, _NET_WM_WINDOW_TYPE_NOTIFICATION, _NET_WM_WINDOW_TYPE_COMBO, _NET_WM_WINDOW_TYPE_DND, _NET_WM_WINDOW_TYPE_NORMAL, _NET_WM_STATE_MODAL, _NET_CLIENT_LIST, _NET_CLIENT_LIST_STACKING, _NET_WM_STATE_SKIP_TASKBAR, _NET_WM_STATE_SKIP_PAGER, _NET_WM_ICON, _NET_WM_ICON_GEOMETRY, _NET_WM_MOVERESIZE, _NET_ACTIVE_WINDOW, _NET_WM_STRUT, _NET_WM_STATE_HIDDEN, _NET_WM_STATE_FULLSCREEN, _NET_WM_PING, _NET_WM_PID, _NET_WORKAREA, _NET_SHOWING_DESKTOP, _NET_DESKTOP_LAYOUT, _NET_DESKTOP_NAMES, _NET_WM_ALLOWED_ACTIONS, _NET_WM_ACTION_MOVE, _NET_WM_ACTION_RESIZE, _NET_WM_ACTION_SHADE, _NET_WM_ACTION_STICK, _NET_WM_ACTION_MAXIMIZE_HORZ, _NET_WM_ACTION_MAXIMIZE_VERT, _NET_WM_ACTION_CHANGE_DESKTOP, _NET_WM_ACTION_CLOSE, _NET_WM_STATE_ABOVE, _NET_WM_STATE_BELOW, _NET_STARTUP_ID, _NET_WM_STRUT_PARTIAL, _NET_WM_ACTION_FULLSCREEN, _NET_WM_ACTION_MINIMIZE, _NET_FRAME_EXTENTS, _NET_REQUEST_FRAME_EXTENTS, _NET_WM_USER_TIME, _NET_WM_STATE_DEMANDS_ATTENTION, _NET_MOVERESIZE_WINDOW, _NET_DESKTOP_GEOMETRY, _NET_DESKTOP_VIEWPORT, _NET_WM_USER_TIME_WINDOW, _NET_WM_ACTION_ABOVE, _NET_WM_ACTION_BELOW, _NET_WM_STATE_STICKY, _NET_WM_FULLSCREEN_MONITORS, _NET_WM_STATE_FOCUSED, _NET_WM_BYPASS_COMPOSITOR, _NET_WM_OPAQUE_REGION, _NET_WM_FRAME_DRAWN, _NET_WM_FRAME_TIMINGS, _NET_WM_WINDOW_OPACITY, _NET_RESTACK_WINDOW, _GTK_FRAME_EXTENTS, _GTK_SHOW_WINDOW_MENU, _GTK_EDGE_CONSTRAINTS, _GTK_WORKAREAS

Now I just have to figure out a programmatic method for querying the window manager for _NET_WM_MOVERESIZE support.

Progress

doctorfree commented 1 year ago

I was able to detect if the window manager supports extended window manager hints to move and resize a window. Currently, if the window manager does not support move and resize then mpplus enables console mode which runs both mpcplus and mppcava in a single terminal window in a tmux session. Tmux handles positioning and sizing of the panes. I may be able to improve upon this over time but that's the solution I have implemented for now. It covers not only DWM but all the window managers out there that do not support these extended window manager hints completely. It's more than you would think.

But, tmux has its own problems. So I would like to find a better solution. I've added a tmux key binding to exit a session with Alt-x and I'm using tmuxp which eases the difficulty of creating tmux sessions quite a bit.

I made quite a lot of changes since v2.0.1r2 so if you wish to test the current state of affairs it would be best to install v2.0.1r3 rather than just replace mpplus and mppinit. I've also added a new config file ~/.config/musicplayerplus/config which is where the music library location is configured and where some terminal preferences are stored so these preferences can persist over invocations.

The new version (not yet released and in need of quite a bit more testing) can be installed with:

git clone https://github.com/doctorfree/MusicPlayerPlus.git
cd MusicPlayerPlus
./mkpkg
./Install

Thanks for helping me get this to work on DWM and other window managers. What a mess the window manager world is in!

se7en-x230 commented 1 year ago

You are getting somewhere :)

building the newest version and recreating all config files leads to: mpplus image once I quite out of that window (guess kitty) I end up in the ncmpcpp playlist ... in the screenshot I changed to the browser window. image

doctorfree commented 1 year ago

@se7en-x230 Thanks! I believe I've fixed that and an appropriate tmux session is spawned when move/resize are not supported by the window manager. In the process I discovered spectrum visualization was not working if Mopidy was enabled rather than MPD. This is because the visualizer data source for Mopidy requires PulseAudio and that was not installed.

This is off-topic and another issue but what do you think about adding pulseaudio and pulseaudio-alsa to the package dependencies? It would only be needed for Mopidy spectrum visualization. Maybe some people object to PulseAudio? I am debating how best to handle this dependency.

I should have a revised package ready to test sometime this weekend depending on how much time I give myself to enjoy the holiday weekend.

Your help in adding Arch support and testing has been invaluable. I consider testing to be an integral component of the development process. If you would like to be credited in the MusicPlayerPlus README then send me your name and email address (or none if you wish to keep it private).

doctorfree commented 1 year ago

I decided to deal with PulseAudio in mppinit during Mopidy initialization rather than as a dependency. I've committed the changes for running under DWM along with those for Mopidy/PulseAudio. I will test as I have time this weekend. These latest changes can be installed as above with:

[EDIT] Hold off on testing until I fix a typo and update

se7en-x230 commented 1 year ago

This is off-topic and another issue but what do you think about adding pulseaudio and pulseaudio-alsa to the package dependencies? It would only be needed for Mopidy spectrum visualization. Maybe some people object to PulseAudio? I am debating how best to handle this dependency.

  • I would guess that most arch user use pulse or moved on to pipewire as I did. I am not a big fan of lots of dependencies but I also don't know what musicplayerplus needs to funktion.

  • I should have a revised package ready to test sometime this weekend depending on how much time I give myself to enjoy the holiday weekend.

  • Good. Have fun.

Your help in adding Arch support and testing has been invaluable. I consider testing to be an integral component of the development process. If you would like to be credited in the MusicPlayerPlus README then send me your name and email address (or none if you wish to keep it private).

  • All good. I didn't do much and I am fine to test things. No need for a credit.
doctorfree commented 1 year ago

Okay, this looks good so far. Give it a whirl if you get a chance.

git clone https://github.com/doctorfree/MusicPlayerPlus.git
cd MusicPlayerPlus
./Uninstall
./mkpkg
./Install
se7en-x230 commented 1 year ago
  1. test I start mpplus from inside the termial st ncmpcpp starts in st, and immediately overlays the entire window with the visualizer (looks like ktty). I am unable to change between the 2 windows. If I quit out of the visualizer I drop back to st (ncmpcpp)

  2. test I start mpplus from the dmenu (app launcher) The visualizer starts in kitty. I quite out and all windows are closed.

  3. test Start mpplus from inside kitty image

se7en-x230 commented 1 year ago
  1. test launching mpcplus in st launching mppclava in another st

image

se7en-x230 commented 1 year ago
  1. test my favorite launching mpcplus-tmux from instide st

image

se7en-x230 commented 1 year ago
  1. test launching mpcplus-tmux from dmenu (app launcher) nothing happens.

  2. test launching kitty and from there mpcpluss-tmux works but the theme is too dark.

image

plus kitty is hungry :)

image

doctorfree commented 1 year ago

This is great, just what I need. There are several ways terminal windows and panes are positioned and sized. The window manager does this, some terminal emulators have this capability, and session managers like tmux arrange them. Your trying out several different ways to launch with different window placements is revealing.

I was expecting you to see a tmux session for all of your tests under DWM. Did you change to a different window manager?

What is the output of xprop -root -notype | grep _NET_SUPPORTED | grep _NET_MOVERESIZE_WINDOW

Can you send me the full output of xprop -root -notype ?

I am not familiar with dmenu but have been intending to learn. I will play around with dmenu and see if I can come up with appropriate menu entries.

I would expect Kitty to be larger than st but 5 times larger!?! As for the Kitty theme, it is configurable. MusicPlayerPlus includes over 150 Kitty themes and uses the Floraverse theme by default. Kitty themes are placed in ~/.config/kitty/themes/ and selected with include themes/Floraverse.conf in ~/.config/kitty/kitty.conf. I don't expect you to solve my Kitty issues, just fyi if you wish to use a different Kitty theme. Right now there is no UI theme selector but that would be a good project for someone.

My main concern at this point is window placement and sizing. Problems like Test 1 with one window overlaying the other should be averted either by using the window manager's placement/sizing capabilities or with tmux. Why isn't that happening as expected in some of your testing? Other placement/sizing issues in your tests may be addressable through modifying the layout specified using the terminal emulator's capabilities. For example, in Test 3 it appears Kitty is using its Layout facility and positioning the windows with the Tall layout. Maybe a different layout would be preferable. I have to experiment.

Thanks, good job. Send xprop output and results of any further testing. I will probably not have any further updates till after the holiday.

se7en-x230 commented 1 year ago

I was expecting you to see a tmux session for all of your tests under DWM. Did you change to a different window manager?

  • nope still using DWM.

What is the output of xprop -root -notype | grep _NET_SUPPORTED | grep _NET_MOVERESIZE_WINDOW

I am not familiar with dmenu but have been intending to learn. I will play around with dmenu and see if I can come up with appropriate menu entries.

  • dmenu is similar to rofi a app launcher. DE would use a menu style thing. I guess the problem here is that launching needs a terminal first to then spawn the program. st -e someProgram.

I would expect Kitty to be larger than st but 5 times larger!?! As for the Kitty theme, it is configurable. MusicPlayerPlus includes over 150 Kitty themes and uses the Floraverse theme by default. Kitty themes are placed in ~/.config/kitty/themes/ and selected with include themes/Floraverse.conf in ~/.config/kitty/kitty.conf. I don't expect you to solve my Kitty issues, just fyi if you wish to use a different Kitty theme. Right now there is no UI theme selector but that would be a good project for someone.

  • I looked at kitty.conf as the font size was by default huge. But I think I speak for most WM user. Usually people theme things and fiddle with the configs. To an extend that they have "the" terminal emulator and would probably not mix.

My main concern at this point is window placement and sizing. Problems like Test 1 with one window overlaying the other should be averted either by using the window manager's placement/sizing capabilities or with tmux. Why isn't that happening as expected in some of your testing? Other placement/sizing issues in your tests may be addressable through modifying the layout specified using the terminal emulator's capabilities. For example, in Test 3 it appears Kitty is using its Layout facility and positioning the windows with the Tall layout. Maybe a different layout would be preferable. I have to experiment.

The window positioning and layout is fine even with multiple st open. image

Also if I launch kitty image

BUT the layout changes in st once I open mpcplus-tmux in kitty... image

Must be a kitty thing as 2 st do not have that layout "jump" problem. image

Thanks, good job. Send xprop output and results of any further testing. I will probably not have any further updates till after the holiday.

se7en-x230 commented 1 year ago

I "recreated" the tmux + ncmpcpp-ueberzug + cava setup. Obviously not the same but I like the setup.

image

doctorfree commented 1 year ago

Your recreated layout is what I was shooting for and my motivation for MusicPlayerPlus when I started the project. I wanted a character-based setup that provided an MPD client, spectrum visualizer, and album cover art display. Tmux, ncmpcpp, cava, and ueberzug fit the bill. Then the project began to sprout tentacles and grew quickly. Now I am thinking I should prune it or somehow divide it up into several projects. Your recreation looks nice!

I committed quite a few changes last night, additional support for user preferences in ~/.config/mpprc a check if the window manager supports transparency, and several fixes. I still have a lot of testing to do and I've started playing around with dmenu. As you mentioned earlier, I think dmenu may need to launch apps that create their own window so in my case that would be a terminal emulator running the desired script. I have a lot to learn.

doctorfree commented 1 year ago

If you have made any customized settings in the configuration files for ncmpcpp, cava, tmux, or the neat trick of getting ueberzug to display cover art in tmux then feel free to share them with me and I will compare with what I have done. But, maybe we have done pretty much the same thing?

I struggled deciding which ncmpcpp setting for progressbar_look I liked the best. Things like that are personal preferences and vary from person to person but I wanted to provide defaults that look nice. Yours looks pretty nice.

se7en-x230 commented 1 year ago

If you have made any customized settings in the configuration files for ncmpcpp, cava, tmux, or the neat trick of getting ueberzug to display cover art in tmux then feel free to share them with me and I will compare with what I have done. But, maybe we have done pretty much the same thing?

  • I basically launch tmux with one horizontal split. tmux new-session 'ncmpcpp-ueberzug'\; split-window -v -p 30 'cava'\;

I struggled deciding which ncmpcpp setting for progressbar_look I liked the best. Things like that are personal preferences and vary from person to person but I wanted to provide defaults that look nice. Yours looks pretty nice.

  • yes most people probably adjust the main look and feel to their needs. In general I find your project ambiguous because of the 1000 things that change the intended setup, like terminal, compositor ...

**** offtopic My initial setup is playing music via lf (file manager) by a keybinding launching mpv --shuffle --no-video . This let's me play music out of my file browser, anywhere in the system. Very small footprint and controlable from anywhere due to a playerctrl script that lets me control the player by either keybindings or clicking on the dwmbocks entry.

image

doctorfree commented 1 year ago

@se7en-x230 thanks for sharing the details of your "reproduction". You have been very helpful improving this project in several ways. Changes to test for the existence of one of the supported terminal emulators during initialization should be ready to commit soon. These changes will detect if a supported terminal emulator is already present and, if so, configure MusicPlayerPlus to use that terminal emulator as the default. I am hopeful that this avoids altering the user's expected experience. If you have any other areas in which similar improvements could be made, please let me know. Maybe "1000 things" is a slight exaggeration? I am aware of several areas where I need to accommodate previously configured user preferences and settings. I wish to address as many of these types of issues as possible. Feel free to open issues detailing where you feel the user intended setup is altered in an unsatisfactory manner. I welcome being scorched by criticism, flame away!

At any rate, you have been a big help with getting Arch support, DWM support, st support, and other areas. Thanks!

se7en-x230 commented 1 year ago

Maybe "1000 things" is a slight exaggeration? I am aware of several areas where I need to accommodate previously configured user preferences and settings. I wish to address as many of these types of issues as possible. Feel free to open issues detailing where you feel the user intended setup is altered in an unsatisfactory manner. I welcome being scorched by criticism, flame away!

  • I meant things like checking what terminal emulator, font, configs for mpd, cava .... already exist and than let musicplayerplus make the right decisions. Defensively a complex project.

At any rate, you have been a big help with getting Arch support, DWM support, st support, and other areas. Thanks!

  • Welcome I have to thanks. I also learned a lot on the way.
doctorfree commented 1 year ago

@se7en-x230 utilizing existing configurations and user setup is a good goal. I have tried to do so in some cases (e.g. tmux), recently done so in other cases (e.g. which terminal emulator is used by default), plan to do so or do not know how to do so in others. Complicating matters is my desire to keep the features and usage the same across several Linux platforms.

I am going to try and identify and prioritize these "Preserve User Configuration" types of issues. I believe I have resolved the "Which terminal emulator to use" issue in the latest commits. The areas I am aware of that need attention are:

There are probably additional areas where user configuration should be preserved.

By "preserve" I mean integrate any custom user configuration into the configuration used by MusicPlayerPlus. This is difficult.

I feel font settings are ok to alter as long as they are restored to the user's preference upon exit. I use monospace fonts throughout and adjust font sizes in some places. Preserving user font preferences is going to be harder. Maybe it is just the font size that is an issue?

I will open an issue for each of these as I tackle them. If you have details on specific problems you encountered with user preferences being ignored or altered, that would be helpful. In general, I know what you are talking about and agree that it needs to be addressed.

doctorfree commented 1 year ago

I believe MusicPlayerPlus is now functioning properly under DWM. I am closing this issue but please re-open if problems running under DWM persist.

I have opened a new issue at https://github.com/doctorfree/MusicPlayerPlus/issues/5 to address integrating previously existing ncmpcpp user preferences into the mpcplus config. I plan on opening an issue for each component's "Preserve user preferences". Please address comments on those issues there.