CWM cwm and urxvt

Instead of using a login manager, I just log in at the console and run 'xinit $HOME/.xinitrc', cwm being my usual window manager.

.xinitrc:

Code:
setxkbmap gb -option terminate:ctrl_alt_bksp

xrdb -merge ~/.Xresources         # update x resources db

export LANG="en_GB.UTF-8"
export LC_ALL="en_GB.UTF-8"
export LANGUAGE="en_GB.UTF-8"
export LC_CTYPE="en_GB.UTF-8"

xsetroot -cursor_name left_ptr     # sets the cursor icon

nvidia-settings --assign SyncToVBlank=0
export __GL_SYNC_TO_VBLANK=0

unclutter --timeout 1 -b
urxvtd -q -f -o
urxvtc -fn "xft:Mono" -rv &

mixer -s vol 90 pcm 100 mix 100

export GDK_USE_XFT=1

exec cwm
exit 0

This is all fine and dandy, but I was looking again for a way to make urxvt start in full screen instead of having to do it manually each time when I first log in which was slightly annoying. The urxvt-perls package doesn't have a fullscreen plugin, but there's a way to make things work.

  1. mkdir -p $HOME/.urxvt/ext
  2. Create the file $HOME/.urxvt/ext/fullscreen with the following contents (yes, the poster on the linked page explains it's a bit "hacky"):

    Code:
    #!/usr/bin/env perl
    #
    # https://stackoverflow.com/questions/9783198/how-to-make-rxvt-start-as-fullscreen
    #
    sub on_start {
      my ($self) = @_;
      # This is hacky, but there doesn't seem to be an event after
      # window creation
      $self->{timer} = urxvt::timer->new->after(0.1)->cb(sub {
          fullscreen $self
        });
      return;
    }
    
    sub fullscreen {
      my ($self) = @_;
      my $wid = $self->parent;
      my $err = `wmctrl -i -r $wid -b add,fullscreen`;
      warn "Error maximizing: $err\n" unless $? == 0;
      $self->{timer}->stop;
      delete $self->{timer};
      return;
    }

  3. Install the wmctrl package

  4. In .Xresources add the line (mine is actually empty apart from this):

    Code:
    URxvt.perl-ext: fullscreen
 
Isn't deciding wether to open applications in fullscreen the duty of the window manager? I for example use Openbox and i can set something like this in its configuration (rc.xml):
Bash:
<application class="urxvt" name="urxvt">
    <fullscreen>yes</fullscreen>
</application>
Don't know if something similar is possible for cwm, though.
 
Isn't deciding wether to open applications in fullscreen the duty of the window manager? I for example use Openbox and i can set something like this in its configuration (rc.xml):
Bash:
<application class="urxvt" name="urxvt">
    <fullscreen>yes</fullscreen>
</application>
Don't know if something similar is possible for cwm, though.

Good question. I've used openbox in the past, but I never found a simple(r) way to do it with cwm.
 
I was in a similar boat (but with XTerm).

The issue is that you can't fullscreen before the window manager has loaded and there are no hooks with CWM to know that it has fully loaded before you start your WM.

I have the following (hacky) script to do it.

Code:
start_xterm()
{
  # Wait until the WM is sufficiently loaded.
  while true; do

    xprop -root | grep ^_NET_SUPPORTED | grep _NET_WM_STATE_FULLSCREEN >/dev/null 2>&1
    RES=$?

    if [ $RES = 0 ]; then
      break
    fi

    sleep 1

  done

  xterm -name CwmTerm -fullscreen +sb -b 0 -fa Spleen -fs 18 -bg Black -fg White \
    -e tmux -f "$ROAMING_PREFIX/etc/tmux.conf" new-session -A -s 0
}

start_xterm &
cwm

What this does is keep polling the X11 root until it finds the ability to fullscreen (_NET_WM_STATE_FULLSCREEN). Only then do I start xterm knowing that the -f flag will work.
 
I was in a similar boat (but with XTerm).

The issue is that you can't fullscreen before the window manager has loaded and there are no hooks with CWM to know that it has fully loaded before you start your WM.

I have the following (hacky) script to do it.

Code:
start_xterm()
{
  # Wait until the WM is sufficiently loaded.
  while true; do

    xprop -root | grep ^_NET_SUPPORTED | grep _NET_WM_STATE_FULLSCREEN >/dev/null 2>&1
    RES=$?

    if [ $RES = 0 ]; then
      break
    fi

    sleep 1

  done

  xterm -name CwmTerm -fullscreen +sb -b 0 -fa Spleen -fs 18 -bg Black -fg White \
    -e tmux -f "$ROAMING_PREFIX/etc/tmux.conf" new-session -A -s 0
}

start_xterm &
cwm

What this does is keep polling the X11 root until it finds the ability to fullscreen (_NET_WM_STATE_FULLSCREEN). Only then do I start xterm knowing that the -f flag will work.

Thanks for this. I discovered that if, instead of using the perl hack, I just do the "naive" thing and specify the geometry in terms of the pixel dimensions of my display (I know I'm supposed to use columns and rows/lines) the desired thing happens, i.e. in .xinitrc:

Code:
urxvtc -geometry 1920x1080 -fn "xft:Mono" -rv &

I'm only using the default urxvt font and to my very imperfect eyes there doesn't seem to be any detrimental effect. I'm not yet clear about what I *should* do and how the *correct* column and line values should be chosen and how they would relate to the urxvt font size in general. I queried what I think are the relevant bash environment variables:

Code:
paul@zoo-FreeBSD ~ $ echo $COLUMNS
190
paul@zoo-FreeBSD ~ $ echo $LINES
53

but my understanding of how the X geometry works is limited at the moment.
 
Back
Top