Skip to content

Commit

Permalink
Preparations for Flatpak release
Browse files Browse the repository at this point in the history
  • Loading branch information
ninjadev64 committed Oct 14, 2024
1 parent 2e3c2c0 commit f1742f9
Show file tree
Hide file tree
Showing 12 changed files with 122 additions and 57 deletions.
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on:
push:
branches:
- release
workflow_dispatch:

jobs:
publish-tauri:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "opendeck",
"version": "2.1.1",
"description": "OpenDeck is a cross-platform desktop application that provides functionality for stream controller devices.",
"description": "A cross-platform desktop application for stream controller devices",
"author": "ninjadev64",
"license": "GPL-3.0-or-later",
"repository": "https://github.com/ninjadev64/OpenDeck",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "opendeck"
version = "2.1.1"
description = "A cross-platform desktop application for ProntoKey and Stream Deck."
description = "A cross-platform desktop application for stream controller devices"
authors = [ "ninjadev64" ]
license = "GPL-3.0-or-later"
repository = "https://github.com/ninjadev64/OpenDeck"
Expand Down
File renamed without changes.
71 changes: 71 additions & 0 deletions src-tauri/bundle/me.amankhanna.opendeck.metainfo.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop-application">
<id>me.amankhanna.opendeck</id>

<name>OpenDeck</name>
<summary>A cross-platform desktop application for stream controller devices</summary>
<developer id="me.amankhanna"><name>Aman Khanna</name></developer>

<url type="vcs-browser">https://github.com/ninjadev64/OpenDeck</url>
<url type="homepage">https://github.com/ninjadev64/OpenDeck</url>
<url type="bugtracker">https://github.com/ninjadev64/OpenDeck/issues</url>
<url type="faq">https://github.com/ninjadev64/OpenDeck?tab=readme-ov-file#support</url>
<url type="contribute">https://github.com/ninjadev64/OpenDeck?tab=readme-ov-file#building-from-source--contributing</url>
<url type="donation">https://github.com/sponsors/ninjadev64</url>
<url type="contact">https://matrix.to/#/#opendeck:amankhanna.me</url>

<metadata_license>CC-BY-SA-4.0</metadata_license>
<project_license>GPL-3.0-or-later</project_license>
<content_rating type="oars-1.1" />

<description>
<p>OpenDeck is a desktop application for using stream controller devices like the Elgato Stream Deck. OpenDeck conforms to the OpenAction API, which is cross-compatible with the Stream Deck SDK, allowing a wide range of pre-existing plugins to be used.</p>
<p>OpenDeck supports ProntoKey, Elgato Stream Deck and some Ajazz hardware on all three major desktop platforms. If you would like to contribute support for additional hardware (e.g. Loupedeck) feel free to reach out on any of the support forums and make a pull request!</p>
<p>Please note that you may need to install udev subsystem rules for your device to be detected. For more information, see the Installation section of the project README on GitHub.</p>
</description>

<launchable type="desktop-id">opendeck.desktop</launchable>
<screenshots>
<screenshot type="default">
<image>https://github.com/ninjadev64/OpenDeck/raw/2daaf68/.github/readme/mainmenu.png</image>
</screenshot>
<screenshot>
<image>https://github.com/ninjadev64/OpenDeck/raw/2daaf68/.github/readme/multiaction.png</image>
</screenshot>
<screenshot>
<image>https://github.com/ninjadev64/OpenDeck/raw/2daaf68/.github/readme/plugins.png</image>
</screenshot>
</screenshots>

