Skip to content

Commit

Permalink
Merge pull request #3 from owenrumney/feature/2-add-actions
Browse files Browse the repository at this point in the history
feat: adding actions so key mappings can be applied
  • Loading branch information
KikiManjaro authored Jul 8, 2023
2 parents 31933ca + a56224c commit df6b1b0
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package com.github.kikimanjaro.intellify.actions

import com.github.kikimanjaro.intellify.services.SpotifyService
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent

class TogglePlayPauseAction : AnAction() {
override fun actionPerformed(e: AnActionEvent) {
if (SpotifyService.isPlaying) {
SpotifyService.pauseTrack()
} else {
SpotifyService.startTrack()
}
}
}

class PrevTrackAction: AnAction() {
override fun actionPerformed(e: AnActionEvent) {
SpotifyService.prevTrack()
}
}

class NextTrackAction: AnAction() {
override fun actionPerformed(e: AnActionEvent) {
SpotifyService.nextTrack()
}
}
12 changes: 12 additions & 0 deletions src/main/resources/META-INF/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@
</applicationListeners>

<actions>
<action id="playPauseActionID"
class="com.github.kikimanjaro.intellify.actions.TogglePlayPauseAction"
text="Intellify Toggle Play"
description="Tell Intellify to toggle playing or pausing"/>
<action id="prevTrackActionID"
class="com.github.kikimanjaro.intellify.actions.PrevTrackAction"
text="Intellify Previous Track"
description="Tell Intellify to play the previous track"/>
<action id="nextTackActionID"
class="com.github.kikimanjaro.intellify.actions.NextTrackAction"
text="Intellify Next Track"
description="Tell Intellify to play the next track"/>
<group id="SpotifyPlugin.SpotifyGroup" icon="/icons/spotify.svg">
<add-to-group group-id="NavBarToolBar" anchor="before" relative-to-action="ToolbarRunGroup"/>
</group>
Expand Down

0 comments on commit df6b1b0

Please sign in to comment.