Git Product home page Git Product logo

toxblh / mtmr Goto Github PK

View Code? Open in Web Editor NEW
4.2K 53.0 220.0 9.65 MB

🌟 [My TouchBar My rules]. The Touch Bar Customisation App for your MacBook Pro

Home Page: https://mtmr.app

License: MIT License

Swift 52.85% Objective-C 44.45% AppleScript 1.03% Shell 0.70% C 0.92% CSS 0.05%
touchbar macos custom-touchbar macbook customization-app customization touch-bar-customization-app touch-bar-customization statusbar applescript

mtmr's Introduction

My touchbar. My rules. GitHub release license minimal system requirements travis

The TouchBar Customization App for your MacBook Pro

My idea is to create a platform for creating plugins to customize the TouchBar. I very much like BTT and having a full custom TouchBar (my BTT preset), and I wanted to create it. It's my first Swift project for MacOS :)

Share your presets here

Mackbook with touchbar

Discord Telegram

PayPal donate button Buy Me A Coffee My TouchBar My Rules (MTMR)

Installation

On first install you need to allow access for MTMR in Accessibility otherwise buttons like Esc, Volume, Brightness and other system keys won't work.

screenshot 2019-02-24 at 23 19 20

πŸβ†’ System Preferences β†’ Security and Privacy β†’ tab Privacy β†’ Accessibility β†’ MTMR

Examples

MTMR presets

Presets for touchbar

Customization

MTMR preferences are stored in ~/Library/Application\ Support/MTMR/items.json.

The pre-installed configuration contains less or more than you'll probably want, try to configure:

Built-in button types:

Buttons

  • escape
  • exitTouchbar
  • brightnessUp
  • brightnessDown
  • illuminationUp (keyboard illumination)
  • illuminationDown (keyboard illumination)
  • volumeDown
  • volumeUp
  • mute

