tool-bar icon indicating copy to clipboard operation
tool-bar copied to clipboard

Custom button types (dropdown, toggle, checkbox, radio)

Open nkt opened this issue 10 years ago • 15 comments

Please add support for select, like this: 2015-05-24 22-38-39 variables less - rent - projects nkt rent

nkt avatar May 24 '15 19:05 nkt

What happens when you click that button? Does a dropdown menu popup? Is it a custom menu or a native select menu?

Can you supply an use-case.

Also, what app is that screenshot from?

jerone avatar May 25 '15 21:05 jerone

@jerone it's webstorm, and use-case is a build system. Select allows you choose which build system you gonna run, and other buttons is "run" and "debug". Webstorm uses not native selects, every option has it own icon, according to build system type. I guess firstly enough just native select.

nkt avatar May 26 '15 09:05 nkt

:+1: I like this.

cakecatz avatar May 26 '15 10:05 cakecatz

Custom button types (dropdown, checkbox, radio) are definitely something that tool-bar should support. :+1:

suda avatar May 26 '15 10:05 suda

@suda commented on 26 mei 2015 12:44 CEST:

Custom button types (dropdown, checkbox, radio) are definitely something that tool-bar should support. :+1:

I do agree. I was thinking for the select/dropdown to use the same styling/layout from Atom's contextmenu. Have to find out where they defined that.

jerone avatar May 26 '15 11:05 jerone

Maybe native select box cannot display font icons properly :cry: Check this FortAwesome/Font-Awesome#996

OSX 10.10. JS Bin screen shot 2015-05-28 at 4 48 38 am screen shot 2015-05-28 at 4 48 45 am

cakecatz avatar May 27 '15 20:05 cakecatz

:+1: for toggle buttons associated to toggle actions !

MaximeWillinger avatar May 28 '15 09:05 MaximeWillinger

@MaximeWillinger commented on 28 mei 2015 11:12 CEST:

:+1: for toggle buttons associated to toggle actions !

Reply from https://github.com/cakecatz/flex-toolbar/issues/19 @jerone on 22 mei 2015 11:02 CEST:

[..] Problem is that it's hard to know which state (active or inactive) a button should be in. Say I want a toggle button for Markdown Preview. How does the toggle button know which state it should be in? When pressed it could be set to active, and when pressed again it could be restored to inactive. Problem is that Markdown Preview could be closed manually, or called by a command. The toggle button doesn't know about those methods.

It is possible to fetch every command (https://github.com/atom/notifications/blob/ea5aaf3a8329ce53f1c9281ac3a1b7c3d8cf8909/lib/command-logger.coffee), but it's not preferred and could significantly impact the performance of all of Atom (source).

I did a quick test and it logged already a lot of redundant events while in idle state:

atom.commands.onWillDispatch(function(event){console.log(arguments);})

jerone avatar May 28 '15 09:05 jerone

The package which adds the button should take care of updating its state i.e.:

consumeToolBar: (toolBar) ->
  @toolBar = toolBar 'your-package-name'

  # Adding button
  @toggleButton = @toolBar.addButton
    icon: 'octoface'
    callback: 'markdown:toggle'
    tooltip: 'Toggle Markdown'

toggle: ->
  @enabled != @enabled
  @toggleButton.setChecked @enabled

If there's one package adding buttons to another one (like in case of flex-toolbar), listening for command dispatch and checking the result (i.e. if Markdown preview is visible) sounds about right.

suda avatar May 28 '15 09:05 suda

What about use setInterval with $(selector) instead onWillDispatch ?

Like this. source demo

cakecatz avatar May 28 '15 12:05 cakecatz

I would say that the best approach would be to create PR for package you want to control with toolbar support (in this case markdown-preview) instead of having a separate package.

suda avatar May 31 '15 11:05 suda

Have you given up on this?

c10b10 avatar Mar 21 '16 17:03 c10b10

Custom buttons are on the backlog, but to quote myself from https://github.com/suda/tool-bar/pull/79#issuecomment-119163725:

Without the user having a way to manage those third-party buttons, the user has no control of disabling if they don't want that. https://github.com/suda/tool-bar/issues/49 needs to be implemented first... ... If I look for example to my statusbar, it's already getting cluttered with tiles I don't use or can't hide... cluttered status-bar

jerone avatar Mar 21 '16 17:03 jerone

I'm reopening this issue as it's still something that's on the roadmap for the future, immediately after https://github.com/suda/tool-bar/issues/49

jerone avatar Jul 04 '16 20:07 jerone

Ahh, sorry. I've just cleaned up issues which opened by myself.

nkt avatar Jul 04 '16 20:07 nkt