Skip to content

Commit b555ff3

Browse files
authored
Merge pull request #122 from CodeF0x/prelive
Complete rewrite + Violin v3.0
2 parents a9f8f90 + 5b3351e commit b555ff3

26 files changed

Lines changed: 1608 additions & 2744 deletions

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ src/img/icons/*-backup.*
77
.idea/*
88
dist/*
99
!dist/package.json
10-
!dist/package-lock.json
10+
!dist/package-lock.json
11+
Violin.md

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<a href="https://snapcraft.io/violin-player">
44
<img alt="Violin" src="https://snapcraft.io/violin-player/badge.svg" />
55
</a>
6-
<img alt="Application size" src="https://img.shields.io/badge/application%20size%3A-%3C%20150%20MB-yellow.svg">
6+
<img alt="Application size" src="https://img.shields.io/badge/application%20size:-%3C%20160%20MB-yellow.svg">
77
<img alt="Supported platforms" src="https://img.shields.io/badge/runs%20on%3A-windows%20|%20linux%20|%20osx-blue.svg">
88
<a href="https://www.codacy.com/app/CodeF0x/violin?utm_source=github.com&utm_medium=referral&utm_content=CodeF0x/violin&utm_campaign=Badge_Grade">
99
<img alt="Codacy Code Grade" src="https://api.codacy.com/project/badge/Grade/7549990eb1954df9858c27b21bf0f8ed">
@@ -54,6 +54,10 @@ Give a ⭐️ if this project helped you!
5454
Copyright © 2019 [Tobias Oettl](https://github.com/CodeF0x).<br />
5555
This project is [MIT](https://github.com/CodeF0x/violin/blob/master/LICENSE) licensed.
5656

57+
<img src="src/img/icons/icon.png" width="100">
58+
59+
[Icon by Zaryab213.](https://www.fiverr.com/zaryab213)
60+
5761
---
5862

5963
_This README was generated with ❤️ by [readme-md-generator](https://github.com/kefranabg/readme-md-generator)_

dist/package-lock.json

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

dist/package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "violin-player",
33
"productName": "Violin",
4-
"version": "2.2.1",
4+
"version": "3.0.0",
55
"description": "A fast, lightweight, and minimalistic desktop music player.",
66
"homepage": "https://violin-player.cc/",
77
"keywords": [
@@ -32,12 +32,14 @@
3232
},
3333
"main": "main.js",
3434
"devDependencies": {
35-
"electron": "^4.0.7",
3635
"gulp": "^4.0.2",
3736
"gulp-clean-css": "^4.2.0",
3837
"gulp-terser": "^1.2.0"
3938
},
4039
"dependencies": {
41-
"jsmediatags": "^3.8.1"
40+
"custom-electron-titlebar": "^3.1.0",
41+
"jsmediatags": "^3.8.1",
42+
"electron-is-dev": "^1.1.0",
43+
"rgbaster": "^2.1.1"
4244
}
4345
}

docs/assets/screenshot.png

-11.8 KB
Loading

docs/assets/sreenshot-colorful.png

193 KB
Loading

docs/index.html

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,58 @@
2424
Violin -- a fast, lightweight, and minimalistic desktop music player
2525
</title>
2626
</head>
27+
<style>
28+
.github-corner:hover .octo-arm {
29+
animation: octocat-wave 560ms ease-in-out;
30+
}
31+
@keyframes octocat-wave {
32+
0%,
33+
100% {
34+
transform: rotate(0);
35+
}
36+
20%,
37+
60% {
38+
transform: rotate(-25deg);
39+
}
40+
40%,
41+
80% {
42+
transform: rotate(10deg);
43+
}
44+
}
45+
@media (max-width: 500px) {
46+
.github-corner:hover .octo-arm {
47+
animation: none;
48+
}
49+
.github-corner .octo-arm {
50+
animation: octocat-wave 560ms ease-in-out;
51+
}
52+
}
53+
</style>
2754
<body>
55+
<a
56+
href="https://github.com/CodeF0x/violin"
57+
class="github-corner"
58+
aria-label="View source on GitHub"
59+
><svg
60+
width="80"
61+
height="80"
62+
viewBox="0 0 250 250"
63+
style="fill:#151513; color:#fff; position: absolute; top: 0; border: 0; right: 0;"
64+
aria-hidden="true"
65+
>
66+
<path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path>
67+
<path
68+
d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2"
69+
fill="currentColor"
70+
style="transform-origin: 130px 106px;"
71+
class="octo-arm"
72+
></path>
73+
<path
74+
d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z"
75+
fill="currentColor"
76+
class="octo-body"
77+
></path></svg
78+
></a>
2879
<section class="first-card">
2980
<div class="firstcard__con-left">
3081
<h1>Violin</h1>

gulpfile.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ gulp.task('copy', () => {
99
'src/**/*',
1010
'!**/img/icons',
1111
'!**/img/icons/**/*',
12+
'**/img/icons/icon.png',
1213
'modules/**/*'
1314
];
1415
return gulp.src(filesToMove, { base: './' }).pipe(gulp.dest('dist'));
@@ -39,19 +40,7 @@ gulp.task('minify-css', () => {
3940
});
4041

