Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
doteq committed Oct 25, 2020
2 parents cb20759 + 62e94f3 commit 71c1643
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/main/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* global __static */

import {
app, protocol, BrowserWindow, Menu, Tray, nativeImage, shell,
app, protocol, BrowserWindow, Menu, Tray, nativeImage, shell, globalShortcut,
} from 'electron';
import { createProtocol } from 'vue-cli-plugin-electron-builder/lib';
import installExtension, { VUEJS_DEVTOOLS } from 'electron-devtools-installer';
Expand Down Expand Up @@ -163,7 +163,7 @@ function createWindow() {
trackerManager.stopPreview();
});

Menu.setApplicationMenu(null)
Menu.setApplicationMenu(null);
}

app.whenReady().then(() => {
Expand Down Expand Up @@ -261,6 +261,10 @@ if (instanceLock) {
}

createOverlayWindow();

globalShortcut.register('CommandOrControl+Alt+F', () => {
if (configStore.get('shortcutEnabled')) trackerManager.removeLastTouch();
});
});
} else {
app.quit();
Expand Down
4 changes: 4 additions & 0 deletions src/main/stores/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ const schema = {
touchesPerHourTilePeriod: {
type: 'number',
},
shortcutEnabled: {
type: 'boolean',
},
};

const defaults = {
Expand All @@ -75,6 +78,7 @@ const defaults = {
darkTheme: false,
recentTouchesTilePeriod: 1,
touchesPerHourTilePeriod: 24,
shortcutEnabled: true,
};

export default function createConfigStore(path) {
Expand Down
12 changes: 12 additions & 0 deletions src/main/tracker-manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path';
import { GifFrame, GifUtil } from 'gifwrap';
import jimp from 'jimp';
import fs from 'fs';
import _ from 'lodash';
import Kinect from './trackers/kinect';
import Webcam from './trackers/webcam';

Expand Down Expand Up @@ -303,4 +304,15 @@ export default class TrackerManager extends EventEmitter {
});
this.trackingStore.set('touches', touches);
}

async removeLastTouch() {
if (this.touchEvent === null) {
const touches = this.trackingStore.get('touches');
this.trackingStore.set('touches', _.initial(touches));
} else {
this.touchEvent = null;
this.touchStreak = 0;
this.$emit('touch-event-update', false);
}
}
}
10 changes: 8 additions & 2 deletions src/renderer/components/settings/AlertSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
</template>
</v-slider>
</v-list-item>
<v-list-item link>
<v-list-item @click="toggleShortcut">
<v-list-item-content>
<v-list-item-title>
Enable false alert shortcut
Expand All @@ -71,7 +71,7 @@
</v-list-item-content>
<v-list-item-action>
<v-switch
:input-value="false"
:input-value="shortcutEnabled"
readonly
/>
</v-list-item-action>
Expand Down Expand Up @@ -115,6 +115,9 @@
saveGifs() {
return this.$store.state.config.saveGifs;
},
shortcutEnabled() {
return this.$store.state.config.shortcutEnabled;
},
},
created() {
this.playAlertDebounced = _.debounce(this.playAlert, 350);
Expand Down Expand Up @@ -142,6 +145,9 @@
toggleSaveGifs() {
this.$comm.setConfigItem('saveGifs', !this.saveGifs);
},
toggleShortcut() {
this.$comm.setConfigItem('shortcutEnabled', !this.shortcutEnabled);
},
},
};
</script>

0 comments on commit 71c1643

Please sign in to comment.