MTMR icon indicating copy to clipboard operation
MTMR copied to clipboard

Show icon for a group

Open Sn0wCooder opened this issue 5 years ago • 23 comments

Sn0wCooder avatar Jan 15 '20 21:01 Sn0wCooder

I have made it so you can define an image for a group, I have created a pull request: https://github.com/Toxblh/MTMR/pull/266/

Hopefully it gets merged.

maandagdev avatar Jan 24 '20 00:01 maandagdev

@maandagdev Heya! I'm using your code which works well. Plus i have also extended it to allow for 'width' parameters for groups. Do you have any idea how to enable the 'border' (.isBorder) for group toggle-button aswell? Tried to modify collapsedRepresentation without any success so far. Maybe you have a lil hint for me (ツ)

dieideeistgut avatar Feb 05 '20 11:02 dieideeistgut

@maandagdev Heya! I'm using your code which works well. Plus i have also extended it to allow for 'width' parameters for groups. Do you have any idea how to enable the 'border' (.isBorder) for group toggle-button aswell? Tried to modify collapsedRepresentation without any success so far. Maybe you have a lil hint for me (ツ)

Nice! I am glad the code is working for you as well, not sure why the border is not working, I will have to go through the code and have a look for you. Can you show me an example of how you want it to look? (Never got the border to work for any of the items)

maandagdev avatar Feb 05 '20 11:02 maandagdev

@maandagdev Heya! I'm using your code which works well. Plus i have also extended it to allow for 'width' parameters for groups. Do you have any idea how to enable the 'border' (.isBorder) for group toggle-button aswell? Tried to modify collapsedRepresentation without any success so far. Maybe you have a lil hint for me (ツ)

Nice! I am glad the code is working for you as well, not sure why the border is not working, I will have to go through the code and have a look for you. Can you show me an example of how you want it to look? (Never got the border to work for any of the items)

Sure thing! I'd love just to be able to get the bordered-param working for groups:

    "type": "group",
    "width": 32,
    "bordered": false,
    [...]

A small hint may be enough (ツ)

dieideeistgut avatar Feb 05 '20 11:02 dieideeistgut

@maandagdev Heya! I'm using your code which works well. Plus i have also extended it to allow for 'width' parameters for groups. Do you have any idea how to enable the 'border' (.isBorder) for group toggle-button aswell? Tried to modify collapsedRepresentation without any success so far. Maybe you have a lil hint for me (ツ)

Nice! I am glad the code is working for you as well, not sure why the border is not working, I will have to go through the code and have a look for you. Can you show me an example of how you want it to look? (Never got the border to work for any of the items)

Sure thing! I'd love just to be able to get the bordered-param working for groups:

    "type": "group",
    "width": 32,
    "bordered": false,
    [...]

A small hint may be enough (ツ)

Aaah, you want to hide the border?

maandagdev avatar Feb 05 '20 12:02 maandagdev

Aaah, you want to hide the border?

Yeah! Would be ok for me if all group-items would have no border too... Simply can't find where this is defined.

dieideeistgut avatar Feb 05 '20 12:02 dieideeistgut

Aaah, you want to hide the border?

Yeah! Would be ok for me if all group-items would have no border too... Simply can't find where this is defined.

I'm currently at my internship but I will have a look for you later tonight. If I can remember correctly it's using an item that the touchbar already knows which makes it (as far as I know) impossible to remove the border. But I will give it a shot for you.

maandagdev avatar Feb 05 '20 12:02 maandagdev

Okay, so I got it working, it's quite dirty but you can find the code on this branch:

https://github.com/maandagdev/MTMR/tree/feature/custom-group-item

What I did is just make a custom class with the same exact code the group item had, but it's now a custom item and from what I can tell it works the same exact way.

Let me know if that is what you want, I will clean up the code and make it work better (Rename the type group to customGroup in your preferences to see it in action)

maandagdev avatar Feb 05 '20 16:02 maandagdev

@maandagdev you deserve the medal of the day! This works awesome! And my touchbar is once clean and simple for my needs!

MTMR MTMR

Thanks a ton!

dieideeistgut avatar Feb 06 '20 08:02 dieideeistgut

@dieideeistgut can you share your preset?

Sn0wCooder avatar Feb 06 '20 11:02 Sn0wCooder

@Sn0wCooder - sure! I'll not PR it to examples as it requires the changes by @maandagdev for now. But this gist will do:

https://gist.github.com/dieideeistgut/163ee7901e7361cae4ebc7e870b64277

dieideeistgut avatar Feb 06 '20 17:02 dieideeistgut

@dieideeistgut thanks!

Sn0wCooder avatar Feb 06 '20 17:02 Sn0wCooder

@dieideeistgut Do you by any chance know how I could close a group programmatically? I see you don't have an exit button on your groups. Does pressing ESC close it?

maandagdev avatar Feb 09 '20 06:02 maandagdev

@dieideeistgut Do you by any chance know how I could close a group programmatically? I see you don't have an exit button on your groups. Does pressing ESC close it?

There is an close button in place of the group-toggle button ;)

dieideeistgut avatar Feb 10 '20 12:02 dieideeistgut

@dieideeistgut I meant by using code, I want to make a timer so the group closes on its own after x amout of time.

maandagdev avatar Feb 10 '20 12:02 maandagdev

@maandagdev maybe you can set an timeout once the group opens and then use the dismissPopover? (https://developer.apple.com/documentation/appkit/nspopovertouchbaritem/2544697-dismisspopover)

dieideeistgut avatar Feb 10 '20 12:02 dieideeistgut

I have tried that, it just closes the entire touchbar. it shows like a black bar.

maandagdev avatar Feb 10 '20 12:02 maandagdev

@maandagdev i have tried several stuff here now too - sadly without success. Sorry m8.

dieideeistgut avatar Feb 12 '20 13:02 dieideeistgut

@dieideeistgut No worries dude, thanks for trying to help :)

maandagdev avatar Feb 12 '20 13:02 maandagdev

Okay, so I got it working, it's quite dirty but you can find the code on this branch:

https://github.com/maandagdev/MTMR/tree/feature/custom-group-item

What I did is just make a custom class with the same exact code the group item had, but it's now a custom item and from what I can tell it works the same exact way.

Let me know if that is what you want, I will clean up the code and make it work better (Rename the type group to customGroup in your preferences to see it in action)

@maandagdev Could you please create a pull request to the original repository? :) I think others could benefit from your update!

davidmokos avatar Feb 27 '20 11:02 davidmokos

Thank you so much @maandagdev !!!! Always having the touch bar display on was bothering me, but your code let me make a blank button to toggle my entire touch bar!

zootsuitproductions avatar Jun 22 '20 07:06 zootsuitproductions

I currently am unable to get an image to show for groups. The button shows and has the image, but nothing opens when pressed. There is haptic feedback as well.

{ "type":"customGroup", "width": 40, "align":"left", "bordered":true, "title":"", "image":{ "base64":"BASE64 of image 54x35" },

"items": [

mdreece avatar Dec 14 '21 23:12 mdreece

@maandagdev any progress? Maybe pull request to master?

Flower7C3 avatar Nov 17 '23 11:11 Flower7C3