jigish / slate

A window management application (replacement for Divvy/SizeUp/ShiftIt)
GNU General Public License v3.0
7.84k stars 510 forks source link

binding to a shell script makes Slate quit #283

Open brunogama opened 11 years ago

brunogama commented 11 years ago

I switch between browsers all day so I wanted to make a key bind to the current default browser, so I created a little script. It's ugly but works ;)

But i am always getting the error message: [<WebScriptObject 0x1003c33d0> valueForUndefinedKey:]: this class is not key value coding-compliant for the key app.

this is the snippet that I am trying to run on my Slate.js

var focusApp = function (argument) { return S.op("focus", {"app": argument}); };
//var hyperKey = function(argument) { return argument+":ctrl;shift;alt;cmd"; };

// Current Browser
// Gist: https://gist.github.com/brunogama/5254021
var currentBrowser = S.sh("default_browser", true, "~/.local/bin");
S.bnda({
    "b:ctrl;shift;alt;cmd": focusApp(currentBrowser)
    //... all the other bindings works
});
dj-trenhaile commented 4 years ago

I was able to reproduce this in multiple scenarios. Take for example this simplified version:

let app = S.sh("get_browser', true, "/Users/<my username>/.local/bin");  
S.bnda(
    {
        "c:alt": S.op("focus", {"app": app})
    }
);

get_browser: echo "Google Chrome"

Using just "Google Chrome" in place of the call to app works just fine. But keeping the reference to app throws the error. As does using "./get_browser" and a non-existent path in place of "get_browser".

I've also tried using this shell api for other basic things without success, such as calling a python script (yes, I use the full path to my executable, python file, and the path of the new file to be written in my python file) to write a message in a txt file. I can't find any working implementations of slate.shell anywhere, let alone anything useful with regards to this issue.