Skip to content

Commit

Permalink
Changed default hotkeys
Browse files Browse the repository at this point in the history
  • Loading branch information
deobfuscate committed Feb 24, 2022
1 parent 2470619 commit 7ac0204
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 13 deletions.
22 changes: 10 additions & 12 deletions winhide.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ char ReadIniString(LPCSTR category, LPCSTR key, int default_value, const char* i
GetPrivateProfileStringA(category, key, LPCSTR(default_value), ini_value, 2, ini_path);
auto last_error = GetLastError();
if (last_error == false || last_error == ERROR_MORE_DATA)
value = VkKeyScanExA(ini_value[0], GetKeyboardLayout(0));
value = (char)VkKeyScanExA(ini_value[0], GetKeyboardLayout(0));
return value;
}

Expand Down Expand Up @@ -77,8 +77,8 @@ int main() {
int start_hidden = 0,
show_modifiers = NO_MOD,
hide_modifiers = NO_MOD;
char hide_key = KEY_B,
show_key = KEY_C,
char hide_key = KEY_C,
show_key = KEY_V,
cwd[BUFSIZ];
if (GetCurrentDirectoryA(BUFSIZ, cwd) == FALSE) {
cerr << "Could not obtain current working directory, exiting" << endl;
Expand All @@ -99,9 +99,8 @@ int main() {
hide_modifiers |= MOD_WIN;
hide_key = ReadIniString("HideHotKey", "Key", NULL, ini_path.c_str());
if (hide_key == KEY_INVALID || hide_key == NULL_CHAR || hide_modifiers == NO_MOD) {
hide_modifiers = MOD_ALT;
hide_key = KEY_B;
cerr << "Invalid hide key or no modifiers specified, using default: Alt-B" << endl;
hide_modifiers = MOD_CONTROL | MOD_SHIFT;
cerr << "Invalid hide key or no modifiers specified, using default: Ctrl+Shift+C" << endl;
}

if (ReadIniInt("ShowHotKey", "Alt", NO_MOD, ini_path.c_str()) == TRUE)
Expand All @@ -114,15 +113,14 @@ int main() {
show_modifiers |= MOD_WIN;
show_key = ReadIniString("ShowHotKey", "Key", NULL, ini_path.c_str());
if (show_key == KEY_INVALID || show_key == NULL_CHAR || show_modifiers == NO_MOD) {
show_modifiers = MOD_ALT;
show_key = KEY_C;
cerr << "Invalid show key or no modifiers specified, using default: Alt-C" << endl;
show_modifiers = MOD_CONTROL | MOD_SHIFT;
cerr << "Invalid show key or no modifiers specified, using default: Ctrl+Shift+V" << endl;
}
}
else {
cout << "Could not find configuration file winhidecfg.ini, using default settings. Hide window: Alt-B, Show window: Alt-C" << endl;
show_modifiers = MOD_ALT;
hide_modifiers = MOD_ALT;
cout << "Could not find configuration file winhidecfg.ini, using default settings. Hide window: Ctrl+Shift+C, Show window: Ctrl+Shift+V" << endl;
show_modifiers = MOD_CONTROL | MOD_SHIFT;
hide_modifiers = MOD_CONTROL | MOD_SHIFT;
}

if (RegisterHotKey(NULL, HOTKEY_HIDE, hide_modifiers | MOD_NOREPEAT, hide_key) &&
Expand Down
2 changes: 1 addition & 1 deletion winhide.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ using namespace std;
#define HOTKEY_HIDE 1
#define HOTKEY_SHOW 2

#define KEY_B 0x42
#define KEY_C 0x43
#define KEY_V 0x56
#define KEY_INVALID -1

#define NO_MOD 0
Expand Down

0 comments on commit 7ac0204

Please sign in to comment.