Skip to content

Commit 6458460

Browse files
committed
initial commit
1 parent 4680fff commit 6458460

23 files changed

+16849
-238
lines changed

.eslintrc.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ module.exports = {
33
env: {
44
node: true
55
},
6+
globals: {
7+
'__static': true
8+
},
69
extends: ["plugin:vue/essential", "@vue/prettier"],
710
rules: {
11+
"quotes": [2, "single", { "avoidEscape": true }],
812
"no-console": process.env.NODE_ENV === "production" ? "error" : "off",
9-
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off"
13+
"no-debugger": process.env.NODE_ENV === "production" ? "error" : "off",
14+
"no-unused-vars": ["error", { "argsIgnorePattern": "^_" }]
1015
},
1116
parserOptions: {
1217
parser: "babel-eslint"

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,6 @@ yarn-error.log*
1919
*.njsproj
2020
*.sln
2121
*.sw*
22+
23+
#Electron-builder output
24+
/dist_electron

.prettierrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"singleQuote": true,
3+
"arrowParens": "always"
4+
}

package-lock.json

Lines changed: 14072 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,24 +5,38 @@
55
"scripts": {
66
"serve": "vue-cli-service serve",
77
"build": "vue-cli-service build",
8-
"lint": "vue-cli-service lint"
8+
"lint": "vue-cli-service lint",
9+
"electron:build": "vue-cli-service electron:build",
10+
"electron:serve": "vue-cli-service electron:serve",
11+
"postinstall": "electron-builder install-app-deps",
12+
"postuninstall": "electron-builder install-app-deps"
913
},
14+
"main": "background.js",
1015
"dependencies": {
16+
"run-applescript": "^3.2.0",
1117
"vue": "^2.6.6",
1218
"vue-router": "^3.0.1",
13-
"vuex": "^3.0.1"
19+
"vuetify": "^1.5.5",
20+
"vuex": "^3.0.1",
21+
"winreg": "^1.2.4"
1422
},
1523
"devDependencies": {
1624
"@vue/cli-plugin-babel": "^3.5.0",
1725
"@vue/cli-plugin-eslint": "^3.5.0",
1826
"@vue/cli-service": "^3.5.0",
1927
"@vue/eslint-config-prettier": "^4.0.1",
2028
"babel-eslint": "^10.0.1",
29+
"electron": "^4.0.0",
2130
"eslint": "^5.8.0",
2231
"eslint-plugin-vue": "^5.0.0",
2332
"fibers": "^3.1.1",
2433
"sass": "^1.17.2",
2534
"sass-loader": "^7.1.0",
26-
"vue-template-compiler": "^2.5.21"
35+
"stylus": "^0.54.5",
36+
"stylus-loader": "^3.0.1",
37+
"vue-cli-plugin-electron-builder": "^1.1.1",
38+
"vue-cli-plugin-vuetify": "^0.5.0",
39+
"vue-template-compiler": "^2.5.21",
40+
"vuetify-loader": "^1.0.5"
2741
}
2842
}

public/index.html

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
<meta name="viewport" content="width=device-width,initial-scale=1.0">
77
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
88
<title>universal-np-2</title>
9+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
10+
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons">
911
</head>
1012
<body>
1113
<noscript>
18.3 KB
Binary file not shown.
9.07 KB
Binary file not shown.

src/App.vue

Lines changed: 70 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,75 @@
11
<template>
2-
<div id="app">
3-
<div id="nav">
4-
<router-link to="/">Home</router-link> |
5-
<router-link to="/about">About</router-link>
6-
</div>
7-
<router-view />
8-
</div>
2+
<v-app id="inspire" dark>
3+
<v-navigation-drawer v-model="drawer" clipped fixed app>
4+
<v-list dense>
5+
<v-list-tile @click="noop">
6+
<v-list-tile-action>
7+
<v-icon>dashboard</v-icon>
8+
</v-list-tile-action>
9+
<v-list-tile-content>
10+
<v-list-tile-title>Dashboard</v-list-tile-title>
11+
</v-list-tile-content>
12+
</v-list-tile>
13+
<v-list-tile @click="noop">
14+
<v-list-tile-action>
15+
<v-icon>settings</v-icon>
16+
</v-list-tile-action>
17+
<v-list-tile-content>
18+
<v-list-tile-title>Settings</v-list-tile-title>
19+
</v-list-tile-content>
20+
</v-list-tile>
21+
</v-list>
22+
</v-navigation-drawer>
23+
<v-toolbar app fixed clipped-left>
24+
<v-toolbar-side-icon @click.stop="drawer = !drawer"></v-toolbar-side-icon>
25+
<v-toolbar-title>Universal Now Playing</v-toolbar-title>
26+
</v-toolbar>
27+
<v-content>
28+
<v-container fluid fill-height>
29+
<v-layout justify-center align-center>
30+
<v-flex shrink>
31+
<router-view />
32+
</v-flex>
33+
</v-layout>
34+
</v-container>
35+
</v-content>
36+
<v-footer app fixed>
37+
<span>&copy; 2017</span>
38+
</v-footer>
39+
</v-app>
940
</template>
1041

