Code Monkey home page Code Monkey logo

anybar's Introduction

Here are a few projects I worked on.

Fonts:

Apps:

  • AnyBar: universal macOS menubar status indicator

Java libraries:

  • Skija: Bindings for Skia, a graphics library
  • JWM: Cross-platform window management

Clojure libraries:

Sublime Text:

  • Clojure Sublimed: Clojure support for Sublime Text 4
  • Executor: Run any executable from your working dir in Sublime Text
  • Writer: Color scheme for focused long-form writing

Alabaster, a Minimalist Color Scheme:

Keyboard layouts:

  • Universal: EN/RU reimagined to be used together

anybar's People

Contributors

chrissantamaria avatar core-code avatar davydovanton avatar dima-369 avatar enedil avatar ericboehs avatar ermakovpetr avatar jenyayel avatar kawarimidoll avatar kstefanini avatar machawk1 avatar maximal avatar mynameismiek avatar nnmrts avatar okertanov avatar pavelstefanov avatar philipbl avatar proger avatar rmuslimov avatar schweinepriester avatar sindresorhus avatar sobolevn avatar stacycurl avatar tie-rack avatar tonsky avatar urschrei avatar wookayin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anybar's Issues

Doesn't start on Mavericks

Not sure if this is a Yosemite only tool, but I'm getting the following on Mavericks.

$ open /Applications/AnyBar.app
LSOpenURLsWithRole() failed with error -10825 for the file /Applications/AnyBar.app.

Set tooltip

This might be out of scope of this app, but it would be useful to be able to set a tooltip for the menubar app, from a client. This is especially useful when you have multiple instances of AnyBar so you can distinguish them.

Usage in Swift?

This is only an issue with my rudimentary Swift skills – sorry if it's inappropriate to post here.

That said… any suggestions for how to change the icon in Swift? I've explored NSTask with both echo and via an AppleScript. Establishing a connection using BSD sockets seems like massive overkill (and I haven't been successful in any event.)

Feature Request: arbitrary message

It would be nice if we could also send some arbitrary message to Anybar, which would be revealed in the pop-up menu by clicking on the icon.
Optionally, there could be a badge on Anybar to indicate that there's a new message to be read.

Pass starting color to AnyBar?

I really like AnyBar, good job 👍

One thing I would love to see though would be a way to set the initial color of the dot. Maybe there is even already something like this implemented?

Asking because calling open -na Anybar && echo -n "green" | nc -4u -w0 localhost 1738 does not set the color of the dot to green, I think because open in itself operates in the background.

One could insert a sleep 0.5s like this: open -na Anybar && sleep 0.5s && echo -n "green" | nc -4u -w0 localhost 1738 but it flickers the dot color because it is set to white initially.

I think something like ANYBAR_INITIAL_COLOR would be amazing!

Play sound on change

It would be awesome if it is possible to play some sound every time it changes.

Get AnyBar status as open/closed?

Thanks for making this. I'm using AnyBar to show the status of some of my Hammerspoon functions [Lua for mac automation], but I'm having trouble identifying when AnyBar is open or closed. I end up launching duplicate processes or not having a process open. How does everyone else deal with those issues?

But in trying to write my question I think I found a couple of ways to solve this:

# A port known to be open returns a line of text
$ sudo nmap -sU -p 1740 $(ipconfig getifaddr en0) | grep open
1740/udp *open*|filtered encore

# While a closed port returns no text
$ sudo nmap -sU -p 9999 $(ipconfig getifaddr en0) | grep open

But this method can be prone to false positives. Alternatively, I launch a set number of AnyBar icons, so I can make sure they are open by counting the number of lines returned from the process list (the [ ] idea was from stackoverflow):

$ ps aux | grep -i '[a]nybar'
kyleking         9728   0.0  0.1  2579936  13844   ??  S    10:54AM   0:00.15 /opt/homebrew-cask/Caskroom/anybar/0.1.3/AnyBar.app/Contents/MacOS/AnyBar
kyleking         9726   0.0  0.1  2579936  14020   ??  S    10:54AM   0:00.16 /opt/homebrew-cask/Caskroom/anybar/0.1.3/AnyBar.app/Contents/MacOS/AnyBar
kyleking         9567   0.0  0.1  2579936  14220   ??  S    10:51AM   0:00.33 /opt/homebrew-cask/Caskroom/anybar/0.1.3/AnyBar.app/Contents/MacOS/AnyBar

