我想编写一个bash脚本,直接在最大化窗口中启动gvim-session.
那是我的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'
Run Code Online (Sandbox Code Playgroud)
你有任何想法如何用bashscript完成这个?只有在通过此脚本启动时才应最大化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';
Run Code Online (Sandbox Code Playgroud)
谢谢大家的时间.
编辑:我刚刚发现上述解决方案仅适用于unity-2d(非3D加速)桌面.哪个对我好.它不适用于使用Unity的3D加速版本的默认Ubuntu-desktop.
以下适用于Ubuntu 8.04,Gnome(基于对此论坛的评论):
#!/bin/bash
gvim
sleep 1 # give gvim time to launch
wmctrl -r :ACTIVE: -b toggle,maximized_vert,maximized_horz
Run Code Online (Sandbox Code Playgroud)
您可能需要安装wmctrl:
sudo apt-get install wmctrl
Run Code Online (Sandbox Code Playgroud)