KDE

From Gentoo Wiki
Jump to:navigation Jump to:search
This page is a translated version of the page KDE and the translation is 58% complete.
Outdated translations are marked like this.

KDE 是一个自由软件社区,其提供了一组应用程序,包括流行的 Plasma 桌面环境。

Gentoo对KDE项目的支持非常好,包括对KDE Frameworks 5,Plasma 5和Applications的全面支持,以及其他各种各样基于KDE的软件。

准备

配置

重要
Read relevant documentation before performing any profile changes.

选择一个适当的Portage配置,尽管这不是必须的,但是我们仍建议这么做。因为这会设置一些全局或针对特定软件包的 USE 标记来确保你能够获得顺畅的 KDE 使用体验。

为了选择适当的Portage配置,首先需要列出有哪些可用的Portage配置

root #eselect profile list
  ...
  [1]   default/linux/amd64/17.1 (stable)
  [2]   default/linux/amd64/17.1/selinux (stable)
  [3]   default/linux/amd64/17.1/hardened (stable)
  [4]   default/linux/amd64/17.1/hardened/selinux (stable)
  [5]   default/linux/amd64/17.1/desktop (stable)
  [6]   default/linux/amd64/17.1/desktop/gnome (stable)
  [7]   default/linux/amd64/17.1/desktop/gnome/systemd (stable)
  [8]   default/linux/amd64/17.1/desktop/plasma (stable)
  [9]   default/linux/amd64/17.1/desktop/plasma/systemd (stable)
  ...

然后选择正确的Portage配置,把下面的命令中的X替换为合适的Portage配置对应的数字:

root #eselect profile set X
如果要使用 Plasma 5 桌面环境,请选择desktop/plasma  OpenRC或者 desktop/plasma/systemd  systemd/zh-cn。需要注意的是,技术上可能可以实现除配置文件的其他 USE 标记组合(特别是在运行选定的应用程序而不是完整的KDE Plasma桌面环境时),但可能不受支持,未经测试,也可能导致意外的功能丢失。

服务

在接下来的章节里,按着安装步骤,这些服务将会默认自动选上,具体的取决于之前选择的profile。但在第一次启动KDE Plasma之前,还是需要将它们设置妥当。为了不会使用默认设置,建议在安装KDE Plasma或者KDE发行服务之前,通过emerge --oneshot先安装这些服务,以便Portage将它们考虑进去。点按链接获取有关如何设置这些服务的信息。

会话管理器

从下列中只选一个:

  • elogind: 从systemd项目中提取的单独的logind服务包,用于OpenRC或其他初始化系统。
  • systemd: 使用systemd提供的会话管理器,systemd用户不需要为此做更多的工作。

设备管理器

提示
By default, systemd-utils is used on OpenRC systems, and systemd is used on systemd systems. Users who don't want to change providers should skip this step.

从下列中只选一个:

  • udev: 启用对udev Linux动态和固定设备命名的支持。
  • eudev: udev的分支,可更好地与旧内核和各种工具链兼容。不再被Gentoo 维护了,并不推荐。
  • systemd: 使用systemd提供的设备管理器,systemd用户不需要为此做更多的工作。

杂项

  • D-Bus: 使用D-Bus消息总线系统。
  • polkit: 启用polkit框架以获得控制全局服务的权限。
  • udisks: 启用对一些存储相关服务的支持。

X 服务

阅读下列来自 X server 的介绍来设置 X 环境。

Plasma

Plasma 5 是 KDE 正在发展的一代桌面环境,基于 Qt 5 和 KDE Framework 5 。

可用版本


KDE Gentoo Ebuild repository Status
KDE Plasma 5.27.11 kde-plasma/plasma-meta-5.27.11 gentoo Stable for amd64, arm64, and x86; Testing for arm, loong, ppc64, riscv
KDE Plasma 6.0.3 kde-plasma/plasma-meta-6.0.3 gentoo Masked, testing for amd64
KDE Plasma 6.0 stable branch kde-plasma/plasma-meta-6.0.49.9999 KDE Live version
KDE Plasma 6 master branch kde-plasma/plasma-meta-9999 KDE Live version
附注
在继续安装之前,请确保选择了一个 Plasma 的Portage配置

