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 Issues

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 πŸ‘

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?

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"
  },

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.

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?

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"}
        ] 
      },
    ]
  }

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.

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 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

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.

Pomodoro timer pls :)

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

Thanks a lot!

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.

"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?

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 =)

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 :)

Add brew formula

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

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.

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"
}]

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.

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

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.

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.

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.