add flatpak support with docker and terminal
This commit is contained in:
parent
13d16fac31
commit
cad5588b72
@ -7,6 +7,21 @@
|
|||||||
"base-version": "5.15-23.08",
|
"base-version": "5.15-23.08",
|
||||||
"command": "qocker",
|
"command": "qocker",
|
||||||
"modules": [
|
"modules": [
|
||||||
|
{
|
||||||
|
"name": "docker-cli",
|
||||||
|
"buildsystem": "simple",
|
||||||
|
"build-commands": [
|
||||||
|
"tar xzvf docker-20.10.9.tgz",
|
||||||
|
"install -D docker/docker /app/bin/docker"
|
||||||
|
],
|
||||||
|
"sources": [
|
||||||
|
{
|
||||||
|
"type": "file",
|
||||||
|
"url": "https://download.docker.com/linux/static/stable/x86_64/docker-20.10.9.tgz",
|
||||||
|
"sha256": "caf74e54b58c0b38bb4d96c8f87665f29b684371c9a325562a3904b8c389995e"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "qocker",
|
"name": "qocker",
|
||||||
"buildsystem": "simple",
|
"buildsystem": "simple",
|
||||||
@ -15,9 +30,8 @@
|
|||||||
],
|
],
|
||||||
"sources": [
|
"sources": [
|
||||||
{
|
{
|
||||||
"type": "git",
|
"type": "dir",
|
||||||
"url": "https://github.com/xlmnxp/qocker.git",
|
"path": ".."
|
||||||
"tag": "v0.2"
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
@ -26,6 +40,9 @@
|
|||||||
"--share=network",
|
"--share=network",
|
||||||
"--socket=fallback-x11",
|
"--socket=fallback-x11",
|
||||||
"--socket=wayland",
|
"--socket=wayland",
|
||||||
"--filesystem=/run/docker.sock"
|
"--env=DOCKER_HOST=unix:///run/docker.sock",
|
||||||
|
"--filesystem=/run/docker.sock",
|
||||||
|
"--system-talk-name=org.freedesktop.DBus",
|
||||||
|
"--socket=session-bus"
|
||||||
]
|
]
|
||||||
}
|
}
|
12
main.py
12
main.py
@ -1,5 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
import sys
|
import sys
|
||||||
|
import os
|
||||||
from PyQt5.QtWidgets import (QApplication, QMainWindow, QTabWidget, QTreeWidget, QTreeWidgetItem,
|
from PyQt5.QtWidgets import (QApplication, QMainWindow, QTabWidget, QTreeWidget, QTreeWidgetItem,
|
||||||
QVBoxLayout, QHBoxLayout, QWidget, QToolBar, QAction, QMenu,
|
QVBoxLayout, QHBoxLayout, QWidget, QToolBar, QAction, QMenu,
|
||||||
QHeaderView, QLabel, QLineEdit, QCheckBox, QMessageBox, QInputDialog)
|
QHeaderView, QLabel, QLineEdit, QCheckBox, QMessageBox, QInputDialog)
|
||||||
@ -41,7 +42,11 @@ class TerminalOpener(QThread):
|
|||||||
if system == "Darwin": # macOS
|
if system == "Darwin": # macOS
|
||||||
subprocess.Popen(['open', '-a', 'Terminal', '--', 'sh', '-c', f"{docker_command}"])
|
subprocess.Popen(['open', '-a', 'Terminal', '--', 'sh', '-c', f"{docker_command}"])
|
||||||
elif system == "Linux":
|
elif system == "Linux":
|
||||||
subprocess.Popen(['x-terminal-emulator', '-e', f'sh -c "{docker_command}"'])
|
# check if inside flatpak
|
||||||
|
if 'container' in os.environ:
|
||||||
|
subprocess.Popen(['flatpak-spawn', '--host', 'x-terminal-emulator', '-e', f'sh -c "{docker_command}"'])
|
||||||
|
else:
|
||||||
|
subprocess.Popen(['x-terminal-emulator', '-e', f'sh -c "{docker_command}"'])
|
||||||
elif system == "Windows":
|
elif system == "Windows":
|
||||||
subprocess.Popen(['start', 'cmd', '/k', docker_command], shell=True)
|
subprocess.Popen(['start', 'cmd', '/k', docker_command], shell=True)
|
||||||
else:
|
else:
|
||||||
@ -64,7 +69,10 @@ class LogsOpener(QThread):
|
|||||||
if system == "Darwin": # macOS
|
if system == "Darwin": # macOS
|
||||||
subprocess.Popen(['open', '-a', 'Terminal', '--', 'sh', '-c', f"{docker_command}"])
|
subprocess.Popen(['open', '-a', 'Terminal', '--', 'sh', '-c', f"{docker_command}"])
|
||||||
elif system == "Linux":
|
elif system == "Linux":
|
||||||
subprocess.Popen(['x-terminal-emulator', '-e', f'sh -c "{docker_command}"'])
|
if 'container' in os.environ:
|
||||||
|
subprocess.Popen(['flatpak-spawn', '--host', 'x-terminal-emulator', '-e', f'sh -c "{docker_command}"'])
|
||||||
|
else:
|
||||||
|
subprocess.Popen(['x-terminal-emulator', '-e', f'sh -c "{docker_command}"'])
|
||||||
elif system == "Windows":
|
elif system == "Windows":
|
||||||
subprocess.Popen(['start', 'cmd', '/k', docker_command], shell=True)
|
subprocess.Popen(['start', 'cmd', '/k', docker_command], shell=True)
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user