Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to make rxvt start as fullscreen?

Tags:

rxvt

I can't find it within man page.
I am using rxvt-unicode-256color from debian squeeze mirror.
Gnome 3 environment, composite enabled in xorg.conf.

like image 752
hero2008 Avatar asked Mar 20 '12 08:03

hero2008


2 Answers

  1. Install wmctrl

    $ sudo apt-get install wmctrl
    
  2. Create the extension directory

    $ mkdir -p ~/.urxvt/ext/
    
  3. Create a plugin for Rxvt

    $ vi ~/.urxvt/ext/fullscreen
    #!perl
    sub on_user_command {
        my ($self, $cmd) = @_;
        if ($cmd eq "fullscreen:switch") {
            my $dummy = `wmctrl -r :ACTIVE: -b toggle,fullscreen` ;
        }
    }
    
  4. Enable the plugin

    $ vi ~/.Xdefaults
    ...
    " Fullscreen switch
    URxvt.perl-ext-common:  fullscreen
    URxvt.keysym.F11:       perl:fullscreen:switch
    

Now, you can toggle fullscreen with the F11 key.


Reference:

  • [SOLVED] rxvt-unicode not switching to fullscreen / Arch Linux Forums
  • my .Xdefaults
like image 90
Chu-Siang Lai Avatar answered Oct 10 '22 07:10

Chu-Siang Lai


Here is a simple perl plugin that will start urxvt in fullscreen mode (without requiring you to press an additional key):

#!/usr/bin/perl

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;
}

Unfortunately, it seems that the window isn't visible to wmctrl when on_start is called, so I had to use a timer to delay the call to wmctrl until the window exists.

like image 21
Thayne Avatar answered Oct 10 '22 06:10

Thayne