elementaryOS系统托盘解决方案

时间:2021-08-23 08:03:07
elementaryOS系统托盘解决方案

在用 eOS 的时候,你可能会遇到系统托盘的问题,有些需要托盘的软件比如说 QQ,没办法在 eOS 的 Wingpanel 上显示,一最小化就不见了,或者出现一个 System tray 的窗口,很麻烦。这是由于 elementaryOS 是没有系统托盘的,只有 Wingpanel,如果软件没有 appindicator,就不会显示在 Wingpanel 上显示,这是官方解释。本文章提供一种不是很完美的解决方案,能暂时解决系统托盘问题。

我的博客原文:

http://elementarycomminity.ml/journal/elementaryos%E7%B3%BB%E7%BB%9F%E6%89%98%E7%9B%98%E8%A7%A3%E5%86%B3%E6%96%B9%E6%A1%88

python-appindicator

python-appindicator只对python写的程序有用,比如*、dropbox。打开终端并输入:

sudo apt-get install python-appindicator

安装完成之后,便可以显示python程序的托盘。

stalonetray

但是其它非python的程序也无法显示在Wingpad上,博主也找不到办法让它们显示在Wingpad上,但是有一种折中的解决方案。就是把系统托盘独立出来,需要用到stalonetray,安装可参考这里。默认是显示在左上方,需要修改一下配置文件~/.stalonetrayrc。

# background # 颜色可以是HTML十六进制形式,也可以是从rgb.txt中的颜色名称,注意颜色前必须加#
background "#777777" # decorations # 设置托盘显示形式
# 可选值: all, title, border, none
decorations none # display # as usual
# dockapp_mode # set dockapp mode, which can be either simple (for
# e.g. OpenBox, wmaker for WindowMaker, or none
# (default). NEW in 0.8.
dockapp_mode none
# fuzzy_edges [] # enable fuzzy edges and set fuzziness level. level
# can be from 0 (disabled) to 3; this setting works
# with tinting and/or transparent and/or pixmap
# backgrounds
fuzzy_edges 0 # geometry # 托盘的几何形状;
geometry 1x1+0+0 # grow_gravity # 可选值有:N, S, E, W, NW, NE, SW, SE; 托盘图标的增长方式。
grow_gravity NW # icon_gravity # 托盘图标的方向: NW, NE, SW, SE
icon_gravity NW # icon_size # spe
icon_size 24 # log_level # controls the amount of logging output, level can
# be err (default), info, or trace (enabled only
# when stalonetray configured with --enable-debug)
# NEW in 0.8.
log_level err # kludges kludge[,kludge] # enable specific kludges to work around
# non-conforming WMs and/or stalonetray bugs.
# NEW in 0.8. Argument is a
# comma-separated list of
# * fix_window_pos - fix tray window position on
# erroneous moves by WM
# * force_icon_size - ignore resize events on all
# icons; force their size to be equal to
# icon_size
# * use_icon_hints - use icon window hints to
# dtermine icon size # max_geometry # maximal tray dimensions; 0 in width/height means
# no limit
max_geometry 0x0 # no_shrink [] # disables shrink-back mode
no_shrink false # parent_bg [] # whether to use pseudo-transparency
# (looks better when reparented into smth like FvwmButtons)
parent_bg false # pixmap_bg <path_to_xpm> # use pixmap from specified xpm file for (tiled) background
# pixmap_bg /home/user/.stalonetraybg.xpm # scrollbars # enable/disable scrollbars; mode is either
# vertical, horizontal, all or none (default)
# NEW in 0.8.
scrollbars none # scrollbars-size # scrollbars step in pixels; default is slot_size / 4
# scrollbars-step 8 # scrollbars-step # scrollbars step in pixels; default is slot_size / 2
# scrollbars-step 32 # slot_size # specifies size of icon slot, defaults to
# icon_size NEW in 0.8. # skip_taskbar [] # hide tray`s window from the taskbar
skip_taskbar true # sticky [] # make a tray`s window sticky across the
# desktops/pages
sticky true # tint_color # set tinting color
tint_color white # tint_level # set tinting level; level ranges from 0 (disabled)
# to 255
tint_level 0 # transparent [] # whether to use root-transparency (background
# image must be set with Esetroot or compatible utility)
transparent false # vertical [] # whether to use vertical layout (horisontal layout
# is used by default)
vertical false # window_layer # set the EWMH-compatible window layer; one of:
# bootom, normal, top
window_layer normal # window_strut # enable/disable window struts for tray window (to
# avoid converting of tray window by maximized
# windows); mode defines to which screen border tray
# will be attached; it can be either top, bottom,
# left, right, none or auto (default)
window_strut auto # window_type # set the EWMH-compatible window type; one of:
# desktop, dock, normal, toolbar, utility
window_type dock # xsync [] # whether to operate on X server synchronously (SLOOOOW)
xsync false

这里介绍几个重点的,这是我自己的配置文件:

geometry 1x1+2+30      #这个是位置及初始化大小,我这里的大小是1x1,坐标为(+2,+30),其+表示左边与上边,-表示下边与右边
transparent true #是否透明
window_layer bottom #窗口的层次
slot_size 24 #托盘图标占用的大小
icon_size 16 #显示图标大小

这是效果图:

elementaryOS系统托盘解决方案