Then to quit the app from a shell prompt, I'm just using:

sudo kill $(ps aux | grep -i '[a]nybar' | awk '{print $2}')

Is there a way to build something like this in Applescript or built-in to AnyBar?

Provide instructions on how to launch

Those unfamiliar with Homebrew-cask will likely enter the commands you provide and expect a result. Per the README, I typed brew cask install anybar then proceeded to the Usage section, entering echo -n "black" | nc -4u -w0 localhost 1738. No icon appeared in my menubar. I checked my Applications directory as linked in the left pane of Finder windows and there is nothing named Anybar. A casual user may give up.

Reading the directions provided by Homebrew-cask, I found that the .app was installed in /Users/myusername/Applications/. This can also be found via Spotlight (with the default configuration in OS X 10.10.2) yet the README does not provide any direction on how to launch the app before the Usage instructions can be utilized.

Anybar changes colour automatically

So how come my anybar dot reverts to red after blinking momentarily into the desired colour for a second or two? very frustrating. however this problem fixes itself once i disconnect/reconnect my wifi. please help.

Sample command in documentation does not work with netcat 0.7.1 at OS X El Capitan / 10.11.4

I tried to get combination of netcat parameters to send out single command and terminate, but failed. The command sits open till you ^C it.
Could you please provide modern working example in documentation?

$ /bin/bash
bash-3.2$ echo -n "black" | nc -4u -w0 localhost 1738
nc: invalid option -- 4
Try `nc --help' for more information.
bash-3.2$ echo -n "black" | nc -u -w0 localhost 1738
Error: Invalid wait-time: 0
bash-3.2$ echo -n "black" | nc -u -w 1 localhost 1738
^C

Which version is being used:

bash-3.2$ ls -l `which nc`
/usr/local/bin/nc -> ../Cellar/netcat/0.7.1/bin/nc
bash-3.2$ brew info netcat
netcat: stable 0.7.1
Utility for managing network connections
http://netcat.sourceforge.net/
/usr/local/Cellar/netcat/0.7.1 (10 files, 103.3K) *
  Built from source
From: https://github.com/Homebrew/homebrew/blob/master/Library/Formula/netcat.rb
bash-3.2$

Using in a shell script

When I try to use anybar from a shell script, I can't seem to get it to change the icon to anything but "question". I'm sure that it's something I'm doing wrong. It is actually changing the icon, but it's like the colour isn't getting sent through properly? I've tried using single quotes, escaping the quotes -- what am I doing wrong?

#!/bin/sh
echo -n "black" | nc -4u -w0 localhost 1738

emoji

Can I place emoji (Unicode symbol) to menubar?

Go client

I created a small golang app to help manage anybar. Hope this is helpful

I published static binaries for OSX and Linux here but anyone should be able to build it themselves as long as they have go installed.

Black dot is white when macOS is running in dark mode

I'm seeing this in 10.12 beta, but I'm guessing that this might be happening in 10.11 too:

When running in dark mode (System Prefs > General > Use dark menu bar and Dock), this creates a white dot:

$ echo -n "black" | nc -4u -w0 localhost 1738

This is minor, arguably correct, but potentially misleading? Not sure if there's a better way here.

Alfred workflow link broken

The main README page includes a link which displays as https://github.com/raguay/MyAlfred but actually links to https://github.com/raguay/MyAlfred/blob/master/AnyBarWorkflow.alfredworkflow.

That link is 404.

However, there is a new link:

https://github.com/raguay/MyAlfred/blob/master/Alfred%204/AnyBar%20Workflow.alfredworkflow

which I believe is the same thing but apparently raguay reorganized their repo.

If you link to

https://github.com/raguay/MyAlfred/raw/master/Alfred%204/AnyBar%20Workflow.alfredworkflow

it should offer to download it directly.

Can't open on Mac OS 10.15.7

Fresh Homebrew reinstall, and I get a Finder dialog:
“AnyBar” can’t be opened because Apple cannot check it for malicious software.
This software needs to be updated. Contact the developer for more information.

Homebrew Cask downloaded this file on February 22, 2021 from github.com.

When downloaded it did not work

When I downloaded anybar, and tried to set the color, the icon turned clear and would not respond to any color setting. When I used cask to install it worked just fine.
screen shot 2015-04-11 at 10 08 07 am

Text status capability

I'm not going to put a full PR on this commit because I made some changes to default behavior, but if you're interested in gleaning/repurposing anything, let me know. I can revert the default changes and issue an actual PR if you'd like.

Short version:

  • adds a setTitle method to change text in the status bar
  • UDP processor looks for a color name in first word of a multi-word string
    • if found, it uses it and removes it from the string
    • remaining text is used as the status bar text
  • adds a "none" color name to remove the icon
  • AppleScript command set title and set color name "none"

Fork is located here: https://github.com/ttscoff/AnyBar/

Start automatically on traffic

launchd has a functionality where it can bind to a socket, and when there's incoming traffic, it starts a service and passes that on. It should be usable by Anybar.

I'm not sure on the details. On Linux, systemd allows this, and I know they copied this design feature from macOS, and that's the extent of my familiarity on it. This link seems very useful. plist is a keyword here.

With such a setup, AnyBar could be set up to start automatically when an application attempts to connect to it, without requiring any change on client's side.

What is the bash alias?

When I use anybar green, I get:

$ anybar green
-bash: anybar: command not found

So what's the bash alias for anybar?

nc: invalid option -- 4

Hi, I couldn't run the nc command as expected.
It seems I have a different version of netcat.
I am using macOS Sierra 10.12.5

$ echo -n "black" | nc -4u -w0 localhost 1738

nc: invalid option -- 4
Try `nc --help' for more information.

