Hi,

When I work I like to watch movies, TV series and so on.
I like my mplayer window to be on all tagsets in the top-right
corner of the screen. So I wrote what I called the movie
layout. All client whose .tags == ~0 are detached from
the monitor client list and reattached, in order, at the right
place in the monitor client list so that tile() can place them
as I want on the screen. I have used it for 3 hours and it
seems to work. If I find errors I will fix and repost the layout.

Guillaume Quintin.
#define MOVIE_IS_FIXED(c) ( (c)->tags == ((~0) & TAGMASK) )

void movie_attach_after(Client *c,Client *after) {
  c->next = after->next;
  after->next = c;
}

void movie(Monitor *m) {
  unsigned int n,i;
  Client *c,*d,*ff,*fl;

  ff = 0;
  fl = 0;
  for( c = nexttiled(m->clients) ; c ; ) {
    d = c;
    c = nexttiled(c->next);
    if ( MOVIE_IS_FIXED(d) ) {
      detach(d);
      if ( !ff ) {
        ff = d;
        fl = d;
      }
      else {
        movie_attach_after(d,fl);
        fl = d;
      }
    }
  }
  if ( !ff || !fl ) {
    tile(m);
    return;
  }
  for( d = 0,i = 0,c = nexttiled(m->clients) ;
       c && i < m->nmaster ;
       i++,d = c,c = nexttiled(c->next) );
  if ( d ) {
    fl->next = d->next;
    d->next = ff;
  }
  else {
    fl->next = m->clients;
    m->clients = ff;
  }
  n = m->nmaster;
  m->nmaster = i;
  tile(m);
  m->nmaster = n;
}

#undef MOVIE_IS_FIXED

Reply via email to