Giter VIP home page Giter VIP logo

mtmr's Introduction

My TouchBar. My rules

The TouchBar Customization App for your MacBook Pro

GitHub release license Total downloads minimal system requirements travis

MTMR Community: Discourse Discord Telegram

PayPal donate button Buy Me A Coffee Become a backer Become a sponsor

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

Installation

  • Download lastest release from github
  • Or via Homebrew brew cask install mtmr

Built-in button types:

Buttons

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

Native Plugins

  • battery
  • currency
  • weather
  • 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)
  • pomodoro

Media Keys

  • previous
  • play
  • next

AppleScript plugins

  • sleep
  • displaySleep

Gestures on central part:

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

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": "/Users/toxblh/Library/Application Support/MTMR/iTunes.nowPlaying.scpt",
      // or
      "inline": "tell application \"Finder\"\rmake new Finder window\rset target of front window to path to home folder as string\ractivate\rend tell",
      // or
      "base64": "StringInbase64"
    },
  • timeButton
  "type": "timeButton",
  "formatTemplate": "HH:mm" //optional

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

timeButton

Attention! Works not all: https://en.wikipedia.org/wiki/List_of_time_zone_abbreviations

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

weather

Provider: https://openweathermap.org Need allowance location service

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

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,
  "bordered": false,
  "refreshInterval": 2, // in seconds
},

pomodoro

Pomodoro plugin. One click to start the work timer, longclick to start the rest timer. Click in progress for 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)
},

Actions:

  • hidKey

https://github.com/aosm/IOHIDFamily/blob/master/IOHIDSystem/IOKit/hidsystem/ev_keymap.h use only numbers

 "action": "hidKey",
 "keycode": 53,
  • keyPress
 "action": "keyPress",
 "keycode": 1,
  • appleScript
 "action": "appleScript",
 "actionAppleScript": {
     "inline": "tell application \"Finder\"\rmake new Finder window\rset target of front window to path to home folder as string\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",

LongActions

If you want to longPress for some operations, it is similar to the configuration for Actions but with additional parameters, for example:

 "longAction": "hidKey",
 "longKeycode": 53,
  • longAction
  • longKeycode
  • longActionAppleScript
  • longExecutablePath
  • longShellArguments
  • longUrl

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"

Example configuration:

[
  { "type": "escape", "width": 110 },
  { "type": "exitTouchbar", "align": "left" },
  {
    "type": "brightnessUp",
    "align": "left",
    "width": 36
  },
  {
    "type": "staticButton",
    "align": "left",
    "title": "🔆",
    "action": "keyPress",
    "keycode": 113,
    "width": 36
  },

  {
    "type": "appleScriptTitledButton",
    "source": {
      "filePath": "/Users/toxblh/Library/Application Support/MTMR/iTunes.nowPlaying.scpt"
    },
    "refreshInterval": 1
  },
 {
    "type": "staticButton",
    "align": "left",
    "image": { "base64" : "%base64Finder%"},
    "action": "appleScript",
    "actionAppleScript": {
        "inline": "tell application \"Finder\"\rmake new Finder window\rset target of front window to path to home folder as string\ractivate\rend tell"
    },
    "width": 36
  },
  {
    "type": "appleScriptTitledButton",
    "source": {
      "inline": "if application \"Safari\" is running then\r\ttell application \"Safari\"\r\t\trepeat with t in tabs of windows\r\t\t\ttell t\r\t\t\t\tif URL starts with \"https:\/\/music.yandex.ru\" and name does not end with \"на Яндекс.Музыке\" then\r\t\t\t\t\treturn name of t as text\r\t\t\t\tend if\r\t\t\tend tell\r\t\tend repeat\r\tend tell\rend if\rreturn \"\""
    },
    "refreshInterval": 1
  },
  { "type": "previous", "width": 36, "align": "right" },
  { "type": "play", "width": 36, "align": "right" },
  { "type": "next", "width": 36, "align": "right" },
  { "type": "sleep", "width": 36 , "align": "right"},
  { "type": "displaySleep", "align": "right" },
  { "type": "weather", "refreshInterval": 1800, "width": 70, "align": "right" },
  { "type": "volumeDown", "width": 36 , "align": "right"},
  { "type": "volumeUp", "width": 36 , "align": "right"},
  { "type": "battery", "refreshInterval": 60 , "align": "right"},
  { "type": "appleScriptTitledButton", "refreshInterval": 1800, "source": { "filePath": "/Users/redetection/Library/Application Support/MTMR/Weather.scpt"} , "align": "right"},
  { "type": "timeButton", "formatTemplate": "HH:mm", "width": 64, "align": "right" }
]

Roadmap

  • Create the first prototype with TouchBar in Storyboard
  • Put in stripe menu on startup the application
  • Find how to simulate real buttons like brightness, volume, night shift and etc.
  • Time in touchbar!
  • First the weather plugin
  • Find how to open full-screen TouchBar without the cross and stripe menu
  • Find how to add haptic feedback
  • Add icon and menu in StatusBar
  • Hide from Dock
  • Status menu: "preferences", "quit"
  • JSON or another approch for save preset, maybe in ~/Library/Application Support/MTMR/
  • Custom buttons size, actions by click
  • Layout: [always left, NSSliderView for center, always right]
  • System for autoupdate (https://sparkle-project.org/)
  • Overwrite default values from item types (e.g. title for brightness)
  • Custom settings for paddings and margins for buttons
  • XPC Service for scripts
  • UI for settings
  • Import config from BTT

Settings:

  • Interface for plugins and export like presets
  • Startup at login
  • Show on/off in Dock
  • Show on/off in StatusBar
  • On/off Haptic Feedback

Maybe:

  • Refactoring the application on packages (AppleScript, JavaScript? and Swift?)

Author's presets

@Toxblh preset

@ReDetection preset

User's presets

@luongvo209 preset

aadi_vs_anand preset

Credits

Built by @Toxblh and @ReDetection.

Analytics

mtmr's People

Contributors

toxblh avatar ad avatar redetection avatar jstart avatar koenpunt avatar luong-komorebi avatar bassoon08 avatar

Watchers

Stijn Dubrul avatar

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.