Skip to content

Developer Documentation

Alexander Frick edited this page Mar 28, 2023 · 1 revision

Interacting with our electron-store instance

From the Main Process

app.cfg.get(item[, defaultValue]) [Function]

  • item String - The value you want to get from the config
  • defaultValue Bool (Optional) - Gets the default value of an item if the config doesn't exist

Fetches a value from the configuration.


app.cfg.set(key, value) [Function]

  • key String - The configuration value you are aiming to change (I.e. general.discordRPC)
  • value Any - The value you wish to set the config value to. (Must be JSON serializable)

Sets a value from the electron-store configuration.


app.cfg.store [Function]

Fetches the entire electron-store configuration


Read more about what you can do by reading the electron-store documentation.

From the Renderer Process

ipcRenderer.invoke('getStoreValue', item[, defaultValue]) [Function]

  • item String - The value you want to get from the config
  • defaultValue Bool (Optional) - Gets the default value of an item if the config doesn't exist

Fetches a value from the configuration.


ipcRenderer.invoke('setStoreValue', key, value) [Function]

  • key String - The configuration value you are aiming to change (I.e. general.discordRPC)
  • value Any - The value you wish to set the config value to. (Must be JSON serializable)

Sets a configuration value


ipcRenderer.sendSync('getStore') [Function]

Fetches the entire electron-store configuration.


ipcRenderer.sendSync('setStore', store) [Function]

  • store Object - The updated store that you want to set the electron-store configuration to

Custom Plugins on Apple Music Electron

AMEPluginHelper Class Documentation

Start [Event Handler]

Executes once the application and web player has finished loading.


OnNavigation [Event Handler]

Executes when the user navigates different pages of the application or opens context menus.


OnPlaybackStateChanged [Event Handler]

  • status Bool - Playback state, play/pause represented as true/false respectively.
  • name String - Current song name.
  • artwork Object - Contains width, height and url of artwork.
  • playParams Object - Contains the id and kind of media playing.
  • albumName String - Current album name.
  • artistName String - Current song's artist.
  • genreNames Array - Array of Genres of this song.
  • remainingTime Integer - Playback time remaining on current song.
  • durrationInMillis Integer - Duration of the song in milliseconds.
  • startTime Integer - The time in milliseconds (since the UNIX epoch) that the current song started.
  • endTime Integer - The time in milliseconds (since the UNIX epoch) that the current song is expected to end.

Executes when the playback state has changed (new song, play/pause, etc). This event is sent the current playback state attributes. Run MusicKit.getInstance().nowPlayingItem.attributes in the renderer console whilst playing a song to view this object.

OnPlaybackStateChanged(args = {Attributes: null})

OnHide [Event Handler]

Executes when the app is hidden by the user


AddMenuItem(Text, OnClick) [Function]

  • Text String - Your menu item entry text.
  • OnClick Function - The onclick function, sends back the event to your function if defined.

Adds a menu item entry to the 👤 Profile menu

this.AddMenuItem({ Text: "My Text", OnClick: ()=>{ alert("Hello world!") } })
ipcRenderer Messages

We will only document the mainly useful ipcMessages, if you want to know all the ipcMessages that we use, see handler.js


ipcRenderer.send("minimize") [Function]

Minimizes the application.


ipcRenderer.send("maximize") [Function]

Maximizes the application.


ipcRenderer.send("back") [Function]

Navigate back a page.


ipcRenderer.send("resize-window", width, height) [Function]

  • width Integer - Pixels for width.
  • heigh Integer - Pixels for height.

Resize the window.


ipcRenderer.send("set-miniplayer", state) [Function]

  • state Bool - State of the miniplayer

ipcRenderer.send("alwaysOnTop", state) [Function]

  • state Bool - If you want alwaysOnTop disabled/enabled.

ipcRenderer.send("close") [Function]

Close the application.

Clone this wiki locally