【发布时间】:2018-10-26 00:04:47
【问题描述】:
我在手册页中找不到它。
我正在使用来自 debian 挤压镜像的 rxvt-unicode-256color。
Gnome 3 环境,在 xorg.conf 中启用复合。
【问题讨论】:
标签: rxvt
我在手册页中找不到它。
我正在使用来自 debian 挤压镜像的 rxvt-unicode-256color。
Gnome 3 环境,在 xorg.conf 中启用复合。
【问题讨论】:
标签: rxvt
安装 wmctrl
$ sudo apt-get install wmctrl
创建扩展目录
$ mkdir -p ~/.urxvt/ext/
为 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` ;
}
}
启用插件
$ vi ~/.Xdefaults
...
" Fullscreen switch
URxvt.perl-ext-common: fullscreen
URxvt.keysym.F11: perl:fullscreen:switch
现在,您可以使用 F11 键切换全屏。
参考:
【讨论】:
这是一个简单的 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 的调用,直到窗口存在。
【讨论】:
要在登录时直接进入全屏模式,我将其放在~/.bashrc 的末尾:
[[ $TERM == *"rxvt"* ]] && wmctrl -r :ACTIVE: -b add,fullscreen
根据Chu-Siang Lai 的answer,您需要确保已安装wmctrl。
【讨论】:
我就是这样解决的
调用 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 中,您可以运行 urxvtmaxed 或 urxvtfull 来启动 urxvt,然后调整窗口大小。
注意:wmctrl 不能在 Wayland 会话中作为控制正常工作 windows 违反了 Wayland 的安全策略。
If $WINDOWID is available
urxvt -e zsh -c "RUN='wmctrl -i -r \$WINDOWID -b add,fullscreen' zsh" &!
【讨论】:
据我所知,你不能。但是,我找到了解决方法:
使用
wmctrl -l
找出您的rxvt 窗口的名称。可能是它的“rxvt”,所以
wmctrl -r rxvt -b toggle,fullscreen
将最大化该窗口。
您必须将此(第二个命令)放入脚本中,该脚本在您的窗口管理器(例如,openbox、metacity)被加载后读取。可能在您的.xinitrc 文件中。
【讨论】:
rxvt吗?我将它用于urxvt,它起作用了。如果 rxvt 的标题确实发生了变化,您可以编写一个脚本来 greps 该行,并为 wmctrl 函数提供正确的标题。
rxvt。它在我的系统上也没有一致的标题,所以也许你可以更新你的答案?我很乐意删除 -1...
:ACTIVE: