Skip to content

Commit

Permalink
Fix incorrect item text copy shortcut; build universal package
Browse files Browse the repository at this point in the history
  • Loading branch information
hsource committed Dec 4, 2023
1 parent f162e6f commit 8561586
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
42 changes: 42 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# How this works

There are 2 main parts of the app:

1. renderer: this is the HTML/Javascript-based UI rendered within the Electron container. This runs Vue.js, a React-like Javascript framework for rendering front-end.
2. main: includes the main app (written in Electron). Handles keyboard shortcuts, brings up the UI and overlays.

Note that these 2 both depend on each other, and one cannot run without the other.

# How to develop

The most up-to-date instructions can always be derived from CI:

[.github/workflows/main.yml](https://github.com/SnosMe/awakened-poe-trade/blob/master/.github/workflows/main.yml)

Here's what that looks like as of 2023-12-03.

```shell
cd renderer
yarn install
yarn make-index-files
yarn dev

# In a second shell
cd main
yarn install
yarn dev
```

# How to build

```shell
cd renderer
yarn install
yarn build

cd ../main
yarn build
# We want to sign with a distribution certificate to ensure other users can
# install without errors
CSC_NAME="Certificate name in Keychain" yarn package
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

### Development

Follow instructions similar to CI [.github/workflows/main.yml](https://github.com/SnosMe/awakened-poe-trade/blob/master/.github/workflows/main.yml)
See [DEVELOPING.md](./DEVELOPING.md)

### Acknowledgments

Expand Down
7 changes: 7 additions & 0 deletions main/electron-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ win:
linux:
target:
- "AppImage"
mac:
target:
- target: default
arch:
- universal
# MacOS apps can only be run on other systems if signed
forceCodeSigning: true
appImage:
executableArgs:
- "--sandbox"
8 changes: 5 additions & 3 deletions main/src/shortcuts/Shortcuts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,14 +223,16 @@ export class Shortcuts {
}

function pressKeysToCopyItemText (pressedModKeys: string[] = [], showModsKey: string) {
let keys = mergeTwoHotkeys('Ctrl + C', showModsKey).split(' + ')
const isMac = process.platform === 'darwin';
const copyModifier = isMac ? 'Meta' : 'Ctrl';
let keys = mergeTwoHotkeys(`${copyModifier} + C`, showModsKey).split(' + ')
keys = keys.filter(key => key !== 'C' && !pressedModKeys.includes(key))

for (const key of keys) {
uIOhook.keyToggle(UiohookKey[key as UiohookKeyT], 'down')
}

const allowedModifierKeys: Set<UiohookKeyT> = new Set(["Ctrl", "Alt", "Shift"]);
const allowedModifierKeys: Set<UiohookKeyT> = new Set(["Ctrl", "Alt", "Meta", "Shift"]);
const modifierKeys: number[] = keys
.filter((key) => allowedModifierKeys.has(key as UiohookKeyT))
.map((key) => UiohookKey[key as UiohookKeyT])
Expand All @@ -240,7 +242,7 @@ function pressKeysToCopyItemText (pressedModKeys: string[] = [], showModsKey: st
UiohookKey.C,
// On Mac, robotjs requires the modifiers to be specified in this way to
// register. See https://github.com/octalmage/robotjs/issues/208#issuecomment-223828356
process.platform === 'darwin' ? modifierKeys : undefined
isMac ? modifierKeys : undefined
)

keys.reverse()
Expand Down

0 comments on commit 8561586

Please sign in to comment.