diff options
| author | Abhinav Prasai <abhinav.prsai@gmail.com> | 2025-10-06 18:46:17 +0100 |
|---|---|---|
| committer | Abhinav Prasai <abhinav.prsai@gmail.com> | 2025-10-06 18:46:17 +0100 |
| commit | 1e221771eaa18f31401a4fbe1781fbb4f78c2608 (patch) | |
| tree | c75d0a9661b08dc20433edb88cb824da78ca73a4 | |
| parent | 55072d9876efbefdd3fa3d73cf122e32aa0b981a (diff) | |
add switch to previous workspace
| -rw-r--r-- | src/defs.h | 1 | ||||
| -rw-r--r-- | src/parser.c | 3 | ||||
| -rw-r--r-- | src/sxwm.c | 9 |
3 files changed, 11 insertions, 2 deletions
@@ -160,6 +160,7 @@ extern void resize_win_down(void); extern void resize_win_left(void); extern void resize_win_right(void); extern void resize_win_up(void); +extern void switch_previous_workspace(void); extern void toggle_floating(void); extern void toggle_floating_global(void); extern void toggle_fullscreen(void); diff --git a/src/parser.c b/src/parser.c index d48f084..a479705 100644 --- a/src/parser.c +++ b/src/parser.c @@ -48,7 +48,8 @@ static const CommandEntry call_table[] = { {"global_floating", toggle_floating_global}, {"fullscreen", toggle_fullscreen}, {"centre_window", centre_window}, - {NULL, NULL} + {"switch_previous_workspace", switch_previous_workspace}, + {NULL, NULL}, }; static void remap_and_dedupe_binds(Config *cfg) @@ -116,6 +116,7 @@ void spawn(const char * const *argv); void startup_exec(void); void swallow_window(Client *swallower, Client *swallowed); void swap_clients(Client *a, Client *b); +/* void switch_previous_workspace(void); */ void tile(void); /* void toggle_floating(void); */ /* void toggle_floating_global(void); */ @@ -191,12 +192,12 @@ Scratchpad scratchpads[MAX_SCRATCHPADS]; int scratchpad_count = 0; int current_scratchpad = 0; int n_mons = 0; +int previous_workspace = 0; int current_ws = 0; int current_mon = 0; Bool global_floating = False; Bool in_ws_switch = False; Bool running = False; -Bool next_should_float = False; long last_motion_time = 0; Mask numlock_mask = 0; @@ -396,6 +397,7 @@ void change_workspace(int ws) } } + previous_workspace = current_ws; current_ws = ws; for (Client *c = workspaces[current_ws]; c; c = c->next) { if (c->mapped) { @@ -2637,6 +2639,11 @@ void swap_clients(Client *a, Client *b) ta->next = tb_next == ta ? tb : tb_next; } +void switch_previous_workspace(void) +{ + change_workspace(previous_workspace); +} + void tile(void) { update_struts(); |