Native Plugins

  • timeButton
  • battery
  • cpu
  • currency
  • weather
  • yandexWeather
  • inputsource
  • music (tap for pause, longTap for next)
  • dock (half-long click to open app, full-long click to kill app)
  • nightShift
  • dnd (Don't disturb)
  • darkMode
  • pomodoro
  • network
  • upnext (Calendar events)

Media Keys

  • previous
  • play
  • next

AppleScript plugins

  • sleep
  • displaySleep

Custom buttons

  • staticButton
  • appleScriptTitledButton
  • shellScriptTitledButton

Gestures

By default you can enable basic gestures from application menu (status bar -> MTMR icon -> Volume/Brightness gestures):

  • two finger slide: change you Volume
  • three finger slide: change you Brightness

Custom gestures

You can add custom actions for two/three/four finger swipes. To do it, you need to use swipe type:

    "type": "swipe",
    "fingers": 2,            // number of fingers required (2,3 or 4)
    "direction": "right",    // direction of swipe (right/left)
    "minOffset": 10,          // optional: minimal required offset for gesture to emit event
    "sourceApple": {         // optional: apple script to run
        "inline": "beep"
    },
    "sourceBash": {          // optional: bash script to run
        "inline": "touch /Users/lobster/test"
    }

You may create as many swipe objects in the preset as you want.

Built-in slider types:

  • brightness
  • volume

You can also make custom buttons using these types

staticButton

 "type": "staticButton",
 "title": "esc",

appleScriptTitledButton

  {
    "type": "appleScriptTitledButton",
    "refreshInterval": 60, //optional
    "source": {
      "filePath": "~/Library/Application Support/MTMR/iTunes.nowPlaying.scpt",
      // or
      "inline": "tell application \"Finder\"\rif not (exists window 1) then\rmake new Finder window\rset target of front window to path to home folder as string\rend if\ractivate\rend tell",
      // or
      "base64": "StringInbase64"
    },
  }

Note: You can change appleScriptTitledButton's icon by following these steps:

  1. Declare dictionary of icons in alternativeImages field
  2. Make you script return array of two values - {"TITLE", "IMAGE_LABEL"}
  3. Make sure that your IMAGE_LABEL is declared in alternativeImages field

Example:

  {
    "type": "appleScriptTitledButton",
    "source": {
      "inline": "if (random number from 1 to 2) = 1 then\n\tset val to {\"title\", \"play\"}\nelse\n\tset val to {\"title\", \"pause\"}\nend if\nreturn val"
    },
    "refreshInterval": 1,
    "image": {
      "base64": "iVBORw0KGgoAAAANSUhEUgA..."
    },
    "alternativeImages": {
      "play": {
        "base64": "iVBORw0KGgoAAAANSUhEUgAAAAAA..."
      },
      "pause": {
        "base64": "iVBORw0KGgoAAAANSUhEUgAAAIAA..."
      }
    }
  },

shellScriptTitledButton

Note: script may also use escape sequences to return colors (read https://misc.flogisoft.com/bash/tip_colors_and_formatting for more information) "16 Colors" is the only mode supported presently. Buttons will set their own background color to the color returned.

Example of "CPU load" button which also changes color based on load value (Note: The native cpu plugin runs runs better):

{
  "type": "shellScriptTitledButton",
  "width": 80,
  "refreshInterval": 2,
  "source": {
    "inline": "top -l 2 -n 0 -F | egrep -o ' \\d*\\.\\d+% idle' | tail -1 | awk -F% '{p = 100 - $1; if (p > 30) c = \"\\033[33m\"; if (p > 70) c = \"\\033[30;43m\"; printf \"%s%4.1f%%\\n\", c, p}'"
  },
  "actions": [
    {
      "trigger": "singleTap",
      "action": "appleScript",
      "actionAppleScript": {
        "inline": "activate application \"Activity Monitor\"\rtell application \"System Events\"\r\ttell process \"Activity Monitor\"\r\t\ttell radio button \"CPU\" of radio group 1 of group 2 of toolbar 1 of window 1 to perform action \"AXPress\"\r\tend tell\rend tell"
      }
    }
  ],
  "align": "right",
  "image": {
    // Or you can specify a filePath here.
    // Images will be resized to 24x24.
    // "filePath": "~/myproject/myimage.jpg" // or "/fixed/path/to/the.png"
    "base64":
    "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAA/1BMVEUAAADaACbYACfYACfjABzXACjYACfXACjYACfYACfYACfYACfdACLYACfXACjYACfVACv/AADXACjYACfYACfXACjYACfXACjaACXYACfYACfVACvYACfYACfZACbZACbYACfYACfZACb/AADYACfYACfVACrXACjVACu/AEDYACfYACfYACfXACjXACjYACfXACjYACfYACfYACfXACjYACfXACjYACfYACfZACbYACfYACfMADPYACfYACfYACfYACfYACfZACbXACjYACfYACfRAC7XACjYACfZACbWACnXACjXACjYACfTACzZACb/AADYACfYACfYACcAAAA+zneGAAAAU3RSTlMAItK+CVPjh3xUxPwPiGDQGAMtSKmN3Vk+wPQG/e26oIJBnwJCdiuAHgTmw+6BX+IgfaqLUvKOW8VKnagK+vBwYrhlc/urCznvhSyUbOEXPAFjGh/ektAAAAABYktHRACIBR1IAAAACXBIWXMAAA3XAAAN1wFCKJt4AAAAB3RJTUUH4ggWETQWgEDcSgAAAqVJREFUWMPtl4ly2jAQhsUNNlcw5r4SICEHLSQhCQRyX73T/u//LpUlLIyxbMAznWmn/0ywo5U+27tr7ZoQuwLBUJidRKIxPhKLRtgxHAoGiLfiQIKdKFCTxjGpQmEDCSC+BiAFpNlJBsgaxyyQYQNpIPUf8AcAOzktD+iaoQJQNI5FoMAGdCCv5XZclpfKFXiqUi5Jllf1mvdyQzW96gigd4h6o+mhRp1O0x3vvwa1VSWeqrZU1Jyeogy01ggSVQsoO/i/gjq9/u6u+2LDXq2jshqLHNCgdsCVwO0NILdi0oDmuoAmoImhQDzFRPNnb36L7U43NVfc2EH2D9h5t9OePyIF5IU9uIhvkyN7iiXmQUIOj8x/lB6f0bTaQ3ZA+9iaNCH2Lpg6btsBIRJOpJl0E9ABTvof5kqEGeCjMaN/AnRMgM5XJcI2J1J1gf6S48Tb2Ae6JkAjdgmAeJ1XAOJ1Xg8wGJ6elXwAzkeGjy62BgxG3MuXnoCIkmEq8EQyAUPgajyhPxJAga9SIiRqzwMOuAbGZDrDjQRgKkpiqiPgFphM74B7d4BKy2cyy1RcBvSodUb/HiSAIl+VlEfh8cm4wvPL9nnw+gbc+kkkUVioO95etwe8PBuP8vQoBzg7UQAe5t7syZwoCaMA3AN30wlzh3MYJYkkADeYTckYuJYlkiSVBeCKZtSY/gxlqezlxEt+pdFg6zBesPXn1ih8Aj5vkAels9PhYCkPsl++kg0AQu4dyuqmugIQm+qS5Nv6N+D7wm7d1skPc4xu666Fhd6BxU6r+jub8tNaWNxK29EhsdpR/sVn7FlLm0txPdgni+JrFNd3p+K67MQtyrsp3w2G7xbHd5Plv83z3Wj6b3V9N9ssFv7afaa//ZPn3wD4/vje8PP/N7TebS0hgZhEAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDE4LTA4LTIyVDE3OjUyOjIyKzAyOjAwc2qUYAAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxOC0wOC0yMlQxNzo1MjoyMiswMjowMAI3LNwAAAAZdEVYdFNvZnR3YXJlAHd3dy5pbmtzY2FwZS5vcmeb7jwaAAAAAElFTkSuQmCC"
  },
  "bordered": false
}

Groups

{
  "type": "group",
  "align": "center",
  "bordered": true,
  "title": "stats",
  "items": [
    { "type": "play" },
    { "type": "mute" },
    ...
  ]
}

To close a group, use the button:

{
  "type": "close",
  "width": 64
},

Native plugins

cpu

Shows current CPU load in percent, changes color based on load value. Has lower power consumption and higher stability than the shell-based solution.

{
  "type": "cpu",
  "refreshInterval": 3,
  "width": 80
}

timeButton

NOTE: Some values don't work properly: https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations

formatTemplate examples: https://www.datetimeformatter.com/how-to-format-date-time-in-swift/

locale examples: https://gist.github.com/jacobbubu/1836273

{
  "type": "timeButton",
  "formatTemplate": "dd HH:mm",
  "locale": "en_GB",
  "timeZone": "UTC"
}

weather

Provider: https://openweathermap.org
Note: Register at https://openweathermap.org to get your API key
Note: Wait for 20 minutes or so for Openweathermap to activate your API key.
Note: Enable MTMR in "Location Services" in the "Security & Privacy" System Preferences pane

  "type": "weather",
  "refreshInterval": 600, // in seconds
  "units": "metric", // or imperial
  "icon_type": "text", // or images
  "api_key": "" // you can get the key on openweather

yandexWeather (experimental)

Provider: https://yandex.ru/pogoda. One click to open up weather forecast in your browser.
Note: Enable MTMR in "Location Services" in the "Security & Privacy" System Preferences pane

  "type": "yandexWeather",
  "refreshInterval": 600 // in seconds

currency

Provider: https://coinbase.com

  "type": "currency",
  "refreshInterval": 600, // in seconds
  "align": "right",
  "from": "BTC",
  "to": "USD",
  "full": true // Β£β€£1.29$

music

{
  "type": "music",
  "align": "center",
  "width": 80, // Optional
  "bordered": false, // Optional
  "refreshInterval": 2, // in seconds. Optional. Default 5 seconds
  "disableMarquee": true // to disable marquee effect. Optional. Default false
},

pomodoro

Pomodoro plugin. One tap starts the work timer, long-press to start the rest timer. Tap an in-progress timer to reset.

{
  "type": "pomodoro",
  "workTime": 1200, // set time work in seconds. Default 1500 (25 min)
  "restTime": 600 // set time rest in seconds. Default 300 (5 min)
},

network

Network plugin. The plugin to show network usage

{
  "type": "network",
  "flip": true,
  "units": "dynamic" // or B/s, KB/s, MB/s, GB/s
},

dock

Dock plugin

{
  "type": "dock",
  "filter": "(^Xcode$)|(Safari)|(.*player)",
  "autoResize": true
},

upnext

Calendar next event plugin Displays upcoming events from macOS Calendar. Does not display current event.

{
  "type": "upnext",
  "from": 0, // Lower bound of search range for next event in hours.        Default 0 (current time)(can be negative to view events in the past)
  "to": 12, // Upper bounds of search range for next event in hours.        Default 12 (12 hours in the future)
  "maxToShow": 3, // Limits the maximum number of events displayed.          Default 3 (the first 3 upcoming events)
  "autoResize": false // If true, widget will expand to display all events. Default false (scrollable view within "width")
},

Actions:

Example:

"actions": [
  {
    "trigger": "singleTap",
    "action": "hidKey",
    "keycode": 53
  }
]

Triggers:

  • singleTap
  • doubleTap
  • tripleTap
  • longTap

Types

 "action": "hidKey",
 "keycode": 53,
 "action": "keyPress",
 "keycode": 1,
  • appleScript
 "action": "appleScript",
 "actionAppleScript": {
      "inline": "tell application \"Finder\"\rif not (exists window 1) then\rmake new Finder window\rset target of front window to path to home folder as string\rend if\ractivate\rend tell",
    // "filePath" or "base64" will work as well
 },
  • shellScript
 "action": "shellScript",
 "executablePath": "/usr/bin/pmset",
 "shellArguments": ["sleepnow"], // optional
  • openUrl
 "action": "openUrl",
 "url": "https://google.com",

Additional parameters:

  • width restrict how much room a particular button will take
  "width": 34
  • align can stick the item to the side. default is center
  "align": "left" // "left", "right" or "center"
  • bordered you can do button without border
  "bordered": "false" // "true" or "false"
  • background allow to specify you button background color
  "background": "#FF0000",

by using background with color "#000000" and bordered == false you can create button without gray background but with background when the button is pressed

  • title specify button title
  "title": "hello"
  • image specify button icon
  "image": {
    //Can be either of those
    "base64": "iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAMAAACdt4HsAAAABGdB...."
    //or
    "filePath": "~/img.png"
  }
  • matchAppId displays the button only when active app's id matches given regexp
  "matchAppId": "Safari"

Troubleshooting

If you can't open preferences:

  • Opening another program which can't edit text
    1. Open Terminal.app
    2. Put open -a TextEdit ~/Library/Application\ Support/MTMR/items.json command and press Enter

Buttons or gestures doesn't work:

  • "After the last update my mtmr is not working anymore!"
  • "Buttons sometimes do not trigger action"
  • "ESC don't work"
  • "Gestures don't work"

Re-tick or check a tick for access πŸβ†’ System Preferences β†’ Security and Privacy β†’ tab Privacy β†’ Accessibility β†’ MTMR

Credits

Built by @Toxblh and @ReDetection.

Analytics

mtmr's People

Contributors

2grey avatar ad avatar ak0nst avatar ash14 avatar atassis avatar bassoon08 avatar bobrosoft avatar cipi1965 avatar ckfear avatar fedorzaytsev avatar finhorsley avatar gtataranni avatar hrvolapeter avatar jazzhpatel avatar koenpunt avatar luong-komorebi avatar markrickert avatar redetection avatar riverky avatar sall0-0p avatar samflattery avatar siroger avatar theepicface007 avatar toxblh avatar tw93 avatar willsunnn avatar winking324 avatar wlatanowicz avatar xerc avatar zaheeraws 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

mtmr's Issues

"no script" on valide appleScript

Hello,

just find something strange today :

 "source": {
    "filePath": "/Users/xxxx/Documents/appleScript/vox.applescript",
}
if application "VOX" is running then
	tell application "VOX"
		if player state is 1 then
			set myArtist to (get artist)
			set myTrack to (get track)
			return myArtist & " – " & myTrack
		else
			return ""
		end if
	end tell
end if

result is ko -> no script

with inline :

    "type": "appleScriptTitledButton",
    "source": {
      "inline":
        "if application \"VOX\" is running then\rtell application \"VOX\"\rif player state is 1 then\rset myArtist to (get artist)\rset myTrack to (get track)\rreturn myArtist & \" – \" & myTrack\relse\rreturn \"\"\rend if\rend tell\rend if"
    },

result is ok

iTunes title scrolling

Hi,

it would be great if the iTunes plugin/script would scroll from right to left if the artist and title is too long to be displayed as a whole on the Touch Bar. Is it clear what I'm trying to say?

Login with touch id not shown after sleep

I use sleep widget (not displaySleep), if I try to login after sleep, the login with touch id not shown. Also there's a loading spinning a while (about 2-3 minutes) once I enter my password. Is anyone experiencing the same?

Also I don't have vox installed, maybe that causing it.

Two currency-elements: second won't update

I have two currency-elements:

{ "type": "currency", "refreshInterval": 60, "from": "ETH", "to": "EUR" }
{ "type": "currency", "refreshInterval": 60, "from": "LTC", "to": "EUR" }

The second one won't update. Only when I do a "reload preset" the second one gets updated.

Conditional Feature

Would be good do some actions when some condition matches like to hide/show some item.

It is just some examples:

Show/Hide battery.

  { "id" : "battery_level", "type": "battery", "align": "right" },

  {
    "type" : "condition",
    "refreshInterval": 60,
    "script" : { 
      "type" : "appleScriptInline",
      "value" : "do shell script \"script that returns battery_charged when battery is charged\""
    },
    "conditions" : [
      { 
        "condition" : "=", "value" : "battery_charged", 
        "actions" : [{ "type" : "hide_item", "id" : "battery_level"}] 
      },
      { 
        "condition" : "!=", "value" : "battery_charged", 
        "actions" : [{ "type" : "show_item", "id" : "battery_level"}] 
      }
    ]
  }

Hide Player buttons when needed:

  { "id" : "previous", "type": "previous", "width": 44 },
  { "id" : "play", "type": "play", "width": 44 },
  { "id" : "next", "type": "next", "width": 44 },

  {
    "type" : "condition",
    "refreshInterval": 1,
    "script": { 
      "type" : "appleScriptInline",
      "value" : "if application \"Spotify\" is running then\rreturn \"playing\"\relse return\"\"\r"
    },
    "conditions" : [
      { 
        "condition" : "=", "value" : "playing", 
        "actions" : [
          { "type" : "show_item", "id" : "previous"},
          { "type" : "show_item", "id" : "play"},
          { "type" : "show_item", "id" : "next"}
        ] 
      },
      { 
        "condition" : "!=", "value" : "playing", 
        "actions" : [
          { "type" : "hide_item", "id" : "previous"},
          { "type" : "hide_item", "id" : "play"},
          { "type" : "hide_item", "id" : "next"}
        ] 
      },
    ]
  }

Pomodoro timer pls :)

Is there any way to add a pomodoro timer? with configurabel pomodoro/short, long break?

Thanks a lot!

Delete button

Found comment to BTT "Esc is nice, but I would pay for a real Delete key at the very right..."
Here you go, just add this to preset:
{
"type": "staticButton",
"title": "Del",
"width": 44,
"align": "right",
"action": "keyPress",
"keycode": 117
},

Could you please add this to documentation.

Icons inside buttons are not centred if the width is custom.

I checked the documentation and couldn't find an option for this, unless I am missing something, these would look much nicer if they were centred.

P.S. I can help with anything design related if you need a hand with that, this idea is amazing.

screenshot 2018-07-04 19 00 57

screenshot 2018-07-04 19 00 57 copy

How the 'dock feature' work?

After setting dock in items.json, i can not open applications through the touch bar, when touching the icon, it does not work.

whitelist apps to let them use own touch bar

Some apps has nice and useful touch bar, so it'll be good to let add them to some whitelist, so they won't be hijacked by MTMR. BTT has this thing like exclude specific apps.

How does the "dock" type work?

I succeed in creating a dock in my touchbar. But I am not aware how it works and right now there is no documentation for that, too. Also, I notice that long press icons on the dock will close an app but clicking on each icon does nothing

Add brew formula

For easy installs and updates, it would be great to be able to just do:
brew install mtmr

Buttons sometimes do not trigger action

MTMR is great for me in all but one way: touching the buttons sometimes produces no result.

It can happen in any app, and I've tested across many. I believe it has to do with touch duration. If I hit a button really fast, the button brightens, but the haptic and the action do not fire.

Is there a threshold duration that has to be met, before the haptic and action are fired?

My current items.json is tiny, while I experiment with MTMR-

[{
	"type": "escape",
	"width": 900,
	"align": "center"
}]

Could dock button work better?

full-long click dock button doesn't work for the apps of Apple inc. And it’s a little difficult to operate, I have to try three times or more always before it works. Anyway it is a good tool, i have kept it all ready, thanks. Hope it work better.

spaces are lost on intergation with iterm2

Goal: to show folder and git branch of active session of iterm2 on touch bar

How: using iterm2_shell_integration in my ~/.zshrc

test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_integration.zsh"

iterm2_print_user_vars() {
  iterm2_set_user_var dirInfo $(print -P "%$(( $COLUMNS ))<...<%~%<<$(git branch 2>/dev/null | grep '\*' | sed 's,* \(.*\),[\1],')")
}

and MTMR items:

  {
    "type": "appleScriptTitledButton",
    "source": {
      "inline":
        "if application \"iTerm2\" is frontmost then tell application \"iTerm2\"\rtell current session of current window\rreturn (variable named \"user.dirInfo\")\rend tell\rend tell\r"
    },
    "action": "appleScript",
    "actionAppleScript": {
      "inline":
        ""
    },
    "refreshInterval": 1
  }

It works while folder doesn't have any spaces:
in case of /Applications/Sublime Text.app it shows just /Applications/Sublime

the same happens if I try to use space separator between folder and git branch name.

feat: finger slide

  • two finger slide: change you Volume
  • three finger slide: change you Brightness

Possible to activate it above all buttons when this gesture is detected ? actually it seems to be available only on the center :)