11-
<style lang="scss">
12-
#app {
13-
font-family: "Avenir", Helvetica, Arial, sans-serif;
14-
-webkit-font-smoothing: antialiased;
15-
-moz-osx-font-smoothing: grayscale;
16-
text-align: center;
17-
color: #2c3e50;
18-
}
19-
#nav {
20-
padding: 30px;
21-
a {
22-
font-weight: bold;
23-
color: #2c3e50;
24-
&.router-link-exact-active {
25-
color: #42b983;
26-
}
42+
<script>
43+
// import runApplescript from 'run-applescript';
44+
import { mapActions } from 'vuex';
45+
import { copyNativeExecutable } from './util';
46+
47+
// const checkAppRunning = async (appName) => {
48+
// return await runApplescript(`
49+
// if application "${appName}" is running then
50+
// return true
51+
// end if
52+
// return false
53+
// `);
54+
// };
55+
56+
export default {
57+
name: 'universal-np',
58+
data: () => ({
59+
drawer: null,
60+
source: null
61+
}),
62+
methods: {
63+
noop() {},
64+
...mapActions('now-playing', ['setTrack', 'setPlayer'])
65+
},
66+
async mounted() {
67+
console.log(__static);
68+
await copyNativeExecutable();
2769
}
28-
}
70+
};
71+
</script>
72+
73+
<style>
74+
/* CSS */
2975
</style>

src/assets/logo.svg

Lines changed: 1 addition & 0 deletions
Loading

src/background.js

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
'use strict';
2+
3+
import { app, protocol, BrowserWindow } from 'electron';
4+
import {
5+
createProtocol,
6+
installVueDevtools
7+
} from 'vue-cli-plugin-electron-builder/lib';
8+
const isDevelopment = process.env.NODE_ENV !== 'production';
9+
10+
// Keep a global reference of the window object, if you don't, the window will
11+
// be closed automatically when the JavaScript object is garbage collected.
12+
let win;
13+
14+
// Standard scheme must be registered before the app is ready
15+
protocol.registerStandardSchemes(['app'], { secure: true });
16+
function createWindow() {
17+
// Create the browser window.
18+
win = new BrowserWindow({ width: 800, height: 600 });
19+
20+
if (process.env.WEBPACK_DEV_SERVER_URL) {
21+
// Load the url of the dev server if in development mode
22+
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL);
23+
if (!process.env.IS_TEST) win.webContents.openDevTools();
24+
} else {
25+
createProtocol('app');
26+
// Load the index.html when not in development
27+
win.loadURL('app://./index.html');
28+
}
29+
30+
win.on('closed', () => {
31+
win = null;
32+
});
33+
}
34+
35+
// Quit when all windows are closed.
36+
app.on('window-all-closed', () => {
37+
// On macOS it is common for applications and their menu bar
38+
// to stay active until the user quits explicitly with Cmd + Q
39+
if (process.platform !== 'darwin') {
40+
app.quit();
41+
}
42+
});
43+
44+
app.on('activate', () => {
45+
// On macOS it's common to re-create a window in the app when the
46+
// dock icon is clicked and there are no other windows open.
47+
if (win === null) {
48+
createWindow();
49+
}
50+
});
51+
52+
// This method will be called when Electron has finished
53+
// initialization and is ready to create browser windows.
54+
// Some APIs can only be used after this event occurs.
55+
app.on('ready', async () => {
56+
if (isDevelopment && !process.env.IS_TEST) {
57+
// Install Vue Devtools
58+
try {
59+
await installVueDevtools();
60+
} catch (e) {
61+
console.error('Vue Devtools failed to install:', e.toString());
62+
}
63+
}
64+
createWindow();
65+
});
66+
67+
// Exit cleanly on request from parent process in development mode.
68+
if (isDevelopment) {
69+
if (process.platform === 'win32') {
70+
process.on('message', (data) => {
71+
if (data === 'graceful-exit') {
72+
app.quit();
73+
}
74+
});
75+
} else {
76+
process.on('SIGTERM', () => {
77+
app.quit();
78+
});
79+
}
80+
}

0 commit comments

Comments
 (0)