<releases>
<release version="2.2.0" date="2024-10-14">
<url type="details">https://github.com/ninjadev64/OpenDeck/releases/tag/v2.2.0</url>
<description>
<ul>
<li>Preparations for Flatpak release</li>
<li>Removal of unnecessary dependencies</li>
<li>Internal build system and formatting improvements</li>
</ul>
</description>
</release>
<release version="2.1.1" date="2024-10-09">
<url type="details">https://github.com/ninjadev64/OpenDeck/release/tag/v2.1.1</url>
<description>Bug fix for blank screens</description>
</release>
<release version="2.1.0" date="2024-10-03">
<url type="details">https://github.com/ninjadev64/OpenDeck/releases/tag/v2.1.0</url>
<description>
<ul>
<li>Changed license to the GNU GPL version 3 or later</li>
<li>Changed the config directory location</li>
<li>Migrated to Tauri v2 to reduce app size, prevent dependency issues, and fix bugs and performance issues</li>
<li>Minor bug fixes</li>
</ul>
</description>
</release>
<release version="2.0.0" date="2024-09-07">
<url type="details">https://github.com/ninjadev64/OpenDeck/release/tag/v2.0.0</url>
<description>This is the first stable release of the completely rewritten version of OpenDeck</description>
</release>
</releases>
</component>
File renamed without changes.
13 changes: 10 additions & 3 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,17 +100,24 @@ async fn main() {
.filter(|v| {
!matches!(
v.target(),
"tungstenite::handshake::server" | "tungstenite::protocol" | "tracing::span" | "zbus::object_server" | "zbus::handshake" | "zbus::connection"
"tungstenite::handshake::server" | "tungstenite::protocol" | "tracing::span" | "zbus::object_server" | "zbus::handshake" | "zbus::connection" | "os_info::imp::lsb_release"
)
})
.build(),
)
.plugin(tauri_plugin_autostart::init(tauri_plugin_autostart::MacosLauncher::LaunchAgent, Some(vec!["--hide"])))
.plugin(tauri_plugin_single_instance::init(|app, _, _| app.get_webview_window("main").unwrap().show().unwrap()))
.on_window_event(|window, event| {
if window.label() != "main" {
return;
}
if let WindowEvent::CloseRequested { api, .. } = event {
window.hide().unwrap();
api.prevent_close();
if let Ok(true) = store::get_settings().map(|store| store.value.background) {
window.hide().unwrap();
api.prevent_close();
} else {
window.app_handle().exit(0);
}
}
})
.run(tauri::generate_context!())
Expand Down
67 changes: 21 additions & 46 deletions src-tauri/src/plugins/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ pub async fn initialise_plugin(path: &path::PathBuf) -> anyhow::Result<()> {
}

let code_path = code_path.unwrap();
let args = ["-port", "57116", "-pluginUUID", plugin_uuid, "-registerEvent", "registerPlugin", "-info"];