_another idea will be to add this in the config file in order to custom :

  • two finger slide
  • three finger slide
  • two finger tap
  • three finger tap

not sure it's a good idea, just for share if someone have other use cases._

Brightness slighter reverts to last position

When I slide the built-in brightness slider and release it, the screen brightness level changes as expected. But after several seconds, the slider reverts to its previous position, and the screen brightness also reverts to its previous level. This happens whether I adjust up or down.

If I instead use hidkey 2 & 3, the screen brightness level changes as expected and does not revert.

Button for lock screen

Hey,

first of all, thank you for this tool, great idea buddy! :)
I would like to change the behavior of your sleep button to just lock the screen. Could you implement this? Something like mode={sleep|lock} maybe :)

Gestures for actions

One guy showed on reddit how he's using gestures in BTT.

I'm using two finger swipe to change the volume and three finger swipe to change brightness. You don't need to press a button and grab a slider, it works no matter where you press on the touchbar.

In the most recent update (2.500), go to the touchbar section and click on the "+Widget/Gesture".
I have it set up with left swipe to "Turn volume down - small step" and right swipe set to "Turn volume up - small step".

Would be nice to have something like this =)

feat: multiple kind of actions

hello, me again! just a quick idea. Since i saw this integration :

music (tap for pause, longTap for next)

