mirror of
https://github.com/Cateners/tiny_computer.git
synced 2026-05-20 16:35:47 +08:00
Fix termux:x11 start & scale
This commit is contained in:
@@ -110,6 +110,5 @@
|
|||||||
"updateRequest": "Please try to use the latest version. Visit the project address to check for the latest version.",
|
"updateRequest": "Please try to use the latest version. Visit the project address to check for the latest version.",
|
||||||
"avncScreenResize": "Adaptive Screen Size",
|
"avncScreenResize": "Adaptive Screen Size",
|
||||||
"avncResizeFactor": "Screen Scaling Ratio",
|
"avncResizeFactor": "Screen Scaling Ratio",
|
||||||
"avncResizeFactorValue": "Current scaling is",
|
"avncResizeFactorValue": "Current scaling is"
|
||||||
"recommendHidpi": "Recommended to enable HiDPI Support simultaneously"
|
|
||||||
}
|
}
|
||||||
@@ -110,6 +110,5 @@
|
|||||||
"updateRequest": "请尽量使用最新版本。前往项目地址可查看最新版本。",
|
"updateRequest": "请尽量使用最新版本。前往项目地址可查看最新版本。",
|
||||||
"avncScreenResize": "自适应屏幕尺寸",
|
"avncScreenResize": "自适应屏幕尺寸",
|
||||||
"avncResizeFactor": "屏幕缩放比",
|
"avncResizeFactor": "屏幕缩放比",
|
||||||
"avncResizeFactorValue": "当前缩放为",
|
"avncResizeFactorValue": "当前缩放为"
|
||||||
"recommendHidpi": "推荐同步开启高分辨率支持"
|
|
||||||
}
|
}
|
||||||
@@ -110,6 +110,5 @@
|
|||||||
"updateRequest": "請盡量使用最新版本。前往專案網址查看最新版本。",
|
"updateRequest": "請盡量使用最新版本。前往專案網址查看最新版本。",
|
||||||
"avncScreenResize": "自適應螢幕尺寸",
|
"avncScreenResize": "自適應螢幕尺寸",
|
||||||
"avncResizeFactor": "螢幕縮放比",
|
"avncResizeFactor": "螢幕縮放比",
|
||||||
"avncResizeFactorValue": "目前縮放為",
|
"avncResizeFactorValue": "目前縮放為"
|
||||||
"recommendHidpi": "推薦同步開啟高解析度支援"
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -354,6 +354,8 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
_avncScaleFactor += value ? 0.5 : -0.5;
|
_avncScaleFactor += value ? 0.5 : -0.5;
|
||||||
_avncScaleFactor = _avncScaleFactor.clamp(-1, 1);
|
_avncScaleFactor = _avncScaleFactor.clamp(-1, 1);
|
||||||
G.prefs.setDouble("avncScaleFactor", _avncScaleFactor);
|
G.prefs.setDouble("avncScaleFactor", _avncScaleFactor);
|
||||||
|
// Termux:X11 并不是设置缩放比例本身,而是倍率
|
||||||
|
X11Flutter.setX11ScaleFactor(value ? 0.5 : 2.0);
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},),
|
},),
|
||||||
const SizedBox.square(dimension: 16),
|
const SizedBox.square(dimension: 16),
|
||||||
@@ -463,12 +465,6 @@ sed -i -E "s@^(VNC_RESOLUTION)=.*@\\1=${w}x${h}@" \$(command -v startvnc)""");
|
|||||||
if (!value && Util.getGlobal("dri3")) {
|
if (!value && Util.getGlobal("dri3")) {
|
||||||
G.prefs.setBool("dri3", false);
|
G.prefs.setBool("dri3", false);
|
||||||
}
|
}
|
||||||
if (value) {
|
|
||||||
ScaffoldMessenger.of(context).hideCurrentSnackBar();
|
|
||||||
ScaffoldMessenger.of(context).showSnackBar(
|
|
||||||
SnackBar(content: Text(AppLocalizations.of(context)!.recommendHidpi))
|
|
||||||
);
|
|
||||||
}
|
|
||||||
setState(() {});
|
setState(() {});
|
||||||
},),
|
},),
|
||||||
const SizedBox.square(dimension: 16),
|
const SizedBox.square(dimension: 16),
|
||||||
|
|||||||
@@ -212,10 +212,10 @@ class Util {
|
|||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
bool isReady = await isXServerReady(host, port);
|
bool isReady = await isXServerReady(host, port);
|
||||||
|
await Future.delayed(Duration(seconds: 1));
|
||||||
if (isReady) {
|
if (isReady) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await Future.delayed(Duration(seconds: 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -785,10 +785,14 @@ export PROOT_LOADER=\$DATA_DIR/applib/libproot-loader.so
|
|||||||
export PROOT_LOADER_32=\$DATA_DIR/applib/libproot-loader32.so
|
export PROOT_LOADER_32=\$DATA_DIR/applib/libproot-loader32.so
|
||||||
${Util.getCurrentProp("boot")}
|
${Util.getCurrentProp("boot")}
|
||||||
${G.postCommand}
|
${G.postCommand}
|
||||||
${(Util.getGlobal("autoLaunchVnc") as bool)?((Util.getGlobal("useX11") as bool)?"""mkdir -p "\$HOME/.vnc" && bash /etc/X11/xinit/Xsession &> "\$HOME/.vnc/x.log" &""":Util.getCurrentProp("vnc")):""}
|
|
||||||
clear""");
|
clear""");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static Future<void> launchGUIBackend() async {
|
||||||
|
Util.termWrite((Util.getGlobal("autoLaunchVnc") as bool)?((Util.getGlobal("useX11") as bool)?"""mkdir -p "\$HOME/.vnc" && bash /etc/X11/xinit/Xsession &> "\$HOME/.vnc/x.log" &""":Util.getCurrentProp("vnc")):"");
|
||||||
|
Util.termWrite("clear");
|
||||||
|
}
|
||||||
|
|
||||||
static Future<void> waitForConnection() async {
|
static Future<void> waitForConnection() async {
|
||||||
await retry(
|
await retry(
|
||||||
// Make a GET request
|
// Make a GET request
|
||||||
@@ -847,9 +851,11 @@ clear""");
|
|||||||
if (Util.getGlobal("autoLaunchVnc") as bool) {
|
if (Util.getGlobal("autoLaunchVnc") as bool) {
|
||||||
if (G.wasX11Enabled) {
|
if (G.wasX11Enabled) {
|
||||||
await Util.waitForXServer();
|
await Util.waitForXServer();
|
||||||
|
launchGUIBackend();
|
||||||
launchX11();
|
launchX11();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
launchGUIBackend();
|
||||||
waitForConnection().then((value) => G.wasAvncEnabled?launchAvnc():launchBrowser());
|
waitForConnection().then((value) => G.wasAvncEnabled?launchAvnc():launchBrowser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -711,8 +711,8 @@ packages:
|
|||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
path: "."
|
path: "."
|
||||||
ref: ed10bd71a24af6019ce7bccd173ee367546dac2c
|
ref: "3b92b515b1ebc32c93e18e8b3a2983656713e4dd"
|
||||||
resolved-ref: ed10bd71a24af6019ce7bccd173ee367546dac2c
|
resolved-ref: "3b92b515b1ebc32c93e18e8b3a2983656713e4dd"
|
||||||
url: "https://github.com/tiny-computer/x11_flutter.git"
|
url: "https://github.com/tiny-computer/x11_flutter.git"
|
||||||
source: git
|
source: git
|
||||||
version: "0.0.1"
|
version: "0.0.1"
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ dependencies:
|
|||||||
x11_flutter:
|
x11_flutter:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/tiny-computer/x11_flutter.git
|
url: https://github.com/tiny-computer/x11_flutter.git
|
||||||
ref: ed10bd71a24af6019ce7bccd173ee367546dac2c
|
ref: 3b92b515b1ebc32c93e18e8b3a2983656713e4dd
|
||||||
avnc_flutter:
|
avnc_flutter:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/tiny-computer/avnc_flutter.git
|
url: https://github.com/tiny-computer/avnc_flutter.git
|
||||||
|
|||||||
Reference in New Issue
Block a user