Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ env:
jobs:
build-windows:
name: Build Windows
runs-on: windows-2022
runs-on: windows-latest

# ----------------------------------- Setup ------------------------------ #

Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,16 @@ jobs:
with:
pre-release: true
secrets: inherit
# call-build-windows:
# needs: call-tests
# uses: ./.github/workflows/build-windows.yml
# with:
# pre-release: true
# secrets: inherit
call-build-windows:
needs: call-tests
uses: ./.github/workflows/build-windows.yml
with:
pre-release: true
secrets: inherit

pre-release:
name: "Pre Release"
# needs: [call-build-linux, call-build-windows]
needs: [call-build-linux]
needs: [call-build-linux, call-build-windows]
runs-on: "ubuntu-latest"

steps:
Expand All @@ -53,4 +52,4 @@ jobs:
title: "Development Build"
files: |
${{ github.workspace }}/artifacts/linux-artifacts/*
# ${{ github.workspace }}/artifacts/windows-artifacts/*
${{ github.workspace }}/artifacts/windows-artifacts/*
15 changes: 7 additions & 8 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@ jobs:
with:
pre-release: true
secrets: inherit
# call-build-windows:
# needs: call-tests
# uses: ./.github/workflows/build-windows.yml
# with:
# pre-release: true
# secrets: inherit
call-build-windows:
needs: call-tests
uses: ./.github/workflows/build-windows.yml
with:
pre-release: true
secrets: inherit

verify-pull-request:
name: Verify Pull Request
# needs: [call-tests, call-build-linux, call-build-windows]
needs: [call-tests, call-build-linux]
needs: [call-tests, call-build-linux, call-build-windows]
runs-on: ubuntu-latest
steps:
- run: echo "Requirements passed, PR looks good!"
6 changes: 3 additions & 3 deletions .github/workflows/release-windows-store.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
# Enable manual run
workflow_dispatch:
# Build & deploy for published releases
# release:
# types:
# - published
release:
types:
- published

concurrency:
group: ci-release-${{ github.ref }}-1
Expand Down
17 changes: 8 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,16 @@ jobs:
with:
pre-release: false
secrets: inherit
# call-build-windows:
# needs: call-tests
# uses: ./.github/workflows/build-windows.yml
# with:
# pre-release: false
# secrets: inherit
call-build-windows:
needs: call-tests
uses: ./.github/workflows/build-windows.yml
with:
pre-release: false
secrets: inherit

release:
name: "Release"
# needs: [call-build-linux, call-build-windows]
needs: [call-build-linux]
needs: [call-build-linux, call-build-windows]
runs-on: "ubuntu-latest"

steps:
Expand All @@ -51,4 +50,4 @@ jobs:
prerelease: false
files: |
${{ github.workspace }}/artifacts/linux-artifacts/*
# ${{ github.workspace }}/artifacts/windows-artifacts/*
${{ github.workspace }}/artifacts/windows-artifacts/*
4 changes: 1 addition & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]

os: [ubuntu-latest, windows-latest]
steps:
- uses: actions/checkout@v3
- uses: subosito/flutter-action@v2
Expand Down
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ Unfortunately no. [CRIU](https://criu.org/) looks very promising to allow us to

## Troubleshooting

The Windows version is unlikely to receive further updates, and is not as stable
as the Linux version.

If you use Microsoft Windows, issues are often resolved by running Nyrna as an
administrator.
If you use Microsoft Windows, issues are often resolved by running Nyrna as an administrator.


## Building
Expand Down
9 changes: 4 additions & 5 deletions lib/app/cubit/app_cubit.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ class AppCubit extends Cubit<AppState> {
/// Lazy loading is used instead of awaiting on a constructor to avoid
/// blocking the UI, since none of the data fetched here is critical.
Future<void> _init() async {
// Set up tray listener immediately so no events are missed while the
// async initialization below is in progress.
_listenToSystemTrayEvents();
await _checkForFirstRun();
_checkLinuxSessionType();
await _fetchVersionData();
await _fetchReleaseNotes();
_listenToSystemTrayEvents();
}

/// Checks if this is the first run of the app.
Expand Down Expand Up @@ -129,10 +131,6 @@ Otherwise, [consider signing in using X11 instead](https://docs.fedoraproject.or

/// Fetches version data from the update service.
Future<void> _fetchVersionData() async {
// Windows version is not being supported for future updates, so we skip fetching
// version data for Windows so they don't get an "update available" message.
if (Platform.isWindows) return;

final VersionInfo versionInfo;
try {
versionInfo = await _updateService.getVersionInfo();
Expand All @@ -155,6 +153,7 @@ Otherwise, [consider signing in using X11 instead](https://docs.fedoraproject.or
/// Fetches release notes from the release notes service.
Future<void> _fetchReleaseNotes() async {
if (state.firstRun) return;
if (state.runningVersion.isEmpty) return;

final String? lastReleaseNotesVersionShown = await _storageRepository.getValue(
'lastReleaseNotesVersionShown',
Expand Down
1 change: 1 addition & 0 deletions lib/hotkey/hotkey.dart
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export 'global/global.dart';
export 'hotkey_label.dart';
export 'in_app/in_app.dart';
76 changes: 76 additions & 0 deletions lib/hotkey/hotkey_label.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import 'package:flutter/services.dart';
import 'package:hotkey_manager/hotkey_manager.dart';

/// Physical keys whose names are not available in release builds via
/// [PhysicalKeyboardKey.debugName] (which is assert-only in Flutter) and are
/// also absent from hotkey_manager's built-in label map.
final _extraPhysicalKeyLabels = <PhysicalKeyboardKey, String>{
PhysicalKeyboardKey.pause: 'Pause',
PhysicalKeyboardKey.insert: 'Insert',
PhysicalKeyboardKey.printScreen: 'Print Screen',
PhysicalKeyboardKey.scrollLock: 'Scroll Lock',
PhysicalKeyboardKey.numLock: 'Num Lock',
PhysicalKeyboardKey.numpadAdd: 'Num +',
PhysicalKeyboardKey.numpadSubtract: 'Num -',
PhysicalKeyboardKey.numpadMultiply: 'Num *',
PhysicalKeyboardKey.numpadDivide: 'Num /',
PhysicalKeyboardKey.numpadEnter: 'Num Enter',
PhysicalKeyboardKey.numpadDecimal: 'Num .',
PhysicalKeyboardKey.numpad0: 'Num 0',
PhysicalKeyboardKey.numpad1: 'Num 1',
PhysicalKeyboardKey.numpad2: 'Num 2',
PhysicalKeyboardKey.numpad3: 'Num 3',
PhysicalKeyboardKey.numpad4: 'Num 4',
PhysicalKeyboardKey.numpad5: 'Num 5',
PhysicalKeyboardKey.numpad6: 'Num 6',
PhysicalKeyboardKey.numpad7: 'Num 7',
PhysicalKeyboardKey.numpad8: 'Num 8',
PhysicalKeyboardKey.numpad9: 'Num 9',
PhysicalKeyboardKey.f13: 'F13',
PhysicalKeyboardKey.f14: 'F14',
PhysicalKeyboardKey.f15: 'F15',
PhysicalKeyboardKey.f16: 'F16',
PhysicalKeyboardKey.f17: 'F17',
PhysicalKeyboardKey.f18: 'F18',
PhysicalKeyboardKey.f19: 'F19',
PhysicalKeyboardKey.f20: 'F20',
PhysicalKeyboardKey.f21: 'F21',
PhysicalKeyboardKey.f22: 'F22',
PhysicalKeyboardKey.f23: 'F23',
PhysicalKeyboardKey.f24: 'F24',
};

/// Human-readable labels for [HotKeyModifier] values.
///
/// [HotKeyModifier.physicalKeys] also relies on [PhysicalKeyboardKey.debugName]
/// indirectly, so we use a static map here instead.
const _modifierLabels = <HotKeyModifier, String>{
HotKeyModifier.alt: 'Alt',
HotKeyModifier.capsLock: '⇪',
HotKeyModifier.control: 'Ctrl',
HotKeyModifier.fn: 'fn',
HotKeyModifier.meta: '⊞',
HotKeyModifier.shift: 'Shift',
};

/// Returns a human-readable label for [hotKey] that is safe in release builds.
///
/// [HotKey.debugName] uses [PhysicalKeyboardKey.debugName] which is
/// assert-only and returns `null` outside of debug mode.
String hotkeyLabel(HotKey hotKey) {
PhysicalKeyboardKey? physicalKey;
if (hotKey.key is PhysicalKeyboardKey) {
physicalKey = hotKey.key as PhysicalKeyboardKey;
}

// hotkey_manager's KeyboardKeyExt.keyLabel covers most standard keys but
// also falls back to debugName for unknown ones, so we check our extended
// map first.
final keyName =
(physicalKey != null ? _extraPhysicalKeyLabels[physicalKey] : null) ??
hotKey.key.keyLabel;

final modifierNames = (hotKey.modifiers ?? []).map((m) => _modifierLabels[m] ?? m.name);

return [...modifierNames, keyName].join(' + ');
}
5 changes: 3 additions & 2 deletions lib/settings/widgets/integration_section.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:hotkey_manager/hotkey_manager.dart';
import '../../app/app.dart';
import '../../apps_list/apps_list.dart';
import '../../core/core.dart';
import '../../hotkey/hotkey.dart';
import '../../localization/app_localizations.dart';
import '../../native_platform/native_platform.dart';
import '../../theme/styles.dart';
Expand Down Expand Up @@ -169,7 +170,7 @@ class _HotkeyConfigWidget extends StatelessWidget {
),
child: BlocBuilder<SettingsCubit, SettingsState>(
builder: (context, state) {
return Text(state.hotKey.debugName);
return Text(hotkeyLabel(state.hotKey));
},
),
),
Expand Down Expand Up @@ -302,7 +303,7 @@ class _AppSpecificHotkeys extends StatelessWidget {
child: Card(
elevation: 2,
child: ListTile(
leading: Text(hotkey.hotkey.debugName),
leading: Text(hotkeyLabel(hotkey.hotkey)),
title: Text(hotkey.executable),
trailing: ElevatedButton(
onPressed: () => settingsCubit.removeAppSpecificHotkey(
Expand Down
4 changes: 4 additions & 0 deletions lib/system_tray/system_tray_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ class SystemTrayManager {
final _eventStreamController = StreamController<SystemTrayEvent>.broadcast();

Future<void> initialize() async {
if (defaultTargetPlatform.isWindows) {
await trayManager.setToolTip('Nyrna');
}

final String iconPath;

if (runningInFlatpak() || runningInSnap()) {
Expand Down
31 changes: 16 additions & 15 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -491,12 +491,13 @@ packages:
source: hosted
version: "0.2.0"
hotkey_manager_windows:
dependency: transitive
dependency: "direct overridden"
description:
name: hotkey_manager_windows
sha256: "0d03ced9fe563ed0b68f0a0e1b22c9ffe26eb8053cb960e401f68a4f070e0117"
url: "https://pub.dev"
source: hosted
path: "packages/hotkey_manager_windows"
ref: a031e87df1ae03a2dd13bb03ea2cc2e5b484a0a7
resolved-ref: a031e87df1ae03a2dd13bb03ea2cc2e5b484a0a7
url: "https://github.com/Merrit/hotkey_manager.git"
source: git
version: "0.2.0"
http:
dependency: "direct main"
Expand Down Expand Up @@ -644,10 +645,10 @@ packages:
dependency: transitive
description:
name: matcher
sha256: "12956d0ad8390bbcc63ca2e1469c0619946ccb52809807067a7020d57e647aa6"
sha256: dc0b7dc7651697ea4ff3e69ef44b0407ea32c487a39fff6a4004fa585e901861
url: "https://pub.dev"
source: hosted
version: "0.12.18"
version: "0.12.19"
material_color_utilities:
dependency: transitive
description:
Expand All @@ -668,10 +669,10 @@ packages:
dependency: transitive
description:
name: meta
sha256: "23f08335362185a5ea2ad3a4e597f1375e78bce8a040df5c600c8d3552ef2394"
sha256: "1741988757a65eb6b36abe716829688cf01910bbf91c34354ff7ec1c3de2b349"
url: "https://pub.dev"
source: hosted
version: "1.17.0"
version: "1.18.0"
mime:
dependency: transitive
description:
Expand Down Expand Up @@ -1089,26 +1090,26 @@ packages:
dependency: "direct dev"
description:
name: test
sha256: "54c516bbb7cee2754d327ad4fca637f78abfc3cbcc5ace83b3eda117e42cd71a"
sha256: "8d9ceddbab833f180fbefed08afa76d7c03513dfdba87ffcec2718b02bbcbf20"
url: "https://pub.dev"
source: hosted
version: "1.29.0"
version: "1.31.0"
test_api:
dependency: transitive
description:
name: test_api
sha256: "93167629bfc610f71560ab9312acdda4959de4df6fac7492c89ff0d3886f6636"
sha256: "949a932224383300f01be9221c39180316445ecb8e7547f70a41a35bf421fb9e"
url: "https://pub.dev"
source: hosted
version: "0.7.9"
version: "0.7.11"
test_core:
dependency: transitive
description:
name: test_core
sha256: "394f07d21f0f2255ec9e3989f21e54d3c7dc0e6e9dbce160e5a9c1a6be0e2943"
sha256: "1991d4cfe85d5043241acac92962c3977c8d2f2add1ee73130c7b286417d1d34"
url: "https://pub.dev"
source: hosted
version: "0.6.15"
version: "0.6.17"
tray_manager:
dependency: "direct main"
description:
Expand Down
5 changes: 5 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ dependency_overrides:
url: https://github.com/gepbird/hotkey_manager.git
path: packages/hotkey_manager_linux
ref: 1b31e3ca4ab017ee72f54a7065b2073a88403d61
hotkey_manager_windows:
git:
url: https://github.com/Merrit/hotkey_manager.git
path: packages/hotkey_manager_windows
ref: a031e87df1ae03a2dd13bb03ea2cc2e5b484a0a7

dev_dependencies:
build_runner: ^2.4.6
Expand Down
Loading
Loading