Skip to content

Commit

Permalink
'修改快捷键,增加pr中自动聚焦'
Browse files Browse the repository at this point in the history
  • Loading branch information
choyy committed Jul 1, 2022
1 parent 17d7093 commit 4bc59e9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions virgo.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ typedef struct {
unsigned current;
unsigned handle_hotkeys;
Windows desktops[NUM_DESKTOPS];
HWND focused[NUM_DESKTOPS];
Trayicon trayicon;
} Virgo;

Expand Down Expand Up @@ -234,7 +235,7 @@ static void virgo_toggle_hotkeys(Virgo *v)
if (v->handle_hotkeys) {
for (i = 0; i < NUM_DESKTOPS; i++) {
register_hotkey(i * 2, MOD_ALT | MOD_NOREPEAT, i + 1 + '0');
register_hotkey(i * 2 + 1, MOD_CONTROL | MOD_NOREPEAT, i + 1 + '0');
register_hotkey(i * 2 + 1, MOD_ALT | MOD_SHIFT | MOD_NOREPEAT, i + 1 + '0');
}
} else {
for (i = 0; i < NUM_DESKTOPS; i++) {
Expand All @@ -250,7 +251,7 @@ static void virgo_init(Virgo *v)
v->handle_hotkeys = 1;
for (i = 0; i < NUM_DESKTOPS; i++) {
register_hotkey(i * 2, MOD_ALT | MOD_NOREPEAT, i + 1 + '0');
register_hotkey(i * 2 + 1, MOD_CONTROL | MOD_NOREPEAT, i + 1 + '0');
register_hotkey(i * 2 + 1, MOD_ALT | MOD_SHIFT | MOD_NOREPEAT, i + 1 + '0');
}
register_hotkey(i * 2, MOD_ALT | MOD_CONTROL | MOD_SHIFT | MOD_NOREPEAT,
'Q');
Expand Down Expand Up @@ -291,8 +292,10 @@ static void virgo_go_to_desk(Virgo *v, unsigned desk)
return;
}
virgo_update(v);
v->focused[v->current] = GetForegroundWindow();
windows_hide(&v->desktops[v->current]);
windows_show(&v->desktops[desk]);
SetForegroundWindow(v->focused[desk]);
v->current = desk;
trayicon_set(&v->trayicon, v->current + 1);
}
Expand Down

0 comments on commit 4bc59e9

Please sign in to comment.