I am writing a ncurses program in C++, which allows the user to press keybindings to execute tasks. However, because there are too many keybindings, I decided to add some modifier keys. One of the most used modifiers is the Shift key. However, I have to implement a way to detect whether Shift is pressed or not.
This is a sample program I've been trying:
#include <ncurses.h>
int main() {
initscr();
raw();
noecho();
char ch = getch();
printw("%c", ch);
refresh();
getch();
endwin();
}
When I press Ctrl-a, it shows ^A. Then, I tried Ctrl-Shift-a, but I still got ^A. I also tried a bunch of other keys, but it seemed like my program cannot distinguish between Ctrl-key and Ctrl-Shift-key events.
Is there a way to detect the Shift key? Thanks in advance!