jwm icon indicating copy to clipboard operation
jwm copied to clipboard

Add new button label positions along with new vertical tasklist mode when labelpos is set to top or bottom

Open purpasmart96 opened this issue 1 year ago • 10 comments

This is a WIP prototype of vertical buttons. They are now utilized for the tasklist when the tray is vertical. I'm not quite yet satisfied with it yet since there are still some issues with resizing and the text disappearing too early when the task icon is too big. But I plan to address those issues.

It will currently try to center the text if the text width is less than or equal to the icon width, otherwise, it will have the text on the left.

To avoid too many changes I just made another Button function that handles drawing instead of adding new logic to the existing DrawButton function.

I did take out some of the existing logic that was in DrawButton and move them into their own functions but I only did that for some parts of it since the parts that use preprocessor macros didn't end up working for me. So I just left them as is.

I posted my results in an existing issue over at https://github.com/joewing/jwm/issues/457 But I don't think too many people noticed it so I'm posting it here for further feedback/ideas.

Screenshot_20240627_152205

FYI: The User defined height attribute for the tasklist is ignored for now.

purpasmart96 avatar Jun 29 '24 09:06 purpasmart96

I think this should probably be a configuration option on the tray or maybe it should use the tray width to decide what to do. I suspect there are users who want trays to show up with the icon and text as they would appear in a menu. Otherwise I think this looks good.

joewing avatar Jul 07 '24 22:07 joewing

I think this should probably be a configuration option on the tray or maybe it should use the tray width to decide what to do. I suspect there are users who want trays to show up with the icon and text as they would appear in a menu.

Yeah, I was thinking of having this as an alternative tray mode you can toggle on, otherwise it will use the original logic for the tray when vertical.

purpasmart96 avatar Jul 08 '24 23:07 purpasmart96

@joewing Alright, I added "altvertlist" attribute to toggle on or off the new vertical tasklist in the TaskListStyle. Do You think this name is fine? And what order would you like this attribute to be in TaskListStyle? Right now I have it positioned after "list".

By default, it is set to false and will use the previous vertical tasklist logic.

I also did some minor refactoring of the ComputeItemSize function.

It already uses the tray width to automatically calculate the tasklist item size. Now, since this is a vertical tray things get swapped around since the actual width is the tray height and the real height is the tray width if that makes any sense. So I end up reusing the "maxwidth" attribute from TaskList as the real max height.

Basically, everything is automatically calculated the same way it's done normally when the tray is horizontal, but with some height and width swapped.

I'm going to try to adjust the vertical button so it prioritizes the label when it's enabled so it doesn't disappear so early when room starts running out in the tray.

purpasmart96 avatar Jul 10 '24 00:07 purpasmart96

For the configuration, it might make it easier to use if it was more explicit... Maybe something like

<TaskListStyle labelpos="right" ...>

and

<TaskListStyle labelpos="bottom" ...>

That way there is also an obvious path to placing the label above or to the left.

joewing avatar Jul 14 '24 15:07 joewing

Yeah, that looks way more clear.

purpasmart96 avatar Jul 14 '24 17:07 purpasmart96

@joewing Do you think labelpos should be part of TaskListStyle or part of <TaskList> from the tray? Edit: Yeah I think having the label position as part of <TaskList/> makes sense. Having it defined in the TaskListStyle means that it will apply for all trays.

purpasmart96 avatar Jul 16 '24 20:07 purpasmart96

Yeah, having it as part of the tray or TaskList probably makes more sense. It's more a layout thing than a style thing anyway.

joewing avatar Jul 17 '24 22:07 joewing

@joewing Well, I ended up doing that and much more. I added button label positions. The button now has 3 different positions. right, top, and bottom.

You can now also have buttons of different styles regardless of tray orientation.

bottom labels on horizontal tray.

horz_bottom_scrot

bottom labels on vertical tray.

vertical_bottom_scrot

top labels on horizontal tray.

horz_top_scrot

top labels on vertical tray.

vertical_top_scrot

By default the button label position is LABEL_POSITION_RIGHT and everything should stay the same by default.

purpasmart96 avatar Jul 22 '24 02:07 purpasmart96

I might rename the PR to reflect the new changes.

purpasmart96 avatar Jul 22 '24 02:07 purpasmart96

@joewing Should be ready to go. I could also further abstract DrawButton if you want.

I can put the logic for drawing the border and background into their separate functions.

purpasmart96 avatar Jul 23 '24 22:07 purpasmart96

Looks good, thanks! I think the only thing left to do would be to document the new feature in jwm.1.in.

joewing avatar Jul 26 '24 00:07 joewing

Looks good, thanks! I think the only thing left to do would be to document the new feature in jwm.1.in. Ahh ok, I will take care of that real quick!

purpasmart96 avatar Jul 26 '24 06:07 purpasmart96

@joewing Alright. It should be ready to go!

purpasmart96 avatar Jul 26 '24 06:07 purpasmart96

Thank you!

joewing avatar Jul 27 '24 12:07 joewing

Thank you!

Glad to get this merged!

purpasmart96 avatar Jul 27 '24 20:07 purpasmart96