Skip to content

Commit

Permalink
hyper key
Browse files Browse the repository at this point in the history
  • Loading branch information
wwwjfy committed Jan 1, 2017
1 parent 5fd3fc7 commit 956ddf3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
{
"name": "fn"
},
{
"name": "hyper"
},
{
"category": "Controls and symbols"
},
Expand Down
15 changes: 15 additions & 0 deletions src/core/grabber/include/manipulator/event_manipulator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ class event_manipulator final {
return;
}

if (post_hyper_key(to_key_code, pressed)) {
return;
}

if (post_modifier_flag_event(to_key_code, pressed)) {
return;
}
Expand Down Expand Up @@ -406,6 +410,17 @@ class event_manipulator final {
return false;
}

bool post_hyper_key(krbn::key_code key_code, bool pressed) {
if (key_code == krbn::key_code::hyper) {
post_modifier_flag_event(krbn::key_code(kHIDUsage_KeyboardLeftControl), pressed);
post_modifier_flag_event(krbn::key_code(kHIDUsage_KeyboardLeftShift), pressed);
post_modifier_flag_event(krbn::key_code(kHIDUsage_KeyboardLeftAlt), pressed);
post_modifier_flag_event(krbn::key_code(kHIDUsage_KeyboardLeftGUI), pressed);
return true;
}
return false;
}

bool post_modifier_flag_event(krbn::key_code key_code, bool pressed) {
auto operation = pressed ? manipulator::modifier_flag_manager::operation::increase : manipulator::modifier_flag_manager::operation::decrease;

Expand Down
2 changes: 2 additions & 0 deletions src/share/types.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ enum class key_code : uint32_t {

// Keys that are not in generic keyboard_or_keypad usage_page.
fn,
hyper,
display_brightness_decrement,
display_brightness_increment,
dashboard,
Expand Down Expand Up @@ -442,6 +443,7 @@ class types final {
{"vk_none", key_code::vk_none},

{"fn", key_code::fn},
{"hyper", key_code::hyper},
{"display_brightness_decrement", key_code::display_brightness_decrement},
{"display_brightness_increment", key_code::display_brightness_increment},
{"mission_control", key_code::mission_control},
Expand Down

0 comments on commit 956ddf3

Please sign in to comment.