Xfce (简体中文)
Xfce 是一个基于 GTK+2 的轻量级模块化的 桌面环境。为了提供完整的用户体验,它包含窗口管理器、文件管理器、桌面和面板。
Contents
- 1 安装
- 2 启动Xfce
- 3 配置
- 4 提示和小技巧
-
5 常见问题与解答
- 5.1 Action buttons are missing icons
- 5.2 Desktop icons rearrange themselves
- 5.3 GTK themes not working with multiple monitors
- 5.4 Xfce4-xkb-plugin settings issue
- 5.5 Icons do not appear in right-click menus
- 5.6 Keyboard settings are not saved in xkb-plugin
- 5.7 NVIDIA 和 xfce4-sensors-plugin
- 5.8 Panel applets keep being aligned on the left
- 5.9 Preferred Applications preferences have no effect
- 5.10 Restore default settings
- 5.11 Session failure
- 5.12 Fonts in window title crashing xfce4-title
- 5.13 Laptop lid settings ignored
- 5.14 Rendering issues with Adwaita theme
- 6 相关文章
安装
安装 xfce4 包组。如果需要的话,还可以安装 xfce4-goodies 包组。此包组提供了一些额外的插件和一些有用的工具,如 mousepad 编辑器。 Xfce 默认使用 Xfwm 作为窗口管理器。
启动Xfce
从显示管理器(display manager)选择Xfce Session,或者添加 exec startxfce4
到 Xinitrc中。
配置
Xfce把配置的选项保存到Xfconf。有几个方式来修改这些选项:
- 在主菜单中,选择Settings,选择想要修改的选项。选项实际上是位于
/usr/bin/xfce4-*
和/usr/bin/xfdesktop-settings
中的程序。 -
xfce4-settings-editors
能看到和修改所有的设置。此处修改的选项会立即生效。使用xfconf-query
来通过命令行设置;文档中有更多的细节。 - 设置保存在XML文件中。此文件位于
~/.config/xfce4/xfconf/xfce-perchannel-xml/
,也可以手动修改文件。但是,此处的修改不会立即生效。
菜单
Whisker 菜单
xfce4-whiskermenu-plugin 是一个可选应用启动器。它可以显示所有的已安装应用中最喜欢和经常被使用的应用。支持应用分类和模糊查询。
编辑菜单
有一些工具可以用来实现此项需求
- XAME — 使用Gambas编写,用于Xfce编辑菜单项的图形工具,在其他环境中没有效果。
- MenuLibre — 一个高级的菜单编辑器,提供了一个纯粹,易用的界面。
- Alacarte — GNOME的菜单编辑器。
当然,也可以手动创建 ~/.config/menus/xfce-applications.menu
。下面给出一个示例的配置:
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd"> <Menu> <Name>Xfce</Name> <MergeFile type="parent">/etc/xdg/menus/xfce-applications.menu</MergeFile> <Exclude> <Filename>xfce4-run.desktop</Filename> <Filename>exo-terminal-emulator.desktop</Filename> <Filename>exo-file-manager.desktop</Filename> <Filename>exo-mail-reader.desktop</Filename> <Filename>exo-web-browser.desktop</Filename> <Filename>xfce4-about.desktop</Filename> <Filename>xfhelp4.desktop</Filename> </Exclude> <Layout> <Merge type="all"/> <Separator/> <Menuname>Settings</Menuname> <Separator/> <Filename>xfce4-session-logout.desktop</Filename> </Layout> </Menu>
<MergeFile>
标签包含了默认的Xfce菜单。
<Exclude>
标签剔除了你不想在菜单中出现的应用程序。尽管此处我们只剔除了一些Xfce的默认快捷方式,但是你也可以剔除 firefox.desktop
或其他任何的应用程序。
<Layout>
标签定义了菜单的布局。应用程序可以被放在文件夹中,或任何我们想要的组织方式。在 Xfce wiki 有更多的详细信息。
你可以通过编辑 .desktop
本身来改变Xfce的菜单。隐藏项,可以参见 Desktop entries#Hide desktop entries。你可以改变 Categories=
桌面项的行,以编辑应用程序的标签(category)。参见 Desktop entries#File example。
桌面
图标文字的背景透明
默认桌面图标的文字是白色背景,可以创建或者修改 ~/.gtkrc-2.0
来得到不一样的效果:
style "xfdesktop-icon-view" { XfdesktopIconView::label-alpha = 10 base[NORMAL] = "#000000" base[SELECTED] = "#71B9FF" base[ACTIVE] = "#71B9FF" fg[NORMAL] = "#fcfcfc" fg[SELECTED] = "#ffffff" fg[ACTIVE] = "#ffffff" } widget_class "*XfdesktopIconView*" style "xfdesktop-icon-view"
从右击菜单中剔除Thunar选项
使用如下的命令:
$ xfconf-query -c xfce4-desktop -v --create -p /desktop-icons/style -t int -s 0
杀死窗口的快捷键
Xfce没有杀死窗口的快捷键,当程序假死时,我们可能需要这样的快捷键。
通过包 xorg-xkill,使用 xkill
来交互时的杀掉一个窗口。对于当下的激活窗口,使用包 xdotool:
$ xdotool getwindowfocus windowkill
也可以:
$ xkill -id "$(xprop -root -notype | sed -n '/^_NET_ACTIVE_WINDOW/ s/^.*# *\|\,.*$//g p')"
添加快捷键,使用 设置 > 键盘 或者使用应用程序,如 xbindkeys。
会话
自启动程序
可以在 程序 > 设置 > 设置管理器 > 会话和自启动 中,设置与Xfce一起启动的自启动程序。 此处列出了所有自启动的程序。点击 添加 按钮后可以添加自定义的自启动任务。
当然,也可以将要执行的命令(包括变量)加入 xinitrc。如果使用 [[Display manager|显示管理器「」,则加入 xprofile
延迟自启动应用程序
有时候,延迟某个应用程序的自启动是很有用的。特别是如 sleep 3 && command
这样的命令在自启动中是不起作用的。与之相对,你需要使用如下的语法来替代:
sh -c "sleep 3 && command"
锁定屏幕
要通过 xflock4 脚本锁定 Xfce4 会话,可以从下面软件列表中选择安装一个:xscreensaver, gnome-screensaver, slock 和 xlockmore。
或者可以选择使用下面命令设置屏保:
$ xfconf-query -c xfce4-session -p /general/LockCommand -s "light-locker-command -l" --create -t string
要更新命令是,可以使用:
$ xfconf-query -c xfce4-session -p /general/LockCommand -s "light-locker-command -l"
List of applications/Security#Screen lockers 包含了屏幕锁定程序列表。
切换用户
只要 Display manager 有切换用户的功能,Xfce4都是可以支持的,比如 LightDM 和 GDM 。关于你所使用的DM的信息,需要参看其wiki页面。当你已经安装并配置好你的DM之后,你就可以通过'actions buttons'菜单项来切换用户。
想要不用GDM而能切换用户, 需要安装一个DM:
- For LXDM - LXDM#Simultaneous users and switching users.
- For LightDM - LightDM (简体中文)#Xfce4 下多用户切换.
禁用保存的会话
可以通过下面命令禁用某个用户的会话:
$ xfconf-query -t bool -c xfce4-session -p /general/SaveOnExit -s false
然后进入 Applications -> Settings -> Session and Startup -> Sessions 并点击 Clear saved sessions 按钮.
Xfce kiosk 模式可以用来彻底禁用对话的保存。为了禁用对话,创建或者编辑 /etc/xdg/xfce4/kiosk/kioskrc
并加入如下的行:
[xfce4-session] SaveSession=NONE
如果kiosk模式不能工作,用户可以给对话目录设置只读权限:
$ rm ~/.cache/sessions/* && chmod 500 ~/.cache/sessions
此操作会防止Xfce保存所有的会话,除了设置和配置。
默认窗口管理器
窗口管理器的设定保存在
- /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml - 系统设置
- ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml - 用户设置
单个用户的默认窗口管理器可以用下面命令修改:
$ xfconf-query -c xfce4-session -p /sessions/Failsafe/Client0_Command -t string -sa wm_name
下面命令增加参数:
$ xfconf-query -c xfce4-session -p /sessions/Failsafe/Client0_Command -t string -t string -s wm_name -s --wm-option
要修改整个系统的默认窗口管理器,需要手动编辑配置文件,将 xfwm4 修改为需要的管理器。可以使用 <value type="string" value="--wm-option"/>
增加额外的参数。
更换主题
在 xfce-look.org 上有不少XFCE的主题。 Xfwm 的主题保存在 /usr/share/themes/xfce4
, 在 Settings > Window Manager中可以更改主题。 而GTK+ 主题在 Settings > Appearance。
如果想要使所有的应用能有一个统一的外观, 参见 Uniform look for Qt and GTK applications获得更多的信息。
相关主题在 Cursor themes, Icons, 和 Font configuration 中。
声音
Xfce4 mixer
xfce4-mixer 是 Xfce 组开发的用户混音程序和面板插件,xfce4 软件组的一部分,所以应该已经安装。要支持 PulseAudio 和 OSS,需要安装 gstreamer0.10-good-plugins。
可能需要变更默认声卡才能正常使用 Xfce4 mixer 详情请参考 Advanced Linux Sound Architecture#Set the default sound card,修改后需要重新登录。此外还可以使用 PulseAudio 和 pavucontrol 或 OSS. 参考OSS#Applications that use GStreamer.
Change default sound card in Xfce4 mixer
In some cases (when using PulseAudio or xfce4-volumedAUR for instance) it might be necessary to change the default sound card in Xfce4 Mixer in order for volume control to work as expected. [2]
To change the default sound card, open xfce4-settings-editor and navigate to xfce4-mixer and check the entries under sound-cards. Locate the correct entry for the card you are using and then replace the values of sound-card and active-card with the entry. If you are using PulseAudio then the entry will likely be similar to the following: PlaybackInternalAudioAnalogStereoPulseAudioMixer. Then logout for the changes to take effect.
xfce4-alsa-plugin
If you do not use PulseAudio, you can install xfce4-alsa-pluginAUR. It provides a simple panel plugin with the ability to control ALSA volume, though it does not support keyboard volume buttons.
Keyboard volume buttons
If the xfce4-mixer package is version 4.10.0-3
or greater, then the mixer panel applet provides the ability to control the volume using the keyboard. However, volume notifications will not be shown. Alternatively, xfce4-volumedAUR maps volume keys to Xfce4 mixer, and displays notifications through Xfce4-notifyd.
If you are using PulseAudio and you do not wish to use Xfce4 Mixer at all, install xfce4-pulseaudio-pluginAUR. This provides a panel applet which has support for keyboard volume control and volume notifications.
For non desktop environment specific alternatives, see List of applications#Volume managers.
Shortcuts
If you are not using an applet or daemon that controls the volume keys, you can map volume control commands to your volume keys manually using Xfce's keyboard settings. For the sound system you are using, see the sections linked to below for the appropriate commands.
- ALSA: see Advanced Linux Sound Architecture#Keyboard volume control.
- PulseAudio: see PulseAudio#Keyboard volume control
- OSS: see OSS#Using multimedia keys with OSS.
键盘快捷键
键盘快捷键在两个地方定义: Settings > Window Manager > Keyboard 和 Settings > Keyboard > Shortcuts。
Polkit 身法认证代理
在安装 xfce4-session 时,会一起安装 polkit-gnome 代理,并会随系统自动启动;并不主要用户的干预。更多信息,参见 Polkit#Authentication agents。
Xfce可用的第三方的 Polkit 身法认证代理,参见 xfce-polkit-gitAUR。
Display blanking
Some programs that are commonly used with Xfce will control monitor blanking and DPMS (monitor powersaving) settings. They are discussed below.
- Xfce Power Manager
Xfce Power Manager will control blanking and DPMS settings. These settings can be configured by running xfce4-power-manager-settings and clicking the Display tab. Note that unticking the Handle display power management option means that the Power Manager will disable DPMS - it does not mean that the Power Manager will relinquish control of DPMS. Also note that it will not disable screen blanking. To disable both blanking and DPMS, right click on the power manager system tray icon or left click on the panel applet and make sure that the option labelled Presentation mode is ticked.
- xset
If neither of the above applications are running, then blanking and DPMS settings can be controlled using the xset command, see DPMS#Modifying DPMS and screensaver settings using xset.
提示和小技巧
从 thunar 和 xfdesktop 隐藏分区
参见 Udisks#Hide selected partitions.
屏幕截图
Xfce 有自己的截图工具, xfce4-screenshooter.它是 xfce4-goodies 包组的一部分.
到 应用程序 > 设置 > 键盘, 应用程序快捷方式. 添加 xfce4-screenshooter -f
(或 -w
为活动窗口)命令用 Print
打印键截屏. 其他可选参数参见 screenshooter 的 man 手册
此外,也可用其他独立的截图程式如 scrot
禁用终端 F1 和 F11 快捷方式
The xfce terminal binds F1 and F11 to help and fullscreen, respectively, which can make using programs like htop difficult. To disable those shortcuts, create or edit its configuration file, then log out and log back in. F10 can disabled in the Preferences menu.
~/.config/xfce4/terminal/accels.scm
(gtk_accel_path "<Actions>/terminal-window/fullscreen" "") (gtk_accel_path "<Actions>/terminal-window/contents" "")
终端的颜色主题和调色板
可以在首选项的外观标签下修改中断主题颜色和调色板. 这些色彩可用于多大数控制台程序如Emacs, Vi等. 它们的设置单独存储在每个用户的~/.config/xfce4/terminal/terminalrc
文件. 还有更多主题可供选择. Terminal Colour Scheme Screenshots 查找更多终端配色方案
修改默认颜色主题
XFCE的extra/terminal
包使用了较暗的颜色使得文字在默认的黑色背景下很难阅读并会使人感到不适,请把以下文字写入到terminalrc文件中来使用一个较明亮的颜色主题, 它会在一直在较暗的终端背景下可见.
~/.config/xfce4/terminal/terminalrc
ColorPalette5=#38d0fcaaf3a9 ColorPalette4=#e013a0a1612f ColorPalette2=#d456a81b7b42 ColorPalette6=#ffff7062ffff ColorPalette3=#7ffff7bd7fff ColorPalette13=#82108210ffff
终端之Tango主题
用你喜欢的编辑器打开~/.config/xfce4/terminal/terminalrc
加入:
ColorForeground=White ColorBackground=#323232323232 ColorPalette1=#2e2e34343636 ColorPalette2=#cccc00000000 ColorPalette3=#4e4e9a9a0606 ColorPalette4=#c4c4a0a00000 ColorPalette5=#34346565a4a4 ColorPalette6=#757550507b7b ColorPalette7=#060698989a9a ColorPalette8=#d3d3d7d7cfcf ColorPalette9=#555557575353 ColorPalette10=#efef29292929 ColorPalette11=#8a8ae2e23434 ColorPalette12=#fcfce9e94f4f ColorPalette13=#72729f9fcfcf ColorPalette14=#adad7f7fa8a8 ColorPalette15=#3434e2e2e2e2 ColorPalette16=#eeeeeeeeecec
颜色管理
Xfce has no native support for colour management. [5] See ICC profiles for alternatives.
多显示器
As of xfce4-settings version 4.11.4, Xfce has support for multiple monitors. Settings can be configured in the Applications -> Settings -> Display dialog. For more information, see the display article from the Xfce documentation.
SSH 代理
By default Xfce 4.10 will try to load gpg-agent or ssh-agent in that order during session initialization. To disable this, create an xfconf key using the following command:
xfconf-query -c xfce4-session -p /startup/ssh-agent/enabled -n -t bool -s false
To force using ssh-agent even if gpg-agent is installed, run the following instead:
xfconf-query -c xfce4-session -p /startup/ssh-agent/type -n -t string -s ssh-agent
To use GNOME Keyring, simply tick the checkbox Launch GNOME services on startup in the Advanced tab of Session Manager in Xfce's settings. This will also disable gpg-agent and ssh-agent.
Source: http://docs.xfce.org/xfce/xfce4-session/advanced
Scroll a background window without shifting focus on it
Go to Main Menu > Settings > Window Manager Tweaks > Accessibility tab. Uncheck Raise windows when any mouse button is pressed.
修改鼠标按键
By default, the mouse button modifier in Xfce is set to Alt
. This can be changed with xfconf-query. For instance, the following command will set the Super
key as the mouse button modifier:
$ xfconf-query -c xfwm4 -p /general/easy_click -n -t string -s "Super"
Strictly speaking, using multiple modifiers is not supported. However, as a workaround, multiple modifiers can be specified if the key names are separated with ><
. For instance, to set Ctrl+Alt
as the mouse button modifier, you can use the following command:
$ xfconf-query -c xfwm4 -p /general/easy_click -n -t string -s "Ctrl><Alt"
常见问题与解答
Action buttons are missing icons
This happens if icons for some actions (Suspend, Hibernate) are missing from the icon theme, or do not have the expected names. To fix this, install an icon theme which has the necessary icons already added; see Icons#Xfce icons.
Then, you can switch to that icon theme using Applications -> Settings -> Appearance -> Icons.
Alternatively you can use the required icons provided by the icon theme you installed in your current icon theme. To do so, you first need to find out what the currently used icon theme is called. You can do so by using the command below:
$ xfconf-query -c xsettings -p /Net/IconThemeName
Then set the following variable:
$ icontheme=/usr/share/icons/theme-name
where theme-name is the name of the current icon theme.
Then create symbolic links from the current icon theme into the icon theme providing the icons (this example assumes the icons are being provided by the elementary-xfce-iconsAUR theme.)
ln -s /usr/share/icons/elementary-xfce/apps/16/system-suspend.svg ${icontheme}/16x16/actions/system-suspend.svg ln -s /usr/share/icons/elementary-xfce/apps/16/system-suspend-hibernate.svg ${icontheme}/16x16/actions/system-hibernate.svg ln -s /usr/share/icons/elementary-xfce/apps/22/system-suspend.svg ${icontheme}/22x22/actions/system-suspend.svg ln -s /usr/share/icons/elementary-xfce/apps/22/system-suspend-hibernate.svg ${icontheme}/22x22/actions/system-hibernate.svg ln -s /usr/share/icons/elementary-xfce/apps/24/system-suspend.svg ${icontheme}/24x24/actions/system-suspend.svg ln -s /usr/share/icons/elementary-xfce/apps/24/system-suspend-hibernate.svg ${icontheme}/24x24/actions/system-hibernate.svg ln -s /usr/share/icons/elementary-xfce/apps/48/system-suspend.svg ${icontheme}/48x48/actions/system-suspend.svg ln -s /usr/share/icons/elementary-xfce/apps/48/system-suspend-hibernate.svg ${icontheme}/48x48/actions/system-hibernate.svg
Log out and in again, and you should see icons for all actions.
Desktop icons rearrange themselves
At certain events (such as opening the panel settings dialog) icons on the desktop rearrange themselves. This is because icon positions are determined by files in the ~/.config/xfce4/desktop/
directory. Each time a change is made to the desktop (icons are added or removed or change position) a new file is generated in this directory and these files can conflict.
To solve the problem, navigate to the directory and delete all the files other than the one which correctly defines the icon positions. You can determine which file defines the correct icon positions by opening it and examining the locations of the icons. The topmost row is defined as row 0
and the leftmost column is defined by col 0
. Therefore an entry of:
[Firefox] row=3 col=0
means that the Firefox icon will be located on the 4th row of the leftmost column.
GTK themes not working with multiple monitors
Some configuration tools may corrupt displays.xml, which results in GTK themes under Applications Menu > Settings > Appearance ceasing to work. To fix the issue, delete ~/.config/xfce4/xfconf/xfce-perchannel-xml/displays.xml
and reconfigure your screens.
Xfce4-xkb-plugin settings issue
There is a bug in version 0.5.4.1-1 which causes xkb-plugin to lose keyboard, layout switching and compose key settings. As a workaround you may enable Use system defaults option in keyboard settings. To do so run
xfce4-keyboard-settings
Go to Layout tab and set the Use system defaults flag, then reconfigure xkb-plugin.
Users may find that icons do not appear when right-clicking options within some applications, including those made with Qt. This problem only appears to happen within Xfce. Run these two commands:
$ gconftool-2 --type boolean --set /desktop/gnome/interface/buttons_have_icons true $ gconftool-2 --type boolean --set /desktop/gnome/interface/menus_have_icons true
Keyboard settings are not saved in xkb-plugin
There is a bug in xfce4-xkb-plugin 0.5.4.1-1 which causes it to lose keyboard, layout switching and compose key settings. [6] As a workaround, enable Use system defaults in xfce4-keyboard-settings
, then reconfigure xfce4-xkb-plugin.
NVIDIA 和 xfce4-sensors-plugin
要探测NVIDIA的gpu温度需要安装 libxnvctrl 并且用 ABS 重新编译 xfce4-sensors-plugin 软件包。You also have the option of using xfce4-sensors-plugin-nvidiaAUR which replaces xfce4-sensors-plugin.
Panel applets keep being aligned on the left
Add a separator someplace before the right end and set its "expand" property. [7]
Preferred Applications preferences have no effect
Most applications rely on xdg-open for opening a preferred application for a given file or URL.
In order for xdg-open and xdg-settings to detect and integrate with the Xfce desktop environment correctly, you need to install the xorg-xprop package.
If you do not do that, your preferred applications preferences (set by exo-preferred-applications) will not be obeyed. Installing the package and allowing xdg-open to detect that you are running Xfce makes it forward all calls to exo-open instead, which correctly uses all your preferred applications preferences.
To make sure xdg-open integration is working correctly, ask xdg-settings for the default web browser and see what the result is:
# xdg-settings get default-web-browser
If it replies with:
xdg-settings: unknown desktop environment
it means that it has failed to detect Xfce as your desktop environment, which is likely due to a missing xorg-xprop package.
Restore default settings
If for any reason you need to revert back: to the default settings, rename ~/.config/xfce4-session/
and ~/.config/xfce4/
$ mv ~/.config/xfce4-session/ ~/.config/xfce4-session-bak $ mv ~/.config/xfce4/ ~/.config/xfce4-bak
Relogin for changes to take effect. If you get Unable to load a failsafe session
upon login, see the #Session failure section.
Session failure
Symptoms include:
- The mouse is an X and/or does not appear at all;
- Window decorations have disappeared and windows cannot be closed;
- (
xfwm4-settings
) will not start, reportingThese settings cannot work with your current window manager (unknown)
; - Errors reported by a display manager such as
No window manager registered on screen 0
. - Unable to load a failsafe session:
Unable to load a failsafe session. Unable to determine failsafe session name. Possible causes: xfconfd isn't running (D-Bus setup problem); environment variable $XDG_CONFIG_DIRS is set incorrectly (must include "/etc"), or xfce4-session is installed incorrectly.
Restarting xfce or rebooting your system may solve the problem, but a corrupt session is the likely cause. Delete the session folder:
$ rm -r ~/.cache/sessions/
Also make sure that the relevant folders in $HOME
are owned by the user starting xfce4
. See Chown.
Fonts in window title crashing xfce4-title
Install ttf-droid and ttf-dejavu. See also FS#44382.
Laptop lid settings ignored
You may find that the lid close settings in Xfce4 Power Manager are ignored, meaning that the laptop will always suspend on lid close, no matter what settings are chosen in the power manager. This is because the power manager is not set to handle lid close events by default. Instead, logind handles the lid close event. To change this behavior so that the the power manager handles lid close events, execute the following command:
$ xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/logind-handle-lid-switch -s false
Note that each time the laptop lid settings are changed in the power manager, this setting will be reset.
Rendering issues with Adwaita theme
Since the upgrade of gnome-themes-standard from 3.18.0-1 version to 3.20.0-1 the Adwaita theme exhibits several issues when being used in Xfce, like a frame around the notification area and dark background of the tooltip in eclipse.
A ugly solution is to downgrade the gnome-themes-standard to the old 3.18.0-1 meanwhile. The package can be downloaded at:
$ wget https://archive.archlinux.org/repos/2016/04/08/extra/os/$(uname -m)/gnome-themes-standard-3.18.0-1-$(uname -m).pkg.tar.xz
and installed via pacman's -U
option.
相关文章
- http://docs.xfce.org/ - The complete documentation.
- Xfce-Look - Themes, wallpapers, and more.
- Xfce Wikia - How to edit the auto generated menu with the menu editor
- Xfce Wiki