Skip to content

Commit

Permalink
v0.0.2 -- Fix cut/copy/paste macOS shortcuts
Browse files Browse the repository at this point in the history
  • Loading branch information
belltown committed Feb 26, 2017
1 parent 6388ebe commit d58c810
Show file tree
Hide file tree
Showing 11 changed files with 90 additions and 54 deletions.
22 changes: 13 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
<h1 style="color: white; background-color: #af9cd9; padding: 2em 0; text-align: center">![](https://github.com/belltown/violetbug/blob/master/doc/icon.png) VioletBug — Roku Debugger Graphical Interface</h1>
<h1 style="color: white; background-color: #af9cd9; padding: 2em 0; text-align: center">![](https://raw.githubusercontent.com/belltown/violetbug/master/doc/icon.png) VioletBug — Roku Debugger Graphical Interface</h1>

VioletBug is a cross-platform desktop application providing a graphical interface to the Roku Debugger as an alternative to Telnet. It is similar to PurpleBug, https://belltown-roku.tk/PurpleBug, which is still supported; however, PurpleBug only runs on Windows PCs, and is closed-source. VioletBug, in contrast, is open-source running under [Electron](http://electron.atom.io/) and [Node.js](https://nodejs.org), written entirely in HTML, CSS and JavaScript. The source code can be found on [GitHub](https://github.com/belltown/violetbug).

Note that VioletBug is not intended as a general-purpose Telnet client, and as such only offers features deemed to be relevant to debugging a Roku device, e.g. Rokus can only be addressed by IP address, not by host name; and only well-known ports used by the Roku are supported.

## Features

* Runs under Windows (7+), macOS (10.9+), and linux
Expand Down Expand Up @@ -35,7 +37,7 @@ VioletBug can be downloaded on Windows using either an automatic "One-Click" NSI

###### Automatic Installation

* Download `VioletBug Setup x.y.z.exe` from https://github.com/belltown/violetbug/releases/latest
* Download `VioletBug.Setup.x.y.z.exe` from https://github.com/belltown/violetbug/releases/latest
* Run the downloaded file to install VioletBug. It may appear as if nothing's happening for a minute or so, depending on how your computer is configured. Be patient and the installation should complete, then VioletBug will launch
* Pin the VioletBug icon to the Taskbar for convenient access, or use the desktop shortcut icon
* You may have to disable your anti-virus protection (unless using only Windows Defender), before downloading and running the installer
Expand All @@ -58,12 +60,12 @@ Compiled binaries and installers for various linux distributions are provided at
Download `violetbug-linux.zip` from https://github.com/belltown/violetbug/releases/latest, e.g:
```
cd ~/Downloads
wget https://github.com/belltown/violetbug/releases/download/vx.y.z/violetbug.zip
wget https://github.com/belltown/violetbug/releases/download/vx.y.z/violetbug-linux.zip
```

Unzip to the appropriate folder, e.g. `/opt`
```
sudo unzip -o -q violetbug.zip -d /opt
sudo unzip -o -q violetbug-linux.zip -d /opt
```

Run the application:
Expand All @@ -79,15 +81,17 @@ Download one of the following installers:

- deb package (Ubuntu/Mint/Debian, etc)
- rpm package (Fedora/CentOS/Red Hat, etc)
- freebsd package (FreeBSD)
- AppImage package file (multiple linux distributions)

AppImage files should run on any linux distribution that supports [AppImage](http://appimage.org/):

* Set the file to be executable, e.g: `chmod u+x violetbug*.AppImage`
* Run the file, e.g: `./violetbug*.AppImage`
* First, download the .AppImage file into any directory from which you can execute applications
* Next, **set the file to be executable**, e.g: `chmod u+x violetbug*.AppImage`, or set executable file property in File Manager GUI
* Finally, run the file, e.g: `./violetbug*.AppImage`
* All required dependencies and resources are contained in the `.AppImage` file. Nothing else gets installed. Run the file from any location; delete it to uninstall.

BSD variants, such as FreeBSD, are not supported.

###### Linux dependency issues

If you get this error on linux: **error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory**, then install libXScrnSaver, e.g: `sudo yum install libXScrnSaver`.
Expand Down Expand Up @@ -149,6 +153,6 @@ File a GitHub issue at https://github.com/belltown/violetbug/issues

## Screenshots

![Rokus](https://github.com/belltown/violetbug/blob/master/doc/ScreenShotRokus.png)
![Rokus](https://raw.githubusercontent.com/belltown/violetbug/master/doc/ScreenShotRokus.png)

![Connections](https://github.com/belltown/violetbug/blob/master/doc/ScreenShotConn.png)
![Connections](https://raw.githubusercontent.com/belltown/violetbug/master/doc/ScreenShotConn.png)
2 changes: 0 additions & 2 deletions doc/BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,4 @@ The following commands are available to generate installers in `/dist`:
| `npm run dist-appimage`
| `npm run dist-deb`
| `npm run dist-rpm`
| `npm run dist-freebsd`
| `npm run dist-tarxz`
| `npm run dist-win`
20 changes: 11 additions & 9 deletions doc/README.md.html
Original file line number Diff line number Diff line change
Expand Up @@ -484,9 +484,10 @@
}
</style>
</head>
<body class='markdown-preview' data-use-github-style><h1 style="color: white; background-color: #af9cd9; padding: 2em 0; text-align: center"><img src="https://github.com/belltown/violetbug/blob/master/doc/icon.png" alt=""> VioletBug — Roku Debugger Graphical Interface</h1>
<body class='markdown-preview' data-use-github-style><h1 style="color: white; background-color: #af9cd9; padding: 2em 0; text-align: center"><img src="https://raw.githubusercontent.com/belltown/violetbug/master/doc/icon.png" alt=""> VioletBug — Roku Debugger Graphical Interface</h1>

<p>VioletBug is a cross-platform desktop application providing a graphical interface to the Roku Debugger as an alternative to Telnet. It is similar to PurpleBug, <a href="https://belltown-roku.tk/PurpleBug">https://belltown-roku.tk/PurpleBug</a>, which is still supported; however, PurpleBug only runs on Windows PCs, and is closed-source. VioletBug, in contrast, is open-source running under <a href="http://electron.atom.io/">Electron</a> and <a href="https://nodejs.org">Node.js</a>, written entirely in HTML, CSS and JavaScript. The source code can be found on <a href="https://github.com/belltown/violetbug">GitHub</a>.</p>
<p>Note that VioletBug is not intended as a general-purpose Telnet client, and as such only offers features deemed to be relevant to debugging a Roku device, e.g. Rokus can only be addressed by IP address, not by host name; and only well-known ports used by the Roku are supported.</p>
<h2 id="features">Features</h2>
<ul>
<li>Runs under Windows (7+), macOS (10.9+), and linux</li>
Expand Down Expand Up @@ -517,7 +518,7 @@ <h3 id="windows-installation">Windows Installation</h3>
<p>VioletBug can be downloaded on Windows using either an automatic &quot;One-Click&quot; NSIS installer, or by manual installation. If one method doesn&#39;t work, try the other.</p>
<h6 id="automatic-installation">Automatic Installation</h6>
<ul>
<li>Download <code>VioletBug Setup x.y.z.exe</code> from <a href="https://github.com/belltown/violetbug/releases/latest">https://github.com/belltown/violetbug/releases/latest</a></li>
<li>Download <code>VioletBug.Setup.x.y.z.exe</code> from <a href="https://github.com/belltown/violetbug/releases/latest">https://github.com/belltown/violetbug/releases/latest</a></li>
<li>Run the downloaded file to install VioletBug. It may appear as if nothing&#39;s happening for a minute or so, depending on how your computer is configured. Be patient and the installation should complete, then VioletBug will launch</li>
<li>Pin the VioletBug icon to the Taskbar for convenient access, or use the desktop shortcut icon</li>
<li>You may have to disable your anti-virus protection (unless using only Windows Defender), before downloading and running the installer</li>
Expand All @@ -535,23 +536,24 @@ <h3 id="linux-installation">Linux Installation</h3>
<p>Compiled binaries and installers for various linux distributions are provided at <a href="https://github.com/belltown/violetbug/releases/latest">https://github.com/belltown/violetbug/releases/latest</a></p>
<h6 id="to-download-compiled-binaries-for-most-linux-distributions">To download compiled binaries for most linux distributions</h6>
<p>Download <code>violetbug-linux.zip</code> from <a href="https://github.com/belltown/violetbug/releases/latest">https://github.com/belltown/violetbug/releases/latest</a>, e.g:</p>
<pre class="editor-colors lang-text"><div class="line"><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span>cd&nbsp;~/Downloads</span></span></span></div><div class="line"><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span>wget&nbsp;</span><span class="syntax--markup syntax--underline syntax--link syntax--https syntax--hyperlink"><span>https://github.com/belltown/violetbug/releases/download/vx.y.z/violetbug.zip</span></span></span></span></div></pre><p>Unzip to the appropriate folder, e.g. <code>/opt</code></p>
<pre class="editor-colors lang-text"><div class="line"><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span>sudo&nbsp;unzip&nbsp;-o&nbsp;-q&nbsp;violetbug.zip&nbsp;-d&nbsp;/opt</span></span></span></div></pre><p>Run the application:</p>
<pre class="editor-colors lang-text"><div class="line"><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span>cd&nbsp;~/Downloads</span></span></span></div><div class="line"><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span>wget&nbsp;</span><span class="syntax--markup syntax--underline syntax--link syntax--https syntax--hyperlink"><span>https://github.com/belltown/violetbug/releases/download/vx.y.z/violetbug-linux.zip</span></span></span></span></div></pre><p>Unzip to the appropriate folder, e.g. <code>/opt</code></p>
<pre class="editor-colors lang-text"><div class="line"><span class="syntax--text syntax--plain"><span class="syntax--meta syntax--paragraph syntax--text"><span>sudo&nbsp;unzip&nbsp;-o&nbsp;-q&nbsp;violetbug-linux.zip&nbsp;-d&nbsp;/opt</span></span></span></div></pre><p>Run the application:</p>
<pre class="editor-colors lang-text"><div class="line"><span class="syntax--text syntax--plain"><span>&nbsp;</span><span class="syntax--meta syntax--paragraph syntax--text"><span>/opt/violetbug-linux-x64/violetbug</span></span></span></div></pre><p>Attach to the Launcher for convenience. If you don&#39;t see the application icon, try copying the file <code>/opt/violetbug-linux-x64/resources/app/violetbug.desktop</code> to <code>~/.local/share/applications/violetbug.desktop</code>, editing it if necessary for the correct path name/icon file, etc.</p>
<h6 id="to-download-installers-for-specific-linux-distributions">To download installers for specific linux distributions</h6>
<p>Download one of the following installers:</p>
<ul>
<li>deb package (Ubuntu/Mint/Debian, etc)</li>
<li>rpm package (Fedora/CentOS/Red Hat, etc)</li>
<li>freebsd package (FreeBSD)</li>
<li>AppImage package file (multiple linux distributions)</li>
</ul>
<p>AppImage files should run on any linux distribution that supports <a href="http://appimage.org/">AppImage</a>:</p>
<ul>
<li>Set the file to be executable, e.g: <code>chmod u+x violetbug*.AppImage</code></li>
<li>Run the file, e.g: <code>./violetbug*.AppImage</code></li>
<li>First, download the .AppImage file into any directory from which you can execute applications</li>
<li>Next, <strong>set the file to be executable</strong>, e.g: <code>chmod u+x violetbug*.AppImage</code>, or set executable file property in File Manager GUI</li>
<li>Finally, run the file, e.g: <code>./violetbug*.AppImage</code></li>
<li>All required dependencies and resources are contained in the <code>.AppImage</code> file. Nothing else gets installed. Run the file from any location; delete it to uninstall.</li>
</ul>
<p>BSD variants, such as FreeBSD, are not supported.</p>
<h6 id="linux-dependency-issues">Linux dependency issues</h6>
<p>If you get this error on linux: <strong>error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory</strong>, then install libXScrnSaver, e.g: <code>sudo yum install libXScrnSaver</code>.</p>
<h3 id="firewall-configuration">Firewall Configuration</h3>
Expand All @@ -567,6 +569,6 @@ <h2 id="support">Support</h2>
<p>Contact <a href="https://forums.roku.com/ucp.php?i=pm&amp;mode=compose&amp;u=37784">belltown</a> through the <a href="https://forums.roku.com/viewforum.php?f=34">Roku Forums</a></p>
<p>File a GitHub issue at <a href="https://github.com/belltown/violetbug/issues">https://github.com/belltown/violetbug/issues</a></p>
<h2 id="screenshots">Screenshots</h2>
<p><img src="https://github.com/belltown/violetbug/blob/master/doc/ScreenShotRokus.png" alt="Rokus"></p>
<p><img src="https://github.com/belltown/violetbug/blob/master/doc/ScreenShotConn.png" alt="Connections"></p></body>
<p><img src="https://raw.githubusercontent.com/belltown/violetbug/master/doc/ScreenShotRokus.png" alt="Rokus"></p>
<p><img src="https://raw.githubusercontent.com/belltown/violetbug/master/doc/ScreenShotConn.png" alt="Connections"></p></body>
</html>
1 change: 0 additions & 1 deletion source/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
<select id="connectToPort" name="portComboBox"
tabindex="0">
<option value="8085">8085 (Main Debug)</option>
<option value="8060">8060 (ECP)</option>
<option value="8080">8080 (Genkey)</option>
<option value="8087">8087 (Screensaver)</option>
<option value="8089">8089 (Scene Graph) - not used</option>
Expand Down
28 changes: 26 additions & 2 deletions source/lib/VBConnPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -420,13 +420,21 @@ class VBConnPanel {
this.lastDOMTextNode = null
}

// Clear line context menu commane or Esc key
// Clear line context menu command or Esc key
clearLine() {
this.deviceInputText.value = ''
}

// Cursor to Input context menu command or CTRL/I key
focusInput() {
// Move the keyboard focus to the input field if it's not already there
if (document.activeElement !== this.deviceInputText) {
this.deviceInputText.focus()
}
}

// connPage keydown handler
// This handler is specifically to handle to clear line/clean screen keys
// This handler is specifically to handle to clear line/clear screen keys
// if the cursor is not positioned in the deviceInputText field
// It is attached to the document therefore it is necessary to check
// whether this is the currently displayed tab or not
Expand All @@ -440,6 +448,9 @@ class VBConnPanel {
case VBKeys.ESCAPE:
this.clearLine()
break
case VBKeys.CTRLI:
this.focusInput()
break
}
}
}
Expand Down Expand Up @@ -492,6 +503,14 @@ class VBConnPanel {
this.clearScreen()
break

// No need to listen for ctrl-i (Cursor to Input), because the cursor
// is already focused in the input text field ...

// Check if Cursor to Input (ctrl-i) pressed
//case VBKeys.CTRLI:
// this.focusInput()
// break

// Check for shortcut keys
case VBKeys.CTRL0:
this.insertShortcutText(this.config.shortcutList['Ctrl-0'])
Expand Down Expand Up @@ -610,6 +629,11 @@ class VBConnPanel {
this.clearLine()
}

// Context menu event listener for Cursor to Input
onFocusInput() {
this.focusInput()
}

// Event listener for Auto Scroll checkbox
_onAutoScrollChanged(e, state) {
this.config.autoScroll = state
Expand Down
2 changes: 1 addition & 1 deletion source/lib/VBDiscover.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ function ssdpSearchRequest(discoveryCallback) {
// Listen for SSDP discovery NOTIFY responses
// These should be received whenever a device connects to the network
function ssdpNotify(discoveryCallback) {
let notifySocket = dgram.createSocket('udp4')
let notifySocket = dgram.createSocket({type: 'udp4', reuseAddr: true})

notifySocket.on('message', (msg, rinfo) => {
const ssdpResponse = msg.toString()
Expand Down
3 changes: 3 additions & 0 deletions source/lib/VBDockPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ class VBDockPanel {
this.doConn(connId, 'clearScreen'))
ipcRenderer.on('clearLine', (e, connId) =>
this.doConn(connId, 'clearLine'))
ipcRenderer.on('focusInput', (e, connId) =>
this.doConn(connId, 'focusInput'))

}

Expand Down Expand Up @@ -140,6 +142,7 @@ class VBDockPanel {
case 'reConnect': return conn.onReConnect()
case 'clearScreen': return conn.onClearScreen()
case 'clearLine': return conn.onClearLine()
case 'focusInput': return conn.onFocusInput()
}
}
catch(e) {
Expand Down
2 changes: 2 additions & 0 deletions source/lib/VBFloatPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ class VBFloatPanel {
ipcRenderer.on('unFloatTab', (e, connId) => this.doConn('unFloatTab'))
ipcRenderer.on('clearScreen', (e, connId) => this.doConn('clearScreen'))
ipcRenderer.on('clearLine', (e, connId) => this.doConn('clearLine'))
ipcRenderer.on('focusInput', (e, connId) => this.doConn('focusInput'))

}

Expand All @@ -68,6 +69,7 @@ class VBFloatPanel {
case 'reConnect': return this.conn.onReConnect()
case 'clearScreen': return this.conn.onClearScreen()
case 'clearLine': return this.conn.onClearLine()
case 'focusInput': return this.conn.onFocusInput()
}
}
catch(e) {
Expand Down
4 changes: 3 additions & 1 deletion source/lib/VBKeys.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class VBKeys {
// Keys with modifiers
if (key === 'Tab' && shift && !alt && !ctrl && !meta) return this.SHTAB
if (key === 'KeyC' && !shift && !alt && ctrl && !meta) return this.CTRLC
if (key === 'KeyI' && !shift && !alt && ctrl && !meta) return this.CTRLI
if (key === 'KeyC' && !shift && alt && !ctrl && !meta) return this.ALTC

// Shortcut keys
Expand All @@ -53,7 +54,8 @@ VBKeys.TAB = 7
VBKeys.DEL = 8
VBKeys.SHTAB = 9
VBKeys.CTRLC = 10
VBKeys.ALTC = 11
VBKeys.CTRLI = 11
VBKeys.ALTC = 12
VBKeys.CTRL0 = 20
VBKeys.CTRL1 = 21
VBKeys.CTRL2 = 22
Expand Down
49 changes: 27 additions & 22 deletions source/lib/VBMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class VBMenu {
label: app.getName(),
submenu: [
fileMenu(),
editMenu(),
settingsMenu(),
windowMenu(),
helpMenu()
Expand Down Expand Up @@ -116,6 +117,22 @@ class VBMenu {
}
}

function editMenu() {
return {
label: 'Edit',
submenu: [
{ role: 'undo' },
{ role: 'redo' },
{ type: 'separator' },
{ role: 'cut' },
{ role: 'copy' },
{ role: 'paste' },
{ role: 'delete' },
{ role: 'selectall' },
]
}
}

function settingsMenu() {
return {
label: 'Settings',
Expand Down Expand Up @@ -372,6 +389,9 @@ class VBMenu {
template.push(fileMenu())

// [2] ...
template.push(editMenu())

// [3] ...
template.push(settingsMenu())

// [3] ...
Expand All @@ -387,11 +407,11 @@ class VBMenu {
// Keep in sync with the above code at the end of createAppMenu()
static settingsMenuIndex() {
if (VBMenu.platform() === 'darwin' || VBMenu.platform() === 'linux') {
return 2
return 3
}
else {
// win32 does not have the initial "VioletBug" menu
return 1
return 2
}
}

Expand Down Expand Up @@ -586,27 +606,12 @@ class VBMenu {
}))
index++

menu.append(new MenuItem({type: 'separator'}))
index++

menu.append(new MenuItem({
label: 'Cut',
accelerator: 'CmdOrCtrl+X',
role: 'cut'
}))
index++

menu.append(new MenuItem({
label: 'Copy',
accelerator: 'CmdOrCtrl+C',
role: 'copy'
}))
index++

menu.append(new MenuItem({
label: 'Paste',
accelerator: 'CmdOrCtrl+V',
role: 'paste'
label: 'Cursor to Input',
accelerator: 'CmdOrCtrl+I',
click(menuItem, browserWindow, event) {
browserWindow.webContents.send('focusInput', connId)
}
}))
index++

Expand Down
Loading

0 comments on commit d58c810

Please sign in to comment.