Jump to content


Photo

Menu bar search

menubar menu bar menu item sublime text

  • Please log in to reply
48 replies to this topic

#1 jvdneut

jvdneut

    Newbie

  • Member
  • Pip
  • 10 posts

Posted 16 February 2013 - 01:41 PM

Hi,

 

I've created a basic workflow that searches the system's menu bar. After having used Sublime Text's command palette I wanted to have a similar system-wide functionality. EDIT: For people that haven't worked with Sublime Text's command palette: the command palette allows you to fuzzy search the entire application menu by keyboard. This saves both time on hunting down the right menu and saves you having to remember all sorts of keyboard shortcuts. For a brief introduction on Sublime Text's command palette see https://tutsplus.com...ommand-palette/

 

EDIT: Better use ctwise's "2.0" workflow http://www.alfredfor...93-menu-search/ [old download is still available at http://dl.dropbox.co....alfredworkflow]

 

The current workflow does not do any fuzzy searching and every keystroke executes the entire script again. My preferred fix to this would be to have a script input that is only executed once, and have Alfred do the subsequent fuzzy matching based on the initial result.

 

Jeroen van der Neut

@jvdneut


Edited by jvdneut, 16 April 2013 - 02:32 PM.

  • Pedro Lobo, twinpeaks, drking and 6 others like this

#2 Florian

Florian

    Member

  • Member
  • PipPip
  • 217 posts

Posted 16 February 2013 - 02:03 PM

That's a damn good idea! It adds so much to afred! We just need to find a way to make it pretty now ;)



#3 ctwise

ctwise

    Member

  • Member
  • PipPip
  • 219 posts

Posted 16 February 2013 - 09:59 PM

Hi,

 

I've created a basic workflow that searches the system's menu bar. After having used Sublime Text's command palette I wanted to have a similar system-wide functionality.

 

http://dl.dropbox.co....alfredworkflow

 

The current workflow does not do any fuzzy searching and every keystroke executes the entire script again. My preferred fix to this would be to have a script input that is only executed once, and have Alfred do the subsequent fuzzy matching based on the initial result.

 

Jeroen van der Neut

@jvdneut

 

That is awesome. I created a variant that:

 

1. Displays the menu path as the subtitle, e.g., Apple > Recent Items or Project > Recent Projects.

2. Displays the icon of the application next to the application's menu items but displays an OS/X icon next to the Apple menu items.

 

But, as discussed, this is slow for applications with many menu items so I won't be publishing the variant until I add menu caching.



#4 jvdneut

jvdneut

    Newbie

  • Member
  • Pip
  • 10 posts

Posted 17 February 2013 - 11:42 AM

That is awesome. I created a variant that:

 

1. Displays the menu path as the subtitle, e.g., Apple > Recent Items or Project > Recent Projects.

2. Displays the icon of the application next to the application's menu items but displays an OS/X icon next to the Apple menu items.

 

But, as discussed, this is slow for applications with many menu items so I won't be publishing the variant until I add menu caching.

 

Cool. I was hoping someone else would pick up where I left. I'm planning on making the script a bit more useful, but that will probably involve me actually having to learn AppleScript to a decent level... Did you make the changes using some more grep / sed commands or using some actual form of scripting?

 

I am a programmer by trade, but unfortunately I don't know any AppleScript, Python, Ruby or PHP, but I guess I'll have to learn in order to make this thing a little more useful. 



#5 ctwise

ctwise

    Member

  • Member
  • PipPip
  • 219 posts

Posted 17 February 2013 - 01:07 PM

Cool. I was hoping someone else would pick up where I left. I'm planning on making the script a bit more useful, but that will probably involve me actually having to learn AppleScript to a decent level... Did you make the changes using some more grep / sed commands or using some actual form of scripting?

 

I am a programmer by trade, but unfortunately I don't know any AppleScript, Python, Ruby or PHP, but I guess I'll have to learn in order to make this thing a little more useful. 

 

Ruby. I'm no guru but I use it to hack together support scripts during development, e.g., data transformation, etc.

 

The new workflow version is here - http://tedwi.se/u/db

 
I added caching but, given the circumstances, it's very coarse. If we've never seen the app before we dump the menu contents into a file in /tmp/. Subsequent invocations, if we find the menu contents in /tmp/, we use them but kick off a background process to regenerate them. That way, we get immediate response but, by the time we get to the end of what we're typing it's current to the given app. It's pretty wasteful, but, oh well.
 
Seriously, this was a flat-out fantastic idea.

  • Pedro Lobo and thec13 like this

#6 jibbe

jibbe

    Newbie

  • Member
  • Pip
  • 9 posts

Posted 17 February 2013 - 01:19 PM

 I love this idea !  :)



#7 Jono

Jono

    Member

  • Member
  • PipPip
  • 154 posts
  • LocationUK

Posted 18 February 2013 - 09:14 AM

Great idea, thanks.



#8 ctwise

ctwise

    Member

  • Member
  • PipPip
  • 219 posts

Posted 18 February 2013 - 02:23 PM

I'm still having issues kicking off a background update that doesn't cause Alfred to hang waiting on the initial script. I've temporarily commented out the line that does the background update. In the meantime, my use of it caused me to change how the workflow searches for menu items.

 

Instead of searching just the menu item name, it searches the whole path, e.g., 'm insert', 'm break' and 'm section' will all find 'Insert > Break > Section Break (Next Page)'. It uses case-insensitive grep, so you can do things like '^insert' to find everything belonging to the Insert top-level menu.

 

Re-download the workflow to get the latest.



#9 twinpeaks

twinpeaks

    Member

  • Member
  • PipPip
  • 173 posts

Posted 19 February 2013 - 12:15 AM

