Skip to content

Commit

Permalink
The 'Big Bang'
Browse files Browse the repository at this point in the history
  • Loading branch information
Mastermindzh committed Sep 16, 2019
0 parents commit cbf1596
Show file tree
Hide file tree
Showing 7 changed files with 1,454 additions and 0 deletions.
53 changes: 53 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
root = true

[*]
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[**.js]
indent_style = space
indent_size = 2

[**.json]
indent_style = space
indent_size = 2

[**.css]
indent_style = space
indent_size = 2

[**.scss]
indent_style = space
indent_size = 2

[**.html]
indent_style = space
indent_size = 2

[**.jsx]
indent_style = space
indent_size = 2

[src/**.{h,cc}]
indent_style = space
indent_size = 2

[configure]
indent_style = space
indent_size = 2

[Makefile]
indent_style = tab
indent_size = 8

[{deps,tools}/**]
indent_style = ignore
indent_size = ignore
end_of_line = ignore
trim_trailing_whitespace = ignore
charset = ignore

[{test/fixtures,deps,tools/eslint,tools/gyp,tools/icu,tools/msvs}/**]
insert_final_newline = false
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# tidal-hifi-electron

The web version of [listen.tidal.com](listen.tidal.com) running in electron with hifi support thanks to widevine.

<!-- toc -->

- [Why](#why)
- [Requirements](#requirements)
- [Integrations](#integrations)

<!-- tocstop -->

## Why

When I started this project there weren't any Linux apps that offered Tidal's "hifi" options nor any scripts to control it.

## Requirements

- Internet connection

## Integrations

- [i3 blocks config]() - My dotfiles where I use this app to fetch currently playing music
61 changes: 61 additions & 0 deletions main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
const { app, globalShortcut, BrowserWindow, process } = require("electron");
const path = require("path");
const tidalUrl = "https://listen.tidal.com";
let mainWindow;

/**
* Enable live reload in development builds
*/
require("electron-reload")(__dirname, {
electron: require(`${__dirname}/node_modules/electron`),
});

function createWindow(options = {}) {
// Create the browser window.
mainWindow = new BrowserWindow({
x: options.x,
y: options.y,
width: 1024,
height: 800,
backgroundColor: options.backgroundColor,
webPreferences: {
affinity: "window",
preload: path.join(__dirname, "preload.js"),
plugins: true,
},
});

// load the Tidal website
mainWindow.loadURL(tidalUrl);

// run stuff after first load
mainWindow.webContents.once("did-finish-load", () => {});

// Emitted when the window is closed.
mainWindow.on("closed", function() {
mainWindow = null;
});
}

function addGlobalShortcuts() {
globalShortcut.register("Control+A", () => {
mainWindow.webContents.send("getPlayInfo");
});
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on("ready", () => {
// window with white backround
createWindow();
addGlobalShortcuts();
});

app.on("activate", function() {
// On OS X it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (mainWindow === null) {
createWindow();
}
});
Loading

0 comments on commit cbf1596

Please sign in to comment.