安装

USE flags

kde-plasma/plasma-meta 包提供完整的 Plasma 5 桌面,可通过丰富的 USE 标记配置:

USE flags for kde-plasma/plasma-meta Merge this to pull in all Plasma 6 packages

accessibility Add support for accessibility (eg 'at-spi' library)
bluetooth Enable Bluetooth Support
browser-integration Enable integration with Chrome/Firefox with browser extensions
colord Enable kde-plasma/kwin color management via x11-misc/colord
crash-handler Pull in kde-plasma/drkonqi for assisted upstream crash reports
crypt Pull in kde-plasma/plasma-vault for encrypted vaults integration
cups Add support for CUPS (Common Unix Printing System)
desktop-portal Enable sys-apps/xdg-desktop-portal backend implementation for Plasma
discover Pull in resources management GUI; a centralised GHNS alternative and optional sys-apps/fwupd frontend
display-manager Pull in a graphical display manager
elogind Enable session tracking via sys-auth/elogind
firewall Pull in kde-plasma/plasma-firewall for system firewall administration
flatpak Pull in kde-plasma/flatpak-kcm for flatpak permissions administration
grub Pull in Breeze theme for sys-boot/grub
gtk Enable Breeze widget style and system settings module for GTK+
handbook Enable handbooks generation for packages by KDE
kwallet Enable support for KWallet auto-unlocking via kde-plasma/kwallet-pam
legacy-systray Add support for legacy applications using kde-plasma/xembed-sni-proxy
networkmanager Enable net-misc/networkmanager support
oxygen-theme Pull in Oxygen icons, sound theme and visual style for KDE Plasma
plymouth Pull in Breeze theme for sys-boot/plymouth
pulseaudio Install Plasma applet for PulseAudio volume management
qt5 Pull in required packages for seamless integration of KF5/Qt5-based applications
sddm Pull in the x11-misc/sddm display manager and system settings module
sdk Pull in kde-plasma/plasma-sdk for Plasma development
smart Pull in kde-plasma/plasma-disks for disk health monitoring
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
thunderbolt Pull in kde-plasma/plasma-thunderbolt control center module
unsupported Allow packages that are known to ruin runtime experience ** DO NOT FILE BUGS WITH THIS ENABLED **
wacom Pull in kde-plasma/wacomtablet control center module
wallpapers Install wallpapers for the Plasma Workspace
webengine Use kde-apps/khelpcenter to access the locally installed KDE Help System Handbook
xwayland Enable Wayland windows screensharing to XWayland applications via gui-apps/xwaylandvideobridge

USE flags for kde-plasma/plasma-meta Merge this to pull in all Plasma 6 packages

accessibility Add support for accessibility (eg 'at-spi' library)
bluetooth Enable Bluetooth Support
browser-integration Enable integration with Chrome/Firefox with browser extensions
colord Enable kde-plasma/kwin color management via x11-misc/colord
crash-handler Pull in kde-plasma/drkonqi for assisted upstream crash reports
crypt Pull in kde-plasma/plasma-vault for encrypted vaults integration
cups Add support for CUPS (Common Unix Printing System)
desktop-portal Enable sys-apps/xdg-desktop-portal backend implementation for Plasma
discover Pull in resources management GUI; a centralised GHNS alternative and optional sys-apps/fwupd frontend
display-manager Pull in a graphical display manager
elogind Enable session tracking via sys-auth/elogind
firewall Pull in kde-plasma/plasma-firewall for system firewall administration
flatpak Pull in kde-plasma/flatpak-kcm for flatpak permissions administration
grub Pull in Breeze theme for sys-boot/grub
gtk Enable Breeze widget style and system settings module for GTK+
handbook Enable handbooks generation for packages by KDE
kwallet Enable support for KWallet auto-unlocking via kde-plasma/kwallet-pam
legacy-systray Add support for legacy applications using kde-plasma/xembed-sni-proxy
networkmanager Enable net-misc/networkmanager support
oxygen-theme Pull in Oxygen icons, sound theme and visual style for KDE Plasma
plymouth Pull in Breeze theme for sys-boot/plymouth
pulseaudio Install Plasma applet for PulseAudio volume management
qt5 Pull in required packages for seamless integration of KF5/Qt5-based applications
sddm Pull in the x11-misc/sddm display manager and system settings module
sdk Pull in kde-plasma/plasma-sdk for Plasma development
smart Pull in kde-plasma/plasma-disks for disk health monitoring
systemd Enable use of systemd-specific libraries and features like socket activation or session tracking
thunderbolt Pull in kde-plasma/plasma-thunderbolt control center module
unsupported Allow packages that are known to ruin runtime experience ** DO NOT FILE BUGS WITH THIS ENABLED **
wacom Pull in kde-plasma/wacomtablet control center module
wallpapers Install wallpapers for the Plasma Workspace
webengine Use kde-apps/khelpcenter to access the locally installed KDE Help System Handbook
xwayland Enable Wayland windows screensharing to XWayland applications via gui-apps/xwaylandvideobridge

