-
Notifications
You must be signed in to change notification settings - Fork 259
CLI Scripting
iaeiou edited this page Nov 5, 2020
·
11 revisions
WARNING: This page is under construction
You should always check the output of the --help
switch, as options may be added or changed between versions.
$ cd ~/.local/share/gnome-shell/extensions/[email protected]/service/
$ ./daemon.js --help
Usage:
GSConnect [OPTION…]
Help Options:
-h, --help Show help options
--help-all Show all help options
--help-gapplication Show GApplication options
--help-gtk Show GTK+ Options
Application Options:
-l, --list-devices List available devices
-a, --list-all List all devices
-d, --device=<device-id> Target Device
--pair Pair
--unpair Unpair
--message=<phone-number> Send SMS
--message-body=<text> Message Body
--notification=<title> Send Notification
--notification-appname=<name> Notification App Name
--notification-body=<text> Notification Body
--notification-icon=<icon-name> Notification Icon
--notification-id=<id> Notification ID
--photo Photo
--ping Ping
--ring Ring
--share-file=<filepath|URI> Share File
--share-link=<URL> Share Link
--share-text=<text> Share Text
-v, --version Show release version
--display=DISPLAY X display to use
When running a script with the Commands plugin, several environment variables are available to ease scripting:
$GSCONNECT; # Path to the application (`daemon.js`)
$GSCONNECT_DEVICE_DBUS; # DBus object path, useful for Python, GJS or other script
$GSCONNECT_DEVICE_ID; # The id of the device executing the command
$GSCONNECT_DEVICE_NAME; # The display name of the device (eg. Google Pixel)
$GSCONNECT_DEVICE_ICON; # The themed icon name of the device (eg. smartphone-symbolic)
The following scripts are simple examples that can be used with the Commands plugin. Please note these are only examples and it is your responsibility to confirm that these scripts are safe to run.
#!/bin/bash
filename=/tmp/$(date).png
gnome-screenshot --file=${filename}
${GSCONNECT} --device ${GSCONNECT_DEVICE_ID} --share-file ${filename}