12

我在手册页中找不到它。
我正在使用来自 debian 挤压镜像的 rxvt-unicode-256color。
Gnome 3 环境,在 xorg.conf 中启用复合。

4

5 回答 5

19
  1. 安装 wmctrl

    $ sudo apt-get install wmctrl
    
  2. 创建扩展目录

    $ mkdir -p ~/.urxvt/ext/
    
  3. 为 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. 启用插件

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

现在,您可以使用 F11 键切换全屏。


参考:

于 2013-05-23T07:15:49.667 回答
2

这是一个简单的 perl 插件,它将以全屏模式启动 urxvt(无需您按其他键):

#!/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;
}

不幸的是,似乎窗口在on_start被调用时对 wmctrl 不可见,所以我不得不使用计时器来延迟对 wmctrl 的调用,直到窗口存在。

于 2017-05-30T05:56:59.873 回答
1

在登录时直接进入全屏,我把它放在我的末尾~/.bashrc

[[ $TERM == *"rxvt"* ]] && wmctrl -r :ACTIVE: -b add,fullscreen

根据Chu-Siang Lai回答,您需要确保wmctrl已安装。

于 2015-04-30T12:48:56.353 回答
0

我就是这样解决的

调用 urxvt 后运行窗口设置。

Shell: zsh
Windowmanager: wmctrl

.zsrch

function urxvtmaxed () {
    # &! is a zsh-specific shortcut to both background and disown the process
    urxvt -e zsh -c "RUN='wmctrl -r :ACTIVE: -b add,maximized_vert,maximized_horz' zsh" &!
}

function urxvtfull () {
    # &! is a zsh-specific shortcut to both background and disown the process
    urxvt -e zsh -c "RUN='wmctrl -r :ACTIVE: -b add,fullscreen' zsh" &!
}

### ======================================================
### Run Commands After zsh invoked

eval "$RUN"

# Example
# RUN='my_prog opt1 opt2' zsh

### Run Commands After zsh invoked END
### ======================================================

现在在 zsh 中,您可以运行urxvtmaxedurxvtfull启动 urxvt,然后调整窗口大小。

注意:wmctrl 在 Wayland 会话中无法正常工作,因为控制窗口违反了 Wayland 的安全策略。

If $WINDOWID is available

urxvt -e zsh -c "RUN='wmctrl -i -r \$WINDOWID -b add,fullscreen' zsh" &!
于 2018-10-25T13:25:24.613 回答
-1

你不能,据我所知。但是,我找到了一种解决方法:

采用

wmctrl -l

找出您的rxvt窗口的名称。可能是它的“rxvt”,所以

wmctrl -r rxvt -b toggle,fullscreen

将最大化该窗口。

您必须将此(第二个命令)放入脚本中,该脚本在您的窗口管理器(例如,openbox、metacity)加载后读取。可能,在您的.xinitrc文件中。

于 2012-11-10T00:52:06.833 回答