Emerge

root #emerge --ask kde-plasma/plasma-meta

你也可以选择安装 kde-plasma/plasma-desktop,它提供了一个非常基本的桌面,让用户可以自由安装他们需要的额外软件包 - 或者更确切地说,让他们自己找出并补全缺少的功能。

警告
请注意,仅安装kde-plasma/plasma-desktop会丢失重要的软件包,例如kde-plasma/powerdevil(电源管理,挂起和休眠选项),kde-plasma/systemsettings等等,在这种情况下都不会被支持。

开始使用 Plasma

Display manager

SDDM (Simple Desktop Display Manager) 是被推荐的登录管理器并且它默认会通过 kde-plasma/plasma-meta 被自动安装。 另外你也可以选择使用 LightDM ,这需要为 kde-plasma/plasma-meta 设置 -sddm 的 USE 标记,同时还要修改 /etc/conf.d/xdm 中的设置。 同时在发生错误时请阅读 SDDM 页面。

无显示管理器

Plasma 可以用startx以老式方式启动,但需要格外小心以确保它获得有效的会话。

文件 ~/.xinitrc
#!/bin/sh
exec dbus-launch --exit-with-session startplasma-x11

When using Wayland, Plasma can be launched with dbus-launch --exit-with-session startplasma-wayland.

This can be added to a user's profile file which will be executed when logging in:

文件 ~/.profile
#!/bin/sh
dbus-launch --exit-with-session startplasma-wayland

小工具

kde-plasma/kdeplasma-addons 提供了很多有用的小工具 (早就被 kde-plasma/plasma-meta作为依赖安装了):

root #emerge --ask kde-plasma/kdeplasma-addons

系统托盘

Plasma 5 对系统托盘图标使用StatusNotifier规范 [1]。由于并非所有应用程序都已移植到新系统,因此需要一些应变方法 [2],并且 Plasma 5 也具有将旧的基于xembed的系统托盘图标转换为StatusNotifier图标的方法。

通过激活kde-plasma/plasma-metalegacy-systray 来启用传统支持,这将引入kde-plasma/xembed-sni-proxy

文件 /etc/portage/package.use/kde-plasma-settingsChange USE flags for kde-plasma/plasma-meta
# xembed system tray support for legacy applications
kde-plasma/plasma-meta legacy-systray

Pidgin

net-im/pidgin 需要 x11-plugins/pidgin-indicator。安装完成后,在 工具|插件 下可以找到 Ubuntu 指示器 插件。

KWallet

在登录桌面后添加一个(无线)网络连接或者在kde-apps/kmail中添加一个电子邮箱账户时,许多用户被推荐使用 kde-frameworks/kwallet —— Plasma桌面的加密密码存储器。

有个软件包kde-apps/kwalletmanager,可用于管理KWallets,导入及导出密码:

root #emerge --ask kde-apps/kwalletmanager

KWallet 自动解锁

kde-plasma/kwallet-pam 提供了一种机制,可以避免在登录后即被要求访问kwallet。

