Merge pull request #1068 from keyboardio/hostos/macos

pull/1054/head
Jesse Vincent 3 years ago committed by GitHub
commit 735f019e20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,7 +40,7 @@ EventHandlerResult AppSwitcher::onKeyEvent(KeyEvent &event) {
// If AppSwitcher was not already active, hold its modifier first. // If AppSwitcher was not already active, hold its modifier first.
if (!active_addr_.isValid()) { if (!active_addr_.isValid()) {
if (::HostOS.os() == hostos::OSX) { if (::HostOS.os() == hostos::MACOS) {
event.key = Key_LeftGui; event.key = Key_LeftGui;
} else { } else {
event.key = Key_LeftAlt; event.key = Key_LeftAlt;

@ -25,8 +25,8 @@ void someFunction(void) {
if (HostOS.os() == kaleidoscope::hostos::LINUX) { if (HostOS.os() == kaleidoscope::hostos::LINUX) {
// do something linux-y // do something linux-y
} }
if (HostOS.os() == kaleidoscope::hostos::OSX) { if (HostOS.os() == kaleidoscope::hostos::MACOS) {
// do something OSX-y // do something macOS-y
} }
} }
@ -55,10 +55,13 @@ The extension provides the following methods on the `HostOS` singleton:
The OS type (i.e. the return type of `.os()` and the arguments to `.os(type)`) will be one of the following: The OS type (i.e. the return type of `.os()` and the arguments to `.os(type)`) will be one of the following:
- `kaleidoscope::hostos::LINUX` - `kaleidoscope::hostos::LINUX`
- `kaleidoscope::hostos::OSX` - `kaleidoscope::hostos::MACOS`
- `kaleidoscope::hostos::WINDOWS` - `kaleidoscope::hostos::WINDOWS`
- `kaleidoscope::hostos::OTHER` - `kaleidoscope::hostos::OTHER`
For compability reasons, `kaleidoscope::hostos::OSX` is an alias to
`kaleidoscope::hostos::MACOS`.
## Focus commands ## Focus commands
The plugin provides the `FocusHostOSCommand` object, which, when enabled, The plugin provides the `FocusHostOSCommand` object, which, when enabled,

@ -1,6 +1,6 @@
/* -*- mode: c++ -*- /* -*- mode: c++ -*-
* Kaleidoscope-HostOS -- Host OS detection and tracking for Kaleidoscope * Kaleidoscope-HostOS -- Host OS detection and tracking for Kaleidoscope
* Copyright (C) 2016, 2017, 2018 Keyboard.io, Inc * Copyright (C) 2016-2021 Keyboard.io, Inc
* *
* This program is free software: you can redistribute it and/or modify it under * This program is free software: you can redistribute it and/or modify it under
* the terms of the GNU General Public License as published by the Free Software * the terms of the GNU General Public License as published by the Free Software
@ -25,7 +25,8 @@ namespace hostos {
typedef enum { typedef enum {
LINUX, LINUX,
OSX, MACOS,
OSX = MACOS,
WINDOWS, WINDOWS,
OTHER, OTHER,

@ -43,7 +43,7 @@ void Unicode::start(void) {
kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_KeypadAdd); kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_KeypadAdd);
kaleidoscope::Runtime.hid().keyboard().sendReport(); kaleidoscope::Runtime.hid().keyboard().sendReport();
break; break;
case hostos::OSX: case hostos::MACOS:
kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftAlt); kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftAlt);
break; break;
default: default:
@ -57,7 +57,7 @@ void Unicode::input(void) {
case hostos::LINUX: case hostos::LINUX:
break; break;
case hostos::WINDOWS: case hostos::WINDOWS:
case hostos::OSX: case hostos::MACOS:
kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftAlt); kaleidoscope::Runtime.hid().keyboard().pressRawKey(Key_LeftAlt);
break; break;
default: default:
@ -76,7 +76,7 @@ void Unicode::end(void) {
kaleidoscope::Runtime.hid().keyboard().sendReport(); kaleidoscope::Runtime.hid().keyboard().sendReport();
break; break;
case hostos::WINDOWS: case hostos::WINDOWS:
case hostos::OSX: case hostos::MACOS:
kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_LeftAlt); kaleidoscope::Runtime.hid().keyboard().releaseRawKey(Key_LeftAlt);
kaleidoscope::Runtime.hid().keyboard().sendReport(); kaleidoscope::Runtime.hid().keyboard().sendReport();
break; break;

Loading…
Cancel
Save