feat: add switch window like gnome alt+tab
This commit is contained in:
@@ -28,6 +28,7 @@ static int log_level = WLR_ERROR;
|
|||||||
static const unsigned int numlockon = 1; // Enable numlock
|
static const unsigned int numlockon = 1; // Enable numlock
|
||||||
static const unsigned int hotarea_size = 10; // Hot area size, 10x10
|
static const unsigned int hotarea_size = 10; // Hot area size, 10x10
|
||||||
static const unsigned int enable_hotarea = 1; // Enable mouse hot area
|
static const unsigned int enable_hotarea = 1; // Enable mouse hot area
|
||||||
|
static const unsigned int ov_tab_mode = 1; // Enable switch window like gnome alt+tab
|
||||||
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
static int smartgaps = 0; /* 1 means no outer gap when there is only one window */
|
||||||
static int sloppyfocus = 1; /* Focus follows mouse */
|
static int sloppyfocus = 1; /* Focus follows mouse */
|
||||||
static unsigned int gappih = 5; /* Horizontal inner gap between windows */
|
static unsigned int gappih = 5; /* Horizontal inner gap between windows */
|
||||||
@@ -252,7 +253,7 @@ static const Button buttons[] = {
|
|||||||
{ 0, BTN_MIDDLE, togglefakefullscreen, {0} }, // Middle button triggers fake fullscreen
|
{ 0, BTN_MIDDLE, togglefakefullscreen, {0} }, // Middle button triggers fake fullscreen
|
||||||
{ WLR_MODIFIER_LOGO, BTN_RIGHT, moveresize, {.ui = CurResize } },
|
{ WLR_MODIFIER_LOGO, BTN_RIGHT, moveresize, {.ui = CurResize } },
|
||||||
{ WLR_MODIFIER_ALT|WLR_MODIFIER_CTRL, BTN_LEFT, spawn, SHCMD("bash ~/tool/shotTranslate.sh shot")},
|
{ WLR_MODIFIER_ALT|WLR_MODIFIER_CTRL, BTN_LEFT, spawn, SHCMD("bash ~/tool/shotTranslate.sh shot")},
|
||||||
{ 0, BTN_LEFT, toggleoverview, {0} },
|
{ 0, BTN_LEFT, toggleoverview, {.i = -1 } },
|
||||||
{ 0, BTN_RIGHT, killclient, {0} },
|
{ 0, BTN_RIGHT, killclient, {0} },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
22
main.c
22
main.c
@@ -2810,6 +2810,17 @@ keypress(struct wl_listener *listener, void *data) {
|
|||||||
uint32_t mods = wlr_keyboard_get_modifiers(kb->wlr_keyboard);
|
uint32_t mods = wlr_keyboard_get_modifiers(kb->wlr_keyboard);
|
||||||
|
|
||||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
|
||||||
|
// ov tab mode detect moe key release
|
||||||
|
if (ov_tab_mode && !locked && event->state == WL_KEYBOARD_KEY_STATE_RELEASED &&
|
||||||
|
(keycode == 133 || keycode == 37 || keycode == 64 || keycode == 50 ||
|
||||||
|
keycode == 134 || keycode == 105 || keycode == 108 || keycode == 62) &&
|
||||||
|
selmon->sel) {
|
||||||
|
if(selmon->isoverview && selmon->sel) {
|
||||||
|
toggleoverview(&(Arg){.i=-1});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef IM
|
#ifdef IM
|
||||||
if (!locked && event->state == WL_KEYBOARD_KEY_STATE_RELEASED &&
|
if (!locked && event->state == WL_KEYBOARD_KEY_STATE_RELEASED &&
|
||||||
(keycode == 133 || keycode == 37 || keycode == 64 || keycode == 50 ||
|
(keycode == 133 || keycode == 37 || keycode == 64 || keycode == 50 ||
|
||||||
@@ -4633,6 +4644,12 @@ void overview_restore(Client *c, const Arg *arg) {
|
|||||||
void toggleoverview(const Arg *arg) {
|
void toggleoverview(const Arg *arg) {
|
||||||
|
|
||||||
Client *c;
|
Client *c;
|
||||||
|
|
||||||
|
if(selmon->isoverview && ov_tab_mode && arg->i != -1 && selmon->sel) {
|
||||||
|
focusstack(&(Arg){.i=1});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
selmon->isoverview ^= 1;
|
selmon->isoverview ^= 1;
|
||||||
unsigned int target;
|
unsigned int target;
|
||||||
unsigned int visible_client_number = 0;
|
unsigned int visible_client_number = 0;
|
||||||
@@ -4674,6 +4691,11 @@ void toggleoverview(const Arg *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
view(&(Arg){.ui = target}, false);
|
view(&(Arg){.ui = target}, false);
|
||||||
|
|
||||||
|
if (ov_tab_mode && selmon->isoverview && selmon->sel) {
|
||||||
|
focusstack(&(Arg){.i=1});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void tile(Monitor *m, unsigned int gappo, unsigned int uappi) {
|
void tile(Monitor *m, unsigned int gappo, unsigned int uappi) {
|
||||||
|
|||||||
Reference in New Issue
Block a user