i thougt it was about a new feat for all buttons, quick example :

  {
  	"type": "staticButton",
  	"title": "πŸ›© ",
        "actions" : [ {
            "kind": "tap",
            "type": "appleScript",
            "actionAppleScript": {
    	         "filePath": "script1.applescript",
             }
         },{
            "kind": "longTap",
            "type": "appleScript",
            "actionAppleScript": {
    	         "filePath": "script2.applescript",
             }
        }],
 	 "width": 34,
 	 "align": "right"
  },

I thought about fours actions :

  • tap
  • longTap
  • doubleTap
  • tripleTap

example with vox or itunes (this reduces the number of buttons and saves space)

  • tap -> next
  • longTap -> pause
  • doubleTap -> previous
  • tripleTap -> quit

example with reminders

  • tap -> check last task
  • longTap -> switch from list
  • doubleTap -> open reminders in front
  • tripleTap -> quit

example with a custom timer in apple script (inspired from touch bar timer)

  • tap -> start/pause
  • longTap -> reset

Actually I'm talking about script by action, but I'm just starting to test AppleScript, maybe we can give the var "kind" two the script, in order to have one script for all actions.

I'm juste sharing the idea, as soon as I have a little time I would not hesitate to PR if I can :)

Really cool project, it's the first time I feel that i can do something with my Touch Bar πŸ‘

