
AnyBar: OS X menubar status indicator - tosh
https://github.com/tonsky/AnyBar
======
NickBusey
I'll be that guy on this thread that points out Hammerspoon. It's an OS X
automation tool that replaces pretty much every OS X 'tweak' style application
out there.
[http://www.hammerspoon.org/go/#simplemenubar](http://www.hammerspoon.org/go/#simplemenubar)

I think it's the best of these type of projects, and would love to see more
people using it / developing and sharing scripts.

~~~
sooheon
Care to share your implementation of your favorite feature? I'm finding it
hard to picture what the workflow/result will be like.

~~~
prashnts
If one likes being cheap, it's fun to mute Spotify if there's an Ad. Yeah...

    
    
        function muteSpotifyOnAd()
          if (hs.spotify.isRunning()) then
            if (hs.spotify.getCurrentTrack():lower() == 'spotify') then
              hs.spotify.setVolume(0)
            else
              hs.spotify.setVolume(100)
            end
          end
        end
        hs.timer.doEvery(10, muteSpotifyOnAd)

~~~
Griffinsauce
No thanks, one likes earning a few cents from their published music.

~~~
kuschku
Spotify still gets paid by the advertiser, and so does the artist.

It’s like switching TV channels when the ad plays.

In analog media, close to no one ever listened to / watched ads, due to
exactly that – many VHS recorders would even automatically skip them.

~~~
mypalmike
> close to no one ever listened to / watched ads

I can still sing jingles I learned from watching TV ads in the 70s.

------
out_of_protocol
Bitbar feels much better imo and allowing not just dots - any stuff

[https://github.com/matryer/bitbar](https://github.com/matryer/bitbar)

~~~
flashman
My BitBar script to display my current free drive space:

    
    
        #!/bin/bash
        df -h | awk '{print $4}' | head -n2 | tail -n1
    

(There has to be a neater way to do this...)

~~~
hug
There is, of course. :)

    
    
        df -h | awk 'NR==2 {print $4}'

~~~
flashman
Thanks :)

------
niklasber
I created a fork of AnyBar with added support for specifying an icon id for
any icon from icons8.com and the status icon will change to it.
[https://github.com/niklasberglund/AnyBar-
icons](https://github.com/niklasberglund/AnyBar-icons)

Just now quickly whipped it together. Needs improvement(error handling and
asynchronous downloading) and packages.

HN submission:
[https://news.ycombinator.com/item?id=13051347](https://news.ycombinator.com/item?id=13051347)

------
pantulis
I woulde like to point out the awesome PowerPro for Windows, something like an
Swiss army knife of desktop automation in Windows --that seems to be under
active development:
[http://powerpro.cresadu.com/xfeatures.htm](http://powerpro.cresadu.com/xfeatures.htm)

~~~
josephcooney
Never was the cultural differences between the windows and OSX platforms more
striking than when looking at the PowerPro page
[http://powerpro.cresadu.com/xfeatures.htm](http://powerpro.cresadu.com/xfeatures.htm)
and the HammerSpoon page
[http://www.hammerspoon.org/](http://www.hammerspoon.org/)

~~~
laurent123456
Well the PowerPro website was done nearly 20 years ago, while the HammerSpoon
one two years ago, so that's mostly where the difference comes from. Also it
seems the PowerPro website makes more sense if viewed on a good old 1024x768
resolution.

~~~
pantulis
This. PowerPro is an amazing tool, although somewhat esoteric. What surprises
me is that successive Windows releases have not ended making the development
impossible. I submitted a pair of plugins _more than 10 years ago_. I've been
surprised to see development is still active, and for what I understand is
pretty equivalent to Hammerspoon, including window management, shortcuts,
menubars & desktop scripting support.

------
dopeboy
Is there anything similar for Linux? Closest I can find is
[https://github.com/abgoyal/ShellToolsApplet](https://github.com/abgoyal/ShellToolsApplet)

~~~
Cyclenerd
For Unity:
[https://github.com/limpbrains/somebar](https://github.com/limpbrains/somebar)

------
psychometry
Does anyone think this could be used to query the desktop Slack app to mirror
the information in the dock icon, i.e. "no messages", "messages", "direct
messages"?

~~~
elsen
Unread status is managed remotely (sync'd between devices), so you should be
able to query it with an API like
[https://api.slack.com/methods/channels.history](https://api.slack.com/methods/channels.history)

I wouldn't want such a distraction on screen at all time though.

------
aaron-santos
Great single-purpose tool that does exactly what it advertises. I found AnyBar
when searching for a programable menubar indicator. I use it at the end of a
particle.io -> ifttt -> node/express/socket.io -> go-lang middleware -> AnyBar
pipeline so I don't have to get up to check the only single occupancy restroom
at the office.

------
tiku
I like Bitbar more. It gives you direct text output in the bar, and extra
lines when clicked..

------
rrggrr
Thank you for this! Simple and small. I use bitbar and like it very much, but
this is a nice add on. I'm all in. Keep developing.

------
fideloper
My absolute favorite part of this is exposing controls as a localhost tcp
listener, making it easy to control from any tool.

~~~
toomim
And -- incidentally -- any other computer on your network.

But hey, security schemurity.

~~~
CSDude
Listening on 127.0.0.1 will not make it available it in the network.

~~~
deathanatos
This app is not listening on 127.0.0.1 — it binds to _all_ interfaces (and on
both IPv4 and IPv6 too), and the parent's comment is completely valid. Anyone
who can get a UDP packet to your machine can control this.

    
    
      AnyBar  32770 ---   14u    IPv4 0x----------------       0t0      UDP *:1738
      AnyBar  32770 ---   15u    IPv6 0x----------------       0t0      UDP *:1738
    

(The `nc` command in the example is directed at localhost, but that doesn't
imply that the app is bound to localhost only, just that it's bound to _at
least_ that.)

Unix sockets are a better fit for this sort of thing, as they can be by
default restricted to your user, and optionally opened up to others. (i.e.,
Unix sockets are authenticated) You can always do both (implement Unix sockets
and Internet sockets).

Even binding to localhost in general is not _completely_ safe, if a webpage or
other apps can be fooled into making the right request. (I _think_ UDP is safe
here, but who knows.)

------
donatj
I'm curious why UDP and not just a small HTTP server? Honestly the overhead is
tiny particularly in this use case.

~~~
tonsky
I believe it’s still easier to write a string to a socket than do a full-blown
HTTP request. It was designed to be accessible from _anywhere_: bash scripts,
build tools plugins, etc. To me single UDP packed seemed like a lowest common
denominator

------
orion138
This looks super handy for having a simple status!

Out of curiosity, anyone know what the hammer and sickle icon is for in the
screenshot?

*edit for grammar

~~~
tonsky
It’s a keyboard layout indicator (RU/EN). I’m using non-standard layout
[http://ilyabirman.ru/projects/typography-
layout/](http://ilyabirman.ru/projects/typography-layout/)

------
FullyFunctional
This is neat, but the complete lack of access control (UDP) just doesn't seem
prudent in 2016.

~~~
josho
I assume it binds to the loop back interface so that other hosts can't send
messages. Regardless UDP interface does seem odd for this sort of tool.

Edit: nope. It listens on all interfaces. At least an attack can only
maliciously change your menubar colour.

~~~
scott_karana
Well, assuming the syntax for calling local files isn't breakable by using
"../square" to open executables with JPEG extensions too... ;)