Ted, I am loving your own workflows and additions to others. They are great so thank you for sharing with us all. Keep, tip of the hat to both of you.


 


#10 jvdneut

jvdneut

    Newbie

  • Member
  • Pip
  • 10 posts

Posted 20 February 2013 - 10:44 AM

Ted, good job on the caching. I'm currently using your workflow instead of my own :)

 

I am still exploring AppleScript to see if I can produce better results directly from it. Disabled entries should not be listed for one. Also the cache is sometimes out of date when using a toggle (Show/hide) menu option.



#11 Pedro Lobo

Pedro Lobo

    Member

  • Member
  • PipPip
  • 171 posts
  • LocationPortugal

Posted 20 February 2013 - 11:36 AM

Damn... Been AWOL for a while and come back to some great new ideas. Good work guys.



#12 ctwise

ctwise

    Member

  • Member
  • PipPip
  • 219 posts

Posted 20 February 2013 - 01:43 PM

Ted, good job on the caching. I'm currently using your workflow instead of my own :)

 

I am still exploring AppleScript to see if I can produce better results directly from it. Disabled entries should not be listed for one. Also the cache is sometimes out of date when using a toggle (Show/hide) menu option.

 

I've been looking into Objective-C through the Scripting Bridge to pull down menus, both for speed and the possibility of getting shortcut keys as well to display. But my lack of knowledge of Objective-C and Cocoa are greatly hampering my efforts.



#13 jvdneut

jvdneut

    Newbie

  • Member
  • Pip
  • 10 posts

Posted 20 February 2013 - 01:48 PM

I've been looking into Objective-C through the Scripting Bridge to pull down menus, both for speed and the possibility of getting shortcut keys as well to display. But my lack of knowledge of Objective-C and Cocoa are greatly hampering my efforts.

 

I was actually looking into Objective-C as well now. QuickSilver (http://qsapp.com) has a similar feature for accessing menu bar items through their UI Access plugin. The source for that is on: https://github.com/q...Access-qsplugin



#14 xuso

xuso

    Newbie

  • Member
  • Pip
  • 8 posts

Posted 15 March 2013 - 08:04 PM

Nice. Really cool idea.



#15 Ramiro Araujo

Ramiro Araujo

    Member

  • Member
  • PipPip
  • 81 posts

Posted 15 March 2013 - 08:46 PM

I've just tried this, but, isn't this the same as the actual search input inside virtually any OSX app? Actually, my Mountain Lion install (I asume everyones) comes with a shortcut (Cmd + shift + /) to toggle this


  • gingerbeardman likes this

#16 jvdneut

jvdneut

    Newbie

  • Member
  • Pip
  • 10 posts

Posted 16 March 2013 - 12:04 PM

I've just tried this, but, isn't this the same as the actual search input inside virtually any OSX app? Actually, my Mountain Lion install (I asume everyones) comes with a shortcut (Cmd + shift + /) to toggle this

 

Pretty much, yes. I still intend to implement fuzzy searching ("wi" to match "show Web Inspector" for example), but I'm not particularly satisfied with the performance right now. I will have to figure out a way to implement caching properly first.



#17 lmartins

lmartins

    Member

  • Member
  • PipPip
  • 89 posts

Posted 16 March 2013 - 12:49 PM

Awesome! It was one of the features i missed the most after switching from Quicksilver to Alfred. 

 

This ain't at the same level yet, but what you guys are achieving in the few days of Alfred 2 leaves no question that will get there really soon. Im loving this.



#18 Ramiro Araujo

Ramiro Araujo

    Member

  • Member
  • PipPip
  • 81 posts

Posted 16 March 2013 - 01:29 PM

@jvdneut ahh, ok, yes fuzzy searching would be great :)



#19 lmartins

lmartins

    Member

  • Member
  • PipPip
  • 89 posts

Posted 16 March 2013 - 02:23 PM

One thing im noticing is that the search results take too long to first appear, maybe something that could be improved in the future. 

 

Thanks for sharing it.



#20 Benzi

Benzi

    Member

  • Member
  • PipPip
  • 122 posts
  • LocationCalicut, Kerala, India

Posted 16 March 2013 - 10:15 PM

Hi, awesome workflow! I am using ctwise's version and its working great overall.

 

A couple of issues I noticed were to do with the workflow trying to find the application_location variable in main.rb and because of which the menu command icons for the specific application would not show up

e.g.

for Alfred Preferences, the menu commands icon were that of an empty file icon

for Google Chrome in full screen mode (Lion), the icon would not be shown. No issues in normal mode.

 

 

The following lines were added/changed in main.rb to fix most of the issues I found.

application = `osascript frontapp.scpt | sed -E 's/application process //'`.strip
application_location = `mdfind "kMDItemDisplayName=#{application}.app" | grep -i [.]app | head -n 1`.strip
if application_location.length == 0
    application_location = `mdfind "#{application}.app" | head -n 1`.strip
end
if application == "Alfred Preferences"    # overall, there should be some other way I suppose...
    application_location = "/Applications/Alfred 2.app/Contents/Preferences/Alfred Preferences.app"
end
 

 

For what its worth, hope this is useful for someone...

 

EDIT (for developers): For checking if the application and application_location variables are correctly set up, use this workflow.

Keyword is "frontmost" and it displays App name and location of the front most app... just to test things out.


Edited by Benzi, 16 March 2013 - 10:21 PM.

              Fun Comics | Lingo | Facts | Rotten Tomatoes | AlfredWorkflow.com Search

Productivity Todo | BulkRename | Wikipedia ML 

          Utility Battery | Battery2 |  TinyPNGScreen Capture | Rome2Rio Search | F.lux | Radium | Monkey Patch




Also tagged with one or more of these keywords: menubar, menu bar, menu item, sublime text

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users