root #emerge --ask kde-plasma/kwallet-pam

需要如下的配置:

  • For KWallet security, use classic blowfish encryption instead of GPG
  • Choose same password for login and kwallet
  • Configure a display manager with support for PAM - both x11-misc/sddm and x11-misc/lightdm fulfill that requirement:
文件 /etc/pam.d/sddmConfig lines for KWallet PAM unlocking via SDDM
-auth           optional        pam_kwallet5.so
-session        optional        pam_kwallet5.so auto_start

For unlocking on tty login (no display manager, or like gui-apps/tuigreet), edit /etc/pam.d/login accordingly. You will need to specify the force_run parameter.

文件 /etc/pam.d/greetdConfig lines for KWallet PAM unlocking via Greetd
-auth           optional        pam_kwallet5.so
-session        optional        pam_kwallet5.so auto_start force_run
附注
对于LightDM, 需要自己编辑/etc/pam.d/lightdm
附注
If the filesystem containing a user's KWallet files is mounted by pam_mount upon logging on, it may be required to copy ~/.local/share/kwalletd/kdewallet.salt to the same path on the root filesystem. Otherwise, PAM attempts to unlock KWallet before the home directory is available and fails. The file ~/.local/share/kwalletd/kdewallet.kwl which actually contains the encrypted KWallet passwords does not need to be copied.

禁用 KWallet

要完全禁用KWallet子系统,请编辑以下文件:

文件 ~/.config/kwalletrc
[Wallet]
Enabled=false

SSH/GPG 密钥启动/关闭脚本

ssh-agent 脚本位于 /etc/xdg/plasma-workspace/env

/etc/xdg/plasma-workspace/shutdown。关闭脚本需要设置可执行位,因为它们不是源。Keychain 提供了更多信息

Non-root user authentication for dialogs

Some KDE dialogs such as printers, adding wireless networks and adding users require administrator authentication. This is handled through sys-auth/polkit and operates independently from app-admin/sudo. By default in Gentoo, the root account is the only administrator, and so even if a user account can run root commands through sudo, authentication in these KDE dialogs will fail.

Adding wireless networks using net-misc/networkmanager is allowed by a polkit rule which is part of the Gentoo package and already allows access for every user in the group plugdev. For other dialogs the behavior must be configured manually: If all users of the group wheel are required to be administrators, create a copy of /usr/share/polkit-1/rules.d/50-default.rules starting with a number lower than 50, and edit the line return ["unix-user:0"] to the following:

文件 /etc/polkit-1/rules.d/49-wheel.rulesAdministrator wheel group
polkit.addAdminRule(function(action, subject) {
    return ["unix-group:wheel"];
});

The Polkit wiki page provides more details on rules configuration.

使用root权限运行 GUI 应用

警告
使用root权限启动 GUI 应用可能是一个 非常 坏的主意。相比之下,更好的办法是将常规用户添加到相应的组或者只是无提权地运行命令。只有在绝对必要时才使用 kdesu

KDE Plasma有一个实用程序,用于以root权限启动图形应用。它由kde-plasma/kde-cli-tools提供 - 要使用 USE 标记kdesu构建。这将会安装kde-frameworks/kdesu的一个图形前端。这依赖Xorg,并且仅在X[3]内有效。

文件 /etc/portage/package.use/kde-plasma-settingsChange USE flags for kde-plasma/kde-cli-tools
# 为kde-frameworks/kdesu构建图形前端(需要X)
kde-plasma/kde-cli-tools kdesu X

记得要重建软件包以获取更改:

root #emerge -1 kde-cli-tools

可以通过从KRunner或终端仿真器调用kdesu来使用它:

user $kdesu <program-name>

将显示一个消息对话框,提示输入root密码。

附注
出于安全原因,某些应用(如kwrite、dolphin等)拒绝使用kdesu打开。
附注
{{{1}}}

文件

XDG standard directories are being used for KDE Plasma and KDE applications:

  • $XDG_CONFIG_HOME (defaults to $HOME/.config) - Configuration files
  • $XDG_DATA_HOME (defaults to $HOME/.local/share) - Application data

