diff --git a/com.angoosh.RDPConnect/RDPConnect.flatpak b/com.angoosh.RDPConnect/RDPConnect.flatpak
new file mode 100644
index 0000000..d12079d
Binary files /dev/null and b/com.angoosh.RDPConnect/RDPConnect.flatpak differ
diff --git a/com.angoosh.RDPConnect/build.sh b/com.angoosh.RDPConnect/build.sh
new file mode 100755
index 0000000..61d41b6
--- /dev/null
+++ b/com.angoosh.RDPConnect/build.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+flatpak-builder --force-clean --user --install-deps-from=flathub --repo=repo --install builddir com.angoosh.RDPConnect.yml
+flatpak build-bundle repo RDPConnect.flatpak com.angoosh.RDPConnect --runtime-repo=https://flathub.org/repo/flathub.flatpakrepo
diff --git a/com.angoosh.RDPConnect/com.angoosh.RDPConnect.desktop b/com.angoosh.RDPConnect/com.angoosh.RDPConnect.desktop
new file mode 100644
index 0000000..bdf58dd
--- /dev/null
+++ b/com.angoosh.RDPConnect/com.angoosh.RDPConnect.desktop
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Name=RDP Connect
+Exec=rdpconnect
+Type=Application
+Icon=com.angoosh.RDPConnect
+Categories=Office;X-Tool;X-IT
\ No newline at end of file
diff --git a/com.angoosh.RDPConnect/com.angoosh.RDPConnect.ui b/com.angoosh.RDPConnect/com.angoosh.RDPConnect.ui
index e02360a..fed3f35 100644
--- a/com.angoosh.RDPConnect/com.angoosh.RDPConnect.ui
+++ b/com.angoosh.RDPConnect/com.angoosh.RDPConnect.ui
@@ -125,6 +125,7 @@
True
Connect
end
+ 5
diff --git a/com.angoosh.RDPConnect/com.angoosh.RDPConnect.yml b/com.angoosh.RDPConnect/com.angoosh.RDPConnect.yml
new file mode 100644
index 0000000..3557b10
--- /dev/null
+++ b/com.angoosh.RDPConnect/com.angoosh.RDPConnect.yml
@@ -0,0 +1,59 @@
+id: com.angoosh.RDPConnect
+runtime: org.gnome.Platform
+runtime-version: '47'
+sdk: org.gnome.Sdk
+command: rdpconnect
+
+finish-args:
+ - --socket=x11
+ - --socket=wayland
+ - --share=network
+ - --filesystem=home
+ - --socket=system-bus
+ - --talk-name=org.freedesktop.Flatpak
+
+modules:
+ - name: python
+ sources:
+ - type: archive
+ url: https://www.python.org/ftp/python/3.9.9/Python-3.9.9.tar.xz
+ sha256: 06828c04a573c073a4e51c4292a27c1be4ae26621c3edc7cf9318418ce3b6d27
+
+ - name: rdpconnect
+ buildsystem: simple
+ build-commands:
+ - ls -l ./
+ - mkdir -p /app/share/icons/hicolor/scalable/apps/
+ - mkdir -p /app/share/applications/
+ - install -Dm755 rdpconnect.sh /app/bin/rdpconnect
+ - install -Dm755 main.py /app/
+ - install com.angoosh.RDPConnect.ui /app/
+ - install style-dark.css /app/
+ - install style-light.css /app/
+ - install -Dm644 com.angoosh.RDPConnect.svg /app/share/icons/hicolor/scalable/apps/
+ - install -Dm644 com.angoosh.RDPConnect.desktop /app/share/applications/
+ sources:
+ - type: script
+ dest-filename: rdpconnect.sh
+ commands:
+ - python3 /app/main.py
+ - type: file
+ path: main.py
+ - type: file
+ path: com.angoosh.RDPConnect.ui
+ - type: file
+ path: style-dark.css
+ - type: file
+ path: style-light.css
+ - type: file
+ path: com.angoosh.RDPConnect.svg
+ - type: file
+ path: com.angoosh.RDPConnect.desktop
+
+ - name: pip-deps
+ buildsystem: simple
+ build-options:
+ build-args:
+ - --share=network
+ build-commands:
+ - pip3 install PyGObject
\ No newline at end of file
diff --git a/com.angoosh.RDPConnect/ico_base.svg b/com.angoosh.RDPConnect/ico_base.svg
deleted file mode 100644
index 9c8132c..0000000
--- a/com.angoosh.RDPConnect/ico_base.svg
+++ /dev/null
@@ -1,532 +0,0 @@
-
-
-
-
diff --git a/com.angoosh.RDPConnect/main.py b/com.angoosh.RDPConnect/main.py
index db136c3..522c7ed 100755
--- a/com.angoosh.RDPConnect/main.py
+++ b/com.angoosh.RDPConnect/main.py
@@ -17,8 +17,6 @@ from gi.repository import Gtk, Adw, Gdk, Gio
APPID = "com.angoosh.RDPConnect"
HOMEDIR = os.path.expanduser('~')
-print(HOMEDIR)
-
conn_info = {}
settings = {}
@@ -52,10 +50,13 @@ class MyApp(Adw.Application):
def on_activate(self, app):
builder = Gtk.Builder()
- builder.add_from_file(APPID+".ui")
+ builder.add_from_file("/app/"+APPID+".ui")
css_provider = Gtk.CssProvider()
- css_provider.load_from_file(Gio.File.new_for_path("style.css"))
+ if Adw.StyleManager().get_default().get_dark():
+ css_provider.load_from_file(Gio.File.new_for_path("/app/style-dark.css"))
+ else:
+ css_provider.load_from_file(Gio.File.new_for_path("/app/style-light.css"))
Gtk.StyleContext.add_provider_for_display(Gdk.Display.get_default(), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)
connect = builder.get_object("connect")
@@ -80,7 +81,7 @@ class MyApp(Adw.Application):
self.win = builder.get_object("main_window")
self.win.set_application(self)
self.win.present()
-
+
def saveConnConf(self):
if settings["save_conn"]:
print("Saving connection config to "+HOMEDIR+"/.config/rdpconnect/connection.json")
@@ -109,7 +110,7 @@ class MyApp(Adw.Application):
settings["extra_params"] = []
self.saveConnConf()
- subprocess.Popen(["flatpak", "run", "com.freerdp.FreeRDP", "/v:"+str(conn_info["ip"]), "/u:"+str(conn_info["user"]), "/p:"+str(conn_info["passwd"])]+settings["extra_params"])
+ subprocess.Popen(["flatpak-spawn", "--host", "com.freerdp.FreeRDP", "/v:"+str(conn_info["ip"]), "/u:"+str(conn_info["user"]), "/p:"+str(conn_info["passwd"])]+settings["extra_params"])
#subprocess.run(["xfreerdp", "/v:"+str(ip), "/u:"+str(user), "/p:"+str(passwd)])
if not os.path.isdir(HOMEDIR+"/.config/rdpconnect"):
diff --git a/com.angoosh.RDPConnect/style.css b/com.angoosh.RDPConnect/style-dark.css
similarity index 63%
rename from com.angoosh.RDPConnect/style.css
rename to com.angoosh.RDPConnect/style-dark.css
index 14571d5..53a038b 100644
--- a/com.angoosh.RDPConnect/style.css
+++ b/com.angoosh.RDPConnect/style-dark.css
@@ -10,5 +10,6 @@ textentry{
}
window{
- background-color: #303030;
-}
\ No newline at end of file
+ background-color: @window_bg_color;
+ color: @window_fg_color;
+}
diff --git a/com.angoosh.RDPConnect/style-light.css b/com.angoosh.RDPConnect/style-light.css
new file mode 100644
index 0000000..00c2a37
--- /dev/null
+++ b/com.angoosh.RDPConnect/style-light.css
@@ -0,0 +1,15 @@
+text{
+ font-size: 16pt;
+
+}
+
+textentry{
+ font-size: 16pt;
+ background-color: #E0E0E0;
+ border-radius: 6pt;
+}
+
+window{
+ background-color: @window_bg_color;
+ color: @window_fg_color;
+}