$ nc --version

netcat (The GNU Netcat) 0.7.1
Copyright (C) 2002 - 2003  Giovanni Giacobbi

This program comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of this program under the terms of
the GNU General Public License.
For more information about these matters, see the file named COPYING.

Original idea and design by Avian Research <[email protected]>,
Written by Giovanni Giacobbi <[email protected]>.

$ nc --help

GNU netcat 0.7.1, a rewrite of the famous networking tool.
Basic usages:
connect to somewhere:  nc [options] hostname port [port] ...
listen for inbound:    nc -l -p port [options] [hostname] [port] ...
tunnel to somewhere:   nc -L hostname:port -p port [options]

Mandatory arguments to long options are mandatory for short options too.
Options:
  -c, --close                close connection on EOF from stdin
  -e, --exec=PROGRAM         program to exec after connect
  -g, --gateway=LIST         source-routing hop point[s], up to 8
  -G, --pointer=NUM          source-routing pointer: 4, 8, 12, ...
  -h, --help                 display this help and exit
  -i, --interval=SECS        delay interval for lines sent, ports scanned
  -l, --listen               listen mode, for inbound connects
  -L, --tunnel=ADDRESS:PORT  forward local port to remote address
  -n, --dont-resolve         numeric-only IP addresses, no DNS
  -o, --output=FILE          output hexdump traffic to FILE (implies -x)
  -p, --local-port=NUM       local port number
  -r, --randomize            randomize local and remote ports
  -s, --source=ADDRESS       local source address (ip or hostname)
  -t, --tcp                  TCP mode (default)
  -T, --telnet               answer using TELNET negotiation
  -u, --udp                  UDP mode
  -v, --verbose              verbose (use twice to be more verbose)
  -V, --version              output version information and exit
  -x, --hexdump              hexdump incoming and outgoing traffic
  -w, --wait=SECS            timeout for connects and final net reads
  -z, --zero                 zero-I/O mode (used for scanning)

Remote port number can also be specified as range.  Example: '1-1024'

[Security] Path Traversal

mv secret_icon.png ~/secret_icon.png
echo -n "../secret_icon" | nc -u localhost 1738

What should happen:
A question mark icon is displayed as no valid icon was found in ~/.AnyBar

What happens:
The secret icon is displayed which is located at ~/.AnyBar/../secret_icon.png

I can't think of a way to exploit it however.

Flashing Icon Feature Req

First, let me say I'm excited to have found this wonderful little app that is so simple to use and so versatile! I am currently using it warn when I have disabled sleep mode on my MBP, however, I would like it to be even more obvious than the exclamation sitting motionless in the bar...

It would be awesome if there was a flash parameter... just a simple blink on and off at 1-second intervals. Even better if there was a way to customize the flashing interval, etc.

I would try to submit a pull for this feature but that type of coding is above my helmet. For now, I'm going to try and hack the feature by having a Keyboard Maestro macro that uses the nc calls to flash it on and off.

