如何从 gnome 中的 bash 脚本启动带有最大化窗口的 gvim
我想编写一个 bash 脚本,直接在最大化窗口中启动 gvim 会话。
这是我的 bash 脚本:
#!/bin/bash -
set -o nounset
cd /home/alexthebird/vim-stuff; # directory of the gvim-session file
gvim -S bootmap; # start gvim from the sessionfile 'bootmap'
您对如何使用 bash 脚本完成此任务有什么想法吗? Gvim 仅应在通过此脚本启动时最大化。当然,欢迎任何其他如何实现这一目标的想法。
我使用 Ubuntu 11.04 和 gnome。
感谢您花时间阅读我的消息。
AlexTheBird
此脚本有效:
#!/bin/bash -
set -o nounset
# directory of the gvim-session file
cd /home/alexthebird/vim-stuff;
# -f because of a ubuntu global-menu bug
# -S starts from session-file named 'bootmap'
# -geom solved the problem. see post of Lstor
gvim -geom '200x50+0+0' -f -S bootmap; # start gvim from the sessionfile 'bootmap';
感谢大家的宝贵时间。
编辑:我刚刚发现上述解决方案仅适用于 unity-2d(非 3D 加速)桌面。这对我来说很好。它不适用于使用 Unity 3D 加速版本的默认 Ubuntu 桌面。
I want to write a bash-script that starts a gvim-session directly in a maximized window.
That is my bash-script:
#!/bin/bash -
set -o nounset
cd /home/alexthebird/vim-stuff; # directory of the gvim-session file
gvim -S bootmap; # start gvim from the sessionfile 'bootmap'
Do you have any ideas how to accomplish this with a bashscript? Gvim should only be maximized when it is started over this script. Any other ideas how to accomplish this are welcome, of course.
I use Ubuntu 11.04 with gnome.
Thank you for taking the time to read my message.
AlexTheBird
This script works:
#!/bin/bash -
set -o nounset
# directory of the gvim-session file
cd /home/alexthebird/vim-stuff;
# -f because of a ubuntu global-menu bug
# -S starts from session-file named 'bootmap'
# -geom solved the problem. see post of Lstor
gvim -geom '200x50+0+0' -f -S bootmap; # start gvim from the sessionfile 'bootmap';
Thank you all for your time.
EDIT : I just found out that the above solution only works for the unity-2d (non 3D accelerated) desktop. Which is fine for me. It does not work with the default Ubuntu-desktop which uses the 3D accelerated version of Unity.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
以下内容适用于 Ubuntu 8.04、Gnome(基于此论坛上的评论):
您可能需要安装
wmctrl
:The following works for me on Ubuntu 8.04, Gnome (based on comments on this forum):
You may need to install
wmctrl
:您可以使用 -geom(etry) 选项来将大小与显示器的大小相匹配。
其中
200
是水平方向可以容纳的字符数,50
是垂直方向上相同的字符数,+0+0
表示水平和垂直偏移为零从屏幕的左上角。请注意,窗口本身不会最大化,它只会(大约)与显示器的大小相同。
You could use the -geom(etry) option to match the size with the size of your monitor(s).
Where
200
is the number of characters you can fit horizontally,50
is the same vertically, and+0+0
indicates zero horizontal and vertical offset from the top-left corner of the screen.Note that the window would not be maximized per se, it would only be (approximately) the same size as your display.
像@Curt Nelson一样,我使用
wmctrl
,以及autocmd
和guienter
。它适用于我的 Windows 7 和 Ubuntu 13.10。sudo apt-get install wmctrl
脚本:
like @Curt Nelson , I use
wmctrl
, with withautocmd
andguienter
. It works both on my windows 7 and Ubuntu 13.10.sudo apt-get install wmctrl
script: