Skip to content

Commit

Permalink
Done for the next release v0.3, with a « about window » and more sounds.
Browse files Browse the repository at this point in the history
  • Loading branch information
Naereen committed Aug 23, 2017
1 parent d1ae7f1 commit 3e5f803
Show file tree
Hide file tree
Showing 4 changed files with 94 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Kaamelott-Soundboard.desktop
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
[Desktop Entry]
Name=Kaamelott Soundbard
Comment=Kaamelott Soundbard desktop app
Exec=/home/lilian/.local/kaamelott-soundboard-linux-x64/kaamelott-soundboard
Exec=/home/lilian/.local/kaamelott-soundboard-desktop-app-linux-x64/kaamelott-soundboard-desktop-app
Icon=/home/lilian/.local/share/applications/kaamelott-soundboard.jpg
Terminal=false
Type=Application
InitialPreference=6
TryExec=/home/lilian/.local/kaamelott-soundboard-linux-x64/kaamelott-soundboard
TryExec=/home/lilian/.local/kaamelott-soundboard-desktop-app-linux-x64/kaamelott-soundboard-desktop-app
9 changes: 5 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ localtest: install_bower
npm start

test:
./kaamelott-soundboard-linux-x64/kaamelott-soundboard
./kaamelott-soundboard-desktop-app-linux-x64/kaamelott-soundboard-desktop-app

test_app:
kaamelott-soundboard
kaamelott-soundboard-desktop-app


# Installers for dependencies
Expand All @@ -43,8 +43,8 @@ install_bower:
# Installer for the app
install_app:
cp -vf ./img/ks.jpg ~/.local/share/applications/kaamelott-soundboard.jpg
cp -rvf ./kaamelott-soundboard-linux-x64 ~/.local/share/
ln -fs ~/.local/share/kaamelott-soundboard-linux-x64/kaamelott-soundboard ~/.local/bin/
cp -rvf ./kaamelott-soundboard-desktop-app-linux-x64 ~/.local/share/
ln -fs ~/.local/share/kaamelott-soundboard-desktop-app-linux-x64/kaamelott-soundboard-desktop-app ~/.local/bin/

validate_desktop_app:
desktop-file-validate Kaamelott-Soundboard.desktop
Expand All @@ -64,6 +64,7 @@ clean_node:

clean_app:
rm -rfv ./kaamelott-soundboard-linux-x64
rm -rfv ./kaamelott-soundboard-desktop-app-linux-x64

clean_bower:
rm -rfv ./js/bower_components
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ <h1>Kaamelott Soundboard</h1>
</body>

<center>
Application bureau faite avec <a href="https://github.com/electron-userland/electron-packager">electron-packager</a> par <a href="https://github.com/Naereen">@Naereen</a>.
Application bureau faite avec <a href="https://github.com/electron-userland/electron-packager">electron-packager</a> par <a href="https://github.com/Naereen">@Naereen</a>, © 2017.
</center>
</html>
90 changes: 86 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
// https://youtu.be/-Lu7ztlgx48?t=588
console.log("Starting my kaamelott-soundboard Electron application...");

const { app, BrowserWindow } = require('electron');
const electron = require('electron');
const app = electron.app;
const Menu = electron.Menu;
const BrowserWindow = electron.BrowserWindow;

const openAboutWindow = require('about-window').default;

const shell = electron.shell;

// Quit when all windows are closed.
app.on('window-all-closed', function() {
Expand All @@ -12,13 +19,88 @@ app.on('window-all-closed', function() {
}
});

// Main function
app.on('ready', () => {
console.log("App is ready... Opening a BrowserWindow...");
let mainWindow = new BrowserWindow(
autoHideMenuBar="false"
);
let mainWindow = new BrowserWindow({
icon: `${__dirname}/img/ks.jpg`,
autoHideMenuBar: false,
center: true
});

mainWindow.once("closed", function() {
mainWindow = null;
});

mainWindow.webContents.on('new-window', (event, url) => {
// stop Electron from opening another BrowserWindow
event.preventDefault()
// open the url in the default system browser
shell.openExternal(url)
});
mainWindow.webContents.on('will-navigate', (event, url) => {
// stop Electron from opening another BrowserWindow
event.preventDefault()
// open the url in the default system browser
shell.openExternal(url)
});

// mainWindow.loadURL("http://monip.org/"); // DEBUG
console.log("Opening", `file://${__dirname}/index.html`, "in a new window...");
mainWindow.loadURL(`file://${__dirname}/index.html`);

const menu = Menu.buildFromTemplate([
{
label: "Version web",
submenu: [
{
label: "Ouvrir l'application web",
click: () => shell.openExternal("http://kaamelott-soundboard.2ec0b4.fr/")
}
]
},
{
label: "Sources ?",
submenu: [
{
label: "Voir les sources de la version bureau",
click: () => shell.openExternal("https://github.com/Naereen/kaamelott-soundboard-desktop-app/")
},
{
label: "Voir les sources de la version web",
click: () => shell.openExternal("https://github.com/2ec0b4/kaamelott-soundboard/")
}
]
},
{
label: "À propos",
submenu: [
{
label: "À propos de cette application bureau",
click: () => openAboutWindow({
icon_path: `${__dirname}/img/ks.jpg`,
copyright: "Copyright © 2017 Lilian Besson (Naereen) and Antoine (2ec0b4) and collaborators",
homepage: "https://github.com/Naereen/kaamelott-soundboard-desktop-app/",
license: "No License",
bug_report_url: "https://github.com/Naereen/kaamelott-soundboard-desktop-app/issues/new",
description: "💻 📢 Application bureau sur Ubuntu, Windows et Mac OS X pour la soundboard de Kaamelott 🎶.\n« Alors, c'est classe ou c'est pas classe ? Ou c'est classe ? »\n« Putain il est fort ce con ! » me souffle-t-on.\nCette application est testée et développée sous GNU/Linux (Ubuntu 17.04) mais elle marche aussi bien sur Mac OS X, et sur Windows.",
adjust_window_size: true
})
},
{
label: "À propos de l'application web",
click: () => openAboutWindow({
icon_path: `${__dirname}/img/ks.jpg`,
copyright: "Copyright © 2016-17 Antoine (2ec0b4) and collaborators",
homepage: "https://github.com/2ec0b4/kaamelott-soundboard/",
license: "No License",
bug_report_url: "https://github.com/2ec0b4/kaamelott-soundboard//issues/new",
description: "💻 📢 Application web pour la soundboard de Kaamelott 🎶.\nAlors, j'ai fait deux fois le tour des Internets pour être sûr, eh ben croyez-moi, croyez-moi pas, je n'ai pas trouvé de plateforme regroupant des répliques sonores de Kaamelott.\nLorem ipsum dolor sit amet. Voilà. Et bien ça, par exemple, ça veut absolument rien dire. Et puis ce n'est pas une réplique de Kaamelott. Du coup vous ne pourrez pas l'écouter. Mais vous pouvez toujours proposer d'autres sons en contribuant à ce dépôt en proposant une fusiodemande.\nAlors, c'est classe ou c'est pas classe ? Ou c'est classe ?",
adjust_window_size: true
})
}
]
}
]);
Menu.setApplicationMenu(menu);
})

0 comments on commit 3e5f803

Please sign in to comment.