Compare commits
59 Commits
@ -1,2 +1,3 @@
|
||||
.idea/
|
||||
.vscode/
|
||||
db_data/
|
||||
|
@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2022, dx8917312@gmail.com
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@ -1,10 +1,13 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>{% block title %}{% endblock %}</title>
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
<link rel="shortcut icon" href="/images/favicon.png"/>
|
||||
<link rel="bookmark" href="/images/favicon.png"/>
|
||||
<link rel="stylesheet" type="text/css" href="/css/site.css"/>
|
||||
</head>
|
||||
<body>
|
||||
{% block body %}{% endblock %}
|
||||
</body>
|
||||
</html>
|
@ -1,27 +1,9 @@
|
||||
html, body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
width: 100%;
|
||||
display: table;
|
||||
font-weight: 100;
|
||||
font-family: 'Lato', sans-serif;
|
||||
}
|
||||
|
||||
.container {
|
||||
text-align: center;
|
||||
display: table-cell;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.content {
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 96px;
|
||||
body {
|
||||
margin: .5em;
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
cd ../api || exit
|
||||
bash source_gen.sh
|
||||
|
||||
cd ../app || exit
|
||||
bash source_gen.sh
|
||||
|
||||
|
||||
VERSION=$(dart version.dart)
|
||||
|
||||
if [ -e pubspec.yaml.bak ]; then
|
||||
mv pubspec.yaml.bak pubspec.yaml
|
||||
fi
|
||||
|
||||
flutter clean
|
||||
|
||||
cp pubspec.yaml pubspec.yaml.bak
|
||||
ln -s /usr/share/fonts/opentype/noto/ noto_fonts
|
||||
|
||||
cat >> pubspec.yaml << EOF
|
||||
fonts:
|
||||
- family: NotoSansSC
|
||||
fonts:
|
||||
- asset: noto_fonts/NotoSansCJK-Regular.ttc
|
||||
weight: 400
|
||||
- asset: noto_fonts/NotoSansCJK-Bold.ttc
|
||||
weight: 700
|
||||
|
||||
EOF
|
||||
|
||||
flutter build linux
|
||||
|
||||
rm pubspec.yaml
|
||||
rm noto_fonts
|
||||
mv pubspec.yaml.bak pubspec.yaml
|
||||
|
||||
if [ -e deb_builder ]; then
|
||||
rm -rf deb_builder
|
||||
fi
|
||||
|
||||
|
||||
mkdir "deb_builder"
|
||||
|
||||
cp -r debian deb_builder/DEBIAN
|
||||
chmod -R 755 deb_builder/DEBIAN
|
||||
|
||||
cp ../LICENSE deb_builder/DEBIAN/copyright
|
||||
|
||||
echo "设置版本号为: $VERSION"
|
||||
|
||||
echo Version: "$VERSION" >> deb_builder/DEBIAN/control
|
||||
|
||||
mkdir -p deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/
|
||||
|
||||
cp -r dde_package_info/* deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/
|
||||
|
||||
ARCH="x64"
|
||||
|
||||
if [[ $(uname -m) == aarch64 ]]; then
|
||||
ARCH="arm64"
|
||||
sed -i "s/amd64/$ARCH/g" deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/info
|
||||
sed -i "s/amd64/$ARCH/g" deb_builder/DEBIAN/control
|
||||
fi
|
||||
|
||||
cp -r build/linux/"$ARCH"/release/bundle deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/files
|
||||
|
||||
rm -rf deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/files/data/flutter_assets/noto_fonts/
|
||||
|
||||
ln -s /usr/share/fonts/opentype/noto/ deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/files/data/flutter_assets/noto_fonts
|
||||
|
||||
mkdir -p deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/entries/icons/hicolor/scalable/apps/
|
||||
|
||||
cp web/icons/Icon-512.png deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/entries/icons/hicolor/scalable/apps/dgm.png
|
||||
|
||||
sed -i "s/VERSION/$VERSION/g" deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/info
|
||||
|
||||
sed -i "s/VERSION/$VERSION/g" deb_builder/opt/apps/com.debuggerx.dde-gesture-manager/entries/applications/com.debuggerx.dde-gesture-manager.desktop
|
||||
|
||||
echo "开始打包 $ARCH deb"
|
||||
|
||||
fakeroot dpkg-deb -b deb_builder
|
||||
|
||||
if [[ $ARCH == "x64" ]]; then
|
||||
ARCH="amd64"
|
||||
fi
|
||||
|
||||
mv deb_builder.deb com.debuggerx.dde-gesture-manager_"$VERSION"_"$ARCH".deb
|
||||
|
||||
echo "打包完成!"
|
@ -0,0 +1,17 @@
|
||||
{
|
||||
"appid": "com.debuggerx.dde-gesture-manager",
|
||||
"name": "dde-gesture-manager",
|
||||
"version": "VERSION",
|
||||
"arch": ["amd64"],
|
||||
"permissions": {
|
||||
"autostart": true,
|
||||
"notification": true,
|
||||
"trayicon": false,
|
||||
"clipboard": true,
|
||||
"account": false,
|
||||
"bluetooth": false,
|
||||
"camera": false,
|
||||
"audio_record": false,
|
||||
"installed_apps": false
|
||||
}
|
||||
}
|
@ -1,7 +1,13 @@
|
||||
import 'package:dde_gesture_manager/models/configs.provider.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:dde_gesture_manager/extensions.dart';
|
||||
|
||||
extension ContextExtension on BuildContext {
|
||||
ThemeData get t => Theme.of(this);
|
||||
|
||||
NavigatorState get n => Navigator.of(this);
|
||||
|
||||
bool get hasToken => this.read<ConfigsProvider>().accessToken.notNull;
|
||||
|
||||
bool get watchHasToken => this.watch<ConfigsProvider>().accessToken.notNull;
|
||||
}
|
||||
|
@ -0,0 +1,7 @@
|
||||
import 'package:dde_gesture_manager/models/scheme.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
export 'apply_scheme_web.dart' if (dart.library.io) 'apply_scheme_linux.dart';
|
||||
|
||||
abstract class SchemeApplyUtilStub {
|
||||
void apply(BuildContext context, Scheme scheme);
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:dde_gesture_manager/constants/constants.dart';
|
||||
import 'package:dde_gesture_manager/extensions.dart';
|
||||
import 'package:dde_gesture_manager/models/scheme.dart';
|
||||
import 'package:dde_gesture_manager/utils/helper.dart';
|
||||
import 'package:dde_gesture_manager/utils/notificator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_platform_alert/flutter_platform_alert.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'apply_scheme_interface.dart';
|
||||
import 'package:xdg_directories/xdg_directories.dart' as xdg;
|
||||
import 'package:path/path.dart' show join;
|
||||
|
||||
class SchemeApplyUtil implements SchemeApplyUtilStub {
|
||||
void apply(BuildContext context, Scheme scheme) {
|
||||
var configFilePath = join(xdg.configHome.path, userGestureConfigFilePath);
|
||||
configFilePath.sout();
|
||||
var file = File(configFilePath);
|
||||
if (scheme.id == Uuid.NAMESPACE_NIL) {
|
||||
if (file.existsSync()) file.deleteSync();
|
||||
} else {
|
||||
if (!file.existsSync()) file.createSync(recursive: true);
|
||||
file.writeAsStringSync(
|
||||
H.transGesturePropsToConfig(scheme.gestures ?? []),
|
||||
flush: true,
|
||||
);
|
||||
Notificator.showConfirm(
|
||||
title: LocaleKeys.info_apply_scheme_success.tr(),
|
||||
description: LocaleKeys.info_apply_scheme_description.tr(),
|
||||
positiveButtonTitle: LocaleKeys.info_apply_scheme_logout_immediately.tr(),
|
||||
negativeButtonTitle: LocaleKeys.str_cancel.tr(),
|
||||
).then((value) {
|
||||
if (value == CustomButton.positiveButton) {
|
||||
Process.run(deepinLogoutCommands.first, deepinLogoutCommands.skip(1).toList());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
import 'package:dde_gesture_manager/constants/constants.dart';
|
||||
import 'package:dde_gesture_manager/extensions.dart';
|
||||
import 'package:dde_gesture_manager/models/scheme.dart';
|
||||
import 'package:dde_gesture_manager/utils/helper.dart';
|
||||
import 'package:dde_gesture_manager/utils/notificator.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:uuid/uuid.dart';
|
||||
import 'apply_scheme_interface.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
class SchemeApplyUtil implements SchemeApplyUtilStub {
|
||||
void apply(BuildContext context, Scheme scheme) {
|
||||
var cmd = scheme.id == Uuid.NAMESPACE_NIL
|
||||
? [
|
||||
'rm \$XDG_CONFIG_HOME/${userGestureConfigFilePath}',
|
||||
]
|
||||
: [
|
||||
'cat > \$XDG_CONFIG_HOME/${userGestureConfigFilePath} << EOF',
|
||||
'${H.transGesturePropsToConfig(scheme.gestures ?? [])}',
|
||||
'EOF',
|
||||
];
|
||||
cmd.add('dialog'
|
||||
' --title "${LocaleKeys.info_apply_scheme_success.tr()}"'
|
||||
' --yes-label "${LocaleKeys.info_apply_scheme_logout_immediately.tr()}"'
|
||||
' --no-label "${LocaleKeys.str_cancel.tr()}"'
|
||||
' --yesno "${LocaleKeys.info_apply_scheme_description.tr()}"'
|
||||
' 8 30'
|
||||
' && ${deepinLogoutCommands.join(' ')}');
|
||||
Clipboard.setData(ClipboardData(
|
||||
text: cmd.join('\n'),
|
||||
));
|
||||
Notificator.success(
|
||||
context,
|
||||
title: LocaleKeys.info_apply_scheme_commands_copied_title.tr(),
|
||||
description: LocaleKeys.info_apply_scheme_commands_copied_description.tr(),
|
||||
);
|
||||
}
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:yaml/yaml.dart';
|
||||
|
||||
void main() async {
|
||||
var document = loadYaml(File('pubspec.yaml').readAsStringSync());
|
||||
print(document['version'].replaceAll('+', '.'));
|
||||
}
|
@ -0,0 +1,6 @@
|
||||
{
|
||||
"id": 1,
|
||||
"once": true,
|
||||
"title": "欢迎",
|
||||
"content": "感谢使用本工具,使用前建议先点击右下角阅读使用说明哦~"
|
||||
}
|
Binary file not shown.
Loading…
Reference in new issue