Thanks for listening! Keep up the great work!

0.2.3 opening old style dots on 10.15.7

when I launch it, it uses old dot styles, rarely it uses new, but if I try fill and hollow on them which I wanted it doesn't work and goes back to previous version dots, is this version only for big sur?

Error on trying to open the app

On trying to open AnyBar, the following error pops up: [OS version: macOS 10.15.7]

image

This however can be force-opened, but it would be better if it could be fixed.

Mojave: shell command with nc exiting with nc error

echo -n "<color>" | nc -4u -w0 localhost 1738 stopped working on my system (macOS 10.14.6). Getting the error message nc: getaddrinfo: nodename nor servname provided, or not known. This happens with both shell scripts and manual execution.

With AppleScript it's still working, i.e. osascript -e 'tell application "AnyBar" to set image name to "<color>"'

Anyone know what the problem could be?

PS (edit): adding /usr/bin/nc to the Accessibility list doesn't help.

License

Hi,

Would you mind adding a LICENSE file to your project? Thanks!

Acknowledge received message

By replying back. I want to ensure the status was changed successfully. Could be useful to also include in the reply whether the sent command was valid.

Big Sur dynamically switches between black and white icons depending on desktop background

This means that choosing the image style based on whether dark mode is enabled or not is not sufficient to choose the correct image, as the menu bar may be using black icons or white icons regardless. This is a screenshot of my mac with dark mode enabled, but a light desktop background image, and setting anybar to the "black" image:

image

My desktop image is a dynamic wallpaper, so in the evening it's much darker and the mac switches to using white icons.

Icons support

I've created a fork which adds support for any icons from icons8.com. Just pass a icon id and the icon will be used for the menu item.

Not sure whether you want this functionality in AnyBar or want to stick to the colored dots? Should I fine tune my fork and create a pull request?

Fork repo at https://github.com/niklasberglund/AnyBar-icons

Custom colors, text messages, and custom template images

Similar to ttscoff's previous issue, I'm not making this a PR because my changes break compatibility with OS X 10.9. But I wanted to put this here in case it would be useful. Perhaps someday 10.9 compatibility won't be a requirement and these changes can be pulled?

I've made some changes to AnyBar to add

  • custom colors
  • text messages
  • automatic support for Dark mode for custom images ending in Template

So you can do something like this:

echo -n "#ffcc33 Hello World" | nc -4u -w0 localhost 1738

Here is the fork: https://github.com/sfsam/AnyBar

Blink ?

Could it be possible to add a blinking function ? To catch the user's attention, by example.

command line control

i wrote an awfully simple node script for controlling the icon...

#!/usr/bin/env node

var dgram = require('dgram'),
    anybarSocket = dgram.createSocket('udp4'),
    message = new Buffer(process.argv[2]);

anybarSocket.send(
  message,
  0,
  message.length,
  process.argv[3] || 1738,
  'localhost',
  function() {
    process.exit();
  }
);

if you chmod +x scriptname then you can ./scriptname question or ./scriptname question 1234.

i'm not sure if this is useful for anyone, but i got a little tired of doing echo -n "color" | nc blah blah...

bash' network redirection preferred over nc

The method provided in the AnyBar README, using nc, has limitations when the process feeding nc's stdin is a little tardy: with the -w0 argument, nc will not wait for input and may exit prematurely.

For example, this silently doesn't work:

( sleep 1; echo -n "black" ) | nc -4u -w0 localhost 1738

A workaround would be to use some arbitrarily high value for the wait argument, but fundamentally nc doesn't provide a means to associate stdin closing and closing the UDP "connection" (put another way, it doesn't have a "write only" mode). (at least one implementation of nc does provide a -c option that will wait for stdin to close, but it's not common)

BASH provides a very useful network redirection feature, this avoids the issue and also has fewer (zero!) dependancies:

( sleep 1; echo -n "black" ) > /dev/udp/localhost/1738

Suggest replacing the examples in the README with the BASH invocations.

Custom Image AppleScript

how would you set a custom image using applescript?
i would be comfortable doing it from terminal also but try to just change the color from terminal with echo -n "black" nc -4u -w0 localhost 1738 changes it for instant (ala issue #45)

EDIT: i figured out why it was reverting back for me when using bash. i was running a looping applescript to show the playing state of spotify and it was still running. oops

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.