Quick and easy access to Microsoft Remote Desktop from any desktop space. Allows connection opening and switching. Only displays connections with labels assigned.
#!/usr/bin/env /usr/local/bin/node
/*
<xbar.title>Microsoft Remote Desktop - Quick Connect</xbar.title>
<xbar.version>v0.1.1</xbar.version>
<xbar.author>Marco Ferrer</xbar.author>
<xbar.author.github>marrferr</xbar.author.github>
<xbar.desc>Quick and easy access to Microsoft Remote Desktop from any desktop space. Allows connection opening and switching. Only displays connections with labels assigned.</xbar.desc>
<xbar.image>https://www.dropbox.com/s/aiodjoketuujbaf/mrd-quick-connect.png?raw=1</xbar.image>
<xbar.dependencies>node,node-simple-plist,node-bitbar</xbar.dependencies>
************** Decoded Contents of the Apple Script Helper ****************
***************************************************************************
on run connectionLabel
set appTitle to "Microsoft Remote Desktop"
set connectionLabel to (text of item 1 of connectionLabel as string)
#set connectionLabel to "show_connection_list"
tell application appTitle
activate
tell application "System Events"
tell process appTitle
#Make sure the frontmost windows from mrdp is the connection list
set frontmost to true
delay 0.4
set menuItems to every menu item of menu "Window" of menu bar 1
set connectionListMenuItem to false
set targetMenuItem to false
try
repeat with menuItem in menuItems
if (name of menuItem as string) is (connectionLabel & " ") then
set targetMenuItem to menuItem
else if name of menuItem as string is appTitle then
set connectionListMenuItem to menuItem
end if
end repeat
end try
if targetMenuItem is not false then
click targetMenuItem
else
click connectionListMenuItem
delay 0.3
set connectionListWindow to windows where title contains appTitle
--Initial focusing of window to prevent problems with closing it later on.
repeat with w in connectionListWindow
set focused of w to true
end repeat
--Clear the search input
keystroke tab
key code 115 --home
perform action "AXRaise" of (first window whose title is appTitle)
keystroke "f" using {command down} --Focus on search input
keystroke "a" using {command down} --Select all of inputs contents
key code 51 --delete
if (connectionLabel as string) is not "show_connection_list" then
--Clear any previously selected list item before filtering
keystroke tab
key code 115 --home
perform action "AXRaise" of (first window whose title is appTitle)
keystroke "f" using {command down} --Focus on search input
keystroke connectionLabel --search query
delay 0.1
keystroke tab
key code 123 --left arrow
key code 124 --right arrow
key code 125 --down
delay 0.3
key code 36 --enter
--This method of closing connection window is unreliable
#perform action "AXPress" of button 1 of (first window whose title is appTitle)
--Work around for consisten results. Using two forms of closing the connection list window
--Each method covers a particular window state
--Closes window when it is outside of a desktop with a open rdc connection.
try
repeat with w in windows
if title of w contains appTitle then
set focused of w to true
perform action "AXPress" of button 1 of w
end if
end repeat
end try
--Allows window to be close it is focused into a desktop with a running rdc connection
tell process "Finder"
click button 1 of item 1 of connectionListWindow
end tell
end if
end if
end tell
end tell
end tell
end run
*******************************************************************
*******************************************************************
*/
'use strict';
var mrdIcon = "iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAACXBIWXMAABYlAAAWJQFJUiTwAAAEHWlDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjajZVdbBRVGIaf3TkzawLOVQUtSZmgAiGlWcAoDQHd7S7bwtputi3SxkS307O7Y6ez45nZ8hOuiInGG1DvDInx747ExEQD/kTwQm4wmBAUsDHRcAHxJyQk3CjUi9nuDtgGz9U37/m+9/2+95yZgdTliu+7SQtmvVCVC1lr/8SklbpCksdYQTcrKnbgZ0qlIkDF913uXQm4/SMJgIubl9h/0FoxLQMbEg8BjenAnoXEQdBP2L4KIdUFbD8Q+iGkikCX2j8xCamXga5aFIdA11QUvwF0qbHyAKROAKZdr0xD6iTQOxXDa7E46gGAroL0pHJsq1zIWiXVqDqujLX7gO3/uWbd5qLeWmBlMDO6F9gIidemK7m9QB8kTtqV/CjwBCSuzjn7hlvxXT/MloH1kFzXnBnPAJsgOVhVu8cjnqSqNwcX43cP18deAFZB8ltvanikVXvZDgYmgXWQvFuXQ0WgBzTLCYfGolptl2qURyJdrTotc3mgF7Q3Zxp7yxGn9nkwN5pf5DxcHxhu4edfqewpAd2g/SbdQjnS0v7xw1KrB9HjucPFSEvkZJAfXcTD+thgpCvcUI21asXxqrN7qJX/aV0NllvxVd8tFaPe9KRqlsejfL2vovKFiFMvSW+8xa/PsS9RQdJgComNxx0syhTIYuGjaF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FFYAAeTxcAH18AHlthABPibAwAFGtoGwACZaJhAB8sRltPWf/zT18AIGoMACFPYQAiagwAI08qYQAbay9hABxbYQAdLFxawTgxYQAkYQAlL2oMACZPYQAnYQAoYQApa3ZsDAAhT2EAKmEAKGEAKWt2bAwAIU9hACtqDAAjT6DkJmEALAEdAOxfACBqDAAhT2EAImoMACNPKmEAG2svYQAcW2EAHSxcWsE4MWEAJGEALS9qDAAmT2EALmEAKGEAKWt2bAwAIU+gagwAIU9hAC9qDAALT18AIGoMACFPYQAwagwAI09hADFqDAAjT2EAMmoMACNPYQAaagwAC09hADNqDAAjTxQARxcAQSphABstW2EAE+JsDAAUa2gbAAKiYQAdLMEIHQAeZaJhAB8sRk+iYQA0ay9hACRhADUvagwAJlkAA2hbT1n/01cACFgAFwAYaE8q6GEANi8SABFfAB7iay9hADRrL2oMABlVT1BZAANoVVVVDwBhc2NyAAEADfre3q0=',
packageJson = {
name: "mrd-quick-connect",
version: "0.1.1",
description: "BitBar plugin for quick and easy access to Microsoft Remote Desktop from any desktop space. Allows connection opening and switching. Only displays connections with labels assigned.",
repository: "",
license: "MIT",
dependencies: {
"bitbar": "^0.3.0",
"simple-plist": "^0.2.1",
"find-process": "^1.0.5"
},
appleScriptVer: "0.1.0"
},
os = require('os'),
fs = require('fs'),
bitbar = null,
plist = null,
find = null,
dependencyDirPath = __dirname + '/' + packageJson.name,
mrdContainerBasePath= os.homedir() + '/Library/Containers/com.microsoft.rdc.mac',
mrdPreferencePath = mrdContainerBasePath + '/Data/Library/Preferences/com.microsoft.rdc.mac.plist',
mrdWindowListPath = mrdContainerBasePath + '/Data/Library/Saved Application State/com.microsoft.rdc.mac.savedState/windows.plist',
appleScriptPath = dependencyDirPath + '/'+ packageJson.name + '.' + packageJson.appleScriptVer + '.scpt';
function getBarContents(mrdIsRunning){
var barContents = [{
text: ' ',
image: mrdIcon,
dropdown: false
},
bitbar.sep,
{
text: "☰ Open Connection List",
bash: "/bin/bash",
param1: "-c",
param2: "osascript " + bitbarEscape(appleScriptPath) + " show_connection_list",
terminal: false
},
bitbar.sep
];
var mrdPrefs = getPlistJson(mrdPreferencePath);
if(mrdPrefs == null){
barContents.push({
text: '❌ Preference file could not be found.'
});
barContents.push({
text: mrdPreferencePath
});
return barContents;
}
//mrd wont always clear windows.plist upon exit. Only get windows if mrd is running
var windowList = (mrdIsRunning ? getWindowList() : {} ),
connectionIds = mrdPrefs["bookmarkorder.ids"];
for (var i = 0; i < connectionIds.length; i++) {
var id = connectionIds[i],
label = mrdPrefs["bookmarks.bookmark."+id+".label"],
username = mrdPrefs["bookmarks.bookmark."+id+".username"],
hostname = mrdPrefs["bookmarks.bookmark."+id+".hostname"];
//For now only connections with labels will be displayed
if(label != undefined && label != ''){
var connectionIsOpen = windowList.hasOwnProperty(label);
//◉ ◯ ◎
var barItem = {
text: (connectionIsOpen ? '◉ ' : '◯ ') + label,
size: "13",
//Only config that succesfully runs apple script help with terminal false
//https://github.com/matryer/bitbar/issues/162
bash: "/bin/bash",
param1: "-c",
param2: "osascript " + bitbarEscape(appleScriptPath) + " " + bitbarEscape(label),
terminal: false
};
//Stylize connection based on state
if(connectionIsOpen){
barItem.font = "HelveticaNeue-Bold";
} else {
barItem.color = "gray";
}
barContents.push(barItem);
barContents.push({
text: "Username: " + username,
size: "10"
});
barContents.push(bitbar.sep);
}
}
return barContents;
}
function bitbarEscape(text){
return text.replace(" ","\\\ ");
}
function getWindowList(){
var mrdWindowStates = getPlistJson(mrdWindowListPath),
windowList = {};
if (mrdWindowStates != null){
for(var i = 0; i < mrdWindowStates.length; i++){
var mrdWindow = mrdWindowStates[i];
if(mrdWindow.hasOwnProperty("NSTitle")){
//The window title is stored in the plist with trailing spaces. Triming before storing
mrdWindow.NSTitle = mrdWindow.NSTitle.trim();
windowList[mrdWindow.NSTitle] = mrdWindow;
}
}
}
return windowList;
}
function getPlistJson(filePath){
var result = null;
try{
result = plist.readFileSync(filePath);
}catch(ignored){
//When an mrd connection is holding up the quiting of the application
//it deletes the window plist and fails to quit.
}
return result;
}
function initDependencies(){
if (!fs.existsSync(dependencyDirPath)){
fs.mkdirSync(dependencyDirPath);
}
if (!fs.existsSync(appleScriptPath)){
fs.writeFileSync(appleScriptPath, Buffer.from(mrdAppleScriptHelper, 'base64'));
}
try{
bitbar = require( dependencyDirPath + '/node_modules/bitbar' );
plist = require( dependencyDirPath + '/node_modules/simple-plist' );
find = require( dependencyDirPath + '/node_modules/find-process' );
return true;
}catch(e){
try{
fs.unlinkSync( dependencyDirPath + "/package.json" );
}catch(ignored){}
}
return false;
}
function prepareForInstall(){
if (!fs.existsSync(dependencyDirPath + "/package.json")){
fs.writeFileSync(dependencyDirPath + "/package.json", JSON.stringify(packageJson), { flag: 'wx' });
}
console.log(
"⬇\n---\n Click to Install Dependencies | bash='cd " +
dependencyDirPath.replace(" ","\\\\ ") + " && npm install'"
);
}
if(initDependencies()){
find('name', 'Microsoft Remote Desktop').then(function (list) {
bitbar(getBarContents(list.length > 0));
});
}else{
prepareForInstall();
}