if code_path.to_lowercase().ends_with(".html") || code_path.to_lowercase().ends_with(".htm") || code_path.to_lowercase().ends_with(".xhtml") {
// Create a webview window for the plugin and call its registration function.
Expand Down Expand Up @@ -177,53 +178,43 @@ pub async fn initialise_plugin(path: &path::PathBuf) -> anyhow::Result<()> {
INSTANCES.lock().await.insert(plugin_uuid.to_owned(), PluginInstance::Webview);
} else if code_path.to_lowercase().ends_with(".js") || code_path.to_lowercase().ends_with(".mjs") || code_path.to_lowercase().ends_with(".cjs") {
// Check for Node.js installation and version in one go.
let version_output = Command::new("node").arg("--version").output();
let command = if std::env::var("container").is_ok() { "flatpak-spawn" } else { "node" };
let extra_args = if std::env::var("container").is_ok() { vec!["--host", "node"] } else { vec![] };
let version_output = Command::new(command).args(&extra_args).arg("--version").output();
if version_output.is_err() || String::from_utf8(version_output.unwrap().stdout).unwrap().trim() < "v20.0.0" {
return Err(anyhow!("Node version 20.0.0 or higher is required, or Node is not installed"));
}

let info = info_param::make_info(plugin_uuid.to_owned(), manifest.version, true).await;
let log_file = fs::File::create(path.parent().unwrap().parent().unwrap().join("logs").join("plugins").join(format!("{plugin_uuid}.log")))?;
// Start Node with the appropriate arguments.
let child = Command::new("node")
let child = Command::new(command)
.current_dir(path)
.args([
code_path,
String::from("-port"),
57116.to_string(),
String::from("-pluginUUID"),
plugin_uuid.to_owned(),
String::from("-registerEvent"),
String::from("registerPlugin"),
String::from("-info"),
serde_json::to_string(&info)?,
])
.args(extra_args)
.arg(code_path)
.args(args)
.arg(serde_json::to_string(&info)?)
.stdout(Stdio::from(log_file.try_clone()?))
.stderr(Stdio::from(log_file))
.spawn()?;

INSTANCES.lock().await.insert(plugin_uuid.to_owned(), PluginInstance::Node(child));
} else if use_wine {
if Command::new("wine").stdout(Stdio::null()).stderr(Stdio::null()).spawn().is_err() {
let command = if std::env::var("container").is_ok() { "flatpak-spawn" } else { "wine" };
let extra_args = if std::env::var("container").is_ok() { vec!["--host", "wine"] } else { vec![] };
if Command::new(command).stdout(Stdio::null()).stderr(Stdio::null()).spawn().is_err() {
return Err(anyhow!("failed to detect an installation of Wine"));
}

let info = info_param::make_info(plugin_uuid.to_owned(), manifest.version, true).await;
let log_file = fs::File::create(path.parent().unwrap().parent().unwrap().join("logs").join("plugins").join(format!("{plugin_uuid}.log")))?;
// Start Wine with the appropriate arguments.
let child = Command::new("wine")
let child = Command::new(command)
.current_dir(path)
.args([
&code_path,
"-port",
"57116",
"-pluginUUID",
plugin_uuid,
"-registerEvent",
"registerPlugin",
"-info",
&serde_json::to_string(&info)?,
])
.args(extra_args)
.arg(code_path)
.args(args)
.arg(serde_json::to_string(&info)?)
.stdout(Stdio::from(log_file.try_clone()?))
.stderr(Stdio::from(log_file))
.spawn()?;
Expand All @@ -236,33 +227,17 @@ pub async fn initialise_plugin(path: &path::PathBuf) -> anyhow::Result<()> {
#[cfg(target_os = "windows")]
let child = Command::new(path.join(code_path))
.current_dir(path)
.args([
"-port",
"57116",
"-pluginUUID",
plugin_uuid,
"-registerEvent",
"registerPlugin",
"-info",
&serde_json::to_string(&info)?,
])
.args(args)
.arg(serde_json::to_string(&info)?)
.stdout(Stdio::from(log_file.try_clone()?))
.stderr(Stdio::from(log_file))
.creation_flags(0x08000000)
.spawn()?;
#[cfg(not(target_os = "windows"))]
let child = Command::new(path.join(code_path))
.current_dir(path)
.args([
"-port",
"57116",
"-pluginUUID",
plugin_uuid,
"-registerEvent",
"registerPlugin",
"-info",
&serde_json::to_string(&info)?,
])
.args(args)
.arg(serde_json::to_string(&info)?)
.stdout(Stdio::from(log_file.try_clone()?))
.stderr(Stdio::from(log_file))
.spawn()?;
Expand Down
2 changes: 2 additions & 0 deletions src-tauri/src/store/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ where
#[serde(default)]
pub struct Settings {
pub language: String,
pub background: bool,
pub autolaunch: bool,
pub darktheme: bool,
pub brightness: u8,
Expand All @@ -78,6 +79,7 @@ impl Default for Settings {
fn default() -> Self {
Self {
language: "en".to_owned(),
background: std::env::var("container").is_err(),
autolaunch: false,
darktheme: true,
brightness: 50,
Expand Down
14 changes: 8 additions & 6 deletions src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,23 @@
"targets": "all",
"linux": {
"deb": {
"desktopTemplate": "opendeck.desktop",
"desktopTemplate": "bundle/opendeck.desktop",
"files": {
"/etc/udev/rules.d/40-streamdeck.rules": "40-streamdeck.rules"
"/etc/udev/rules.d/40-streamdeck.rules": "bundle/40-streamdeck.rules",
"/app/share/metainfo/me.amankhanna.opendeck.metainfo.xml": "bundle/me.amankhanna.opendeck.metainfo.xml"
}
},
"rpm": {
"desktopTemplate": "opendeck.desktop",
"desktopTemplate": "bundle/opendeck.desktop",
"files": {
"/etc/udev/rules.d/40-streamdeck.rules": "40-streamdeck.rules"
"/etc/udev/rules.d/40-streamdeck.rules": "bundle/40-streamdeck.rules",
"/app/share/metainfo/me.amankhanna.opendeck.metainfo.xml": "bundle/me.amankhanna.opendeck.metainfo.xml"
}
}
},
"publisher": "ninjadev64",
"shortDescription": "A cross-platform desktop application for ProntoKey and Stream Deck.",
"longDescription": "OpenDeck is a cross-platform desktop application that provides functionality for stream controller devices.",
"shortDescription": "A cross-platform desktop application for stream controller devices",
"longDescription": "OpenDeck is a desktop application for using stream controller devices like the Elgato Stream Deck. OpenDeck conforms to the OpenAction API, which is cross-compatible with the Stream Deck SDK, allowing a wide range of pre-existing plugins to be used.",
"category": "Productivity",
"icon": [
"icons/icon.png",
Expand Down
6 changes: 6 additions & 0 deletions src/components/SettingsView.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
</Tooltip>
</div>

<div class="flex flex-row items-center m-2 space-x-2">
<span class="dark:text-neutral-400"> Run in background: </span>
<input type="checkbox" bind:checked={$settings.background} />
<Tooltip> If this option is enabled, OpenDeck will minimise to the tray and run in the background. </Tooltip>
</div>

<div class="flex flex-row items-center m-2 space-x-2">
<span class="dark:text-neutral-400"> Autolaunch: </span>
<input type="checkbox" bind:checked={$settings.autolaunch} />
Expand Down
1 change: 1 addition & 0 deletions src/lib/settings.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export type Settings = {
language: string;
background: boolean;
autolaunch: boolean;
darktheme: boolean;
brightness: number;
Expand Down

0 comments on commit f1742f9

Please sign in to comment.