移除

The first step to remove KDE Plasma and its dependencies is to unmerge kde-plasma/plasma-meta. This will not yet remove any files from the installation, so the desktop environment will keep running:

root #emerge --ask --depclean --verbose kde-plasma/plasma-meta

In a next step it makes sense to scan /etc/portage directory for any KDE Plasma specific entries in package.mask, package.unmask and package.accept_keywords and clean them up.

Finally, run the command to uninstall any Plasma packages and their dependencies. It would make sense to quit any running Plasma session beforehand:

root #emerge --ask --depclean  
警告
Please note that this will not just remove KDE Plasma but also any other package not registered (or being depended on) in @world. It makes sense to carefully read through the list of packages to be removed before continuing. Alternatively, run this command prior to unmerging of kde-plasma/plasma-meta to get an overview of already dangling packages on the system.

应用程序(Applications)

发行服务版本包含很多基于 Qt 5/KDE Frameworks 5 的应用程序和支持库。

可用版本

KDE Gentoo Ebuild repository Status
KDE Gear 23.08.5 kde-apps/kde-apps-meta-23.08.5 gentoo Stable for amd64, arm64, ppc64 and x86
KDE Gear 24.02.2 kde-apps/kde-apps-meta-24.02.2 gentoo Masked, testing for amd64
KDE Gear master branch kde-apps/kde-apps-meta-9999 KDE Live version

KDE 发行服务这个包会安装以下包:

Package name Description
kde-apps/kdeaccessibility-meta Accessibility applications and utilities.
kde-apps/kdeadmin-meta Administrative utilities, which helps in managing the system.
kde-apps/kdecore-meta Basic applications such as file browser, editor, terminal emulator.
kde-apps/kdeedu-meta Educational applications and games.
kde-apps/kdegames-meta Standard desktop games.
kde-apps/kdegraphics-meta Graphics applications such as image viewers, color pickers, etc.
kde-apps/kdemultimedia-meta Audio and video playback applications and services.
kde-apps/kdenetwork-meta Network applications and VNC services.
kde-apps/kdepim-meta PIM applications such as emailer, addressbook, organizer, etc.
kde-apps/kdesdk-meta Various development tools.
kde-apps/kdeutils-meta Standard desktop utilities such as a archiver, a calculator, etc.

安装

kde-apps/kde-apps-meta 包提供完整的发行服务集合,但是可替代地,可以挑选来自上述列表的一个或多个较小的元包:

root #emerge --ask kde-apps/kde-apps-meta

If not all the packages are required, one or several smaller meta packages from the list above may be picked instead. Alternatively, it is possible to set USE flags to reduce the number of applications installed by kde-apps/kde-apps-meta.

本地化

Plasma-5 和应用程序的每个包都提供了本地化文件。可以在系统设置中启用本地化。

KDE PIM

KDE PIM 是一整套用于管理个人信息的应用程序,包括邮件,日历,联系人等。它有几个可选的运行时依赖来扩展其功能:

框架(Frameworks)

KDE Frameworks 5 是一套运行库和软件框架的合集,为KDE Plasma 5 和 KDE 应用提供基础,但是可能会受到一些 Qt 程序的影响。

KDE 框架大部分是运行库,只提供少量的面对用户的功能。它不需要被手动安装 —— 需要的软件包会被作为别的软件包的依赖自动安装。

可用版本


KDE Gentoo Ebuild repository Status
KDE Frameworks 5.115.0 kde-frameworks/*-5.115.0 gentoo Stable for amd64, arm64, and x86; testing for arm, loong, ppc64 and riscv
KDE Frameworks 6.1.0 kde-frameworks/*-6.1.0 gentoo Masked, testing for amd64
KDE Frameworks 5 (kf5) branch kde-frameworks/*-5.239.9999 KDE Live version
KDE Frameworks 6 (master) branch kde-frameworks/*-9999 KDE Live version

更多KDE软件

最主要的 KDE 应用程序在 Porage 树的 kde-appskde-misc 分类中。

故障排除

请参阅 故障排除 子文章。

另请参阅

外部资源

References