Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
zbarbuto committed Jul 29, 2021
0 parents commit 65d086c
Show file tree
Hide file tree
Showing 12 changed files with 2,520 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"rules": {
"semi": "error",
"quotes": "error"
}
}
28 changes: 28 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build / Release

on: push

jobs:
release:
runs-on: ${{ matrix.os }}

strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- run: npm install
- name: Build/release Electron app
uses: samuelmeuli/action-electron-builder@v1
with:
# GitHub token, automatically provided to the action
# (No need to define this secret in the repo settings)
github_token: ${{ secrets.github_token }}

# If the commit is tagged with a version (e.g. "v1.0.0"),
# release the app after building
release: ${{ startsWith(github.ref, 'refs/tags/v') }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
dist/
5 changes: 5 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"tabWidth": 2,
"semi": true,
"singleQuote": true
}
20 changes: 20 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Copyright (c) Zak Barbuto

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<center>

# TREMOR

<img src="icon/icon.png" width="150">

### A quake-style drop-down browser you can open from anywhere

## FAQ

### Why?

Because I wanted one and couldn't find one

### How?

Launch the app ``then CTRL+ALT+` `` to summon browser. Note, it opens on the monitor your cursor is on.

### Can it use my normal chrome profile?

Probably but I don't know how yet

### Can it open an address bar instead of google search by default?

Yes, I'll do it later. I made this in 30 minutes so didn't really put much thought into features.

### "Tremor"?

Quake -> Earthquake -> Tremors.... I dunno, you name it!

</center>
Binary file added icon/icon.ico
Binary file not shown.
Binary file added icon/icon.kra
Binary file not shown.
Binary file added icon/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 92 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
const {
app,
BrowserWindow,
Tray,
globalShortcut,
screen,
Menu,
nativeImage,
} = require('electron');
const { join } = require('path');

let hasWin = false;

function createWindow() {
const electronScreen = screen;
const { x, y } = screen.getCursorScreenPoint();
// Find the display where the mouse cursor will be
// const currentDisplay = screen.getDisplayNearestPoint({ x, y });

const displays = electronScreen.getAllDisplays();
const currentDisplay = screen.getDisplayNearestPoint({ x, y });
const size = currentDisplay.workAreaSize;

let win = new BrowserWindow({
x: currentDisplay.bounds.x,
y: 0,
frame: false,
width: size.width,
height: size.height / 3,
});

win.loadURL('https://www.google.com');

// Emitted when the window is closed.
win.on('closed', (e) => {
// Dereference the window object, usually you would store window
// in an array if your app supports multi windows, this is the time
// when you should delete the corresponding element.
// win = null;
hasWin = false;
win = null;

// Don't exit electron
e.preventDefault();
});

return win;
}

app.whenReady().then(() => {
let win;
const ret = globalShortcut.register('Alt+Ctrl+`', () => {
if (!hasWin) {
win = createWindow();
hasWin = true;
} else {
win.close();
}
});

const contextMenu = Menu.buildFromTemplate([
{
label: 'Exit',
enabled: true,
click: () => {
app.quit();
},
},
]);

tray = new Tray(
nativeImage
.createFromPath(
join(
__dirname,
'icon',
process.platform === 'win32' ? 'icon.ico' : 'icon.png'
)
)
.resize(
process.platform === 'darwin'
? { width: 16, height: 16 }
: { width: 128, height: 128 }
)
);
tray.setToolTip('Tremor');
tray.setContextMenu(contextMenu);
});

app.on('window-all-closed', () => {
// do nothing - otherwise electron exits
});
Loading

0 comments on commit 65d086c

Please sign in to comment.