我可以让 Ubuntu 上的 Eclipse 看起来更紧凑吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13684289/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Can I make Eclipse on Ubuntu look more compact?
提问by Redsandro
Possible Duplicate:
Gigantic Tabs in Eclipse on Ubuntu
可能的重复:
Ubuntu 上 Eclipse 中的巨大标签
Back when I was using Eclipse on Ubuntu 10.04 LTS, I found that the tabs and bars used a bit too much vertical spacing, which made the interface a bit too spacey for my taste.
当我在 Ubuntu 10.04 LTS 上使用 Eclipse 时,我发现选项卡和栏使用了太多的垂直间距,这使得界面对于我的口味来说有点过于宽敞。
However, I didn't find a good way to make this right, and I learned to work with it.
然而,我没有找到一个好的方法来解决这个问题,我学会了使用它。
But now, after installing Ubuntu 12.10 (or actually Linux Mint 14 Cinnamon), it has gotten even bigger, the vertical spacing.
但是现在,在安装 Ubuntu 12.10(或者实际上是 Linux Mint 14 Cinnamon)之后,它变得更大了,垂直间距。
If you have three tabbed windows with two toolbars in your normal vertical workspace, this easily hides 6 lines of code with useless UI spacing, which I personally find quite annoying.
如果您在正常的垂直工作区中有三个带有两个工具栏的选项卡式窗口,那么这很容易隐藏 6 行具有无用 UI 间距的代码,我个人觉得这很烦人。
Before screenshot (a bit too spacey) | After screenshot (annoyingly spacey):
截图前(有点太太空了)| 截图后(令人讨厌的空间):
I personally don't like this and I would prefer to get rid of it. I have tried some GTK3 themes and they left stuff almost equally spacey, adding or removing maybe an extra pixel.
我个人不喜欢这个,我宁愿摆脱它。我尝试了一些 GTK3 主题,它们留下的东西几乎同样空旷,可能添加或删除了一个额外的像素。
I have traveled deep into the preferences of Eclipse itself and I have seen many things. I am not sure if I was distracted or there is just no way of changing this from within Eclipse itself, but I didn't find any.
我深入了解了 Eclipse 本身的偏好,并且看到了很多东西。我不确定是我分心了还是没有办法从 Eclipse 内部改变这一点,但我没有找到任何方法。
How do I turn this oversized touch interface for people with 4K screens back into a compact interface for programmers who want to see lots of code?
我如何将这个为 4K 屏幕用户设计的超大触摸界面变回为想要查看大量代码的程序员提供的紧凑界面?
or
或者
How do I brutally do this myself in /usr/share/themes/*/gtk-3.0/*css
?
我如何残忍地自己做这件事/usr/share/themes/*/gtk-3.0/*css
?
回答by Redsandro
I have been looking everywhere for a GTK3 solution, because I was sure the switch to a GTK3 system caused this. However, after two hours of wasting my time, I found out that the 'old GTK2 trick' just works.
我一直在到处寻找 GTK3 解决方案,因为我确信切换到 GTK3 系统会导致这种情况。然而,在浪费了我两个小时的时间之后,我发现“旧的 GTK2 技巧”确实有效。
The original forum post is here: http://ubuntuforums.org/showthread.php?t=1465712
原始论坛帖子在这里:http: //ubuntuforums.org/showthread.php?t=1465712
Add a new file called .gtkrc-2.0
to your home directory with the following content:
添加一个名为主.gtkrc-2.0
目录的新文件,内容如下:
style "gtkcompact" {
GtkButton::default_border={0,0,0,0}
GtkButton::default_outside_border={0,0,0,0}
GtkButtonBox::child_min_width=0
GtkButtonBox::child_min_heigth=0
GtkButtonBox::child_internal_pad_x=0
GtkButtonBox::child_internal_pad_y=0
GtkMenu::vertical-padding=1
GtkMenuBar::internal_padding=0
GtkMenuItem::horizontal_padding=4
GtkToolbar::internal-padding=0
GtkToolbar::space-size=0
GtkOptionMenu::indicator_size=0
GtkOptionMenu::indicator_spacing=0
GtkPaned::handle_size=4
GtkRange::trough_border=0
GtkRange::stepper_spacing=0
GtkScale::value_spacing=0
GtkScrolledWindow::scrollbar_spacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focus_padding=0
}
class "GtkWidget" style "gtkcompact"
Restart Eclipse.
重新启动 Eclipse。
Wasted space back to efficient use!
浪费的空间重新得到有效利用!
Update 2014-06
更新 2014-06
Now that I myself have (finally) moved to Kepler, I found that the little minimize-maximize widgets wouldn't go below 28 pixels anymore. These .gtkrc-2.0
seem to have better results for Kepler.
现在我自己(终于)搬到了 Kepler,我发现最小化-最大化小部件不会再低于 28 像素了。这些.gtkrc-2.0
似乎对开普勒有更好的结果。
style "gtkcompact" {
GtkButton::defaultborder={0,0,0,0}
GtkButton::defaultoutsideborder={0,0,0,0}
GtkButtonBox::childminwidth=0
GtkButtonBox::childminheigth=0
GtkButtonBox::childinternalpadx=0
GtkButtonBox::childinternalpady=0
GtkMenu::vertical-padding=1
GtkMenuBar::internalpadding=0
GtkMenuItem::horizontalpadding=4
GtkToolbar::internal-padding=0
GtkToolbar::space-size=0
GtkOptionMenu::indicatorsize=0
GtkOptionMenu::indicatorspacing=2
GtkPaned::handlesize=4
GtkRange::troughborder=0
GtkRange::stepperspacing=0
GtkScale::valuespacing=0
GtkScrolledWindow::scrollbarspacing=0
GtkExpander::expandersize=10
GtkExpander::expanderspacing=0
GtkTreeView::vertical-separator=0
GtkTreeView::horizontal-separator=0
GtkTreeView::expander-size=8
GtkTreeView::fixed-height-mode=TRUE
GtkWidget::focuspadding=1
}
class "GtkWidget" style "gtkcompact"
style "gtkcompactextra" {
xthickness=2 ythickness=2
}
class "GtkButton" style "gtkcompactextra"
class "GtkToolbar" style "gtkcompactextra"
class "GtkPaned" style "gtkcompactextra"
If you add the xthickness
and ythickness
to the whole GtkWidget
class, your menu bar will be all tight and squeezed together. That's too much in my opinion, but just so you know.
如果您将xthickness
和添加ythickness
到整个GtkWidget
班级,您的菜单栏将全部挤在一起。这在我看来太多了,但只是让你知道。
You can edit the file and save it, open up something simple like Geany
, tweak save, re-open Geany
etc. to quickly tweak this. For details you can open Eclipse every time, but it takes longer to load, depending on how much plugins you have to load.
您可以编辑文件并保存它,打开一些简单的东西,例如Geany
调整保存、重新打开Geany
等,以快速调整它。有关详细信息,您可以每次都打开 Eclipse,但加载时间会更长,具体取决于您必须加载多少插件。
Update 2015-10-02
更新 2015-10-02
About Luna and Mars
关于月神和火星
@eocanha said at jan 15:
@eocanha 在 1 月 15 日说:
If you have Gtk3 installed, Eclipse Luna will use the Gtk3 CSS based styling system and will ignore .gtkrc-2.0. However, you can force Eclipse to use Gtk2 again (if you have it installed) via shell environment variables: "export SWT_GTK3=0" in your .bashrc or in some wrapper script calling Eclipse.
如果您安装了 Gtk3,Eclipse Luna 将使用基于 Gtk3 CSS 的样式系统并忽略 .gtkrc-2.0。但是,您可以通过 shell 环境变量强制 Eclipse 再次使用 Gtk2(如果已安装):“export SWT_GTK3=0”在您的 .bashrc 或一些调用 Eclipse 的包装器脚本中。
Original source: https://bugs.eclipse.org/bugs/show_bug.cgi?id=420180
回答by kostja
If you want to see more code and less clutter, take a look at the eclipse fullscreen plugin . Toggle the fullscreen mode with Ctrl+Alt+z
(or define your own binding).
如果你想看到更多的代码和更少的混乱,看看eclipse fullscreen plugin。使用Ctrl+Alt+z
(或定义您自己的绑定)切换全屏模式。
Instead of using menus, the "universal command" shortcut Ctrl+3
can take you to any menu and perform any task faster.
代替使用菜单,“通用命令”快捷方式Ctrl+3
可以将您带到任何菜单并更快地执行任何任务。