essential-actions

Clone or download

Added support for windows media keys

Modified Files

--- 'a/DemoCustomNormalAction/DemoCustomNormalAction.iml'
+++ b/DemoCustomNormalAction/DemoCustomNormalAction.iml
@@ -9,16 +9,16 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Maven: com.stream_pi:util:1.0.0" level="project" />
- <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-fontawesome5-pack:11.5.0" level="project" />
- <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-javafx:11.5.0" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:linux:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:linux:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:linux:16-ea+6" level="project" />
- <orderEntry type="library" name="Maven: com.stream_pi:action_api:1.0.0" level="project" />
+ <orderEntry type="library" name="Maven: com.stream-pi:action-api:1.0.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: com.stream-pi:util:1.0.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-fontawesome5-pack:11.5.0" level="project" />
+ <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-javafx:11.5.0" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-material-pack:11.5.0" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-core:11.5.0" level="project" />
</component>
--- 'a/DemoCustomNormalAction/pom.xml'
+++ b/DemoCustomNormalAction/pom.xml
@@ -4,7 +4,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
- <groupId>com.StreamPi</groupId>
+ <groupId>com.stream-pi</groupId>
<artifactId>DemoCustomNormalAction</artifactId>
<version>1.0.0</version>
@@ -37,8 +37,7 @@
</build>
<properties>
- <ActionAPIVersion>1.0.0</ActionAPIVersion>
- <UtilVersion>1.0.0</UtilVersion>
+ <ActionAPIVersion>1.0.0-SNAPSHOT</ActionAPIVersion>
<JavaFXVersion>16-ea+6</JavaFXVersion>
@@ -48,11 +47,6 @@
</properties>
<dependencies>
- <dependency>
- <groupId>com.stream_pi</groupId>
- <artifactId>util</artifactId>
- <version>${UtilVersion}</version>
- </dependency>
<dependency>
<groupId>org.openjfx</groupId>
@@ -75,8 +69,8 @@
<dependency>
- <groupId>com.stream_pi</groupId>
- <artifactId>action_api</artifactId>
+ <groupId>com.stream-pi</groupId>
+ <artifactId>action-api</artifactId>
<version>${ActionAPIVersion}</version>
</dependency>
--- 'a/DemoCustomNormalAction/src/main/java/com/stream_pi/democustomnormalaction/DemoCustomNormalAction.java'
+++ b/DemoCustomNormalAction/src/main/java/com/stream_pi/democustomnormalaction/DemoCustomNormalAction.java
@@ -1,9 +1,9 @@
package com.stream_pi.democustomnormalaction;
-import com.stream_pi.actionapi.actionproperty.property.ControlType;
-import com.stream_pi.actionapi.actionproperty.property.Property;
-import com.stream_pi.actionapi.actionproperty.property.Type;
-import com.stream_pi.actionapi.normalaction.NormalAction;
+import com.stream_pi.action_api.actionproperty.property.ControlType;
+import com.stream_pi.action_api.actionproperty.property.Property;
+import com.stream_pi.action_api.actionproperty.property.Type;
+import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.util.version.Version;
import java.util.ArrayList;
--- 'a/DemoCustomNormalAction/src/main/java/module-info.java'
+++ b/DemoCustomNormalAction/src/main/java/module-info.java
@@ -1,8 +1,5 @@
module com.stream_pi.democustomnormalaction{
- requires com.stream_pi.actionapi;
- requires com.stream_pi.util;
-
+ requires com.stream_pi.action_api;
requires org.kordamp.ikonli.javafx;
-
- provides com.stream_pi.actionapi.normalaction.NormalAction with com.stream_pi.democustomnormalaction.DemoCustomNormalAction;
+ provides com.stream_pi.action_api.normalaction.NormalAction with com.stream_pi.democustomnormalaction.DemoCustomNormalAction;
}
\ No newline at end of file
Binary files 'a/PreBuiltPlugins/hotkeyaction.jar' and b/PreBuiltPlugins/hotkeyaction.jar differ
Binary files 'a/PreBuiltPlugins/mediakeyaction.jar' and b/PreBuiltPlugins/mediakeyaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_motheraction.jar' and b/PreBuiltPlugins/obssuite_motheraction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setcurrentprofileaction.jar' and b/PreBuiltPlugins/obssuite_setcurrentprofileaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setcurrentsceneaction.jar' and b/PreBuiltPlugins/obssuite_setcurrentsceneaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setcurrenttransitionaction.jar' and b/PreBuiltPlugins/obssuite_setcurrenttransitionaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setmuteaction.jar' and b/PreBuiltPlugins/obssuite_setmuteaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setpreviewsceneaction.jar' and b/PreBuiltPlugins/obssuite_setpreviewsceneaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setrecordingaction.jar' and b/PreBuiltPlugins/obssuite_setrecordingaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setreplaybufferaction.jar' and b/PreBuiltPlugins/obssuite_setreplaybufferaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setstreamingaction.jar' and b/PreBuiltPlugins/obssuite_setstreamingaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setstudiomodeaction.jar' and b/PreBuiltPlugins/obssuite_setstudiomodeaction.jar differ
Binary files 'a/PreBuiltPlugins/obssuite_setvolumeaction.jar' and b/PreBuiltPlugins/obssuite_setvolumeaction.jar differ
Binary files 'a/PreBuiltPlugins/playaudioclipaction.jar' and b/PreBuiltPlugins/playaudioclipaction.jar differ
Binary files 'a/PreBuiltPlugins/runcommandaction.jar' and b/PreBuiltPlugins/runcommandaction.jar differ
Binary files 'a/PreBuiltPlugins/textblockaction.jar' and b/PreBuiltPlugins/textblockaction.jar differ
Binary files 'a/PreBuiltPlugins/twitteraction.jar' and b/PreBuiltPlugins/twitteraction.jar differ
Binary files 'a/PreBuiltPlugins/websiteaction.jar' and b/PreBuiltPlugins/websiteaction.jar differ
--- 'a/hotkeyaction/src/main/java/com/stream_pi/hotkeyaction/HotkeyAction.java'
+++ b/hotkeyaction/src/main/java/com/stream_pi/hotkeyaction/HotkeyAction.java
@@ -5,6 +5,7 @@ import com.stream_pi.action_api.actionpr
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
+import com.stream_pi.util.exception.MinorException;
import com.stream_pi.util.version.Version;
import javafx.application.Platform;
@@ -50,8 +51,7 @@ public class HotkeyAction extends Normal
if(keyCombination.getStringValue().isBlank())
{
- new StreamPiAlert("Hotkey Action", "No key specified", StreamPiAlertType.ERROR).show();
- return;
+ throw new MinorException("No key specified");
}
press(keyCombination.getStringValue()
@@ -79,7 +79,8 @@ public class HotkeyAction extends Normal
}
}
- private void releaseCharacters(ArrayList<KeyCode> chars) throws InterruptedException {
+ private void releaseCharacters(ArrayList<KeyCode> chars) throws InterruptedException
+ {
for(KeyCode c : chars)
{
release(c);
@@ -87,7 +88,8 @@ public class HotkeyAction extends Normal
}
}
- public KeyCode getKeyCodeValue(String character) {
+ public KeyCode getKeyCodeValue(String character) throws IllegalArgumentException
+ {
switch (character) {
case "A": return A;
case "B": return B;
--- 'a/mediakeyaction/src/main/java/com/stream_pi/mediakeyaction/MediaKeyAction.java'
+++ b/mediakeyaction/src/main/java/com/stream_pi/mediakeyaction/MediaKeyAction.java
@@ -5,8 +5,10 @@ import com.stream_pi.action_api.actionpr
import com.stream_pi.action_api.normalaction.NormalAction;
import com.stream_pi.util.alert.StreamPiAlert;
import com.stream_pi.util.alert.StreamPiAlertType;
+import com.stream_pi.util.platform.Platform;
import com.stream_pi.util.version.Version;
+import java.io.*;
import java.util.List;
public class MediaKeyAction extends NormalAction
@@ -37,6 +39,30 @@ public class MediaKeyAction extends Norm
@Override
public void initAction() throws Exception {
+ if(getServerConnection().getPlatform() == Platform.WINDOWS)
+ extractKeyEXEToTmpDirectory();
+ }
+
+ private static String absolutePathToExe;
+ private void extractKeyEXEToTmpDirectory() throws Exception
+ {
+ String tmpDirectory = System.getProperty("java.io.tmpdir");
+
+ InputStream is = getClass().getResource("key.exe").openStream();
+ absolutePathToExe = tmpDirectory+"/key.exe";
+ File file = new File(absolutePathToExe);
+ file.deleteOnExit();
+ OutputStream os = new FileOutputStream(file);
+
+ byte[] b = new byte[2048];
+ int length;
+
+ while ((length = is.read(b)) != -1) {
+ os.write(b, 0, length);
+ }
+
+ is.close();
+ os.close();
}
@Override
@@ -46,10 +72,13 @@ public class MediaKeyAction extends Norm
switch(getServerConnection().getPlatform())
{
- case LINUX :
- case LINUX_RPI :
+ case LINUX :
linuxHandler(state);
break;
+
+ case WINDOWS:
+ windowsHandler(state);
+ break;
default:
othersHandler();
@@ -57,8 +86,8 @@ public class MediaKeyAction extends Norm
}
@Override
- public void onShutDown() throws Exception {
- // TODO Auto-generated method stub
+ public void onShutDown() throws Exception
+ {
}
@@ -95,6 +124,33 @@ public class MediaKeyAction extends Norm
}
}
+ private void windowsHandler(int state) throws Exception
+ {
+ try
+ {
+ switch(state)
+ {
+ case 0: runCommand(absolutePathToExe+" 0xB3"); break;
+ case 1: runCommand(absolutePathToExe+" 0xB1"); break;
+ case 2: runCommand(absolutePathToExe+" 0xB0"); break;
+ case 3: runCommand(absolutePathToExe+" 0xAF"); break;
+ case 4: runCommand(absolutePathToExe+" 0xAE"); break;
+ case 5: runCommand(absolutePathToExe+" 0xAD"); break;
+ case 6: runCommand(absolutePathToExe+" 0xB2"); break;
+ }
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+
+ new StreamPiAlert("Uh Oh!",
+ "Internal Error occured. Check logs, stacktrace. Report to us.",
+ StreamPiAlertType.ERROR
+ ).show();
+ }
+ }
+
+
private void othersHandler()
{
new StreamPiAlert("Uh Oh!",
--- /dev/null
+++ b/mediakeyaction/src/main/java/com/stream_pi/mediakeyaction/key.c
@@ -0,0 +1,61 @@
+//
+// key.c - Pauses, then simulates a key press
+//
+// Written by Ted Burke - last updated 3-9-2014
+// Modified by Debayan Sutradhar (rnayabed) to use multiple keystrokes - 19th February 2021
+//
+// To compile with MinGW:
+//
+// gcc -o keystroke.exe keystroke.c
+//
+// To run the program:
+//
+// keystroke.exe
+//
+// ...then switch to e.g. a Notepad window and wait
+// 5 seconds for the A key to be magically pressed.
+//
+
+// Because the SendInput function is only supported in
+// Windows 2000 and later, WINVER needs to be set as
+// follows so that SendInput gets defined when windows.h
+// is included below.
+
+#define WINVER 0x0500
+#include <windows.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+int main(int argc, char *argv[])
+{
+ // This structure will be used to create the keyboard
+ // input event.
+ INPUT ip;
+
+ // Pause for 5 seconds.
+ //Sleep(5000);
+
+ // Set up a generic keyboard event.
+ ip.type = INPUT_KEYBOARD;
+ ip.ki.wScan = 0;// DirectInput key scancode for the "A" key
+ ip.ki.time = 0;
+ ip.ki.dwExtraInfo = 0;
+
+ // read a hex string and turn it into a value
+ //virtual key code
+ int vkc;
+ sscanf(argv[1], "%x", &vkc);
+
+ // Press the key (using scancode to specify which key)
+ ip.ki.wVk = vkc;
+ ip.ki.dwFlags = 0;
+ SendInput(1, &ip, sizeof(INPUT));
+
+ // Release the key (again, using scancode to specify which key)
+ ip.ki.dwFlags = KEYEVENTF_KEYUP | KEYEVENTF_SCANCODE;
+ SendInput(1, &ip, sizeof(INPUT));
+
+ // Exit normally
+ return 0;
+}
\ No newline at end of file
Binary files /dev/null and b/mediakeyaction/src/main/resources/com/stream_pi/mediakeyaction/key.exe differ
--- 'a/obssuite/mother/OBSSuite-MotherAction.iml'
+++ b/obssuite/mother/OBSSuite-MotherAction.iml
@@ -10,15 +10,15 @@
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Maven: com.stream-pi:util:1.0.0-SNAPSHOT" level="project" />
- <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-fontawesome5-pack:11.5.0" level="project" />
- <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-core:11.5.0" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-controls:16-ea+6" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-controls:linux:16-ea+6" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:16-ea+6" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:linux:16-ea+6" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-base:16-ea+6" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-base:linux:16-ea+6" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-controls:16-ea+7" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-controls:linux:16-ea+7" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:16-ea+7" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:linux:16-ea+7" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-base:16-ea+7" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-base:linux:16-ea+7" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-javafx:11.5.0" level="project" />
+ <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-core:11.5.0" level="project" />
+ <orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-fontawesome5-pack:11.5.0" level="project" />
<orderEntry type="library" name="Maven: com.stream-pi:action-api:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: net.twasi:obs-websocket-java:1.2.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
--- 'a/obssuite/mother/pom.xml'
+++ b/obssuite/mother/pom.xml
@@ -64,7 +64,6 @@
<groupId>net.twasi</groupId>
<artifactId>obs-websocket-java</artifactId>
<version>${OBSWebsocketJavaVersion}</version>
-
</dependency>
<dependency>
--- 'a/obssuite/mother/src/main/java/module-info.java'
+++ b/obssuite/mother/src/main/java/module-info.java
@@ -13,7 +13,6 @@ module com.stream_pi.obssuite.motheracti
requires transitive org.eclipse.jetty.io;
requires transitive com.google.gson;
-
exports mother.motherconnection;
provides com.stream_pi.action_api.normalaction.NormalAction with mother.Mother;
--- 'a/obssuite/setvolume/.gitignore'
+++ b/obssuite/setvolume/.gitignore
@@ -1,6 +1,6 @@
.idea/
target/
-
+OBSSuite-SetVolumeAction.iml
.classpath
.factorypath
.project
--- 'a/obssuite/setvolume/OBSSuite-SetVolumeAction.iml'
+++ b/obssuite/setvolume/OBSSuite-SetVolumeAction.iml
@@ -9,18 +9,18 @@
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
- <orderEntry type="library" name="Maven: com.stream_pi:util:1.0.0" level="project" />
+ <orderEntry type="library" name="Maven: com.stream-pi:util:1.0.0-SNAPSHOT" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-fontawesome5-pack:11.5.0" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-core:11.5.0" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-controls:linux:16-ea+6" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:16-ea+6" level="project" />
+ <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:linux:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.openjfx:javafx-base:linux:16-ea+6" level="project" />
<orderEntry type="library" name="Maven: org.kordamp.ikonli:ikonli-javafx:11.5.0" level="project" />
- <orderEntry type="library" name="Maven: com.stream_pi:actionapi:1.0.0" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:15" level="project" />
- <orderEntry type="library" name="Maven: org.openjfx:javafx-graphics:linux:15" level="project" />
- <orderEntry type="library" name="Maven: com.stream_pi:obssuite_motheraction:1.0.0" level="project" />
+ <orderEntry type="library" name="Maven: com.stream-pi:action-api:1.0.0-SNAPSHOT" level="project" />
+ <orderEntry type="library" name="Maven: com.stream-pi:obssuite_motheraction:1.0.0" level="project" />
<orderEntry type="library" name="Maven: net.twasi:obs-websocket-java:1.2.0" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:slf4j-api:1.7.30" level="project" />
<orderEntry type="library" scope="RUNTIME" name="Maven: org.slf4j:slf4j-simple:1.7.30" level="project" />