Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move the desktop left or right #27

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Hotkeys:
CTRL + 1..4 -> moves active window to desktop 1..4
ALT + CTRL + SHIFT + Q -> exits the program
ALT + CTRL + SHIFT + S -> starts/stops handling of other hotkeys
ALT + ← / → -> move the desktop left or right

the nerds can build it with

Expand Down
8 changes: 8 additions & 0 deletions virgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,8 @@ static void virgo_init(Virgo *v)
'Q');
register_hotkey(i * 2 + 1, MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_NOREPEAT,
'S');
register_hotkey(i * 2 + 2, MOD_ALT | MOD_NOREPEAT, VK_LEFT);
register_hotkey(i * 2 + 3, MOD_ALT | MOD_NOREPEAT, VK_RIGHT);
trayicon_init(&v->trayicon);
}

Expand Down Expand Up @@ -312,6 +314,12 @@ void __main(void)
}
if (msg.wParam == NUM_DESKTOPS * 2 + 1) {
virgo_toggle_hotkeys(&v);
} else if (msg.wParam == NUM_DESKTOPS * 2 + 2) {
unsigned target_desk = (v.current - 1) % NUM_DESKTOPS;
virgo_go_to_desk(&v, target_desk);
} else if (msg.wParam == NUM_DESKTOPS * 2 + 3) {
unsigned target_desk = (v.current + 1) % NUM_DESKTOPS;
virgo_go_to_desk(&v, target_desk);
} else if (msg.wParam % 2 == 0) {
virgo_go_to_desk(&v, msg.wParam / 2);
} else {
Expand Down