Skip to content

Commit

Permalink
-d 3 option for excluding current desktop
Browse files Browse the repository at this point in the history
related: #55
  • Loading branch information
sagb committed Mar 27, 2018
1 parent e14f76b commit 1b37d33
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 6 deletions.
5 changes: 4 additions & 1 deletion doc/alttab.1
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ resource: alttab\.desktops
default: \fI0\fR
.
.IP
Show windows belonging to desktops (workspaces, groups)\. \fINUMBER\fR must be 0, 1 or 2:
Show windows belonging to desktops (workspaces, groups)\. \fINUMBER\fR must be between 0 and 3:
.
.IP
\fI0\fR: Current desktop\.
Expand All @@ -83,6 +83,9 @@ Doesn\'t work in ratpoison\.
.IP
In various EWMH WM this desktop may be designed hidden or containing sticky windows\. In i3, it\'s "scratchpad"\.
.
.IP
\fI3\fR: All desktops, excluding current one\.
.
.TP
\fB\-sc\fR \fINUMBER\fR
resource: alttab\.screens
Expand Down
4 changes: 3 additions & 1 deletion doc/alttab.1.ronn
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Most command line options have corresponding X resource, see doc/alttab.ad for e
resource: alttab.desktops
default: <0>

Show windows belonging to desktops (workspaces, groups). <NUMBER> must be 0, 1 or 2:
Show windows belonging to desktops (workspaces, groups). <NUMBER> must be between 0 and 3:

<0>: Current desktop.

Expand All @@ -88,6 +88,8 @@ Most command line options have corresponding X resource, see doc/alttab.ad for e
In various EWMH WM this desktop may be designed hidden
or containing sticky windows. In i3, it's "scratchpad".

<3>: All desktops, excluding current one.

* `-sc` <NUMBER>:
resource: alttab.screens
default: <1>
Expand Down
4 changes: 2 additions & 2 deletions src/alttab.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ void helpexit()
fprintf(stderr, "alttab, the task switcher.\n\
Options:\n\
-w N window manager: 0=no, 1=ewmh-compatible, 2=ratpoison, 3=old fashion\n\
-d N desktop: 0=current 1=all, 2=all but special\n\
-d N desktop: 0=current 1=all, 2=all but special, 3=all but current\n\
-sc N screen: 0=current 1=all\n\
-mm N main modifier mask\n\
-bm N backward scroll modifier mask\n\
-kk N keysym of main modifier\n\
-mk N keysym of main key\n\
-t NxM tile geometry\n\
-i NxM icon geometry\n\
-vp geo switcher viewport: focus, pointer, total, WxH+X+Y\n\
-vp str switcher viewport: focus, pointer, total, WxH+X+Y\n\
-p str switcher position: center, none, +X+Y\n\
-s N icon source: 0=X11 only, 1=fallback to files, 2=best size, 3=files only\n\
-theme name icon theme\n\
Expand Down
3 changes: 2 additions & 1 deletion src/alttab.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,8 @@ typedef struct {
#define DESK_CURRENT 0
#define DESK_ALL 1
#define DESK_NOSPECIAL 2
#define DESK_MAX 2
#define DESK_NOCURRENT 3
#define DESK_MAX 3
#define DESK_DEFAULT DESK_CURRENT
int option_desktop;
#define SCR_MIN 0
Expand Down
7 changes: 7 additions & 0 deletions src/ewmh.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,13 @@ int ewmh_initWinlist(quad screen)
}
continue;
}
if (g.option_desktop == DESK_NOCURRENT
&& current_desktop == window_desktop) {
if (g.debug > 1) {
fprintf (stderr, "window on current desktop, skipped\n");
}
continue;
}

if (g.option_screen == SCR_CURRENT) {
if (! get_absolute_coordinates(w, &wq)) {
Expand Down
2 changes: 1 addition & 1 deletion src/win.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ along with alttab. If not, see <http://www.gnu.org/licenses/>.
#include <unistd.h>
#include <string.h>
#include <utlist.h>
#include <sys/time.h>
//#include <sys/time.h>
#include "alttab.h"
#include "util.h"
extern Globals g;
Expand Down

0 comments on commit 1b37d33

Please sign in to comment.