diff options
| author | Guido Cella <guidocella91@gmail.com> | 2020-07-24 17:12:41 +0200 | 
|---|---|---|
| committer | Guido Cella <guidocella91@gmail.com> | 2020-07-24 17:30:45 +0200 | 
| commit | 7b608da8c5b159c9a905fb3be3a5cde34ea3adc7 (patch) | |
| tree | 605b3534963dce419dd8821da311bc84084fc637 /dwl.c | |
| parent | 53798dfbff8c8352e42be2f9c400cb4b66ca28fe (diff) | |
Add zoom
Diffstat (limited to 'dwl.c')
| -rw-r--r-- | dwl.c | 30 | 
1 files changed, 30 insertions, 0 deletions
| @@ -211,6 +211,7 @@ static void unmapnotify(struct wl_listener *listener, void *data);  static void view(const Arg *arg);  static Client *xytoclient(double x, double y);  static Monitor *xytomon(double x, double y); +static void zoom(const Arg *arg);  /* variables */  static const char broken[] = "broken"; @@ -1636,6 +1637,35 @@ xytomon(double x, double y)  	return o ? o->data : NULL;  } +void +zoom(const Arg *arg) +{ +	unsigned int n = 0; +	Client *c, *sel = selclient(); + +	if (!sel || !selmon->lt[selmon->sellt]->arrange || sel->isfloating) +		return; + +	wl_list_for_each(c, &clients, link) +		if (VISIBLEON(c, selmon) && !c->isfloating) { +			if (++n == 1 && c == sel) +				sel = NULL; +			else if (n == 2) { +				if (!sel) +					sel = c; +				break; +			} +		} + +	if (n == 1) +		return; + +	wl_list_remove(&sel->link); +	wl_list_insert(&clients, &sel->link); +	focusclient(sel, NULL, 1); +	arrange(selmon); +} +  int  main(int argc, char *argv[])  { | 
