Skip to content

Commit

Permalink
Merge pull request #264 from bostrot/upgrade-packages
Browse files Browse the repository at this point in the history
Upgrade packages
  • Loading branch information
bostrot authored Nov 11, 2024
2 parents 16f6ef0 + dae7af6 commit de60697
Show file tree
Hide file tree
Showing 9 changed files with 204 additions and 169 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/publisher.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
description: Empty for latest tag or specify a tag to publish
type: string
release:
types: [published]
types: [created]

jobs:
# Publish to Microsoft Store
Expand Down
13 changes: 8 additions & 5 deletions lib/api/wsl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ class WSLApi {
{String startPath = '',
String startUser = '',
String startCmd = ''}) async {
List<String> args = ['wsl', '-d', distribution];
List<String> args = [];
args.addAll(['wsl', '-d', distribution]);
if (startPath != '') {
args.addAll(['--cd', startPath]);
}
Expand All @@ -91,7 +92,6 @@ class WSLApi {
}
await Process.start('start', args,
mode: ProcessStartMode.detached, runInShell: true);

if (kDebugMode) {
print("Done starting $distribution");
}
Expand Down Expand Up @@ -201,12 +201,15 @@ class WSLApi {
mode: ProcessStartMode.normal, runInShell: true);
}

/// Start Windows Terminal\
/// *(falls back to PowerShell on exception)*
/// Start Windows Terminal or PowerShell
void startWindowsTerminal(String distribution) async {
List<String> launchWslHome = ['wsl', '-d', distribution, '--cd', '~'];
try {
await Process.start('wt', launchWslHome);
// Run windows terminal in same window wt -w 0 nt
var args = ['wt', '-w', '0', 'nt'];
args.addAll(launchWslHome);

await Process.run('start', args);
} catch (_) {
// Windows Terminal not installed
Notify.message('openwithwt-not-found-error'.i18n());
Expand Down
13 changes: 0 additions & 13 deletions lib/components/list_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -210,19 +210,6 @@ class Bar extends StatelessWidget {
),
),
),
Tooltip(
message: 'openwithwt-text'.i18n(),
child: MouseRegion(
cursor: SystemMouseCursors.click,
child: IconButton(
icon: const Icon(FluentIcons.power_shell, size: 16.0),
onPressed: () {
plausible.event(name: "wsl_wt");
WSLApi().startWindowsTerminal(widget.item);
},
),
),
),
Tooltip(
message: 'openwithvscode-text'.i18n(),
child: MouseRegion(
Expand Down
13 changes: 9 additions & 4 deletions lib/nav/panelist.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ final List<NavigationPaneItem> originalItems = [
title: Text('homepage-text'.i18n()),
body: const SizedBox.shrink(),
onTap: () {
if (router.location != '/') router.pushNamed('home');
if (router.routerDelegate.currentConfiguration.uri.toString() != '/') {
router.pushNamed('home');
}
},
),
PaneItem(
Expand All @@ -23,7 +25,8 @@ final List<NavigationPaneItem> originalItems = [
title: Text('managequickactions-text'.i18n()),
body: const SizedBox.shrink(),
onTap: () {
if (router.location != '/quickactions') {
if (router.routerDelegate.currentConfiguration.uri.toString() !=
'/quickactions') {
router.pushNamed('quickactions');
}
},
Expand All @@ -34,7 +37,8 @@ final List<NavigationPaneItem> originalItems = [
title: Text('templates-text'.i18n()),
body: const SizedBox.shrink(),
onTap: () {
if (router.location != '/templates') {
if (router.routerDelegate.currentConfiguration.uri.toString() !=
'/templates') {
router.pushNamed('templates');
}
},
Expand Down Expand Up @@ -63,7 +67,8 @@ final List<NavigationPaneItem> footerItems = [
title: Text('settings-text'.i18n()),
body: const SizedBox.shrink(),
onTap: () {
if (router.location != '/settings') router.pushNamed('settings');
if (router.routerDelegate.currentConfiguration.uri.toString() !=
'/settings') router.pushNamed('settings');
},
),
LinkPaneItemAction(
Expand Down
2 changes: 1 addition & 1 deletion lib/nav/root_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ class RootPageState extends State<RootPage> with WindowListener {
}

int _calculateSelectedIndex(BuildContext context) {
final location = router.location;
final location = router.routerDelegate.currentConfiguration.uri.toString();
int indexOriginal = originalItems
.toList()
.indexWhere((element) => element.key == Key(location));
Expand Down
Loading

0 comments on commit de60697

Please sign in to comment.