Is modifier key possible for keypress? What is hidkey?

I want to make a button for screen-capture. Since I already have a keyboard shortcut that will launch screen-cap, seems like the easiest way is to create a "staticButton" with "keypress" action, but I don't know how to include a modifier (cmd,ctrl,shft) into the keycode.

Also, what does the "hidkey" action do?

Cannot see Input Source button

Background Color and the input source button is not the same as other buttons. I have installed English & Chinese (Traditional) Stroke. But I have tried removing the Chinese, but the problem persist. Attached with the Touch Bar Screenshot

touch bar shot 2018-07-26 at 8 12 58 pm

Static button with base64 encoded image not work

This will not work, although image renders correctly:

{
  "type": "staticButton",
  "action": "shellScript",
  "executablePath": "/usr/local/bin/maclock",
  "width": 36,
  "align": "left",
  "image": {
    "base64":
      "iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAMAAABEpIrGAAAAA3NCSVQICAjb4U/gAAAACXBIWXMAAAiEAAAIhAENVwL6AAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAQtQTFRF////gICA////VVVV////1dXVVWqA1dXVUmZ6xMzEWGh4ycnJUmt6U2x7Ump4Uml71t/bVGp72traVGp5U2x4yMrIU2l4VGl6xsrGVGp6VGp5U2t5U2l529/fyMvIusC/VGp5xsnGxsnGu8HAVGp5VWl5VGp53ODgx8rHVGt5mKSnx8rHVWl509nZ3+PjxsrGU2p54OTkVGp53+PjVGp51Nrbx8rHVGp5sLu/yMrI4eXmx8rH4ubnVGp54+npVGp5VGp55err5errTExPVGp5X19hX2BiYGFjZGRnZGVoZmZpfH1+gYKDhIWGiIqMj5GTk5WXlJaWp6qsu767wsXCx8rH2Nze4ebn5+ztsVhOVQAAAEN0Uk5TAAICAwQGDAwZHiAhMjQ1ODg6PlJTYWhtfoCLjZadoaOkq7C1t7i5vsDJyc3Q3Nzd4uPm5+jp6u/v7+/w9ff6/P39/otxtB4AAAEASURBVDhPpdDnTgJBFAXgRYqAFCmCNEFUEERERJbe7hE7RVB4/ycxkCEzu7BjIufXnJwvuckoCo8pGM1UKplo0KTsjCsHlpxr1x7pAeWrWOyyDPQi23sAUMPm1cscVoGAfneqKNk3xV6C6tSBONpu3txtxHWggJRYUyhod1sXIbGH0LVpgAfwid0HeDTAC3hlfW9wcJLM5y/S6zys81ir3SYsm916/c2z5GkcMnAq7CJYZhm4MQItBupGYMBAk8+zj/GPFLwTjaRgSPQqBU9EL/uBZ6I3KfgkmkjBfPq1kII/P+qf4M4IdBg4MwJFBhziDfHCMQPK0Xl1G/Tv/avtFzQPtEKn9N7CAAAAAElFTkSuQmCC"
  }
},

this works but not render image

{
    "type": "staticButton",
    "action": "shellScript",
    "executablePath": "/usr/local/bin/maclock",
    "width": 36,
    "align": "left",
    "title": "πŸ”’"
  },

this works fine

{
    "type": "staticButton",
    "action": "shellScript",
    "executablePath": "/usr/local/bin/maclock",
    "width": 36,
    "align": "left",
    "title": "sleep"
  },

No way to exit from group

Hi everybody, it is strange, but i've found no way to exit from opened group (return to mtmr bar). There is no "type" for it. What i'm missing?

Custom apple script button not working

Awesome work guys! That's a great tool!
However I'd like to have a mute button instead of having to slide down to zero.

I tried multiple ways to add a custom applescript button but none worked πŸ˜”

This is my last attempt :

{
    "type": "staticButton",
    "align": "right",
    "image": { "base64" :"a real base 64 that is way too long"},
    "action": "appleScript",
    "actionAppleScript": {
        "source": "/Users/acalmette/mute.scpt"
    },
    "width": 36
  }

I tried to inline the script which is :

set curVolume to get volume settings
if output muted of curVolume is false then
	set volume with output muted
else
	set volume without output muted
end if

And it didn't work neither.

Note that the script works when played by script editor.
Any ideas?

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.