4142
gulp.task('build', cb => {
42-
exec('electron-builder --mac', (error, stdout, stderr) => {
43-
console.log(stdout);
44-
console.log(stderr);
45-
cb(error);
46-
});
47-
48-
exec('electron-builder --linux', (error, stdout, stderr) => {
49-
console.log(stdout);
50-
console.log(stderr);
51-
cb(error);
52-
});
53-
54-
exec('electron-builder --windows', (error, stdout, stderr) => {
43+
exec('electron-builder --mac --linux --win', (error, stdout, stderr) => {
5544
console.log(stdout);
5645
console.log(stderr);
5746
cb(error);

main.js

Lines changed: 57 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,65 @@
1-
const {
2-
app,
3-
BrowserWindow,
4-
globalShortcut,
5-
systemPreferences,
6-
Notification
7-
} = require('electron');
1+
(function() {
2+
const { app, BrowserWindow, globalShortcut } = require('electron');
83

9-
const { dialog, ipcMain } = require('electron');
10-
const openDirectory = require('./modules/open-directory');
11-
let window = null;
4+
const { dialog, ipcMain } = require('electron');
5+
const openDirectory = require('./modules/open-directory');
6+
let window = null;
127

13-
function createWindow() {
14-
window = new BrowserWindow({
15-
width: 800,
16-
minWidth: 800,
17-
height: 600,
18-
minHeight: 600,
19-
titleBarStyle: 'hiddenInset',
20-
useContentSize: false,
21-
webPreferences: {
22-
nodeIntegration: true
23-
}
24-
});
8+
function createWindow() {
9+
window = new BrowserWindow({
10+
width: 800,
11+
minWidth: 800,
12+
height: 600,
13+
minHeight: 600,
14+
titleBarStyle: 'hidden',
15+
frame: false,
16+
useContentSize: false,
17+
webPreferences: {
18+
nodeIntegration: true
19+
}
20+
});
2521

26-
window.setResizable(true);
27-
window.loadFile('src/index.html');
28-
}
22+
window.setResizable(true);
23+
window.loadFile('src/index.html');
24+
}
2925

30-
ipcMain.on('open-file-dialog', (event, path) => {
31-
dialog.showOpenDialog(
32-
window,
33-
{
34-
properties: ['openDirectory']
35-
},
36-
filePaths => {
37-
if (filePaths) {
38-
openDirectory(filePaths, event);
39-
}
40-
}
41-
);
42-
});
26+
ipcMain.on('open-file-dialog', event => {
27+
dialog
28+
.showOpenDialog(window, {
29+
properties: ['openDirectory']
30+
})
31+
.then(contents => {
32+
const files = contents.filePaths;
33+
if (files.length > 0) {
34+
openDirectory(files, event);
35+
}
36+
})
37+
.catch(err => {
38+
console.error(err);
39+
});
40+
});
4341

44-
app.on('ready', () => {
45-
function registerShortcuts() {
46-
if (process.platform === 'darwin') {
47-
if (!systemPreferences.isTrustedAccessibilityClient(true)) {
48-
const not = new Notification({
49-
title: 'Violin',
50-
body:
51-
'Please add Violin as a trusted client, then click on this message or restart Violin.'
52-
});
53-
not.on('click', () => {
54-
app.relaunch();
55-
app.quit();
56-
});
57-
not.show();
58-
}
59-
}
60-
// TODO find a smoother way to register shortcuts
61-
globalShortcut.register('MediaPlayPause', () => {
62-
window.webContents.send('shortcut', 'MediaPlayPause');
63-
});
42+
app.on('ready', () => {
43+
function registerShortcuts() {
44+
// TODO find a smoother way to register shortcuts
45+
globalShortcut.register('MediaPlayPause', () => {
46+
window.webContents.send('shortcut', 'MediaPlayPause');
47+
});
6448

65-
globalShortcut.register('MediaNextTrack', () => {
66-
window.webContents.send('shortcut', 'MediaNextTrack');
67-
});
49+
globalShortcut.register('MediaNextTrack', () => {
50+
window.webContents.send('shortcut', 'MediaNextTrack');
51+
});
6852

69-
globalShortcut.register('MediaPreviousTrack', () => {
70-
window.webContents.send('shortcut', 'MediaPreviousTrack');
71-
});
72-
}
73-
createWindow();
74-
registerShortcuts();
75-
});
53+
globalShortcut.register('MediaPreviousTrack', () => {
54+
window.webContents.send('shortcut', 'MediaPreviousTrack');
55+
});
56+
}
57+
createWindow();
58+
registerShortcuts();
59+
});
7660

77-
app.on('window-all-closed', () => {
78-
globalShortcut.unregisterAll();
79-
app.quit();
80-
});
61+
app.on('window-all-closed', () => {
62+
globalShortcut.unregisterAll();
63+
app.quit();
64+
});
65+
})();

package-lock.json

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

0 commit comments

Comments
 (0)