I have Crouton on my Chromebook with Spotify inside an Ubuntu chroot.
I can execute Spotify inside an Ubuntu chroot as a single app window via a Crouton command.
I want to create a Chrome OS application that acts as a launcher for Spotify, Skype, etc.
In short:
My Chrome OS app should execute a shell command.
I read about NPAPI, but it says it's getting depreciated (since 2013 o.O).
If there's another way (for example executing a bash script that adds a button to the shelf that just executes another shell script to open Spotify), it would also be great.
Thx in advance :)
EDIT:
With Dart this seems to be possible. It says "access File system, USB Devices, shells and much more" with it
Looks like Native Messaging is just the thing you're looking for! However you may need to create an application that can be registered as a Native Messaging Host. This application will then in turn call the shell command/script you intend to run.
Related
I am using google-cloud-shell which is basically a shell that allows us to use online cloud shell (for developing apps etc.) and provides 5gb of free storage (only for home directory).
It is a very cool thing because i don't have PC but google-cloud-shell allows me to run gradle, java, python, etc. without any issues except one issue and i.e typing response. Although it is a very good platform for learning coding but typing is insane.
If i type a character it takes about a second to be displayed on screen and it really really sucks. Now what i want is to connect this shell to termux (which is an app just like terminal in linux) with ssh or any other thing that can connect it.
NOTE: I am not using paid version of google-cloud-storage I am just using it cloud shell which is free to use.
You can use the following gcloud command to SSH into your cloud-shell from local terminal.
gcloud alpha cloud-shell ssh
You can find more details here
Not sure how clear the title is, but basically I've created a program for Windows which my company can use to build games remotely from their desktops. Currently the Windows aspect works without a hitch, but I'm struggling to get our Mac to build.
We use psexec for the Windows side, and I tried to use it for Mac as well (just hoping), to be stuck with an Invalid Handle error.
The way the program works is the user selects from their system tray what they want to build, we have two options that require the Mac, both of those currently are the only ones that don't work.
We do have the ability to remotely access the Mac as well, but we're looking to mostly automate the process so that literally anyone (even the non-technically savvy) can click two buttons and create a build.
I've got an AWS instance running Jupyter that I use for general mucking around, and tend to shut it down when not in use. Shutting it down changes the IP and the DNS name. On the Mac, I have a simple script that uses the AWS CLI to grab the current IP of the instance and use that to open the Jupyter notebook in Chrome.
I'm trying to replicate the same functionality on a ChromeBook. I've been able to get the shell running, get the AWS CLI running, but can't figure out how to do the last bit, which is to open the URL in Chrome. (In other words, do the equivalent of the OSX Bash command open -a "/Applications/Google Chrome.app" http://1.2.3.4:8888 on the ChromeBook shell.
So basically I want to know how to open an arbitrary URL in Chrome from the ChromeBook shell.
My Chromium OS machine has xdg-open. If your version has that, it'll be the easiest thing.
xdg-open http://1.2.3.4:8888
If not, you can always just call the full path of Chrome with the url as a parameter, (e.g. chrome http://...) or consider the many options provided here.
I created a Command Line Tool app using Xcode.
In that app, I used NSWorkspace to launch another application bundle (.app) as suggested here.
MacOsX: How to launch an application (.app) from a "Command Line Tool" type of app
All seem to work fine until I tried to start that Command Line Tool app as a daemon using launchctl.
If the daemon is run as the currently logged in user, then the Command Line Tool app launches the external app just fine.
If the daemon is run as root, then the Command Line Tool app cannot launch the external app.
Using NSWorkspace to open an app doesn't seem to work if the daemon is run as root.
Does anyone know the correct way to open another app from a daemon that's running as root?
This is likely a security restriction within MacOS you're running into.
What I would suggest doing is to create a code-signed "helper tool" that resets itself (via setuid -- which I wouldn't do outside of a code-signed app) to the userid of currently logged in user, and then do the NSWorkspace trick to launch the app in that user context.
Creating helper tools is not trivial though. The grand concepts are described in Apple's Authorization Services Programming Guide.
Take a look at Apple's "SMJobBless" sample code, which shows how to install the helper tool that you could set the user rights on and then modify it's helper tool code to launch your app.
This is too complicated a subject to really address in a StackOverflow answer. The short answer is that daemons can't launch applications reliably. For the long answer, please read Apple's Technical Note TN2083: Daemons and Agents.
I finally got it working by using the code mentioned in this link to get the "console user's" uid and gid:
https://superuser.com/questions/180819/how-can-you-find-out-the-currently-logged-in-user-in-the-os-x-gui.
The link shows an example of how to use SCDynamicStoreCreate() and SCDynamicStoreCopyConsoleUser() to get "console user's" uid and gid.
After getting the uid and gid, just set the uid and gid to those of the console user before using NSWorkspace to open an app and that did the trick for me.
So I want to open my workspace automatically when I open a profile for work, the problem is that it opens the windows (and windows splits) correctly but doesn't run any script to start my server, celery tasks, get into the correct folders, etc.
Is there a way to do this? even running a bash script would work for me, it doesn't have to be supported by iTerm.
I think you will find this article useful. It uses Apple Script to tell iTerm2 to open multiple windows and run commands in each of them.
http://90kts.com/2011/09/29/split-panes-and-remembered-sessions-in-iterm2/