https://wiki.archlinux.org/api.php?action=feedcontributions&user=Fince&feedformat=atomArchWiki - User contributions [en]2024-03-28T11:09:53ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Improving_performance_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=730091Improving performance (简体中文)2022-05-19T07:17:03Z<p>Fince: minor edit</p>
<hr />
<div>[[Category:Hardware (简体中文)]]<br />
[[Category:System administration (简体中文)]]<br />
[[en:Improving performance]]<br />
[[es:Improving performance]]<br />
[[fr:Improving performance]]<br />
[[ja:パフォーマンスの最大化]]<br />
[[pt:Improving performance]]<br />
[[ru:Improving performance]]<br />
{{Bad translation (简体中文)|部分内容未翻译,部分内容翻译质量较差}}<br />
{{TranslationStatus (简体中文)|Improving performance|2022-05-19|726654}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|/Boot process}}<br />
{{Related|Pacman/Tips and tricks#Performance}}<br />
{{Related|OpenSSH#Speeding up SSH}}<br />
{{Related|Openoffice#Speed up OpenOffice}}<br />
{{Related|Laptop}}<br />
{{Related|Preload}}<br />
{{Related articles end}}<br />
本文将介绍与性能有关的系统诊断知识和具体步骤,通过减少资源消耗等方式优化系统性能。<br />
<br />
== 基础 ==<br />
<br />
=== 了解系统 ===<br />
<br />
性能优化的最佳方法是找到瓶颈或拖慢整体速度的子系统。查看系统细节可以帮助确定问题。<br />
<br />
*如果在同时运行多个大型程序时卡顿(如 LibreOffice、Firefox 等),请检查内存容量是否充足。使用以下命令,并检查“available”一列的数值:{{bc|$ free -h}}<br />
<br />
*如果电脑开机很慢,并且(仅在)第一次打开应用时加载很慢,可能是因为硬盘速度过慢。可以用{{ic|hdparm}}命令测试硬盘速度:{{bc|# hdparm -t /dev/sd''X''}}<br />
<br />
{{注意|{{Pkg|hdparm}} 只代表了硬盘的读取速度,并没有进行有效的评分。空闲时读取速度只要高于 40MB/s 就可以满足大多数系统。}}<br />
<br />
* 如果内存足够而 CPU 占用率居高不下,可以尝试停止进程或禁用 [[Daemons (简体中文)|守护服务]]。有多种方法可以监测 CPU 负荷,例如 {{pkg|htop}}、{{ic|pstree}} 或其他 [[List_of_applications_(简体中文)#系统监视器|系统监视器]]:{{bc|$ htop}}<br />
<br />
*如果使用直接渲染(GPU 渲染)的应用运行卡顿(比如使用 GPU 的视频播放器、游戏甚至[[窗口管理器]]),改善 GPU 的性能应当有所帮助。首先需要检查直接渲染是否已经开启。可以使用 {{Pkg|mesa-demos}} 中的 {{ic|glxinfo}} 命令:{{bc|$ glxinfo {{!}} grep "direct rendering"}},如果开启了,则会返回{{ic|direct rendering: Yes}}。<br />
<br />
* 使用 [[桌面环境]]时,禁用桌面特效或许可以减少 GPU 使用。如果当前的桌面环境不符合硬件或个人需求,可以使用一个更轻量的桌面环境或 [[Desktop_environment_(简体中文)#自己打造桌面环境|自己打造桌面环境]] 。<br />
<br />
=== 基准测试 ===<br />
<br />
为定量评估优化成果,可使用[[benchmarking (简体中文)|基准测试]]。<br />
<br />
== 存储设备 ==<br />
<br />
=== 多硬件路径 ===<br />
<br />
内部硬件路径意指储存设备是如何连接到主板的。例如 TCP/IP 经由 NIC、即插即用设备可以使用 PCIe/PCI、火线、RAID 卡 、USB 等。通过将储存设备均分到这些接口可以最大化主板的性能,比如将六个硬盘接连到 USB 要比三个连接到 USB、三个连接到火线要慢。原因是主板上的接口点类似管道,而管道同一时间的最大流量是有上限的。幸运的是主板通常会有多个管道。<br />
<br />
此外,假设电脑前面有两个 USB 插口,后面有四个 USB 插口,那么前面插两个、后面插两个应当要比前面插一个、后面插三个更快。这是因为前面的插口可能是多个根 Hub 设备,也就是说它可以在同一时间发送更多的数据。<br />
<br />
使用下面的命令查看机器上是否有多个路径:<br />
<br />
{{hc|USB设备树|$ lsusb -tv}}<br />
<br />
{{hc|PCI设备树|$ lspci -tv}}<br />
<br />
=== 分区 ===<br />
<br />
确保您已经[[Partitioning_(简体中文)#分区对齐|对齐分区]]。<br />
<br />
==== 多硬盘 ====<br />
<br />
如果有多个硬盘,将其设置为软件 [[RAID (简体中文)|RAID]] 可以提升速度。<br />
<br />
在分离的硬盘上创建 [[swap (简体中文)|交换空间]] 也有所帮助,尤其是使用交换空间十分频繁时。<br />
<br />
==== 机械硬盘布局 ====<br />
<br />
{{Out of date (简体中文)|此操作可能不适用于多盘片的硬盘。}}<br />
<br />
如果使用传统的机械硬盘,您的分区布局会影响系统的性能。驱动器开头(靠近磁盘外部)的扇区比末尾的扇区要快。此外,较小的分区不需要驱动器磁头大幅度移动,从而加快磁盘的操作。因此,建议为您的系统创建一个小分区(10GB,或多或少取决于您的需要),并且尽可能靠近驱动器开头。其他数据(图片、视频)应该存放在一个单独的分区上,这通常是通过将家目录({{ic|/home/''user''}})与根目录({{ic|/}})分开来实现的。<br />
<br />
=== 选择并调整文件系统 ===<br />
<br />
为系统选择合适的文件系统十分重要,因为不同文件系统有各自的优势。[[File systems]] 文中对主流文件系统作了简短的总结,也可以在 [[:Category:File systems]] 中阅读其他相关文章。<br />
<br />
==== 挂载选项 ====<br />
<br />
The [[fstab#atime options|noatime]] option is known to improve performance of the filesystem.<br />
<br />
Other mount options are filesystem specific, therefore see the relevant articles for the filesystems:<br />
<br />
* [[Ext3]]<br />
* [[Ext4#Improving performance]]<br />
* [[JFS Filesystem#Optimizations]]<br />
* [[XFS#Performance]]<br />
* [[Btrfs#Defragmentation]], [[Btrfs#Compression]], and {{man|5|btrfs}}<br />
* [[ZFS#Tuning]]<br />
* [[NTFS#Improving performance]]<br />
<br />
===== 文件系统 =====<br />
<br />
{{Ic|1=data=writeback}} 挂载选项可提高速度, 但可能会在断电期间损坏数据. {{Ic|notail}} 挂载选项将文件系统使用的空间增加了大约 5% , 但也提高了整体速度. 您还可以通过将日志和数据放在单独的驱动器上来减少磁盘负载。 这是在创建文件系统时完成的: <br />
<br />
# mkreiserfs –j /dev/sd'''a1''' /dev/sd'''b1'''<br />
<br />
Replace {{ic|/dev/sd'''a1'''}} with the partition reserved for the journal, and {{ic|/dev/sd'''b1'''}} with the partition for data. You can learn more about reiserfs with [[Funtoo:Funtoo Filesystem Guide, Part 2|Funtoo Filesystem Guide]].<br />
<br />
=== 更改内核选项 ===<br />
<br />
There are several key tunables affecting the performance of block devices, see [[sysctl#Virtual memory]] for more information.<br />
<br />
=== I/O 调度 ===<br />
<br />
==== 背景信息 ====<br />
<br />
The input/output ''(I/O)'' scheduler is the kernel component that decides in which order the block I/O operations are submitted to storage devices. It is useful to remind here some specifications of two main drive types because the goal of the I/O scheduler is to optimize the way these are able to deal with read requests:<br />
<br />
* An HDD has spinning disks and a head that moves physically to the required location. Therefore, random latency is quite high ranging between 3 and 12ms (whether it is a high end server drive or a laptop drive and bypassing the disk controller write buffer) while sequential access provides much higher throughput. The typical HDD throughput is about 200 I/O operations per second ''(IOPS)''.<br />
<br />
* An SSD does not have moving parts, random access is as fast as sequential one, typically under 0.1ms, and it can handle multiple concurrent requests. The typical SSD throughput is greater than 10,000 IOPS, which is more than needed in common workload situations.<br />
<br />
If there are many processes making I/O requests to different storage parts, thousands of IOPS can be generated while a typical HDD can handle only about 200 IOPS. There is a queue of requests that have to wait for access to the storage. This is where the I/O schedulers plays an optimization role.<br />
<br />
==== 调度算法 ====<br />
<br />
One way to improve throughput is to linearize access: by ordering waiting requests by their logical address and grouping the closest ones. Historically this was the first Linux I/O scheduler called [[Wikipedia:Elevator algorithm|elevator]].<br />
<br />
One issue with the elevator algorithm is that it is not optimal for a process doing sequential access: reading a block of data, processing it for several microseconds then reading next block and so on. The elevator scheduler does not know that the process is about to read another block nearby and, thus, moves to another request by another process at some other location. The [[Wikipedia:Anticipatory scheduling|anticipatory]] I/O scheduler overcomes the problem: it pauses for a few milliseconds in anticipation of another close-by read operation before dealing with another request.<br />
<br />
While these schedulers try to improve total throughput, they might leave some unlucky requests waiting for a very long time. As an example, imagine the majority of processes make requests at the beginning of the storage space while an unlucky process makes a request at the other end of storage. This potentially infinite postponement of the process is called starvation. To improve fairness, the [[Wikipedia:Deadline scheduler|deadline]] algorithm was developed. It has a queue ordered by address, similar to the elevator, but if some request sits in this queue for too long then it moves to an "expired" queue ordered by expire time. The scheduler checks the expire queue first and processes requests from there and only then moves to the elevator queue. Note that this fairness has a negative impact on overall throughput.<br />
<br />
The [[Wikipedia:CFQ|Completely Fair Queuing (CFQ)]] approaches the problem differently by allocating a timeslice and a number of allowed requests by queue depending on the priority of the process submitting them. It supports [[cgroup]] that allows to reserve some amount of I/O to a specific collection of processes. It is in particular useful for shared and cloud hosting: users who paid for some IOPS want to get their share whenever needed. Also, it idles at the end of synchronous I/O waiting for other nearby operations, taking over this feature from the ''anticipatory'' scheduler and bringing some enhancements. Both the ''anticipatory'' and the ''elevator'' schedulers were decommissioned from the Linux kernel replaced by the more advanced alternatives presented below.<br />
<br />
The [https://algo.ing.unimo.it/people/paolo/disk_sched/ Budget Fair Queuing (BFQ)] is based on CFQ code and brings some enhancements. It does not grant the disk to each process for a fixed time-slice but assigns a "budget" measured in number of sectors to the process and uses heuristics. It is a relatively complex scheduler, it may be more adapted to rotational drives and slow SSDs because its high per-operation overhead, especially if associated with a slow CPU, can slow down fast devices. The objective of BFQ on personal systems is that for interactive tasks, the storage device is virtually as responsive as if it was idle. In its default configuration it focuses on delivering the lowest latency rather than achieving the maximum throughput.<br />
<br />
[https://lwn.net/Articles/720675/ Kyber] is a recent scheduler inspired by active queue management techniques used for network routing. The implementation is based on "tokens" that serve as a mechanism for limiting requests. A queuing token is required to allocate a request, this is used to prevent starvation of requests. A dispatch token is also needed and limits the operations of a certain priority on a given device. Finally, a target read latency is defined and the scheduler tunes itself to reach this latency goal. The implementation of the algorithm is relatively simple and it is deemed efficient for fast devices.<br />
<br />
==== 内核的 I/O 调度器 ====<br />
<br />
While some of the early algorithms have now been decommissioned, the official Linux kernel supports a number of I/O schedulers which can be split into two categories:<br />
<br />
*The '''multi-queue schedulers''' are available by default with the kernel. The [https://www.thomas-krenn.com/en/wiki/Linux_Multi-Queue_Block_IO_Queueing_Mechanism_(blk-mq) Multi-Queue Block I/O Queuing Mechanism (blk-mq)] maps I/O queries to multiple queues, the tasks are distributed across threads and therefore CPU cores. Within this framework the following schedulers are available:<br />
**''None'', where no queuing algorithm is applied.<br />
**''mq-deadline'', the adaptation of the deadline scheduler (see below) to multi-threading.<br />
**''Kyber''<br />
**''BFQ''<br />
<br />
*The '''single-queue schedulers''' are legacy schedulers:<br />
**[[w:Noop scheduler|NOOP]] is the simplest scheduler, it inserts all incoming I/O requests into a simple FIFO queue and implements request merging. In this algorithm, there is no re-ordering of the request based on the sector number. Therefore it can be used if the ordering is dealt with at another layer, at the device level for example, or if it does not matter, for SSDs for instance.<br />
**[[w:Deadline scheduler|Deadline]]<br />
**[[w:CFQ|CFQ]]<br />
<br />
:{{Note (简体中文)|1=Single-queue schedulers [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f382fb0bcef4c37dc049e9f6963e3baf204d815c were removed from kernel since Linux 5.0].}}<br />
<br />
==== 更改 I/O 调度器 ====<br />
<br />
{{Note (简体中文)|The best choice of scheduler depends on both the device and the exact nature of the workload. Also, the throughput in MB/s is not the only measure of performance: deadline or fairness deteriorate the overall throughput but may improve system responsiveness. [[Benchmarking]] may be useful to indicate each I/O scheduler performance.}}<br />
<br />
To list the available schedulers for a device and the active scheduler (in brackets):<br />
<br />
{{hc|$ cat /sys/block/'''''sda'''''/queue/scheduler|<br />
mq-deadline kyber [bfq] none<br />
}}<br />
<br />
To list the available schedulers for all devices:<br />
<br />
{{hc|$ grep "" /sys/block/'''*'''/queue/scheduler|<br />
/sys/block/pktcdvd0/queue/scheduler:none<br />
/sys/block/sda/queue/scheduler:mq-deadline kyber [bfq] none<br />
/sys/block/sr0/queue/scheduler:[mq-deadline] kyber bfq none<br />
}}<br />
<br />
To change the active I/O scheduler to ''bfq'' for device ''sda'', use:<br />
<br />
# echo '''''bfq''''' > /sys/block/'''''sda'''''/queue/scheduler<br />
<br />
The process to change I/O scheduler, depending on whether the disk is rotating or not can be automated and persist across reboots. For example the [[udev]] rule below sets the scheduler to ''none'' for [[NVMe]], ''mq-deadline'' for [[SSD]]/eMMC, and ''bfq'' for rotational drives:<br />
<br />
{{hc|/etc/udev/rules.d/60-ioschedulers.rules|2=<br />
# set scheduler for NVMe<br />
ACTION=="add{{!}}change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none"<br />
# set scheduler for SSD and eMMC<br />
ACTION=="add{{!}}change", KERNEL=="sd[a-z]{{!}}mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"<br />
# set scheduler for rotating disks<br />
ACTION=="add{{!}}change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"<br />
}}<br />
<br />
Reboot or force [[udev#Loading new rules]].<br />
<br />
==== 使用 I/O 调度器 ====<br />
<br />
Each of the kernel's I/O scheduler has its own tunables, such as the latency time, the expiry time or the FIFO parameters. They are helpful in adjusting the algorithm to a particular combination of device and workload. This is typically to achieve a higher throughput or a lower latency for a given utilization.<br />
The tunables and their description can be found within the [https://www.kernel.org/doc/html/latest/block/index.html kernel documentation].<br />
<br />
To list the available tunables for a device, in the example below ''sdb'' which is using ''deadline'', use:<br />
<br />
{{hc|$ ls /sys/block/'''''sdb'''''/queue/iosched|<br />
fifo_batch front_merges read_expire write_expire writes_starved}}<br />
<br />
To improve ''deadline'''s throughput at the cost of latency, one can increase {{ic|fifo_batch}} with the command:<br />
<br />
{{bc|# echo ''32'' > /sys/block/'''''sdb'''''/queue/iosched/'''fifo_batch'''}}<br />
<br />
=== 电源管理配置 ===<br />
<br />
When dealing with traditional rotational disks (HDD's) you may want to [[Hdparm#Power_management_configuration|lower or disable power saving features]] completely.<br />
<br />
=== 减少磁盘读写 ===<br />
<br />
Avoiding unnecessary access to slow storage drives is good for performance and also increasing lifetime of the devices, although on modern hardware the difference in life expectancy is usually negligible.<br />
<br />
{{Note (简体中文)|A 32GB SSD with a mediocre 10x write amplification factor, a standard 10000 write/erase cycle, and '''10GB of data written per day''', would get an '''8 years life expectancy'''. It gets better with bigger SSDs and modern controllers with less write amplification. Also compare [https://techreport.com/review/25889/the-ssd-endurance-experiment-500tb-update] when considering whether any particular strategy to limit disk writes is actually needed.}}<br />
<br />
==== 显示磁盘写信息 ====<br />
<br />
The {{Pkg|iotop}} package can sort by disk writes, and show how much and how frequently programs are writing to the disk. See {{man|8|iotop}} for details.<br />
<br />
==== 重定位文件到 tmpfs ====<br />
<br />
Relocate files, such as your browser profile, to a [[tmpfs]] file system, for improvements in application response as all the files are now stored in RAM:<br />
<br />
* Refer to [[Profile-sync-daemon]] for syncing browser profiles. Certain browsers might need special attention, see e.g. [[Firefox on RAM]].<br />
* Refer to [[Anything-sync-daemon]] for syncing any specified folder.<br />
* Refer to [[Makepkg#Improving compile times]] for improving compile times by building packages in tmpfs.<br />
<br />
==== 文件系统 ====<br />
<br />
Refer to corresponding [[file system]] page in case there were performance improvements instructions, e.g. [[Ext4#Improving performance]] and [[XFS#Performance]].<br />
<br />
==== 交换空间 ====<br />
<br />
见 [[Swap (简体中文)#性能优化]]。<br />
<br />
==== Writeback interval 和缓冲区大小 ====<br />
<br />
详见 [[Sysctl#Virtual memory]]。<br />
<br />
=== 使用 ionice 调度储存 I/O ===<br />
<br />
Many tasks such as backups do not rely on a short storage I/O delay or high storage I/O bandwidth to fulfil their task, they can be classified as background tasks. On the other hand quick I/O is necessary for good UI responsiveness on the desktop. Therefore it is beneficial to reduce the amount of storage bandwidth available to background tasks, whilst other tasks are in need of storage I/O. This can be achieved by making use of the linux I/O scheduler CFQ, which allows setting different priorities for processes.<br />
<br />
The I/O priority of a background process can be reduced to the "Idle" level by starting it with<br />
<br />
# ionice -c 3 command<br />
<br />
See [https://www.cyberciti.biz/tips/linux-set-io-scheduling-class-priority.html a short introduction to ionice] and {{man|1|ionice}} for more information.<br />
<br />
== CPU ==<br />
<br />
=== 超频 ===<br />
<br />
[[Wikipedia:Overclocking|超频]]通过提升 CPU 的时钟频率提升电脑性能,超频能力取决于 CPU 和主板的型号。通常使用 BIOS 进行超频。超频也会带来风险和不便,这里既不推荐超频也不反对超频。<br />
<br />
Many Intel chips will not correctly report their clock frequency to acpi_cpufreq and most other utilities. This will result in excessive messages in [[dmesg]], which can be avoided by unloading and blacklisting the kernel module {{ic|acpi_cpufreq}}.<br />
To read their clock speed use ''i7z'' from the {{Pkg|i7z}} package. To check for correct operation of an overclocked CPU, it is recommended to do [[stress testing]].<br />
<br />
=== 自动调整频率 ===<br />
<br />
见 [[CPU frequency scaling]]。<br />
<br />
=== Tweak default scheduler (CFS) for responsiveness ===<br />
<br />
The default CPU scheduler in the mainline Linux kernel is [[Wikipedia:Completely_Fair_Scheduler|CFS]].<br />
<br />
The upstream default settings are tweaked for high throughput which make the desktop applications unresponsive under heavy CPU loads.<br />
<br />
The {{AUR|cfs-zen-tweaks}} package contains a script that sets up the CFS to use the same settings as the {{Pkg|linux-zen}} kernel. To run the script on startup, [[enable/start]] {{ic|set-cfs-tweaks.service}}.<br />
<br />
=== Alternative CPU schedulers ===<br />
<br />
* {{App|[[Wikipedia:Brain_Fuck_Scheduler#MuQSS|MuQSS]]|Multiple Queue Skiplist Scheduler. Available with the {{ic|-ck}} patch set developed by [[Wikipedia:Con_Kolivas|Con Kolivas]].|[[Unofficial user repositories/Repo-ck]]|{{AUR|linux-ck}}}}<br />
* {{App|[https://cchalpha.blogspot.com/search/label/PDS PDS]|Priority and Deadline based Skiplist multiple queue scheduler focused on desktop responsiveness.|https://cchalpha.blogspot.com/|{{AUR|linux-pds}}}}<br />
<br />
=== Real-time kernel ===<br />
<br />
Some applications such as running a TV tuner card at full HD resolution (1080p) may benefit from using a [[realtime kernel]].<br />
<br />
=== Adjusting priorities of processes ===<br />
<br />
See also {{man|1|nice}} and {{man|1|renice}}.<br />
<br />
==== Ananicy ====<br />
<br />
[https://github.com/Nefelim4ag/Ananicy Ananicy] is a daemon, available in the {{AUR|ananicy-git}} package, for auto adjusting the nice levels of executables. The nice level represents the priority of the executable when allocating CPU resources.<br />
<br />
==== cgroups ====<br />
<br />
See [[cgroups]].<br />
<br />
==== Cpulimit ====<br />
<br />
[https://github.com/opsengine/cpulimit Cpulimit] is a program to limit the CPU usage percentage of a specific process. After installing {{Pkg|cpulimit}}, you may limit the CPU usage of a processes' PID using a scale of 0 to 100 times the number of CPU cores that the computer has. For example, with eight CPU cores the precentage range will be 0 to 800. Usage:<br />
<br />
$ cpulimit -l 50 -p 5081<br />
<br />
=== irqbalance ===<br />
<br />
The purpose of {{Pkg|irqbalance}} is distribute hardware interrupts across processors on a multiprocessor system in order to increase performance. It can be [[systemd#Using units|controlled]] by the provided {{ic|irqbalance.service}}.<br />
<br />
=== Turn off CPU exploit mitigations ===<br />
<br />
{{Warning|1=Do not apply this setting without considering the vulnerabilities it opens up. See [https://phoronix.com/scan.php?page=news_item&px=Linux-Improve-CPU-Spec-Switches this] and [https://linuxreviews.org/HOWTO_make_Linux_run_blazing_fast_(again)_on_Intel_CPUs this] for more information.}}<br />
<br />
Turning off CPU exploit mitigations may improve performance. Use below [[kernel parameter]] to disable them all:<br />
<br />
mitigations=off<br />
<br />
The explanations of all the switches it toggles are given at [https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html kernel.org]. You can use {{AUR|spectre-meltdown-checker}} for vulnerability check.<br />
<br />
{{Note|1=When using an Intel CPU from generation 10 and later, or AMD Ryzen 1 and later, the performance uplift from disabling mitigations is only up to 5% instead of the up to 25% for the previous CPU generations. See [https://www.phoronix.com/scan.php?page=article&item=3-years-specmelt the general review from early 2021], [https://www.phoronix.com/scan.php?page=article&item=spectre-rocket-lake the test on Rocket Lake] and [https://www.phoronix.com/scan.php?page=article&item=alder-lake-mitigations the test on Alder Lake]}}<br />
<br />
== 显卡 ==<br />
<br />
=== Xorg 配置 ===<br />
<br />
显卡性能由{{ic|/etc/X11/xorg.conf}}的配置决定,见 [[NVIDIA]]、[[ATI]] 和 [[Intel]] 文章。配置不当可能导致 Xorg 停止工作,请慎重操作。<br />
<br />
=== Mesa 配置 ===<br />
<br />
The performance of the Mesa drivers can be configured via [https://dri.freedesktop.org/wiki/ConfigurationInfrastructure/ drirc]. GUI configuration tools are available:<br />
<br />
* {{App|adriconf (Advanced DRI Configurator)|GUI tool to configure Mesa drivers by setting options and writing them to the standard drirc file.|https://gitlab.freedesktop.org/mesa/adriconf/|{{Pkg|adriconf}}}}<br />
* {{App|DRIconf|Configuration applet for the Direct Rendering Infrastructure. It allows customizing performance and visual quality settings of OpenGL drivers on a per-driver, per-screen and/or per-application level.|https://dri.freedesktop.org/wiki/DriConf/|{{AUR|driconf}}}}<br />
<br />
=== 硬件视频加速 ===<br />
<br />
[[Hardware video acceleration]] makes it possible for the video card to decode/encode video.<br />
<br />
=== 超频 ===<br />
<br />
与 CPU 一样,超频可以直接提高性能,但通常不建议使用。[[AUR]]中的超频工具有{{AUR|rovclock}} (ATI 显卡)、{{AUR|rocm-smi-lib}} (较新的 AMD 显卡) 、{{AUR|nvclock}} (到 Geforce 9系的旧 NVIDIA 显卡),以及适用于新 NVIDIA 显卡的{{Pkg|nvidia-utils}}。<br />
<br />
见 [[AMDGPU#Overclocking]] 或 [[NVIDIA/Tips and tricks#Enabling overclocking]]。<br />
<br />
=== Enabling PCI Resizable BAR ===<br />
<br />
{{Note|<br />
* On some systems enabling PCI Resizable BAR can result in a significant loss of performance. Benchmark your system to make sure it increases performance.<br />
* The [[Wikipedia:Unified Extensible Firmware Interface#CSM booting|Compatibility Support Module (CSM)]] must be disabled for this to take effect. <br />
}}<br />
<br />
The PCI specification allows larger [[wikipedia:PCI_configuration_space#Standardized_registers|Base Address Registers]] to be used for exposing PCI devices memory to the PCI Controller. This can result in a performance increase for video cards. Having access to the the full video memory improves performance, but also enables optimizations in the graphics driver. The combination of resizable BAR, above 4G decoding and these driver optimizations are what AMD calls [https://www.amd.com/en/technologies/smart-access-memory AMD Smart Access Memory], available at first on AMD Series 500 chipset motherboards, later expanded to AMD Series 400 and Intel Series 300 and later through UEFI updates. This setting may not be available on all motherboards, and is known to sometimes cause boot problems on certain boards.<br />
<br />
If the BAR has a 256M size, the feature is not enabled or not supported:<br />
<br />
{{hc|1=# dmesg {{!}} grep BAR=|2=<br />
[drm] Detected VRAM RAM=8176M, BAR=256M}}<br />
<br />
To enable it, enable the setting named "Above 4G Decode" or ">4GB MMIO" in your motherboard settings. Verify that the BAR is now larger:<br />
<br />
{{hc|1=# dmesg {{!}} grep BAR=|2=<br />
[drm] Detected VRAM RAM=8176M, BAR=8192M}}<br />
<br />
== 内存、虚拟内存与内存溢出处理 ==<br />
<br />
=== Clock frequency and timings ===<br />
<br />
RAM can run at different clock frequencies and timings, which can be configured in the BIOS. Memory performance depends on both values. Selecting the highest preset presented by the BIOS usually improves the performance over the default setting. Note that increasing the frequency to values not supported by both motherboard and RAM vendor is overclocking, and similar risks and disadvantages apply, see [[#Overclocking]].<br />
<br />
=== Root on RAM overlay ===<br />
<br />
If running off a slow writing medium (USB, spinning HDDs) and storage requirements are low, the root may be run on a RAM overlay ontop of read only root (on disk). This can vastly improve performance at the cost of a limited writable space to root. See {{AUR|liveroot}}.<br />
<br />
=== zram 或 zswap ===<br />
<br />
内核模块 [https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html zram](以前叫做 '''compcache''')在内存中提供了一个压缩块。若将其用作交换空间,则内存可以保存更多的数据,代价是消耗更多的 CPU 。但是它仍然比硬盘上的交换空间快得多。若一个系统经常使用交换空间,使用 zram 可以提高响应。使用 zram 也可以减少对磁盘的读写,当交换空间被设置到固态硬盘时,这可以增加固态硬盘的寿命。<br />
<br />
[[zswap]] 可以带来相似的益处(和相似的代价)。两者不同的是 zswap 将页面压缩后换入交换空间,而 zram 则换入内存。详见 [[zswap]] 以查看两者差异。 <br />
<br />
{{Tip|Since it is enabled by default, [[Zswap#Toggling_zswap|disable zswap]] when you use zram to avoid it acting as a swap cache in front of zram. Having both enabled also results in incorrect {{man|8|zramctl}} statistics as zram remains mostly unused; this is because zswap intercepts and compresses memory pages being swapped out before they can reach zram.}}<br />
<br />
例如:设置一个使用 lz4 压缩算法、32GB、高优先级的 zram(仅作用于当前会话):<br />
<br />
# modprobe zram<br />
# echo lz4 > /sys/block/zram0/comp_algorithm<br />
# echo 32G > /sys/block/zram0/disksize<br />
# mkswap --label zram0 /dev/zram0<br />
# swapon --priority 100 /dev/zram0<br />
<br />
若要禁用它,可以重启或运行:<br />
<br />
# swapoff /dev/zram0<br />
# rmmod zram<br />
<br />
若要查看详细的步骤、选项与潜在问题,见 [https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html zram 模块的官方文档]。<br />
<br />
{{pkg|zram-generator}} 提供了一个 {{ic|systemd-zram-setup@.service}} 单元用来自动初始化 zram 设备。此单元无需被 [enable/start]。以下资源提供了使用它的必要信息:<br />
<br />
* {{man|8|zram-generator}}<br />
* {{man|5|zram-generator.conf}}<br />
* https://github.com/systemd/zram-generator#readme<br />
<br />
“生成器将会在系统启动的早期被 systemd 调用”,因此使用它只需要创建配置文件并重启。这里提供了一个简单的配置:[https://raw.githubusercontent.com/systemd/zram-generator/main/zram-generator.conf.example /usr/share/doc/zram-generator/zram-generator.conf.example] 。可以通过检查 [[Swap#Swap space|swap 的状态]] 或通过检查 {{ic|systemd-zram-setup@zram''N''.service}} 的 [[systemd#Using units|状态]] 来检查 zram 的情况。这里 {{ic|/dev/zram''N''}} 是配置文件中设定的内容。<br />
<br />
The package {{AUR|zramswap}} provides an automated script for setting up a swap with a higher priority and a default size of 20% of the RAM size of your system. To do this automatically on every boot, [[enable]] {{ic|zramswap.service}}.<br />
<br />
此外,{{AUR|zramd}} 默认以 zstd 算法自动设置 zram 。其配置文件位于 {{ic|/etc/default/zramd}} 并且需要 [[启用]] {{ic|zramd.service}} 服务。<br />
<br />
==== Swap on zram using a udev rule ====<br />
<br />
The example below describes how to set up swap on zram automatically at boot with a single udev rule. No extra package should be needed to make this work.<br />
<br />
First, enable the module:<br />
<br />
{{hc|/etc/modules-load.d/zram.conf|<br />
zram<br />
}}<br />
<br />
Configure the number of /dev/zram nodes you need.<br />
<br />
{{hc|/etc/modprobe.d/zram.conf|2=<br />
options zram num_devices=2<br />
}}<br />
<br />
Create the udev rule as shown in the example.<br />
<br />
{{hc|/etc/udev/rules.d/99-zram.rules|2=<br />
KERNEL=="zram0", ATTR{disksize}="512M" RUN="/usr/bin/mkswap /dev/zram0", TAG+="systemd"<br />
KERNEL=="zram1", ATTR{disksize}="512M" RUN="/usr/bin/mkswap /dev/zram1", TAG+="systemd"<br />
}}<br />
<br />
Add /dev/zram to your fstab.<br />
<br />
{{hc|/etc/fstab|<br />
/dev/zram0 none swap defaults 0 0<br />
/dev/zram1 none swap defaults 0 0<br />
}}<br />
<br />
=== 使用显存 ===<br />
<br />
在很少见的情况下,内存很小而显存过剩,那么可以将显存设为交换文件。见 [[Swap on video RAM]].<br />
<br />
=== 在低内存情况下改善系统反应速度 ===<br />
<br />
On traditional GNU/Linux system, especially for graphical workstations, when allocated memory is overcommitted, the overall system's responsiveness may degrade to a nearly unusable state before either triggering the in-kernel OOM-killer or a sufficient amount of memory got free (which is unlikely to happen quickly when the system is unresponsive, as you can hardly close any memory-hungry applications which may continue to allocate more memory). The behaviour also depends on specific setups and conditions, returning to a normal responsive state may take from a few seconds to more than half an hour, which could be a pain to wait in serious scenario like during a conference presentation.<br />
<br />
{{Tip|Check if {{ic|/proc/sys/vm/oom_kill_allocating_task}} is 0 and consider changing it. [https://askubuntu.com/a/402940]}}<br />
<br />
While the behaviour of the kernel as well as the userspace things under low-memory conditions may improve in the future as discussed on [https://lore.kernel.org/lkml/d9802b6a-949b-b327-c4a6-3dbca485ec20@gmx.com/T/ kernel] and [https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/XUZLHJ5O32OX24LG44R7UZ2TMN6NY47N/ Fedora] mailing lists, users can use more feasible and effective options than hard-resetting the system or tuning the {{ic|vm.overcommit_*}} [[sysctl]] parameters:<br />
<br />
* Manually trigger the kernel OOM-killer with [https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html Magic SysRq key], namely {{ic|Alt+SysRq+f}}.<br />
* Use a userspace OOM daemon to tackle these automatically (or interactively).<br />
<br />
{{Warning|Triggering OOM killer to kill running applications may lose your unsaved works. It is up to you that either you are patient enough to wait in hope that applications will finally free the memory normally, or you want to bring back unresponsive system as soon as possible.}}<br />
<br />
Sometimes a user may prefer OOM daemon to SysRq because with kernel OOM-killer you cannot prioritize the process to (or not) terminate. To list some OOM daemons:<br />
<br />
* {{App|systemd-oomd|Provided by [[systemd]] as {{ic|systemd-oomd.service}} that uses cgroups-v2 and pressure stall information (PSI) to monitor and take action on processes before an OOM occurs in kernel space.|https://github.com/systemd/systemd, {{man|8|systemd-oomd}}|{{Pkg|systemd}}}}<br />
* {{App|earlyoom|Simple userspace OOM-killer implementation written in C.|https://github.com/rfjakob/earlyoom|{{Pkg|earlyoom}}}}<br />
* {{App|oomd|OOM-killer implementation based on [https://lwn.net/Articles/759781/ PSI], requires Linux kernel version 4.20+. Configuration is in JSON and is quite complex. Confirmed to work in Facebook's production environment.|https://github.com/facebookincubator/oomd|{{AUR|oomd}}}}<br />
* {{App|nohang|Sophisticated OOM handler written in Python, with optional PSI support, more configurable than earlyoom.|https://github.com/hakavlad/nohang|{{AUR|nohang-git}}}}<br />
* {{App|low-memory-monitor|GNOME developer's effort that aims to provides better communication to userspace applications to indicate the low memory state, besides that it could be configured to trigger the kernel OOM-killer. Based on PSI, requires Linux 5.2+.|https://gitlab.freedesktop.org/hadess/low-memory-monitor/|{{AUR|low-memory-monitor-git}}}}<br />
* {{App|uresourced|A small daemon that enables cgroup based resource protection for the active graphical user session.|https://gitlab.freedesktop.org/benzea/uresourced|{{AUR|uresourced}}}}<br />
<br />
== 网络 ==<br />
<br />
* Kernel networking: see [[Sysctl#Improving performance]]<br />
* NIC: see [[Network configuration#Set device MTU and queue length]]<br />
* DNS: consider using a caching DNS resolver, see [[Domain name resolution#DNS servers]]<br />
* Samba: see [[Samba#Improve throughput]]<br />
<br />
== Watchdogs ==<br />
<br />
According to [[Wikipedia:Watchdog timer]]:<br />
<br />
:A watchdog timer [...] is an electronic timer that is used to detect and recover from computer malfunctions. During normal operation, the computer regularly resets the watchdog timer [...]. If, [...], the computer fails to reset the watchdog, the timer will elapse and generate a timeout signal [...] used to initiate corrective [...] actions [...] typically include placing the computer system in a safe state and restoring normal system operation.<br />
<br />
Many users need this feature due to their system's mission-critical role (i.e. servers), or because of the lack of power reset (i.e. embedded devices). Thus, this feature is required for a good operation in some situations. On the other hand, normal users (i.e. desktop and laptop) do not need this feature and can disable it.<br />
<br />
To disable watchdog timers (both software and hardware), append {{ic|nowatchdog}} to your boot parameters.<br />
<br />
To check the new configuration do:<br />
<br />
# cat /proc/sys/kernel/watchdog<br />
<br />
or use:<br />
<br />
# wdctl<br />
<br />
After you disabled watchdogs, you can ''optionally'' avoid the loading of the module responsible of the hardware watchdog, too. Do it by [[blacklisting]] the related module, e.g. {{ic|iTCO_wdt}}.<br />
<br />
{{Note|1=Some users [https://bbs.archlinux.org/viewtopic.php?id=221239 reported] the {{ic|nowatchdog}} parameter does not work as expected but they have successfully disabled the watchdog (at least the hardware one) by blacklisting the above-mentioned module.}}<br />
<br />
Either action will speed up your boot and shutdown, because one less module is loaded. Additionally disabling watchdog timers increases performance and [[Power management#Disabling NMI watchdog|lowers power consumption]].<br />
<br />
See [https://bbs.archlinux.org/viewtopic.php?id=163768], [https://bbs.archlinux.org/viewtopic.php?id=165834], [https://0pointer.de/blog/projects/watchdog.html], and [https://www.kernel.org/doc/html/latest/watchdog/watchdog-parameters.html] for more information.<br />
<br />
== 另见 ==<br />
<br />
* [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Performance_Tuning_Guide/index.html Red Hat Performance Tuning Guide]<br />
* [https://www.thomas-krenn.com/en/wiki/Linux_Performance_Measurements_using_vmstat Linux Performance Measurements using vmstat]</div>Fincehttps://wiki.archlinux.org/index.php?title=Improving_performance_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=730090Improving performance (简体中文)2022-05-19T07:12:27Z<p>Fince: update and improve translation</p>
<hr />
<div>[[Category:Hardware (简体中文)]]<br />
[[Category:System administration (简体中文)]]<br />
[[en:Improving performance]]<br />
[[es:Improving performance]]<br />
[[fr:Improving performance]]<br />
[[ja:パフォーマンスの最大化]]<br />
[[pt:Improving performance]]<br />
[[ru:Improving performance]]<br />
{{Bad translation (简体中文)|部分内容未翻译,部分内容翻译质量较差}}<br />
{{TranslationStatus (简体中文)|Improving performance|2022-05-19|726654}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|/Boot process}}<br />
{{Related|Pacman/Tips and tricks#Performance}}<br />
{{Related|OpenSSH#Speeding up SSH}}<br />
{{Related|Openoffice#Speed up OpenOffice}}<br />
{{Related|Laptop}}<br />
{{Related|Preload}}<br />
{{Related articles end}}<br />
本文将介绍与性能有关的系统诊断知识和具体步骤,通过减少资源消耗等方式优化系统性能。<br />
<br />
== 基础 ==<br />
<br />
=== 了解系统 ===<br />
<br />
性能优化的最佳方法是找到瓶颈或拖慢整体速度的子系统。查看系统细节可以帮助确定问题。<br />
<br />
*如果在同时运行多个大型程序时卡顿(如 LibreOffice、Firefox 等),请检查内存容量是否充足。使用以下命令,并检查“available”一列的数值:{{bc|$ free -h}}<br />
<br />
*如果电脑开机很慢,并且(仅在)第一次打开应用时加载很慢,可能是因为硬盘速度过慢。可以用{{ic|hdparm}}命令测试硬盘速度:{{bc|# hdparm -t /dev/sd''X''}}<br />
<br />
{{注意|{{Pkg|hdparm}} 只代表了硬盘的读取速度,并没有进行有效的评分。空闲时读取速度只要高于 40MB/s 就可以满足大多数系统。}}<br />
<br />
* 如果内存足够而 CPU 占用率居高不下,可以尝试停止进程或禁用 [[Daemons (简体中文)|守护服务]]。有多种方法可以监测 CPU 负荷,例如 {{pkg|htop}}、{{ic|pstree}} 或其他 [[List_of_applications_(简体中文)#系统监视器|系统监视器]]:{{bc|$ htop}}<br />
<br />
*如果使用直接渲染(GPU 渲染)的应用运行卡顿(比如使用 GPU 的视频播放器、游戏甚至[[窗口管理器]]),改善 GPU 的性能应当有所帮助。首先需要检查直接渲染是否已经开启。可以使用 {{Pkg|mesa-demos}} 中的 {{ic|glxinfo}} 命令:{{bc|$ glxinfo {{!}} grep "direct rendering"}},如果开启了,则会返回{{ic|direct rendering: Yes}}。<br />
<br />
* 使用 [[桌面环境]]时,禁用桌面特效或许可以减少 GPU 使用。如果当前的桌面环境不符合硬件或个人需求,可以使用一个更轻量的桌面环境或 [[Desktop_environment_(简体中文)#自己打造桌面环境|自己打造桌面环境]] 。<br />
<br />
=== 基准测试 ===<br />
<br />
为定量评估优化成果,可使用[[benchmarking (简体中文)|基准测试]]。<br />
<br />
== 存储设备 ==<br />
<br />
=== 多硬件路径 ===<br />
<br />
内部硬件路径意指储存设备是如何连接到主板的。例如 TCP/IP 经由 NIC、即插即用设备可以使用 PCIe/PCI、火线、RAID 卡 、USB 等。通过将储存设备均分到这些接口可以最大化主板的性能,比如将六个硬盘接连到 USB 要比三个连接到 USB、三个连接到火线要慢。原因是主板上的接口点类似管道,而管道同一时间的最大流量是有上限的。幸运的是主板通常会有多个管道。<br />
<br />
此外,假设你的电脑前面有两个 USB 插口,后面有四个 USB 插口,那么前面插两个、后面插两个应当要比前面插一个、后面插三个更快。这是因为前面的插口可能是多个根 Hub 设备,也就是说它可以在同一时间发送更多的数据。<br />
<br />
使用下面的命令查看你的机器上是否有多个路径:<br />
<br />
{{hc|USB设备树|$ lsusb -tv}}<br />
<br />
{{hc|PCI设备树|$ lspci -tv}}<br />
<br />
=== 分区 ===<br />
<br />
确保您已经[[Partitioning_(简体中文)#分区对齐|对齐分区]]。<br />
<br />
==== 多硬盘 ====<br />
<br />
如果有多个硬盘,将其设置为软件 [[RAID (简体中文)|RAID]] 可以提升速度。<br />
<br />
在分离的硬盘上创建 [[swap (简体中文)|交换空间]] 也有所帮助,尤其是使用交换空间十分频繁时。<br />
<br />
==== 机械硬盘布局 ====<br />
<br />
{{Out of date (简体中文)|此操作可能不适用于多盘片的硬盘。}}<br />
<br />
如果使用传统的机械硬盘,您的分区布局会影响系统的性能。驱动器开头(靠近磁盘外部)的扇区比末尾的扇区要快。此外,较小的分区不需要驱动器磁头大幅度移动,从而加快磁盘的操作。因此,建议为您的系统创建一个小分区(10GB,或多或少取决于您的需要),并且尽可能靠近驱动器开头。其他数据(图片、视频)应该存放在一个单独的分区上,这通常是通过将家目录({{ic|/home/''user''}})与根目录({{ic|/}})分开来实现的。<br />
<br />
=== 选择并调整文件系统 ===<br />
<br />
为系统选择合适的文件系统十分重要,因为不同文件系统有各自的优势。[[File systems]] 文中对主流文件系统作了简短的总结,也可以在 [[:Category:File systems]] 中阅读其他相关文章。<br />
<br />
==== 挂载选项 ====<br />
<br />
The [[fstab#atime options|noatime]] option is known to improve performance of the filesystem.<br />
<br />
Other mount options are filesystem specific, therefore see the relevant articles for the filesystems:<br />
<br />
* [[Ext3]]<br />
* [[Ext4#Improving performance]]<br />
* [[JFS Filesystem#Optimizations]]<br />
* [[XFS#Performance]]<br />
* [[Btrfs#Defragmentation]], [[Btrfs#Compression]], and {{man|5|btrfs}}<br />
* [[ZFS#Tuning]]<br />
* [[NTFS#Improving performance]]<br />
<br />
===== 文件系统 =====<br />
<br />
{{Ic|1=data=writeback}} 挂载选项可提高速度, 但可能会在断电期间损坏数据. {{Ic|notail}} 挂载选项将文件系统使用的空间增加了大约 5% , 但也提高了整体速度. 您还可以通过将日志和数据放在单独的驱动器上来减少磁盘负载。 这是在创建文件系统时完成的: <br />
<br />
# mkreiserfs –j /dev/sd'''a1''' /dev/sd'''b1'''<br />
<br />
Replace {{ic|/dev/sd'''a1'''}} with the partition reserved for the journal, and {{ic|/dev/sd'''b1'''}} with the partition for data. You can learn more about reiserfs with [[Funtoo:Funtoo Filesystem Guide, Part 2|Funtoo Filesystem Guide]].<br />
<br />
=== 更改内核选项 ===<br />
<br />
There are several key tunables affecting the performance of block devices, see [[sysctl#Virtual memory]] for more information.<br />
<br />
=== I/O 调度 ===<br />
<br />
==== 背景信息 ====<br />
<br />
The input/output ''(I/O)'' scheduler is the kernel component that decides in which order the block I/O operations are submitted to storage devices. It is useful to remind here some specifications of two main drive types because the goal of the I/O scheduler is to optimize the way these are able to deal with read requests:<br />
<br />
* An HDD has spinning disks and a head that moves physically to the required location. Therefore, random latency is quite high ranging between 3 and 12ms (whether it is a high end server drive or a laptop drive and bypassing the disk controller write buffer) while sequential access provides much higher throughput. The typical HDD throughput is about 200 I/O operations per second ''(IOPS)''.<br />
<br />
* An SSD does not have moving parts, random access is as fast as sequential one, typically under 0.1ms, and it can handle multiple concurrent requests. The typical SSD throughput is greater than 10,000 IOPS, which is more than needed in common workload situations.<br />
<br />
If there are many processes making I/O requests to different storage parts, thousands of IOPS can be generated while a typical HDD can handle only about 200 IOPS. There is a queue of requests that have to wait for access to the storage. This is where the I/O schedulers plays an optimization role.<br />
<br />
==== 调度算法 ====<br />
<br />
One way to improve throughput is to linearize access: by ordering waiting requests by their logical address and grouping the closest ones. Historically this was the first Linux I/O scheduler called [[Wikipedia:Elevator algorithm|elevator]].<br />
<br />
One issue with the elevator algorithm is that it is not optimal for a process doing sequential access: reading a block of data, processing it for several microseconds then reading next block and so on. The elevator scheduler does not know that the process is about to read another block nearby and, thus, moves to another request by another process at some other location. The [[Wikipedia:Anticipatory scheduling|anticipatory]] I/O scheduler overcomes the problem: it pauses for a few milliseconds in anticipation of another close-by read operation before dealing with another request.<br />
<br />
While these schedulers try to improve total throughput, they might leave some unlucky requests waiting for a very long time. As an example, imagine the majority of processes make requests at the beginning of the storage space while an unlucky process makes a request at the other end of storage. This potentially infinite postponement of the process is called starvation. To improve fairness, the [[Wikipedia:Deadline scheduler|deadline]] algorithm was developed. It has a queue ordered by address, similar to the elevator, but if some request sits in this queue for too long then it moves to an "expired" queue ordered by expire time. The scheduler checks the expire queue first and processes requests from there and only then moves to the elevator queue. Note that this fairness has a negative impact on overall throughput.<br />
<br />
The [[Wikipedia:CFQ|Completely Fair Queuing (CFQ)]] approaches the problem differently by allocating a timeslice and a number of allowed requests by queue depending on the priority of the process submitting them. It supports [[cgroup]] that allows to reserve some amount of I/O to a specific collection of processes. It is in particular useful for shared and cloud hosting: users who paid for some IOPS want to get their share whenever needed. Also, it idles at the end of synchronous I/O waiting for other nearby operations, taking over this feature from the ''anticipatory'' scheduler and bringing some enhancements. Both the ''anticipatory'' and the ''elevator'' schedulers were decommissioned from the Linux kernel replaced by the more advanced alternatives presented below.<br />
<br />
The [https://algo.ing.unimo.it/people/paolo/disk_sched/ Budget Fair Queuing (BFQ)] is based on CFQ code and brings some enhancements. It does not grant the disk to each process for a fixed time-slice but assigns a "budget" measured in number of sectors to the process and uses heuristics. It is a relatively complex scheduler, it may be more adapted to rotational drives and slow SSDs because its high per-operation overhead, especially if associated with a slow CPU, can slow down fast devices. The objective of BFQ on personal systems is that for interactive tasks, the storage device is virtually as responsive as if it was idle. In its default configuration it focuses on delivering the lowest latency rather than achieving the maximum throughput.<br />
<br />
[https://lwn.net/Articles/720675/ Kyber] is a recent scheduler inspired by active queue management techniques used for network routing. The implementation is based on "tokens" that serve as a mechanism for limiting requests. A queuing token is required to allocate a request, this is used to prevent starvation of requests. A dispatch token is also needed and limits the operations of a certain priority on a given device. Finally, a target read latency is defined and the scheduler tunes itself to reach this latency goal. The implementation of the algorithm is relatively simple and it is deemed efficient for fast devices.<br />
<br />
==== 内核的 I/O 调度器 ====<br />
<br />
While some of the early algorithms have now been decommissioned, the official Linux kernel supports a number of I/O schedulers which can be split into two categories:<br />
<br />
*The '''multi-queue schedulers''' are available by default with the kernel. The [https://www.thomas-krenn.com/en/wiki/Linux_Multi-Queue_Block_IO_Queueing_Mechanism_(blk-mq) Multi-Queue Block I/O Queuing Mechanism (blk-mq)] maps I/O queries to multiple queues, the tasks are distributed across threads and therefore CPU cores. Within this framework the following schedulers are available:<br />
**''None'', where no queuing algorithm is applied.<br />
**''mq-deadline'', the adaptation of the deadline scheduler (see below) to multi-threading.<br />
**''Kyber''<br />
**''BFQ''<br />
<br />
*The '''single-queue schedulers''' are legacy schedulers:<br />
**[[w:Noop scheduler|NOOP]] is the simplest scheduler, it inserts all incoming I/O requests into a simple FIFO queue and implements request merging. In this algorithm, there is no re-ordering of the request based on the sector number. Therefore it can be used if the ordering is dealt with at another layer, at the device level for example, or if it does not matter, for SSDs for instance.<br />
**[[w:Deadline scheduler|Deadline]]<br />
**[[w:CFQ|CFQ]]<br />
<br />
:{{Note (简体中文)|1=Single-queue schedulers [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f382fb0bcef4c37dc049e9f6963e3baf204d815c were removed from kernel since Linux 5.0].}}<br />
<br />
==== 更改 I/O 调度器 ====<br />
<br />
{{Note (简体中文)|The best choice of scheduler depends on both the device and the exact nature of the workload. Also, the throughput in MB/s is not the only measure of performance: deadline or fairness deteriorate the overall throughput but may improve system responsiveness. [[Benchmarking]] may be useful to indicate each I/O scheduler performance.}}<br />
<br />
To list the available schedulers for a device and the active scheduler (in brackets):<br />
<br />
{{hc|$ cat /sys/block/'''''sda'''''/queue/scheduler|<br />
mq-deadline kyber [bfq] none<br />
}}<br />
<br />
To list the available schedulers for all devices:<br />
<br />
{{hc|$ grep "" /sys/block/'''*'''/queue/scheduler|<br />
/sys/block/pktcdvd0/queue/scheduler:none<br />
/sys/block/sda/queue/scheduler:mq-deadline kyber [bfq] none<br />
/sys/block/sr0/queue/scheduler:[mq-deadline] kyber bfq none<br />
}}<br />
<br />
To change the active I/O scheduler to ''bfq'' for device ''sda'', use:<br />
<br />
# echo '''''bfq''''' > /sys/block/'''''sda'''''/queue/scheduler<br />
<br />
The process to change I/O scheduler, depending on whether the disk is rotating or not can be automated and persist across reboots. For example the [[udev]] rule below sets the scheduler to ''none'' for [[NVMe]], ''mq-deadline'' for [[SSD]]/eMMC, and ''bfq'' for rotational drives:<br />
<br />
{{hc|/etc/udev/rules.d/60-ioschedulers.rules|2=<br />
# set scheduler for NVMe<br />
ACTION=="add{{!}}change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none"<br />
# set scheduler for SSD and eMMC<br />
ACTION=="add{{!}}change", KERNEL=="sd[a-z]{{!}}mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"<br />
# set scheduler for rotating disks<br />
ACTION=="add{{!}}change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"<br />
}}<br />
<br />
Reboot or force [[udev#Loading new rules]].<br />
<br />
==== 使用 I/O 调度器 ====<br />
<br />
Each of the kernel's I/O scheduler has its own tunables, such as the latency time, the expiry time or the FIFO parameters. They are helpful in adjusting the algorithm to a particular combination of device and workload. This is typically to achieve a higher throughput or a lower latency for a given utilization.<br />
The tunables and their description can be found within the [https://www.kernel.org/doc/html/latest/block/index.html kernel documentation].<br />
<br />
To list the available tunables for a device, in the example below ''sdb'' which is using ''deadline'', use:<br />
<br />
{{hc|$ ls /sys/block/'''''sdb'''''/queue/iosched|<br />
fifo_batch front_merges read_expire write_expire writes_starved}}<br />
<br />
To improve ''deadline'''s throughput at the cost of latency, one can increase {{ic|fifo_batch}} with the command:<br />
<br />
{{bc|# echo ''32'' > /sys/block/'''''sdb'''''/queue/iosched/'''fifo_batch'''}}<br />
<br />
=== 电源管理配置 ===<br />
<br />
When dealing with traditional rotational disks (HDD's) you may want to [[Hdparm#Power_management_configuration|lower or disable power saving features]] completely.<br />
<br />
=== 减少磁盘读写 ===<br />
<br />
Avoiding unnecessary access to slow storage drives is good for performance and also increasing lifetime of the devices, although on modern hardware the difference in life expectancy is usually negligible.<br />
<br />
{{Note (简体中文)|A 32GB SSD with a mediocre 10x write amplification factor, a standard 10000 write/erase cycle, and '''10GB of data written per day''', would get an '''8 years life expectancy'''. It gets better with bigger SSDs and modern controllers with less write amplification. Also compare [https://techreport.com/review/25889/the-ssd-endurance-experiment-500tb-update] when considering whether any particular strategy to limit disk writes is actually needed.}}<br />
<br />
==== 显示磁盘写信息 ====<br />
<br />
The {{Pkg|iotop}} package can sort by disk writes, and show how much and how frequently programs are writing to the disk. See {{man|8|iotop}} for details.<br />
<br />
==== 重定位文件到 tmpfs ====<br />
<br />
Relocate files, such as your browser profile, to a [[tmpfs]] file system, for improvements in application response as all the files are now stored in RAM:<br />
<br />
* Refer to [[Profile-sync-daemon]] for syncing browser profiles. Certain browsers might need special attention, see e.g. [[Firefox on RAM]].<br />
* Refer to [[Anything-sync-daemon]] for syncing any specified folder.<br />
* Refer to [[Makepkg#Improving compile times]] for improving compile times by building packages in tmpfs.<br />
<br />
==== 文件系统 ====<br />
<br />
Refer to corresponding [[file system]] page in case there were performance improvements instructions, e.g. [[Ext4#Improving performance]] and [[XFS#Performance]].<br />
<br />
==== 交换空间 ====<br />
<br />
见 [[Swap (简体中文)#性能优化]]。<br />
<br />
==== Writeback interval 和缓冲区大小 ====<br />
<br />
详见 [[Sysctl#Virtual memory]]。<br />
<br />
=== 使用 ionice 调度储存 I/O ===<br />
<br />
Many tasks such as backups do not rely on a short storage I/O delay or high storage I/O bandwidth to fulfil their task, they can be classified as background tasks. On the other hand quick I/O is necessary for good UI responsiveness on the desktop. Therefore it is beneficial to reduce the amount of storage bandwidth available to background tasks, whilst other tasks are in need of storage I/O. This can be achieved by making use of the linux I/O scheduler CFQ, which allows setting different priorities for processes.<br />
<br />
The I/O priority of a background process can be reduced to the "Idle" level by starting it with<br />
<br />
# ionice -c 3 command<br />
<br />
See [https://www.cyberciti.biz/tips/linux-set-io-scheduling-class-priority.html a short introduction to ionice] and {{man|1|ionice}} for more information.<br />
<br />
== CPU ==<br />
<br />
=== 超频 ===<br />
<br />
[[Wikipedia:Overclocking|超频]]通过提升 CPU 的时钟频率提升电脑性能,超频能力取决于 CPU 和主板的型号。通常使用 BIOS 进行超频。超频也会带来风险和不便,这里既不推荐超频也不反对超频。<br />
<br />
Many Intel chips will not correctly report their clock frequency to acpi_cpufreq and most other utilities. This will result in excessive messages in [[dmesg]], which can be avoided by unloading and blacklisting the kernel module {{ic|acpi_cpufreq}}.<br />
To read their clock speed use ''i7z'' from the {{Pkg|i7z}} package. To check for correct operation of an overclocked CPU, it is recommended to do [[stress testing]].<br />
<br />
=== 自动调整频率 ===<br />
<br />
见 [[CPU frequency scaling]]。<br />
<br />
=== Tweak default scheduler (CFS) for responsiveness ===<br />
<br />
The default CPU scheduler in the mainline Linux kernel is [[Wikipedia:Completely_Fair_Scheduler|CFS]].<br />
<br />
The upstream default settings are tweaked for high throughput which make the desktop applications unresponsive under heavy CPU loads.<br />
<br />
The {{AUR|cfs-zen-tweaks}} package contains a script that sets up the CFS to use the same settings as the {{Pkg|linux-zen}} kernel. To run the script on startup, [[enable/start]] {{ic|set-cfs-tweaks.service}}.<br />
<br />
=== Alternative CPU schedulers ===<br />
<br />
* {{App|[[Wikipedia:Brain_Fuck_Scheduler#MuQSS|MuQSS]]|Multiple Queue Skiplist Scheduler. Available with the {{ic|-ck}} patch set developed by [[Wikipedia:Con_Kolivas|Con Kolivas]].|[[Unofficial user repositories/Repo-ck]]|{{AUR|linux-ck}}}}<br />
* {{App|[https://cchalpha.blogspot.com/search/label/PDS PDS]|Priority and Deadline based Skiplist multiple queue scheduler focused on desktop responsiveness.|https://cchalpha.blogspot.com/|{{AUR|linux-pds}}}}<br />
<br />
=== Real-time kernel ===<br />
<br />
Some applications such as running a TV tuner card at full HD resolution (1080p) may benefit from using a [[realtime kernel]].<br />
<br />
=== Adjusting priorities of processes ===<br />
<br />
See also {{man|1|nice}} and {{man|1|renice}}.<br />
<br />
==== Ananicy ====<br />
<br />
[https://github.com/Nefelim4ag/Ananicy Ananicy] is a daemon, available in the {{AUR|ananicy-git}} package, for auto adjusting the nice levels of executables. The nice level represents the priority of the executable when allocating CPU resources.<br />
<br />
==== cgroups ====<br />
<br />
See [[cgroups]].<br />
<br />
==== Cpulimit ====<br />
<br />
[https://github.com/opsengine/cpulimit Cpulimit] is a program to limit the CPU usage percentage of a specific process. After installing {{Pkg|cpulimit}}, you may limit the CPU usage of a processes' PID using a scale of 0 to 100 times the number of CPU cores that the computer has. For example, with eight CPU cores the precentage range will be 0 to 800. Usage:<br />
<br />
$ cpulimit -l 50 -p 5081<br />
<br />
=== irqbalance ===<br />
<br />
The purpose of {{Pkg|irqbalance}} is distribute hardware interrupts across processors on a multiprocessor system in order to increase performance. It can be [[systemd#Using units|controlled]] by the provided {{ic|irqbalance.service}}.<br />
<br />
=== Turn off CPU exploit mitigations ===<br />
<br />
{{Warning|1=Do not apply this setting without considering the vulnerabilities it opens up. See [https://phoronix.com/scan.php?page=news_item&px=Linux-Improve-CPU-Spec-Switches this] and [https://linuxreviews.org/HOWTO_make_Linux_run_blazing_fast_(again)_on_Intel_CPUs this] for more information.}}<br />
<br />
Turning off CPU exploit mitigations may improve performance. Use below [[kernel parameter]] to disable them all:<br />
<br />
mitigations=off<br />
<br />
The explanations of all the switches it toggles are given at [https://www.kernel.org/doc/html/latest/admin-guide/kernel-parameters.html kernel.org]. You can use {{AUR|spectre-meltdown-checker}} for vulnerability check.<br />
<br />
{{Note|1=When using an Intel CPU from generation 10 and later, or AMD Ryzen 1 and later, the performance uplift from disabling mitigations is only up to 5% instead of the up to 25% for the previous CPU generations. See [https://www.phoronix.com/scan.php?page=article&item=3-years-specmelt the general review from early 2021], [https://www.phoronix.com/scan.php?page=article&item=spectre-rocket-lake the test on Rocket Lake] and [https://www.phoronix.com/scan.php?page=article&item=alder-lake-mitigations the test on Alder Lake]}}<br />
<br />
== 显卡 ==<br />
<br />
=== Xorg 配置 ===<br />
<br />
显卡性能由{{ic|/etc/X11/xorg.conf}}的配置决定,见 [[NVIDIA]]、[[ATI]] 和 [[Intel]] 文章。配置不当可能导致 Xorg 停止工作,请慎重操作。<br />
<br />
=== Mesa 配置 ===<br />
<br />
The performance of the Mesa drivers can be configured via [https://dri.freedesktop.org/wiki/ConfigurationInfrastructure/ drirc]. GUI configuration tools are available:<br />
<br />
* {{App|adriconf (Advanced DRI Configurator)|GUI tool to configure Mesa drivers by setting options and writing them to the standard drirc file.|https://gitlab.freedesktop.org/mesa/adriconf/|{{Pkg|adriconf}}}}<br />
* {{App|DRIconf|Configuration applet for the Direct Rendering Infrastructure. It allows customizing performance and visual quality settings of OpenGL drivers on a per-driver, per-screen and/or per-application level.|https://dri.freedesktop.org/wiki/DriConf/|{{AUR|driconf}}}}<br />
<br />
=== 硬件视频加速 ===<br />
<br />
[[Hardware video acceleration]] makes it possible for the video card to decode/encode video.<br />
<br />
=== 超频 ===<br />
<br />
与 CPU 一样,超频可以直接提高性能,但通常不建议使用。[[AUR]]中的超频工具有{{AUR|rovclock}} (ATI 显卡)、{{AUR|rocm-smi-lib}} (较新的 AMD 显卡) 、{{AUR|nvclock}} (到 Geforce 9系的旧 NVIDIA 显卡),以及适用于新 NVIDIA 显卡的{{Pkg|nvidia-utils}}。<br />
<br />
见 [[AMDGPU#Overclocking]] 或 [[NVIDIA/Tips and tricks#Enabling overclocking]]。<br />
<br />
=== Enabling PCI Resizable BAR ===<br />
<br />
{{Note|<br />
* On some systems enabling PCI Resizable BAR can result in a significant loss of performance. Benchmark your system to make sure it increases performance.<br />
* The [[Wikipedia:Unified Extensible Firmware Interface#CSM booting|Compatibility Support Module (CSM)]] must be disabled for this to take effect. <br />
}}<br />
<br />
The PCI specification allows larger [[wikipedia:PCI_configuration_space#Standardized_registers|Base Address Registers]] to be used for exposing PCI devices memory to the PCI Controller. This can result in a performance increase for video cards. Having access to the the full video memory improves performance, but also enables optimizations in the graphics driver. The combination of resizable BAR, above 4G decoding and these driver optimizations are what AMD calls [https://www.amd.com/en/technologies/smart-access-memory AMD Smart Access Memory], available at first on AMD Series 500 chipset motherboards, later expanded to AMD Series 400 and Intel Series 300 and later through UEFI updates. This setting may not be available on all motherboards, and is known to sometimes cause boot problems on certain boards.<br />
<br />
If the BAR has a 256M size, the feature is not enabled or not supported:<br />
<br />
{{hc|1=# dmesg {{!}} grep BAR=|2=<br />
[drm] Detected VRAM RAM=8176M, BAR=256M}}<br />
<br />
To enable it, enable the setting named "Above 4G Decode" or ">4GB MMIO" in your motherboard settings. Verify that the BAR is now larger:<br />
<br />
{{hc|1=# dmesg {{!}} grep BAR=|2=<br />
[drm] Detected VRAM RAM=8176M, BAR=8192M}}<br />
<br />
== 内存、虚拟内存与内存溢出处理 ==<br />
<br />
=== Clock frequency and timings ===<br />
<br />
RAM can run at different clock frequencies and timings, which can be configured in the BIOS. Memory performance depends on both values. Selecting the highest preset presented by the BIOS usually improves the performance over the default setting. Note that increasing the frequency to values not supported by both motherboard and RAM vendor is overclocking, and similar risks and disadvantages apply, see [[#Overclocking]].<br />
<br />
=== Root on RAM overlay ===<br />
<br />
If running off a slow writing medium (USB, spinning HDDs) and storage requirements are low, the root may be run on a RAM overlay ontop of read only root (on disk). This can vastly improve performance at the cost of a limited writable space to root. See {{AUR|liveroot}}.<br />
<br />
=== zram 或 zswap ===<br />
<br />
内核模块 [https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html zram](以前叫做 '''compcache''')在内存中提供了一个压缩块。若你将其用作交换空间,则内存可以保存更多的数据,代价是消耗更多的 CPU 。但是它仍然比硬盘上的交换空间快得多。若一个系统经常使用交换空间,使用 zram 可以提高响应。使用 zram 也可以减少对磁盘的读写,当交换空间被设置到固态硬盘时,这可以增加固态硬盘的寿命。<br />
<br />
[[zswap]] 可以带来相似的益处(和相似的代价)。两者不同的是 zswap 将页面压缩后换入交换空间,而 zram 则换入内存。详见 [[zswap]] 以查看两者差异。 <br />
<br />
{{Tip|Since it is enabled by default, [[Zswap#Toggling_zswap|disable zswap]] when you use zram to avoid it acting as a swap cache in front of zram. Having both enabled also results in incorrect {{man|8|zramctl}} statistics as zram remains mostly unused; this is because zswap intercepts and compresses memory pages being swapped out before they can reach zram.}}<br />
<br />
例如:设置一个使用 lz4 压缩算法、32GB、高优先级的 zram(仅作用于当前会话):<br />
<br />
# modprobe zram<br />
# echo lz4 > /sys/block/zram0/comp_algorithm<br />
# echo 32G > /sys/block/zram0/disksize<br />
# mkswap --label zram0 /dev/zram0<br />
# swapon --priority 100 /dev/zram0<br />
<br />
若要禁用它,可以重启或运行:<br />
<br />
# swapoff /dev/zram0<br />
# rmmod zram<br />
<br />
若要查看详细的步骤、选项与潜在问题,见 [https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html zram 模块的官方文档]。<br />
<br />
{{pkg|zram-generator}} 提供了一个 {{ic|systemd-zram-setup@.service}} 单元用来自动初始化 zram 设备。此单元无需被 [enable/start]。以下资源提供了使用它的必要信息:<br />
<br />
* {{man|8|zram-generator}}<br />
* {{man|5|zram-generator.conf}}<br />
* https://github.com/systemd/zram-generator#readme<br />
<br />
“生成器将会在系统启动的早期被 systemd 调用”,因此使用它只需要创建配置文件并重启。这里提供了一个简单的配置:[https://raw.githubusercontent.com/systemd/zram-generator/main/zram-generator.conf.example /usr/share/doc/zram-generator/zram-generator.conf.example] 。你可以通过检查 [[Swap#Swap space|swap 的状态]] 或通过检查 {{ic|systemd-zram-setup@zram''N''.service}} 的 [[systemd#Using units|状态]] 来检查 zram 的情况。这里 {{ic|/dev/zram''N''}} 是配置文件中设定的内容。<br />
<br />
The package {{AUR|zramswap}} provides an automated script for setting up a swap with a higher priority and a default size of 20% of the RAM size of your system. To do this automatically on every boot, [[enable]] {{ic|zramswap.service}}.<br />
<br />
此外,{{AUR|zramd}} 默认以 zstd 算法自动设置 zram 。其配置文件位于 {{ic|/etc/default/zramd}} 并且需要 [[启用]] {{ic|zramd.service}} 服务。<br />
<br />
==== Swap on zram using a udev rule ====<br />
<br />
The example below describes how to set up swap on zram automatically at boot with a single udev rule. No extra package should be needed to make this work.<br />
<br />
First, enable the module:<br />
<br />
{{hc|/etc/modules-load.d/zram.conf|<br />
zram<br />
}}<br />
<br />
Configure the number of /dev/zram nodes you need.<br />
<br />
{{hc|/etc/modprobe.d/zram.conf|2=<br />
options zram num_devices=2<br />
}}<br />
<br />
Create the udev rule as shown in the example.<br />
<br />
{{hc|/etc/udev/rules.d/99-zram.rules|2=<br />
KERNEL=="zram0", ATTR{disksize}="512M" RUN="/usr/bin/mkswap /dev/zram0", TAG+="systemd"<br />
KERNEL=="zram1", ATTR{disksize}="512M" RUN="/usr/bin/mkswap /dev/zram1", TAG+="systemd"<br />
}}<br />
<br />
Add /dev/zram to your fstab.<br />
<br />
{{hc|/etc/fstab|<br />
/dev/zram0 none swap defaults 0 0<br />
/dev/zram1 none swap defaults 0 0<br />
}}<br />
<br />
=== 使用显存 ===<br />
<br />
在很少见的情况下,内存很小而显存过剩,那么可以将显存设为交换文件。见 [[Swap on video RAM]].<br />
<br />
=== 在低内存情况下改善系统反应速度 ===<br />
<br />
On traditional GNU/Linux system, especially for graphical workstations, when allocated memory is overcommitted, the overall system's responsiveness may degrade to a nearly unusable state before either triggering the in-kernel OOM-killer or a sufficient amount of memory got free (which is unlikely to happen quickly when the system is unresponsive, as you can hardly close any memory-hungry applications which may continue to allocate more memory). The behaviour also depends on specific setups and conditions, returning to a normal responsive state may take from a few seconds to more than half an hour, which could be a pain to wait in serious scenario like during a conference presentation.<br />
<br />
{{Tip|Check if {{ic|/proc/sys/vm/oom_kill_allocating_task}} is 0 and consider changing it. [https://askubuntu.com/a/402940]}}<br />
<br />
While the behaviour of the kernel as well as the userspace things under low-memory conditions may improve in the future as discussed on [https://lore.kernel.org/lkml/d9802b6a-949b-b327-c4a6-3dbca485ec20@gmx.com/T/ kernel] and [https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/XUZLHJ5O32OX24LG44R7UZ2TMN6NY47N/ Fedora] mailing lists, users can use more feasible and effective options than hard-resetting the system or tuning the {{ic|vm.overcommit_*}} [[sysctl]] parameters:<br />
<br />
* Manually trigger the kernel OOM-killer with [https://www.kernel.org/doc/html/latest/admin-guide/sysrq.html Magic SysRq key], namely {{ic|Alt+SysRq+f}}.<br />
* Use a userspace OOM daemon to tackle these automatically (or interactively).<br />
<br />
{{Warning|Triggering OOM killer to kill running applications may lose your unsaved works. It is up to you that either you are patient enough to wait in hope that applications will finally free the memory normally, or you want to bring back unresponsive system as soon as possible.}}<br />
<br />
Sometimes a user may prefer OOM daemon to SysRq because with kernel OOM-killer you cannot prioritize the process to (or not) terminate. To list some OOM daemons:<br />
<br />
* {{App|systemd-oomd|Provided by [[systemd]] as {{ic|systemd-oomd.service}} that uses cgroups-v2 and pressure stall information (PSI) to monitor and take action on processes before an OOM occurs in kernel space.|https://github.com/systemd/systemd, {{man|8|systemd-oomd}}|{{Pkg|systemd}}}}<br />
* {{App|earlyoom|Simple userspace OOM-killer implementation written in C.|https://github.com/rfjakob/earlyoom|{{Pkg|earlyoom}}}}<br />
* {{App|oomd|OOM-killer implementation based on [https://lwn.net/Articles/759781/ PSI], requires Linux kernel version 4.20+. Configuration is in JSON and is quite complex. Confirmed to work in Facebook's production environment.|https://github.com/facebookincubator/oomd|{{AUR|oomd}}}}<br />
* {{App|nohang|Sophisticated OOM handler written in Python, with optional PSI support, more configurable than earlyoom.|https://github.com/hakavlad/nohang|{{AUR|nohang-git}}}}<br />
* {{App|low-memory-monitor|GNOME developer's effort that aims to provides better communication to userspace applications to indicate the low memory state, besides that it could be configured to trigger the kernel OOM-killer. Based on PSI, requires Linux 5.2+.|https://gitlab.freedesktop.org/hadess/low-memory-monitor/|{{AUR|low-memory-monitor-git}}}}<br />
* {{App|uresourced|A small daemon that enables cgroup based resource protection for the active graphical user session.|https://gitlab.freedesktop.org/benzea/uresourced|{{AUR|uresourced}}}}<br />
<br />
== 网络 ==<br />
<br />
* Kernel networking: see [[Sysctl#Improving performance]]<br />
* NIC: see [[Network configuration#Set device MTU and queue length]]<br />
* DNS: consider using a caching DNS resolver, see [[Domain name resolution#DNS servers]]<br />
* Samba: see [[Samba#Improve throughput]]<br />
<br />
== Watchdogs ==<br />
<br />
According to [[Wikipedia:Watchdog timer]]:<br />
<br />
:A watchdog timer [...] is an electronic timer that is used to detect and recover from computer malfunctions. During normal operation, the computer regularly resets the watchdog timer [...]. If, [...], the computer fails to reset the watchdog, the timer will elapse and generate a timeout signal [...] used to initiate corrective [...] actions [...] typically include placing the computer system in a safe state and restoring normal system operation.<br />
<br />
Many users need this feature due to their system's mission-critical role (i.e. servers), or because of the lack of power reset (i.e. embedded devices). Thus, this feature is required for a good operation in some situations. On the other hand, normal users (i.e. desktop and laptop) do not need this feature and can disable it.<br />
<br />
To disable watchdog timers (both software and hardware), append {{ic|nowatchdog}} to your boot parameters.<br />
<br />
To check the new configuration do:<br />
<br />
# cat /proc/sys/kernel/watchdog<br />
<br />
or use:<br />
<br />
# wdctl<br />
<br />
After you disabled watchdogs, you can ''optionally'' avoid the loading of the module responsible of the hardware watchdog, too. Do it by [[blacklisting]] the related module, e.g. {{ic|iTCO_wdt}}.<br />
<br />
{{Note|1=Some users [https://bbs.archlinux.org/viewtopic.php?id=221239 reported] the {{ic|nowatchdog}} parameter does not work as expected but they have successfully disabled the watchdog (at least the hardware one) by blacklisting the above-mentioned module.}}<br />
<br />
Either action will speed up your boot and shutdown, because one less module is loaded. Additionally disabling watchdog timers increases performance and [[Power management#Disabling NMI watchdog|lowers power consumption]].<br />
<br />
See [https://bbs.archlinux.org/viewtopic.php?id=163768], [https://bbs.archlinux.org/viewtopic.php?id=165834], [https://0pointer.de/blog/projects/watchdog.html], and [https://www.kernel.org/doc/html/latest/watchdog/watchdog-parameters.html] for more information.<br />
<br />
== 另见 ==<br />
<br />
* [https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Performance_Tuning_Guide/index.html Red Hat Performance Tuning Guide]<br />
* [https://www.thomas-krenn.com/en/wiki/Linux_Performance_Measurements_using_vmstat Linux Performance Measurements using vmstat]</div>Fincehttps://wiki.archlinux.org/index.php?title=Improving_performance_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=730083Improving performance (简体中文)2022-05-19T05:21:10Z<p>Fince: /* 了解系统 */ 将free -m指令改为free -h</p>
<hr />
<div>[[Category:Hardware (简体中文)]]<br />
[[Category:System administration (简体中文)]]<br />
[[en:Improving performance]]<br />
[[es:Improving performance]]<br />
[[fr:Improving performance]]<br />
[[ja:パフォーマンスの最大化]]<br />
[[pt:Improving performance]]<br />
[[ru:Improving performance]]<br />
{{Bad translation (简体中文)|部分内容未翻译。}}<br />
{{TranslationStatus (简体中文)|Improving performance|2018-12-25|559927}}<br />
{{Related articles start (简体中文)}}<br />
{{Related|Improving performance/Boot process}}<br />
{{Related|Pacman/Tips and tricks#Performance}}<br />
{{Related|OpenSSH#Speeding up SSH}}<br />
{{Related|Openoffice#Speed up OpenOffice}}<br />
{{Related|Laptop}}<br />
{{Related|Preload}}<br />
{{Related articles end}}<br />
<br />
本文将介绍关于系统性能诊断的基本知识,以及优化系统性能的具体步骤。<br />
<br />
== 基础工作 ==<br />
<br />
=== 了解系统 ===<br />
<br />
性能优化的最佳方法是找到瓶颈,因为这个子系统是导致系统速度低下的主要原因。查看系统配置表可以发现瓶颈,也可以通过以下方式寻找线索:<br />
<br />
*如果同时运行多个大型程序(如 LibreOffice、Firefox等)时卡顿,检查内存容量是否充足。可使用以下命令,并检查“available”列的数值:<br />
<br />
$ free -h<br />
<br />
*如果开机时间非常长,并且第一次加载应用时很慢(但是启动以后运行却很流畅),可能是硬盘问题。可以用 {{ic|hdparm}} 命令测量硬盘速度,在硬盘空闲时执行:<br />
<br />
{{注意|{{Pkg|hdparm}} 只代表了硬盘的读取速度,并没有进行有效的评分。空闲时读取速度只要高于 40MB/s 就足以满足大多数系统。}}<br />
<br />
$ hdparm -t /dev/sdx<br />
<br />
* 如果在内存充裕的情况下 CPU 占用率一直很高,可以通过停止进程或禁用 [[Daemons (简体中文)|守护服务]]。有多种方法可以监测 CPU 负荷,例如 {{pkg|htop}}、{{ic|pstree}} 或其他 [[List_of_applications_(简体中文)#系统监视器|系统监视器]]<br />
<br />
$ htop<br />
<br />
*如果应用使用直接渲染卡顿(比如使用 GPU 的视频播放器、游戏或[[窗口管理器]]),改善 GPU 的性能应当很有效。首先需要检查直接渲染是否真的开启的。可以使用 {{Pkg|mesa-demos}} 中的 {{ic|glxinfo}} 命令:<br />
<br />
{{hc|$ glxinfo {{!}} grep "direct rendering"|<br />
direct rendering: Yes<br />
}}<br />
<br />
* 使用 [[桌面环境]]时,禁用桌面特效或许可以减少 GPU 使用。可以使用一个更轻量的桌面环境或 [[Desktop_environment_(简体中文)#自己打造桌面环境|自己打造桌面环境]] 。<br />
<br />
=== 跑分 ===<br />
<br />
为定量评估优化成果,可使用[[benchmarking (简体中文)|基准测试]]。<br />
<br />
== 存储设备 ==<br />
<br />
=== 硬盘的连接方式 ===<br />
<br />
内部硬件路径意指储存设备是如何连接到主板的。例如 TCP/IP 经由 NIC、即插即用设备可以使用 PCIe/PCI、火线、RAID 卡 、USB 等。通过将储存设备均分到这些接口可以最大化主板的性能,比如将六个硬盘接连到 USB 要比三个连接到 USB、三个连接到火线要慢。原因是主板上的接口点类似管道,而管道同一时间的最大流量是有上限的。幸运的是主板通常会有多个管道。<br />
比如:<br />
<br />
# 使用 PCI/PCIe/ATA 直接连接到主板。<br />
# Using an external enclosure to house the disk over USB/Firewire<br />
# 通过 TCP/IP 将设备转换为网络存储。<br />
<br />
此外,假设你的电脑前面有两个 USB 插口,后面有四个 USB 插口,那么前面插两个、后面插两个应当要比前面插一个、后面插三个更快。这是因为前面的插口可能是多个根 Hub 设备,也就是说它可以在同一时间发送更多的数据。使用下面的命令查看你的机器上是否有多个路径:<br />
<br />
{{hc|USB设备树|$ lsusb -tv}}<br />
{{hc|PCI设备树|$ lspci -tv}}<br />
<br />
=== 分区 ===<br />
<br />
确保你的分区是 [[Partitioning_(简体中文)#分区对齐|分区对齐]] 的。<br />
<br />
==== 多硬盘 ====<br />
<br />
如果你有多个硬盘,那么将其设置为 [[RAID (简体中文)|RAID]] 可以提升速度。<br />
<br />
在分离的硬盘上创建 [[swap (简体中文)|交换空间]] 也可以带来一些帮助,尤其是使用交换空间十分频繁时。<br />
<br />
==== 机械硬盘布局 ====<br />
<br />
如果使用传统的机械硬盘,您的分区布局会影响系统的性能。驱动器开头(靠近磁盘外部)的扇区比末尾的扇区要快(物理知识)。此外,较小的分区不需要驱动器磁头大幅度移动,从而加快磁盘的操作。因此,建议为您的系统创建一个小分区(10GB,或多或少取决于您的需要),并且尽可能靠近驱动器开头。其他数据(图片、视频)应该存放在一个单独的分区上,这通常是通过将家目录({{ic|/home/''user''}})与根目录({{ic|/}})分开来实现的。<br />
<br />
=== 选择文件系统 ===<br />
<br />
Choosing the best filesystem for a specific system is very important because each has its own strengths. The [[File systems]] article provides a short summary of the most popular ones. You can also find relevant articles in [[:Category:File systems]].<br />
<br />
==== 挂载选项 ====<br />
<br />
The [[fstab#atime options|noatime]] option is known to improve performance of the filesystem.<br />
<br />
Other mount options are filesystem specific, therefore see the relevant articles for the filesystems:<br />
<br />
* [[Ext3]]<br />
* [[Ext4#Improving performance]]<br />
* [[JFS Filesystem#Optimizations]]<br />
* [[XFS#Performance]]<br />
* [[Btrfs#Defragmentation]], [[Btrfs#Compression]], and {{man|5|btrfs}}<br />
* [[ZFS#Tuning]]<br />
<br />
===== 文件系统 =====<br />
<br />
{{Ic|1=data=writeback}} 挂载选项可提高速度, 但可能会在断电期间损坏数据. {{Ic|notail}} 挂载选项将文件系统使用的空间增加了大约 5% , 但也提高了整体速度. 您还可以通过将日志和数据放在单独的驱动器上来减少磁盘负载。 这是在创建文件系统时完成的: <br />
<br />
# mkreiserfs –j /dev/sd'''a1''' /dev/sd'''b1'''<br />
<br />
Replace {{ic|/dev/sd'''a1'''}} with the partition reserved for the journal, and {{ic|/dev/sd'''b1'''}} with the partition for data. You can learn more about reiserfs with this [https://www.funtoo.org/Funtoo_Filesystem_Guide,_Part_2 article].<br />
<br />
=== 更改内核选项 ===<br />
<br />
There are several key tunables affecting the performance of block devices, see [[sysctl#Virtual memory]] for more information.<br />
<br />
=== I/O 调度 ===<br />
<br />
==== 背景信息 ====<br />
<br />
The input/output ''(I/O)'' scheduler is the kernel component that decides in which order the block I/O operations are submitted to storage devices. It is useful to remind here some specifications of two main drive types because the goal of the I/O scheduler is to optimize the way these are able to deal with read requests:<br />
<br />
* An HDD has spinning disks and a head that moves physically to the required location. Therefore, random latency is quite high ranging between 3 and 12ms (whether it is a high end server drive or a laptop drive and bypassing the disk controller write buffer) while sequential access provides much higher throughput. The typical HDD throughput is about 200 I/O operations per second ''(IOPS)''.<br />
<br />
* An SSD does not have moving parts, random access is as fast as sequential one, typically under 0.1ms, and it can handle multiple concurrent requests. The typical SSD throughput is greater than 10,000 IOPS, which is more than needed in common workload situations.<br />
<br />
If there are many processes making I/O requests to different storage parts, thousands of IOPS can be generated while a typical HDD can handle only about 200 IOPS. There is a queue of requests that have to wait for access to the storage. This is where the I/O schedulers plays an optimization role.<br />
<br />
==== 调度算法 ====<br />
<br />
One way to improve throughput is to linearize access: by ordering waiting requests by their logical address and grouping the closest ones. Historically this was the first Linux I/O scheduler called [[Wikipedia:Elevator algorithm|elevator]].<br />
<br />
One issue with the elevator algorithm is that it is not optimal for a process doing sequential access: reading a block of data, processing it for several microseconds then reading next block and so on. The elevator scheduler does not know that the process is about to read another block nearby and, thus, moves to another request by another process at some other location. The [[Wikipedia:Anticipatory scheduling|anticipatory]] I/O scheduler overcomes the problem: it pauses for a few milliseconds in anticipation of another close-by read operation before dealing with another request.<br />
<br />
While these schedulers try to improve total throughput, they might leave some unlucky requests waiting for a very long time. As an example, imagine the majority of processes make requests at the beginning of the storage space while an unlucky process makes a request at the other end of storage. This potentially infinite postponement of the process is called starvation. To improve fairness, the [[Wikipedia:Deadline scheduler|deadline]] algorithm was developed. It has a queue ordered by address, similar to the elevator, but if some request sits in this queue for too long then it moves to an "expired" queue ordered by expire time. The scheduler checks the expire queue first and processes requests from there and only then moves to the elevator queue. Note that this fairness has a negative impact on overall throughput.<br />
<br />
The [[Wikipedia:CFQ|Completely Fair Queuing (CFQ)]] approaches the problem differently by allocating a timeslice and a number of allowed requests by queue depending on the priority of the process submitting them. It supports [[cgroup]] that allows to reserve some amount of I/O to a specific collection of processes. It is in particular useful for shared and cloud hosting: users who paid for some IOPS want to get their share whenever needed. Also, it idles at the end of synchronous I/O waiting for other nearby operations, taking over this feature from the ''anticipatory'' scheduler and bringing some enhancements. Both the ''anticipatory'' and the ''elevator'' schedulers were decommissioned from the Linux kernel replaced by the more advanced alternatives presented below.<br />
<br />
The [https://algo.ing.unimo.it/people/paolo/disk_sched/ Budget Fair Queuing (BFQ)] is based on CFQ code and brings some enhancements. It does not grant the disk to each process for a fixed time-slice but assigns a "budget" measured in number of sectors to the process and uses heuristics. It is a relatively complex scheduler, it may be more adapted to rotational drives and slow SSDs because its high per-operation overhead, especially if associated with a slow CPU, can slow down fast devices. The objective of BFQ on personal systems is that for interactive tasks, the storage device is virtually as responsive as if it was idle. In its default configuration it focuses on delivering the lowest latency rather than achieving the maximum throughput.<br />
<br />
[https://lwn.net/Articles/720675/ Kyber] is a recent scheduler inspired by active queue management techniques used for network routing. The implementation is based on "tokens" that serve as a mechanism for limiting requests. A queuing token is required to allocate a request, this is used to prevent starvation of requests. A dispatch token is also needed and limits the operations of a certain priority on a given device. Finally, a target read latency is defined and the scheduler tunes itself to reach this latency goal. The implementation of the algorithm is relatively simple and it is deemed efficient for fast devices.<br />
<br />
==== 内核的 I/O 调度器 ====<br />
<br />
While some of the early algorithms have now been decommissioned, the official Linux kernel supports a number of I/O schedulers which can be split into two categories:<br />
<br />
*The '''multi-queue schedulers''' are available by default with the kernel. The [https://www.thomas-krenn.com/en/wiki/Linux_Multi-Queue_Block_IO_Queueing_Mechanism_(blk-mq) Multi-Queue Block I/O Queuing Mechanism (blk-mq)] maps I/O queries to multiple queues, the tasks are distributed across threads and therefore CPU cores. Within this framework the following schedulers are available:<br />
**''None'', where no queuing algorithm is applied.<br />
**''mq-deadline'', the adaptation of the deadline scheduler (see below) to multi-threading.<br />
**''Kyber''<br />
**''BFQ''<br />
<br />
*The '''single-queue schedulers''' are legacy schedulers:<br />
**[[w:Noop scheduler|NOOP]] is the simplest scheduler, it inserts all incoming I/O requests into a simple FIFO queue and implements request merging. In this algorithm, there is no re-ordering of the request based on the sector number. Therefore it can be used if the ordering is dealt with at another layer, at the device level for example, or if it does not matter, for SSDs for instance.<br />
**[[w:Deadline scheduler|Deadline]]<br />
**[[w:CFQ|CFQ]]<br />
<br />
:{{Note (简体中文)|1=Single-queue schedulers [https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f382fb0bcef4c37dc049e9f6963e3baf204d815c were removed from kernel since Linux 5.0].}}<br />
<br />
==== 更改 I/O 调度器 ====<br />
<br />
{{Note (简体中文)|The best choice of scheduler depends on both the device and the exact nature of the workload. Also, the throughput in MB/s is not the only measure of performance: deadline or fairness deteriorate the overall throughput but may improve system responsiveness. [[Benchmarking]] may be useful to indicate each I/O scheduler performance.}}<br />
<br />
To list the available schedulers for a device and the active scheduler (in brackets):<br />
<br />
{{hc|$ cat /sys/block/'''''sda'''''/queue/scheduler|<br />
mq-deadline kyber [bfq] none<br />
}}<br />
<br />
To list the available schedulers for all devices:<br />
<br />
{{hc|$ grep "" /sys/block/'''*'''/queue/scheduler|<br />
/sys/block/pktcdvd0/queue/scheduler:none<br />
/sys/block/sda/queue/scheduler:mq-deadline kyber [bfq] none<br />
/sys/block/sr0/queue/scheduler:[mq-deadline] kyber bfq none<br />
}}<br />
<br />
To change the active I/O scheduler to ''bfq'' for device ''sda'', use:<br />
<br />
# echo '''''bfq''''' > /sys/block/'''''sda'''''/queue/scheduler<br />
<br />
The process to change I/O scheduler, depending on whether the disk is rotating or not can be automated and persist across reboots. For example the [[udev]] rule below sets the scheduler to ''none'' for [[NVMe]], ''mq-deadline'' for [[SSD]]/eMMC, and ''bfq'' for rotational drives:<br />
<br />
{{hc|/etc/udev/rules.d/60-ioschedulers.rules|2=<br />
# set scheduler for NVMe<br />
ACTION=="add{{!}}change", KERNEL=="nvme[0-9]n[0-9]", ATTR{queue/scheduler}="none"<br />
# set scheduler for SSD and eMMC<br />
ACTION=="add{{!}}change", KERNEL=="sd[a-z]{{!}}mmcblk[0-9]*", ATTR{queue/rotational}=="0", ATTR{queue/scheduler}="mq-deadline"<br />
# set scheduler for rotating disks<br />
ACTION=="add{{!}}change", KERNEL=="sd[a-z]", ATTR{queue/rotational}=="1", ATTR{queue/scheduler}="bfq"<br />
}}<br />
<br />
Reboot or force [[udev#Loading new rules]].<br />
<br />
==== 使用 I/O 调度器 ====<br />
<br />
Each of the kernel's I/O scheduler has its own tunables, such as the latency time, the expiry time or the FIFO parameters. They are helpful in adjusting the algorithm to a particular combination of device and workload. This is typically to achieve a higher throughput or a lower latency for a given utilization.<br />
The tunables and their description can be found within the [https://www.kernel.org/doc/html/latest/block/index.html kernel documentation].<br />
<br />
To list the available tunables for a device, in the example below ''sdb'' which is using ''deadline'', use:<br />
<br />
{{hc|$ ls /sys/block/'''''sdb'''''/queue/iosched|<br />
fifo_batch front_merges read_expire write_expire writes_starved}}<br />
<br />
To improve ''deadline'''s throughput at the cost of latency, one can increase {{ic|fifo_batch}} with the command:<br />
<br />
{{bc|# echo ''32'' > /sys/block/'''''sdb'''''/queue/iosched/'''fifo_batch'''}}<br />
<br />
=== 电源管理配置 ===<br />
<br />
When dealing with traditional rotational disks (HDD's) you may want to [[Hdparm#Power_management_configuration|lower or disable power saving features]] completely.<br />
<br />
=== 减少磁盘读写 ===<br />
<br />
Avoiding unnecessary access to slow storage drives is good for performance and also increasing lifetime of the devices, although on modern hardware the difference in life expectancy is usually negligible.<br />
<br />
{{Note (简体中文)|A 32GB SSD with a mediocre 10x write amplification factor, a standard 10000 write/erase cycle, and '''10GB of data written per day''', would get an '''8 years life expectancy'''. It gets better with bigger SSDs and modern controllers with less write amplification. Also compare [https://techreport.com/review/25889/the-ssd-endurance-experiment-500tb-update] when considering whether any particular strategy to limit disk writes is actually needed.}}<br />
<br />
==== 显示磁盘写信息 ====<br />
<br />
The {{Pkg|iotop}} package can sort by disk writes, and show how much and how frequently programs are writing to the disk. See {{man|8|iotop}} for details.<br />
<br />
==== 重定位文件到 tmpfs ====<br />
<br />
Relocate files, such as your browser profile, to a [[tmpfs]] file system, for improvements in application response as all the files are now stored in RAM:<br />
<br />
* Refer to [[Profile-sync-daemon]] for syncing browser profiles. Certain browsers might need special attention, see e.g. [[Firefox on RAM]].<br />
* Refer to [[Anything-sync-daemon]] for syncing any specified folder.<br />
* Refer to [[Makepkg#Improving compile times]] for improving compile times by building packages in tmpfs.<br />
<br />
==== 文件系统 ====<br />
<br />
Refer to corresponding [[file system]] page in case there were performance improvements instructions, e.g. [[Ext4#Improving performance]] and [[XFS#Performance]].<br />
<br />
==== 交换空间 ====<br />
<br />
See [[Swap#Performance]].<br />
<br />
==== 同步和缓冲区大小 ====<br />
<br />
See [[Sysctl#Virtual memory]] for details.<br />
<br />
=== 使用 ionice 调度 储存 I/O ===<br />
<br />
Many tasks such as backups do not rely on a short storage I/O delay or high storage I/O bandwidth to fulfil their task, they can be classified as background tasks. On the other hand quick I/O is necessary for good UI responsiveness on the desktop. Therefore it is beneficial to reduce the amount of storage bandwidth available to background tasks, whilst other tasks are in need of storage I/O. This can be achieved by making use of the linux I/O scheduler CFQ, which allows setting different priorities for processes.<br />
<br />
The I/O priority of a background process can be reduced to the "Idle" level by starting it with<br />
<br />
# ionice -c 3 command<br />
<br />
See {{man|1|ionice}} and [https://www.cyberciti.biz/tips/linux-set-io-scheduling-class-priority.html] for more information.<br />
<br />
== CPU ==<br />
<br />
=== 超频 ===<br />
<br />
超频就是增加 CPU 的实际运行频率。可是一项复杂而又有风险的操作,不建议盲目使用。超频的最佳手段是通过BIOS。acpi_cpufreq等工具常用工具无法读取I5或I7处理器超频后的频率。用户需要改用[[Community]]中的{{Pkg|i7z}}工具。<br />
<br />
=== 频率自动调整 ===<br />
<br />
请参考 [[CPU frequency scaling]].<br />
<br />
=== Real-time kernel ===<br />
<br />
Some applications such as running a TV tuner card at full HD resolution (1080p) may benefit from using a [[realtime kernel]].<br />
<br />
=== Adjusting priorities of processes ===<br />
<br />
See also {{man|1|nice}} and {{man|1|renice}}.<br />
<br />
==== Ananicy ====<br />
<br />
[https://github.com/Nefelim4ag/Ananicy Ananicy] is a daemon, available in the {{AUR|ananicy-git}} package, for auto adjusting the nice levels of executables. The nice level represents the priority of the executable when allocating CPU resources.<br />
<br />
==== cgroups ====<br />
<br />
See [[cgroups]].<br />
<br />
==== Cpulimit ====<br />
<br />
[https://github.com/opsengine/cpulimit Cpulimit] is a program to limit the CPU usage percentage of a specific process. After installing {{Pkg|cpulimit}}, you may limit the CPU usage of a processes' PID using a scale of 0 to 100 times the number of CPU cores that the computer has. For example, with eight CPU cores the precentage range will be 0 to 800. Usage:<br />
<br />
$ cpulimit -l 50 -p 5081<br />
<br />
=== irqbalance ===<br />
<br />
The purpose of {{Pkg|irqbalance}} is distribute hardware interrupts across processors on a multiprocessor system in order to increase performance. It can be [[systemd#Using units|controlled]] by the provided {{ic|irqbalance.service}}.<br />
<br />
== 显卡 ==<br />
<br />
=== Xorg.conf配置 ===<br />
<br />
显卡性能严重依赖于{{ic|/etc/X11/xorg.conf}},请参阅[[NVIDIA]]、[[ATI]]以及[[Intel]]显卡的相关教程修改配置。注意,不当的配置可能导致Xorg停止工作,所以,请审慎操作。<br />
<br />
=== Driconf ===<br />
<br />
{{AUR|driconf}}是[[official repositories|官方库]]中收录的小工具,它可以修改开源驱动的直接渲染设置。启用HyperZ功能将显著改善性能。<br />
<br />
=== GPU 超频 ===<br />
<br />
GPU 超频要比 CPU 超频简单得多,通过软件可以实时调整 GPU 时钟频率。<br />
<br />
* ATI 显卡可使用 {{AUR|rovclock}}。<br />
* NVIDIA 显卡可使用 {{AUR|nvclock}}。<br />
* Intel 显卡可使用 [https://archive.is/KfDPe GMABooster.com] 出品的 {{AUR|gmabooster}}。<br />
<br />
超频设置可以保存到 {{ic|~/.xinitrc}},每次X启动之后就能自动超频。当然,更安全的做法应该是按需设置。<br />
<br />
== 内存及虚拟内存 ==<br />
<br />
=== 将临时文件转移到tmpfs ===<br />
<br />
如果内存充足,可将{{ic|/tmp}}、{{ic|/dev/shm}}或者浏览器缓存文件等转移至[[Wikipedia:tmpfs|tmpfs]],这些文件将保存在内存中,从而加快软件的响应速度。借助脚本的帮助,可以轻松实现:<br />
*同步浏览器缓存:[[Profile-sync-daemon]]。<br />
*同步任意目录:[[Anything-sync-daemon]]。<br />
<br />
=== Swappiness ===<br />
<br />
参阅[[Swap#Swappiness]]。<br />
<br />
=== zram 或 zswap ===<br />
<br />
内核模块 [https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html zram](以前叫做 '''compcache''')在内存中提供了一个压缩块。若你将其用作交换空间,则内存可以保存更多的数据,代价是消耗更多的 CPU 。但是它仍然比硬盘上的交换空间快得多。若一个系统经常使用交换空间,使用 zram 可以提高响应。使用 zram 也可以减少对磁盘的读写,当交换空间被设置到固态硬盘时,这可以增加固态硬盘的寿命。<br />
<br />
[[zswap]] 可以带来相似的益处(和相似的代价)。两者不同的是 zswap 将页面压缩后换入交换空间,而 zram 则换入内存。<br />
<br />
例如:设置一个使用 lz4 压缩算法的 32GB 的、高优先级的 zram:<br />
<br />
# modprobe zram<br />
# echo lz4 > /sys/block/zram0/comp_algorithm<br />
# echo 32G > /sys/block/zram0/disksize<br />
# mkswap --label zram0 /dev/zram0<br />
# swapon --priority 100 /dev/zram0<br />
<br />
要禁用它,可以重启或者:<br />
<br />
# swapoff /dev/zram0<br />
# rmmod zram<br />
<br />
详细的描述提供在 [https://www.kernel.org/doc/html/latest/admin-guide/blockdev/zram.html zram 模块的官方文档]。<br />
<br />
{{pkg|zram-generator}} 提供了一个 {{ic|systemd-zram-setup@.service}} 单元用来自动初始化 zram 设备。此单元无需被 [enable/start]。以下资源提供了使用它的必要信息:<br />
<br />
* {{man|8|zram-generator}}<br />
* {{man|5|zram-generator.conf}}<br />
* https://github.com/systemd/zram-generator#readme<br />
<br />
“生成器将会在系统启动的早期被 systemd 调用”,因此使用它只需要创建配置文件并重启。这里提供了一个简单的配置:[https://raw.githubusercontent.com/systemd/zram-generator/main/zram-generator.conf.example /usr/share/doc/zram-generator/zram-generator.conf.example] 。你可以通过检查 [[Swap#Swap space|swap 的状态]] 或通过检查 {{ic|systemd-zram-setup@zram''N''.service}} 的 [[systemd#Using units|状态]] 来检查 zram 的情况。这里 {{ic|/dev/zram''N''}} 是配置文件中设定的内容。<br />
<br />
此外,{{AUR|zramd}} 默认以 zstd 算法自动设置 zram 。其配置文件位于 {{ic|/etc/default/zramd}} 并且需要 [[启用]] {{ic|zramd.service}} 服务。<br />
<br />
==== Swap on zram using a udev rule ====<br />
<br />
The example below describes how to set up swap on zram automatically at boot with a single udev rule. No extra package should be needed to make this work.<br />
<br />
First, enable the module:<br />
<br />
{{hc|/etc/modules-load.d/zram.conf|<br />
zram<br />
}}<br />
<br />
Configure the number of /dev/zram nodes you need.<br />
<br />
{{hc|/etc/modprobe.d/zram.conf|2=<br />
options zram num_devices=2<br />
}}<br />
<br />
Create the udev rule as shown in the example.<br />
<br />
{{hc|/etc/udev/rules.d/99-zram.rules|2=<br />
KERNEL=="zram0", ATTR{disksize}="512M" RUN="/usr/bin/mkswap /dev/zram0", TAG+="systemd"<br />
KERNEL=="zram1", ATTR{disksize}="512M" RUN="/usr/bin/mkswap /dev/zram1", TAG+="systemd"<br />
}}<br />
<br />
Add /dev/zram to your fstab.<br />
<br />
{{hc|/etc/fstab|<br />
/dev/zram0 none swap defaults 0 0<br />
/dev/zram1 none swap defaults 0 0<br />
}}<br />
<br />
=== 使用显存 ===<br />
<br />
如果你的系统内存很小,而显存又过剩,请参阅[[Swap on video RAM]]的方法,将交换文件设置在显存上。<br />
<br />
=== 预读 ===<br />
<br />
通过预读程序、库到内存中,能有效加快程序加载速度。预读通常用于常用的程序,如浏览器。<br />
<br />
==== Go-preload ====<br />
<br />
{{AUR|gopreload-git}}是来自gentoo的一个预读服务。安装后,通过下列命令采集预读信息:<br />
# gopreload-prepare program<br />
运行需要预读的程序,收集结束后按回车键。<br />
<br />
然后会生成一个预读列表:{{ic|/usr/share/gopreload/enabled}}。在{{ic|/etc/rc.conf}}设置开机启动gopreload,Go-preload就会在每次开机时预读列表中的程序。要禁止预读某个程序,只需从{{ic|/usr/share/gopreload/enabled}}删除项目,或者移入{{ic|/usr/share/gopreload/disabled}}。<br />
<br />
==== Preload ====<br />
<br />
比起Go-preload,[[Preload]]更自动化(尽管有违KISS):只需要在{{ic|/etc/rc.conf}}添加服务就完事了。<br />
<br />
== 系统启动 ==<br />
<br />
参见:[[Improve boot performance (简体中文)|加速系统启动]]。<br />
<br />
=== 待机 ===<br />
<br />
想要加快系统启动,最好的方法就是不要关电脑,而选择[[Suspend to RAM|待机]]。当然,为了可持续发展(至少是电费),不用电脑时还是关了吧。<br />
<br />
=== 自己编译内核 ===<br />
<br />
自己编译内核,删除不需要的模块,可以减少引导时间和内存占用。但通常这是个耗时、枯燥甚至令人厌烦的事情,你可能面临各种错误——甚至最终节约的开机时间还不如你浪费的时间多。但通过自己编译内核,可以学习到不少知识。参见:[[Kernel Compilation|here]]。<br />
<br />
== Network ==<br />
<br />
* Kernel networking: see [[Sysctl#Improving performance]]<br />
* NIC: see [[Network configuration#Set device MTU and queue length]]<br />
* DNS: consider using a caching DNS resolver, see [[Domain name resolution#DNS servers]]<br />
* Samba: see [[Samba#Improve throughput]]</div>Fincehttps://wiki.archlinux.org/index.php?title=Chroot_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=728992Chroot (简体中文)2022-05-10T03:39:05Z<p>Fince: change TranslationStatus</p>
<hr />
<div>[[Category:System recovery (简体中文)]]<br />
[[de:Chroot]]<br />
[[en:Chroot]]<br />
[[es:Chroot]]<br />
[[fa:تغییر ریشه]]<br />
[[fr:Chroot]]<br />
[[ja:Chroot]]<br />
[[pt:Chroot]]<br />
[[ru:Chroot]]<br />
[[tr:Chroot]]<br />
{{TranslationStatus (简体中文)|chroot|2022-05-10|723126}}<br />
[[Wikipedia:Chroot|Chroot]] 是一种修改当前进程及其子进程的可见根目录的操作。修改后,进程将不能访问该环境目录树以外的任何文件和命令,这种修改后的环境叫作 ''chroot jail''(直译为 chroot 监狱)。<br />
<br />
== 原因 ==<br />
<br />
改变根目录通常是为了在无法启动或登录的系统上进行系统维护,例如:<br />
<br />
* 重新安装 [[bootloader]]。<br />
* 重建 [[mkinitcpio|initramfs 镜像]]。<br />
* 升级或[[downgrading packages|降级软件包]]。<br />
* 重置[[Password recovery|忘记的密码]]。<br />
* 在干净的 [[DeveloperWiki:Building in a clean chroot|clean chroot]] 中构建软件包。<br />
<br />
另见 [[Wikipedia:Chroot#Limitations]]。<br />
<br />
== 必要条件 ==<br />
<br />
* root 权限<br />
* 另一个 linux 环境,例如 liveCD、USB 闪存介质或者一个已经安装的另一个 linux 发行版。<br />
* 匹配的架构,chroot 前后的环境架构要一致(例如,都是 i686 或 x86_64)。可以用以下命令查看当前环境的架构 {{bc|uname -m}}<br />
* 提前加载 chroot 环境需要的内核模块<br />
* 如果需要 [[Swap (简体中文)|swap]], chroot 前先启用 swap ({{ic|swapon /dev/sdxY}})<br />
* 如果需要网络,chroot 之前先建立好网络连接。<br />
<br />
== 用法 ==<br />
<br />
{{Note (简体中文)|<br />
*有些[[systemd (简体中文)|systemd]] 工具无法在 chroot 中运行,例如 ''hostnamectl''、''localectl'' 和 ''timedatectl'',因为这些程序需要可用的 [[dbus]] 连接。 [https://github.com/systemd/systemd/issues/798#issuecomment-126568596]<br />
*新的 root ({{ic|/}}) 所在的文件系统必须是可用访问的状态(提前解密、[[https://wiki.archlinux.org/title/File systems (简体中文)#挂载文件系统|挂载]])。}}<br />
<br />
有两种使用 chroot 的方式:<br />
<br />
=== 使用 arch-chroot ===<br />
<br />
{{ic|arch-chroot}} bash 脚本是软件包 {{Pkg|arch-install-scripts}} 的一部分,在运行 {{ic|/usr/bin/chroot}} 前,这个脚本会挂载类似 {{ic|/proc}} 的 API 文件系统,建立可用的 {{ic|/etc/resolv.conf}}。<br />
<br />
进入 chroot<br />
<br />
# arch-chroot ''/location/of/new/root''<br />
<br />
例如在 [[installation guide|安装指南]] 中,chroot 到 {{ic|/mnt}}:<br />
<br />
# arch-chroot /mnt<br />
<br />
退出 chroot:<br />
<br />
# exit<br />
<br />
==== 运行一个命令并退出 ====<br />
<br />
用下面命令在 chroot 中运行一个命令并退出:<br />
<br />
# arch-chroot ''/location/of/new/root'' ''mycommand''<br />
<br />
例如要在 {{ic|/mnt/arch}} 中运行 {{ic|mkinitcpio -p linux}} 并退出:<br />
<br />
# arch-chroot /mnt/arch mkinitcpio -p linux<br />
<br />
=== 使用 chroot ===<br />
<br />
{{警告|使用 {{ic|--rbind}} 选项时,将无法卸载某些 {{ic|dev/}} 和 {{ic|sys/}} 的子目录,用 {{ic|umount -l}} 卸载将会破坏会话并需要重启,所以请尽可能使用 {{ic|-o bind}}。}}<br />
<br />
在下面的例子中,{{ic|''/location/of/new/root''}} 代指新的根目录所在的文件夹。<br />
首先,临时挂载 API 文件系统:<br />
<br />
# cd {{ic|''/location/of/new/root''}}<br />
# mount -t proc /proc proc/<br />
# mount -t sysfs /sys sys/<br />
# mount --rbind /dev dev/<br />
<br />
可选挂载:<br />
<br />
# mount --rbind /run run/<br />
<br />
如果正运行在 UEFI 系统,则还需要能够访问 EFI 变量,不然在安装 GRUB 时会得到类似这样的消息:{{ic|UEFI variables not supported on this machine}}:<br />
<br />
# mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/<br />
<br />
如果已经建立了一个网络连接并且想在 chroot 环境中继续使用,将 DNS 服务器配置复制到新环境:<br />
<br />
# cp -L /etc/resolv.conf etc/resolv.conf<br />
<br />
chroot 到新环境中并启用指定 shell<br />
<br />
# chroot /mnt/arch /usr/bin/bash<br />
<br />
{{Note (简体中文)|<br />
* 如果遇到错误 {{ic|chroot: cannot run command '/bin/bash': Exec format error}},很可能是因为两个环境架构不匹配。<br />
* 如果遇到错误 {{ic|chroot: '/usr/bin/bash': permission denied}},用执行权限重新挂载: {{ic|mount -o remount,exec ''/location/of/new/root''}}。<br />
** 如果以上方式无效,那么请[https://www.tldp.org/LDP/LG/issue52/okopnik.html 确保]新环境的基础组件完整(如果是 Arch 根目录,请尝试 {{ic|1=paccheck --root=''/location/of/new/root'' --files --file-properties --md5sum glibc filesystem}},来自 {{Pkg|pacutils}})。<br />
}}<br />
<br />
(可选)加载 Bash 配置文件({{ic|~/.bashrc}} 和 {{ic|/etc/bash.bashrc}}),运行:<br />
<br />
# source ~/.bashrc<br />
# source /etc/profile<br />
<br />
或创建一个独特的提示符来区别你的chroot环境:<br />
<br />
# export PS1="(chroot) $PS1"<br />
<br />
退出 chroot 环境:<br />
<br />
# exit<br />
<br />
然后卸载临时文件系统:<br />
<br />
# cd /<br />
# umount --recursive {{ic|''/location/of/new/root''}}<br />
<br />
如果出现 {{ic|/mnt}}(或其它任何分区) is busy, 这可能意味着:<br />
<br />
* chroot环境中残留了一个运行的程序或者还有分区没有被卸载,退出程序并用 {{ic|findmnt -R ''/location/of/new/root''}} 查找然后卸载未卸载的分区。<br />
* 如果你仍然不能卸载分区,使用{{ic|--force}}选项:{{bc|# umount -f /mnt}}, 或使用 {{ic|umount --lazy}} 直接释放挂载。这是,请立即重启系统以避免不一致的状态导致冲突。<br />
<br />
== 在 chroot 中运行图形程序 ==<br />
<br />
如果系统上运行了[[X]],可以在 chroot 环境启动图形应用。<br />
<br />
为了chroot环境能连接到你的X服务器,在X服务器中打开一个终端(例如,在用户当前登录的桌面中),然后运行如下命令给任何人连接到用户X服务器的权限(另见 [[Xhost]]):<br />
<br />
$ xhost +local:<br />
<br />
然后,从chroot环境中将应用指向你的X服务器,将chroot中的DISPLAY环境变量设定成和拥有X服务器的用户DISPLAY变量相匹配。例如运行:<br />
<br />
$ echo $DISPLAY<br />
<br />
作为拥有X服务器的用户查看DISPLAY的值。如果是“:0”(例如是),然后在chroot环境中运行<br />
<br />
# export DISPLAY=:0<br />
<br />
现在就可以从chroot命令行启动图形界面应用<br />
<br />
== 不使用 root 权限 ==<br />
<br />
Chroot 需要 root 权限,有时用户并没有这个权限,下面工具可用实现类似的功能:<br />
<br />
=== PRoot ===<br />
<br />
[[PRoot]] 可用在没有 root 权限的情况下,用 {{ic|mount --bind}} 设置可见根目录,这样可用为不同的 CPU 架构编译程序。这个程序的缺点是文件属于主机系统。可用用 {{ic|--root-id}} 选项解决一部分问题。<br />
<br />
=== Fakechroot ===<br />
<br />
{{Pkg|fakechroot}} 是一个拦截 chroot 调用并伪造结果的程序。用 {{Pkg|fakeroot}} 可用为普通用户伪造一个 chroot 环境:<br />
<br />
$ fakechroot fakeroot chroot ~/my-chroot bash<br />
<br />
=== Unshare ===<br />
<br />
Unshare 是 {{Pkg|util-linux}} 的一部分,可以用来创建新的内核命名空间。它使用常规的 chroot 命令运行,例如:<br />
<br />
$ unshare --map-root-user chroot ~/namespace /bin/sh<br />
<br />
== 疑难解答 ==<br />
<br />
=== arch-chroot: /location/of/new/root is not a mountpoint. This may have undesirable side effects. ===<br />
<br />
执行 {{ic|arch-chroot ''/location/of/new/root''}} 命令后,出现以下警告:<br />
<br />
==> WARNING: ''/location/of/new/root'' is not a mountpoint. This may have undesirable side effects.<br />
<br />
见 {{man|8|arch-chroot}} 中的解释和使用绑定挂载让 chroot 目录变成挂载点的例子。<br />
<br />
== 另见 ==<br />
<br />
* [https://help.ubuntu.com/community/BasicChroot 基础 Chroot]</div>Fincehttps://wiki.archlinux.org/index.php?title=Chroot_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=728991Chroot (简体中文)2022-05-10T03:37:57Z<p>Fince: minor edit</p>
<hr />
<div>[[Category:System recovery (简体中文)]]<br />
[[de:Chroot]]<br />
[[en:Chroot]]<br />
[[es:Chroot]]<br />
[[fa:تغییر ریشه]]<br />
[[fr:Chroot]]<br />
[[ja:Chroot]]<br />
[[pt:Chroot]]<br />
[[ru:Chroot]]<br />
[[tr:Chroot]]<br />
{{TranslationStatus (简体中文)|Change_Root|2022-05-10|723126}}<br />
[[Wikipedia:Chroot|Chroot]] 是一种修改当前进程及其子进程的可见根目录的操作。修改后,进程将不能访问该环境目录树以外的任何文件和命令,这种修改后的环境叫作 ''chroot jail''(直译为 chroot 监狱)。<br />
<br />
== 原因 ==<br />
<br />
改变根目录通常是为了在无法启动或登录的系统上进行系统维护,例如:<br />
<br />
* 重新安装 [[bootloader]]。<br />
* 重建 [[mkinitcpio|initramfs 镜像]]。<br />
* 升级或[[downgrading packages|降级软件包]]。<br />
* 重置[[Password recovery|忘记的密码]]。<br />
* 在干净的 [[DeveloperWiki:Building in a clean chroot|clean chroot]] 中构建软件包。<br />
<br />
另见 [[Wikipedia:Chroot#Limitations]]。<br />
<br />
== 必要条件 ==<br />
<br />
* root 权限<br />
* 另一个 linux 环境,例如 liveCD、USB 闪存介质或者一个已经安装的另一个 linux 发行版。<br />
* 匹配的架构,chroot 前后的环境架构要一致(例如,都是 i686 或 x86_64)。可以用以下命令查看当前环境的架构 {{bc|uname -m}}<br />
* 提前加载 chroot 环境需要的内核模块<br />
* 如果需要 [[Swap (简体中文)|swap]], chroot 前先启用 swap ({{ic|swapon /dev/sdxY}})<br />
* 如果需要网络,chroot 之前先建立好网络连接。<br />
<br />
== 用法 ==<br />
<br />
{{Note (简体中文)|<br />
*有些[[systemd (简体中文)|systemd]] 工具无法在 chroot 中运行,例如 ''hostnamectl''、''localectl'' 和 ''timedatectl'',因为这些程序需要可用的 [[dbus]] 连接。 [https://github.com/systemd/systemd/issues/798#issuecomment-126568596]<br />
*新的 root ({{ic|/}}) 所在的文件系统必须是可用访问的状态(提前解密、[[https://wiki.archlinux.org/title/File systems (简体中文)#挂载文件系统|挂载]])。}}<br />
<br />
有两种使用 chroot 的方式:<br />
<br />
=== 使用 arch-chroot ===<br />
<br />
{{ic|arch-chroot}} bash 脚本是软件包 {{Pkg|arch-install-scripts}} 的一部分,在运行 {{ic|/usr/bin/chroot}} 前,这个脚本会挂载类似 {{ic|/proc}} 的 API 文件系统,建立可用的 {{ic|/etc/resolv.conf}}。<br />
<br />
进入 chroot<br />
<br />
# arch-chroot ''/location/of/new/root''<br />
<br />
例如在 [[installation guide|安装指南]] 中,chroot 到 {{ic|/mnt}}:<br />
<br />
# arch-chroot /mnt<br />
<br />
退出 chroot:<br />
<br />
# exit<br />
<br />
==== 运行一个命令并退出 ====<br />
<br />
用下面命令在 chroot 中运行一个命令并退出:<br />
<br />
# arch-chroot ''/location/of/new/root'' ''mycommand''<br />
<br />
例如要在 {{ic|/mnt/arch}} 中运行 {{ic|mkinitcpio -p linux}} 并退出:<br />
<br />
# arch-chroot /mnt/arch mkinitcpio -p linux<br />
<br />
=== 使用 chroot ===<br />
<br />
{{警告|使用 {{ic|--rbind}} 选项时,将无法卸载某些 {{ic|dev/}} 和 {{ic|sys/}} 的子目录,用 {{ic|umount -l}} 卸载将会破坏会话并需要重启,所以请尽可能使用 {{ic|-o bind}}。}}<br />
<br />
在下面的例子中,{{ic|''/location/of/new/root''}} 代指新的根目录所在的文件夹。<br />
首先,临时挂载 API 文件系统:<br />
<br />
# cd {{ic|''/location/of/new/root''}}<br />
# mount -t proc /proc proc/<br />
# mount -t sysfs /sys sys/<br />
# mount --rbind /dev dev/<br />
<br />
可选挂载:<br />
<br />
# mount --rbind /run run/<br />
<br />
如果正运行在 UEFI 系统,则还需要能够访问 EFI 变量,不然在安装 GRUB 时会得到类似这样的消息:{{ic|UEFI variables not supported on this machine}}:<br />
<br />
# mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/<br />
<br />
如果已经建立了一个网络连接并且想在 chroot 环境中继续使用,将 DNS 服务器配置复制到新环境:<br />
<br />
# cp -L /etc/resolv.conf etc/resolv.conf<br />
<br />
chroot 到新环境中并启用指定 shell<br />
<br />
# chroot /mnt/arch /usr/bin/bash<br />
<br />
{{Note (简体中文)|<br />
* 如果遇到错误 {{ic|chroot: cannot run command '/bin/bash': Exec format error}},很可能是因为两个环境架构不匹配。<br />
* 如果遇到错误 {{ic|chroot: '/usr/bin/bash': permission denied}},用执行权限重新挂载: {{ic|mount -o remount,exec ''/location/of/new/root''}}。<br />
** 如果以上方式无效,那么请[https://www.tldp.org/LDP/LG/issue52/okopnik.html 确保]新环境的基础组件完整(如果是 Arch 根目录,请尝试 {{ic|1=paccheck --root=''/location/of/new/root'' --files --file-properties --md5sum glibc filesystem}},来自 {{Pkg|pacutils}})。<br />
}}<br />
<br />
(可选)加载 Bash 配置文件({{ic|~/.bashrc}} 和 {{ic|/etc/bash.bashrc}}),运行:<br />
<br />
# source ~/.bashrc<br />
# source /etc/profile<br />
<br />
或创建一个独特的提示符来区别你的chroot环境:<br />
<br />
# export PS1="(chroot) $PS1"<br />
<br />
退出 chroot 环境:<br />
<br />
# exit<br />
<br />
然后卸载临时文件系统:<br />
<br />
# cd /<br />
# umount --recursive {{ic|''/location/of/new/root''}}<br />
<br />
如果出现 {{ic|/mnt}}(或其它任何分区) is busy, 这可能意味着:<br />
<br />
* chroot环境中残留了一个运行的程序或者还有分区没有被卸载,退出程序并用 {{ic|findmnt -R ''/location/of/new/root''}} 查找然后卸载未卸载的分区。<br />
* 如果你仍然不能卸载分区,使用{{ic|--force}}选项:{{bc|# umount -f /mnt}}, 或使用 {{ic|umount --lazy}} 直接释放挂载。这是,请立即重启系统以避免不一致的状态导致冲突。<br />
<br />
== 在 chroot 中运行图形程序 ==<br />
<br />
如果系统上运行了[[X]],可以在 chroot 环境启动图形应用。<br />
<br />
为了chroot环境能连接到你的X服务器,在X服务器中打开一个终端(例如,在用户当前登录的桌面中),然后运行如下命令给任何人连接到用户X服务器的权限(另见 [[Xhost]]):<br />
<br />
$ xhost +local:<br />
<br />
然后,从chroot环境中将应用指向你的X服务器,将chroot中的DISPLAY环境变量设定成和拥有X服务器的用户DISPLAY变量相匹配。例如运行:<br />
<br />
$ echo $DISPLAY<br />
<br />
作为拥有X服务器的用户查看DISPLAY的值。如果是“:0”(例如是),然后在chroot环境中运行<br />
<br />
# export DISPLAY=:0<br />
<br />
现在就可以从chroot命令行启动图形界面应用<br />
<br />
== 不使用 root 权限 ==<br />
<br />
Chroot 需要 root 权限,有时用户并没有这个权限,下面工具可用实现类似的功能:<br />
<br />
=== PRoot ===<br />
<br />
[[PRoot]] 可用在没有 root 权限的情况下,用 {{ic|mount --bind}} 设置可见根目录,这样可用为不同的 CPU 架构编译程序。这个程序的缺点是文件属于主机系统。可用用 {{ic|--root-id}} 选项解决一部分问题。<br />
<br />
=== Fakechroot ===<br />
<br />
{{Pkg|fakechroot}} 是一个拦截 chroot 调用并伪造结果的程序。用 {{Pkg|fakeroot}} 可用为普通用户伪造一个 chroot 环境:<br />
<br />
$ fakechroot fakeroot chroot ~/my-chroot bash<br />
<br />
=== Unshare ===<br />
<br />
Unshare 是 {{Pkg|util-linux}} 的一部分,可以用来创建新的内核命名空间。它使用常规的 chroot 命令运行,例如:<br />
<br />
$ unshare --map-root-user chroot ~/namespace /bin/sh<br />
<br />
== 疑难解答 ==<br />
<br />
=== arch-chroot: /location/of/new/root is not a mountpoint. This may have undesirable side effects. ===<br />
<br />
执行 {{ic|arch-chroot ''/location/of/new/root''}} 命令后,出现以下警告:<br />
<br />
==> WARNING: ''/location/of/new/root'' is not a mountpoint. This may have undesirable side effects.<br />
<br />
见 {{man|8|arch-chroot}} 中的解释和使用绑定挂载让 chroot 目录变成挂载点的例子。<br />
<br />
== 另见 ==<br />
<br />
* [https://help.ubuntu.com/community/BasicChroot 基础 Chroot]</div>Fincehttps://wiki.archlinux.org/index.php?title=Chroot_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=728990Chroot (简体中文)2022-05-10T03:36:54Z<p>Fince: update translation</p>
<hr />
<div>[[Category:System recovery (简体中文)]]<br />
[[de:Chroot]]<br />
[[en:Chroot]]<br />
[[es:Chroot]]<br />
[[fa:تغییر ریشه]]<br />
[[fr:Chroot]]<br />
[[ja:Chroot]]<br />
[[pt:Chroot]]<br />
[[ru:Chroot]]<br />
[[tr:Chroot]]<br />
{{TranslationStatus (简体中文)|Change_Root|2022-05-10|723126}}<br />
[[Wikipedia:Chroot|Chroot]] 是一种修改当前进程及其子进程的可见根目录的操作。修改后,进程将不能访问该环境目录树以外的任何文件和命令,这种修改后的环境叫作 ''chroot jail''(直译为chroot监狱)。<br />
<br />
== 原因 ==<br />
<br />
改变根目录通常是为了在无法启动或登录的系统上进行系统维护,例如:<br />
<br />
* 重新安装 [[bootloader]]。<br />
* 重建 [[mkinitcpio|initramfs 镜像]]。<br />
* 升级或[[downgrading packages|降级软件包]]。<br />
* 重置[[Password recovery|忘记的密码]]。<br />
* 在干净的 [[DeveloperWiki:Building in a clean chroot|clean chroot]] 中构建软件包。<br />
<br />
另见 [[Wikipedia:Chroot#Limitations]]。<br />
<br />
== 必要条件 ==<br />
<br />
* root 权限<br />
* 另一个 linux 环境,例如 liveCD、USB 闪存介质或者一个已经安装的另一个 linux 发行版。<br />
* 匹配的架构,chroot 前后的环境架构要一致(例如,都是 i686 或 x86_64)。可以用以下命令查看当前环境的架构 {{bc|uname -m}}<br />
* 提前加载 chroot 环境需要的内核模块<br />
* 如果需要 [[Swap (简体中文)|swap]], chroot 前先启用 swap ({{ic|swapon /dev/sdxY}})<br />
* 如果需要网络,chroot 之前先建立好网络连接。<br />
<br />
== 用法 ==<br />
<br />
{{Note (简体中文)|<br />
*有些[[systemd (简体中文)|systemd]] 工具无法在 chroot 中运行,例如 ''hostnamectl''、''localectl'' 和 ''timedatectl'',因为这些程序需要可用的 [[dbus]] 连接。 [https://github.com/systemd/systemd/issues/798#issuecomment-126568596]<br />
*新的 root ({{ic|/}}) 所在的文件系统必须是可用访问的状态(提前解密、[[https://wiki.archlinux.org/title/File systems (简体中文)#挂载文件系统|挂载]])。}}<br />
<br />
有两种使用 chroot 的方式:<br />
<br />
=== 使用 arch-chroot ===<br />
<br />
{{ic|arch-chroot}} bash 脚本是软件包 {{Pkg|arch-install-scripts}} 的一部分,在运行 {{ic|/usr/bin/chroot}} 前,这个脚本会挂载类似 {{ic|/proc}} 的 API 文件系统,建立可用的 {{ic|/etc/resolv.conf}}。<br />
<br />
进入 chroot<br />
<br />
# arch-chroot ''/location/of/new/root''<br />
<br />
例如在 [[installation guide|安装指南]] 中,chroot 到 {{ic|/mnt}}:<br />
<br />
# arch-chroot /mnt<br />
<br />
退出 chroot:<br />
<br />
# exit<br />
<br />
==== 运行一个命令并退出 ====<br />
<br />
用下面命令在 chroot 中运行一个命令并退出:<br />
<br />
# arch-chroot ''/location/of/new/root'' ''mycommand''<br />
<br />
例如要在 {{ic|/mnt/arch}} 中运行 {{ic|mkinitcpio -p linux}} 并退出:<br />
<br />
# arch-chroot /mnt/arch mkinitcpio -p linux<br />
<br />
=== 使用 chroot ===<br />
<br />
{{警告|使用 {{ic|--rbind}} 选项时,将无法卸载某些 {{ic|dev/}} 和 {{ic|sys/}} 的子目录,用 {{ic|umount -l}} 卸载将会破坏会话并需要重启,所以请尽可能使用 {{ic|-o bind}}。}}<br />
<br />
在下面的例子中,{{ic|''/location/of/new/root''}} 代指新的根目录所在的文件夹。<br />
首先,临时挂载 API 文件系统:<br />
<br />
# cd {{ic|''/location/of/new/root''}}<br />
# mount -t proc /proc proc/<br />
# mount -t sysfs /sys sys/<br />
# mount --rbind /dev dev/<br />
<br />
可选挂载:<br />
<br />
# mount --rbind /run run/<br />
<br />
如果正运行在 UEFI 系统,则还需要能够访问 EFI 变量,不然在安装 GRUB 时会得到类似这样的消息:{{ic|UEFI variables not supported on this machine}}:<br />
<br />
# mount --rbind /sys/firmware/efi/efivars sys/firmware/efi/efivars/<br />
<br />
如果已经建立了一个网络连接并且想在 chroot 环境中继续使用,将 DNS 服务器配置复制到新环境:<br />
<br />
# cp -L /etc/resolv.conf etc/resolv.conf<br />
<br />
chroot 到新环境中并启用指定 shell<br />
<br />
# chroot /mnt/arch /usr/bin/bash<br />
<br />
{{Note (简体中文)|<br />
* 如果遇到错误 {{ic|chroot: cannot run command '/bin/bash': Exec format error}},很可能是因为两个环境架构不匹配。<br />
* 如果遇到错误 {{ic|chroot: '/usr/bin/bash': permission denied}},用执行权限重新挂载: {{ic|mount -o remount,exec ''/location/of/new/root''}}。<br />
** 如果以上方式无效,那么请[https://www.tldp.org/LDP/LG/issue52/okopnik.html 确保]新环境的基础组件完整(如果是 Arch 根目录,请尝试 {{ic|1=paccheck --root=''/location/of/new/root'' --files --file-properties --md5sum glibc filesystem}},来自 {{Pkg|pacutils}})。<br />
}}<br />
<br />
(可选)加载 Bash 配置文件({{ic|~/.bashrc}} 和 {{ic|/etc/bash.bashrc}}),运行:<br />
<br />
# source ~/.bashrc<br />
# source /etc/profile<br />
<br />
或创建一个独特的提示符来区别你的chroot环境:<br />
<br />
# export PS1="(chroot) $PS1"<br />
<br />
退出 chroot 环境:<br />
<br />
# exit<br />
<br />
然后卸载临时文件系统:<br />
<br />
# cd /<br />
# umount --recursive {{ic|''/location/of/new/root''}}<br />
<br />
如果出现 {{ic|/mnt}}(或其它任何分区) is busy, 这可能意味着:<br />
<br />
* chroot环境中残留了一个运行的程序或者还有分区没有被卸载,退出程序并用 {{ic|findmnt -R ''/location/of/new/root''}} 查找然后卸载未卸载的分区。<br />
* 如果你仍然不能卸载分区,使用{{ic|--force}}选项:{{bc|# umount -f /mnt}}, 或使用 {{ic|umount --lazy}} 直接释放挂载。这是,请立即重启系统以避免不一致的状态导致冲突。<br />
<br />
== 在 chroot 中运行图形程序 ==<br />
<br />
如果系统上运行了[[X]],可以在 chroot 环境启动图形应用。<br />
<br />
为了chroot环境能连接到你的X服务器,在X服务器中打开一个终端(例如,在用户当前登录的桌面中),然后运行如下命令给任何人连接到用户X服务器的权限(另见 [[Xhost]]):<br />
<br />
$ xhost +local:<br />
<br />
然后,从chroot环境中将应用指向你的X服务器,将chroot中的DISPLAY环境变量设定成和拥有X服务器的用户DISPLAY变量相匹配。例如运行:<br />
<br />
$ echo $DISPLAY<br />
<br />
作为拥有X服务器的用户查看DISPLAY的值。如果是“:0”(例如是),然后在chroot环境中运行<br />
<br />
# export DISPLAY=:0<br />
<br />
现在就可以从chroot命令行启动图形界面应用<br />
<br />
== 不使用 root 权限 ==<br />
<br />
Chroot 需要 root 权限,有时用户并没有这个权限,下面工具可用实现类似的功能:<br />
<br />
=== PRoot ===<br />
<br />
[[PRoot]] 可用在没有 root 权限的情况下,用 {{ic|mount --bind}} 设置可见根目录,这样可用为不同的 CPU 架构编译程序。这个程序的缺点是文件属于主机系统。可用用 {{ic|--root-id}} 选项解决一部分问题。<br />
<br />
=== Fakechroot ===<br />
<br />
{{Pkg|fakechroot}} 是一个拦截 chroot 调用并伪造结果的程序。用 {{Pkg|fakeroot}} 可用为普通用户伪造一个 chroot 环境:<br />
<br />
$ fakechroot fakeroot chroot ~/my-chroot bash<br />
<br />
=== Unshare ===<br />
<br />
Unshare 是 {{Pkg|util-linux}} 的一部分,可以用来创建新的内核命名空间。它使用常规的 chroot 命令运行,例如:<br />
<br />
$ unshare --map-root-user chroot ~/namespace /bin/sh<br />
<br />
== 疑难解答 ==<br />
<br />
=== arch-chroot: /location/of/new/root is not a mountpoint. This may have undesirable side effects. ===<br />
<br />
执行 {{ic|arch-chroot ''/location/of/new/root''}} 命令后,出现以下警告:<br />
<br />
==> WARNING: ''/location/of/new/root'' is not a mountpoint. This may have undesirable side effects.<br />
<br />
见 {{man|8|arch-chroot}} 中的解释和使用绑定挂载让 chroot 目录变成挂载点的例子。<br />
<br />
== 另见 ==<br />
<br />
* [https://help.ubuntu.com/community/BasicChroot 基础 Chroot]</div>Fincehttps://wiki.archlinux.org/index.php?title=Python_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727897Python (简体中文)2022-04-29T10:54:13Z<p>Fince: update translation</p>
<hr />
<div>[[Category:Programming languages (简体中文)]]<br />
[[de:Python]]<br />
[[en:Python]]<br />
[[ja:Python]]<br />
[[pt:Python]]<br />
[[ru:Python]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Python Package Guidelines}}<br />
{{Related|mod_python}}<br />
{{Related|Python/Virtualenv (简体中文)}}<br />
{{Related|Django}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Python|2022-04-29|727857}}<br />
来自[https://docs.python.org/zh-cn/3/faq/general.html#what-is-python 什么是 Python?]:<br />
<br />
:Python 是一种解释型、交互式、面向对象的编程语言。它包含了模块、异常、动态类型、高层级动态数据类型以及类等特性。在面向对象编程以外它还支持多种编程范式,例如过程式和函数式编程等 Python 结合了超强的功能和极清晰的语法。它带有许多系统调用和库以及多种窗口系统的接口,并且能用 C 或 C++ 来进行扩展。它还可用作需要可编程接口的应用程序的扩展语言。最后,Python 非常易于移植:它可以在包括 Linux 和 macOS 在内的许多 Unix 变种以及 Windows 上运行。<br />
<br />
== 安装 ==<br />
<br />
=== Python 3 ===<br />
<br />
Python 3是最新并且处于活跃开发中的 Python 版本。Python 3的最近更新内容见 [https://docs.python.org/zh-cn/3/whatsnew/index.html Python 的新变化]。<br />
<br />
请[[pacman (简体中文)|安装]] {{Pkg|python}} 软件包以获取当前版本的 Python 3。<br />
<br />
若要从源代码编译测试版,请访问 [https://www.python.org/downloads/ Python 下载页面]。[[Arch User Repository (简体中文)|AUR]] 中也有 [[PKGBUILD (简体中文)|PKGBUILDS]]。若要安装 RC 版,请注意二进制文件将默认安装到 {{ic|/usr/local/bin/python3.''x''}} 目录。如果不需要超级用户权限,并想要安装到主目录,可以考虑使用 {{Pkg|pyenv}} 以替代。<br />
<br />
=== Python 2 ===<br />
<br />
{{警告|Python 2已于2020年1月1日停止支持。见[https://www.python.org/doc/sunset-python-2/ Sunsetting Python 2]。}}<br />
<br />
Python 2 是该语言的老版本,它与 Python 3不兼容。若要查看两者区别的概述,见 [https://wiki.python.org/moin/Python2orPython3?action=recall&rev=96 Python2orPython3 文档的历史版本]。<br />
<br />
尽管Python 2不再维护,但仍有一些软件包依赖它。Python 2对于维护、使用或移植传统 Python 2软件的开发者来说也可能是有用的。<br />
<br />
请[[pacman (简体中文)|安装]]软件包 {{Pkg|python2}} 以获取Python 2。<br />
<br />
Python 2 可以和 Python 3 同时运行,需要指定为 {{ic|python2}} 才会运行此版本。<br />
<br />
{{ic|/usr/bin/python}} 默认链接到 python 3,所以使用 python 2的软件包应该用 {{ic|/usr/bin/python2}} 替换 {{ic|/usr/bin/python}},要注意某些 python 2脚本也会错误地指定为{{ic|python}}。用文本编辑器打开需要修改的程序或脚本,第一行可能为:<br />
<br />
#!/usr/bin/env python<br />
<br />
或<br />
<br />
#!/usr/bin/python<br />
<br />
将其中的 {{ic|python}} 替换为 {{ic|python2}} 即可。<br />
<br />
另一种强制使用 python2 而不修改脚本的方法是明确地使用 python2 调用它,即<br />
<br />
$ python2 ''my_script''.py<br />
<br />
最后,您可能无法控制脚本调用哪一个,但还有一种方法。它仅在脚本使用 {{ic|#!/usr/bin/env python}} 时有效,在用 {{ic|#!/usr/bin/python}} 时无效。这种手法依赖于 {{ic|env}} 在 PATH 变量中搜索第一个对应的条目。<br />
<br />
首先创建一个目录。<br />
<br />
$ mkdir ~/bin<br />
<br />
然后添加一个名为 'python' 的链接指向 python2 以及一个名为 'python-config' 的链接指向 python2-config 。<br />
<br />
$ ln -s /usr/bin/python2 ~/bin/python<br />
$ ln -s /usr/bin/python2-config ~/bin/python-config<br />
<br />
最后把新的目录添加到 PATH 变量的 ''最前面''。<br />
<br />
$ export PATH=~/bin:$PATH<br />
<br />
{{Note (简体中文)|这种[[environment variables (简体中文)|环境变量]]的修改仅在当前终端会话中生效。}}<br />
<br />
要检查 {{ic|env}} 使用的是哪个 python 解释器,使用以下命令:<br />
<br />
$ which python<br />
<br />
另一个解决这个问题的方法是通过 [[Python/Virtualenv (简体中文)]] 来伪造一个脚本的运行环境。<br />
<br />
=== 实现的替代方案 ===<br />
<br />
The {{Pkg|python}} package installs [https://github.com/python/cpython CPython], the reference implementation of Python. However, there are also other implementations available. These implementations are usually based on older versions of Python and are not fully compatible with CPython.<br />
<br />
Implementations available on Arch Linux include:<br />
<br />
* {{App|[[PyPy]]| A Python implementation written in Python. It has speed and memory usage advantages compared to CPython.|https://www.pypy.org|{{Pkg|pypy}}, {{Pkg|pypy3}}}}<br />
* {{App|Jython|An implementation of the Python language written in Java. It can be used to embed Python scripting into Java programs or use Java libraries in Python programs.|https://www.jython.org/|{{Pkg|jython}}}}<br />
* {{App|micropython|Python for microcontrollers. It includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments.|https://micropython.org/|{{AUR|micropython}}}}<br />
* {{App|IronPython|An implementation of the Python programming language which is tightly integrated with [[.NET]]. It can use .NET libraries and allows .NET programs to use Python libraries.|https://ironpython.net|{{AUR|ironpython-git}}}}<br />
<br />
[[wikipedia:Python_(programming_language)#Implementations|More implementations exist]]. Some, such as [https://github.com/stackless-dev/stackless/wiki Stackless], [https://www.pyston.org/ Pyston] and [https://github.com/facebookincubator/cinder Cinder] are used internally at large technology companies. Others are historically notable but are no longer maintained due to improvements in the most popular implementations.<br />
<br />
=== shell 的替代方案 ===<br />
<br />
{{Pkg|python}} 软件包有一个交互式的 Python shell/REPL,可以用 {{ic|python}} 命令启动。也可以使用以下 shell:<br />
<br />
* {{App|bpython|A fancy interface for the Python interpreter.|https://bpython-interpreter.org/|{{Pkg|bpython}}}}<br />
* {{App|IPython|A powerful interactive Python shell.|https://ipython.org/|{{Pkg|ipython}}}}<br />
* {{App|[[Jupyter]]|A web-based computation application powered by IPython.|https://jupyter.org/|{{Pkg|jupyterlab}}, {{Pkg|jupyter-notebook}}}}<br />
* {{App|ptpython|An advanced Python REPL built with [https://github.com/jonathanslenders/python-prompt-toolkit prompt-toolkit].|https://github.com/jonathanslenders/ptpython|{{aur|ptpython}}}}<br />
<br />
=== 旧版本 ===<br />
<br />
[[Arch User Repository|AUR]]中有之前发布的 Python 版本,可以用于运行旧程序或测试程序的版本兼容性等:<br />
<br />
* Python 3.9: {{AUR|python39}}<br />
* Python 3.8: {{AUR|python38}}<br />
* Python 3.7: {{AUR|python37}}<br />
* Python 3.6: {{AUR|python36}}<br />
<br />
AUR 中还有老版本使用的模块和库,可以通过带版本的 python 搜索。例如 "python26" 关键字可以搜索支持 2.6 的模块。<br />
<br />
在AUR上搜索{{ic|python<''不带点的版本号''>}}可以找到对应旧版本的额外模块和库,例如搜索{{ic|python37}}可以找到3.7版本的模块。<br />
<br />
== 软件包管理 ==<br />
<br />
可以使用以下多种方式安装Python软件包:<br />
<br />
* [[official repositories (简体中文)|官方软件仓库]] 和 [[AUR (简体中文)|AUR]] — Arch仓库中有大量流行软件包可用。[[System maintenance#Use the package manager to install software|推荐]]以此安装系统级的软件包。<br />
* {{App|{{man|1|pip}}|Python 官方的软件包安装器。可以使用 pip 安装来自 [https://pypi.org/ Python 包索引]和其他索引的软件包。|https://pip.pypa.io/|{{Pkg|python-pip}}}}<br />
* {{App|pipx|与 pip 类似,但为运行它的用户创建了一个孤立环境,用于每个应用程序及其相关软件包,防止与系统软件包冲突。专注于可以从命令行直接作为应用程序运行的软件包。可以使用 pipx 安装来自 [https://pypi.org/ Python Package Index] 和其他索引的软件包。|https://pypa.github.io/pipx/|{{Pkg|python-pipx}}}}<br />
* {{App|Anaconda|一个开源的软件包与环境管理系统,为Python程序而创建。可以使用 Conda 安装来自 [https://repo.anaconda.com/ Anaconda仓库]的软件包。|https://docs.conda.io/projects/conda/|{{Aur|anaconda}}}}<br />
* {{App|Miniconda|Anaconda 的轻量级替代方案,它安装软件包管理器,但默认不安装科学计算软件包。|https://docs.conda.io/en/latest/miniconda.html|{Aur|miniconda3}}}}<br />
<br />
如果使用 ''pip'' 安装软件包,请使用[[#虚拟环境|虚拟环境]]以避免将软件包安装到 {{ic|/usr}}。也可以使用 {{ic|pip install --user}} 以将软件包安装到[https://pip.pypa.io/en/latest/user_guide/#user-installs user scheme]。''pipx''和 Conda 将环境管理纳入了其工作流中。<br />
<br />
若要查看 Python 软件包管理的最佳实践,见[https://packaging.python.org/ Python Packaging User Guide]。<br />
<br />
历史上,''easy_install''({{Pkg|python-setuptools}}的一部分)用来安装以 [https://packaging.python.org/glossary/#term-egg Eggs] 形式分发的软件包。''easy_install'' 和 Eggs 已经被 ''pip'' 和 [https://packaging.python.org/glossary/#term-wheel Wheels] 取代。详见 [https://packaging.python.org/pip_easy_install/#pip-vs-easy-install pip vs easy_install] 与 [https://packaging.python.org/discussions/wheel-vs-egg Wheel vs Egg]。<br />
<br />
{{Note (简体中文)|[[Creating packages#PKGBUILD generators]] 中介绍了一些工具,可以将 ''pip'' 与 ''pacman'' 整合起来,为特定 PyPI 软件包自动生成 PKGBUILD。}}<br />
<br />
{{提示|[https://pipenv.pypa.io pipenv] 可以为 [https://github.com/pypa/pipfile Pipfile]、''pip'' 和 [[virtualenv]] 提供独立的CLI。若要使用,请安装 {{Pkg|python-pipenv}}。}}<br />
<br />
== 部件绑定 ==<br />
<br />
以下是可用的[[wikipedia:widget toolkit|部件工具包]]绑定:<br />
<br />
* {{App|Tkinter|The standard Python interface to the [https://www.tcl.tk/ Tk] GUI toolkit.|https://docs.python.org/3/library/tkinter.html|{{Pkg|python}}}}<br />
* {{App|Qt for Python (PySide2)|The official Python bindings for [[Qt]]5.|https://www.qt.io/qt-for-python|{{Pkg|pyside2}}, {{Pkg|pyside2-tools}}}}<br />
* {{App|Qt for Python (PySide6)|The official Python bindings for [[Qt]]6.|https://www.qt.io/qt-for-python|{{Pkg|pyside6}}, {{AUR|pyside6-tools}}}}<br />
* {{App|pyQt|A set of Python bindings for Qt.|https://riverbankcomputing.com/software/pyqt/intro|{{Pkg|python-pyqt5}}}}<br />
* {{App|PyGObject|Python bindings for GObject based libraries such as [[GTK]], [[GStreamer]], WebKitGTK, GLib, and GIO.|https://pygobject.readthedocs.io/|{{Pkg|python-gobject}}}}<br />
* {{App|wxPython|A cross-platform GUI toolkit for Python which wraps [https://www.wxwidgets.org/ wxWidgets].|https://wxpython.org/|{{Pkg|python-wxpython}}}}<br />
<br />
若要在 Python 中使用它们,可能还需要安装相关的部件工具包软件包(例如,必须同时安装 {{Pkg|tk}} 才能使用Tkinter)。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 虚拟环境 ===<br />
<br />
{{Pkg|python-virtualenv}} 是 Ian Bicking 编写的 Python 工具,可以为 Python 建立独立环境,可以安装软件包而不影响其它 virtualenv 环境或系统 Python 软件包,可以修改一个软件使用的 Python 版本。<br />
<br />
Python 提供了创建隔离的''虚拟环境''的工具,可以将软件包安装到其中,而不会与其他虚拟环境或系统软件包发生冲突。虚拟环境也可以在同一个系统上运行不同版本的 Python。<br />
<br />
详见 [[Python (简体中文)/Virtual environment (简体中文)]]。<br />
<br />
=== 在 Python Shell 中实现 Tab 补全功能 ===<br />
<br />
[https://docs.python.org/3/tutorial/interactive.html Tab completion] is available in the interactive shell by default. Note that the readline completer will only complete names in the global namespace. You can use {{Pkg|python-jedi}} for a richer tab completion experience [https://jedi.readthedocs.io/en/latest/docs/usage.html#tab-completion-in-the-python-shell].<br />
<br />
== 另见 ==<br />
<br />
=== 官方 ===<br />
<br />
* [https://docs.python.org/ Official Python documentation]<br />
* [https://docs.python.org/3/tutorial/index.html Official Python tutorial]<br />
<br />
=== 第三方 ===<br />
<br />
* [https://automatetheboringstuff.com/ Automate the Boring Stuff with Python] - Creative Commons book<br />
* [https://github.com/vinta/awesome-python Awesome Python] - A curated list of Python resources<br />
* [https://python.swaroopch.com/ A Byte of Python] - Creative Commons book<br />
* [http://inventwithpython.com/cracking/ Cracking Codes With Python] - Free online book<br />
* [https://stephensugden.com/crash_into_python/ Crash into Python] - Free tutorial<br />
* [https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/ Debugging in Python] - Guide to using {{ic|pdb}}, the Python debugger<br />
* [https://diveintopython3.net/ Dive Into Python] - Creative Commons book<br />
* [https://www.oreilly.com/library/view/fluent-python-2nd/9781492056348/ Fluent Python] - Commercial book<br />
* [https://www.oreilly.com/library/view/introducing-python-2nd/9781492051374/ Introducing Python] - Commercial book<br />
* [http://inventwithpython.com/invent4thed/ Invent Your Own Computer Games with Python] - Free online book<br />
* [https://learnpython.org/ Learn Python] - Free interactive tutorial<br />
* [https://learnpythonthehardway.org/ Learn Python the Hard Way] - Commercial book<br />
* [https://pythonspot.com Pythonspot Python Tutorials] - Free online tutorials<br />
* [https://greenteapress.com/wp/think-python-2e// Think Python] - Creative Commons book</div>Fincehttps://wiki.archlinux.org/index.php?title=Python&diff=727857Python2022-04-29T07:25:39Z<p>Fince: /* Old versions */ delete a sentence same as another one in Installation section.</p>
<hr />
<div>[[Category:Programming languages]]<br />
[[de:Python]]<br />
[[ja:Python]]<br />
[[pt:Python]]<br />
[[ru:Python]]<br />
[[zh-hans:Python]]<br />
{{Related articles start}}<br />
{{Related|Python package guidelines}}<br />
{{Related|Python/Virtual environment}}<br />
{{Related|mod_wsgi}}<br />
{{Related|Django}}<br />
{{Related articles end}}<br />
From [https://docs.python.org/3/faq/general.html#what-is-python What is Python?]:<br />
<br />
:Python is an interpreted, interactive, object-oriented programming language. It incorporates modules, exceptions, dynamic typing, very high level dynamic data types, and classes. It supports multiple programming paradigms beyond object-oriented programming, such as procedural and functional programming. Python combines remarkable power with very clear syntax. It has interfaces to many system calls and libraries, as well as to various window systems, and is extensible in C or C++. It is also usable as an extension language for applications that need a programmable interface. Finally, Python is portable: it runs on many Unix variants including Linux and macOS, and on Windows.<br />
<br />
== Installation ==<br />
<br />
=== Python 3 ===<br />
<br />
Python 3 is the latest and actively developed version of the language. See [https://docs.python.org/3/whatsnew/index.html What's New in Python] to see the latest changes in Python 3.<br />
<br />
To install the current release of Python 3, [[install]] the {{Pkg|python}} package.<br />
<br />
If you would like to build the latest RC/betas from source, visit [https://www.python.org/downloads/ Python Downloads]. The [[Arch User Repository]] also contains good [[PKGBUILD]]s. If you do decide to build the RC, note that the binary (by default) installs to {{ic|/usr/local/bin/python3.''x''}}. As an alternative which does not require superuser capabilities and installs to the home directory, consider using {{Pkg|pyenv}}.<br />
<br />
=== Python 2 ===<br />
<br />
{{warning|Python 2 reached its end of life on January 1st of 2020. A small number of packages still depend on Python 2 but that version of Python will not be maintained further. See: [https://www.python.org/doc/sunset-python-2/ Sunsetting Python 2] }}<br />
<br />
Python 2 is an older version of the language. Python 3 and Python 2 are incompatible. For an overview of the differences, see [https://wiki.python.org/moin/Python2orPython3?action=recall&rev=96 the historical version of the Python2orPython3 document].<br />
<br />
Although Python 2 is no longer actively maintained, there are some packages that still depend on it. Python 2 may also be useful for developers maintaining, using or porting legacy Python 2 software.<br />
<br />
To get the last version of Python 2, [[install]] the {{Pkg|python2}} package.<br />
<br />
Python 2 will happily run alongside Python 3. You need to specify {{ic|python2}} in order to run this version.<br />
<br />
Any program requiring Python 2 needs to use {{ic|/usr/bin/python2}}, instead of {{ic|/usr/bin/python}}, which points to Python 3. However, many legacy Python 2 scripts incorrectly specify {{ic|python}} in their shebang line. To change this, open the program or script in a [[text editor]] and change the first line. The line may show one of the following:<br />
<br />
#!/usr/bin/env python<br />
<br />
or<br />
<br />
#!/usr/bin/python<br />
<br />
In either case, change {{ic|python}} to {{ic|python2}} and the program will then use Python 2 instead of Python 3.<br />
<br />
Another way to force the use of python2 without altering the scripts is to call it explicitly with {{ic|python2}}:<br />
<br />
$ python2 ''my_script''.py<br />
<br />
Finally, you may not be able to control the script calls, but there is a way to trick the environment. It only works if the scripts use {{ic|#!/usr/bin/env python}}. It will not work with {{ic|#!/usr/bin/python}}. This trick relies on {{ic|env}} searching for the first corresponding entry in the {{ic|PATH}} variable.<br />
<br />
First create a dummy folder:<br />
<br />
$ mkdir ~/bin<br />
<br />
Then add a symlink {{ic|python}} to ''python2'' and the configuration scripts in it:<br />
<br />
$ ln -s /usr/bin/python2 ~/bin/python<br />
$ ln -s /usr/bin/python2-config ~/bin/python-config<br />
<br />
Finally put the new folder ''at the beginning'' of your {{ic|PATH}} variable:<br />
<br />
$ export PATH=~/bin:$PATH<br />
<br />
{{Note|This method of changing [[environment variables]] is not permanent and is only active in the current terminal session.}}<br />
<br />
To check which python interpreter is being used by {{ic|env}}, use the following command:<br />
<br />
$ command -v python<br />
<br />
A similar approach in tricking the environment, which also relies on {{ic|#!/usr/bin/env python}} to be called by the script in question, is to use a [[#Virtual environment|virtual environment]].<br />
<br />
=== Alternative implementations ===<br />
<br />
The {{Pkg|python}} package installs [https://github.com/python/cpython CPython], the reference implementation of Python. However, there are also other implementations available. These implementations are usually based on older versions of Python and are not fully compatible with CPython.<br />
<br />
Implementations available on Arch Linux include:<br />
<br />
* {{App|[[PyPy]]| A Python implementation written in Python. It has speed and memory usage advantages compared to CPython.|https://www.pypy.org|{{Pkg|pypy}}, {{Pkg|pypy3}}}}<br />
* {{App|Jython|An implementation of the Python language written in Java. It can be used to embed Python scripting into Java programs or use Java libraries in Python programs.|https://www.jython.org/|{{Pkg|jython}}}}<br />
* {{App|micropython|Python for microcontrollers. It includes a small subset of the Python standard library and is optimized to run on microcontrollers and in constrained environments.|https://micropython.org/|{{AUR|micropython}}}}<br />
* {{App|IronPython|An implementation of the Python programming language which is tightly integrated with [[.NET]]. It can use .NET libraries and allows .NET programs to use Python libraries.|https://ironpython.net|{{AUR|ironpython-git}}}}<br />
<br />
[[wikipedia:Python_(programming_language)#Implementations|More implementations exist]]. Some, such as [https://github.com/stackless-dev/stackless/wiki Stackless], [https://www.pyston.org/ Pyston] and [https://github.com/facebookincubator/cinder Cinder] are used internally at large technology companies. Others are historically notable but are no longer maintained due to improvements in the most popular implementations.<br />
<br />
=== Alternative shells ===<br />
<br />
The {{Pkg|python}} package includes an interactive Python shell/REPL which can be launched with the {{ic|python}} command. The following shells are also available:<br />
<br />
* {{App|bpython|A fancy interface for the Python interpreter.|https://bpython-interpreter.org/|{{Pkg|bpython}}}}<br />
* {{App|IPython|A powerful interactive Python shell.|https://ipython.org/|{{Pkg|ipython}}}}<br />
* {{App|[[Jupyter]]|A web-based computation application powered by IPython.|https://jupyter.org/|{{Pkg|jupyterlab}}, {{Pkg|jupyter-notebook}}}}<br />
* {{App|ptpython|An advanced Python REPL built with [https://github.com/jonathanslenders/python-prompt-toolkit prompt-toolkit].|https://github.com/jonathanslenders/ptpython|{{aur|ptpython}}}}<br />
<br />
=== Old versions ===<br />
<br />
Old versions of Python are available via the [[AUR]] and may be useful for historical curiosity, old applications that do not run on current versions, or for testing Python programs intended to run on a distribution that comes with an older version:<br />
<br />
* Python 3.9: {{AUR|python39}}<br />
* Python 3.8: {{AUR|python38}}<br />
* Python 3.7: {{AUR|python37}}<br />
* Python 3.6: {{AUR|python36}}<br />
<br />
Extra modules/libraries for old versions of Python may be found on the AUR by searching for {{ic|python<''version without period''>}}, e.g. searching for {{ic|python37}} for 3.7 modules.<br />
<br />
== Package management ==<br />
<br />
There are several ways to install Python packages on Arch Linux:<br />
<br />
* [[Official repositories]] and [[AUR]] — A large number of popular packages are available in the Arch repositories. This is [[System maintenance#Use the package manager to install software|the preferred way]] to install system-wide packages.<br />
* {{App|{{man|1|pip}}|The official package installer for Python. You can use pip to install packages from the [https://pypi.org/ Python Package Index] and other indexes.|https://pip.pypa.io/|{{Pkg|python-pip}}}}<br />
* {{App|pipx|Closely related to pip, but creates, for the user running it, an isolated environment for each application and its associated packages, preventing conflicts with system packages. Focused on packages that can be run from the command line directly as applications. You can use pipx to install packages from the [https://pypi.org/ Python Package Index] and other indexes.|https://pypa.github.io/pipx/|{{Pkg|python-pipx}}}}<br />
* {{App|Anaconda|An open source package management system and environment management system, originally created for Python programs. You can use Conda to install packages from the [https://repo.anaconda.com/ Anaconda repositories].|https://docs.conda.io/projects/conda/|{{Aur|anaconda}}}}<br />
* {{App|Miniconda|A lightweight alternative to Anaconda which installs the package manager but does not install scientific computing packages by default.|https://docs.conda.io/en/latest/miniconda.html|{{Aur|miniconda3}}}}<br />
<br />
When installing packages using ''pip'', it is recommended to use a [[#Virtual environment|virtual environment]] to prevent conflicts with system packages in {{ic|/usr}}. Alternatively, {{ic|pip install --user}} can be used to install packages into the [https://pip.pypa.io/en/latest/user_guide/#user-installs user scheme] instead of {{ic|/usr}}. ''pipx'' and Conda integrate environment management into their workflows.<br />
<br />
See the [https://packaging.python.org/ Python Packaging User Guide] for the official best practices for package management.<br />
<br />
Historically, ''easy_install'' (part of {{Pkg|python-setuptools}}) was used to install packages distributed as [https://packaging.python.org/glossary/#term-egg Eggs]. ''easy_install'' and Eggs have been replaced with ''pip'' and [https://packaging.python.org/glossary/#term-wheel Wheels]. See [https://packaging.python.org/pip_easy_install/#pip-vs-easy-install pip vs easy_install] and [https://packaging.python.org/discussions/wheel-vs-egg Wheel vs Egg] for more information.<br />
<br />
{{Note|There are also tools integrating ''pip'' with ''pacman'' by automatically generating PKGBUILDs for specified PyPI packages: see [[Creating packages#PKGBUILD generators]].}}<br />
<br />
{{Tip|[https://pipenv.pypa.io pipenv] provides a single CLI for [https://github.com/pypa/pipfile Pipfile], ''pip'' and [[virtualenv]]. It is available as {{Pkg|python-pipenv}}.}}<br />
<br />
== Widget bindings ==<br />
<br />
The following [[Wikipedia:Widget toolkit|widget toolkit]] bindings are available:<br />
<br />
* {{App|Tkinter|The standard Python interface to the [https://www.tcl.tk/ Tk] GUI toolkit.|https://docs.python.org/3/library/tkinter.html|{{Pkg|python}}}}<br />
* {{App|Qt for Python (PySide2)|The official Python bindings for [[Qt]]5.|https://www.qt.io/qt-for-python|{{Pkg|pyside2}}, {{Pkg|pyside2-tools}}}}<br />
* {{App|Qt for Python (PySide6)|The official Python bindings for [[Qt]]6.|https://www.qt.io/qt-for-python|{{Pkg|pyside6}}, {{AUR|pyside6-tools}}}}<br />
* {{App|pyQt|A set of Python bindings for Qt.|https://riverbankcomputing.com/software/pyqt/intro|{{Pkg|python-pyqt5}}}}<br />
* {{App|PyGObject|Python bindings for GObject based libraries such as [[GTK]], [[GStreamer]], WebKitGTK, GLib, and GIO.|https://pygobject.readthedocs.io/|{{Pkg|python-gobject}}}}<br />
* {{App|wxPython|A cross-platform GUI toolkit for Python which wraps [https://www.wxwidgets.org/ wxWidgets].|https://wxpython.org/|{{Pkg|python-wxpython}}}}<br />
<br />
To use these with Python, you may also need to install the associated widget toolkit packages (e.g. {{Pkg|tk}} must also be installed to use Tkinter).<br />
<br />
== Tips and tricks ==<br />
<br />
=== Virtual environment ===<br />
<br />
Python provides tools to create isolated ''virtual environments'' into which packages may be installed without conflicting with other virtual environments or the system packages. Virtual environments can also run applications with different versions of Python on the same system.<br />
<br />
See [[Python/Virtual environment]] for details.<br />
<br />
=== Tab completion in Python shell ===<br />
<br />
[https://docs.python.org/3/tutorial/interactive.html Tab completion] is available in the interactive shell by default. Note that the readline completer will only complete names in the global namespace. You can use {{Pkg|python-jedi}} for a richer tab completion experience [https://jedi.readthedocs.io/en/latest/docs/usage.html#tab-completion-in-the-python-shell].<br />
<br />
== See also ==<br />
<br />
<br />
=== Official ===<br />
<br />
* [https://docs.python.org/ Official Python documentation]<br />
* [https://docs.python.org/3/tutorial/index.html Official Python tutorial]<br />
<br />
=== Third-Party ===<br />
<br />
* [https://automatetheboringstuff.com/ Automate the Boring Stuff with Python] - Creative Commons book<br />
* [https://github.com/vinta/awesome-python Awesome Python] - A curated list of Python resources<br />
* [https://python.swaroopch.com/ A Byte of Python] - Creative Commons book<br />
* [http://inventwithpython.com/cracking/ Cracking Codes With Python] - Free online book<br />
* [https://stephensugden.com/crash_into_python/ Crash into Python] - Free tutorial<br />
* [https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/ Debugging in Python] - Guide to using {{ic|pdb}}, the Python debugger<br />
* [https://diveintopython3.net/ Dive Into Python] - Creative Commons book<br />
* [https://www.oreilly.com/library/view/fluent-python-2nd/9781492056348/ Fluent Python] - Commercial book<br />
* [https://www.oreilly.com/library/view/introducing-python-2nd/9781492051374/ Introducing Python] - Commercial book<br />
* [http://inventwithpython.com/invent4thed/ Invent Your Own Computer Games with Python] - Free online book<br />
* [https://learnpython.org/ Learn Python] - Free interactive tutorial<br />
* [https://learnpythonthehardway.org/ Learn Python the Hard Way] - Commercial book<br />
* [https://pythonspot.com Pythonspot Python Tutorials] - Free online tutorials<br />
* [https://greenteapress.com/wp/think-python-2e// Think Python] - Creative Commons book</div>Fincehttps://wiki.archlinux.org/index.php?title=AUR_helpers_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727804AUR helpers (简体中文)2022-04-28T08:56:20Z<p>Fince: little improve</p>
<hr />
<div>[[Category:Package management (简体中文)]]<br />
[[Category:Software comparisons (简体中文)]]<br />
[[de:AUR Hilfsprogramme]]<br />
[[en:AUR helpers]]<br />
[[es:AUR helpers]]<br />
[[fr:AUR helpers]]<br />
[[ja:AUR ヘルパー]]<br />
[[pt:AUR helpers]]<br />
[[ru:AUR helpers]]<br />
{{Bad translation (简体中文)|Many dead links, outdated columns, TranslationStatus is erroneous : the page still refers to yaourt which was [[Special:Diff/572291|removed in 2019 in the english page]].}}<br />
{{TranslationStatus (简体中文)|AUR helpers|2021-03-26|653649}}<br />
{{警告|<br />
1=这些工具都不受官方支持。用户应熟悉[[Arch User Repository (简体中文)#安装软件包|手动构建流程]],以便排查问题。}}<br />
{{注意|请使用讨论页对修改此文章提出建议:[[Talk:AUR helpers_(简体中文)|Talk:AUR helpers]]}}<br />
<br />
在使用[[Arch User Repository (简体中文)|Arch用户软件仓库]]时,AUR工具可以自动完成以下任务:<br />
* 搜索在AUR中发布的软件包<br />
* 解析AUR软件包之间的依赖关系<br />
* 下载AUR软件包<br />
* 下载网站内容,例如用户评论<br />
* 提交AUR软件包<br />
<br />
[[pacman (简体中文)|pacman]]只会处理其仓库中预先构建好的软件包的更新。AUR软件包以[[PKGBUILD (简体中文)|PKGBUILD]]的形式再分发并需要AUR helper来自动化构建流程。然而请注意,即使软件包自身并没有更新,但由于某些库文件的更新,您可能仍需重新构建某些软件包、<br />
<br />
不会为AUR软件包检查更新,所以一些工具也可以自动从AUR检查更新并再次构建新版本的软件包。请注意,即使软件包自身并没有更新,但由于某些库文件的更新,您可能仍需重新构建某些软件包、<br />
<br />
== 词汇表 ==<br />
<br />
[[#对比表]]中这些列的含义:<br />
;文件检查: ''默认''不{{ic|[[Help:Reading (简体中文)#Source|source]]}} [[PKGBUILD (简体中文)|PKGBUILD]],或者在{{ic|source}}之前让用户有机会手动检查PKGBUILD。已知某些工具在用户可以检查PKGBUILD之前就执行了{{ic|source}},'''这会允许执行PKGBUILD中的恶意代码'''。<br />
;差异比较: 有检查包差异的能力。除了PKGBUILD,还包括对{{ic|.install}}或{{ic|.patch}}文件更改的检查。<br />
;Git clone: 默认使用{{man|1|git-clone}}从AUR获取相关文件。<br />
;可靠的语法分析器: 有能力通过使用所提供的元数据(PRC/.SRCINFO)代替解析PKGBUILD以处理复杂包,例如{{AUR|aws-cli-git}}。<br />
;可靠的求解器: 有能力正确处理复杂的依赖关系,例如{{AUR|ros-lunar-desktop}}{{Broken package link (简体中文)|package not found}}。<br />
;包拆分: 有能力正确地构建和安装:<br />
:* 对于有相同包基础的多个软件包,不重复构建和安装包基础,例如{{AUR|clion}}。<br />
:* 拆分依赖相同包基础的包(Split packages which depend on a package from the same package base), 例如{{Pkg|libc++}} and {{Pkg|libc++abi}}。<br />
:* 独立地拆分包,例如{{AUR|python-pyalsaaudio}}和{{AUR|python2-pyalsaaudio}}。<br />
;Shell补全: [[w:Command-line_completion|Tab completion]]在列出的[[shell]]中可用<br />
<br />
{{提示|<br />
* '''可选'''意味着功能可用,但需要通过命令行选项或配置文件启用。<br />
* '''部分'''意味着功能尚未完全实现,或者与标准有一些差别。<br />
}}<br />
<br />
== 对比表 ==<br />
<br />
=== 搜索和下载 ===<br />
<br />
{| class="wikitable sortable" width="100%" style="text-align: center;"<br />
! 名称 !! 语言 !! Git clone !! 可靠的语法分析器 !! 可靠的求解器 !! 命令补全 !! 特性<br />
|-<br />
! {{AUR|auracle-git}}<br />
| C++ || {{是|https://github.com/falconindy/auracle/commit/c73bbee}} || {{是}} || {{是}} || bash || {{L|显示构建顺序}}<br />
|-<br />
! {{AUR|pbget}}<br />
| Python || {{是}} || {{是}} || {{-}} || {{-}} || {{-}}<br />
|-<br />
! {{AUR|repoctl}}<br />
| Go || {{否}} || {{是|https://github.com/goulash/pacman/blob/master/aur/aur.go}} || {{-}} || zsh || {{L|支持[[pacman/Tips and tricks (简体中文)#自建本地仓库|本地仓库]]}}<br />
|-<br />
! {{AUR|yaah}}<br />
| Bash || {{Y|可选}} || {{是}} || {{-}} || bash || {{-}}<br />
|-<br />
|}<br />
<br />
=== 搜索和构建 ===<br />
<br />
{| class="wikitable sortable" width="100%" style="text-align: center;"<br />
! 名称 !! 语言 !! 文件检查 !! 差异比较 !! Git clone !! 可靠的语法分析器 !! 可靠的求解器 !! 包拆分 !! 命令补全 !! 特性<br />
|-<br />
! {{AUR|aurutils}}<br />
| Bash || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || bash, zsh || {{L|[[vifm]], [[pacman/Tips and tricks (简体中文)#自建本地仓库|本地仓库]], 本地补丁应用. [[pacman (简体中文)/Package signing (简体中文)|Package signing]], [[DeveloperWiki:Building_in_a_clean_chroot|clean chroot]], 按票数或受欢迎度排序}}<br />
|-<br />
! {{AUR|bauerbill}}<br />
| Python || {{是}} || {{否}} || {{是}} || {{是}} || {{是}} || {{是}} || bash, zsh || {{L|[[Arch Build System (简体中文)|ABS]]支持, 使用{{ic|bb-wrapper}}封装''pacman'', trust管理, Powerpill扩展}}<br />
|-<br />
! {{AUR|PKGBUILDer}}<br />
| Python || {{否}}|| {{否|https://github.com/Kwpolska/pkgbuilder/issues/36}} || {{是}} || {{是}} || {{是}} || {{Y|部分}} || {{-}} || {{L|使用{{ic|pb}}封装''pacman'', 默认自动构建, 使用{{ic|-F以禁用}}, 多语言}}<br />
|-<br />
! {{AUR|rua}}<br />
| Rust || {{是}} || {{是|https://github.com/vn971/rua/commit/0459a8b}} || {{是}} || {{是}} || {{是}} || {{是}} || bash, zsh || {{L|本地补丁应用, [[Bubblewrap]], {{ic|.pkg.tar}}检查}}<br />
|-<br />
|}<br />
<br />
=== Pacman封装 ===<br />
<br />
{{警告|{{man|8|pacman}}封装抽象了包管理器的工作,它们可能(默认可选地)引入[[System_maintenance_(简体中文)#避免某些_Pacman_命令|不安全的参数]]或其它异常行为导致系统崩坏。}}<br />
<br />
{{注意|这些pacman封装支持批量(而不是按需)操作:{{AUR|pacaur}}, {{AUR|pikaur}}, {{AUR|yay}}, {{AUR|aura}}, {{AUR|paru}}<br />
}}<br />
<br />
{| class="wikitable sortable" width="100%" style="text-align: center;"<br />
! 名称 !! 语言 !! 文件检查 !! 差异比较 !! Git clone !! 可靠的语法分析器 !! 可靠的求解器 !! 包拆分 !! 不安全的参数 || 命令补全 !! 特性<br />
|-<br />
! {{AUR|aura}}<br />
| Haskell || {{否}} || {{Y|[https://github.com/aurapm/aura/blob/89bf702/aura/src/Aura/Pkgbuild/Records.hs 部分]}} || {{是|https://github.com/fosskers/aura/commit/ca9c38d}} || {{是|https://github.com/aurapm/aura/commit/7848e98}} || {{是|https://github.com/fosskers/aura/pull/479}} || {{是|https://github.com/fosskers/aura/pull/479}} || {{-}} || bash, fish, zsh || {{L|默认自动构建,使用{{ic|--dryrun}} 以禁用,[[downgrade|降级]]支持,多语言}}<br />
|-<br />
! {{AUR|paru}}<br />
| Rust || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || -Sy<br>--ask || bash, fish, zsh || {{L|导入PGP密钥}}<br />
|-<br />
! {{AUR|pikaur}}<br />
| Python || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || [https://github.com/actionless/pikaur#pikaur -Sy] || bash, fish, zsh || {{L|[http://0pointer.net/blog/dynamic-users-with-systemd.html 动态用户],[https://github.com/actionless/pikaur/tree/master/locale 多语言],按票数或受欢迎度排序,显示新闻,[https://github.com/actionless/pikaur/commit/3688d828591d307c6864c3b5ad8c1f581396b865 忽略错误]}}<br />
|-<br />
! {{AUR|trizen}}<br />
| Perl || {{是}} || {{是}} || {{是|https://github.com/trizen/trizen/commit/6fb0cc9}} || {{是|https://github.com/trizen/trizen/commit/7ab7ee5f}} || {{是}} || {{Y|[https://github.com/trizen/trizen/issues/46 部分]}} || {{-}} || bash,zsh,fish || {{L|默认自动构建,使用{{ic|-G}}以禁用,AUR评论}}<br />
|-<br />
! {{AUR|yay}}<br />
| Go || {{是}} || {{是|https://github.com/Jguer/yay/pull/447}} || {{是|https://github.com/Jguer/yay/pull/297}} || {{是}} || {{是|https://github.com/Jguer/yay/pull/866}} || {{是}} || [https://github.com/Jguer/yay/commit/3bdb534 -Sy]<br>[https://github.com/Jguer/yay/commit/ea5a94e --ask] || bash,fish,zsh || {{L|按票数排序,导入PGP密钥,[https://github.com/Jguer/yay/commit/4bcd3a6297052714e91e3f886602ce5c12d15786 架构提示]}}<br />
|-<br />
! {{AUR|pakku}}<br />
| Nim || {{是}} || {{是|https://github.com/kitsunyan/pakku/commit/396e9f4}} || {{是}} || {{是}} || {{是}} || {{是}} || [https://github.com/kitsunyan/pakku/wiki/Native-Pacman-Explanation -Sy] || bash,zsh || {{L|[[Arch Build System (简体中文)|ABS]]支持,AUR评论,导入PGP密钥}}<br />
|}<br />
<br />
=== 开发停止或有问题 ===<br />
<br />
此表中的是已经停止开发的,或是在过去6个月内有未处理的'''文件检查''','''Clean build'''或是'''原生pacman'''的问题的项目。<br />
<br />
{| class="wikitable sortable" width="100%" style="text-align: center;"<br />
! 名称 !! 语言 !! 原生pacman !! 文件检查 !! Clean build !! 可靠的语法分析器 !! 可靠的求解器 !! 拆分包 !! Git clone !! 差异比较 !! 批量处理 || 命令补全 !! 特性<br />
|-<br />
! {{AUR|aurel}}{{Broken package link (简体中文)|package not found}} [https://bbs.archlinux.org/viewtopic.php?pid=1522459#p1522459]<br />
| Emacs Lisp || {{-}} || {{是}} || {{-}} || {{-}} || {{-}} || {{-}} || {{否}} || {{-}} || {{-}} || {{-}} || {{L|Emacs插件,不自动构建}}<br />
|-<br />
! {{AUR|pacaur}} [https://bbs.archlinux.org/viewtopic.php?pid=1755144#p1755144]<br />
| Bash/C || {{R|[https://github.com/rmarquis/pacaur/commit/d8f49188452785fb28afc017baadd01d9e24ba21 使用] {{ic|-Ud}}}} || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || {{是}} || 1,3 || bash,zsh || {{L|多语言, 按票数或受欢迎度排序}}<br />
|-<br />
! {{AUR|wrapaur}}{{Broken package link (简体中文)|package not found}}<br />
| Bash || 是 || {{是}} || {{是}} || {{否}} || {{否}} || {{否}} || {{是}} || {{否}} || {{-}} || {{-}} || {{L|更新镜像列表显示新闻和AUR评论}}<br />
|-<br />
! {{AUR|spinach}}{{Broken package link (简体中文)|package not found}} [https://github.com/floft/spinach]<br />
| Bash || {{-}} || {{G|[https://github.com/floft/spinach/commit/545574700812eb369b9537370f085ec9e5c3f01a 是]}} || {{是}} || {{否}} || {{否}} || {{否}} || {{否}} || {{否}} || {{-}} || {{-}} || {{-}}<br />
|-<br />
! {{AUR|burgaur}}{{Broken package link (简体中文)|package not found}} [https://github.com/m45t3r/burgaur/issues/7#issuecomment-365599675]<br />
| Python/C || {{-}} || {{Y|可选}} || {{是}} || {{否}} || {{否}} || {{否}} || {{否}} || {{否}} || {{-}} || {{-}} || {{L|cower的包装}}<br />
|-<br />
! {{AUR|packer-aur-git}}{{Broken package link (简体中文)|package not found}}<br />
| Bash || 是 || {{否}} || {{是}} || {{否}} || {{否}} || {{否}} || {{否}} || {{否}} || {{-}} || {{-}} || {{-}}<br />
|-<br />
! {{AUR|yaourt}}{{Broken package link (简体中文)|package not found}}<br />
| Bash/C || {{Y|拆分 {{ic|-Syu}}}} || {{否}} [https://github.com/archlinuxfr/yaourt/blob/f373121d23d87031a24135fee593115832d803ec/src/lib/aur.sh#L47] [https://github.com/archlinuxfr/yaourt/blob/d9790e29cd7194535c793f51d185b7130a396916/src/lib/pkgbuild.sh.in#L415-L438] || {{R|[https://lists.archlinux.org/pipermail/aur-general/2015-August/031314.html 否]}} || {{否}} || {{R|[https://github.com/archlinuxfr/yaourt/issues/186 否]}} || {{R|[https://github.com/archlinuxfr/yaourt/issues/85 否]}} || {{Y|可选}} || {{Y|可选}} || 2 || bash,zsh,fish || {{L|备份 ([https://github.com/archlinuxfr/yaourt/blob/5a82dfe/src/lib/alpm_backup.sh#L38 更改pacman数据库!]),ABS支持,显示AUR评论,多语言}}<br />
|-<br />
! {{AUR|aurman}}[https://github.com/polygamma/aurman#stopped-development-for-public-use]<br />
| Python || 是 || {{是}} || {{是}} || {{是}} || {{G|[https://github.com/polygamma/aurman/wiki/Description-of-the-aurman-dependency-solving 是]}} || {{是}} || {{是}} || {{是}} || 1,[https://github.com/polygamma/aurman#question-6 2*,3*] || bash,fish || {{L|导入PGP密钥,按票数或欢迎度排序,显示新闻}}<br />
|-<br />
! {{AUR|naaman}}{{Broken package link (简体中文)|package not found}}<br />
| Python || {{-}} || {{Y|可选}} || {{是}} || {{是}} || {{Y|[https://web.archive.org/web/20200911035652/https://github.com/enckse/naaman/issues/19 部分]}} || {{Y|[https://web.archive.org/web/20200911035653/https://github.com/enckse/naaman/issues/20 部分]}} || {{是}} || {{否}} || 1* || bash || {{L|默认自动构建,使用{{ic|--fetch}}以禁用,使用{{ic|-d}}启用求解器}}<br />
|-<br />
! {{AUR|repofish}}{{Broken package link (简体中文)|package not found}}<br />
| Bash || {{-}} || {{Y|可选}} || {{是}} || {{否}} || {{否}} || {{否}} || {{是}} || {{是}} || 1* || {{-}} || {{L|默认自动构建,使用{{ic|check}}或{{ic|update}}以禁用,[[local repository|本地仓库]]支持}}<br />
|-<br />
! {{AUR|aurget}}[https://github.com/pbrisbin/aurget/issues/66]<br />
| Bash || {{-}} || {{Y|可选}} || {{是}} || {{否}} || {{否}} || {{R|[https://github.com/pbrisbin/aurget/issues/40 否]}} || {{否}} || {{R|[https://github.com/pbrisbin/aurget/issues/41 否]}} || {{-}} || bash,zsh || {{L|按票数排序}}<br />
|}<br />
<br />
== 图形化工具 ==<br />
<br />
{{警告|<br />
* 图形化的AUR工具通常针对于[[Arch-based distributions|基于Arch的发行版]]. 在[[Arch Linux]] 中使用它们可能会导致系统故障,例如进行自动的[[partial upgrades|部分升级]]。<br />
* 如果某项工具有'''已知的'''有问题的行为,它将被标记为红色。}}<br />
<br />
{| class="wikitable sortable" style="text-align: center;"<br />
! 名称 !! 语言 !! GUI toolkit !! 后端 !! 注意<br />
|-<br />
! {{AUR|aarchup}}<br />
| C<br />
| GTK+ 2<br />
| auracle<br />
| {{-}}<br />
|-<br />
! {{AUR|argon}}<br />
| Python<br />
| GTK+ 3<br />
| auracle, pacaur<br />
| {{-}}<br />
|-<br />
! {{AUR|cylon}}<br />
| Bash<br />
| TUI<br />
| auracle, trizen<br />
| {{-}}<br />
|-<br />
! {{AUR|kalu}}<br />
| C<br />
| GTK+ 3<br />
| {{-}}<br />
| {{-}}<br />
|-<br />
! {{AUR|pactray}}<br />
| Python<br />
| GTK+3<br />
| auracle<br />
| {{-}}<br />
|-<br />
! {{AUR|pamac-aur}}<br />
| Vala<br />
| GTK+ 3<br />
| {{-}}<br />
| 使用{{man|3|libalpm}}而不是{{man|8|pacman}}<br />
|-<br />
! {{AUR|pakku-gui}}<br />
| Python<br />
| GTK+ 3<br />
| pakku<br />
| {{-}}<br />
|-<br />
! {{AUR|pkgbrowser}}<br />
| Python<br />
| Qt 5<br />
| {{-}}<br />
| {{-}}<br />
|-<br />
! {{AUR|updatehint}}<br />
| Bash<br />
| GTK+ 3<br />
| auracle<br />
| {{-}}<br />
|-<br />
! {{AUR|octopi}}<br />
| C++<br />
| Qt 5<br />
| trizen, pacaur, yaourt<br />
| {{-}}<br />
|-<br />
! {{AUR|yup}}<br />
| Go<br />
| TUI<br />
| {{-}}<br />
| {{-}}<br />
|}<br />
<br />
== 维护 ==<br />
<br />
* {{App|aur-out-of-date|使用hoster的API检查AUR包的上游改动。|https://github.com/simon04/aur-out-of-date|{{AUR|aur-out-of-date}}}}<br />
<br />
* {{App|aurpublish|帮助使用{{man|1|git-subtree}}管理和上传AUR软件包。使用{{man|5|githooks}}验证{{ic|PKGBUILD}}完整性,自动生成{{ic|.SRCINFO}}并创建commit模板|https://github.com/eli-schwartz/aurpublish|{{Pkg|aurpublish}}}}<br />
<br />
* {{App|[[DeveloperWiki:Building in a clean chroot|devtools]]|在干净的环境(通过[[systemd-nspawn]]容器)中构建软件包来确保正确性。由{{AUR|aurutils}}和{{AUR|clean-chroot-manager}}封装。|https://gitlab.archlinux.org/archlinux/devtools|{{Pkg|devtools}}}}<br />
<br />
* {{App|pkgbuild-watch|监视上游网页的更改。|http://kmkeen.com/pkgbuild-watch|{{AUR|pkgbuild-watch}}}}<br />
<br />
* {{App|pkgoutofdate|解析PKGBUILD中的URL,并以发送递增的版本号的方式来检查更新。<br />
|https://github.com/anatol/pkgoutofdate|{{AUR|pkgoutofdate-git}}}}<br />
<br />
== 其它 ==<br />
<br />
* {{App|aur-talk|获取并显示AUR评论。|https://github.com/GermainZ/aur-talk|{{AUR|aur-talk-git}}}}<br />
* {{App|aurvote-utils|一系列管理AUR投票的应用|https://github.com/jadenPete/aurvote-utils|{{AUR|aurvote-utils}}}}<br />
* {{App|haskell-archlinux|用于访问AUR和包元数据的库,使用Haskell语言编写。|https://hackage.haskell.org/package/archlinux|{{AUR|haskell-archlinux}}}}<br />
* {{App|haskell-aur|用于访问[[Aurweb RPC interface]]的Haskell库。|https://hackage.haskell.org/package/aur|{{AUR|haskell-aur}}}}<br />
* {{App|package-query|用于查询{{man|3|libalpm}}和AUR的工具。|https://github.com/archlinuxfr/package-query|{{AUR|package-query}}}}<br />
* {{App|python3-aur|用于访问AUR包的信息并自动完成AUR交互的Python 3模块。|https://xyne.dev/projects/python3-aur|{{AUR|python3-aur}}}}<br />
* {{App|raur|用于访问[[Aurweb RPC interface]]的Rust库。|https://gitlab.com/davidbittner/raur||}}<br />
* [https://github.com/JonnyJD/PKGBUILDs/blob/master/_bin/aur4_import.sh aur4_import.sh] — 从包含多个包的git仓库拆分包,为每个提交添加更新{{ic|.SRCINFO}}。<br />
* [https://github.com/JonnyJD/PKGBUILDs/blob/master/_bin/aur4_make_submodule.sh aur4_make_submodule.sh] — 使用aur4的子模块来替换较大的git仓库的包,包括{{ic|.SRCINFO}}.</div>Fincehttps://wiki.archlinux.org/index.php?title=DaVinci_Resolve_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727625DaVinci Resolve (简体中文)2022-04-26T12:29:49Z<p>Fince: /* 免费版DR的解决方案 */ fix</p>
<hr />
<div>[[Category:Audio (简体中文)]]<br />
[[Category:Video (简体中文)]]<br />
[[en:DaVinci Resolve]]<br />
[[ja:DaVinci Resolve]]<br />
[[pl:DaVinci Resolve]]<br />
{{TranslationStatus (简体中文)|DaVinci Resolve|2022-04-18|726833}}<br />
[https://www.blackmagicdesign.com/products/davinciresolve/ Davinci Resolve](简称为DR)是一款用于视频剪辑、调色和后期处理的专有软件。<br />
<br />
== 安装 ==<br />
<br />
DaVinci Resolve分别提供免费版和付费版(Studio版)。<br /><br />
若要获取免费版本,[[安装]] {{AUR|davinci-resolve}} 或 {{AUR|davinci-resolve-beta}}。<br /><br />
若要获取付费版本,安装 {{AUR|davinci-resolve-studio}} 或 {{AUR|davinci-resolve-studio-beta}}。<br />
<br />
DaVinci Resolve需要合适的OpenGL和OpenCL驱动才能运行。目前暂不支持开源的OpenCL驱动。注意,应当卸载不兼容的OpenCL驱动,以免导致Resolve崩溃(例:如果使用了opencl-nvidia等专有驱动,则应卸载{{Pkg|opencl-mesa}})。<br />
<br />
目前暂不支持Intel GPU。如果使用了AMD+Intel的混合配置,可以使用Intel GPU作为主GPU,并为AMD GPU使用专有的OpenCL驱动。<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|+OpenGL驱动表<br />
|-<br />
! GPU厂商 !! Type !! GPU驱动 !! OpenGL驱动 !! 归档 !! 已测试的驱动版本 !! 是否可用于Davinci Resolve !! 已测试的Davinci Resolve版本 !! 备注<br />
|-<br />
! rowspan="3" | AMD / ATI<br />
| rowspan="2" | 开源 || {{Pkg|xf86-video-amdgpu}} || rowspan="2" | {{Pkg|mesa}} || [[AMDGPU]] || 22.0.0-1 || {{Y|是/否<br>取决于GPU}} || 17.4.5-1 || 已分别测试于Radeon Pro W6600(可用)和RX580(不可用)。见https://gitlab.freedesktop.org/mesa/mesa/-/issues/6256<br />
|-<br />
| {{Pkg|xf86-video-ati}} || [[ATI]] || || 尚未测试 || ||<br />
|-<br />
| 专有 || {{Pkg|xf86-video-amdgpu}} || {{AUR|amdgpu-pro-libgl}} || [[AMDGPU PRO]] || 21.10_1247438-1 || {{Yes (简体中文)}} || 17.1.1 || 需要用{{ic|progl}}脚本运行Resolve。使用方法见[[AMDGPU_PRO#Workaround_for_using_proprietary_OpenGL|文档]]和[https://github.com/Ashark/archlinux-amdgpu-pro 驱动github页面]。<br />
|-<br />
! Intel<br />
| 开源 || {{Pkg|xf86-video-intel}} || {{Pkg|mesa}} || [[Intel graphics]] || || {{Yes (简体中文)}} || ||<br />
|-<br />
! rowspan="2" | NVIDIA<br />
| 开源 || {{Pkg|xf86-video-nouveau}} || {{Pkg|mesa}} || [[Nouveau]] || || {{No (简体中文)}} || ||<br />
|-<br />
| 专有 || {{Pkg|nvidia}} || {{Pkg|nvidia-utils}} || [[NVIDIA]] || 460.32.03-1 || {{Yes (简体中文)}} || 17.0b6-1 || 已测试于使用nvidia-xrun的Optimus技术笔记本。<br />
|-<br />
|}<br />
<br />
{| class="wikitable" style="text-align:center"<br />
|+[[OpenCL]]驱动表<br />
! GPU厂商 !! OpenCL驱动 !! 已测试的驱动版本 !! 是否可用于Davinci Resolve !! 已测试的Davinci Resolve版本 !! 备注<br />
|-<br />
!通用(Neutral)<br />
|{{Pkg|opencl-mesa}} || 22.0.0-1 || {{Y|部分可用,可视为不可用}} || 17.4.5-1 || 使用效果与intel-compute-runtime相同:可以正常启动并打开项目,但是在Cut和Edit页面中无法播放时间线(即使没有视频轨道),Fairlight页面则可以播放。<br>Davinci Resolve需要OpenCL 1.2才能使用。Mesa [https://www.phoronix.com/scan.php?page=news_item&px=Mesa-20.3-OpenCL-1.2-Clover 支持OpenCL 1.2], 尽管[https://gitlab.freedesktop.org/mesa/mesa/-/issues/4452 会报告为OpenCL 1.1]. [https://www.phoronix.com/forums/forum/linux-graphics-x-org-drivers/opengl-vulkan-mesa-gallium3d/1211540-opencl-1-2-support-merged-for-mesa-s-gallium3d-clover-while-opencl-3-0-is-being-tackled?p=1211802#post1211802 Overriding] 带有以下参数的OpenCL版本 {{ic|1=CLOVER_PLATFORM_VERSION_OVERRIDE=1.2 CLOVER_DEVICE_VERSION_OVERRIDE=1.2 CLOVER_DEVICE_CLC_VERSION_OVERRIDE=1.2}} 不会改变这一情况。<br>已测试于RX580.<br />
|-<br />
!AMD<br />
| {{AUR|opencl-amd}} || 21.40.2.1350682-3 || {{Yes (简体中文)}} || 17.4.3 || 已测试于Radeon Pro W6600<br />
|-<br />
!rowspan="4"|Intel<br />
|{{Pkg|intel-compute-runtime}} || 21.21.19914-1 || {{Y|部分可用,可视为不可用}} || 17.2.1 || 可以正常启动并打开项目,但是在Cut和Edit页面中无法播放时间线(即使没有视频轨道),Fairlight页面则可以播放。<br>已测试于Intel酷睿i7-8700 CPU.<br />
|-<br />
|{{AUR|beignet}} || 1.3.2+12+gfc5f430c-2 || {{No (简体中文)}} || || Core dumped<br />
|-<br />
|{{AUR|intel-opencl}} || 5.0.r63503-2 || {{No (简体中文)}} || || Core dumped<br />
|-<br />
|{{AUR|intel-opencl-runtime}} || 1:18.1.0.013-2 || {{No (简体中文)}} || || Core dumped<br />
|-<br />
!Nvidia<br />
|{{Pkg|opencl-nvidia}} || 460.32.03-1 || {{Yes (简体中文)}} || || Suitable, but working on cuda instead?<br />
|}<br />
<br />
{{注意|{{AUR|davinci-resolve}}的下载链接可能无法使用,请前往 https://www.blackmagicdesign.com/support/download/8f1bf6e1fc9641718a32d2ba1e2cf161/Linux 下载安装包后放置在 .cache/yay/davinci-resolve 后再尝试使用 AUR 安装。}}<br />
<br />
=== DaVinci Resolve检查器 ===<br />
<br />
可以通过运行 [https://github.com/Ashark/davinci-resolve-checker davinci-resolve-checker] 脚本以确认自己的配置是否能够正常运行Davinci Resolve。如果配置良好,它将会输出以下内容:<br />
All seems good. You should be able to run DaVinci Resolve successfully.<br />
<br />
=== BlackMagic采集卡 ===<br />
<br />
如果使用DeckLink、UltraStudio或Intensity卡进行视频采集和播放,请使用{{AUR|decklink}}包安装Blackmagic Desktop Video Software。<br />
<br />
== 提示与技巧 ==<br />
<br />
=== 减少安装时间 ===<br />
<br />
因为二进制文件很大,压缩Davinci Resolve软件包需要大量时间。这样安装Davinci Resolve可以避免压缩和解压(假设使用yay)。<br />
<br />
$ PKGEXT='.pkg.tar' yay -S davinci-resolve<br />
更多信息见[[Makepkg#Use other compression algorithms]]。<br />
<br />
=== 使用便携版软件 ===<br />
<br />
如果因为软件包太大、需要切换多个版本等原因不想在系统中安装Davinci Resolve,可以把需要版本的安装包解压到想要解压的目录,然后直接在目录里运行opt/resolve/bin/resolve。<br />
<br />
=== 使用自动化脚本 ===<br />
<br />
Davinci Resolve支持脚本。免费版只支持从软件内部启动脚本,而Studio版本可以从外部调用脚本。在 首选项->系统->常规->使用外部脚本 中可以选择三个选项:无(只能从软件内部调用)、本地(允许从本地主机调用)和网络(允许从远程主机调用)。<br />
<br />
可以在 帮助 -> 文档 -> 开发者 中找到相关文档。<br />
<br />
=== 重新映射键盘和鼠标滚轮以滚动和缩放 ===<br />
<br />
软件本身滚动和缩放的快捷键很奇怪:<br />
* Shift + 滚轮 = 调整轨道高度<br />
* Ctrl + 滚轮 = 滚动时间线<br />
* Alt + 滚轮 = 缩放时间线<br />
* 滚轮 = 垂直滚动<br />
<br />
在软件中无法重新映射这些快捷键,见[https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=74515]。若要解决此问题,可以使用[[IMWheel]]工具。它能只为正则表达式中的程序重新映射快捷键。<br />
<br />
使用以下配置:<br />
<br />
{{hc|head=~/.imwheelrc|output=<br />
"^resolve"<br />
<br />
# just wheel for scroll<br />
None, Up, Control_L{{!}}Button4<br />
None, Down, Control_L{{!}}Button5<br />
<br />
# crtl wheel for zoom<br />
Control_L, Up, Alt_L{{!}}Button4<br />
Control_L, Down, Alt_L{{!}}Button5<br />
<br />
# alt wheel for track height<br />
Alt_L, Up, Shift_L{{!}}Button4<br />
Alt_L, Down, Shift_L{{!}}Button5<br />
}}<br />
<br />
或使用以下配置:<br />
<br />
{{hc|head=~/.imwheelrc|output=<br />
"^resolve"<br />
<br />
# just wheel for zoom<br />
None, Up, Alt_L{{!}}Button4<br />
None, Down, Alt_L{{!}}Button5<br />
<br />
# shift wheel for scroll<br />
Shift_L, Up, Control_L{{!}}Button4<br />
Shift_L, Down, Control_L{{!}}Button5<br />
}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== 日志存储位置 ===<br />
<br />
DaVinci Resolve每次启动时都会在{{ic|'$HOME/.local/share/DaVinciResolve/logs/ResolveDebug.txt'}}创建日志文件。如果出现问题,可以检查此日志以获取相关信息。<br />
<br />
=== 窗口没有标题栏 ===<br />
<br />
KDE可以用窗口规则强制开启标题栏,见[https://forum.blackmagicdesign.com/viewtopic.php?=21&t=56878&p=456990#p456990]。<br />
<br />
你可以手动创建描述所需窗口规则的文件:<br />
{{hc|1=DaVinci_Resolve_main_window_always_with_titlebar_and_frame.kwinrule|2=<br />
[DaVinci Resolve main window always with titlebar and frame]<br />
Description=DaVinci Resolve main window always with titlebar and frame<br />
clientmachinematch=0<br />
noborder=false<br />
noborderrule=2<br />
titlematch=0<br />
types=1<br />
wmclass=resolve<br />
wmclasscomplete=false<br />
wmclassmatch=1<br />
}}<br />
然后在 ''系统设置 > 窗口管理 > 窗口规则'' 中导入此文件。<br />
<br />
=== 无法使用Mp4格式 ===<br />
<br />
Linux的免费版Davinci Resolve不支持MP4容器和AAC音频流(MP4使用的音频格式),因此MP4视频无法显示预览图,回放时AAC音频也没有声音。<br />
<br />
==== 免费版DR的解决方案 ====<br />
<br />
需要将MP4视频转为其他格式才能使用,转换的命令格式如下:<br />
<br />
ffmpeg -i input.mp4 -c:v dnxhd -profile:v dnxhr_hq -pix_fmt yuv422p -c:a pcm_s16le -f mov output.mov<br />
<br />
可以使用[[incron]]自动转换指定文件夹里出现的文件,见[https://passthroughpo.st/painless-linux-video-production-part-3-organization-and-workflow/#:~:text=Auto%2DTranscode%20Your%20Footage 此文章]中的设置案例。也可以编写脚本以实现此效果,更多信息见[[DaVinci Resolve (简体中文)#另见|另见部分]]。<br />
<br />
==== DR Studio的解决方案 ====<br />
<br />
需要将MP4视频的音频导出并转换为MP3(MP3空间占用比WAV小,并且DR支持MP3格式,见下文),然后将音频导入并和视频轨道重新组合在一起才能使用音频。<br />
<br />
可以使用Andrew Shark编写的[https://gitlab.com/AndrewShark/davinci-resolve-scripts/-/blob/main/mp4%20audio%20compounder.py mp4 audio compounder.py]脚本以自动化此操作。<br />
<br />
There is no yet (as of February 2022) a document listing supported codecs for DR 17, but DR 17.1 and DR studio 17.4.3 both supports mp3 files. However, for some reason, integrating mp3 audio to mov file is not playing.<br />
官方目前(2022年2月)还没有发布DR 17的编解码器支持列表,但DR 17.1和DR studio 17.4.3都支持MP3文件,然而某些原因导致MP3在集成到MOV视频后无法播放。<br />
<br />
=== 高分辨率支持 ===<br />
<br />
为了兼容高分辨率显示器,请设置以下环境变量:<br />
<br />
export QT_DEVICE_PIXEL_RATIO=2<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=true<br />
<br />
来源:https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=84614&p=469009&hilit=hidpi#wrapper<br />
<br />
=== 关于Wine版本 ===<br />
<br />
因为有些插件能用于Windows而无法用于Linux版DR,而且Linux有MP4格式问题,所以可能有人想用Wine运行DR。但尽管Wine 6.5[https://www.phoronix.com/scan.php?page=news_item&px=Wine-6.5-Released 支持了]DR[https://www.newsshooter.com/2020/11/13/blackmagic-design-davinci-resolve-17-1-released/ 所需]的OpenCL 1.2,还是无法用Wine启动DR。测试结果[https://appdb.winehq.org/objectManager.php?sClass=application&iId=17141 在此]。在DR 17.4.1中,DR无法看到可用的GPU列表(wine 6.21)。<br />
<br />
=== OpenCL版本错误 ===<br />
<br />
If the application simply is not starting, even after showing installer and "tour" successfully your OpenCL Version may not match your NVIDIA driver. <br />
If you have installed nvidia-440xx make sure to install opencl-nvidia-440xx as well.<br />
错误信息可能如下:<br />
{{hc|~/.local/share/DaVinciResolve/logs/LogArchive/ResolveDebug_C1.txt|<br />
...<br />
OpenCL error -1001: 'Unspecified Error', GPUPropertiesUtilUnix.cpp:338<br />
...}}<br />
<br />
=== 再次显示初始界面 ===<br />
<br />
在尝试安装驱动时,可能需要从能检查系统和显卡的初始界面开始,你可以在备份后使用以下命令删除配置文件:<br />
<br />
rm -r $HOME/.local/share/DaVinciResolve/configs<br />
<br />
=== 找不到全屏预览功能 ===<br />
<br />
仅Studio版有此功能,可以在菜单的 ''Workspace > Video Clean Feed'' 中找到。<br />
<br />
=== 视频预览时没有声音 ===<br />
<br />
DaVinci interfaces the ALSA directly, so you need to redirect it to use PulseAudio by creating {{ic|asound.conf}} in {{ic|/etc/}} with the following content:<br />
{{hc|/etc/asound.conf|<br />
pcm.!default pulse<br />
ctl.!default pulse}}<br />
<br />
=== 在intel/nvidia混合显卡上出现Error Code: 999 ===<br />
<br />
"The GPU failed to perform image processing because of an error. Error Code: 999."<br />
<br />
If nvidia gpu is used in on-demand mode, you have to explicitly demand it. To enable set the following environment variables:<br />
<br />
export __NV_PRIME_RENDER_OFFLOAD=1<br />
export __GLX_VENDOR_LIBRARY_NAME=nvidia<br />
<br />
=== 与libcrypto.so.1.0.0有关的静默崩溃 ===<br />
<br />
可能出现的崩溃信息:<br />
{{hc|~/.local/share/DaVinciResolve/logs/ResolveDebug.txt|<nowiki><br />
...<br />
<br />
==========[CRASH DUMP]==========<br />
<br />
Please send this to support:<br />
<br />
#TIME Sat Jan 23 19:42:20 2021 - Uptime 00:00:08 (hh:mm:ss)<br />
#PROGRAM_NAME DaVinci Resolve v16.2.8.005 (Linux/Clang)<br />
<br />
/opt/resolve/bin/resolve() [0x550e0a9]<br />
/opt/resolve/bin/resolve() [0x550d89a]<br />
/usr/lib/libpthread.so.0(+0x140f0) [0x7f80d90640f0]<br />
/usr/lib/libc.so.6(+0x15df7e) [0x7f80d6af5f7e]<br />
/opt/resolve/bin/../libs/libcrypto.so.1.0.0(lh_insert+0xad) [0x7f80d8aa2e4d]<br />
/opt/resolve/bin/../libs/libcrypto.so.1.0.0(OBJ_NAME_add+0x65) [0x7f80d89f1855]<br />
...<br />
</nowiki>}}<br />
<br />
将{{ic|/opt/resolve/libs/libcrypto.so.1.0.0}}替换为{{ic|/usr/lib/libcrypto.so.1.0.0}}:<br />
<br />
# cp /usr/lib/libcrypto.so.1.0.0 /opt/resolve/libs/libcrypto.so.1.0.0<br />
<br />
=== Missing Workflow Integrations menu ===<br />
<br />
In DR Studio for Windows and Mac OS there is Workspace -> Workflow Integrations menu. Workflow Integration plugins are written in JavaScript (electron applications). As noted in documentation (you can reach it in Help -> Documentation -> Developer), Linux currently is not supported (checked in 17.4.3). They say Integration Scripts are supported in Linux, this is most probably a mistake, because they did not provided a path where to put them and still the menu is missing (it is that same Workspace -> Workflow Integrations).<br />
<br />
=== Python 3.6 not found ===<br />
<br />
前往 Workspace -> Console -> Py3 ,可能会弹出错误窗口 "Python 3.6 not found"。<br />
<br />
以下提供一种解决方案(来自[https://video.stackexchange.com/questions/32458/davinci-resolve-python-3-6-not-found 此问题]):<br />
<br />
env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.11<br />
sudo ln -s $HOME/.pyenv/versions/3.6.11/lib/python3.6 /usr/local/lib/python3.6<br />
sudo ln -s $HOME/.pyenv/versions/3.6.11/lib/libpython3.so /usr/local/lib/libpython3.6.so<br />
<br />
=== Error while loading shared libraries: libcrypt.so.1 ===<br />
<br />
安装[https://archlinux.org/packages/core/x86_64/libxcrypt-compat/ libxcrypt-compat]以解决此问题。<br />
<br />
=== 杀死挂起进程 ===<br />
<br />
If dr hanged, fails to release a terminal when you press ctrl + c (to send sigint), and when its window is not shown and you cannot open dr again (it is saying another instance is already running), you can still fix it. 打开任务管理器(KDE的快捷键是ctrl + esc), 然后搜索名为"GUI"的进程, 然后杀死它 (发送信号9)。现在可以正常打开DR了。<br />
<br />
<br />
== 另见 ==<br />
<br />
* 已通过测试的配置见Davinci Resolve论坛的[https://forum.blackmagicdesign.com/viewtopic.php?f=21&t=56878&p=456990#p456924 这条帖子]。 <br />
* Davinci Resolve 16编解码器的[https://documents.blackmagicdesign.com/SupportNotes/DaVinci_Resolve_16_Supported_Codec_List.pdf 支持列表PDF]。<br />
* [https://www.blackmagicdesign.com/support/family/davinci-resolve-and-fusion Here] you can check if BMD released a document for a newer version, see in the Latest Support Notes column. Also, it lists the whats new notes for each release.<br />
* [https://resolvedevdoc.readthedocs.io/en/latest/ ResolveDevDoc] - 关于脚本的非官方文档。Formatted with readthedocs and is prettier to read and search than in original txt file.</div>Fincehttps://wiki.archlinux.org/index.php?title=Davinci&diff=727624Davinci2022-04-26T12:27:54Z<p>Fince: add redirect page</p>
<hr />
<div>#REDIRECT [[DaVinci Resolve]]</div>Fincehttps://wiki.archlinux.org/index.php?title=Steam/Game-specific_troubleshooting&diff=727623Steam/Game-specific troubleshooting2022-04-26T12:17:36Z<p>Fince: /* Dirt Rally */ add a solution</p>
<hr />
<div>[[Category:Gaming]]<br />
[[ja:Steam/ゲーム別のトラブルシューティング]]<br />
== Introduction ==<br />
<br />
See [[Steam/Troubleshooting]] first.<br />
<br />
This page assumes familiarity with the [[Steam#Directory structure]], [[Steam#Launch options]], [[environment variables]], the [[Steam runtime]] and [[Steam/Troubleshooting#Debugging shared libraries|shared libraries]]. The {{ic|''GAME''}} pseudo-variable is used to refer to a game's directory. When the text reads "''run the game with {{ic|1=FOO=bar}}''" it is implied that you either update your launch options or run the game from the command-line with the environment variable.<br />
<br />
== Contributing ==<br />
<br />
* Use "game directory" or the {{ic|''GAME''}} pseudo-variable to refer to a game's directory.<br />
* Link bug reports and sources of workarounds.<br />
<br />
== Other sources ==<br />
<br />
The following links offer even more fixes and tweaks for various games which would otherwise exceed this article's purpose:<br />
<br />
* [https://pcgamingwiki.com/wiki/Home PC Gaming Wiki]<br />
<br />
For games running with Proton, you can check the ProtonDB which lists a lot of useful user reports for specific games. You can filter searched reports by Linux distribution and by hardware. Users also describe if they had to apply tweaks.<br />
<br />
* [https://www.protondb.com/ ProtonDB]<br />
<br />
== Common steps ==<br />
<br />
=== OpenSSL 1.0 setup ===<br />
<br />
Some Steam games are built against OpenSSL 1.0. ({{bug|53618}})<br />
<br />
Install {{Pkg|lib32-openssl-1.0}} and run the game with {{ic|1=LD_LIBRARY_PATH=/usr/lib/openssl-1.0}}.<br />
<br />
=== Steam Link ===<br />
<br />
Currently Steam Link does not work with Wayland. You will only see a blank screen or even flickering when connecting to a Steam host running on Wayland. So you have to disable Wayland in /etc/gdm/custom.conf:<br />
<br />
WaylandEnable=false<br />
<br />
And reboot before trying again.<br />
<br />
=== Squares or invisible symbols, special characters and cyrillic letters in Source-based games ===<br />
<br />
Any special character may produce a square or an empty space mark in the game, main menu and game console. In practice, any characters other than latin ones are not working. The problem is that {{ic|Bitstream Vera Sans}} is configured as the system primary default font for latin sans-serif fonts.<br />
<br />
First, make sure that per-user font customization files are enabled, i.e. the following file exist:<br />
<br />
/etc/fonts/conf.d/50-user.conf<br />
<br />
Next, create {{ic|fonts.conf}} file in your fontconfig directory with the following content or if the file already exist, append only the alias section to the file:<br />
<br />
{{hc|~/.config/fontconfig/fonts.conf|2=<br />
<?xml version="1.0"?><br />
<!DOCTYPE fontconfig SYSTEM "fonts.dtd"><br />
<fontconfig><br />
<alias><br />
<family>sans-serif</family><br />
<prefer><br />
<family>DejaVu Sans</family><br />
<family>Verdana</family><br />
<family>Arial</family><br />
<family>Albany AMT</family><br />
<family>Luxi Sans</family><br />
<family>Nimbus Sans L</family><br />
<family>Nimbus Sans</family><br />
<family>Helvetica</family><br />
<family>Lucida Sans Unicode</family><br />
<family>BPG Glaho International</family> <!-- lat,cyr,arab,geor --><br />
<family>Tahoma</family> <!-- lat,cyr,greek,heb,arab,thai --><br />
</prefer><br />
</alias><br />
</fontconfig><br />
}}<br />
<br />
=== PipeWire & FMOD ===<br />
<br />
If you are using PipeWire and do not have any sound in games utilising FMOD as an audio backend then you may require {{pkg|pipewire-alsa}}. Such games include Project Zomboid, Do not Starve, and Unrailed.<br />
<br />
You will see similar to the following in your logs if this affects you.<br />
<br />
[00:00:01]: FMOD Error: An invalid object handle was used.<br />
[00:00:10]: FMOD Error: Can't play event dontstarve/HUD/click_mouseover: An invalid object handle was used.<br />
<br />
== Games ==<br />
<br />
=== 7 Days To Die ===<br />
<br />
If the game crashes on start, add the following to Steam launch options:<br />
<br />
LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 %command% -force-glcore<br />
<br />
If the game does not recognize your screen's resolution, launch the game with '''Game Launcher''' and check the '''Unity screen selector''' option to correct the resolution. This will give you a GUI in which you can select the correct screen when the game is started.<br />
<br />
{{Note|The game tends to crash or disfunction in windowed mode. It may be advisable to run it in full screen mode.}}<br />
<br />
If that does not help try running the game in '''32-bit''' mode by checking the respective option in the Game-engine in the launcher options.<br />
<br />
It will help the game performance if the '''GLCore''' option is checked in launcher options.<br />
<br />
{{Note|The game does not accept {{ic|.dll}} mods if installing mods. Always check if the mod is of {{ic|.dll}} type}}<br />
<br />
=== Alien Isolation ===<br />
<br />
==== Missing libpcre.so.3 and libidn.so.11 ====<br />
<br />
$ ln -s /usr/lib/libpcre.so '''GAME''/lib/x86_64/libpcre.so.3'<br />
$ ln -s /usr/lib/libidn.so '''GAME''/lib/x86_64/libidn.so.11'<br />
<br />
Append {{ic|./lib/x86_64}} to your {{ic|LD_LIBRARY_PATH}}.[https://steamcommunity.com/app/214490/discussions/0/154644705028020291/]<br />
<br />
=== Amnesia: The Dark Descent ===<br />
<br />
Dependencies:<br />
[https://steamcommunity.com/app/221410/discussions/0/864957183198111387/]<br />
<br />
* {{AUR|lib32-freealut}}<br />
* {{pkg|lib32-glu}}<br />
* {{pkg|lib32-libxmu}}<br />
* {{pkg|lib32-sdl_ttf}}<br />
<br />
==== Gamepad not working ====<br />
<br />
The version of libSDL2 shipped with the game seems to be out-of-date and may not support your gamepad yet. Simply remove or rename {{ic|<install_dir>/game/lib64/libSDL2-2.0.so.0}}, the linker will fall back to using the up-to-date version from /usr/lib.<br />
<br />
=== Amnesia: Rebirth ===<br />
<br />
If you encounter a popup with {{ic|Fatal Error: Fmod could not be initialized!!}} on startup which immediately closes the game and you are using {{Pkg|pipewire}}, [[install]] these packages if they are not already: {{Pkg|pulseaudio-alsa}}, {{Pkg|alsa-firmware}}, {{Pkg|lib32-libpulse}} and {{Pkg|lib32-alsa-plugins}}. Reboot and re-open the game.<br />
<br />
=== And Yet It Moves ===<br />
<br />
Dependencies:<br />
<br />
* {{Pkg|lib32-libjpeg6-turbo}}<br />
* {{Pkg|lib32-libpng12}}<br />
* {{Pkg|lib32-libtheora}}<br />
* {{Pkg|lib32-libtiff4}}<br />
<br />
==== Game does not start ====<br />
<br />
When the game refuses to launch and prints one of the following error messages:<br />
<br />
readlink: extra operand ‘Yet’<br>Try 'readlink --help' for more information.<br />
<br />
This script must be run as a user with write priviledges to game directory<br />
<br />
Open {{ic|''GAME''/AndYetItMovesSteam.sh}} and surround {{ic|${BASH_SOURCE[0]} }} in the following line with double quotes.<br />
<br />
ayim_dir="$(dirname "$(readlink -f ${BASH_SOURCE[0]})")"<br />
<br />
=== Anomaly Warzone Earth ===<br />
<br />
==== Leave fullscreen ====<br />
<br />
There are no in-game settings for this, but fullscreen can be toggled with {{ic|Alt+Enter}}<br />
<br />
==== Infinite loading ====<br />
<br />
Create file {{ic|loadfix.c}} next to the game executable: [https://steamcommunity.com/app/282070/discussions/0/610573751159186268/?ctp=4#c530647080133257413 src]<br />
<br />
#define _GNU_SOURCE <br />
#include <dlfcn.h> <br />
#include <semaphore.h> <br />
#include <stdio.h> <br />
#include <time.h> <br />
#include <unistd.h> <br />
static int (*_realSemTimedWait)(sem_t *, const struct timespec *) = NULL; <br />
<br />
int sem_timedwait(sem_t *sem, const struct timespec *abs_timeout)<br />
{ <br />
if (abs_timeout->tv_nsec >= 1000000000)<br />
{ <br />
//fprintf(stderr, "to: %lu:%lu\n", abs_timeout->tv_sec, abs_timeout->tv_nsec); <br />
((struct timespec *)abs_timeout)->tv_nsec -= 1000000000; <br />
((struct timespec *)abs_timeout)->tv_sec++; <br />
} <br />
return _realSemTimedWait(sem, abs_timeout); <br />
} <br />
<br />
__attribute__((constructor)) void init(void) <br />
{<br />
_realSemTimedWait = dlsym(RTLD_NEXT, "sem_timedwait");<br />
}<br />
<br />
Compile with {{ic|gcc -m32 -o loadfix.so loadfix.c -ldl -shared -fPIC -Wall -Wextra}}<br />
<br />
Launch with {{ic|1=LD_PRELOAD=$LD_PRELOAD:./loadfix.so %command%}}<br />
<br />
==== Gamepad not working ====<br />
<br />
You have to enable keyboard control and map gamepad to keys.<br />
<br />
Config for Steam: {{ic|steam://controllerconfig/91200/1498735506}}<br />
<br />
=== Aquaria ===<br />
<br />
==== Mouse pointer gets stuck in one direction ====<br />
<br />
If the mouse pointer gets stuck in one direction, make sure {{ic|''GAME''/usersettings.xml}} contains {{ic|1=<JoystickEnabled on="0" />}}.<br />
<br />
If that does not fix the issue, try unplugging any joysticks or joystick adapter devices you have plugged in.<br />
<br />
=== ARK: Survival Evolved ===<br />
<br />
==== Game does not start, displays text window with unreadable text ====<br />
<br />
Run the game with {{ic|1=MESA_GL_VERSION_OVERRIDE=4.0 MESA_GLSL_VERSION_OVERRIDE=400}}.<br />
<br />
==== Gray water ====<br />
<br />
Download the TheCenter map and copy {{ic|Water_DepthBlur_MIC.uasset}} from that map into TheIsland as described [https://www.gamingonlinux.com/articles/heres-a-way-to-fix-the-broken-water-in-ark-survival-evolved-on-linux.10530 here].<br />
<br />
Ragnarok uses TheIsland's texture, so the same procedure fixes the issue on Ragnarok as well.<br />
<br />
==== Segmentation fault on startup ====<br />
<br />
Caused by the games packaged libopenal. Use system libopenal to solve the segfault by running the game with with {{ic|1=LD_PRELOAD=/usr/lib/libopenal.so.1}}<br />
<br />
==== Crash on joining a game ====<br />
<br />
Set steam to 'offline mode' and try again<br />
<br />
=== Audiosurf 2 ===<br />
<br />
==== error. unable to load song <filename> ,came back with zero duration ====<br />
<br />
If you get this in your log, install {{pkg|pulseaudio-alsa}}.<br />
<br />
=== BADLAND: Game of the Year Edition ===<br />
<br />
Refer to [[#Missing libcurl.so.4 or version CURL_OPENSSL_3 not found]].<br />
<br />
=== BATTLETECH ===<br />
<br />
==== Game does not start ====<br />
<br />
Try deleting {{ic|''BATTLETECH''/BattleTech_Data/plugins/x86_64/libc.so.6}}, this should make the game run again.<br />
<br />
=== Beat Cop ===<br />
<br />
==== "BeatCop.x86_64" is not responding ====<br />
<br />
Run {{ic|BeatCop.x86}} instead of {{ic|BeatCop.x86_64}}.<br />
<br />
=== Binding of Isaac: Rebirth ===<br />
<br />
==== No sound ====<br />
<br />
{{Note|This also helps with Never Alone (Kisima Ingitchuna) and No Time to Explain.}}<br />
<br />
Prepend {{ic|/usr/lib}} to {{ic|LD_LIBRARY_PATH}}.<br />
<br />
Adjust the audio levels in the game options.<br />
<br />
=== BioShock Infinite ===<br />
<br />
==== Game launching on wrong monitor in fullscreen mode ====<br />
<br />
Add the following launch option:<br />
--eon_force_display=1<br />
<br />
Various more fixes and tweaks can be found [https://pcgamingwiki.com/wiki/BioShock_Infinite here]<br />
<br />
==== Audio crackling ====<br />
<br />
Change the launch options to<br />
<br />
PULSE_LATENCY_MSEC=60 %command%<br />
<br />
Discussion on the variable can be found in [https://github.com/ValveSoftware/Proton/issues/1209 Proton issue #1209]. Lower values maintain lower audio latency but crackling may still occur; higher values are more likely to eliminate crackling but allow for higher audio latency.<br />
<br />
=== BLACKHOLE ===<br />
<br />
Refer to [[#Missing libcurl.so.4 or version CURL_OPENSSL_3 not found]].<br />
<br />
=== Black Mesa ===<br />
<br />
Install {{AUR|lib32-gperftools}} for 32bit version of libtcmalloc_minimal.so.4 which is needed [https://steamcommunity.com/app/362890/discussions/1/340412628175324858/?ctp=7 Source].<br />
<br />
=== Block'hood ===<br />
<br />
==== White screen on startup ====<br />
<br />
When launched the game may only display a white screen with no interface and no way to play the game. Add "-screen-fullscreen 0" to launch options.<br />
<br />
=== The Book of Unwritten Tales ===<br />
<br />
Dependencies:<br />
<br />
* {{AUR|lib32-jasper}}<br />
* {{AUR|lib32-libxaw}}<br />
<br />
If the game does not start, uncheck: ''Properties > Enable Steam Community In-Game''.<br />
<br />
The game is known to segfault when opening the settings and possibly during or before playing. A workaround from the [https://steamcommunity.com/app/221410/discussions/3/846939071081758230/#p2 Steam discussions] is to replace the game's {{ic|RenderSystem_GL.so}} with one from Debian's repositories. To do that download [https://launchpad.net/ubuntu/+archive/primary/+files/libogre-1.7.4_1.7.4-3_i386.deb this deb file], and extract it with {{Pkg|dpkg}}:<br />
<br />
$ dpkg -x libogre-*.deb outdir<br />
<br />
Now replace {{ic|''GAME''/lib/32/RenderSystem_GL.so}} with the one extracted from the {{ic|.deb}} package.<br />
<br />
=== BRAIN/OUT ===<br />
<br />
If the game does not start with error message saying "invalid app configuration".<br />
Change directory to game folder:<br />
<br />
$ cd ~/.steam/steam/steamapps/common/BrainOut/<br />
<br />
Run game directly:<br />
<br />
$ java -jar brainout-steam.jar<br />
<br />
You need to have steam running in the background.<br />
<br />
=== The Book of Unwritten Tales: The Critter Chronicles ===<br />
<br />
See [[#The Book of Unwritten Tales]].<br />
<br />
To prevent the game from crashing at the end credits, change the size of the credits image as described [https://steamcommunity.com/app/221830/discussions/0/828925849276110960/#c810921273836530791 here].<br />
<br />
=== Borderlands 2 ===<br />
<br />
==== Migrating saves from other platforms ====<br />
<br />
Borderlands 2 does not support cross-platform Steam Cloud syncing,<br />
you have to manually copy the files between platforms.<br />
Save locations can be found [https://pcgamingwiki.com/wiki/Borderlands_2#Game_data here].<br />
Make sure your user can access the files.<br />
<br />
==== Using Ctrl Key ====<br />
<br />
Borderlands 2 does not allow the {{ic|Ctrl}} key to be used by default. The game seems to be accessing keycodes and not keysyms, therefore xmodmap has no affect. A workaround is using ''setkeycodes'' to map the Ctrl-scancode to some other key, as described in [[Map scancodes to keycodes#Using setkeycodes]]. I use {{ic|setkeycodes 0x1d 56}} (as root) to map Ctrl to Alt before starting the game and {{ic|setkeycodes 0x1d 29}} to restore the default.<br />
<br />
==== Logging into SHiFT ====<br />
<br />
Out of the box you will not be able to log into SHiFT since the game expects certificates to be in {{ic|/usr/lib/ssl}}, which is where Ubuntu stores them. Arch however uses {{ic|/etc/ssl}}.<br />
To resolve the problem, run the game with {{ic|1=SSL_CERT_DIR=/etc/ssl/certs}}.<br />
<br />
==== Game crashes nearly instantly ====<br />
<br />
The game crashes in libopenal directly after launch.<br />
<br />
Possible solution 0: Run the game with the {{ic|-nostartupmovies}} flag. It no longer crashes in libopenal with a general protection error.<br />
<br />
Possible solution 1: As of lib32-openal version 1.18.0-1, the game crashes instantly. The possible solutions are to downgrade lib32-openal to 1.17.2-1, or to start the game with {{ic|LD_PRELOAD<nowiki>=</nowiki>'$HOME/.steam/root/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/libopenal.so.1'}}.<br />
<br />
In case there are messages like this in the terminal:<br />
<br />
[ 671.617205] Borderlands2[2772]: segfault at 0 ip (null) sp 00000000ff9a462c error 14 in Borderlands2[8048000+235a000]<br />
<br />
The following change may help ([https://steamcommunity.com/app/49520/discussions/0/348292787746982160/ source]):<br />
LD_PRELOAD='./libcxxrt.so:/usr/$LIB/libstdc++.so.6' %command%<br />
<br />
Possible solution 2: Launch steam as {{ic|steam-native}} as described in [[Steam/Troubleshooting #Steam native runtime|#Steam native runtime]]. If the game still fails to launch even after installing the {{Pkg|steam-native-runtime}} meta package, then you might be missing some libraries. You can find those missing libraries as described in [[Steam/Troubleshooting #Debugging shared libraries|#Debugging shared libraries]].<br />
<br />
=== Borderlands: The Pre-Sequel ===<br />
<br />
See [[#Borderlands 2]].<br />
<br />
==== Keyboard not working ====<br />
<br />
This can occur with certain window managers e.g. [[dwm]]. Try a different [[window manager]], or install {{pkg|wmname}} and run:<br />
$ wmname LG3D<br />
<br />
see [[Java#Impersonate another window manager]] for more information.<br />
<br />
==== Not starting via Steam ====<br />
<br />
If the game appears as ''Running'', then syncs and closes when you launch it from Steam, try creating a {{ic|steam_appid.txt}} in the game directory<br />
containing {{ic|261640}}. This should resolve the issue and let you start the game directly from the game directory. If that does not work, try using the {{Pkg|steam-native-runtime}}.<br />
<br />
=== Chaos Engine ===<br />
<br />
Set your [[launch option]]s to:<br />
<br />
LD_PRELOAD="/usr/lib32/libpng16.so.16" %command%<br />
<br />
If such error is seen in terminal output of steam-native:<br />
/home/$USER/.local/share/Steam/steamapps/common/Chaos engine/TheChaosEngineSteam: /home/$USER/.local/share/Steam/steamapps/common/Chaos engine/lib/libz.so.1: version `ZLIB_1.2.9' not found (required by /usr/lib32/libpng16.so.16)<br />
/home/$USER/.local/share/Steam/steamapps/common/Chaos engine/TheChaosEngineSteam: /home/$USER/.local/share/Steam/steamapps/common/Chaos engine/lib/libz.so.1: version `ZLIB_1.2.3.4' not found (required by /usr/lib32/libpng16.so.16)<br />
<br />
Then link the system libz.so:<br />
cd ~/.local/share/Steam/steamapps/common/Chaos\ engine/lib<br />
mv libz.so.1 libz.so.1.old<br />
ln -s /lib/libz.so.1<br />
<br />
=== Cities in Motion 2 ===<br />
<br />
==== Dialog boxes fail to display properly ====<br />
<br />
You will not be able to read or see anything, and you will have this in your logs:<br />
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 69: non-double matrix element<br />
Fontconfig error: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 69: wrong number of matrix elements<br />
<br />
Workaround for the bug {{Bug|35039}} is available [https://archive.is/L9AoT here] (replace {{ic|/etc/fonts/conf.d/10-scale-bitmap-fonts.conf}}).<br />
<br />
=== Cities Skylines ===<br />
<br />
==== Game not starting ====<br />
<br />
If you set {{ic|$XDG_DATA_HOME}} to something other than {{ic|$HOME/.local/share}}, Cities Skylines will put some files in {{ic|$XDG_DATA_HOME/Paradox Interactive}} and some hard-coded in {{ic|~/.local/share/Paradox Interactive}}.<br />
Unset the Variable to fix this issue.<br />
<br />
==== Textures not rendering properly ====<br />
<br />
Run the game with {{ic|1=UNITY_DISABLE_GRAPHICS_DRIVER_WORKAROUNDS=yes}}.<br />
<br />
==== Game crashes in loading screen when Node Controller or Intersection Marking tool are enabled in Content Manager ====<br />
<br />
If the game crashes with one or both of the above mods enabled when loading a save or starting a new game but works fine with both mods disabled, install {{Pkg|mono}}.<br />
<br />
=== Civilization V ===<br />
<br />
Run the game with {{ic|1=LD_PRELOAD=/usr/lib32/libopenal.so.1 %command% }}.[https://steamcommunity.com/app/8930/discussions/0/1621726179576099775/] For old versions of PulseAudio (<12.0), use {{ic|1=LD_PRELOAD='./libcxxrt.so:/usr/$LIB/libstdc++.so.6:/usr/lib32/libopenal.so.1' %command% }}.[https://github.com/ValveSoftware/steam-for-linux/issues/4379] If libopenal.so.1 is not in /usr/lib32, you may need to install {{Pkg|lib32-openal}} after making sure multilib is enabled.[[Official repositories#multilib]]<br />
<br />
If you are experiencing heavy lag (less than 1fps) or the game crashes on startup, try adding the following paths to LD_PRELOAD: {{ic|1='/usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1 /usr/$LIB/libgpg-error.so ./libcxxrt.so /usr/lib32/libstdc++.so.6 /usr/lib32/libopenal.so.1'}}.[https://forum.manjaro.org/t/civ-v-wont-launch-after-update/10825/6]{{Dead link|2021|05|17|status=404}}<br />
<br />
==== Stuttering sound with PulseAudio ====<br />
<br />
See [[PulseAudio/Troubleshooting#Laggy sound]].<br />
<br />
==== Game crashes seconds after loading a map ====<br />
<br />
If you have a CPU with more than 8 threads (such as AMD Ryzen), set {{ic|MaxSimultaneousThreads}} to {{ic|16}} in {{ic|config.ini}} in game directory.[https://www.reddit.com/r/civ5/comments/5z77jr/game_crashes_randomly_on_linux_amd_ryzen/]<br />
<br />
Alternatively, you can limit the number of threads the game uses by adding {{ic|taskset -c 0-7 %command%}} to the launch options: [https://steamcommunity.com/app/8930/discussions/0/1693788384127278334/]<br />
<br />
==== Game crashes after intro video with "Unable to load texture (LoadingBaseGame.dds)" / configuration reset at startup ====<br />
<br />
The issue is a result of the game calling some file in a case-insensitive manner.<br />
<br />
The solution is either to install the game on a case-insensitive file system like VFAT, or on a mount point for {{AUR|ciopfs}}.<br />
<br />
It is not enough the game is in a case-insensitive filesystem, but also the configuration/data directory at "~/.local/share/Aspyr/Sid Meier's Civilization 5" needs to be in a case-insensitive filesystem or mount point. If the data directory is in a case-sensitive filesystem, the game will not work correctly and symptoms such as configuration getting constantly reset can be observed.<br />
<br />
==== Game crashes on startup with an error in libpulsecommon-12.0.so" ====<br />
<br />
Run the game with {{ic|1=LD_PRELOAD=/usr/lib32/libopenal.so.1 %command%}}<br />
<br />
==== Steam Overlay not working ====<br />
<br />
If the Steam Overlay does not show up simply add<br />
LD_PRELOAD='/home/USERNAME/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so' %command%<br />
<br />
to the launch options in the properties of the game in Steam.<br />
<br />
==== Crashes during __memcpy_ssse3 ====<br />
<br />
This appears to be a memory alignment bug that can be corrected by compiling the libraries with -mstackrealign. GDB can also be used to run it as-is with the following launch options:<br />
LD_PRELOAD=/usr/lib/libcurl.so.4 /bin/gdb -windows -batch -return-child-result -nx -eval-command="run" -exec=%command%<br />
<br />
=== Civilization: Beyond earth ===<br />
<br />
If you are getting an instant crash/close upon launch, make sure you have the following packages installed:<br />
<br />
* {{pkg|lib32-libcurl-compat}}<br />
* {{pkg|lib32-libcurl-gnutls}}<br />
* {{pkg|lib32-openal}}<br />
<br />
You also need an older version of lib32-tbb which provides libtbb.so.2. To get this:<br />
<br />
# Download the [http://archive.ubuntu.com/ubuntu/pool/universe/t/tbb/libtbb2_4.2~20130725-1.1ubuntu1_i386.deb libtbb2 deb-package] from the Ubuntu archive.<br />
# Unpack {{ic|libtbb.so.2}} from {{ic|libtbb2_4.2_20130725-1.1ubuntu1_i386.deb/data.tar.xz/usr/lib}} into the game directory.<br />
<br />
Note that if you have a globally installed 32-bit libtbb.so.2, you will need to run the game with:<br />
<br />
# Run the game with {{ic|1=LD_PRELOAD='./libtbb.so.2'}}.<br />
<br />
To force it to use this version. This version also resolves crashes with the following backtrace:<br />
<br />
#0 0x08b71d06 in FireGrafix::DynamicsLock<Graphics::BuildingSkinnedDataDynamicConsts>::DynamicsLock(Graphics::SurfaceSet**, FireGrafix::SurfaceSetPoolAllocator*, unsigned short) ()<br />
#1 0x08c25ffc in cvLandmarkVisSystem::cvLandmarkVisDynamicConstantUpdaterSS::HandleBuildingShaderSkinned(Graphics::FGXShaderPackageInstanceView*, FireGrafix::FGXModelNode*, FGXVector4*) ()<br />
#2 0x08c25f34 in cvLandmarkVisSystem::cvLandmarkVisDynamicConstantUpdaterSS::UpdateNode(Graphics::FGXShaderPackageInstanceView*, FireGrafix::FGXModelNode*, FGXVector4*) ()<br />
#3 0x08c25e2c in FireGrafix::FGXModelRenderByNodeSSExample_Shadow<cvLandmarkVisSystem::cvLandmarkVisDynamicConstantUpdaterSS, 2, FireGrafix::FGXModelRenderEndSuperclass>::RenderNode(unsigned int*, FireGrafix::FGX_SPIV_GENERIC*, FireGrafix::FGXModelNode*, FGXVector4*) ()<br />
#4 0x08c24ff5 in cvLandmarkVisSystem::LandmarkRenderJob::Execute(unsigned int) ()<br />
#5 0x093d26d9 in Platform::JobTask::execute() ()<br />
#6 0xf749f3c0 in ?? () from /usr/lib32/libtbb.so.2<br />
#7 0xf7497551 in ?? () from /usr/lib32/libtbb.so.2<br />
#8 0xf7495fc3 in ?? () from /usr/lib32/libtbb.so.2<br />
#9 0xf7491b7e in ?? () from /usr/lib32/libtbb.so.2<br />
#10 0xf7491db7 in ?? () from /usr/lib32/libtbb.so.2<br />
#11 0xf78f4346 in start_thread () from /usr/lib32/libpthread.so.0<br />
#12 0xf7716026 in clone () from /usr/lib32/libc.so.6<br />
<br />
=== Civilization VI ===<br />
<br />
Either run with steam-native, launch option {{ic|1=LD_PRELOAD='/usr/lib/libfreetype.so.6:/usr/lib/libbrotlicommon.so.1:/usr/lib/libbrotlidec.so.1' %command%}}, and go to ''Properties > Compatibility'', check "Force the use of a specific Steam Play compatiblity tool" and select "Steam Linux runtime".<br />
<br />
If you are using [[Wayland]], you might need to also set {{ic|1=QT_QPA_PLATFORM=xcb}}, as the game's launcher uses a version of Qt which only supports Xorg (see [[Wayland#Qt]]). Some versions of the game also seem to require adding {{ic|1=SDL_VIDEODRIVER=x11}} and will otherwise refuse to start with an error message that reads "An unrecoverable error has occurred, and Civilization VI cannot continue."<br />
<br />
Follow [[#OpenSSL 1.0 setup]]. <br />
<br />
Ensure that Steam Workshop mods are disabled as certain ones may cause issues following loading.<br />
<br />
==== Steam Overlay not working ====<br />
<br />
Since the introduction of the new launcher, the steam overlay does not work in this game. To get it working again, simlpy skip the launcher as described in [[#Launcher unable to load page]].<br />
<br />
==== If Segfault Immediately on Start ====<br />
<br />
This is a strange corner case which happens infrequently at best (and the prerequisites for reproducing it are unknown), but the crash would look like this:<br />
<br />
# Immediate segfault on start, before any windows get created<br />
# The game creates {{ic|~/.local/share/aspyr-media/Sid Meier's Civilization VI/AppOptions.txt}}<br />
# The string {{ic|AppHost::BugSubmissionPackager::BugSubmissionPackager}} appears in the backtrace output when running the game under {{pkg|gdb}}<br />
## To run under {{pkg|gdb}}, first launch a shell and change into the game directory.<br />
## Then {{ic|echo 289070 > steam_appid.txt}} ''(otherwise the game will not launch outside of Steam itself)''<br />
## Then run something like {{ic|gdb -ex run -ex bt -ex quit --args ./Civ6 ./Civ6}}<br />
## The relevant info towards the end of the output should look like this:<br />
Thread 3 "Civ6" received signal SIGSEGV, Segmentation fault.<br />
[Switching to Thread 0x7fffe5d06700 (LWP 12315)]<br />
0x000000000201121e in AppHost::BugSubmissionPackager::BugSubmissionPackager(unsigned long, String::BasicT<Platform::StaticHeapAllocator<5, 0>, (String::Encoding)4> const&, String::BasicT<Platform::StaticHeapAllocator<5, 0>, (String::Encoding)0> const&, AppHost::ModuleVersionInfo const&) ()<br />
#0 0x000000000201121e in AppHost::BugSubmissionPackager::BugSubmissionPackager(unsigned long, String::BasicT<Platform::StaticHeapAllocator<5, 0>, (String::Encoding)4> const&, String::BasicT<Platform::StaticHeapAllocator<5, 0>, (String::Encoding)0> const&, AppHost::ModuleVersionInfo const&) ()<br />
#1 0x000000000200c796 in AppHost::_INTERNAL::SetupFXSPlatform(AppHost::AppEnvironment const*, AppHost::AppOptions*)<br />
()<br />
#2 0x000000000200fea0 in AppHost::RunApp(int, char**, AppHost::Application*) ()<br />
#3 0x000000000200f9bc in AppHost::RunApp(char*, AppHost::Application*) ()<br />
#4 0x0000000001112d98 in WinMain ()<br />
#5 0x00000000010bdab0 in ?? ()<br />
#6 0x00000000010bfb31 in ThreadHANDLE::ThreadProc(void*) ()<br />
#7 0x00007ffff473e08a in start_thread () from /usr/lib/libpthread.so.0<br />
#8 0x00007ffff38f747f in clone () from /usr/lib/libc.so.6<br />
<br />
If all of that is the case for you, the fix is pretty simple. Edit {{ic|~/.local/share/aspyr-media/Sid Meier's Civilization VI/AppOptions.txt}} and change the line reading {{ic|EnableBugCollection 1}} to {{ic|EnableBugCollection 0}}.<br />
<br />
Presumably this fix will prevent any automated bug reports from reaching Aspyr, should you encounter crashes/bugs in the future, but it will at least let the game launch properly.<br />
<br />
==== If Crash with Error "undefined symbol FT_Done_MM_Var" ====<br />
<br />
If the game crashed with: <br />
<br />
./GameGuide/Civ6: symbol lookup error: /usr/lib/libfontconfig.so.1: undefined symbol: FT_Done_MM_Var<br />
<br />
The solution is to set launch options to: <br />
<br />
LD_PRELOAD=/usr/lib/libfreetype.so.6 %command%<br />
<br />
==== If the game ends up being a grey-color blank screen ====<br />
<br />
The solution is to disable mods.<br />
<br />
==== If the computer becomes irresponsive after "Loading" screen ====<br />
<br />
This may be caused by amdgpu driver crash due to insuffcient video memory. If running an integrated graphics (eg. AMD Renoir), try allocating more memory in your BIOS.<br />
<br />
==== Multi-monitor and wayland: mismatched resolution ====<br />
<br />
Wayland does not define a primary monitor, so the game will show the available resolutions of an arbitrary monitor; it may not have the same size and the mouse may be off. A solution is to set an XWayland monitor as primary.<br />
<br />
To find the list of XWayland monitors: {{ic|xrandr --listmonitors}}<br />
<br />
To set (eg) the XWAYLAND4 monitor as the primary: {{ic|xrandr --output XWAYLAND4 --primary}}<br />
<br />
==== Launcher window is huge (wrong scaling) ====<br />
<br />
If the launcher window is huge (sometimes bigger than the screen), then the scaling is wrong. Add {{ic|1=QT_AUTO_SCREEN_SCALE_FACTOR=0}} to the launch options and on next start the launcher should be usable.<br />
<br />
==== Launcher unable to load page ====<br />
<br />
The launcher often shows errors like {{ic|1=Error loading page}}. It is possible to bypass the launcher by editing the games startup configuration {{ic|~/.local/share/Steam/steamapps/common/Sid Meier's Civilization VI/Civ6}} and changing the line {{ic|1=./GameGuide/Civ6}} to {{ic|1=./Civ6Sub}}.<br />
<br />
=== CrossCode ===<br />
<br />
==== If FontConfig Errors on Start ====<br />
<br />
{{bc|<br />
...<br />
Fontconfig error: "/etc/fonts/fonts.conf", line 6: invalid attribute 'translate'<br />
Fontconfig error: "/etc/fonts/fonts.conf", line 6: invalid attribute 'selector'<br />
Fontconfig error: "/etc/fonts/fonts.conf", line 7: invalid attribute 'xmlns:its'<br />
Fontconfig error: "/etc/fonts/fonts.conf", line 7: invalid attribute 'version'<br />
Fontconfig warning: "/etc/fonts/fonts.conf", line 9: unknown element "description"<br />
Fontconfig warning: "/etc/fonts/conf.d/10-hinting-slight.conf", line 4: unknown element "its:rules"<br />
Fontconfig warning: "/etc/fonts/conf.d/10-hinting-slight.conf", line 5: unknown element "its:translateRule"<br />
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 5: invalid attribute 'translate'<br />
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 5: invalid attribute 'selector'<br />
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 6: invalid attribute 'xmlns:its'<br />
Fontconfig error: "/etc/fonts/conf.d/10-hinting-slight.conf", line 6: invalid attribute 'version'<br />
Fontconfig warning: "/etc/fonts/conf.d/10-hinting-slight.conf", line 8: unknown element "description"<br />
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 4: unknown element "its:rules"<br />
Fontconfig warning: "/etc/fonts/conf.d/10-scale-bitmap-fonts.conf", line 5: unknown element "its:translateRule"<br />
...<br />
}}<br />
<br />
Download the latest version of nwjs from [https://nwjs.io/ here] and extract its contents into your CrossCode directory, overwriting the files.<br />
<br />
Be sure to rename {{ic|nw}} to {{ic|CrossCode}} after.<br />
<br />
This solution was documented to work with CrossCode 1.2 and nwjs 0.41.2 and is based on [https://steamcommunity.com/app/368340/discussions/1/1727575977598417554/ this steam post]<br />
<br />
==== Crash during startup : X server probably went away ====<br />
<br />
If the game crashes on startup, with the logs ending with a line like the following: <br />
<br />
[19142:19142:0315/222104.782993:ERROR:chrome_browser_main_extra_parts_x11.cc(62)] X IO error received (X server probably went away)<br />
<br />
Add {{ic|--disable-gpu}} to the launch options (as documented [https://steamcommunity.com/app/368340/discussions/1/1733213724900972605/?&ctp=6#c3185738591085997507 in this steam post]).<br />
<br />
=== Deus Ex: Mankind Divided ===<br />
<br />
Follow [[#OpenSSL 1.0 setup]].<br />
<br />
Requires {{Pkg|libidn11}} & {{Pkg|librtmp0}}.<br />
<br />
Also if you use Bumblebee set your [[launch option]]s to:<br />
<br />
LD_PRELOAD="$LD_PRELOAD:libpthread.so.0:libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 optirun %command%<br />
<br />
=== The Clockwork Man ===<br />
<br />
Requires {{pkg|lib32-libidn}} (pulled in by {{pkg|steam-native-runtime}}).<br />
<br />
=== Company of Heroes 2 ===<br />
<br />
Make sure you have {{AUR|lib32-gconf}} installed.<br />
<br />
==== Missing libpcre.so.3 and libidn.so.11 ====<br />
<br />
Like with [[#Alien Isolation]] you need to symlink {{ic|/usr/lib/libpcre.so}} to {{ic|''GAME''/lib/''arch''/libpcre.so.3}}, as well as {{ic|/usr/lib/libidn.so}} to {{ic|''GAME''/lib/''arch''/libidn.so.11}}, otherwise the game will fail to start.<br />
<br />
=== Cossacks 3 ===<br />
<br />
==== No sound ====<br />
<br />
Use the steam-runtime, e.g. set the [https://support.steampowered.com/kb_article.php?ref=1040-JWMT-2947 launch options] to:<br />
<br />
~/.steam/root/ubuntu12_32/steam-runtime/run.sh %command%<br />
<br />
==== Flashing screen with primus ====<br />
<br />
Set {{ic|1=PRIMUS_SYNC=2}}in the launch options.<br />
<br />
=== Counter-Strike: Source (CS:S) ===<br />
<br />
==== Invisible symbols, special characters and cyrillic letters ====<br />
<br />
Check [[#Squares or invisible symbols, special characters and cyrillic letters in Source-based games]]<br />
<br />
=== Counter-Strike: Global Offensive (CS:GO) ===<br />
<br />
==== Game starts on the wrong screen ====<br />
<br />
[https://github.com/ValveSoftware/csgo-osx-linux/issues/60 csgo-osx-linux issue #60]<br />
<br />
If it happens, go into fullscreen windowed or windowed mode and drag the window to the correct monitor. Then go back into fullscreen, the game should now be on the correct monitor.<br />
<br />
==== Cannot reach bottom of the screen on menus ====<br />
<br />
[https://github.com/ValveSoftware/csgo-osx-linux/issues/594 csgo-osx-linux issue #594]<br />
<br />
If you have a secondary monitor you might have a part of your lower screen you cannot reach in menus.<br />
If on Gnome you can try to open the overview (Super key) and drag the game to the other monitor and back.<br />
<br />
If you are not on Gnome or dragging the window back and forth did not work you can try to [[install]] {{pkg|wmctrl}} and run this command, where X and Y is the offset of the window and H and W is the size.<br />
wmctrl -r "Counter-Strike: Global Offensive - OpenGL" -e 0,X,Y,H,W<br />
<br />
'''Example''': SecondaryMonitor: on the left 2560x1600, GamingMonitor: on the right 2560x1440).<br />
wmctrl -r "Counter-Strike: Global Offensive - OpenGL" -e 0,2560,0,1600,1200<br />
Here X and Y is 0,2560 to move the window to the monitor on the right and H and W 1600,1200 is set to match the in-game resolution.<br />
<br />
==== Sound is played slightly delayed ====<br />
<br />
[https://github.com/ValveSoftware/csgo-osx-linux/issues/45 csgo-osx-linux issue #45]<br />
<br />
See [[PulseAudio/Troubleshooting#Laggy sound]] for a possible solution.<br />
<br />
==== Mouse not working in-game ====<br />
<br />
If your mouse works in the main menu but not in-game, run the game with {{ic|1=SDL_VIDEO_X11_DGAMOUSE=0}}.<br />
[https://bbs.archlinux.org/viewtopic.php?id=184905]<br />
<br />
==== Brightness slider not working ====<br />
<br />
[[Install]] {{pkg|xorg-xrandr}} and run {{ic|xrandr}} to find out the name of your connected display output.<br />
<br />
Edit {{ic|''GAME''/csgo.sh}} and add the following lines (adapt ''output_name''):<br />
<br />
'''# gamma correction'''<br />
'''xrandr --output ''output_name'' --gamma 1.6:1.6:1.6 # play with values if required'''<br />
STATUS=42<br />
while [$STATUS -eq 42]; do<br />
...<br />
done<br />
'''# restore gamma'''<br />
'''xrandr --output ''output_name'' --gamma 1:1:1'''<br />
exit $STATUS<br />
<br />
==== Microphone not working ====<br />
<br />
[https://github.com/ValveSoftware/csgo-osx-linux/issues/573#issuecomment-174016722 csgo-osx-linux issue #573]<br />
<br />
CS:GO uses the default PulseAudio sound device ignoring what is configured in Steam settings.<br />
<br />
First find out the source name of your microphone (it should start with {{ic|alsa_input.}}):<br />
$ pacmd list-sources<br />
<br />
Then set the default device (change the name accordingly):<br />
$ pacmd set-default-source ''device_name''<br />
<br />
Also lower the microphone level to 60% otherwise you will get some nasty background noise and you will be difficult to understand (change the name accordingly):<br />
$ pacmd set-source-volume ''device_name'' 0x6000<br />
<br />
==== Mouse is unrensponsive or moves slowly ====<br />
<br />
Set launch options to:<br />
vblank_mode=0 %command%<br />
<br />
Works with almost any other game.<br />
<br />
==== Game crashes on startup with game controller plugged in ====<br />
<br />
* The solution is to add {{ic|-nojoy}} to the launch options: [https://github.com/ValveSoftware/csgo-osx-linux/issues/1757 csgo-osx-linux issue #1757]<br />
<br />
* Another solution: delete startup video: [https://github.com/ValveSoftware/csgo-osx-linux/issues/2659#issuecomment-934357559 csgo-osx-linux issue #2659]<br />
<br />
==== Some texts are missing or mis-positioned ====<br />
<br />
[[Locale#Generating_locales|Generate]] the {{ic|en_US.UTF-8}} locale will solve the problem.<br />
<br />
=== Creeper World 3: Arc Eternal ===<br />
<br />
==== Game does not start ====<br />
<br />
{{Accuracy|Would this not be fixed by using native versions instead of the Steam runtime?}}<br />
<br />
Search for Player.log<br />
(might be in {{ic|~/.config/unity3d/Knuckle Cracker LLC/Creeper World 3/}})<br />
<br />
If it says somewhere in Player.log<br />
FMOD failed to get number of drivers ... An error occured that was not supposed to. Contact support.<br />
Unity is probably having problem with some pulse audio libraries. <br />
<br />
Remove or rename all instances of libpulse-simple* files in {{ic|/usr/lib}}, {{ic|/usr/lib32}}, {{ic|~/.steam/steam/ubuntu12_32/steam-runtime/i386/usr/lib/i386-linux-gnu/}}, {{ic|~/.steam/steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/}}.<br />
<br />
=== Crusader Kings II ===<br />
<br />
==== No audio ====<br />
<br />
SDL uses [[PulseAudio]] by default, so to use it with [[ALSA]] you need to [[Environment variables#Graphical environment|set]] the {{ic|1=SDL_AUDIODRIVER=alsa}} environment variable.<br />
<br />
==== Oddly sized starting window ====<br />
<br />
You can make full screen mode the default by setting {{ic|1=fullscreen=yes}} in {{ic|~/.paradoxinteractive/Crusader Kings II/settings.txt}}.<br />
<br />
==== DLCs not detected ====<br />
<br />
If the DLC tab in the launcher is not selectable, rename the {{ic|DLC}} directory in the game directory to {{ic|dlc}}.<br />
<br />
==== Game takes ages to start ====<br />
<br />
If you are using a nvidia graphics card, make sure you have enabled the [[NVIDIA#DRM kernel mode setting|DRM kernel mode setting]].<br />
<br />
==== Game does not start at all ====<br />
<br />
If the game stopped launching after Patch 3.3 (when the game became 64-bit only), install {{Pkg|tbb}}.<br />
<br />
=== Crypt of the NecroDancer ===<br />
<br />
==== Crashes after splash screen ====<br />
<br />
The following error occurs if launching Steam from the terminal.<br />
<br />
FMOD ERROR: UpdateFMOD SystemUpdate: This command failed because System::init or System::setDriver was not called.<br />
<br />
This error is solved by installing {{pkg|pulseaudio-alsa}}.<br />
<br />
=== The Curious Expedition ===<br />
<br />
==== Game stuck on loading screen ====<br />
<br />
The Electron shipped with this game is too old for Arch Linux.<br />
<br />
Install {{pkg|electron}} and run the game with {{ic|electron resources/app.asar}}.<br />
<br />
=== Death Road To Canada ===<br />
<br />
==== No music ====<br />
<br />
Prepend {{ic|/usr/lib}} to {{ic|LD_LIBRARY_PATH}}.<br />
<br />
=== Dirt ===<br />
<br />
Follow [[#OpenSSL 1.0 setup]].<br />
<br />
=== Dirt Rally ===<br />
<br />
Prepend {{ic|lib/x86_64}} to your {{ic|LD_LIBRARY_PATH}}, otherwise the game will fail to start.<br />
<br />
{{Note|The order of the paths is important. {{ic|$LD_LIBRARY_PATH}} must be the last entry or it will not work.}}<br />
<br />
If Dirt Rally still has crashed, make sure you are installed {{Pkg|libxcrypt-compat}}.<br />
<br />
=== Divinity: Original Sin - Enhanced Edition ===<br />
<br />
==== Game does not start when using Bumblebee optirun or primusrun ====<br />
<br />
Edit {{ic|''GAME''/runner.sh}} to use primusrun:<br />
LD_LIBRARY_PATH="." primusrun ./EoCApp<br />
<br />
==== Game does not work with mesa ====<br />
<br />
It is a known bug and they have no intention of fixing it, see [https://bugs.freedesktop.org/show_bug.cgi?id=93551 the bug].<br />
<br />
Workaround[https://www.gamingonlinux.com/articles/divinity-original-sin-may-soon-work-with-mesa-drivers.8867/comment_id=81524] (see [https://bugs.freedesktop.org/show_bug.cgi?id=93551#c46 step by step guide])<br />
<br />
Get the following file:<br />
https://bugs.freedesktop.org/attachment.cgi?id=125302<br />
and rename it to {{ic|divos-hack.c}}<br />
<br />
Then execute <br />
$ gcc -s -O2 -shared -fPIC -o divos-hack.{so,c} -ldl<br />
<br />
Copy the {{ic|divos-hack.so}} to the ''game'' folder.<br />
<br />
For GOG version, go to the said game folder and run Divinity with the following command<br />
$ allow_glsl_extension_directive_midshader=true LD_PRELOAD="divos-hack.so" ./runner.sh<br />
<br />
For ''steam'', open a console, change to the divinity directory with <br />
$ cd ~/.steam/steam/steamapps/common/Divinity Original Sin Enhanced Edition<br />
<br />
Launch steam and got o the preferences of the game, and open the "Set Launch Options" dialogue. There, put the following<br />
allow_glsl_extension_directive_midshader=true LD_PRELOAD="divos-hack.so:$LD_PRELOAD" %command%<br />
<br />
Then just start the game.<br />
<br />
=== Doki Doki Literature Club ===<br />
<br />
Linux version is shipped with the Windows version, but can only be installed with Steam Play.<br />
<br />
Native version can be started with this launch option: {{ic|./DDLC.sh # %command%}}<br />
<br />
=== Don't Starve Together ===<br />
<br />
If you get a crash on start in {{ic|libX11.so.6.4.0}}, the problem is likely a bug in SDL1.3. Unfortunately, DST is statically linked and we cannot use {{ic|LD_PRELOAD}} to replace libSDL with something newer. The bug has been reported to the developer, but a possible workaround is [https://forums.kleientertainment.com/klei-bug-tracker/dont-starve-together/crash-on-startup-r32786/?do=findComment&comment=49731 to patch {{ic|XGetICValues()}} to not crash when it is incorrectly given a null parameter.]<br />
<br />
=== Dota 2 ===<br />
<br />
Dependencies:<br />
<br />
* {{AUR|libudev0}}<br />
* {{pkg|libpng12}}<br />
<br />
==== Install/Set RADV as default Vulkan application ====<br />
<br />
Valve recommend RADV (Mesa) is used instead of AMDVLK (AMD), see [[Vulkan]] to install and set default.<br />
<br />
==== Switch between OpenGL and Vulkan (recommended) ====<br />
<br />
Under the game launch options add the following flags: <br />
<br />
For OpenGL: {{ic|-gl}}<br />
<br />
For Vulkan: {{ic|-vulkan}}<br />
<br />
==== In-game font is unreadable ====<br />
<br />
Run the game with {{ic|1=MESA_GL_VERSION_OVERRIDE=2.1}}.<br />
<br />
==== Error with libpangoft2 ====<br />
<br />
# [[Install]] the {{pkg|pango}} package.<br />
# Remove {{ic|libpango-1.0.so}} and {{ic|libpangoft2-1.0.so}} in {{ic|''GAME''/game/bin/linuxsteamrt64}}.<br />
# If you are using Bumblebee add {{ic|1=LD_PRELOAD="libpthread.so.0 libGL.so.1" __GL_THREADED_OPTIMIZATIONS=1 optiru}} to your [[launch option]]s.<br />
<br />
==== The game does not start ====<br />
<br />
If you run the game from the terminal and, although no error is shown, try disabling: ''Steam > Settings > In-Game > Enable Steam Community In-Game''.<br />
<br />
Apparently the game [[#The Book of Unwritten Tales]] has the same problem. It also describes a workaround that is untested in Dota 2.<br />
<br />
==== Game runs on the wrong screen ====<br />
<br />
See [https://github.com/ValveSoftware/Dota-2/issues/11 GitHub Dota 2 issue #11]<br />
<br />
==== Game does not start with libxcb-dri3 error message ====<br />
<br />
After a recent Mesa update, Dota 2 stopped working. The error message is:<br />
<br />
SDL_GL_LoadLibrary(NULL) failed: Failed loading libGL.so.1: /usr/lib32/libxcb-dri3.so.0: undefined symbol: xcb_send_fd<br />
<br />
==== Game has no audio ====<br />
<br />
This might happen because Dota 2 is trying to output through ALSA, which has already been taken over by PulseAudio. Try installing {{pkg|pulseaudio-alsa}} and setting in-game audio output to 'Default'.<br />
<br />
==== Steam overlay ====<br />
<br />
Steam distributes a copy of libxcb which is incompatible with the latest xorg libxcb. See [https://github.com/ValveSoftware/steam-for-linux/issues/3199], [https://github.com/ValveSoftware/steam-for-linux/issues/3093].<br />
<br />
==== Clear or disable shader cache for troubleshooting purposes ====<br />
<br />
To clear shader cache delete delete the 570 (Dota's app ID) folder under the steam shadercache directory e.g.<br />
<br />
/home/gaben/steam/steamapps/shadercache/<br />
<br />
To disable shader cache add the following to dota's launch options:<br />
<br />
-vulkan_disable_steam_shader_cache<br />
<br />
==== Chinese tips and player names not shown ====<br />
<br />
The Chinese characters in tips and player names are displayed as block characters.<br />
<br />
The problem is caused by the font packages: {{pkg|ttf-dejavu}}, {{pkg|ttf-liberation}} and {{aur|ttf-ms-fonts}}.<br />
<br />
See [https://github.com/ValveSoftware/Dota-2/issues/1688 GitHub Steam issue #1688]<br />
<br />
==== Chinese input method problem ====<br />
<br />
Dota2 is compatible with [[IBus]].<br />
<br />
=== Devil Daggers ===<br />
<br />
Refer to [[#Missing libcurl.so.4 or version CURL_OPENSSL_3 not found]].<br />
<br />
=== Drox Operative ===<br />
<br />
If the game fails to start with "Couldn't find Database/database.dbl!", manually extract the assets. assets003.zip will overwrite some files from the previous files.<br />
<br />
$ cd "~/.steam/root/steamapps/common/Drox Operative/Assets"<br />
$ unzip assets00[123].zip<br />
<br />
=== Dungeon Souls ===<br />
<br />
For AMD cards this game crashes on launch, unless you start it like this:<br />
<br />
R600_DEBUG=mono %command%<br />
<br />
=== Dying Light ===<br />
<br />
==== Game crashes on startup ====<br />
<br />
The game runs with the Steam setting "Force the use of a specific Steam Play compatibility tool" > "Steam Linux Runtime"<br />
<br />
=== Dynamite Jack ===<br />
<br />
Requires {{Pkg|lib32-sdl}}.<br />
<br />
==== Sound Issues ====<br />
<br />
When running on 64-bit Arch Linux, there may be "pops and hisses" when running Dynamite Jack. This could be caused by not having {{ic|1=STEAM_RUNTIME=0}} set. (However, even with {{ic|1=STEAM_RUNTIME=0}} set, the game may still sometimes start with this issue. Exiting and restarting the game seems to make the problem go away.)<br />
<br />
==== Game does not start ====<br />
<br />
If running steam with the {{ic|1=STEAM_RUNTIME=0}}, Dynamite Jack may have a problem starting. Check the steam error messages for this message:<br />
<br />
/home/$USER/.steam/root/steamapps/common/Dynamite Jack/bin/main: error while loading shared libraries: libSDL-1.2.so.0: cannot open shared object file: No such file or directory<br />
<br />
Install {{pkg|lib32-sdl}} from [[multilib]] and Dynamite Jack should start up.<br />
<br />
=== Empire Total War ===<br />
<br />
==== Weird unreadable fonts ====<br />
<br />
Open {{ic|~/.local/share/feral-interactive/Empire/preferences}}, then find {{ic|UsePBOSurfaces}} and change it from 1 to 0.<br />
<br />
=== Euro Truck Simulator 2 ===<br />
<br />
==== Shows only a black screen ====<br />
<br />
Select safe mode when the game starts up.<br />
<br />
=== Firewatch ===<br />
<br />
If Firewatch starts but does not show anything try running Steam with<br />
<br />
`STEAM_RUNTIME_PREFER_HOST_LIBRARIES=0 steam`<br />
<br />
=== Football Manager 2014 ===<br />
<br />
This game will not run when installed on an [[XFS]] or reiserfs filesystem. Workaround is to install on an ext4 filesystem.<br />
<br />
=== FORCED ===<br />
<br />
Requires {{pkg|lib32-glu}}.<br />
<br />
This game has 32-bit and 64-bit binaries. For some reason, Steam will launch the 32-bit binary even on 64-bit Arch Linux.<br />
When manually launching the 64-bit binary, the game starts, but cannot connect to Steam account, so you cannot play.<br />
So install 32-bits dependencies, and launch the game from Steam.<br />
<br />
=== For the King ===<br />
<br />
==== With steam-native ====<br />
<br />
Starts with black page. Requires to be told to use the libSDL2 shipping with Steam<br />
<br />
Add to Steam launch options for game: <br />
<br />
LD_PRELOAD=~/.local/share/Steam/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 %command%<br />
<br />
Note however, that this disables the Steam overlay as a side effect.<br />
<br />
==== With steam-runtime ====<br />
<br />
It works out of the box.<br />
<br />
For the full experience, run FTK via steam-runtime instead of steam-native.<br />
<br />
=== FTL: Faster than Light ===<br />
<br />
==== Compatibility ====<br />
<br />
After installation, FTL may fail to run due to a 'Text file busy' error (characterised in Steam by your portrait border going green then blue again). The easiest way to mend this is to just reboot your system. Upon logging back in FTL should run.<br />
<br />
The Steam overlay in FTL does not function as it is not a 3D accelerated game. Because of this the desktop notifications will be visible. If playing in fullscreen, therefore, these notifications in some systems may steal focus and revert you back to windowed mode with no way of going back to fullscreen without relaunching. The binaries for FTL on Steam have no DRM and it is possible to run the game ''without'' Steam running, so in some cases that may be optimum - just ensure that you launch FTL via the launcher script in {{ic|''GAME''/data/}} rather than the FTL binary in the $arch directory.<br />
<br />
==== Problems with open-source video driver ====<br />
<br />
FTL may fail to run if you are using an opensource driver for your video card. There are two solutions: install a proprietary video driver or delete (rename if you are unsure) the library "libstdc++.so.6" inside {{ic|''GAME''/data/amd64/lib}}. This is if you are using a 64bit system. In case you are using a 32bit system you have to remove (rename) the same library located into {{ic|''GAME''/data/x86/lib}}.<br />
<br />
==== Artifacts when launching, Problems with openGL ====<br />
<br />
Using the open source drivers, ATI for radeon cards, the game can display artifacts on screen. Run the game with {{ic|1=MESA_GL_VERSION_OVERRIDE=3.0 %command%}}<br />
<br />
=== Game Dev Tycoon ===<br />
<br />
==== Game does not start ====<br />
<br />
You might get an error about missing {{ic|libudev.so.0}}.<br />
<br />
Run the game with {{ic|1=LD_PRELOAD=/usr/lib/libudev.so.1}}.<br />
<br />
=== Garry's Mod ===<br />
<br />
==== Game does not start ====<br />
<br />
When an error about a missing {{ic|client.so}} appears, try the following:<br />
<br />
$ cd ~/.steam/root/steamapps/common/GarrysMod/bin/<br />
$ ln -s libawesomium-1-7.so.0 libawesomium-1-7.so.2<br />
$ ln -s ../garrysmod/bin/client.so ./<br />
<br />
If the error mentions a missing library for {{ic|libgconf-2.so.4}}, install {{AUR|lib32-gconf}}.<br />
<br />
==== Opening some menus causes the game to crash ====<br />
<br />
Most menus work fine, but ones with checkboxes (LAN multiplayer, mounted games list) do not work at all. This is a bug in the menu code.<br />
<br />
If you prefer the default menu style and do not mind a hacky solution: [https://github.com/Facepunch/garrysmod-issues/issues/86#issuecomment-30935491 Simon311] has written code with instructions to fix it.<br />
<br />
If you do not care for the default menu style and want a more stable but feature-incomplete solution, Facepunch developer [https://github.com/robotboy655/gmod-lua-menu robotboy655] has written a new menu.<br />
<br />
==== Game crashes after attempting to join server ====<br />
<br />
While in the process of joining a server, downloading resources, etc, the game seems to hang and after a while, perhaps during the "sending client info" portion the game crashes, usually without any error messages. Error does not give much information, however, the process for Garry's mod is killed.<br />
<br />
This issue arises more often when joining servers with many addons like DarkRP servers specifically.<br />
<br />
The problem seems to correlate with a weak GPU and the game is timing out from the server, so if the GPU is the problem, lowering the graphics settings to the minimum should fix the problem.<br />
<br />
The problem seems to be related to RAM usage, once you hit around 2GB of RAM used, the game will crash. Servers with many addons have much more RAM usage, and lowering graphics settings to the minimum lowers RAM usage and mitigates crashes.<br />
<br />
Using the experimental x86-64 branch may help mitigate this issue, however keep in mind that some addons may return errors while using this branch.<br />
<br />
=== Gods will be watching ===<br />
<br />
Follow [[#OpenSSL 1.0 setup]].<br />
<br />
=== GRID Autosport ===<br />
<br />
Follow [[#OpenSSL 1.0 setup]].<br />
<br />
==== Black screen when trying to play ====<br />
<br />
Run the game with {{ic|1=LC_ALL=C}}.<br />
<br />
=== Guns of Icarus Online ===<br />
<br />
If you encounter problems, check out the error log: <br />
<br />
~/.config/unity3d/Muse Games/GunsOfIcarusOnline/Player.log<br />
<br />
==== version `CURL_OPENSSL_4' not found (required by /usr/lib/libdebuginfod.so.1) ====<br />
<br />
Install the package {{Pkg|lib32-libcurl-compat}} and include 'libcurl.so.4' in your LD_PRELOAD in your shell environment like so:<br />
<br />
export LD_PRELOAD=$LD_PRELOAD libcurl.so.4<br />
<br />
=== Hack 'n' Slash ===<br />
<br />
==== Crashes when trying to load a game ====<br />
<br />
Prepend {{ic|/usr/lib}} to {{ic|LD_LIBRARY_PATH}}.<br />
<br />
=== Hacker Evolution ===<br />
<br />
Requires {{Pkg|lib32-sdl2_mixer}}.<br />
<br />
=== Half-Life ===<br />
<br />
==== Invisible text ====<br />
<br />
Half-Life uses microsoft fonts to display text, see [[Microsoft fonts]] for ways to install them.<br />
<br />
=== Half-Life 2 and episodes ===<br />
<br />
==== Cyrillic fonts problem ====<br />
<br />
This problem can be solved by deleting "Helvetica" font.<br />
<br />
=== Hammerwatch ===<br />
<br />
==== The game does not start via Steam ====<br />
<br />
Prepend {{ic|/usr/lib}} to {{ic|LD_LIBRARY_PATH}}.<br />
<br />
==== No sound ====<br />
<br />
Hammerwatch opens with a popup: "Sound Error" -- "Could not initialize OpenAL, no sounds will be played. Try updating your OpenAL drivers."<br />
<br />
OpenAL, which Hammerwatch uses, defaults to PulseAudio. To change that, add the following line to {{ic|/etc/openal/alsoft.conf}}:<br />
<br />
drivers=alsa,pulse<br />
<br />
This way, Hammerwatch will use ALSA. This solution was found [https://stackoverflow.com/questions/9547396/what-does-al-lib-pulseaudio-c612-context-did-not-connect-access-denied-me here].<br />
<br />
=== Harvest: Massive Encounter ===<br />
<br />
Dependencies:<br />
<br />
* {{AUR|lib32-sfml}}<br />
* {{Pkg|lib32-libjpeg6-turbo}}<br />
* {{Pkg|lib32-nvidia-cg-toolkit}}<br />
* {{pkg|lib32-gtk2}}<br />
* {{pkg|lib32-libvorbis}}<br />
* {{pkg|lib32-openal}}<br />
<br />
==== Compatibility ====<br />
<br />
If the game refuses to launch and throws you into a library installer loop, run the {{ic|Harvest}} executable instead of the {{ic|run_harvest}} script.<br />
<br />
=== Hatoful Boyfriend ===<br />
<br />
==== Japanese text invisible ====<br />
<br />
Install {{pkg|wqy-microhei}} and {{pkg|wqy-microhei-lite}}.<br />
<br />
=== HEARTBEAT ===<br />
<br />
==== If FontConfig Errors on Start ====<br />
<br />
Follow the same process described in [[#CrossCode]].<br />
<br />
=== HuniePop ===<br />
<br />
==== Game crashes upon launch ====<br />
<br />
Install {{pkg|lsb-release}}.<br />
<br />
=== Hyper Light Drifter ===<br />
<br />
==== The controller does not work ====<br />
<br />
[[Install]] {{pkg|lib32-sdl2}} and run the game with {{ic|1=LD_PRELOAD=libSDL2.so}}.<br />
<br />
See the following Steam Community discussions:<br />
<br />
* [https://steamcommunity.com/app/257850/discussions/1/365163686036494421 Controller Issues]<br />
* [https://steamcommunity.com/app/257850/discussions/1/365163686045397160/ Common Bugs + Known Issues]<br />
<br />
It is suggested to run the ''next_update'' branch to get new fixes,<br />
there however currently is a libcurl segfault keeping it from starting without special workarounds.<br />
<br />
==== Missing libcurl.so.4 or version CURL_OPENSSL_3 not found ====<br />
<br />
[[Install]] {{pkg|lib32-libcurl-compat}} and run the game with {{ic|1=LD_PRELOAD=libcurl.so.3}}.<br />
<br />
=== Rome Total War Remastered ===<br />
<br />
==== Slowness of loading screen for open-source drivers ==== <br />
<br />
[[Install]] {{pkg|vulkan-swrast}} and then change the renderer option in the game launcher to llvmpipe after a system restart.<br />
<br />
Once done the loading screen scene would then be fixed and should load up as normal for open-source drivers.<br />
<br />
=== Imperator: Rome ===<br />
<br />
Paradox Launcher freezes or crashes after start. Set your launch options to: <br />
<br />
LD_PRELOAD=/usr/lib/libc.so.6 %command%<br />
<br />
Screen freezes every ~3 seconds.<br />
Run the following command:<br />
<br />
sudo chmod o-rx /dev/input/<br />
<br />
After playing, undo it with:<br />
<br />
sudo chmod o+rx /dev/input/<br />
<br />
=== The Impossible Game ===<br />
<br />
Dependencies:<br />
<br />
* {{pkg|lib32-sdl2}}<br />
* {{pkg|lib32-sdl2_image}}<br />
<br />
=== The Inner World ===<br />
<br />
Requires {{AUR|java-commons-codec}} for sound support.<br />
<br />
==== Bringing up the inventory or main menu ====<br />
<br />
Hold the tab key.<br />
<br />
===== Cutscenes =====<br />
<br />
The game has cutscenes. It starts directly with a cutscene before you start the actual game in the backyard. To see these cutscenes you need to use Oracle's [[Java]] instead of the OpenJDK.<br />
<br />
Furthermore you need the package {{aur|ffmpeg-compat-55}}.<br />
<br />
There seem to be problems with the Steam overlay. Try to run the game directly with {{ic|''GAME''/TIW_start.sh}}.<br />
<br />
Note that cutscenes open in a new window. So pay attention to that and switch to the new window to enjoy the movies.<br />
<br />
See the [https://steamcommunity.com/app/251430/discussions/0/611701360817206606/#c611701360827509770 Steam Forums] for details.<br />
<br />
=== Insurgency ===<br />
<br />
==== Game does not start ====<br />
<br />
Set the following launch option<br />
LD_PRELOAD='/usr/$LIB/libstdc++.so.6:/usr/$LIB/libgcc_s.so.1:/usr/$LIB/libxcb.so.1:/usr/$LIB/libgpg-error.so' %command%<br />
<br />
=== Interloper ===<br />
<br />
Requires {{pkg|alsa-lib}}.<br />
<br />
==== Game does not start ====<br />
<br />
The game can sometimes segfault due to an incompatibility with the Steam Runtime's {{ic|libasound.so.2}}.<br />
<br />
=== Invisible Apartment ===<br />
<br />
Requires {{pkg|qt5-multimedia}}.<br />
<br />
==== Game does not start ====<br />
<br />
If the game does not run when you launch it via Steam, try to directly run {{ic|./ia1}} in the game directory.<br />
<br />
=== Joe Danger 2: The Movie ===<br />
<br />
Requires {{pkg|lib32-libpulse}}.<br />
<br />
==== Compatibility ====<br />
<br />
Game only worked after obtaining from the [https://www.humblebundle.com/ Humble Bundle] directly and {{pkg|lib32-libpulse}} was installed.<br />
<br />
=== Kerbal Space Program ===<br />
<br />
See [[Kerbal Space Program]].<br />
<br />
=== Killing Floor ===<br />
<br />
==== Cannot change screen resolution ====<br />
<br />
If trying to modify the resolution in-game crashes your desktop environment, edit {{ic|~/.killingfloor/System/KillingFloor.ini}}:<br />
<br />
[WinDrv.WindowsClient]<br />
WindowedViewportX=''width''<br />
WindowedViewportY=''height''<br />
FullscreenViewportX=''width''<br />
FullscreenViewportY=''height''<br />
MenuViewportX=''width''<br />
MenuViewportY=''height''<br />
<br />
[SDLDrv.SDLClient]<br />
WindowedViewportX=''width''<br />
WindowedViewportY=''height''<br />
FullscreenViewportX=''width''<br />
FullscreenViewportY=''height''<br />
MenuViewportX=''width''<br />
MenuViewportY=''height''<br />
<br />
==== Windowed mode ====<br />
<br />
Uncheck fullscreen in the options menu, and press {{ic|Ctrl+g}} to stop mouse capturing.<br />
<br />
==== Stuttering sound ====<br />
<br />
KillingFloor comes with its own OpenAL library {{ic|''GAME''/System/openal.so}}.<br />
<br />
Back it up, [[install]] {{pkg|openal}} or {{pkg|lib32-openal}} (if using a 64bit system).<br />
<br />
Then symlink the installed system library ({{ic|/usr/lib32/libopenal.so.1}} or {{ic|/usr/lib/libopenal.so.1}}) to {{ic|openal.so}}.<br />
<br />
=== Left for Dead 2 ===<br />
<br />
==== Missing Chinese font ====<br />
<br />
L4D2 Requires {{Pkg|wqy-zenhei}}. Or add the following lines to {{ic|~/.config/fontconfig/fonts.conf}}<br />
<br />
<match target="pattern"><br />
<test qual="any" name="family"><br />
<string>WenQuanYi Zen Hei</string><br />
</test><br />
<edit name="family" mode="assign" binding="same"><br />
<string>Source Han Sans CN</string><br />
</edit><br />
</match><br />
<br />
=== Lethal League ===<br />
<br />
Requires {{Pkg|lib32-glew1.10}}.<br />
<br />
=== Life is Strange ===<br />
<br />
Requires {{Pkg|sdl2_image}} {{Pkg|librtmp0}} {{Pkg|libidn11}} {{AUR|gconf}}.<br />
<br />
=== Little Racers STREET ===<br />
<br />
Install {{Pkg|sdl2_mixer}}.<br />
<br />
Move/backup {{ic|''GAME''/lib64/libSDL2_mixer-2.0.so.0}}.<br />
<br />
Symlink {{ic|/usr/lib/libSDL2_mixer-2.0.so.0}} to {{ic|''GAME''/lib64/libSDL2_mixer-2.0.so.0}}.<br />
<br />
=== The Long Dark ===<br />
<br />
==== Game does not start ====<br />
<br />
The 64-bit version fails to start. Either use the 32-bit version {{ic|tld.x86}} in the game directory or start the 64-bit version like so:<br />
<br />
LD_PRELOAD=~/.steam/root/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 ./tld.x86_64<br />
<br />
==== Game starts, but some overlay text is missing and cutscenes shows black screen ====<br />
<br />
In addition to the command above, add the following to the Steam launch command:<br />
<br />
-screen-fullscreen 0 -screen-width WIDTH_PIXELS -screen-height HEIGHT_PIXELS<br />
<br />
For example, if you have a screen resolution of 1280x720 and are launching the x64 version from the terminal (within the directory which contains the binaries), the full command would be:<br />
<br />
LD_PRELOAD=~/.steam/root/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 ./tld.x86_64 -screen-fullscreen 0 -screen-width 1280 -screen-height 720<br />
<br />
and from Steam, the complete game [[launch option]]s would be:<br />
<br />
LD_PRELOAD=~/.steam/root/ubuntu12_32/steam-runtime/amd64/usr/lib/x86_64-linux-gnu/libSDL2-2.0.so.0 %command% -screen-fullscreen 0 -screen-width 1280 -screen-height 720<br />
<br />
==== Cutscenes are still black ====<br />
<br />
Turn off Vertical Sync in the Display options, and/or set POST FX to Low in the Quality options, and/or turn global Quality options down a notch.<br />
<br />
==== Cursor disappears ====<br />
<br />
Go to Options > Controls, and set mouse locking to unlocked.<br />
<br />
The options is visible only if you are navigating using your (invisible) mouse. It will not show up when navigating with a controller.<br />
One solution is to go to Options -> Controls with a controller before switching to the mouse and trying to blindly it the setting.<br />
<br />
=== Grand Theft Auto V ===<br />
<br />
==== Game crashes in Online ====<br />
<br />
If you experience crashes in GTA Online (e.g. when creating a new character), set these launch options:<br />
<br />
PROTON_NO_ESYNC=1 WINEDLLOVERRIDES=winedbg.exe=d %command%<br />
<br />
=== Graphical Issues using a NVIDIA GPU ===<br />
<br />
Try launch options: -force-glcore42 -force-clamped<br />
<br />
=== Magicka 2 ===<br />
<br />
==== Indefinitely stuck at start ====<br />
<br />
The game does not start if the output of the command "ip -s link" is longer than 4096 characters. That is because, in the function bitsquid::network_info(char*), where they query the networking information, they do not handle that case correctly.<br />
See [https://i.imgur.com/AOTLoTY.png this picture] for reference.<br />
It was reported to upstream (Pieces Interactive) but Magicka 2 does not seem to be maintained anymore.<br />
<br />
A dirty fix is to wrap your ip binary, as such:<br />
<br />
{{bc|1=<br />
#!/bin/sh<br />
if [ "$*" = "-s link" ]; then<br />
echo "<paste a smaller subset of the normal output>"<br />
else<br />
/path/to/your/real/ip "$@"<br />
fi<br />
}}<br />
<br />
=== Mark of the Ninja ===<br />
<br />
==== Bad sound ====<br />
<br />
Prepend {{ic|/usr/lib}} to {{ic|LD_LIBRARY_PATH}}.<br />
<br />
=== Metro: Last Light ===<br />
<br />
The game does not allow you to change its resolution on a multi-monitor setup on GNOME with the AMD Catalyst drivers. A temporary workaround is to disable the side monitors.<br />
Jason over at [https://unencumberedbyfacts.com/2013/11/20/multiple-monitor-gaming-on-linux/ unencumbered by facts] managed to get it working with his multi-monitor setup using a single display server, he however is using Nvidia.<br />
<br />
=== Metro: 2033 Redux ===<br />
<br />
==== No sound ====<br />
<br />
Install {{Pkg|pulseaudio-alsa}}<br />
<br />
==== No image ====<br />
<br />
Try setting {{ic|r_fullscreen off}} in {{ic|~/.local/share/Steam/steamapps/common/Metro 2033 Redux/user.cfg}}.<br />
<br />
=== Middle-earth: Shadow of Mordor ===<br />
<br />
==== Floating heads ====<br />
<br />
Run the game with {{ic|1=__GL_ShaderPortabilityWarnings=0}}.<br />
<br />
=== Mount & Blade: Warband ===<br />
<br />
==== Segmentation fault (core dumped) with wayland ====<br />
<br />
Use [[Xorg]] instead.<br />
<br />
==== DLC Chooser ====<br />
<br />
Requires {{aur|lib32-nas}}.<br />
<br />
==== Crash on startup ====<br />
<br />
Set launch options to: <br />
LD_LIBRARY_PATH="." %command%<br />
<br />
=== Move or Die ===<br />
<br />
==== No Sound ====<br />
<br />
Install {{pkg|lib32-libpulse}}.<br />
Remove file "Move or Die/Love/linux32/libogg.so.0"<br />
<br />
=== Multiwinia ===<br />
<br />
Requires {{pkg|lib32-openal}}.<br />
<br />
==== Crash on startup ====<br />
<br />
If Multiwinia crashes on startup on X64 systems, force launching the 32-bit executable by replacing {{ic|''GAME''/run_steam.sh}} with the following script:<br />
<br />
{{bc|<br />
#!/bin/sh<br />
./multiwinia.bin.x86<br />
}}<br />
<br />
See [https://steamcommunity.com/app/1530/discussions/0/864969481950542663/#c558746995160431396].<br />
<br />
=== Natural Selection 2 ===<br />
<br />
{{Pkg|sndio}} is required, furthermore, you must also execute<br />
$ ln -s /usr/lib/libsndio.so x64/libsndio.so.6.1<br />
within the root of the NS2 directory.<br />
This is because NS2 uses an older outdated version of sndio, but it is still compatible with the new version, thankfully.<br />
<br />
For a more minimal solution, one can attempt to set the audio driver used through the environment variable {{ic|SDL_AUDIODRIVER}}. For example, {{ic|1=SDL_AUDIODRIVER=sndio}} or {{ic|1=SDL_AUDIODRIVER=alsa}}.<br />
<br />
The environment variable {{ic|SDL_VIDEODRIVER}} must not be set to {{ic|wayland}}.<br />
Try setting {{ic|SDL_VIDEODRIVER}} to {{ic|x11}} if it still does not work.<br />
<br />
=== No Man's Sky ===<br />
<br />
==== Black screen at start ====<br />
<br />
Edit {{ic|~/Steam/SteamApps/common/No Man's Sky/Binaries/SETTINGS/TKGRAPHICSSETTINGS.MXML}} and set {{ic|FullScreen}} to {{ic|false}} and {{ic|Borderless}} to {{ic|true}}.<br />
<br />
==== White screen at start ====<br />
<br />
If you get a white screen, it may seem like the game has froze, but it has not. Hold down {{ic|e}} to continue.<br />
<br />
=== Nuclear Throne ===<br />
<br />
==== Missing libcurl.so.4 or version CURL_OPENSSL_3 not found ====<br />
<br />
[[Install]] {{pkg|lib32-libcurl-compat}} and run the game with {{ic|1=LD_PRELOAD=libcurl.so.3}}.<br />
<br />
=== OneShot ===<br />
<br />
==== Game fails to start ====<br />
<br />
This problem occurs because the game use outdated libraries. Go to the game directory and remove libdrm.so.2, libGLdispatch.so.0, libstdc++.so.6 and librt.so.1. Those files usually have an equivalent already installed on the system.<br />
<br />
==== File _______ will not run ====<br />
<br />
The executable _______ may fail when run from the Documents folder. It also exists in the game directory and will run from there.<br />
<br />
=== Oxygen Not Included ===<br />
<br />
==== World generation hangs ====<br />
<br />
This problem occurs with locales that use comas instead of dots to separate decimals.<br />
<br />
Set launch options in steam to {{ic|1=LANG=C %command%}}.[https://steamcommunity.com/app/457140/discussions/3/1488866180617243731/#c1488866813753688864]<br />
<br />
=== Penumbra: Overture ===<br />
<br />
Dependencies:<br />
<br />
* {{pkg|lib32-glu}}<br />
* {{pkg|lib32-libvorbis}}<br />
* {{pkg|lib32-libxft}}<br />
* {{pkg|lib32-openal}}<br />
* {{pkg|lib32-sdl_image}}<br />
* {{pkg|lib32-sdl_ttf}}<br />
<br />
==== Windowed mode ====<br />
<br />
There is no in-game option to change to the windowed mode, you will have to edit {{ic|~/.frictionalgames/Penumbra/Overture/settings.cfg}} to activate it.<br />
<br />
Find {{ic|1=FullScreen="true"}} and change it to {{ic|1=FullScreen="false"}}, after this the game should start in windowed mode.<br />
<br />
=== Portal 2 ===<br />
<br />
==== Game does not start ====<br />
<br />
Several OpenGL-related errors (such as {{ic|PROBLEM: You appear to have OpenGL 1.4.0, but we need at least 2.0.0!}} or {{ic|libGL error: driver pointer missing}}) are caused by Portal&nbsp;2 bundling an old libstdc++ file. This error is especially common with open source Radeon drivers ({{ic|radeonsi}}).<br />
<br />
A problem with libstdc can be fixed by running the game with {{ic|1=LD_PRELOAD='/usr/$LIB/libstdc++.so.6'}}.<br />
<br />
==== Resolution too low ====<br />
<br />
When the game starts with a resolution so low that you cannot reach the game settings,<br />
run the game in windowed mode using the {{ic|-windowed}} flag.<br />
<br />
==== Missing non Latin font ====<br />
<br />
The phenomenon is no menu in Portal. Portal and Portal2 use Helvetica, add the following lines to {{ic|~/.config/fontconfig/fonts.conf}}:<br />
<br />
<match target="pattern"><br />
<test qual="any" name="family"><br />
<string>Helvetica</string><br />
</test><br />
<edit name="family" mode="assign" binding="same"><br />
<string>Source Han Sans CN</string><br />
</edit><br />
</match><br />
<br />
You can replace "Source Han Sans CN" by your favoriate and existing font.<br />
<br />
=== Prison Architect ===<br />
<br />
==== ALSA error when using PulseAudio or Pipewire ====<br />
<br />
The error:<br />
<br />
{{ic|ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave}}<br />
<br />
was resolved by installing:<br />
<br />
* {{pkg|pulseaudio-alsa}}<br />
* {{pkg|lib32-libpulse}}<br />
* {{pkg|pipewire-alsa}}<br />
<br />
per [[PulseAudio#ALSA]].<br />
<br />
Alternatively, if running the game through Steam, you can force the game to be ran through proton, and that can resolve other audio errors.<br />
<br />
You can do this by opening the game's properties through steam, and under "general" tick the "Force the use of a specific Steam Play comparability tool", and then select a proton version from the dropdown below<br />
<br />
==== Game only starting in safe mode ====<br />
<br />
If the game does not start, but steam thinks it is running, probably the Paradox launcher has problems running properly.<br><br />
If this is the case, you will find some processes running in background:<br />
<br />
{{ic|<nowiki> ps -ef|grep paradoxlauncher </nowiki>}}<br />
<br />
Kill them all, then modify the game startup options as follows:<br />
<br />
{{ic|1= LD_PRELOAD=/usr/lib64/libc.so %command% }}<br />
<br />
Eventually, if the above option has not worked, an option to skip it:<br />
<br />
{{ic|./PrisonArchitect %command% }}<br />
<br />
Note: even if we are using another executable to start the game, %command% has to be added at the end of the command to trick Steam.<br />
<br />
=== Project Zomboid ===<br />
<br />
Requires {{AUR|jre7}}.<br />
<br />
==== No sound ====<br />
<br />
Prepend {{ic|/usr/lib}} to {{ic|LD_LIBRARY_PATH}}.<br />
<br />
In the game, go to the options and set all audio to the proper volume.<br />
<br />
=== Redshirt ===<br />
<br />
Requires {{pkg|lib32-libpulse}} if you use PulseAudio.<br />
<br />
=== Revenge of the Titans ===<br />
<br />
Requires {{pkg|libxtst}} and {{pkg|lib32-libxtst}}.<br />
<br />
=== Rise of the Tomb Raider ===<br />
<br />
Run in an X session.<br />
<br />
=== Risk of Rain ===<br />
<br />
Requires {{pkg|lib32-libcurl-compat}}.<br />
Refer to [[#Missing libcurl.so.4 or version CURL_OPENSSL_3 not found]].<br />
<br />
=== Rock Boshers DX: Directors Cut ===<br />
<br />
Requires {{Pkg|lib32-libcaca}}.<br />
<br />
=== Saints Row: The Third ===<br />
<br />
==== Impossible to save custom display settings ====<br />
<br />
Although game settings menu allows to choose custom display settings, the game may have problems saving them.<br />
<br />
In such case, adjust these settings manually in the game's {{ic|display.ini}} file at:<br />
<br />
"${HOME}/.local/share/Steam/steamapps/common/Saints Row the Third/display.ini"<br />
<br />
The comments in this file explain well all the settings and acceptable values.<br />
<br />
==== Incorrect screen resolution in game ====<br />
<br />
This can occur when game is launched in a multi-head environment, with some monitors rotated, etc., so the game detects available screen resolutions incorrectly.<br />
<br />
In such case, adjust {{ic|1=ResolutionWidth}} and {{ic|1=ResolutionHeight}} options in the {{ic|display.ini}} file. Also, one must set option {{ic|1=VerifyResolution = false}}.<br />
<br />
=== Saints Row IV ===<br />
<br />
==== Game fails to launch after update to new Nvidia drivers ====<br />
<br />
{{Accuracy|General settings not specific to this game}}<br />
<br />
Run the game with {{ic|/usr/lib32/libGLX_nvidia.so}} appended to the {{ic|LD_PRELOAD}}.<br />
<br />
==== Game causes GPU lockup with mesa drivers ====<br />
<br />
Saints Rows IV can cause a GPU lockup when trying to play on certain AMD<br />
hardware using open source drivers: [https://bugs.freedesktop.org/show_bug.cgi?id=93475 Bug 93475].<br />
<br />
A workaround is to run the game with {{ic|1=R600_DEBUG=nosb}}.<br />
<br />
=== Serious Sam 3: BFE ===<br />
<br />
==== No audio ====<br />
<br />
Try running:<br />
<br />
# mkdir -p /usr/lib/i386-linux-gnu/alsa-lib/<br />
# ln -s /usr/lib32/alsa-lib/libasound_module_pcm_pulse.so /usr/lib/i386-linux-gnu/alsa-lib/<br />
<br />
If that does not work, try tweaking {{ic|~/.alsoftrc}} as proposed by the [https://steamcommunity.com/app/221410/discussions/3/846940248238406974/ Steam community] (Serious Sam 3: BFE uses OpenAL to output sound). If you are not using Pulse Audio, you may want to write the following configuration:<br />
<br />
{{hc|~/.alsoftrc|<nowiki><br />
[general]<br />
drivers = alsa<br />
[alsa]<br />
device = default<br />
capture = default<br />
mmap = true<br />
</nowiki>}}<br />
<br />
=== SJ-19 Learns to Love ===<br />
<br />
If the game crashes at startup with this error in Steam's output:<br />
<br />
/home/username/.local/share/Steam/steamapps/common/SJ-19 Learns To Love/sj-19-linux/sj-19-learns-to-love.x86_64: error while loading shared libraries: libsteam_api.so: cannot open shared object file: No such file or directory<br />
<br />
Right click the game in steam, select Properties, and set this in Launch Options:<br />
<br />
LD_LIBRARY_PATH=./sj-19-linux %command%<br />
<br />
=== Slay the Spire ===<br />
<br />
If the game does not start or crashes at startup, install {{pkg|xorg-xrandr}}.<br />
<br />
If the game crashes with the xrandr stacktrace:<br />
<br />
{{bc|<nowiki><br />
Caused by: java.lang.ArrayIndexOutOfBoundsException: 0<br />
at org.lwjgl.opengl.XRandR.findPrimary(XRandR.java:326)<br />
at org.lwjgl.opengl.XRandR.ScreentoDisplayMode(XRandR.java:315)<br />
</nowiki>}}<br />
It is likely due to a [https://github.com/LWJGL/lwjgl/issues/112#issuecomment-291598776 known bug in LWJGL]. The workaround is to change the xrandr configuration to only contain the resolution (For example: {{ic|2560x1440_60.00}} should become {{ic|2560x1440}}.<br />
<br />
If the game does not move sink input, you can edit the following file to allow sink moves:<br />
<br />
{{hc|~/.alsoftrc|<nowiki><br />
[pulse]<br />
allow-moves=yes<br />
</nowiki>}}<br />
<br />
=== Stick Fight: The Game ===<br />
<br />
If the game does not launch, try appending {{ic|1=PROTON_USE_WINED3D=1 %command%}} to force using WINE direct3D. To do this you must have {{pkg|wine}} installed.<br />
<br />
=== Songbringer ===<br />
<br />
==== Launch error with Wayland ====<br />
<br />
Install {{pkg|glfw-x11}} and run the game with {{ic|1=LD_PRELOAD=/usr/lib/libglfw.so.3}}.<br />
<br />
=== Space Pirates and Zombies ===<br />
<br />
Requires {{pkg|lib32-openal}}.<br />
<br />
==== No audio ====<br />
<br />
Try running:<br />
<br />
# mkdir -p /usr/lib/i386-linux-gnu/alsa-lib/<br />
# ln -s /usr/lib32/alsa-lib/libasound_module_pcm_pulse.so /usr/lib/i386-linux-gnu/alsa-lib/<br />
<br />
If that does not work, try tweaking {{ic|~/.alsoftrc}} as proposed by the Steam community (Serious Sam 3: BFE uses OpenAL to output sound). If you are not using Pulse Audio, you may want to write the following configuration:<br />
<br />
{{hc|~/.alsoftrc|<nowiki><br />
[general]<br />
drivers = alsa<br />
[alsa]<br />
device = default<br />
capture = default<br />
mmap = true<br />
</nowiki>}}<br />
<br />
=== Spacechem ===<br />
<br />
Dependencies:<br />
<br />
* {{Pkg|lib32-sdl_mixer}}<br />
* {{pkg|lib32-sdl_image}}<br />
* {{pkg|lib32-sqlite}}<br />
<br />
==== Game crash ====<br />
<br />
The shipped x86 version of Spacechem does not work on x64 with the game's own libSDL* files, and crashes with some strange output.<br />
<br />
To solve this just remove the three files {{ic|libSDL-1.2.so.0}}, {{ic|libSDL_image-1.2.so.0}}, {{ic|libSDL_mixer-1.2.so.0}} from the game directory.<br />
<br />
=== Splice ===<br />
<br />
Requires {{pkg|glu}}.<br />
<br />
=== The Stanley Parable ===<br />
<br />
==== Game will not start ====<br />
<br />
As discussed in the Steam store page, remove {{ic|bin/libstdc++.so.6}} from the game folder.<br />
<br />
=== Shadow Tactics: Blades of the Shogun ===<br />
<br />
Dependencies:<br />
<br />
* {{AUR|lib32-libstdc++5}}<br />
* {{pkg|lib32-libxcursor}}<br />
* {{pkg|lib32-libxrandr}}<br />
<br />
=== Shadows of Adam ===<br />
<br />
==== Old Pango Version Dependency ====<br />
<br />
Build [https://github.com/archlinux/svntogit-packages/blob/3884efafe7de661e3aa2ef5467991648919fea74/trunk/PKGBUILD pango 1.27.1] and copy the libpango* libraries into the game directory as recommended [https://steamcommunity.com/app/506510/discussions/0/135510393195664956/?ctp=16#c2527030866868228210 here].<br />
<br />
=== Stardew Valley ===<br />
<br />
==== Unable to move or input text ====<br />
<br />
When in game, you are stuck in your bed as you cannot move your character or you cannot enter text into the input fields when starting a new game. This is a bug with the SDL2 lib bundled with the game.<br />
<br />
Install {{pkg|sdl2}}.<br />
<br />
Modify this config line:<br />
{{hc|~/.steam/steam/steamapps/common/Stardew\ Valley/MonoGame.Framework.dll.config|<nowiki><br />
<dllmap dll="SDL2.dll" os="linux" cpu="x86-64" target="./lib64/libSDL2-2.0.so.0"/><br />
</nowiki>}}<br />
<br />
To this (the period is removed at the beginning of target):<br />
{{hc|~/.steam/steam/steamapps/common/Stardew\ Valley/MonoGame.Framework.dll.config|<nowiki><br />
<dllmap dll="SDL2.dll" os="linux" cpu="x86-64" target="/lib64/libSDL2-2.0.so.0"/><br />
</nowiki>}}<br />
<br />
=== Steel Storm: Burning Retribution ===<br />
<br />
==== Start with black screen ====<br />
<br />
The game by default tries to launch in fullscreen mode with a resolution of 1024x768,<br />
which does not work on some devices (for example the Samsung Series9 laptop with Intel hd4000 video).<br />
<br />
Run the game in windowed mode by using the {{ic|-window}} flag. Then change the resolution in-game.<br />
<br />
=== Stellaris ===<br />
<br />
==== No window opening, only sound ====<br />
<br />
Happens with some AMD GPU and mesa combination, set multi_sampling=0 in ~/.local/share/Paradox\ Interactive/Stellaris/settings.txt.<br />
<br />
On some window managers (eg Xmonad) you should set fullScreen=no.<br />
<br />
==== Immediate crash to desktop ====<br />
<br />
It seems that Stellaris requires a 32bit libnss_sss.so.2 to operate. You can confirm if this is your problem by running <br />
# strace ~/.local/share/Steam/steamapps/common/Stellaris/stellaris 2>&1 | grep sss <br />
and seeing if you get output like <br />
# openat(AT_FDCWD, "/usr/lib32/tls/i686/sse2/libnss_sss.so.2", O_RDONLY|O_LARGEFILE|O_CLOEXEC) = -1 ENOENT (No such file or directory)<br />
<br />
If this is indeed your problem, download the libnss-sss package from Ubuntu's repository [https://packages.ubuntu.com/bionic/i386/libnss-sss/download], extract the libnss_sss.so.2 from the downloaded package, and place it at ~/.local/share/Steam/steamapps/common/Stellaris. The game should now load properly.<br />
<br />
=== Stephen's Sausage Roll ===<br />
<br />
==== No sound ====<br />
<br />
If using [[Steam/Troubleshooting#Steam native runtime|native libraries]] and {{pkg|libpulse}} is installed, Unity may try to use that library for sound and fail.<br />
To test if this is the problem, try removing {{pkg|libpulse}} or renaming the package files that are named {{ic|libpulse-simple*}}. To see which {{pkg|libpulse}} files are relevant, run:<br />
<br />
{{hc|$ pacman -Qql libpulse <nowiki>|</nowiki> grep /usr/lib/libpulse-simple|<br />
/usr/lib/libpulse-simple.so<br />
/usr/lib/libpulse-simple.so.0<br />
/usr/lib/libpulse-simple.so.0.1.0}}<br />
<br />
If renaming any of those files works for you, you can proceed with the following instructions (revert any renaming you just did). Browse to the game's directory:<br />
<br />
$ cd "$HOME/.steam/root/steamapps/common/Stephen's Sausage Roll"<br />
<br />
And create a sub-directory that we can use to hold 0-byte look-alike library files:<br />
<br />
$ mkdir noload/<br />
<br />
Use {{ic|touch}} to create 0-byte versions of the above files that we want the dynamic linker to skip, e.g.:<br />
<br />
$ touch noload/{libpulse-simple.so,libpulse-simple.so.0,libpulse-simple.so.0.1.0}<br />
<br />
{{Note|Only a 0-byte {{ic|libpulse-simple.so.0}} file may be required.}}<br />
<br />
After you have created these 0-byte files, you can now attempt to run the game binary directly, telling the dynamic linker to use our 0-byte files:<br />
<br />
$ LD_LIBRARY_PATH="noload/:$LD_LIBRARY_PATH" ./Sausage.x86_64<br />
<br />
If everything works up to this point, prepend {{ic|noload/}} to your {{ic|LD_LIBRARY_PATH}}.<br />
<br />
Again, this should work because Steam checks for a {{ic|noload/}} directory relative to the game's directory. The dynamic linker should respect the {{ic|$LD_LIBRARY_PATH}} variable and fail to load the necessary {{pkg|libpulse}} files. The game should then fallback to plain ALSA.<br />
<br />
=== Superbrothers: Sword & Sworcery EP ===<br />
<br />
Dependencies:<br />
<br />
* {{pkg|lib32-glu}}<br />
* {{pkg|lib32-libpulse}} if you use PulseAudio<br />
<br />
The game bundles an outdated version of libstdc++ which prevents the game from starting. [https://steamcommunity.com/app/204060/discussions/0/364039785161291413] The following can be observed when you run Steam and S&S from the terminal:<br />
<br />
libGL error: unable to load driver: i965_dri.so<br />
libGL error: driver pointer missing<br />
libGL error: failed to load driver: i965<br />
libGL error: unable to load driver: i965_dri.so<br />
libGL error: driver pointer missing<br />
libGL error: failed to load driver: i965<br />
libGL error: unable to load driver: swrast_dri.so<br />
libGL error: failed to load driver: swrast<br />
<br />
To solve this problem remove {{ic|''GAME''/lib/libstdc++.so.6*}}. After that the game will use the libstdc++ from Steam.<br />
<br />
=== System Shock 2 ===<br />
<br />
You get these errors when running it with the native client:<br />
<br />
C:\windows\system32\winedevice.exe: symbol lookup error: /usr/lib32/libX11.so.6: undefined symbol: xcb_wait_for_reply64<br />
C:\windows\system32\wineboot.exe: symbol lookup error: /usr/lib32/libX11.so.6: undefined symbol: xcb_wait_for_reply64<br />
<br />
Just delete or rename the libxcb library it got shipped with:<br />
<br />
mv /mnt/olhdd/steam/steamapps/common/SS2/lib/libxcb.so.1{,.old}<br />
mv /mnt/olhdd/steam/steamapps/common/SS2/lib/libxcb.so.1.1.0{,.old}<br />
<br />
==== Game will not launch ====<br />
<br />
If you encounter the game not launching do the following:<br />
<br />
Cut & Paste libsteam_api.so from the "SS2/Bin" folder within the main steam common folder and transfer it to "SS2" main game folder not the sub folder "SS2/bin"<br />
<br />
After Cut & Paste put LD_PRELOAD='/usr/$LIB/libxcb.so.1' %command% into the Launch options <br />
<br />
Once all of these have been implemented the game should work after hitting play on steam.<br />
<br />
==== Resolution fix ====<br />
<br />
You may encounter some resolution problems with this game on steam not working properly in full screen mode. Do the following:<br />
<br />
Open cam.cfg in the SS2 folder you may have to search for it via the search mode while in the game folder:<br />
<br />
Place game_screen_size 1024 768 or game_screen_size 1920 1080 depending on your resolution & put game_full_screen 1 into bottom of the cam.cfg file. <br />
<br />
Then go to cam_ext.cfg and next to the display setting place a simi-colon prefix next to the use_d3d_display option so it should be like this ;use_d3d_display it should then properly not go off-screen and should stay full screen within the active main screen.<br />
<br />
=== Tabletop Simulator ===<br />
<br />
==== CJK characters not showing in game ====<br />
<br />
Install {{pkg|wqy-microhei}} and {{pkg|wqy-microhei-lite}}.<br />
<br />
=== Team Fortress 2 ===<br />
<br />
Requires {{Pkg|lib32-libpng12}}.<br />
<br />
==== HRTF setup ====<br />
<br />
Assuming HRTF (head-related transfer function) has been properly set up in the operating system, HRTF will not be enabled unless you disable the original processing. To do so, use<br />
<br />
dsp_slow_cpu 1<br />
<br />
For best results, also change the following:<br />
<br />
snd_spatialize_roundrobin 1<br />
dsp_enhance_stereo 0<br />
snd_pitchquality 1<br />
<br />
==== Loading screen freeze ====<br />
<br />
If you are a non-English (speaking) user, you have to enable "en_US.UTF-8" in the locale.gen! Generate a new locale after that.<br />
<br />
==== No audio ====<br />
<br />
It happens if there is no PulseAudio in your system.<br />
If you want to use [[ALSA]], you need to launch Steam or the game directly with {{ic|1=SDL_AUDIODRIVER=alsa}}<br />
(From [https://steamcommunity.com/app/221410/discussions/0/882966056462819091/#c882966056470753683 SteamCommunity]).<br />
<br />
If it still does not work, you may also need to set the environment variable AUDIODEV. For instance {{ic|1=AUDIODEV=Live}}. Use {{ic|aplay -l}} to list the available sound cards.<br />
<br />
==== Slow loading textures ====<br />
<br />
If you are using Chris' FPS Configs or any other FPS config, you may have set {{ic|mat_picmip}} to {{ic|2}}. This spawns multiple threads for texture loading, which may cause more jittering and lag on Linux, especially on alternative kernels. Try setting it to {{ic|-1}}, the default.<br />
<br />
==== "Invalid color format" Error at loading screen on integrated Intel Atom/BayTrail HD Graphics ====<br />
<br />
Add the following to the game startup options:<br />
{{ic| -force_vendor_id 0x10DE -force_device_id 0x1180 }}<br />
<br />
These options deceive the game engine that we are having a Nvidia GPU, not Intel/AMD.<br />
<br />
==== Wrong mouse sensitivity ====<br />
<br />
TF2 ships with an old version of libSDL2.so. Adding this to the startup options loads the system version:<br />
{{ic|1= LD_PRELOAD="/usr/\$LIB/libSDL2.so:$LD_PRELOAD" %command% }}<br />
<br />
(From [https://github.com/ValveSoftware/Source-1-Games/issues/1834#issuecomment-428303829 GitHub]).<br />
<br />
=== Terraria ===<br />
<br />
See the KNOWN ISSUES & WORKAROUNDS section of the [https://forums.terraria.org/index.php?threads/terraria-1-3-0-8-can-mac-linux-come-out-play.30287/ release announcement].<br />
<br />
==== Input Issues ====<br />
<br />
The symptoms of this problem are: When moving after standing still, your character seems to vary their speed, if wearing running boots they do not activate. When jumping with an item for double jumping sometimes you double jump even if you just jumped once. Going up/down ropes seems slow/choppy.<br />
<br />
The solution is to preload the system SDL2 libraries: {{ic|1=LD_PRELOAD='/usr/$LIB/libSDL2-2.0.so:/usr/lib32/libSDL2-2.0.so' }} For more information: [https://forums.terraria.org/index.php?threads/keyboard-input-bug-involving-linux.56763/page-2#post-1533051 Terraria Forums]{{Dead link|2021|05|17|status=403}}<br />
<br />
=== This War of Mine ===<br />
<br />
==== Game does not start ====<br />
<br />
This happens because of an incompatibility with the newer version of {{ic|lib32-curl}}. To fix the problem , set your [[launch option]]s to:<br />
LD_PRELOAD=./libcurl.so.4 %command%<br />
<br />
==== Sound glitches with Steam native ====<br />
<br />
The bundled {{ic|libOpenAL}} might not work correctly, try symlinking {{ic|/usr/lib32/libopenal.so}} to {{ic|''GAME''/libOpenAL.so}}.<br />
<br />
=== Ticket to Ride ===<br />
<br />
Dependencies:<br />
<br />
* {{AUR|lib32-gstreamer0.10-base}}<br />
* {{AUR|lib32-pangox-compat}}<br />
<br />
As lib32-gstreamer0.10-base is quite hard to build you can use [[Unofficial_user_repositories#alucryd-multilib|alucryd-multilib]] repo for this package<br />
<br />
=== The Tiny Bang Story ===<br />
<br />
==== Missing libGLEW.so.1.6 ====<br />
<br />
# ln -s /usr/lib32/libGLEW.so.1.10.0 /usr/lib32/libGLEW.so.1.6<br />
<br />
=== Tomb Raider (2013) ===<br />
<br />
==== Game immediately closes when running with steam-native ====<br />
<br />
Tomb Raider has a very heavy amount of dependency on the Steam runtime, the easiest solution is to just run it using the runtime.<br />
<br />
==== Steam Controller not working in-game ====<br />
<br />
If your Steam Controller is correctly recognized and paired but still not working in-game try the following:<br />
<br />
* In Steam, non Big Screen, go to ''Settings > Account > Beta participation > Change...'' and in the dropdown select box select Steam Beta Update<br />
* Restart Steam<br />
* Go to Big Screen and start Tomb Raider<br />
<br />
Correctly recognized means you can control the desktop mouse and Steam in Big Picture mode and the controller is shown in the Big Picture settings.<br />
<br />
==== Failed to Initialize Direct3D ====<br />
<br />
This can happen when switching monitors.<br />
<br />
You need to manually edit the preferences file (found in ~/.local/share/feral-interactive/Tomb Raider/) and change the ExclusiveFullscreen option to 0. After this you should be able to successfully start the game (after which you may exit and revert that option to a 1 to restore fullscreen).<br />
<br />
==== Stuck at the start menu ====<br />
<br />
Tomb Raider for Linux will not start if there are any active VPNs that use TUN devices. This is because it makes incorrect assumptions about the return value of {{ic|getifaddrs()}}. The only reason it calls {{ic|getifaddrs()}} is to get the MAC address for a Version 1 UUID, and fall back to a different algorithm if {{ic|getifaddrs()}} returns no interfaces at all.<br />
<br />
One optional solution for such a situation is listed down below, which fixes assumptions made by Tomb Raiders about the output of {{ic|getifaddrs()}} (see [https://github.com/PinkPandaKatie/tomb_raider_vpn_fix/releases tomb_raider_vpn_fix/releases] for the original code):<br />
<br />
{{bc|1=<br />
#include <stdio.h><br />
#include <errno.h><br />
#include <ifaddrs.h><br />
<br />
int getifaddrs(struct ifaddrs **ifap) {<br />
fprintf(stderr, "\n\n\n---------------- dummied out getifaddrs()!\n\n\n");<br />
*ifap = NULL;<br />
return 0;<br />
}<br />
<br />
void freeifaddrs(struct ifaddrs *ifap) {<br />
/* do nothing */<br />
}<br />
}}<br />
<br />
Compile it using<br />
<br />
$ gcc -m32 -fPIC -shared ''file_name''.c -o ''file_name''.so -ldl -Wall<br />
<br />
Then use the following launch option:<br />
<br />
env LD_PRELOAD=$LD_PRELOAD:''path/to/file_name''.so %command%<br />
<br />
=== Torchlight 2 ===<br />
<br />
==== Libfreetype/libfontconfig Incompatibility ====<br />
<br />
If you are experiencing issues with launching games such as Torchlight 2 or Civilization IV, it could be due to using a newer libfontconfig than the game currently supports.<br />
<br />
Right click the game in Steam, and set the following as its launch option:<br />
<br />
LD_PRELOAD=/usr/lib/libfreetype.so.6 %command%<br />
<br />
then attempt launching the game. <br />
<br />
Alternately, re-naming or deleting these 2 files will force it to use your system's libraries:<br />
<br />
Torchlight 2/game/lib/libfreetype.so.6<br />
Torchlight 2/game/lib64/libfreetype.so.6<br />
<br />
==== Locale incompatibility ====<br />
<br />
Some users report that Torchlight 2 does not work if you do not have en_US.UTF8 in your locale. <br />
<br />
Double check you have generated the locale needed in [[Steam#Installation|Steam Installation Requirements]].<br />
<br />
=== Tower Unite ===<br />
<br />
==== Graphical Glitches ====<br />
<br />
This is a known issue, and it occurs because the shaders had not been ported to Linux yet by the developers.<br />
To minimize glitches and make the game playable add {{ic|-opengl4}} to your [[launch option]]s,<br />
set Ocean Quality to "Potato" and Effects Quality to "Low" in the game settings.<br />
<br />
=== Towns / Towns Demo ===<br />
<br />
Requires [[Java]].<br />
<br />
=== Transistor ===<br />
<br />
==== Crash on launch / FMOD binding crash / audio issues ====<br />
<br />
Run the game with:<br />
<br />
LD_PRELOAD='/usr/lib/libstdc++.so.6:/usr/lib/libgcc_s.so.1:/usr/lib/libxcb.so.1:/usr/lib/libasound.so.2'<br />
<br />
Otherwise, run the game via shell and set up proper audio device for FMOD, as discussed in [https://steamcommunity.com/app/237930/discussions/2/620695877176333955/].<br />
<br />
Also, check out this thread [https://steamcommunity.com/app/237930/discussions/2/492378265893557247/].<br />
<br />
=== Transmissions: Element 120 ===<br />
<br />
Dependencies:<br />
<br />
* {{Pkg|lib32-libgcrypt15}}<br />
* {{pkg|lib32-libpng12}}<br />
<br />
==== Troubleshooting ====<br />
<br />
Make sure you have all libraries installed. Above the standard set required by Steam runtime, the game requires few additional ones. The typical error message that indicates that is<br />
<br />
AppFramework : Unable to load module vguimatsurface.so!<br />
<br />
To find missing dependencies go into the game directory and run:<br />
<br />
LD_LIBRARY_PATH=bin ldd bin/vguimatsurface.so<br />
<br />
Look for entries that say ''not found''.<br />
<br />
=== Transport Fever 2 ===<br />
<br />
==== Game will not launch ====<br />
<br />
Rename or delete the following files in game directory (~/.steam/steam/steamapps/common/Transport Fever 2) as discussed in [https://steamcommunity.com/app/1066780/discussions/0/1740010344363244243/]<br />
<br />
* libstdc++.so.6<br />
* libstdc++.so.6.0.25<br />
<br />
=== Trine 2 ===<br />
<br />
Dependencies:<br />
<br />
* {{pkg|lib32-glu}}<br />
* {{pkg|lib32-libxxf86vm}}<br />
* {{pkg|lib32-openal}}<br />
* {{pkg|xorg-xwininfo}}<br />
* {{pkg|lib32-libdrm}}<br />
<br />
* {{pkg|lib32-libpng12}}<br />
* {{pkg|lib32-libwrap}}<br />
<br />
==== Fullscreen ====<br />
<br />
Game crashes if started in fullscreen mode, but starts in windowed mode. After start the window can be set to fullscreen (borderless window) if your window manager supports this.<br />
[https://steamcommunity.com/app/35720/discussions/0/1735463620079681092/ steam forum]<br />
<br />
==== Colors ====<br />
<br />
If colors are wrong with FOSS drivers (r600g at least), try to run the game in windowed mode, rendering will be corrected. ([https://bugs.freedesktop.org/show_bug.cgi?id=60553 bug report])<br />
<br />
==== Sound ====<br />
<br />
{{Accuracy|General settings not specific to this game}}<br />
<br />
If sound plays choppy, try:<br />
<br />
{{hc|/etc/openal/alsoft.conf|<nowiki><br />
drivers=pulse,alsa<br />
frequency=48000<br />
</nowiki>}}<br />
<br />
==== Resolution ====<br />
<br />
If the game resolution is wrong when using a dual monitor setup and you cannot see the whole window edit {{ic|~/.frozenbyte/Trine2/options.txt}} and change the options {{ic|ForceFullscreenWidth}} and {{ic|ForceFullscreenHeight}} to the resolution of your monitor on which you want to play the game.<br />
<br />
==== Crash on start in libX11.so.6.3.0 ====<br />
<br />
gdb may report a crash in XGetICValues(), probably due to a bug in SDL1.3; fortunately SDL2.0 is compatible with trine 2, so just force it and see if it works by modifying the steam launch options (or by script/commandline if using the drm free version).<br />
<br />
{{bc|<nowiki><br />
LD_PRELOAD="/usr/lib32/libSDL2.so" %command%<br />
</nowiki>}}<br />
<br />
=== Tropico 5 ===<br />
<br />
==== Blank screen with sound only on startup ====<br />
<br />
Run the game with {{ic|1=MESA_GL_VERSION_OVERRIDE=4.0 MESA_GLSL_VERSION_OVERRIDE=400}}.<br />
<br />
=== Unbound: Worlds Apart ===<br />
<br />
If your controller does not work, try selecting the game in your inventory, click the gear icon on the right,<br />
then Properties, Controller, and select Disable Steam Input in the dropdown.<br />
<br />
=== Unity of Command ===<br />
<br />
Requires {{pkg|lib32-pango}}.<br />
<br />
==== Squares ====<br />
<br />
If squares are shown instead of text, try removing {{ic|''GAME''/bin/libpangoft2-1.0.so.0}}.<br />
<br />
==== No audio ====<br />
<br />
If you get this error:<br />
<br />
ALSA lib dlmisc.c:254:(snd1_dlobj_cache_get) Cannot open shared library /usr/lib/i386-linux-gnu/alsa-lib/libasound_module_pcm_pulse.so<br />
<br />
Try running:<br />
<br />
# mkdir -p /usr/lib/i386-linux-gnu/alsa-lib/<br />
# ln -s /usr/lib32/alsa-lib/libasound_module_pcm_pulse.so /usr/lib/i386-linux-gnu/alsa-lib/<br />
<br />
=== Unity3D ===<br />
<br />
Games based on the Unity3D engine, like ''War For The Overworld'' or ''Pixel Piracy'' may need the package {{pkg|lsb-release}} to understand that they run on Linux and work properly.<br />
<br />
==== Locale settings ====<br />
<br />
Games made in C# often have a problem with some locales (e.g. Russian, German) because developers do not specify locale-agnostic number formatting. This can result in some game screens loading only partially, problems with online features or other bugs.<br />
<br />
{{Accuracy|Would this not be fixed with only setting {{ic|1=LC_NUMERIC}}?}}<br />
<br />
To work around this, run the game with {{ic|1=LC_ALL=C}}.<br />
<br />
Affected games: ''FORCED, Gone Home, Ichi, Nimble Quest, Syder Arcade''.<br />
<br />
==== Unity 5 sound problems ====<br />
<br />
The sound system in Unity 5 changed and to be able to play games created with it you must most likely install and run [[PulseAudio]].<br />
<br />
Another solution is to disable the Steam runtime: in the launch options for the game, write this: {{ic|1=LD_LIBRARY_PATH="" %command%}}<br />
<br />
Another solution is to prevent Unity from trying to use pulseaudio using {{AUR|pulsenomore}} package from the [[AUR]]. Once it is installed, use the following as launch options :{{ic|/usr/bin/pulsenomore %command%}}<br />
<br />
Affected games: ''Kerbal Space Program, SUPERHOT, ClusterTruck''<br />
<br />
==== Game launching on wrong monitor in fullscreen mode ====<br />
<br />
Unity games that do not support monitor selection will most likely launch the game on a wrong monitor.<br />
<br />
The problem is that Unity games write the default parameter {{ic|1=<pref name="UnitySelectMonitor" type="int">-1</pref>}} to the game config file.<br />
<br />
This will lead to the game launching on a non-primary monitor.<br />
<br />
When changing to value into {{ic|1=<pref name="UnitySelectMonitor" type="int">'''0'''</pref>}} for the according game, the game will start on the correct (primary) monitor.<br />
<br />
A Unity game config file usually resides in {{ic|~/.config/unity3d/''CompanyName''/''ProductName''/prefs}}.<br />
<br />
Affected games: ''Cities: Skylines, Tabletop Simulator, Assault Android Cactus, Wasteland 2, Tyranny, Beat Cop''.<br />
<br />
Be aware that some games do not support setting that parameter, it will simply be ignored. This is the case for ''Pillars of Eternity'', ''Kentucky Route Zero'', ''Sunless Sea''.<br />
<br />
==== Chinese/Japanese/Korean display bug ====<br />
<br />
Install {{pkg|wqy-microhei}} and {{pkg|wqy-microhei-lite}}. Then<br />
<br />
#fc-cache -fv<br />
<br />
==== Game does not respond ====<br />
<br />
Add the following line to your [[launch option]]s :<br />
<br />
SDL_DYNAMIC_API=/usr/lib/libSDL2-2.0.so %command%<br />
<br />
==== No window opens on Wayland ====<br />
<br />
See [[Unity3D#No window opens: Desktop is 0 x 0 @ 0 Hz]].<br />
<br />
=== Unrest ===<br />
<br />
Requires {{pkg|fluidsynth}}.<br />
<br />
=== Volgarr the Viking ===<br />
<br />
Delete the {{ic|lib}} directory in the game directory to get rid of the libGL errors.<br />
<br />
=== War Thunder ===<br />
<br />
==== No audio ====<br />
<br />
If there is no audio after launching the game, install {{pkg|pulseaudio-alsa}}.<br />
<br />
==== Blank screen ====<br />
<br />
If having a green or blank screen on startup, run the game with {{ic|1=MESA_GL_VERSION_OVERRIDE=4.1COMPAT}}. [https://forum.warthunder.com/index.php?/topic/267809-linux-potential-workaround-for-mesa-drivers-black-screen/] [http://forum.warthunder.com/index.php?search_term=0030709&app=core&module=search&do=search&fromMainBar=1&search_app=forums%3Aforum%3A920&sort_field=&sort_order=&search_in=posts]{{Dead link|2020|04|03|status=404}}<br />
<br />
==== Launcher fails to auto-close ====<br />
<br />
When running through Steam a startup option must be set or the War Thunder Launcher will not auto-close when the game exits. Doing so will prevent it from being reported as the running game on the Steam Community, and more importantly running up CPU and RAM usage in the background. Put {{ic|<nowiki>XMODIFIERS="" %command%</nowiki>}} in the Launch Options/Parameters of War Thunder on Steam.<br />
<br />
=== Warhammer 40,000: Dawn of War II ===<br />
<br />
Dependencies:<br />
<br />
* {{Pkg|alsa-lib}}<br />
* {{Pkg|librtmp0}}<br />
<br />
The start script does not point to the right direction of {{ic|libasound.so.2}}.<br />
<br />
To fix it open {{ic|''GAME''/DawnOfWar2.sh}} and replace the following lines:<br />
<br />
{{bc|<nowiki>HAS_LSB_RELEASE=$(command -v lsb_release)<br />
if [ -n "${HAS_LSB_RELEASE}" ] && [ "$(lsb_release -c | cut -f2)" = "trusty" ]; then<br />
LD_PRELOAD_ADDITIONS="/usr/lib/x86_64-linux-gnu/libasound.so.2:${LD_PRELOAD_ADDITIONS}"<br />
fi </nowiki>}}<br />
<br />
with:<br />
<br />
{{bc|1=LD_PRELOAD_ADDITIONS="/usr/lib64/libasound.so.2:${LD_PRELOAD_ADDITIONS}"}}<br />
<br />
=== Wasteland 2 ===<br />
<br />
If Wasteland 2 immediately exits when you try to launch it there may not be enough system file descriptors available. To increase the descriptor limit edit '''/etc/security/limits.conf''' and add the line:<br />
<br />
<nowiki>* hard nofile 524288</nowiki><br />
<br />
Then reboot for the new limit to take effect, Wasteland 2 should now launch and this setting might also fix other games.<br />
<br />
=== We Were Here ===<br />
<br />
==== Stuck on black screen or logo on launch ====<br />
<br />
Add {{ic|-screen-fullscreen 0}} to launch options. [https://steamcommunity.com/app/582500/discussions/1/1470840994974091613/]<br />
<br />
=== Worms W.M.D ===<br />
<br />
The game includes several workarounds in the {{ic|Run.sh}} script, however these may not work and it is easy to get the game running without this script.<br />
<br />
First, try running the game directly from its game directory using {{ic|Worms W.M.Dx64}}. If you get a "No such file or directory" error about libcurl-gnutls, install {{pkg|libcurl-gnutls}}. If the game crashes after playing the intro movies, add the Steam Runtime dbus libraries to the game's library directory:<br />
<br />
$ ln -s ~/.steam/steam/ubuntu12_32/steam-runtime/amd64/lib/x86_64-linux-gnu/*dbus* ~/.steam/steam/steamapps/common/WormsWMD/lib<br />
<br />
Now the game should run using the default "Play Worms W.M.D" option. See also Steam community discussions [https://steamcommunity.com/app/327030/discussions/2/133257959065155871/] and [https://steamcommunity.com/app/327030/discussions/1/343785380902286766/].<br />
<br />
On some systems there are terrain bugs where holes in terrain are not rendered properly and worms can fall through terrain unexpectedly. These bugs can make the game unplayable in many situations and there is no known fix for them.<br />
<br />
=== Witcher 2: Assassin of Kings ===<br />
<br />
Dependencies:<br />
<br />
* {{Pkg|lib32-gnutls}}<br />
* {{Pkg|lib32-libcurl-compat}}<br />
* {{Pkg|lib32-libcurl-gnutls}}<br />
* {{Pkg|lib32-sdl2_image}}<br />
* {{Pkg|lib32-sdl2}}<br />
<br />
==== Game does not start ====<br />
<br />
The game will not start with SDL set to use wayland. You can have only the game run in x11 by adding the following launch options in steam:<br />
<br />
$ SDL_VIDEODRIVER=x11 %command%<br />
<br />
If the game does not run, enable error messages:<br />
<br />
$ LIBGL_DEBUG=verbose ./witcher2<br />
<br />
=== Wizardry 6: Bane of the Cosmic Forge ===<br />
<br />
Requires [[DOSBox]].<br />
<br />
To fix the crash at start, open {{ic|''GAME''/dosbox_linux/launch_wizardry6.sh}} and:<br />
<br />
# comment the line {{ic|1=export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./libs}}<br />
# change the beginning of the line starting with {{ic|exec ./dosbox}} to {{ic|exec dosbox}}<br />
<br />
=== World of Goo ===<br />
<br />
==== Changing resolution ====<br />
<br />
To change the game resolution edit the ''Graphics display'' section in {{ic|''GAME''/properties/config.txt}}. For example:<br />
<br />
<nowiki><!-- Graphics display --></nowiki><br />
<param name="screen_width" value="1680" /><br />
<param name="screen_height" value="1050" /><br />
<param name="color_depth" value="0" /><br />
<param name="fullscreen" value="true" /><br />
<param name="ui_inset" value="10" /><br />
<br />
=== X3: Terran Conflict ===<br />
<br />
==== Game crashes on startup ====<br />
<br />
The game may crash on startup because it is linked to libz version 1.2.9, while the latest version of this library in Arch Linux is higher. The following message in the terminals appears in this case:<br />
./X3TC_config: lib/libz.so.1: version 'ZLIB_1.2.9' not found (required by /usr/lib32/libpng16.so.16<br />
<br />
Renaming or removing lib/libz.so.1 may help.<br />
<br />
=== X Rebirth ===<br />
<br />
==== Game crashes on startup ====<br />
<br />
The game may crash on startup because it is linked to the shadergl function of the game. Do the follow in the .../steamapps/common/X Rebirth/shadergl/shaders/common.fh file.<br />
<br />
--- ./common.fh.orig<br />
+++ ./common.fh<br />
<br />
@@ -574 +574 @@<br />
- /* OUT_COLOR.rgb *= 0.0001; OUT_COLOR.rgb += half3(specstr);/**/ \<br />
+ /* OUT_COLOR.rgb *= 0.0001; OUT_COLOR.rgb += half3(specstr);*/ \<br />
<br />
@@ -622 +622 @@<br />
- /* OUT_COLOR.rgb *= 0.0001; OUT_COLOR.rgb += LightColor.xyz/ 10;/**/ \<br />
+ /* OUT_COLOR.rgb *= 0.0001; OUT_COLOR.rgb += LightColor.xyz/ 10;*/ \<br />
<br />
After this workaround is implemented the game should load as normal.<br />
<br />
=== XCOM ===<br />
<br />
Dependencies:<br />
<br />
* {{Pkg|librtmp0}}<br />
* {{Pkg|sdl2_image}} (required to enable keyboard functionality in-game)<br />
<br />
==== Hangs on startup ====<br />
<br />
If you are running a [[hybrid graphics]] system, try:<br />
<br />
__GL_THREADED_OPTIMIZATIONS=0 primusrun %command%<br />
<br />
==== Graphical glitches on Intel HD ====<br />
<br />
XCOM: Enemy Unknown may not recognize the SDL2 shared libraries shipped with the Steam runtime.<br />
Check if the binary finds all required files and install missing packages if necessary ({{Pkg|sdl2}} and {{Pkg|sdl2_image}}).<br />
<br />
{{bc|ldd binaries/linux/game.x86_64 | grep "not found"}}<br />
<br />
=== XCOM 2 ===<br />
<br />
==== Unable to start with steam native ====<br />
<br />
needs {{ic|libgconf-2.so.4}} which is not avaliable in arch repos, loading it from steams runtime seems to work.<br />
<br />
LD_PRELOAD="$HOME/.local/share/Steam/ubuntu12_32/steam-runtime/usr/lib/x86_64-linux-gnu/libgconf-2.so.4" %command%</div>Fincehttps://wiki.archlinux.org/index.php?title=GNU_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727558GNU (简体中文)2022-04-25T12:23:20Z<p>Fince: improve translation</p>
<hr />
<div>[[Category:GNU (简体中文)]]<br />
[[Category:Lists of software (简体中文)]]<br />
[[en:GNU]]<br />
[[es:GNU]]<br />
[[ja:GNU]]<br />
[[pt:GNU]]<br />
[[ru:GNU]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Arch Linux (简体中文)}}<br />
{{Related|Core utilities (简体中文)}}<br />
{{Related articles end}}<br />
<br />
摘自 [[Wikipedia:GNU|维基百科]]:<br />
:GNU 是一款操作系统和一组全面的计算机软件。GNU 完全由自由软件组成,其中大部分软件采用 GNU 项目自己的通用公共许可证 (GPL) 进行许可。GNU是 "GNU's Not Unix!" 的递归首字母缩写。<br />
<br />
因为 GNU 自己的 [https://www.gnu.org/s/hurd/hurd.html Hurd] 内核尚不成熟,[https://www.gnu.org/software/hurd/hurd/status.html] GNU 一般使用 Linux 内核。 [[Arch Linux (简体中文)]] 就是这类 GNU/Linux 发行版之一,使用了包括 [[Bash (简体中文)]] shell,GNU 核心工具,GNU 工具链在内的各种工具和库。此页面只列出部分比较重要的 GNU 软件包,而不会列出所有的[https://www.gnu.org/software/software.html#allgnupkgs 近400个]软件包。<br />
<br />
== Texinfo ==<br />
<br />
GNU 软件以 [[Wikipedia:Texinfo|Texinfo]] 排版规则来编排文档。您可以使用 {{ic|info}} 程序查阅info文档, 它来自 {{Pkg|texinfo}} 软件包。<br />
<br />
大部分GNU软件都提供了 [[man page (简体中文)|man page]], 但info文档内容往往更加全面。<br />
<br />
== 基本系统组件 ==<br />
<br />
* {{App|[[GRUB]]|GRUB 是 GNU 项目的引导程序。|https://www.gnu.org/software/grub/|{{Pkg|grub}}}}<br />
* {{App|[[Bash]]|Bash 是一种与其他 shell 兼容的 shell,它合并了许多 korn shell(ksh)和C shell(csh)的特性。|https://www.gnu.org/software/bash/|{{Pkg|bash}}}}<br />
* {{App|[[Coreutils]]|Coreutils 提供了 GNU 系统最基本的文件、shell和文本操作工具。|https://www.gnu.org/software/coreutils/|{{Pkg|coreutils}}}}<br />
* {{App|[[Wikipedia:gzip|gzip]]|gzip 既是一种文件格式,又是一种压缩和解压的工具。|https://www.gnu.org/software/gzip/|{{Pkg|gzip}}}}<br />
* {{App|[[tar]]|tar 提供了创建和解压tar压缩包的功能,也提供一些其它功能。|https://www.gnu.org/software/tar/|{{Pkg|tar}}}}<br />
<br />
== 工具链 ==<br />
<br />
大部分 [[Wikipedia:GNU toolchain|GNU toolchain]] 中的工具都在 {{Grp|base-devel}} 组里, 除了 ''glibc'' ({{Pkg|base}} 的依赖)和 GDB。<br />
<br />
* {{App|[[Wikipedia:Make (software)|GNU make]]|GNU make工具用于维护程序组.|https://www.gnu.org/software/make|{{Pkg|make}}}}<br />
* {{App|[[GCC]]|GNU编译器集合-C和C++前段.|https://gcc.gnu.org/|{{Pkg|gcc}}}}<br />
* {{App|[[Wikipedia:GNU C Library|glibc]]|GNU的C库实现 library.|https://www.gnu.org/software/libc/|{{Pkg|glibc}} ({{Pkg|base}} 的依赖)}}<br />
* {{App|[[Wikipedia:GNU Binutils|GNU Binutils]]|一组用来汇编和操作二进制和模板文件的程序。包括 [[Wikipedia:GNU linker|ld]].|https://www.gnu.org/software/binutils/|{{Pkg|binutils}}}}<br />
* {{App|[[Wikipedia:GNU Bison|GNU Bison]]|GNU通用解析器生成器.|https://www.gnu.org/software/bison/bison.html|{{Pkg|bison}}}}<br />
* {{App|[[Wikipedia:GNU m4|GNU m4]]|GNU宏处理器.|https://www.gnu.org/software/m4/|{{Pkg|m4}}}}<br />
* {{App|[[Wikipedia:GNU Debugger|GDB]]| GNU 调试器.|https://www.gnu.org/software/gdb/|{{Pkg|gdb}}}}<br />
<br />
=== 构建系统 ===<br />
<br />
来自[[Wikipedia:GNU build system|维基百科]]:<br />
<br />
:GNU构造系统,也被叫做自动工具,是一套用来帮助让源码包能移植到类Unix系统的编程工具<br />
<br />
* {{App|[[Wikipedia:Autoconf|GNU Autoconf]]|用来自动设置源码的工具.|https://www.gnu.org/software/autoconf|{{Pkg|autoconf}}}}<br />
* {{App|[[Wikipedia:Automake|GNU Automake]]|自动创建make文件的工具.|https://www.gnu.org/software/automake|{{Pkg|automake}}}}<br />
* {{App|[[Wikipedia:GNU Libtool|GNU Libtool]]|支持脚本的通用库.|https://www.gnu.org/software/libtool|{{Pkg|libtool}}}}<br />
<br />
== 其他软件 ==<br />
<br />
在 [[official repositories]] 中可以找到其它可选 GNU 工具:<br />
<br />
* [[GNOME]] 桌面环境<br />
* [[GIMP]] 图片编辑器<br />
* [[GTK+]] 小部件工具包<br />
* [[Gnumeric]] 表格处理软件<br />
* [[GNU Parted]] 分区管理器<br />
* [[GNU Screen]], 一种终端多路复用器<br />
* [[GNU nano]] 命令行文本编辑器<br />
* [[GNU Emacs]], 一款可扩展的、可自定义的、可自文档化的文本编辑器<br />
* [[GnuPG]] OpenPGP 实现<br />
* [[GNU Octave]] 科学编程工具<br />
* [[Readline|GNU Readline]], 一款用于命令行界面的行编辑库<br />
<br />
== 另见 ==<br />
<br />
* https://www.gnu.org/<br />
* [https://www.gnu.org/gnu/manifesto The GNU Manifesto]<br />
* [[Wikipedia:List of GNU packages]]<br />
* [https://archhurd.org/ Arch Hurd Project] 致力于将Arch Linux移植到Hurd内核。</div>Fincehttps://wiki.archlinux.org/index.php?title=GNOME_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727552GNOME (简体中文)2022-04-25T10:34:17Z<p>Fince: /* 笔记本合盖时不挂起 */ translate</p>
<hr />
<div>[[Category:Desktop environments (简体中文)]]<br />
[[de:GNOME]]<br />
[[en:GNOME]]<br />
[[es:GNOME]]<br />
[[fr:GNOME]]<br />
[[it:GNOME]]<br />
[[ja:GNOME]]<br />
[[pt:GNOME]]<br />
[[ru:GNOME]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|GTK (简体中文)}}<br />
{{Related|GDM (简体中文)}}<br />
{{Related|GNOME/Tips and tricks (简体中文)}}<br />
{{Related|GNOME/Troubleshooting (简体中文)}}<br />
{{Related|GNOME (简体中文)/Files (简体中文)}}<br />
{{Related|GNOME (简体中文)/Gedit (简体中文)}}<br />
{{Related|GNOME/Web}}<br />
{{Related|GNOME/Evolution}}<br />
{{Related|GNOME/Flashback}}<br />
{{Related|GNOME (简体中文)/Keyring (简体中文)}}<br />
{{Related|Cinnamon (简体中文)}}<br />
{{Related|MATE}}<br />
{{Related|Official repositories#gnome-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|GNOME|2022-04-19|725684}}<br />
<br />
[https://www.gnome.org/ GNOME](读音为/(ɡ)noʊm/)是一个追求简单易用的[[Desktop environment (简体中文)|桌面环境]]。它由 [[Wikipedia:zh:GNOME計劃|GNOME项目]]设计,并且完全由自由开源的软件组成。GNOME默认使用 [[Wayland (简体中文)|Wayland]] 而不是 [[Xorg (简体中文)|Xorg]] 作为显示服务器,并同时提供多个对话可供选择:<br />
<br />
* '''GNOME'''是在[[Wayland]]上运行GNOME Shell的默认选项。传统的X应用使用Xwayland运行。<br />
* '''GNOME Classic'''通过[https://web.archive.org/web/20190503163814/http://www.worldofgnome.org/welcome-to-gnome-3-8-flintstones-mode/ 特定的扩展和数值],提供了“[https://help.gnome.org/users/gnome-help/stable/gnome-classic.html 传统的桌面体验]”(类似GNOME2的界面)。因此,它是GNOME Shell的定制样式,而非真正的不同模式Thus。<br />
* '''GNOME on Xorg'''使用[[Xorg]]运行GNOME Shell。<br />
<br />
== 安装 ==<br />
<br />
有两个软件组可用:<br />
<br />
* {{Grp|gnome}}包含基本的桌面环境和一些集成良好的[https://wiki.gnome.org/Apps 应用];<br />
<br />
* {{Grp|gnome-extra}}包含其它GNOME应用,如邮件客户端、IRC客户端、[[#Advanced settings|GNOME Tweaks]]和一些游戏。请注意,这个组建立在{{Grp|gnome}}之上。 <br />
<br />
GNOME的基础桌面环境由[[Wikipedia:zh:Mutter_(software)|Mutter]]窗口管理器的插件[[Wikipedia:zh:GNOME_Shell|GNOME Shell]]组成。可以用{{Pkg|gnome-shell}}单独安装它。<br />
<br />
{{注意|''mutter''是桌面的混成器。它利用硬件图形加速减少屏幕的混乱。GNOME会话管理器会自动检测显卡驱动是否能够运行GNOME Shell,如果不行则用''llvmpipe''软件渲染。}}<br />
<br />
也可以使用不稳定版本,见[[Official repositories#gnome-unstable]].<br />
<br />
== 运行 GNOME ==<br />
<br />
GNOME 可以使用[[display manager (简体中文)|显示管理器]]以图形方式启动,也可以从控制台手动启动(可能会缺少某些功能)。{{Grp|gnome}}的显示管理器是[[GDM]]。<br />
{{注意|GDM提供了GNOME的锁屏功能(及其它)支持。如果没有使用GDM启动GNOME,则需要使用其它屏幕锁定器。见[[List of applications/Security#Screen lockers]]。}}<br />
<br />
=== 图形界面启动 ===<br />
<br />
如果安装了{{Grp|gnome}}并希望GNOME在下次启动时自动启动, 请[[enable|启用]]{{ic|gdm.service}},随后可以在显示管理器的会话菜单中选择想要使用的会话:''GNOME'', ''GNOME Classic'' (仅在{{Pkg|gnome-shell-extensions}} 已安装时显示), 或''GNOME on Xorg''。<br />
<br />
If you prefer to start GNOME right away, thereby avoiding a reboot, [[start]] the aforementioned {{ic|gdm.service}} from a graphically unoccupied tty instead.<br />
如果想立即启动GNOME以避免重启,可以从一个没有图形占用的tty上[[start|启动]]{{ic|gdm.service}}以代替。<br />
<br />
=== 手动启动 ===<br />
<br />
==== Xorg 会话 ====<br />
<br />
* 对于 GNOME on Xorg 会话,在 {{ic|~/.xinitrc}} 中添加(详见[https://gitlab.gnome.org/GNOME/gtk/issues/1390#note_344758]):{{bc|<nowiki><br />
export XDG_SESSION_TYPE=x11<br />
export GDK_BACKEND=x11<br />
exec gnome-session<br />
</nowiki>}}<br />
* 对于 GNOME Classic 会话,在 {{ic|~/.xinitrc}} 中添加:{{bc|<nowiki><br />
export XDG_CURRENT_DESKTOP=GNOME-Classic:GNOME<br />
export GNOME_SHELL_SESSION_MODE=classic<br />
exec gnome-session<br />
</nowiki>}}<br />
<br />
修改完 {{ic|~/.xinitrc}} 后,即可使用 {{ic|startx}} 启动 GNOME(有关其它详细信息,例如如何保留 logind 会话,详见 [[xinit (简体中文)|xinitrc]])。设置完 {{ic|~/.xinitrc}} 后,也可以设定[[xinit (简体中文)#在登录时自动启用 X|在登录时自动启动X]]。例如要在tty1上默认启动,可以在{{ic|.bash_profile}}中添加:<br />
{{bc|<nowiki><br />
if [[ -z $DISPLAY && $(tty) == /dev/tty1 ]]; then<br />
XDG_SESSION_TYPE=x11 GDK_BACKEND=x11 exec startx<br />
fi<br />
</nowiki>}}<br />
<br />
==== Wayland 会话 ====<br />
<br />
{{注意|X服务器仍然需要用于运行尚未移植到[[Wayland (简体中文)|Wayland]]的应用,详见[[Wayland#XWayland]]。使用Qt等特定图形库的应用,可以通过强制设置环境变量使用Wayland。详见[[Wayland#GUI libraries]]。}}<br />
<br />
可以使用 {{ic|<nowiki>XDG_SESSION_TYPE=wayland dbus-run-session gnome-session</nowiki>}} 手动启动 Wayland 会话。或者,可以在任何可用的tty直接调用带wayland选项的{{ic|gnome-shell}}:<br />
<br />
$ gnome-shell --wayland<br />
<br />
请注意,手动调用Gnome'''不需要'''{{ic|gdm}}(因此也不需要附带的{{ic|gdm.service}}),因此对于安装了Gnome最小安装的用户来说,可以根据个人喜好,选择一些包含在更广泛的{{ic|gnome}}组中的软件包。<br />
<br />
若要在 tty1 登录时启动,将以下内容添加到 {{ic|.bash_profile}} 中。Firefox和Qt应用不遵守{{ic|XDG_SESSION_TYPE}},所以最好给它们加上变量:<br />
<br />
{{bc|<nowiki><br />
if [[ -z $DISPLAY && $(tty) == /dev/tty1 && $XDG_SESSION_TYPE == tty ]]; then<br />
MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session<br />
fi<br />
</nowiki>}}<br />
<br />
=== Wayland中的GNOME应用 ===<br />
<br />
在使用 ''GNOME'' 会话时,GNOME 应用将使用 Wayland 运行。出于调试需要, https://docs.gtk.org/gtk3/running.html 和 https://docs.gtk.org/gtk4/running.html 列出的选项和环境变量。<br />
<br />
== 浏览 ==<br />
<br />
[https://wiki.gnome.org/Projects/GnomeShell/CheatSheet GNOME Shell cheat sheet] 中解释了如何高效地使用 GNOME shell,它展示了 GNOME shell 的特色和快捷键,包括切换任务,使用键盘,窗口控制,面板,概览模式等等。以下是部分常用的快捷键:<br />
<br />
* {{ic|Super+m}}:显示消息列表<br />
* {{ic|Super+a}}:显示应用菜单<br />
* {{ic|Alt+Tab}}:切换当前使用的应用<br />
* {{ic|Alt+`}} (美式键盘{{ic|Tab}}上面的按键):切换正在前台使用的应用的窗口<br />
* {{ic|Alt+F2}},然后输入 {{ic|r}} 或 {{ic|restart}}:在图形界面出问题时重启界面(仅用于X/传统模式,不适用于Wayland模式)。<br />
<br />
更多快捷键见[https://help.gnome.org/users/gnome-help/stable/keyboard-nav.html 键盘导航]。<br />
<br />
{{Tip|若要让{{ic|Alt+Tab}}只在当前工作区切换应用,可以将{{ic|current-workspace-only}}设为{{ic|true}}:<br />
<br />
$ gsettings set org.gnome.shell.app-switcher current-workspace-only true<br />
}}<br />
<br />
== 遗留名称 ==<br />
<br />
{{注意|一些GNOME应用在文档和对话框中的名称已经更改,但执行文件名称却没有。下面表格列出了一些这样的应用。}}<br />
<br />
{{提示|在搜索栏中搜索应用的遗留名称将成功找到对应的应用,例如搜索 ''nautilus'' 会出现 ''文件''。}}<br />
<br />
{| class="wikitable"<br />
! 当前<br />
! 遗留<br />
|-<br />
| [[GNOME/Files|文件]]<br />
| Nautilus<br />
|-<br />
| [[GNOME/Web|Web]]<br />
| Epiphany<br />
|-<br />
| 视频<br />
| Totem<br />
|-<br />
| 主菜单<br />
| Alacarte<br />
|-<br />
| [[GNOME/Document viewer|文档查看器]]<br />
| Evince<br />
|-<br />
| 磁盘使用情况分析器<br />
| Baobab<br />
|-<br />
| 图像查看器<br />
| EoG (Eye of GNOME)<br />
|-<br />
| [[GNOME/Keyring|密码和密钥]]<br />
| Seahorse<br />
|-<br />
| 翻译编辑器<br />
| Gtranslator<br />
|}<br />
<br />
== 配置 ==<br />
<br />
GNOME系统设置面板(''gnome-control-center'')和GNOME应用使用[[wikipedia:Dconf|dconf]]配置系统存储设置。<br />
<br />
您可以使用{{man|1|gsettings}}命令行工具直接访问 dconf 数据库。这也可以让您修改用户界面不公开的设置。Command line tool {{man|1|dconf}} can directly modify the underlying database, bypassing validation.<br />
<br />
直到GNOME 3.24,设置由GNOME设置进程应用(位于{{ic|/usr/lib/gnome-settings-daemon/gnome-settings-daemon}}),其也可以在GNOME会话之外运行。<br />
<br />
然而GNOME 3.24用几个相互独立的设置插件({{ic|/usr/lib/gnome-settings-daemon/gsd-*}},后来移动到{{ic|/usr/lib/gsd-*}})取代了 GNOME 设置进程。这些插件通过 {{ic|/etc/xdg/autostart}} (匹配org.gnome.SettingsDaemon.*.desktop) 下的桌面文件进行控制。若要在 GNOME 会话之外运行这些插件,您需要复制或编辑相应的[[desktop entries (简体中文)|桌面条目]]到 {{ic|~/.config/autostart}}。<br />
<br />
配置通常是用户特定的,本文将不介绍如何为多个用户创建配置模板。<br />
<br />
=== GNOME 系统设置 ===<br />
<br />
==== 色彩 ====<br />
<br />
{{ic|colord}} 守护进程会读取显示器的 EDID 信息并提取出合适的色彩配置内容。大多数情况下,色彩配置都是正确的,不需要额外设置;但是对于某些偏差情况或使用较旧的显示器时,可以把色彩配置文件放在 {{ic|~/.local/share/icc/}} 下并被指向。<br />
<br />
==== 夜间模式 ====<br />
<br />
GNOME 内置了类似于 [[Redshift]] 的蓝光过滤功能。夜间模式可以在设置面板中启动及自定义启动时间。此外,夜间模式的色温可以使用以下{{Pkg|dconf}}设置进行调整,5000是一个示例值:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 5000<br />
<br />
{{提示|若要在Wayland中调整白天的色温,请安装[https://extensions.gnome.org/extension/1276/night-light-slider/ Night Light Slider扩展]。}}<br />
<br />
==== 日期与时间 ====<br />
<br />
如果系统已有配置好的 [[Network_Time_Protocol_daemon_(简体中文)|网络时间协议<br />
守护进程]],它同样会对 GNOME 起作用。如果需要,同步设置可以在菜单内设为手动控制。<br />
<br />
GNOME支持自动选择时区,可在系统设置里的''日期和时间''选项中开启。前提是已开启定位服务 (见设置中的''隐私''选项)。<br />
<br />
若要在顶栏内显示日期,请运行:<br />
<br />
$ gsettings set org.gnome.desktop.interface clock-show-date true<br />
<br />
另外,若要在顶栏的日历中显示周数,请运行:<br />
<br />
$ gsettings set org.gnome.shell.calendar show-weekdate true<br />
<br />
==== 默认应用程序 ====<br />
<br />
首次安装 GNOME 时,您可能会发现某些格式由错误的应用处理,比如视频被''totem''打开而不是以前使用的 [[VLC]]。某些格式关联可以使用系统设置中的''默认应用程序''进行调整。<br />
<br />
有关其它协议和方法,请参阅[[Default applications (简体中文)|默认应用程序]]进行配置。<br />
<br />
==== 鼠标和触摸板 ====<br />
<br />
大多数触摸板设置可以使用系统设置中的''鼠标和触摸板''进行调整。<br />
<br />
根据您的设备,其它配置可能可用,但不会显示在默认界面内,例如不同的触摸板点击方法:<br />
{{hc|$ gsettings range org.gnome.desktop.peripherals.touchpad click-method|<br />
enum<br />
'default'<br />
'none'<br />
'areas'<br />
'fingers'<br />
}}<br />
手动设置:<br />
<br />
$ gsettings set org.gnome.desktop.peripherals.touchpad click-method 'fingers'<br />
或使用{{Pkg|gnome-tweaks}}设置。<br />
<br />
{{Note (简体中文)|1=GNOME 不支持 [[synaptics]] 并默认使用 [[libinput]]。参考 [https://bugzilla.gnome.org/show_bug.cgi?id=764257#c12 这个缺陷报告]。}}<br />
<br />
==== 网络 ====<br />
<br />
[[NetworkManager (简体中文)|NetworkManager]] 是GNOME项目中控制网络设置的工具,它也是{{Grp|gnome}}的一部分。如果尚未安装,则[[安装]]{{Pkg|networkmanager}}软件包并[[启用]]{{ic|NetworkManager.service}} systemd单元。<br />
<br />
虽然可以使用任何其它[[network manager|网络管理器]],但 NetworkManager 可以使用网络设置和状态指示器 {{Pkg|network-manager-applet}}( GNOME不需要 )整合到桌面环境当中。<br />
<br />
{{注意|1=用{{Pkg|networkmanager}}的''nmtui''设置隐藏的无线网络不会自动连接。您需要在GNOME设置中创建一个新配置文件,以恢复该网络的自动连接功能。}}<br />
<br />
==== 在线帐户 ====<br />
<br />
部分在线账户,比如 [[ownCloud]],需要安装 {{Pkg|gvfs-goa}} 以在 GNOME 应用比如 [[GNOME Files|GNOME 文件]] 以及 GNOME 文档中发挥全部功能[https://wiki.gnome.org/ThreePointSeven/Features/Owncloud]。<br />
<br />
详见[https://help.gnome.org/users/gnome-help/stable/accounts.html 在线账户]。<br />
<br />
==== 搜索 ====<br />
<br />
GNOME shell在按下{{ic|Super}}键并开始输入时会启动搜索。{{Pkg|tracker}}软件包默认作为{{Grp|gnome}}组的一部分被安装。它提供一个应用和数据的索引数据库。它可以被“搜索及索引”菜单项配置,通过"tracker-control"监视状态。它在用户登录时自动被"gnome-session"启动。索引可以被{{ic|tracker-control -s}}手动启动。搜索设置也可以在系统设置中配置。<br />
<br />
Tracker数据库可以使用"tracker-sparql“命令查询。详见{{man|1|tracker-sparql}}。<br />
<br />
=== 高级设置 ===<br />
<br />
如上文所述,改变[[GTK (简体中文)|GTK]]主题或[[Window manager (简体中文)|窗口管理器]]主题等选项,并不会出现在GNOME设置(gnome-control-center)里。想要修改这些设置可以使用GNOME Tweaks ({{Pkg|gnome-tweaks}}),这是一个展示了许多这类设置的图形化工具。<br />
<br />
(存储在 DConf 数据库中的)GNOME设置也可以使用{{man|1|dconf-editor}}(一个图形化的DConf配置工具)或[https://developer.gnome.org/gio/stable/GSettings.html gsettings]命令行工具进行配置。GNOME Tweaks 不会在 GUI 背后做任何其他事情;note though that you will not find all settings described in the following sections in it.<br />
<br />
==== 外观 ====<br />
<br />
===== 主题 =====<br />
<br />
{{Note|从[https://release.gnome.org/42/ Gnome 42]开始,许多默认的Gnome应用程序使用GTK 4和libadwaita。这些应用程序目前不支持通过gsettings或{{pkg|gnome-tweaks}}改变主题,只能通过系统设置的外观选项来调整配置。若要设置Adwaita或Adwaita-dark以外的GTK主题,见[[GTK#Themes]]。}}<br />
<br />
GNOME默认使用Adwaita。若要只将Adwaita-dark应用于GTK 2应用,请使用以下符号链接:<br />
<br />
$ ln -s /usr/share/themes/Adwaita-dark ~/.themes/Adwaita<br />
<br />
{{Note|Adwaita-dark主题由{{Pkg|gnome-themes-extra}}提供,因此GNOME的最小安装可能不会包含此主题。}}<br />
<br />
若要选择新的主题,(将它们移到适当的目录中,并)使用GNOME Tweaks或下面的GSettings命令。<br />
<br />
对于GTK主题:<br />
<br />
$ gsettings set org.gnome.desktop.interface gtk-theme ''theme-name''<br />
<br />
对于图标主题:<br />
<br />
$ gsettings set org.gnome.desktop.interface icon-theme ''theme-name''<br />
<br />
{{Note|窗口管理器的主题会跟随GTK主题。使用{{ic|org.gnome.desktop.wm.preferences theme}}的方法已被废弃和忽略。}}<br />
<br />
见[[GTK#Themes]]和[[Icons#Manually]].<br />
<br />
====== 标题栏高度 ======<br />
<br />
{{注意|应用此配置可以缩小不使用 GNOME风格CSD的应用程序的标题栏。带有CSD的原生GNOME应用程序不受影响。}}<br />
<br />
{{hc|~/.config/gtk-3.0/gtk.css|<br />
headerbar.default-decoration {<br />
padding-top: 0px;<br />
padding-bottom: 0px;<br />
min-height: 0px;<br />
font-size: 0.6em;<br />
}<br />
<br />
headerbar.default-decoration button.titlebutton {<br />
padding: 0px;<br />
min-height: 0px;<br />
}<br />
}}<br />
<br />
详见[https://askbot.fedoraproject.org/en/question/10035/shrink-title-bar/?answer=86149#post-id-86149]。<br />
<br />
====== 标题栏按钮排序 ======<br />
<br />
设置 GNOME 窗口管理器顺序 (Mutter, Metacity): <br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'<br />
<br />
{{提示|冒号表示窗口标题栏按钮出现的方向}}<br />
<br />
====== 最大化时隐藏标题栏 ======<br />
<br />
* [[Install]] {{AUR|gnome-shell-extension-gtktitlebar-git}},在最大化时移除标题栏,非GTK窗口.<br />
<br />
*[[安装]] {{AUR|gnome-shell-extension-pixel-saver-git}}或{{AUR|gnome-shell-extension-pixel-saver}}。最大化窗口的标题栏将与活动栏整合以节省空间。<br />
<br />
===== GNOME Shell主题 =====<br />
<br />
GNOME Shell本身的主题是可配置的。首先确认您已安装{{Pkg|gnome-shell-extensions}}软件包以应用Shell主题。然后通过GNOME Tweaks或通过[https://extensions.gnome.org GNOME Shell Extensions] 网站启用“User Themes”扩展。Shel主题可以通过使用GNOME Tweaks软件加载并选用。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=gnome-shell-theme&do_Search=Go&PP=50&SB=v&SO=d AUR]里有大量可用的GNOME Shell主题。Shell主题也可在[https://gnome-look.org/ gnome-look.org]里下载。<br />
<br />
===== AppIndicators/顶部菜单栏图标 =====<br />
<br />
To enable AppIndicators, which is useful for controlling/monitoring certain applications running in the background, Install {{Pkg|gnome-shell-extension-appindicator}} or {{AUR|gnome-shell-extension-appindicator-git}}, [[#Navigation|restart the GNOME Shell]], then enable the AppIndicator extension in the GNOME Extensions application or by running {{ic|$ gnome-extensions enable $(gnome-extensions list {{!}} grep -m 1 appindicatorsupport)}}<br />
<br />
==== 应用列表中的文件夹 ====<br />
<br />
{{提示| [https://github.com/prurigro/gnome-catgen gnome-catgen] ({{AUR|gnome-catgen-git}}) 脚本允许您通过创建{{ic|~/.local/share/applications-categories}}}下与分类同名的文件并在文件中包含您想包括在内的应用。或者,您可以使其在没有文件夹的情况下遍历各个应用直到您摁下{{ic|Ctrl+c}}或遍历完应用,然后输入想要的文件夹名称}}<br />
<br />
在'''dconf-editor'''中导航至 {{ic|org.gnome.desktop.app-folders}} 并设置{{ic|folder-children}}的值为一个由逗号分隔的文件夹的序列:<br />
<br />
['Utilities', 'Sundry']<br />
<br />
使用{{ic|gsettings}}加入应用:<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ apps "['alacarte.desktop', 'dconf-editor.desktop']"<br />
<br />
上述命令将{{ic|alacarte.desktop}}及{{ic|dconf-editor.desktop}}加入到Sundry文件夹。 该命令也创建{{ic|org.gnome.desktop.app-folders.folders.Sundry}}。<br />
<br />
要显示文件夹名称(如果其在应用上部没有显示名称):<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ name "Sundry"<br />
<br />
应用也可以通过它们的分类整理 (在它们的''.desktop''文件中):<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ categories "['Office']"<br />
<br />
如果某一个应用不想被加入某一文件夹,运行下列命令以设置例外:<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ excluded-apps "['libreoffice-draw.desktop']"<br />
<br />
详情参考[https://git.gnome.org/browse/gsettings-desktop-schemas/tree/schemas/org.gnome.desktop.app-folders.gschema.xml.in]和[[Gentoo:Gnome Applications Folders]].<br />
<br />
==== 自启动 ====<br />
<br />
GNOME提供[[XDG Autostart]]。<br />
<br />
{{Pkg|gnome-tweaks}} 程序可以用来管理自启动项。<br />
<br />
{{提示|如果Tweaks中自启动应用选项下加号按钮为灰色不可用,尝试在终端下通过{{ic|gnome-tweaks}}命令启动Tweaks。见[https://bbs.archlinux.org/viewtopic.php?pid&#61;1413631#p1413631 此贴]。}}<br />
<br />
{{注意|已经弃用的''gnome-session-properties''对话框可以通过[[安装]] {{AUR|gnome-session-properties}} 添加。这同样提供了禁用系统范围自启动应用的功能,这是''gnome-tweaks''所不能做到的。}}<br />
<br />
==== 桌面 ====<br />
<br />
===== 桌面图标 =====<br />
<br />
GNOME 3.28之前,桌面图标通过[[GNOME/Files|Files]]在桌面上绘制一个透明的带图标的窗口实现。在GNOME 3.28中,该功能被移除,桌面图标不再在GNOME上可用。可能的方案包括使用[[Nemo]](GNOME File的一个分支,目前仍支持桌面图标)或安装{{AUR|gnome-shell-extension-desktop-icons}}插件以复刻GNOME 3.26以下支持的桌面图标功能,但略有差异。详见[https://bbs.archlinux.org/viewtopic.php?id=235633 Arch论坛中的讨论]。<br />
<br />
===== 锁屏和背景 =====<br />
<br />
在设置桌面及锁屏背景的时候,注意Picture标签下只显示{{ic|~/Pictures}}文件夹下的图片。如果您想使用不在该文件夹下的图片,请使用下列命令:<br />
<br />
对于桌面背景:<br />
<br />
$ gsettings set org.gnome.desktop.background picture-uri 'file:///path/to/my/picture.jpg'<br />
<br />
对于锁屏背景:<br />
<br />
$ gsettings set org.gnome.desktop.screensaver picture-uri 'file:///path/to/my/picture.jpg'<br />
<br />
===== 禁用顶部左侧的热区 =====<br />
<br />
从GNOME 3.34开始,可以使用以下命令禁用它:<br />
<br />
$ gsettings set org.gnome.desktop.interface enable-hot-corners false<br />
<br />
或在{{Pkg|gnome-tweaks}}中的''顶栏 > 活动概览热区''中禁用。<br />
<br />
GNOME 42后,可在系统设置的多任务选项中禁用。<br />
<br />
===== 启动到概览模式 =====<br />
<br />
从GNOME 40开始,桌面会直接启动到概览模式,而不是桌面(如以前的版本)。若要模仿经典的行为,可以安装[https://extensions.gnome.org/extension/4099/no-overview/ No overview at start-up]插件。<br />
<br />
详见[https://discourse.gnome.org/t/gnome-40-login-is-to-the-activities-overview-mode-how-do-you-disable-this/5783 此讨论]。<br />
<br />
==== 扩展 ====<br />
<br />
在 [https://extensions.gnome.org extensions.gnome.org] 里可以找到扩展。只要把屏幕做上方的按钮按成 '''ON''' 然后点击弹出窗口里的 '''Install''' 就能够安装并启用那个插件了。已经安装的扩展可以在 [https://extensions.gnome.org/local/ extensions.gnome.org/local] 里查看,而且还能看到哪个能够升级。用{{Pkg|gnome-tweaks}}也可以开关某个扩展。<br />
<br />
{{注意|[[GNOME/Web]]可以直接安装[https://extensions.gnome.org extensions.gnome.org]里的扩展。其它浏览器则需先安装 {{AUR|chrome-gnome-shell}} ,并安装对应的浏览器插件。}}<br />
<br />
GNOME Shell 的插件自定义可以是限定于某个用户的,也可以是全局的。用 [[pacman]] 安装的扩展是全局的,而且会随着系统更新而更新。<br />
<br />
{{Pkg|gnome-shell-extensions}} 提供了包含在 GNOME project 里的(即有官方支持的)插件包,其中包含的插件有很多都会被 GNOME Classic session 使用。如果想要一个任务栏但是又不想用 GNOME Classic session,那就可以用 ''Window list'' 扩展。<br />
<br />
用以下命令查看已启用的扩展:<br />
<br />
$ gsettings get org.gnome.shell enabled-extensions<br />
<br />
上述命令可能会列出已经删除的扩展。若要只列出已启用''和''已安装的扩展,使用''gnome-extensions'':<br />
<br />
$ gnome-extensions list --enabled<br />
<br />
更多有关GNOME Shell的信息,见[https://extensions.gnome.org/about/]。<br />
<br />
==== 字体 ====<br />
<br />
{{提示|如果您把"Scaling factor"调至1.00以上的某值,辅助功能菜单将自动启用}}<br />
<br />
GNOME可以设置窗体标题,界面(应用),文档及等宽字体。查看Tweaks下的字体选项卡以获得相关选项。<br />
<br />
对于字体渲染来说,RGBA可能适合更多的显示器类型,如果字体看起来过分拥挤,可以将字体渲染调至“Slight”或“None”。<br />
<br />
==== WEBP,缩略图 ====<br />
<br />
[[Install|安装]]{{Pkg|webp-pixbuf-loader}}使GNOME的图像查看器({{Pkg|eog}})能够查看WEBP图像并为其创建缩略图,以便在[[GNOME Files]]中查看。<br />
<br />
==== 输入法 ====<br />
<br />
GNOME集成了的通过[[IBus]]的输入法, 只有{{Pkg|ibus}}和添加想要的输入法引擎 (例如:{{Pkg|ibus-libpinyin}} for Intelligent Pinyin) 需要安装,安装后,输入法引擎可以加入GNOME的区域和语言设置键盘布局。<br />
<br />
==== Keyboard Layout quirks ====<br />
<br />
If you are using an alternative keyboard layout like Neo2 which uses multiple layers/modifiers, you might need to go to ''Keyboard > Type Special Characters'' in GNOME Settings (''gnome-control-center'') and change the ''Alternate Characters Key'' away from ''Right Alt'' so that it can be used as a native modifier of the keyboard layout. Setting it to e.g. ''Left Alt'' prevents ''Alt+Tab'', so be careful what you change it to.<br />
Without this change, your left ''Mod3'' key might work, but the right one (''AltGr'') does not. (As of 2021-05-18)<br />
<br />
==== 电源 ====<br />
<br />
当您使用笔记本时,可能想修改以下设置,包括控制闲置、按下电源按钮和盖子关闭时的行为。<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.power button-power ''hibernate''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout ''3600''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type ''hibernate''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout ''1800''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type ''hibernate''<br />
$ gsettings set org.gnome.desktop.lockdown disable-lock-screen ''true''<br />
<br />
如需在合上盖子后依然保持显示器开启:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xrandr default-monitors-setup do-nothing<br />
<br />
GNOME 3.24中不建议使用以下设置:<br />
<br />
org.gnome.settings-daemon.plugins.power button-hibernate<br />
org.gnome.settings-daemon.plugins.power button-power<br />
org.gnome.settings-daemon.plugins.power button-sleep<br />
org.gnome.settings-daemon.plugins.power button-suspend<br />
org.gnome.settings-daemon.plugins.power critical-battery-action<br />
<br />
===== 笔记本合盖时不挂起 =====<br />
<br />
GNOME的设置面板并没有改变合盖触发动作的选项,但{{Pkg|gnome-tweaks}}可以覆盖{{Pkg|systemd}}的设置。在''通用''选项卡中,关闭''笔记本电脑盖子关闭时挂起''。这样,系统就不会在合盖时''挂起到RAM(S3)''。<br />
<br />
要系统级改变开关动作,请先确保上述设置'''没有关闭''',并编辑{{ic|/etc/systemd/logind.conf}}中的systemd设置。若要合盖时不挂起,请设置{{ic|1=HandleLidSwitch=ignore}},详见[[Power management#ACPI events]]。<br />
<br />
===== 修改电池电量严重不足时的行为 =====<br />
<br />
设置面板不提供对电池电量严重不足行为的设置。这些设置也从dconf中移除。不过它们现在由uppower管理。按需编辑{{ic|/etc/UPower/Upower.conf}}中upower设置。<br />
<br />
{{hc|head=/etc/UPower/UPower.conf|output=<br />
PercentageLow=10<br />
PercentageCritical=3<br />
PercentageAction=2<br />
CriticalPowerAction=HybridSleep<br />
}}<br />
<br />
===== 电源模式 =====<br />
<br />
安装{{Pkg|gnome-control-center}}的可选依赖[[power-profiles-daemon]]以支持电源配置文件。<br />
由于''gnome-shell''和GNOME设置都请求在启动时激活{{ic|power-profiles-daemon}}服务,所以不需要特意将其[[starting/enabling|启动或启用]]。<br />
<br />
When the service is active, power profiles can be managed through the ''Power'' section of GNOME Settings and in the system menu.<br />
当服务激活时,可以通过GNOME设置的''电源''选项和系统菜单管理电源配置文件。<br />
<br />
=== 使用其它window manager ===<br />
<br />
GNOME Shell 不支持更改 [[window manager]], 但是 [[GNOME Flashback]] 提供使用 Metacity 和 [[Compiz]] 的session。此外,可以通过 [[GNOME/Tips and tricks#Custom GNOME sessions|自定义 GNOME sessions]] 来使用别的组件。<br />
<br />
== 参见 ==<br />
<br />
* [https://www.gnome.org/ 官方网站]<br />
* [https://blogs.gnome.org/tbernard/2021/06/15/community-power-2/ Contributing to GNOME, feature requests, bugs, code]<br />
* [https://extensions.gnome.org/ GNOME-shell 扩展]<br />
* 主题、图标和壁纸:<br />
** [https://art.gnome.org/ GNOME Art]<br />
** [https://www.gnome-look.org/ GNOME 外观]<br />
* GTK/GNOME 程序:<br />
** [https://www.gnomefiles.org/ GNOME 文件管理]<br />
** [https://www.gnome.org/projects/ GNOME 项目列表]<br />
* [https://blog.fpmurphy.com/2011/03/customizing-the-gnome-3-shell.html 自定义 GNOME Shell] <br />
* GNOME 代码和镜像:<br />
** [https://gitlab.gnome.org/ GNOME GitLab]<br />
** [https://github.com/GNOME GNOME Github 镜像]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727362KDE (简体中文)2022-04-23T17:04:18Z<p>Fince: /* 禁用面板阴影 */ minor fix</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|KDE|2022-04-24|727318}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的可执行权限。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要可执行权限才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{注意|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{注意|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727361KDE (简体中文)2022-04-23T17:03:47Z<p>Fince: /* 自启动 */ minor fix</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|KDE|2022-04-24|727318}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的[[Reading (简体中文)#添加可执行权限|可执行权限]]。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要可执行权限才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{注意|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{注意|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727360KDE (简体中文)2022-04-23T17:02:32Z<p>Fince: /* KWin-lowlatency */ minor fix</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|KDE|2022-04-24|727318}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的[[Reading (简体中文)#添加可执行权限|可执行权限]]。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要[[Reading (简体中文)#添加可执行权限|可执行权限]]才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{注意|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{注意|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727359KDE (简体中文)2022-04-23T17:01:26Z<p>Fince: /* KIO opens URLs with error programs */ minor fix</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|KDE|2022-04-24|727318}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的[[Reading (简体中文)#添加可执行权限|可执行权限]]。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要[[Reading (简体中文)#添加可执行权限|可执行权限]]才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{注意|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{Out of date (简体中文)|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 该项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727358KDE (简体中文)2022-04-23T17:00:44Z<p>Fince: /* 系统级 MySQL 实例 */ minor fix</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|KDE|2022-04-24|727318}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的[[Reading (简体中文)#添加可执行权限|可执行权限]]。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要[[Reading (简体中文)#添加可执行权限|可执行权限]]才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{注意|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{Out of date (简体中文)|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 该项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
{{Style|The language in this section could use some improvements for clarity and grammar (mostly in regards to the first sentence and section heading).}}<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727357KDE (简体中文)2022-04-23T17:00:16Z<p>Fince: /* 在 KDE Telepathy 中使用 Telegram */ minor fix</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|KDE|2022-04-24|727318}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的[[Reading (简体中文)#添加可执行权限|可执行权限]]。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要[[Reading (简体中文)#添加可执行权限|可执行权限]]才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{Expansion|Add instructions.}}<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{注意|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{Out of date (简体中文)|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 该项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
{{Style|The language in this section could use some improvements for clarity and grammar (mostly in regards to the first sentence and section heading).}}<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727356KDE (简体中文)2022-04-23T16:59:13Z<p>Fince: add TranslationStatus</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|KDE|2022-04-24|727318}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的[[Reading (简体中文)#添加可执行权限|可执行权限]]。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要[[Reading (简体中文)#添加可执行权限|可执行权限]]才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{Expansion|Add instructions.}}<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{Out of date (简体中文)|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{Out of date (简体中文)|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 该项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
{{Style|The language in this section could use some improvements for clarity and grammar (mostly in regards to the first sentence and section heading).}}<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727355KDE (简体中文)2022-04-23T16:57:24Z<p>Fince: update translation</p>
<hr />
<div>[[Category:KDE (简体中文)|KDE]]<br />
[[de:KDE]]<br />
[[en:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|Qt (简体中文)}}<br />
{{Related|SDDM (简体中文)}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet (简体中文)}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform Look for Qt and GTK Applications (简体中文)}}<br />
{{Related|Official repositories (简体中文)#kde-unstable}}<br />
{{Related articles end}}<br />
<br />
KDE 是一套由 Plasma [[desktop environment (简体中文)|桌面环境]]、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。KDE 上游有一份维护良好的 [https://userbase.kde.org/Welcome_to_KDE_UserBase/zh-cn UserBase Wiki],在此可以找到大多数 KDE 应用的详细信息。<br />
<br />
== 安装 ==<br />
<br />
=== Plasma 桌面 ===<br />
<br />
在安装 Plasma 之前,请确保 [[Xorg (简体中文)|Xorg]] 已经被安装到您的系统中并可以正常工作。<br />
<br />
[[安装]] {{Pkg|plasma-meta}} 元软件包或者 {{Grp|plasma}} 组。<br />
关于 {{Pkg|plasma-meta}} 和 {{Grp|plasma}} 两者的不同见[[Meta package and package group (简体中文)|元软件包与软件包组]]。若要使用 Plasma 的最小安装,请安装 {{Pkg|plasma-desktop}} 包。<br />
<br />
若要启用 Plasma 的 [[Wayland]] 支持,请安装 {{Pkg|plasma-wayland-session}} 软件包。[[NVIDIA (简体中文)|NVIDIA]]显卡用户请额外安装 {{Pkg|egl-wayland}},如果使用私有的{{Pkg|nvidia}}驱动无法启动会话,请额外启用[[NVIDIA#DRM kernel mode setting|DRM内核级显示模式设置]]。如果还是无法正常运行,请查看 [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki] 中的操作指南。<br />
<br />
=== KDE 应用 ===<br />
<br />
若要安装 KDE 的全套应用,请安装 {{Grp|kde-applications}} 组或 {{Pkg|kde-applications-meta}} 元软件包。若只需要安装特定类别的 KDE 应用(如游戏或教育),请只安装 {{Pkg|kde-applications-meta}} 中与此相关的依赖。请注意,此操作只安装应用,'''不会'''安装 Plasma 桌面。<br />
<br />
=== 不稳定版 ===<br />
<br />
见 [[Official repositories (简体中文)#kde-unstable]]。<br />
<br />
== 启动 Plasma ==<br />
<br />
{{Note (简体中文)|虽然可以使用 [[Wayland (简体中文)|Wayland]] 启动 Plasma,但 Plasma 仍存在一些缺失的功能和已知问题。问题清单见 [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers],当前开发状况见 [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard]。使用 [[Xorg (简体中文)|Xorg]] 以获得最完整和稳定的体验。}}<br />
<br />
Plasma 可以通过[[display manager (简体中文)|显示管理器]]启动,也可以从控制台手动启动。<br />
<br />
=== 使用显示管理器 ===<br />
<br />
{{Tip (简体中文)|推荐使用 [[SDDM (简体中文)|SDDM]] [[display manager (简体中文)|显示管理器]]。.}}<br />
<br />
* 选择 ''Plasma (X11)'' 以在[[Xorg (简体中文)|Xorg]]下开启新会话。<br />
* 选择 ''Plasma (Wayland)'' 以在[[Wayland (简体中文)|Wayland]]下开启新会话。<br />
<br />
=== 从控制台启动 ===<br />
<br />
* 若要使用 "[[xinit (简体中文)|xinit/startx]]" 启动 Plasma 桌面,请在 {{ic|.xinitrc}} 文件中添加 {{ic|1=export DESKTOP_SESSION=plasma}} 和 {{ic|exec startplasma-x11}}。<br />
若要在登录时开启 Xorg,见[[Start X at Login (简体中文)|登录时启动 X]]。<br />
若要从终端启动 Plasma 的 Wayland 会话, 请运行 {{ic|1=dbus-run-session startplasma-wayland}}。[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland]<br />
<br />
== 配置 ==<br />
<br />
KDE应用的大部分配置存储于 {{ic|~/.config}} 目录下。KDE 主要使用'''“系统设置”'''调整配置,也可以在终端执行 {{ic|systemsettings}} 启动它。<br />
<br />
=== 个性化 ===<br />
<br />
==== Plasma 桌面 ====<br />
<br />
===== 主题 =====<br />
<br />
[https://store.kde.org/browse/cat/104/ Plasma 主题]定义了面板和 Plasma widget 的样式。为了方便从系统层面安装主题,官方软件仓库和 [https://aur.archlinux.org/packages?K=plasma+theme AUR] 中也提供了一些主题。<br />
<br />
您也可以通过系统设置来安装主题:<br />
<br />
系统设置 > 工作空间主题 > 桌面主题 > 获取新主题<br />
<br />
[https://store.kde.org/ KDE商店] 提供了更多的plasma个性化方案,包括 [[SDDM_(简体中文)|SDDM]] 主题和 splash-screens。<br />
<br />
====== GTK+ 应用的外观 ======<br />
<br />
{{提示|若要使 Qt 和 GTK 主题一致,见[[Uniform_look_for_Qt_and_GTK_applications_(简体中文)|QT 和 GTK 应用的统一外观]]。}}<br />
<br />
在 GTK 中推荐使用 {{Pkg|breeze-gtk}} 主题,这款 GTK 主题模仿了 Plasma 的 Breeze 主题。<br />
安装 {{Pkg|kde-gtk-config}}(该软件是{{Grp|plasma}} 的一部分),在''系统设置 > 外观 > 应用风格 > 配置 GNOME/GTK 应用风格''中选择 {{ic|Breeze}} 即可。<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== 小部件 =====<br />
<br />
Plasmoid 是 Plasma Shell 的小部件,用于增强桌面功能。<br />
<br />
若要安装Plasmoid脚本,最方便的方式是右键面板或桌面,然后选择:<br />
<br />
添加部件 > 获得新部件 > 下载新 Plasma 部件<br />
<br />
随后将会显示 [https://www.kde-look.org/ kde-look.org] 的前端界面,并可一键安装/卸载/更新第三方 plasmoid 脚本。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=plasmoid&PP=50&SO=d&SB=v AUR] 仓库中可以下载到很多二进制文件版的Plasmoid部件。<br />
<br />
===== 系统托盘中的声音小程序 =====<br />
<br />
[[安装]] {{Pkg|plasma-pa}} 或 {{Pkg|kmix}} (从程序启动器启动 Kmix)。前者已自动安装,无需另外设置。<br />
<br />
{{注意|1=若要调整 [https://bugs.kde.org/show_bug.cgi?id=313579#c28 音量单次增减的长度],请将例如 {{ic|1=VolumePercentageStep=1}} (后面的数字代表长度)的一行文字添加到 {{ic|~/.kde4/share/config/kmixrc}} 的 {{ic|[Global]}} 部分中。}}<br />
<br />
===== 禁用面板阴影 =====<br />
<br />
因为 Plasma 的面板在其他窗口之上,所以其阴影也会渲染在其他窗口之上。[https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] 若要在不影响其他阴影的情况下禁用此行为,[[安装]] {{Pkg|xorg-xprop}} 并运行:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
然后用增大的光标选择面板。[https://forum.kde.org/viewtopic.php?f=285&t=121592] 若要自动化此操作,请[[安装]] {{Pkg|xorg-xwininfo}} 并创建以下脚本:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
并添加此脚本的[[Reading (简体中文)#添加可执行权限|可执行权限]]。<br />
<br />
在''自动启动''的''添加脚本''中添加此脚本,可以使其在登录时启动:<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== 显示缩放/高DPI显示 =====<br />
<br />
见 [[HiDPI (简体中文)#KDE]]。<br />
<br />
==== 窗口装饰 ====<br />
<br />
可在 ''系统设置 > 应用程序风格 > 窗口装饰'' 中设置[https://store.kde.org/browse/cat/114/ 窗口装饰]。<br />
<br />
您也可以在[https://aur.archlinux.org/packages?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR]上中直接下载并安装更多主题。<br />
<br />
==== 图标主题 ====<br />
<br />
可在 ''系统设置 > 图标'' 中安装或改变图标主题。<br />
<br />
{{注意|虽然所有现代的Linux发行版都共享统一的图标主题格式,但像 [[GNOME_(简体中文)|GNOME]]这样的桌面使用更少的图标(特别是在工具栏和菜单中)。为这些桌面开发的主题一般都缺少 Plasma 和 KDE 应用需要的图标。建议安装与 Plasma 兼容的主题。}}<br />
<br />
{{提示|部分图标主题不从默认图标主题中引入图标,这将导致部分图标缺失。要想从默认图标主题中导入缺失图标,把{{ic|breeze}}添加到 {{ic|/usr/share/icon/''theme-name''/index.theme}}的{{ic|1=Inherits=}} 中,比如{{ic|1=Inherits=breeze,hicolor}}。每次更新图标主题时都需要重新使用这个补丁,尝试使用[[Pacman hooks]]来自动完成这项任务。}}<br />
<br />
==== 空间效率 ====<br />
<br />
Plasma Netbool shell (上网本交互界面)已从 Plasma 5 中移除,请阅[https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 此KDE论坛帖子]。但您仍然可以通过编辑 {{ic|~/.config/kwinrc}},在 {{ic|[Windows]}} 部分加上 {{ic|1=BorderlessMaximizedWindows=true}} 来实现类似的操作。<br />
<br />
==== 缩略图生成 ====<br />
<br />
若要在桌面和 Dolphin 内为媒体或文档文件生成缩略图,安装 {{Pkg|kdegraphics-thumbnailers}} 和 {{Pkg|ffmpegthumbs}}。<br />
<br />
然后在 ''桌面背景'' > ''配置桌面'' > ''图标'' > ''更多预览选项...'' 内通过 ''右键单击'' 启用桌面的缩略图类别。<br />
<br />
在 ''Dolphin'' 中,进入 ''控制'' > ''通用'' > ''预览''。<br />
<br />
=== 夜间模式 ===<br />
<br />
Plasma提供了一种类似 [[Redshift]] 的特性(在 [[Xorg (简体中文)|Xorg]] 和[[Wayland (简体中文)|Wayland]] 上都可以使用),称为夜间模式。它使屏幕上的颜色呈现更暖的色调,以在指定的时间里减少眼睛疲劳。<br />
您可以在 系统设置 -> 显示和屏幕 -> 夜间模式 中启动该功能。<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== 打印 ===<br />
<br />
{{提示|使用 [[CUPS (简体中文)|CUPS]] 的 Web 接口进行快速配置。这种方式配置的打印机可以被 KDE 应用使用。}}<br />
<br />
您也可以在 '''系统设置 > 打印机配置''' 中配置打印机。要使用这种配置方式,必须首先安装 {{Pkg|print-manager}} 和 {{Pkg|cups}} 软件包。请阅[[CUPS_(简体中文)#配置|CUPS配置]]<br />
<br />
=== Samba/Windows 支持 ===<br />
<br />
若要使用 Windows 服务,安装 [[Samba (简体中文)|Samba]] ({{Pkg|samba}} 软件包)。<br />
<br />
Dophin 的共享服务需要 {{Pkg|kdenetwork-filesharing}} 软件包以及 usershares。关于如何配置usershares(在不启动 {{ic|smb.conf}} 的情况下),见[[Samba (简体中文)#建立 Usershare 路径|建立 Usershare 路径]]。重新启动Samba后,应无需进一步配置Dolphin的共享。<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
不像 GTK 文件浏览器利用 GVfs 启动程序,如果在 Dolphin 中通过 KIO 打开 Samba 共享的文件,大多数程序中 Plasma 会先把整个文件复制到本地系统(除了 VLC)。<br />
使用基于GTK的文件浏览器可以解决此问题,如 {{Pkg|thunar}} 和 {{Pkg|gvfs-smb}} 可以更有效地访问SMB共享(同时要安装 {{Pkg|gnome-keyring}}以保存登录凭证)。<br />
<br />
另一种方法则是使用 {{Pkg|cifs-utils}} [[File_systems#Mount_a_file system|挂载]] Samba 共享从而让 Plasma 把 SMB 共享当成一个普通的本地文件夹从而正常访问。见[[Samba (简体中文)#手动挂载|手动挂载]]和[[Samba (简体中文)#自动挂载|自动挂载]]。<br />
<br />
另一种简单的GUI解决方法则是使用 {{AUR|samba-mounter-git}}。它在 ''系统设置'' > ''网络驱动'' 中提供了基本相同的功能。要注意,在新版 KDE Plasma 中此应用可能会崩溃。<br />
<br />
=== KDE 桌面活动 ===<br />
<br />
[https://userbase.kde.org/Plasma/zh-cn#.E6.B4.BB.E5.8A.A8 KDE 桌面活动]是一种类似于“虚拟桌面”的 Plasma 组件,您可以独立设置特定的活动。 只有在您正在使用这个活动时,这些设定才会生效。<br />
<br />
=== 电源管理 ===<br />
<br />
[[安装]] {{Pkg|powerdevil}} 以使用 KDE 内置的 "'''PowerDevil 电源管理'''"的节能服务,它可以调整系统的节能配置、屏幕亮度(如果支持)并提供详细的电源报告。<br />
<br />
{{Tip (简体中文)|<br />
* 可以选择不需要依赖 [[NetworkManager]] 和 [[Bluez]] 的 {{AUR|powerdevil-light}} 替代它。<br />
* 可以选择启用了 [[Wikipedia:DDC/CI|DDC/CI]] 的外接显示器背光控制的 {{AUR|powerdevil-ddcutil}} 替代它。<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Note (简体中文)|Powerdevil 可能无法 [[Power management (简体中文)#电源管理器|覆盖]] 所有的 logind 设置(例如笔记本合盖动作). 如果遇到这样的问题,需要修改logind的设置,请参考 [[Power management (简体中文)#用 systemd 进行电源管理]]。<br />
<br />
问题也可能是因为 logind 中 {{ic|LidSwitchIgnoreInhibited}} 的默认值是 {{ic|yes}},见 [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
=== 自启动 ===<br />
<br />
Plasma 可以在启动和关闭时自动启动应用程序并运行shell脚本。若要自动启动应用程序,请进入 ''系统设置 > 开关机 > 自启动'' 并添加您想要的程序或shell脚本。若选择程序,则会创建一个 {{ic|.desktop}} 文件;选择脚本,则会创建一个用来启动脚本的 {{ic|.desktop}} 文件。<br />
<br />
{{注意|<br />
* 程序只能在登录时自启动,而shell脚本也可以在关机和 Plasma 启动前启动。<br />
* Shell脚本需要[[Reading (简体中文)#添加可执行权限|可执行权限]]才能运行。<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* 将[[Desktop_entries_(简体中文)|桌面配置项]](即{{ic|.desktop}}文件)放入适当的 [[XDG Autostart]] 目录:<br />
* 将shell脚本的symlink放入以下目录之一:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env}}: 在 Plasma 启动前启动脚本。<br />
:; {{ic|~/.config/plasma-workspace/shutdown}}: 在关机时启动脚本。<br />
<br />
见[https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html 官方文档]。<br />
<br />
=== Phonon ===<br />
<br />
摘自[[Wikipedia:Phonon (software)|维基百科]]:<br />
<br />
:Phonon 是 KDE 的多媒体 API, 提供了多个多媒体框架的抽象,为 KDE 和一些 QT 程序提供多媒体流处理功能。<br />
<br />
:Phonon 最初的目的,是让 KDE 和 Qt 软件独立于其他多媒体框架(例如GStreamer或xine),并为其提供一个稳定的 API。<br />
<br />
KDE 广泛地将 Phonon 用于音频(例如系统通知或者 KDE 声音应用)和视频(例如 [[Dolphin]] 中的视频缩略图)中。<br />
<br />
==== 我应该选择哪个后端? ====<br />
<br />
您可以在 [[GStreamer]] 和 [[VLC]] 之间做选择–每个后端都有 Qt4 和 Qt5 版本 ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://lists.kde.org/?l=kde-multimedia&m=137994906723790&w=2 KDE-Multimedia 上游建议使用 VLC 后端],但是很多 Linux 发行版 (例如 Kubuntu 和 Fedora-KDE ) 选择 GStreamer,因为它可以更方便的去掉专利 MPEG codecs。它们的 [https://community.kde.org/Phonon/FeatureMatrix 功能]有稍许不同。The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav 编解码器。<br />
* {{Pkg|gst-plugins-good}} — PulseAudio 支持与额外的编解码器。<br />
* {{Pkg|gst-plugins-ugly}} — 额外的编解码器。<br />
* {{Pkg|gst-plugins-bad}} — 额外的编解码器。<br />
<br />
过去还有一些后端,但已经因为缺乏维护而删除了它们的 AUR 软件包。<br />
<br />
{{注意|1=<br><br />
* 可以同时安装多个后端,并在 ''系统设置 > 多媒体 > 后端'' 中进行优先级设定。<br />
* 根据 [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE 这个帖子], VLC 后端不支持 [[wikipedia:ReplayGain|ReplayGain]]。<br />
* 如果使用 VLC 后端,可能会遇到崩溃问题,如在每次 Plasma 发送语音警告时崩溃等等,详见 [https://forum.kde.org/viewtopic.php?f=289&t=135956]。重建VLC插件缓存也许能解决问题:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen -f /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== 拼写检查 ===<br />
<br />
KDE 使用 {{Pkg|sonnet}} 提供拼写检查功能。查看它的可选依赖以获取支持的[[spell checker|拼写检查]]。<br />
<br />
可在 ''系统设置->区域设置->拼写检查'' 配置拼写检查。<br />
<br />
=== 使用NVIDIA显卡运行kwin wayland ===<br />
<br />
见 https://community.kde.org/Plasma/Wayland/Nvidia。<br />
<br />
== 应用程序 ==<br />
<br />
KDE项目提供了一套与Plasma桌面集成的应用程序。有关可用应用程序的完整列表,详见 {{Grp|kde-applications}} 软件包。另见 [[:Category:KDE|KDE 相关应用页面]]。<br />
<br />
除了 KDE 应用程序包提供的程序之外,还有许多其他可用于补充 Plasma 的应用程序。其中一些将在下面讨论。<br />
<br />
=== 系统管理 ===<br />
<br />
==== KDE 系统设置中配置终止 Xorg-server ====<br />
<br />
浏览到子菜单:<br />
系统设置 > 硬件 > 输入设备 > 键盘 > 高级(标签) > "Key Sequence to kill the X server" <br />
然后选中复选框。<br />
<br />
==== KCM ====<br />
<br />
KCM 意为 KDE 控制模块('''KC'''onfig '''M'''odule)。这些模块在系统设置中提供了界面从而帮助您配置系统,或通过命令行('kcmshell5'')。<br />
<br />
* {{App|sddm-kcm|[[SDDM]] 的 KDE 配置模块|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 和 GTK3 的 KDE 配置器。|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|允许管理员改变 [[PolicyKit]] 设置的配置模块集。|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE Wacom 驱动的图形界面。|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|KDE 系统控制模块。|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
可在 [https://www.linux-apps.com/search?projectSearchText=KCM linux-apps.com] 找到更多的 KCM 。<br />
<br />
=== 桌面搜索 ===<br />
<br />
KDE 使用 [[Baloo (简体中文)]] 索引与查找文件。<br />
<br />
=== Web 浏览器 ===<br />
<br />
下列浏览器可以与 Plasma 集成:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|KDE项目的一部分, 支持两种渲染引擎 – KHTML 和基于[[Chromium]]的 Qt Web引擎。|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:QupZilla|QupZilla]]|包含 Plasma 集成特性的 Qt web 浏览器。其使用 Qt Web引擎。|https://github.com/QupZilla/qupzilla|{{Pkg|qupzilla}}{{Broken package link (简体中文)|package not found}}}}<br />
* {{App|[[Chromium]]|Chromium 及它的专有版本 Google Chrome 具有有限的 Plasma 集成。 [[KDE Wallet#KDE Wallet for Chrome and Chromium|它们可以使用 KWallet]] 以及 KDE 窗口 打开/保存。|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox 可以通过配置以和 Plasma 更好地集成。参考 [[Firefox_(简体中文)#KDE_整合|Firefox KDE整合]]。|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
=== 个人信息管理(PIM) ===<br />
<br />
KDE 提供了自有的[[Wikipedia:Personal information management|个人信息管理]](PIM)存储,包括电子邮件,联系人,日历等。可以使用 {{Grp|kde-pim}} 安装包组或 {{Pkg|kde-pim-meta}} 元软件包安装所有 PIM 软件包。<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi 是系统中本地缓存各种来源的 PIM 数据的一种方法,接着这些数据可以被其它的应用使用。这包含了用户的邮件、联系人、日历、事件、刊物、闹钟、笔记等。Akonadi 自身并不存储任何数据:存储格式依赖于数据的性质(例如,联系人可能以 vcard 格式存储)。<br />
<br />
[[安装]] {{Pkg|akonadi}}. 若需其他插件,安装 {{Pkg|kdepim-addons}}。<br />
<br />
{{注意|若要使用除 MariaDB/MySQL 以外的数据库引擎,请在安装 {{Pkg|akonadi}} 包时使用以下命令从而跳过 {{Pkg|mariadb}} 依赖项的安装:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
另见 {{Bug|32878}}。<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== 系统级 MySQL 实例 ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{Expansion|Add instructions.}}<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
====== SQLite ======<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
编辑Akonadi配置文件以匹配以下配置:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
见 [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem KDE userbase 的此部分]。<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] 是一个把即时信息功能紧密整合到 KDE 桌面中的项目。它使用 Telepathy 框架作为后端,意在替代 Kopete。<br />
<br />
若要安装所有 Telepathy 协议,安装 {{Grp|telepathy}} 组。<br />
若要使用 KDE Telepathy 客户端,安装 {{Pkg|telepathy-kde-meta}} 元软件包,它包含了所有在 {{Grp|telepathy-kde}} 组中的软件包。<br />
<br />
==== 在 KDE Telepathy 中使用 Telegram ====<br />
<br />
{{Out of date (简体中文)|''telegram-purple'' [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple 已被放弃]。另见[[Special:Diff/704779|Diff/704779]]。As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] 协议需要使用 {{pkg|telepathy-haze}}, 安装 {{aur|telegram-purple}} 或 {{aur|telegram-purple-git}} 和 {{aur|telepathy-morse-git}}。用户名是 Telegram 账户电话号码 (加国家前缀 {{ic|+''xx''}},例如德国是 {{ic|+49}}).<br />
<br />
通过图形界面进行配置可能会很棘手:如果在KDE Telepathy客户端中配置新帐户时不接受电话号码(出现一个错误信息表明参数无效并阻止创建账户),请把其添加在单引号中,并在帐号创建好后从配置文件({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}})中手动移除引号(如果引号未被移除,会发生认证错误)。<br />
<br />
{{注意|配置文件应当在 KDE Telepathy 未运行时手动编辑,例如当 KDE 桌面未激活时,否则手动更改可能会被软件覆盖。}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] 提供了一些功能以将 [[Android]] 手机与Linux桌面连接:<br />
<br />
* 从任何应用向 KDE 共享文件和 URL 或从 KDE 向任何应用共享,无需连线。<br />
* 触摸板模拟:将手机屏幕用作计算机的触摸板。<br />
* 通知同步(4.3+):从桌面读取您的安卓通知。<br />
* 共享剪贴板:在手机和电脑之间复制粘贴。<br />
* 多媒体远程控制:将手机用作 Linux 媒体播放器的遥控器。<br />
* WiFi 连接:不需要 usb 和蓝牙。<br />
* RSA加密:保证您的信息安全。<br />
<br />
您需要同时在电脑和安卓上安装 KDE Connect。PC端上安装 {{Pkg|kdeconnect}} 软件包,而安卓端可以在 [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] 或 [https://f-droid.org/repository/browse/?fdid=org.kde.kdeconnect_tp F-Droid] 上安装 KDE Connect。If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
即使不使用 Plasma 桌面,您也可以使用 KDE Connect。对于使用 AppIndicator的桌面环境(如Unity),还需要安装 {{AUR|indicator-kdeconnect}} 软件包。For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== 提示和技巧 ==<br />
<br />
=== 使用其他窗口管理器 ===<br />
<br />
Plasma 中的组件选择器设置已不再允许更改窗口管理器。[https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]若需更改窗口管理器,您需要在 KDE 启动之前设置 {{ic|KDEWM}} [[Environment_variables_(简体中文)|环境变量]]。The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox 会话 ====<br />
<br />
软件包 {{Pkg|openbox}} 为在plasma下使用 [[Openbox]] 提供了会话. 要使用这个会话,请在 [[display manager]] 菜单中选择 ''KDE/Openbox'' .<br />
<br />
若要手动启动会话,请将下面这行添加到您的 [[xinit (简体中文)|xinit]] 配置中:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== 重新启用特殊效果 ====<br />
<br />
当您用不包含混成器的窗口管理器(例如 Openbox)替换 Kwin 时,任何桌面特殊效果都会失效(例如窗口透明度)。在这种情况下,请安装并运行其他独立的混成器,如 [[Xcompmgr]] 或 [[Compton]]。<br />
<br />
=== 配置显示器分辨率 / 多显示器 ===<br />
<br />
若要在 Plasma 中启用分辨率和多显示器管理, 请安装 {{Pkg|kscreen}}. 它在 ''系统设置 > 显示'' 中添加了更多选项.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{Out of date (简体中文)|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] 该项目已停止支持,并将不能在 Plasma 5.24下工作。}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency]是一种尝试,它试图减少KWin compositor在Wayland中的延迟和中断,可以在这里 {{AUR|KWin-lowlatency}}获得。<br />
<br />
=== 配置 ICC 色彩矫正 ===<br />
<br />
若要在Plasma中启用 [[ICC profiles|ICC 配置文件]],请先安装{{Pkg|colord-kde}},它会在''系统设置''中添加''色彩校正''选项。<br />
<br />
使用“添加配置文件”可以导入ICC配置文件。<br />
<br />
=== 禁用使用 Super 键(Windows 键)打开应用程序启动器 ===<br />
<br />
若要禁用此功能,请运行以下命令:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== 在应用程序菜单中禁用书签 ===<br />
<br />
安装了Plasma Browser集成后,KDE将在应用程序启动器中显示书签。<br />
<br />
要禁用此功能,您可以运行以下命令:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== 字体 ===<br />
<br />
==== 字体在Plasma会话中看起来发虚 ====<br />
<br />
尝试安装{{Pkg|ttf-dejavu}}和{{Pkg|ttf-liberation}}包。<br />
<br />
安装后,请确保登出并重新登录。无需修改 ''系统设置 > 字体'' 中的任何选项。如果您正在使用{{Pkg|qt5ct}},Qt5配置工具中的设置可能会覆盖系统设置中的字体设置。<br />
<br />
如果您设置了字体[[Fonts (简体中文)]]的渲染方式,请注意系统设置可能会改变它们的外观。当您进入 ''系统设置 > 字体'' 时,系统设置可能会改变您的字体配置文件({{ic|Fonts.conf}})。<br />
<br />
这是无法避免的,但是,如果您设置的字体与{{ic|fonts.conf}} 文件匹配,则将返回预期的字体渲染效果(这将要求您重新启动应用程序或在重新登录您的桌面)。请注意,Gnome的“字体首选项”也可以执行此操作。<br />
<br />
==== 字体很大或看起来不成比例 ====<br />
<br />
尝试在 ''系统设置 > 字体'' 中强制字体DPI为 {{ic|'''96'''}} 。<br />
<br />
如果不起作用,请尝试按照 [[Xorg (简体中文)#手动设置DPI]] 中的说明直接在Xorg配置文件中设置DPI。<br />
<br />
=== 有关配置的问题 ===<br />
<br />
KDE 中许多问题都跟配置相关。<br />
<br />
==== Plasma 桌面行为异常 ====<br />
<br />
Plasma 故障通常是由不稳定的 '''plasma 小部件'''(plasmoids)或者 '''plasma 主题'''引起的。首先寻找最近安装的 plasmoid 或者 plasma 主题并禁用或者卸载它。<br />
<br />
因此,如果您的桌面突然被"锁定"了,很可能是由于安装了有问题的组件造成的。如果您不记得故障发生前您安装了什么小部件(有时它可能是一个不寻常的问题),请通过逐个移除小部件直到问题不再出现。然后您可以卸载这个小部件并提交一份缺陷报告,'''若是官方小部件时'''到[https://bugs.kde.org/ KDE 缺陷跟踪页]提交一份缺陷报告。如果它不是,您可以在 https://store.kde.org/ 上寻找它的条目并告知小部件的开发者您所碰到的问题(以及再现它的详细步骤等)。<br />
<br />
如果您找不到问题,也不想丢失''所有''设置,浏览到{{ic|~/.config}}:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
这个命令会将'''所有'''用户中跟 Plasma 有关的设置重命名为 *.bak (例如 {{ic|plasmarc.bak}}),并且当重新登录 Plasma 时,将会恢复'''默认'''设置。若要撤销该操作,请删除.bak文件扩展名。若已有 *.bak 文件,请先重命名,移动或删除它们。强烈建议您经常备份。 有关可能的方案列表,见[[Synchronization and backup programs|同步和备份程序(英文)]]。<br />
<br />
==== 清理缓存以解决升级故障 ====<br />
<br />
[https://bbs.archlinux.org/viewtopic.php?id=135301 此故障]可能由旧的缓存导致。有时,升级后旧缓存可能会产生奇怪的、难以调试的行为,例如关不掉的 shell、改变设置时失去响应、以及像 ark 不能解压 rar/zip 文件又或者 amarok 不能识别音乐等各种其它问题。这个办法也能解决 KDE 和 Qt 程序在升级后变得难看的问题。<br />
<br />
用以下命令来重建缓存:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== 不能在系统设置中更改主题、图标、字体、颜色;大多数图标不显示 ====<br />
<br />
确保 {{ic|QT_QPA_PLATFORMTHEME}} 在 [[Environment variables (简体中文)]] 未设置,命令 {{ic|printenv QT_QPA_PLATFORMTHEME}} 输出应该为空。Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== 音量控制、通知或多媒体键不起作用 ====<br />
<br />
隐藏系统托盘设置中的某些项(如音频音量、媒体播放器或通知)也会禁用相关功能。Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== 登录界面不会将光标设置同步到SDDM ====<br />
<br />
登录界面从{{ic|~/.config/kcminputrc}}读取您的光标设置,如果没有此文件,则不会同步任何设置。生成此文件的最简单方法是在 ''系统设置 > 光标'' 中更改光标主题,然后将其更改回首选的光标主题。<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== 图形问题 ===<br />
<br />
请先确保您已安装了适合您 GPU 的驱动程序。详见 [[Xorg#Driver installation]]。如果您的显卡较旧,您可以尝试 [[#禁用桌面特效]] 或 [[#禁用混合项(compositing)]]。<br />
<br />
==== 获取KWin的当前状态以用于获得帮助和调试 ====<br />
<br />
该命令打印出KWin当前状态的摘要,包括使用的选项,使用的合成后端以及相关的OpenGL驱动程序功能。详见[https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog]。<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== 禁用桌面特效 ====<br />
<br />
Plasma 默认启用了桌面特效,并且不是所有的游戏都会自动禁用它们。您可以通过''系统设置 > 桌面特效'' 禁用桌面特效。您也可以使用 {{ic|Alt+Shift+F12}} 切换桌面效果。<br />
<br />
另外,您也可以在 ''系统设置 > 窗口管理 > 窗口规则'' 下创建自定义KWin规则,以在某个应用程序/窗口启动时自动禁用/启用混合项。<br />
<br />
==== 启用透明功能 ====<br />
<br />
如果使用透明背景而不启用合成器,则会收到以下消息:<br />
<br />
配色方案使用的透明背景在您的桌面上似乎不受支持<br />
<br />
在 ''系统设置 > 显示和监视 > 合成器'' 中,选中 ''启动时开启混成'' 并重新启动Plasma。<br />
<br />
==== 禁用混成 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''启动时激活混成器''并重启 Plasma。<br />
<br />
==== 启用混成时全屏状态会闪烁 ====<br />
<br />
在 ''系统设置 > 显示''中取消选中''允许应用程序阻止混成''。这可能会影响性能。<br />
<br />
==== Nvidia 显卡屏幕撕裂 ====<br />
<br />
{{提示|翻译人员使用,请无视本提示。英文页面将本章搬到了 NVIDIA/Troubleshooting ,但中文没有此界面,故保留此章}}<br />
<br />
默认情况下,KWin 混合项在与 Nvidia 闭源驱动一起使用时会遭受屏幕撕裂。要解决此问题,运行 {{ic|kwin_x11 --replace}} 并在其之前陈述环境变量 {{ic|1=export __GL_YIELD="USLEEP"}}:<br />
<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
<br />
与使用全局环境变量不同,这只会影响 KWin,并不会降低其他 3D 应用程序的 CPU 性能。也可以通过在 Plasma 的 {{ic|~/.config/autostart-scripts}} 文件夹中创建一个简单的脚本,使其在登录时自动执行。<br />
<br />
{{hc|~/.config/autostart-scripts/restartkwinusleep.sh|<nowiki><br />
(sleep 2s &&<br />
export __GL_YIELD="USLEEP" && kwin_x11 --replace<br />
)<br />
<br />
</nowiki>}}<br />
{{ic|sleep}} 参数有助于防止 KWin 在登录后过早重新启动时出现问题,可以根据需要调整时间。 不要忘记将脚本标记为可执行文件。<br />
<br />
==== Plasma 光标有时显示不正确 ====<br />
<br />
创建 {{ic|~/.icons/default}} 目录并在其内创建一个包含以下内容的 {{ic|index.theme}} 的文件:<br />
<br />
{{hc|/home/''archie''/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
执行以下命令:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== 更改角色时(例如,将鼠标悬停在超链接上时)光标抖动/闪烁 ====<br />
<br />
尝试为系统和窗口管理器安装适当的2D加速驱动程序。<br />
<br />
==== 屏幕分辨率设置不可用 ====<br />
<br />
您的kscreen本地配置设置可以覆盖{{ic|xorg.conf}}中设置的配置。在{{ic|~/.local/share/kscreen/}}中查找kscreen配置文件,并检查分辨率是否设置为显示器不支持的分辨率。<br />
<br />
==== 系统托盘上的图标模糊 ====<br />
<br />
为了在托盘中添加图标,应用程序经常使用 appindicator库。如果图标模糊,请检查已安装的libappindicator版本。如果您只安装了{{Pkg|libappindicator-gtk2}},那么您可以安装{{Pkg|libappindicator-gtk3},以尝试获得清晰的图标。<br />
<br />
==== 在虚拟机中无法更改屏幕分辨率 ====<br />
<br />
当在[[VMware]]、[[VirtualBox]]或[[QEMU]]虚拟机上运行Plasma时,kscreen可能不允许将Guest的屏幕分辨率更改为高于800x600的分辨率。<br />
<br />
解决方法是在 {{man|5|xorg.conf.d}} 中设置 {{ic|PreferredMode}} 选项,或者尝试在VM中使用其他图形适配器。例如,对于VirtualBox,使用VBoxSVGA代替VMSVGA;对于QEMU,用Virtio代替QXL。<br />
有关详细信息,请参见[https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058]。<br />
<br />
==== Dolphin、Kate等软件启动时卡住很长时间 ====<br />
<br />
检查您的用户文件夹({{ic|Documents}} 和 {{ic|Downloads}} 等)是否设为了只读。<br />
<br />
=== 声音问题 ===<br />
<br />
{{注意|首先保证您已经安装了 {{Pkg|alsa-utils}}。}}<br />
<br />
==== 挂起后没有声音 ====<br />
<br />
如果挂起后没有声音并且 Kmix 没有显示应该显示的音频设备,可以尝试重新启动 plasmeshell 和 pulseaudio:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
某些应用程序也可能需要重新启动才能再次播放声音。<br />
<br />
==== 使用 GStreamer Phonon 后端时不能播放 MP3 文件 ====<br />
<br />
安装 GStreamer libav 插件(软件包{{Pkg|gst-libav}})可以解决问题。如果仍然碰到,您可以尝试换一个软件包,例如 {{AUR|phonon-qt4-vlc}} 或 {{Pkg|phonon-qt5-vlc}}。<br />
<br />
然后,请在以下位置检查它是否已是首选的后端:<br />
<br />
系统设置 > 多媒体 > 后端<br />
<br />
If you the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== 电源管理 ===<br />
<br />
==== 没有挂起/休眠选项 ====<br />
<br />
如果您的系统可以使用 systemd 挂起/休眠,但 KDE 中没有这些选项,请确保 {{Pkg|powerdevil}} 已被安装。<br />
<br />
=== KMail ===<br />
<br />
==== 清理 akonadi 配置来修复 kmail ====<br />
<br />
详见 [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration]。<br />
<br />
若要备份配置文件,请复制以下文件夹:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== KMail 的 IMAP 收件箱是空的 ====<br />
<br />
对于某些 IMAP 账户,kmail将把收件箱当作一个包含此帐户所有其他文件夹的容器显示。Kmail 不会在收件箱容器中显示消息,而是在所有其他子文件夹中显示消息,见 [https://bugs.kde.org/show_bug.cgi?id=284172]。若要解决此问题,只需在kmail帐户设置中禁用服务器端订阅即可。<br />
<br />
==== KMail中EWS帐户的授权错误 ====<br />
<br />
在KMail中设置EWS帐户时,您可能会不断收到关于授权失败的错误,即使是使用有效的凭证。这可能是由于[[KWallet]]和KMail之间的通讯中断造成的。要解决此问题,请通过qdbus设置密码:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
见 [[Qt#Disable/Change Qt journal logging behaviour]]。<br />
<br />
=== KF5/Qt 5应用程序在i3/FVWM/awesome中不显示图标 ===<br />
<br />
见 [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]]。<br />
<br />
=== 保存凭据和持续显示 KWallet 对话框的问题 ===<br />
<br />
不建议在用户设置中关闭 KWallet 密码保存系统,因为需要它为每个用户保存加密凭证(如WiFi密码)。关闭它可能会导致 KWallet 对话框持续出现。<br />
<br />
如果您嫌每当应用程序想要访问 Kwallet 时需要解锁烦,您可以让登录管理器 SDDM 和 LightDM 在登录时自动解锁 KWallet,见 [[KDE Wallet (简体中文)]]。第一个钱包需要由 KWallet 生成(而不是“用户生成”),以便用于系统程序凭据。<br />
<br />
如果您不希望让钱包凭据在内存内为每个应用打开,可以通过 {{Pkg|kwalletmanager}} 在KWallet设置中限制应用程序访问它。<br />
<br />
如果您不关心凭证加密,您可以在创建钱包,KWallet 要求输入密码时,将密码留空。这样,应用程序将可以在不解锁钱包的情况下访问密码。<br />
<br />
=== Discover不显示任何程序 ===<br />
<br />
请安装 {{Pkg|packagekit-qt5}} 以解决问题。<br />
<br />
=== NVIDIA驱动程序的kscreenlocker_greet的CPU使用率很高 ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== 某些程序的窗口处于非活动状态时无法滚动 ===<br />
<br />
这是由GTK3处理鼠标滚动事件处理有问题造成的。一个解决方法是设置[[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}。但是,这种方法也会破坏触摸板的平滑滚动和触摸屏滚动。<br />
<br />
=== TeamViewer 很卡 ===<br />
<br />
在使用TeamViewer时,如果您使用平滑动画(比如最小化窗口),它可能会运行得很慢。参见 [[#禁用混合项(compositing)]] 作为一种解决方案。<br />
<br />
=== Kmail, Kontact and wayland ===<br />
<br />
Kmail可能会失去响应,显示一个黑色的消息视图或者类似的,通常是在最小化和恢复之后。一个解决方案可能是设置 [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}。<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
{{Style|The language in this section could use some improvements for clarity and grammar (mostly in regards to the first sentence and section heading).}}<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== 另见 ==<br />
<br />
* [https://www.kde.org/ KDE 主页]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE 论坛]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE 缺陷跟踪页]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix 房间]</div>Fincehttps://wiki.archlinux.org/index.php?title=Baloo&diff=727350Baloo2022-04-23T15:59:14Z<p>Fince: add Chinese translate link</p>
<hr />
<div>[[Category:Search]]<br />
[[Category:KDE]]<br />
[[zh-hans:Baloo]]<br />
[https://community.kde.org/Baloo Baloo] is a file indexing and searching framework for [[KDE]] Plasma.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|baloo}} package.<br />
<br />
== Usage and configuration ==<br />
<br />
In order to search using Baloo on the Plasma desktop, start [[KRunner]] (default keyboard shortcut {{ic|ALT+F2}}) and type in your query. Within Dolphin press {{ic|Ctrl+f}}.<br />
<br />
By default the Desktop Search KCM exposes only two options: A panel to blacklist folders and a way to disable it with one click. Alternatively you can edit your {{ic|~/.config/baloofilerc}} file ([https://community.kde.org/Baloo/Configuration info]). <br />
<br />
Additionally the {{ic|balooctl}} process can also be used to control Baloo, e.g. in order to stop/start Baloo use {{ic|balooctl suspend}} or {{ic|balooctl start}} to resume.<br />
<br />
Once you added additional folders to the blacklist or disabled Baloo entirely, a process named {{ic|baloo_file_cleaner}} removes all unneeded index files automatically. These are stored under {{ic|~/.local/share/baloo/}}.<br />
<br />
== Command-line usage ==<br />
<br />
$ baloosearch ''query''<br />
<br />
Support for range queries:<br />
<br />
$ baloosearch "width>=6000 width<7000"<br />
<br />
Groups and OR/AND operators:<br />
<br />
$ baloosearch "tag:coolpicture OR (width>=6000 width<7000)"<br />
<br />
For a list of all supported filter properties available, see ([https://api.kde.org/frameworks/baloo/html/searching.html info]).<br />
<br />
Note that text search index breaks down all metadata (including filenames) into "words", and does all its searches over it from the beginning of the word only. What this means is that while {{ic|baloosearch "tutorial"}} would match {{ic|my_great_tutorial.txt}}, {{ic|baloosearch "utorial"}} would not match it.<br />
To see what "words" baloo stored in the index for a particular file do:<br />
<br />
$ balooshow -x ''filename''<br />
<br />
== Indexing a removable or remote device ==<br />
<br />
By default every removable and remote device is blacklisted. It is possible to remove devices from the blacklist in the KCM panel.<br />
<br />
== Disabling the indexer ==<br />
<br />
To disable the Baloo file indexer:<br />
<br />
$ balooctl suspend<br />
$ balooctl disable<br />
<br />
The indexer will be disabled on next login.<br />
<br />
Alternatively, disable ''Enable File Search'' in ''System settings'' under ''Search > File search''.<br />
<br />
To permanently delete the index database, run:<br />
<br />
$ balooctl purge<br />
<br />
This will also resolve the following error message in file dialogs and other applications ([https://bugs.kde.org/show_bug.cgi?id=437176 KDE bug 437176]):<br />
<br />
kf.kio.core: "Could not enter folder tags:/."<br />
<br />
== Troubleshooting ==<br />
<br />
=== Inotify folder watch limit error ===<br />
<br />
If you get the following error:<br />
<br />
KDE Baloo Filewatch service reached the inotify folder watch limit. File changes may be ignored.<br />
<br />
Then you will need to increase the inotify folder watch limit:<br />
<br />
# echo 524288 > /proc/sys/fs/inotify/max_user_watches<br />
<br />
To make changes permanent, create a [[sysctl]] configuration file:<br />
<br />
{{hc|/etc/sysctl.d/40-max-user-watches.conf|2=<br />
fs.inotify.max_user_watches=524288<br />
}}<br />
<br />
=== Plasma Vault Files are indexed and available even when vault is closed ===<br />
<br />
This is a major security [https://bugs.kde.org/show_bug.cgi?id=390830 bug] not yet fixed. Any file inside vault is by default indexed and available through file manager search, Krunner and Kickoff.<br />
<br />
One workaround is to '''stop''' folder(s) from being indexed by Baloo. The relevant options are available in ''System Settings > Search > File Search > Folder specific configuration > Add folder configuration > Stop indexing a folder''. After adding the desired folder, the existing Baloo data needs to be removed and freshly indexed again:<br />
<br />
$ balooctl disable<br />
$ balooctl purge<br />
$ balooctl enable<br />
$ balooctl check</div>Fincehttps://wiki.archlinux.org/index.php?title=Baloo_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727349Baloo (简体中文)2022-04-23T15:59:00Z<p>Fince: -</p>
<hr />
<div>[[Category:Search]]<br />
[[Category:KDE]]<br />
[[en:Baloo]]<br />
[https://community.kde.org/Baloo Baloo] 是 [[KDE (简体中文)|KDE]] Plasma 的文件索引与搜索框架。<br />
<br />
== 安装 ==<br />
<br />
[[Install (简体中文)|安装]] {{Pkg|baloo}} 软件包。<br />
<br />
== 用法与配置 ==<br />
<br />
为了在 Plasma 桌面上使用 Baloo 进行搜索,启动 krunner (默认快捷键 {{ic|ALT+F2}})并键入查询。若要在 Dophin(文件管理器)内搜索,按{{ic|CTRL+F}}。<br />
<br />
在默认情况下,桌面搜索的 KCM 仅显示两个选项:一个将文件夹放入黑名单的面板以及一种一次点击来禁用它的方法。<br />
<br />
或者您可以编辑 {{ic|~/.config/baloofilerc}} 文件[https://community.kde.org/Baloo/Configuration]。另外您也可以使用 {{ic|balooctl}} 进程。运行 {{ic|balooctl stop}} 和 {{ic|balooctl disable}}。<br />
<br />
将文件夹添加到黑名单或完全禁用了Baloo之后,{{ic|baloo_file_cleaner}} 进程将会自动删除所有不需要的索引文件。这些文件存储于 {{ic|~/.local/share/baloo/}} 目录下。<br />
<br />
== 命令行用法 ==<br />
<br />
$ baloosearch ''query''<br />
<br />
Support for range queries:<br />
<br />
$ baloosearch "width>=6000 width<7000"<br />
<br />
Groups and OR/AND operators:<br />
<br />
$ baloosearch "tag:coolpicture OR (width>=6000 width<7000)"<br />
<br />
For a list of all supported filter properties available, see ([https://api.kde.org/frameworks/baloo/html/searching.html info]).<br />
<br />
Note that text search index breaks down all metadata (including filenames) into "words", and does all its searches over it from the beginning of the word only. What this means is that while {{ic|baloosearch "tutorial"}} would match {{ic|my_great_tutorial.txt}}, {{ic|baloosearch "utorial"}} would not match it.<br />
To see what "words" baloo stored in the index for a particular file do:<br />
<br />
$ balooshow -x ''filename''<br />
<br />
== 索引可移动设备或远程设备 ==<br />
<br />
默认情况下,所有可移动设备都在黑名单内,只需在 KCM 面板中将其移除即可。<br />
<br />
== 禁用索引器 ==<br />
<br />
To disable the Baloo file indexer:<br />
<br />
$ balooctl suspend<br />
$ balooctl disable<br />
<br />
The indexer will be disabled on next login.<br />
<br />
Alternatively, disable ''Enable File Search'' in ''System settings'' under ''Search > File search''.<br />
<br />
To permanently delete the index database, run:<br />
<br />
$ balooctl purge<br />
<br />
This will also resolve the following error message in file dialogs and other applications ([https://bugs.kde.org/show_bug.cgi?id=437176 KDE bug 437176]):<br />
<br />
kf.kio.core: "Could not enter folder tags:/."<br />
<br />
== 疑难解答 ==<br />
<br />
=== Inotify folder watch limit error ===<br />
<br />
If you get the following error:<br />
<br />
KDE Baloo Filewatch service reached the inotify folder watch limit. File changes may be ignored.<br />
<br />
Then you will need to increase the inotify folder watch limit:<br />
<br />
# echo 524288 > /proc/sys/fs/inotify/max_user_watches<br />
<br />
To make changes permanent, create a [[sysctl]] configuration file:<br />
<br />
{{hc|/etc/sysctl.d/40-max-user-watches.conf|2=<br />
fs.inotify.max_user_watches=524288<br />
}}<br />
<br />
=== Plasma Vault Files are indexed and available even when vault is closed ===<br />
<br />
This is a major security [https://bugs.kde.org/show_bug.cgi?id=390830 bug] not yet fixed. Any file inside vault is by default indexed and available through file manager search, Krunner and Kickoff.<br />
<br />
One workaround is to '''stop''' folder(s) from being indexed by Baloo. The relevant options are available in ''System Settings > Search > File Search > Folder specific configuration > Add folder configuration > Stop indexing a folder''. After adding the desired folder, the existing Baloo data needs to be removed and freshly indexed again:<br />
<br />
$ balooctl disable<br />
$ balooctl purge<br />
$ balooctl enable<br />
$ balooctl check</div>Fincehttps://wiki.archlinux.org/index.php?title=Baloo_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727348Baloo (简体中文)2022-04-23T15:57:57Z<p>Fince: create page</p>
<hr />
<div>[[Category:Search]]<br />
[[Category:KDE]]<br />
[[en:Baloo]]<br />
<br />
[https://community.kde.org/Baloo Baloo] 是 [[KDE (简体中文)|KDE]] Plasma 的文件索引与搜索框架。<br />
<br />
== 安装 ==<br />
<br />
[[Install (简体中文)|安装]] {{Pkg|baloo}} 软件包。<br />
<br />
== 用法与配置 ==<br />
<br />
为了在 Plasma 桌面上使用 Baloo 进行搜索,启动 krunner (默认快捷键 {{ic|ALT+F2}})并键入查询。若要在 Dophin(文件管理器)内搜索,按{{ic|CTRL+F}}。<br />
<br />
在默认情况下,桌面搜索的 KCM 仅显示两个选项:一个将文件夹放入黑名单的面板以及一种一次点击来禁用它的方法。<br />
<br />
或者您可以编辑 {{ic|~/.config/baloofilerc}} 文件[https://community.kde.org/Baloo/Configuration]。另外您也可以使用 {{ic|balooctl}} 进程。运行 {{ic|balooctl stop}} 和 {{ic|balooctl disable}}。<br />
<br />
将文件夹添加到黑名单或完全禁用了Baloo之后,{{ic|baloo_file_cleaner}} 进程将会自动删除所有不需要的索引文件。这些文件存储于 {{ic|~/.local/share/baloo/}} 目录下。<br />
<br />
== 命令行用法 ==<br />
<br />
$ baloosearch ''query''<br />
<br />
Support for range queries:<br />
<br />
$ baloosearch "width>=6000 width<7000"<br />
<br />
Groups and OR/AND operators:<br />
<br />
$ baloosearch "tag:coolpicture OR (width>=6000 width<7000)"<br />
<br />
For a list of all supported filter properties available, see ([https://api.kde.org/frameworks/baloo/html/searching.html info]).<br />
<br />
Note that text search index breaks down all metadata (including filenames) into "words", and does all its searches over it from the beginning of the word only. What this means is that while {{ic|baloosearch "tutorial"}} would match {{ic|my_great_tutorial.txt}}, {{ic|baloosearch "utorial"}} would not match it.<br />
To see what "words" baloo stored in the index for a particular file do:<br />
<br />
$ balooshow -x ''filename''<br />
<br />
== 索引可移动设备或远程设备 ==<br />
<br />
默认情况下,所有可移动设备都在黑名单内,只需在 KCM 面板中将其移除即可。<br />
<br />
== 禁用索引器 ==<br />
<br />
To disable the Baloo file indexer:<br />
<br />
$ balooctl suspend<br />
$ balooctl disable<br />
<br />
The indexer will be disabled on next login.<br />
<br />
Alternatively, disable ''Enable File Search'' in ''System settings'' under ''Search > File search''.<br />
<br />
To permanently delete the index database, run:<br />
<br />
$ balooctl purge<br />
<br />
This will also resolve the following error message in file dialogs and other applications ([https://bugs.kde.org/show_bug.cgi?id=437176 KDE bug 437176]):<br />
<br />
kf.kio.core: "Could not enter folder tags:/."<br />
<br />
== 疑难解答 ==<br />
<br />
=== Inotify folder watch limit error ===<br />
<br />
If you get the following error:<br />
<br />
KDE Baloo Filewatch service reached the inotify folder watch limit. File changes may be ignored.<br />
<br />
Then you will need to increase the inotify folder watch limit:<br />
<br />
# echo 524288 > /proc/sys/fs/inotify/max_user_watches<br />
<br />
To make changes permanent, create a [[sysctl]] configuration file:<br />
<br />
{{hc|/etc/sysctl.d/40-max-user-watches.conf|2=<br />
fs.inotify.max_user_watches=524288<br />
}}<br />
<br />
=== Plasma Vault Files are indexed and available even when vault is closed ===<br />
<br />
This is a major security [https://bugs.kde.org/show_bug.cgi?id=390830 bug] not yet fixed. Any file inside vault is by default indexed and available through file manager search, Krunner and Kickoff.<br />
<br />
One workaround is to '''stop''' folder(s) from being indexed by Baloo. The relevant options are available in ''System Settings > Search > File Search > Folder specific configuration > Add folder configuration > Stop indexing a folder''. After adding the desired folder, the existing Baloo data needs to be removed and freshly indexed again:<br />
<br />
$ balooctl disable<br />
$ balooctl purge<br />
$ balooctl enable<br />
$ balooctl check</div>Fincehttps://wiki.archlinux.org/index.php?title=Samba_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727330Samba (简体中文)2022-04-23T12:49:24Z<p>Fince: translate</p>
<hr />
<div>[[Category:Networking (简体中文)]]<br />
[[de:Samba]]<br />
[[en:Samba]]<br />
[[ja:Samba]]<br />
[[ru:Samba]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|NFS}}<br />
{{Related|Samba/Active Directory domain controller}}<br />
{{Related|Active Directory Integration}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|Samba|2020-05-06|606810}}<br />
'''Samba''' 是 [[wikipedia:Server_Message_Block|SMB/CIFS]] 网络协议的重新实现, 可以在 Linux 和 Windows 系统间进行文件、打印机共享,和 [[NFS (简体中文)|NFS]] 的功能类似。本文介绍如何配置和使用 Samba.<br />
<br />
== 服务器 ==<br />
<br />
=== 安装 ===<br />
<br />
[[Pacman|安装]] 软件包 {{Pkg|samba}}。<br />
<br />
Samba 服务的配置文件是 {{ic|/etc/samba/smb.conf}},{{man|5|smb.conf}}提供了详细的文档。<br />
<br />
{{Pkg|samba}} 软件包没有提供此文件,启动 ''smb''.service 前需要先创建这个文件。从 [https://git.samba.org/samba.git/?p=samba.git;a=blob_plain;f=examples/smb.conf.default;hb=HEAD 这里] 可以获取到示例文件。<br />
<br />
从上面获取的默认配置文件里把日志{{ic|log file}}设置到一个不能写的地方, 这会引起错误。下面的办法可以解决这个问题:<br />
* 把日志文件放到可写的路径: {{ic|1=log file = /var/log/samba/%m.log}}<br />
** 把日志存到非文件后端的解决方案里: {{ic|1=logging = syslog}} 配合 {{ic|1=syslog only = yes}}, 或者使用 {{ic|1=logging = systemd}}<br />
<br />
如果需要的话; 在{{ic|[global]}}部份中指定的 {{ic|workgroup}} 需要对应windows工作组的名称 (默认是 {{ic|WORKGROUP}}).<br />
<br />
{{Tip (简体中文)|修改 {{ic|smb.conf}} 文件后,运行 {{man|1|testparm}} 命令看看有没有语法错误。}}<br />
<br />
==== 配置防火墙 ====<br />
<br />
如果使用了 [[firewall|防火墙]],请记得打开需要的端口(通常是 137-139 + 445). 完整列表请查看 [https://www.samba.org/~tpot/articles/firewall.html Samba 端口使用]。<br />
<br />
=== 用户管理 ===<br />
<br />
==== 添加用户 ====<br />
<br />
Samba 需要 Linux 账户才能使用 - 可以使用已有账户或 [[Users and groups#User management|创建新用户]].<br />
<br />
虽然用户名可以和 Linux 系统共享,Samba 使用单独的密码管理,将下面的 {{ic|samba_user}} 替换为选择的 Samba 用户:<br />
<br />
# smbpasswd -a ''samba_user''<br />
<br />
根据 [https://www.samba.org/samba/docs/man/manpages-3/smb.conf.5.html#SERVERROLE 服务器角色] 的差异,可能需要修改已有的 [[File permissions and attributes|文件权限和属性]]。<br />
<br />
要让新创建的用户仅能访问 Samba 远程文件服务器,可以禁用其它登录选项<br />
* 禁用 shell - {{ic|usermod --shell /usr/bin/nologin --lock samba_user}}<br />
* 禁用 SSH logons - /etc/ssh/sshd_config, option {{ic|AllowUsers}}<br />
<br />
参阅[[Security]]。<br />
<br />
==== 查询用户 ====<br />
<br />
用 {{man|8|pdbedit}} 命令查询现有用户:<br />
<br />
# pdbedit -L -v<br />
<br />
==== 更改 samba 用户的密码 ====<br />
<br />
用 {{ic|smbpasswd}} 修改 samba 用户的密码:<br />
<br />
# smbpasswd ''samba_user''<br />
<br />
==== 创建共享 ====<br />
<br />
{{Note (简体中文)|To allow the usage of ''guests'' on public shares, one may need to [[append]] {{ic|1=map to guest = Bad User}} in the {{ic|[global]}} section of {{ic|/etc/samba/smb.conf}}. A different {{ic|1=guest account}} may be used instead of the default provided {{ic|nobody}}.}}<br />
<br />
请确保 [https://git.samba.org/samba.git/?p=samba.git;a=blob_plain;f=examples/smb.conf.default;hb=HEAD smb.conf.default] 的 ''Share Definitions'' 部分正确设置了共享。<br />
<br />
==== 启动服务 ====<br />
<br />
为了能够使用 SMB 进行基本的文件共享,[[Systemd#Using units|start/enable]] {{ic|smb.service}} 和 {{ic|nmb.service}} 服务。更多信息参阅 [https://www.samba.org/samba/docs/man/manpages-3/smbd.8.html smbd] 和 [https://www.samba.org/samba/docs/man/manpages-3/nmbd.8.html nmbd] 的 man 手册。<br />
{{ic|nmb.service}} 并不总是需要启用。<br />
<br />
{{提示|除了在启动时启动服务,可以选择启用 {{ic|smbd.socket}},禁用 {{ic|smb.service}}。这样的话会在第一次收到连接请求是启动后台进程。}}<br />
<br />
=== 高级配置 ===<br />
<br />
==== 建立 Usershare 路径 ====<br />
<br />
{{Note (简体中文)|此为可选功能,如无需要可以跳过。}}<br />
<br />
[https://www.samba.org/samba/docs/current/man-html/smb.conf.5.html Usershares] 让不具有 root 权限的用户可以进行添加、修改和删除自己的文件夹的操作。<br />
<br />
以下操作将会在 {{ic|/var/lib/samba}} 添加 usershares 目录:<br />
<br />
#mkdir /var/lib/samba/usershare<br />
<br />
以下操作将会建立 sambashare 用户组:<br />
<br />
#groupadd sambashare<br />
<br />
以下操作将会将刚刚建立的文件夹的权限:拥有者更改为 root,群组更改为 sambashare:<br />
<br />
# chown root:sambashare /var/lib/samba/usershare<br />
<br />
以下的操作将会让 sambashare 群组中的用户拥有读取,写入和执行此文件夹中内容的权限:<br />
<br />
# chmod 1770 /var/lib/samba/usershare<br />
<br />
修改 {{ic|smb.conf}} 配置文件中的以下变量:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
...<br />
[global]<br />
usershare path = /var/lib/samba/usershare<br />
usershare max shares = 100<br />
usershare allow guests = yes<br />
usershare owner only = yes<br />
...<br />
}}<br />
<br />
将用户添加到群组 ''sambashare'' 中。其中,替换 {{ic|''your_username''}} 为实际的用户名:<br />
<br />
# usermod -a -G sambashare ''your_username''<br />
<br />
重启 {{ic|smb.service}} 和 {{ic|nmb.service}} 服务。<br />
<br />
注销后重新登陆,此时您应该就可以使用 GUI 程序配置您的 samba 共享服务了。例如,在 [[Thunar]] 中您可以右键点击任何一个文件夹将它在局域网中共享。如果你想共享自己主目录内的路径,需要主目录的内容让其它用户可以列出。<br />
<br />
在命令行中,请使用下面命令, 替换掉 ''sharename'', ''user'', ... :<br />
<br />
# net usershare add ''sharename'' ''abspath'' [''comment''] [''user'':{R|D|F}] [guest_ok={y|n}]<br />
# net usershare delete ''sharename''<br />
# net usershare list ''wildcard-sharename''<br />
# net usershare info ''wildcard-sharename''<br />
<br />
==== Set and forcing permissions ====<br />
<br />
Permissions may be applied to both the server and shares:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
;inherit owner = unix only ; Inherit ownership of the parent directory for new files and directories<br />
;inherit permissions = yes ; Inherit permissions of the parent directory for new files and directories<br />
create mask = 0664<br />
directory mask = 2755<br />
force create mode = 0644<br />
force directory mode = 2755<br />
...<br />
<br />
[media]<br />
comment = Media share accessible by ''greg'' and ''pcusers''<br />
path = ''/path/to/media''<br />
valid users = ''greg @pcusers''<br />
force group = ''+pcusers''<br />
public = no<br />
writable = yes<br />
create mask = 0664<br />
directory mask = 2775<br />
force create mode = 0664<br />
force directory mode = 2775<br />
<br />
[public]<br />
comment = Public share where ''archie'' has write access<br />
path = ''/path/to/public''<br />
public = yes<br />
read only = yes<br />
write list = ''archie''<br />
printable = no<br />
<br />
[guests]<br />
comment = Allow all users to read/write<br />
path = ''/path/to/guests''<br />
public = yes<br />
only guest = yes<br />
writable = yes<br />
printable = no<br />
}}<br />
<br />
See {{man|5|smb.conf}} for a full overview of possible permission flags and settings.<br />
<br />
==== Restrict protocols for better security ====<br />
<br />
{{Warning (简体中文)|By default, Samba versions prior to 4.11 allow connections using the outdated and insecure SMB1 protocol. When using one these Samba versions, it is highly recommended to set {{ic|1=server min protocol = SMB2_02}} to protect yourself from ransomware attacks. In Samba 4.11 and newer, SMB2 is the default min protocol, so no changes are required there.}}<br />
<br />
[[Append]] {{ic|server min protocol}} and {{ic|server max protocol}} in {{ic|/etc/samba/smb.conf}} to force usage of a minimum and maximum protocol:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
server min protocol = SMB2_02<br />
; server max protocol = SMB3<br />
}}<br />
<br />
See {{ic|server max protocol}} in {{man|5|smb.conf}} for an overview of supported protocols.<br />
<br />
For compatibility with older clients and/or servers, you might need to set {{ic|1=client min protocol = CORE}} or {{ic|1=server min protocol = CORE}}, but please note that this makes you vulnerable to exploits in SMB1 including ransomware attacks.<br />
<br />
{{Tip (简体中文)|Use {{ic|1=server min protocol = SMB3_00}} when clients should only connect using the latest SMB3 protocol, e.g. on clients running Windows 8 and later.}}<br />
<br />
[[#手动挂载|Clients]] using {{ic|mount.cifs}} may need to specify the correct {{ic|1=vers=*}}, e.g.:<br />
<br />
# mount -t cifs //''SERVER''/''sharename'' /mnt/''mountpoint'' -o username=''username'',password=''password'',iocharset=''utf8'',vers=''3.1.1''<br />
<br />
See {{man|8|mount.cifs}} for more information.<br />
<br />
==== Restrict protocols for better security ====<br />
<br />
{{Warning (简体中文)|By default, Samba versions prior to 4.11 allow connections using the outdated and insecure SMB1 protocol. When using one these Samba versions, it is highly recommended to set {{ic|1=server min protocol = SMB2_02}} to protect yourself from ransomware attacks. In Samba 4.11 and newer, SMB2 is the default min protocol, so no changes are required there.}}<br />
<br />
[[Append]] {{ic|server min protocol}} and {{ic|server max protocol}} in {{ic|/etc/samba/smb.conf}} to force usage of a minimum and maximum protocol:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
server min protocol = SMB2_02<br />
; server max protocol = SMB3<br />
}}<br />
<br />
See {{ic|server max protocol}} in {{man|5|smb.conf}} for an overview of supported protocols.<br />
<br />
For compatibility with older clients and/or servers, you might need to set {{ic|1=client min protocol = CORE}} or {{ic|1=server min protocol = CORE}}, but please note that this makes you vulnerable to exploits in SMB1 including ransomware attacks.<br />
<br />
{{Tip (简体中文)|Use {{ic|1=server min protocol = SMB3_00}} when clients should only connect using the latest SMB3 protocol, e.g. on clients running Windows 8 and later.}}<br />
<br />
[[#手动挂载|Clients]] using {{ic|mount.cifs}} may need to specify the correct {{ic|1=vers=*}}, e.g.:<br />
<br />
# mount -t cifs //''SERVER''/''sharename'' /mnt/''mountpoint'' -o username=''username'',password=''password'',iocharset=''utf8'',vers=''3.1.1''<br />
<br />
See {{man|8|mount.cifs}} for more information.<br />
<br />
==== Use native SMB transport encryption ====<br />
<br />
Native SMB transport encryption is available in SMB version 3.0 or newer. Clients supporting this type of encryption include Windows 8 and newer, Windows server 2012 and newer, and smbclient of Samba 4.1 and newer.<br />
<br />
To use native SMB transport encryption by default, set the {{ic|smb encrypt}} parameter globally and/or by share. Possible values are {{ic|off}}, {{ic|enabled}} (default value), {{ic|desired}}, or {{ic|required}}:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
smb encrypt = desired<br />
}}<br />
<br />
See {{man|5|smb.conf}} for more information, especially the paragraphs ''Effects for SMB1'' and ''Effects for SMB2''.<br />
<br />
{{Tip (简体中文)|When [[#手动挂载|mounting]] a share, specify the {{ic|seal}} mount option to force usage of encryption.}}<br />
<br />
==== Disable printer sharing ====<br />
<br />
By default Samba shares printers configured using [[CUPS]].<br />
<br />
If you do not want printers to be shared, use the following settings:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
load printers = no<br />
printing = bsd<br />
printcap name = /dev/null<br />
disable spoolss = yes<br />
show add printer wizard = no<br />
}}<br />
<br />
==== Block certain file extensions on Samba share ====<br />
<br />
{{Note (简体中文)|Setting this parameter will affect the performance of Samba, as it will be forced to check all files and directories for a match as they are scanned.}}<br />
<br />
Samba offers an option to block files with certain patterns, like file extensions. This option can be used to prevent dissemination of viruses or to dissuade users from wasting space with certain files. More information about this option can be found in {{man|5|smb.conf}}.<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
...<br />
[myshare]<br />
comment = Private<br />
path = /mnt/data<br />
read only = no<br />
veto files = /*.exe/*.com/*.dll/*.bat/*.vbs/*.tmp/*.mp3/*.avi/*.mp4/*.wmv/*.wma/<br />
}}<br />
<br />
==== Improve throughput ====<br />
<br />
{{Warning (简体中文)|Beware this may lead to corruption/connection issues and potentially cripple your TCP/IP stack.}}<br />
<br />
The default settings should be sufficient for most users. However setting the 'socket options' correct can improve performance, but getting them wrong can degrade it by just as much. Test the effect before making any large changes.<br />
<br />
Read the {{man|5|smb.conf}} man page before applying any of the options listed below.<br />
<br />
The following settings should be [[append]] to the {{ic|[global]}} section of {{ic|/etc/samba/smb.conf}}.<br />
<br />
SMB3 multi-channel may improve performance, however it may result in data corruption under some race conditions. Future releases may improve this situation:<br />
<br />
server multi channel support = yes<br />
<br />
Setting a deadtime is useful to stop a server's resources being exhausted by a large number of inactive connections:<br />
<br />
deadtime = 30<br />
<br />
The usage of sendfile may make more efficient use of the system CPU's and cause Samba to be faster:<br />
<br />
use sendfile = yes<br />
<br />
The write cache allows Samba to batch client writes into a more efficient write size for [[RAID]] disks (i.e. writes may be tuned to be the RAID stripe size) and can improve performance on systems where the disk subsystem is a bottleneck but there is free memory for userspace programs:<br />
<br />
write cache size = 262144<br />
<br />
Setting min receivefile size allows zero-copy writes directly from network socket buffers into the filesystem buffer cache (if available). It may improve performance but user testing is recommended:<br />
<br />
min receivefile size = 16384<br />
<br />
Reading/writing files asynchronously may improve performance instead of using synchronously writes:<br />
<br />
aio read size = 1<br />
aio write size = 1<br />
<br />
Increasing the receive/send buffers size and socket optimize flags might be useful to improve throughput. It is recommended to test each flag separately as it may cause issues on some networks:<br />
<br />
socket options = IPTOS_LOWDELAY TCP_NODELAY IPTOS_THROUGHPUT SO_RCVBUF=131072 SO_SNDBUF=131072<br />
<br />
{{Note (简体中文)|Network-interface adjustments may be needed for some options to work, see [[Sysctl#Networking]].}}<br />
<br />
== 客户端配置 ==<br />
<br />
如果不需要查询公开的共享,可以安装轻量级的 {{Pkg|cifs-utils}} 软件包,使用 {{ic|/usr/bin/mount.cifs}} 命令挂载共享.<br />
<br />
要使用类似 ftp 的命令行界面,请安装软件包 {{Pkg|smbclient}}。常用命令请参考 {{man|1|smbclient}}。<br />
<br />
[[desktop environment|桌面环境]] 可能提供了图形界面,参考[[#File manager configuration]].<br />
<br />
{{Note (简体中文)|安装 {{Pkg|cifs-utils}} 或 {{Pkg|smbclient}} 后,请加载 {{ic|cifs}} [[kernel module|内核模块]] 或重启以避免挂载失败。}}<br />
<br />
=== 显示可用共享 ===<br />
<br />
下面命令会显示服务器上的可用共享:<br />
<br />
$ smbclient -L ''hostname'' -U%<br />
<br />
''smbtree'' 可用显示共享目录树,不建议再有大量计算机的网络上使用此功能。可用它检查共享名是否可用。<br />
<br />
$ smbtree -b -N<br />
<br />
{{ic|-b}} ({{ic|--broadcast}}) 使用广播模式,{{ic|-N}} ({{ic|-no-pass}}) 不询问密码.<br />
<br />
=== WINS 主机名 ===<br />
<br />
{{pkg|smbclient}} 提供了一个用 WINS 解析主机名的驱动,要启用它,将 “wins” 添加到 /etc/nsswitch.conf 的 “hosts” 行。<br />
<br />
=== 手动挂载 ===<br />
<br />
创建共享挂载点:<br />
<br />
# mkdir /mnt/''mountpoint''<br />
<br />
使用 {{ic|mount.cifs}} 作为挂载类型 {{ic|type}},下面列出的选项并不是全部都需要:<br />
{{bc|1=<br />
# mount -t cifs //''SERVER''/''sharename'' /mnt/''mountpoint'' -o user=''username'',password=''password'',uid=''username'',gid=''group'',workgroup=''workgroup'',ip=''serverip'',iocharset=''utf8''<br />
}}<br />
<br />
要允许用户挂载到自己可以访问的目录,请使用 {{ic|users}} 挂载选项。<br />
<br />
{{Note (简体中文)|请注意这里有 '''s''',其它文件系统一般用的是 ''user''。}}<br />
使用 {{ic|uid}} 和 {{ic|gid}} 挂载选项时,请注意 [[File permissions and attributes|文件权限]],否则会出现 I/O 错误。}}<br />
<br />
''SERVER''<br />
: 服务器名.<br />
<br />
''sharename''<br />
: 共享目录.<br />
<br />
''mountpoint''<br />
: 本地的挂载点.<br />
<br />
{{ic|<nowiki>-o [options]</nowiki>}}<br />
: 详情请参考 {{man|8|mount.cifs}}.<br />
<br />
{{Note (简体中文)|<br />
* 结尾不要加 {{ic|/}}. {{ic|//''SERVER''/''sharename'''''/'''}} 无法工作.<br />
* 如果挂载工作不稳定,出现死机和掉线问题,请尝试用 {{ic|1=vers=}} 设置不同的 SMB 协议版本。例如, 挂载 Vista 用 {{ic|1=vers=2.0}}.<br />
* 如果挂载了 cifs 机器上出现关机超时,请参考 [[wpa_supplicant#Problem with mounted network shares (cifs) and shutdown]].<br />
}}<br />
<br />
==== 保存共享密码 ====<br />
<br />
不建议将密码保存在所有人都可读的文件中,一个更安全的方式是创建密码文件:<br />
{{hc|/path/to/credentials/share|2=<br />
username=''myuser''<br />
password=''mypass''<br />
}}<br />
<br />
将 {{ic|<nowiki>username=myuser,password=mypass</nowiki>}} 替换为 {{ic|<nowiki>credentials=/path/to/credentials/share</nowiki>}}.<br />
<br />
修改密码文件的权限:<br />
# chmod 600 /path/to/credentials/share<br />
<br />
=== 自动挂载 ===<br />
<br />
{{Note (简体中文)|You may need to [[enable]] {{ic|systemd-networkd-wait-online.service}} or {{ic| NetworkManager-wait-online.service}} (depending on your setup) to proper enable booting on start-up.}}<br />
<br />
==== 作为挂载路径 ====<br />
<br />
This is a simple example of a {{ic|cifs}} [[fstab|mount entry]] that requires authentication:<br />
<br />
{{hc|/etc/fstab|2=<br />
//''SERVER''/''sharename'' /mnt/''mountpoint'' cifs _netdev,username=''myuser'',password=''mypass'' 0 0<br />
}}<br />
<br />
{{Note (简体中文)|Spaces in sharename should be replaced by {{ic|\040}} (ASCII code for space in octal). For example, {{ic|//''SERVER''/share name}} on the command line should be {{ic|//''SERVER''/share\040name}} in {{ic|/etc/fstab}}.}}<br />
<br />
{{Tip (简体中文)|Use {{ic|x-systemd.automount}} if you want them to be mounted only upon access. See [[Fstab#Remote file system]] for details.}}<br />
<br />
==== 作为系统单元 ====<br />
<br />
Create a new {{ic|.mount}} file inside {{ic|/etc/systemd/system}}, e.g. {{ic|mnt-myshare.mount}}. See {{man|5|systemd.mount}} for details.<br />
<br />
{{Note (简体中文)|Make sure the filename corresponds to the mountpoint you want to use.<br />
E.g. the unit name {{ic|mnt-myshare.mount}} can only be used if are going to mount the share under {{ic|/mnt/myshare}}. Otherwise the following error might occur: {{ic|1=systemd[1]: mnt-myshare.mount: Where= setting does not match unit name. Refusing.}}.}}<br />
<br />
{{ic|1=What=}} path to share<br />
<br />
{{ic|1=Where=}} path to mount the share<br />
<br />
{{ic|1=Options=}} share mounting options<br />
<br />
{{Note (简体中文)|<br />
* Network mount units automatically acquire {{ic|After}} dependencies on ''remote-fs-pre.target'', ''network.target'' and ''network-online.target'', and gain a {{ic|Before}} dependency on ''remote-fs.target'' unless {{ic|nofail}} mount option is set. Towards the latter a {{ic|Wants}} unit is added as well.<br />
* [[Append]] {{ic|noauto}} to {{ic|Options}} preventing automatically mount during boot (unless it is pulled in by some other unit).<br />
* If you want to use a hostname for the server you want to share (instead of an IP address), add {{ic|1=nss-lookup.target}} to {{ic|1=After}} and {{ic|1=Wants}}. This might avoid mount errors at boot time that do not arise when testing the unit.}} <br />
<br />
{{hc|/etc/systemd/system/mnt-myshare.mount|2=<br />
[Unit]<br />
Description=Mount Share at boot<br />
<br />
[Mount]<br />
What=//server/share<br />
Where=/mnt/myshare<br />
Options=_netdev,credentials=/etc/samba/credentials/myshare,iocharset=utf8,rw<br />
Type=cifs<br />
TimeoutSec=30<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
{{Tip (简体中文)|In case of an unreachable system, [[append]] {{ic|1=ForceUnmount=true}} to {{ic|[Mount]}}, allowing the share to be (force-)unmounted.}}<br />
<br />
To use {{ic|mnt-myshare.mount}}, [[start]] the unit and [[enable]] it to run on system boot.<br />
<br />
===== automount =====<br />
<br />
To automatically mount a share, one may use the following automount unit:<br />
<br />
{{hc|/etc/systemd/system/mnt-myshare.automount|2=<br />
[Unit]<br />
Description=Automount myshare<br />
<br />
[Automount]<br />
Where=/mnt/myshare<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
}}<br />
<br />
[[Disable]]/[[stop]] the {{ic|mnt-myshare.mount}} unit, and [[enable]]/[[start]] {{ic|mnt-myshare.automount}} to automount the share when the mount path is being accessed.<br />
<br />
{{Tip (简体中文)|[[Append]] {{ic|TimeoutIdleSec}} to enable auto unmount. See {{man|5|systemd.automount}} for details.}}<br />
<br />
==== smbnetfs ====<br />
<br />
{{Note (简体中文)|1=smbnetfs needs an intact Samba server setup.<br />
See above on how to do that.}}<br />
<br />
First, check if you can see all the shares you are interested in mounting:<br />
$ smbtree -U ''remote_user''<br />
<br />
If that does not work, find and modify the following line<br />
in {{ic|/etc/samba/smb.conf}} accordingly:<br />
<br />
domain master = auto<br />
<br />
Now [[restart]] {{ic|smb.service}} and {{ic|nmb.service}}.<br />
<br />
If everything works as expected, [[pacman#Installing specific packages|install]] {{Pkg|smbnetfs}} from the official repositories.<br />
<br />
Then, add the following line to {{ic|/etc/fuse.conf}}:<br />
<br />
user_allow_other<br />
<br />
Now copy the directory {{ic|/etc/smbnetfs/.smb}} to your home directory:<br />
<br />
$ cp -a /etc/smbnetfs/.smb ~<br />
<br />
Then create a link to {{ic|smb.conf}}:<br />
<br />
$ ln -sf /etc/samba/smb.conf ~/.smb/smb.conf<br />
<br />
If a username and a password are required to access some of the shared folders, edit {{ic|~/.smb/smbnetfs.auth}}<br />
to include one or more entries like this:<br />
<br />
{{hc|~/.smb/smbnetfs.auth|<br />
auth "hostname" "username" "password"<br />
}}<br />
<br />
It is also possible to add entries for specific hosts to be mounted by smbnetfs, if necessary.<br />
More details can be found in {{ic|~/.smb/smbnetfs.conf}}.<br />
<br />
If you are using the [[Dolphin]] or [[GNOME Files]], you may want to add the following to {{ic|~/.smb/smbnetfs.conf}} to avoid "Disk full" errors as smbnetfs by default will report 0 bytes of free space:<br />
<br />
{{hc|~/.smb/smbnetfs.conf|<br />
free_space_size 1073741824<br />
}}<br />
<br />
When you are done with the configuration, you need to run<br />
<br />
$ chmod 600 ~/.smb/smbnetfs.*<br />
<br />
Otherwise, smbnetfs complains about 'insecure config file permissions'.<br />
<br />
Finally, to mount your Samba network neighbourhood to a directory of your choice, call<br />
<br />
$ smbnetfs ''mount_point''<br />
<br />
===== Daemon =====<br />
<br />
The Arch Linux package also maintains an additional system-wide operation mode for smbnetfs. To enable it, you need to make the<br />
said modifications in the directory {{ic|/etc/smbnetfs/.smb}}.<br />
<br />
Then, you can start and/or enable the {{ic|smbnetfs}} [[daemon]] as usual. The system-wide mount point is at {{ic|/mnt/smbnet/}}.<br />
<br />
==== autofs ====<br />
<br />
See [[Autofs]] for information on the kernel-based automounter for Linux.<br />
<br />
=== 文件管理器配置 ===<br />
<br />
==== GNOME文件、Nemo、Caja、Thunar 和 PCManFM ====<br />
<br />
In order to access samba shares through GNOME Files, Nemo, Caja, Thunar or PCManFM, install the {{Pkg|gvfs-smb}} package, available in the [[official repositories]].<br />
<br />
Press {{ic|Ctrl+l}} and enter {{ic|smb://''servername''/''share''}} in the location bar to access your share.<br />
<br />
The mounted share is likely to be present at {{ic|/run/user/''your_UID''/gvfs}} or {{ic|~/.gvfs}} in the filesystem.<br />
<br />
==== KDE ====<br />
<br />
KDE has the ability to browse Samba shares built in. To use a GUI in the KDE System Settings, you will need to install the {{Pkg|kdenetwork-filesharing}} package.<br />
<br />
If you get a "Time Out" Error when navigating with Dolphin, you should uncomment and edit the following line in smb.conf:{{bc|1=name resolve order = lmhosts bcast host wins}}<br />
as shown in this [https://ubuntuforums.org/showthread.php?t=1605499 page].<br />
<br />
==== 其它图形环境 ====<br />
<br />
There are a number of useful programs, but they may need to have packages created for them. This can be done with the Arch package build system. The good thing about these others is that they do not require a particular environment to be installed to support them, and so they bring along less baggage.<br />
<br />
* {{AUR|pyneighborhood}} is available in the official repositories.<br />
* LinNeighborhood, RUmba, xffm-samba plugin for Xffm are not available in the official repositories or the AUR. As they are not officially (or even unofficially supported), they may be obsolete and may not work at all.<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Discovering network shares ===<br />
<br />
If nothing is known about other systems on the local network, and automated tools such as [[#smbnetfs|smbnetfs]] are not available, the following methods allow one to manually probe for Samba shares.<br />
<br />
1. First, [[install]] the {{Pkg|nmap}} and {{Pkg|smbclient}} packages.<br />
<br />
2. {{ic|nmap}} checks which ports are open:<br />
<br />
# nmap -p 139 -sT "192.168.1.*"<br />
<br />
In this case, a scan on the 192.168.1.* IP address range and port 139 has been performed, resulting in:<br />
<br />
{{hc|$ nmap -sT "192.168.1.*"|<br />
Starting nmap 3.78 ( http://www.insecure.org/nmap/ ) at 2005-02-15 11:45 PHT<br />
Interesting ports on 192.168.1.1:<br />
(The 1661 ports scanned but not shown below are in state: closed)<br />
PORT STATE SERVICE<br />
'''139/tcp open netbios-ssn'''<br />
5000/tcp open UPnP<br />
<br />
Interesting ports on 192.168.1.5:<br />
(The 1662 ports scanned but not shown below are in state: closed)<br />
PORT STATE SERVICE<br />
6000/tcp open X11<br />
<br />
Nmap run completed -- 256 IP addresses (2 hosts up) scanned in 7.255 seconds<br />
}}<br />
<br />
The first result is another system; the second happens to be the client from where this scan was performed.<br />
<br />
3. Now that systems with port 139 open are revealed, use {{man|1|nmblookup}} to check for NetBIOS names: <br />
<br />
{{hc|$ nmblookup -A 192.168.1.1|<br />
Looking up status of 192.168.1.1<br />
PUTER <00> - B <ACTIVE><br />
HOMENET <00> - <GROUP> B <ACTIVE><br />
PUTER <03> - B <ACTIVE><br />
'''PUTER <20> - B <ACTIVE>'''<br />
HOMENET <1e> - <GROUP> B <ACTIVE><br />
USERNAME <03> - B <ACTIVE><br />
HOMENET <1d> - B <ACTIVE><br />
MSBROWSE <01> - <GROUP> B <ACTIVE><br />
}}<br />
<br />
Regardless of the output, look for '''<20>''', which shows the host with open services.<br />
<br />
4. Use {{ic|smbclient}} to list which services are shared on ''PUTER''. If prompted for a password, pressing enter should still display the list:<br />
<br />
{{hc|$ smbclient -L \\PUTER|2=<br />
Sharename Type Comment<br />
--------- ---- -------<br />
MY_MUSIC Disk<br />
SHAREDDOCS Disk<br />
PRINTER$ Disk<br />
PRINTER Printer<br />
IPC$ IPC Remote Inter Process Communication<br />
<br />
Server Comment<br />
--------- -------<br />
PUTER<br />
<br />
Workgroup Master<br />
--------- -------<br />
HOMENET PUTER<br />
}}<br />
<br />
=== Remote control of Windows computer ===<br />
<br />
Samba offers a set of tools for communication with Windows. These can be handy if access to a Windows computer through remote desktop is not an option, as shown by some examples.<br />
<br />
Send shutdown command with a comment:<br />
<br />
$ net rpc shutdown -C "comment" -I IPADDRESS -U USERNAME%PASSWORD<br />
<br />
A forced shutdown instead can be invoked by changing -C with comment to a single -f. For a restart, only add -r, followed by a -C or -f.<br />
<br />
Stop and start services:<br />
<br />
$ net rpc service stop SERVICENAME -I IPADDRESS -U USERNAME%PASSWORD<br />
<br />
To see all possible net rpc command:<br />
<br />
$ net rpc<br />
<br />
== 疑难解答 ==<br />
<br />
=== Failed to start Samba SMB/CIFS server ===<br />
<br />
Possible solutions:<br />
<br />
* Check {{ic|smb.conf}} on syntactic errors with {{man|1|testparm}}.<br />
* Set correct permissions for {{ic|/var/cache/samba/}} and [[restart]] {{ic|smb.service}}:<br />
<br />
# chmod 0755 /var/cache/samba/msg<br />
<br />
=== Permission issues on AppArmor ===<br />
<br />
If using a [[#创建共享|share path]] located outside of a home-directory, whitelist it in {{ic|/etc/apparmor.d/local/usr.sbin.smbd}}. E.g.:<br />
<br />
{{hc|/etc/apparmor.d/local/usr.sbin.smbd|<br />
"/data/" rk,<br />
"/data/**" lrwk,<br />
}}<br />
<br />
=== No dialect specified on mount ===<br />
<br />
The client is using an unsupported SMB/CIFS version that is required by the server.<br />
<br />
See [[#Restrict protocols for better security]] for more information.<br />
<br />
=== Unable to overwrite files, permissions errors ===<br />
<br />
{{Accuracy|An user should set/check for server/client permissions, instead of using incorrect/possible insecure flags.}}<br />
<br />
Possible solutions:<br />
<br />
* Append the mount option {{ic|nodfs}} to the {{ic|/etc/fstab}} [[#As mount entry|entry]].<br />
* Add {{ic|1=msdfs root = no}} to the {{ic|[global]}} section of the server's {{ic|/etc/samba/smb.conf}}.<br />
<br />
=== Windows clients keep asking for password even if Samba shares are created with guest permissions ===<br />
<br />
Set {{ic|map to guest}} inside the {{ic|global}} section of {{ic|/etc/samba/smb.conf}}:<br />
<br />
map to guest = Bad User<br />
<br />
From Samba 4.10.10 you should use {{ic|Bad Password}} instead {{ic|Bad User}}.<br />
<br />
=== Windows 7 connectivity problems - mount error(12): cannot allocate memory ===<br />
<br />
A known Windows 7 bug that causes "mount error(12): cannot allocate memory" on an otherwise perfect cifs share on the Linux end can be fixed by setting a few registry keys on the Windows box as follows:<br />
<br />
* {{ic|HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management\LargeSystemCache}} (set to {{ic|1}})<br />
* {{ic|HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters\Size}} (set to {{ic|3}})<br />
<br />
Alternatively, start Command Prompt in Admin Mode and execute the following:<br />
<br />
reg add "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management" /v "LargeSystemCache" /t REG_DWORD /d 1 /f<br />
reg add "HKLM\SYSTEM\CurrentControlSet\Services\LanmanServer\Parameters" /v "Size" /t REG_DWORD /d 3 /f<br />
<br />
Do one of the following for the settings to take effect:<br />
<br />
* Restart Windows<br />
* Restart the Server service via services.msc<br />
* From the Command Prompt run: 'net stop lanmanserver' and 'net start lanmanserver' - The server may automatically restart after stopping it.<br />
<br />
{{Note (简体中文)|Googling will reveal another tweak recommending users to add a key modifying the "IRPStackSize" size. This is incorrect for fixing this issue under Windows 7. Do not attempt it.}}<br />
<br />
[https://web.archive.org/web/20150819153712/http://alan.lamielle.net/2009/09/03/windows-7-nonpaged-pool-srv-error-2017/ Original article].<br />
<br />
=== Windows 10 1709 and up connectivity problems - "Windows cannot access" 0x80004005 ===<br />
<br />
This error affects some machines running Windows 10 version 1709 and later. It is not related to SMB1 being disabled in this version but to the fact that Microsoft disabled insecure logons for guests on this version for some, but not others.<br />
<br />
To fix, open Group Policy Editor ({{ic|gpedit.msc}}). Navigate to ''Computer configuration\administrative templates\network\Lanman Workstation > Enable insecure guest logons'' and enable it.<br />
Alternatively,change the following value in the registry:<br />
<br />
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]<br />
"AllowInsecureGuestAuth"=dword:1<br />
<br />
=== Error: Failed to retrieve printer list: NT_STATUS_UNSUCCESSFUL ===<br />
<br />
If you are a home user and using samba purely for file sharing from a server or NAS, you are probably not interested in sharing printers through it. If so, you can prevent this error from occurring by adding the following lines to your {{ic|/etc/samba/smb.conf}}:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
load printers = No<br />
printing = bsd<br />
printcap name = /dev/null<br />
disable spoolss = Yes<br />
}}<br />
<br />
[[Restart]] the samba service, {{ic|smb.service}}, and then check your logs:<br />
<br />
# cat /var/log/samba/smbd.log<br />
<br />
and the error should now no longer be appearing.<br />
<br />
=== Sharing a folder fails ===<br />
<br />
It means that while you are sharing a folder from ''Dolphin'' (file manager) and everything seems ok at first, after restarting ''Dolphin'' the share icon is gone from the shared folder, and also some output like this in terminal (''Konsole'') output:<br />
<br />
‘net usershare’ returned error 255: net usershare: usershares are currently disabled<br />
<br />
To fix it, enable usershare as described in [[#建立 Usershare 路径]].<br />
<br />
=== "Browsing" network fails with "Failed to retrieve share list from server" ===<br />
<br />
And you are using a firewall (iptables) because you do not trust your local (school, university, hotel) network. This may be due to the following: When the smbclient is browsing the local network it sends out a broadcast request on udp port 137. The servers on the network then reply to your client but as the source address of this reply is different from the destination address iptables saw when sending the request for the listing out, iptables will not recognize the reply as being "ESTABLISHED" or "RELATED", and hence the packet is dropped. A possible solution is to add:<br />
<br />
iptables -t raw -A OUTPUT -p udp -m udp --dport 137 -j CT --helper netbios-ns<br />
<br />
to your iptables setup.<br />
<br />
=== Protocol negotiation failed: NT_STATUS_INVALID_NETWORK_RESPONSE ===<br />
<br />
The client probably does not have access to shares. Make sure clients' IP address is in {{ic|1=hosts allow =}} line in {{ic|/etc/samba/smb.conf}}.<br />
<br />
Another problem could be, that the client uses an invalid protocol version. To check this try to connect with the {{ic|smbclient}} where you specify the maximum protocol version manually:<br />
<br />
$ smbclient -U <user name> -L //<server name> -m <protocol version: e. g. SMB2> -W <domain name><br />
<br />
If the command was successful then create a configuration file:<br />
<br />
{{hc|~/.smb/smb.conf|output=<br />
[global]<br />
workgroup = <domain name><br />
client max protocol = SMB2<br />
}}<br />
<br />
=== Connection to SERVER failed: (Error NT_STATUS_UNSUCCESSFUL) ===<br />
<br />
You are probably passing a wrong server name to {{ic|smbclient}}. To find out the server name, run {{ic|hostnamectl}} on the server and look at "Transient hostname" line<br />
<br />
=== Connection to SERVER failed: (Error NT_STATUS_CONNECTION_REFUSED) ===<br />
<br />
Make sure that the server has started. The shared directories should exist and be accessible.<br />
<br />
=== Protocol negotiation failed: NT_STATUS_CONNECTION_RESET ===<br />
<br />
Probably the server is configured not to accept protocol SMB1. Add option {{ic|1=client max protocol = SMB2}} in {{ic|/etc/samba/smb.conf}}.<br />
Or just pass argument {{ic|-m SMB2}} to {{ic|smbclient}}.<br />
<br />
=== Password Error when correct credentials are given (error 1326) ===<br />
<br />
[https://www.samba.org/samba/history/samba-4.5.0.html Samba 4.5] has NTLMv1 authentication disabled by default. It is recommend to install the latest available upgrades on clients and deny access for unsupported clients.<br />
<br />
If you still need support for very old clients without NTLMv2 support (e.g. Windows XP), it is possible force enable NTLMv1, although this is '''not recommend''' for security reasons:<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
lanman auth = yes<br />
ntlm auth = yes<br />
}}<br />
<br />
If NTLMv2 clients are unable to authenticate when NTLMv1 has been enabled, create the following file on the client:<br />
{{hc|/home/user/.smb/smb.conf|2=<br />
[global]<br />
sec = ntlmv2<br />
client ntlmv2 auth = yes<br />
}}<br />
<br />
This change also affects samba shares mounted with '''mount.cifs'''. If after upgrade to Samba 4.5 your mount fails, add the '''sec=ntlmssp''' option to your mount command, e.g.<br />
<br />
mount.cifs //server/share /mnt/point -o sec=ntlmssp,...<br />
<br />
See the {{man|8|mount.cifs}} man page: '''ntlmssp''' - Use NTLMv2 password hashing encapsulated in Raw NTLMSSP message. The default in mainline kernel versions prior to v3.8 was '''sec=ntlm'''. In v3.8, the default was changed to '''sec=ntlmssp'''.<br />
<br />
=== Mapping reserved Windows characters ===<br />
<br />
Starting with kernel 3.18, the cifs module uses the [https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=2baa2682531ff02928e2d3904800696d9e7193db "mapposix" option by default].<br />
When mounting a share using unix extensions and a default Samba configuration, files and directories containing one of the seven reserved Windows characters {{ic|: \ * < > ? |}} are listed but cannot be accessed.<br />
<br />
Possible solutions are:<br />
<br />
* Use the undocumented {{ic|nomapposix}} mount option for cifs<br />
<br />
# mount.cifs //server/share /mnt/point -o nomapposix<br />
<br />
* Configure Samba to remap {{ic|mapposix}} ("SFM", Services for Mac) style characters to the correct native ones using [https://www.mankier.com/8/vfs_fruit fruit]<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
vfs objects = catia fruit<br />
fruit:encoding = native<br />
}}<br />
<br />
* Manually remap forbidden characters using [https://www.mankier.com/8/vfs_catia catia]<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
vfs objects = catia<br />
catia:mappings = 0x22:0xf022, 0x2a:0xf02a, 0x2f:0xf02f, 0x3a:0xf03a, 0x3c:0xf03c, 0x3e:0xf03e, 0x3f:0xf03f, 0x5c:0xf05c, 0x7c:0xf07c, 0x20:0xf020<br />
}}<br />
<br />
The latter approach (using catia or fruit) has the drawback of filtering files with unprintable characters.<br />
<br />
=== Folder shared inside graphical environment is not available to guests ===<br />
<br />
This section presupposes:<br />
<br />
# Usershares are configured following [[#建立 Usershare 路径|previous section]]<br />
# A shared folder has been created as a non-root user from GUI<br />
# Guests access has been set to shared folder during creation<br />
# Samba service has been restarted at least once since last {{ic|/etc/samba/smb.conf}} file modification<br />
<br />
For clarification purpose only, in the following sub-sections is assumed:<br />
<br />
* Shared folder is located inside user home directory path ({{ic|/home/yourUser/Shared}})<br />
* Shared folder name is ''MySharedFiles''<br />
* Guest access is read-only.<br />
* Windows users will access shared folder content without login prompt<br />
<br />
==== Verify correct samba configuration ====<br />
<br />
Run the following command from a terminal to test configuration file correctness:<br />
<br />
$ testparm<br />
<br />
==== Verify correct shared folder creation ====<br />
<br />
Run the following commands from a terminal:<br />
<br />
$ cd /var/lib/samba/usershare<br />
$ ls<br />
<br />
If everything is fine, you will notice a file named {{ic|mysharedfiles}}<br />
<br />
Read the file contents using the following command:<br />
<br />
$ cat mysharedfiles<br />
<br />
The terminal output should display something like this:<br />
<br />
{{hc|/var/lib/samba/usershare/mysharedfiles|2=<br />
path=/home/yourUser/Shared<br />
comment=<br />
usershare_acl=S-1-1-0:r<br />
guest_ok=y<br />
sharename=MySharedFiles<br />
}}<br />
<br />
==== Verify folder access by guest ====<br />
<br />
Run the following command from a terminal. If prompted for a password, just press Enter:<br />
<br />
$ smbclient -L localhost<br />
<br />
If everything is fine, MySharedFiles should be displayed under {{ic|Sharename}} column<br />
<br />
Run the following command in order to access the shared folder as guest (anonymous login)<br />
<br />
$ smbclient -N //localhost/MySharedFiles<br />
<br />
If everything is fine samba client prompt will be displayed:<br />
<br />
smb: \><br />
<br />
From samba prompt verify guest can list directory contents:<br />
<br />
smb: \> ls<br />
<br />
If {{ic|NTFS_STATUS_ACCESS_DENIED}} error displayed, probably there is something to be solved at directory permission level.<br />
<br />
Run the following commands as root to set correct permissions for folders:<br />
<br />
# cd /home<br />
# chmod -R 755 /home/yourUser/Shared<br />
<br />
Access shared folder again as guest to be sure guest read access error has been solved.<br />
<br />
=== Mount error: Host is down ===<br />
<br />
This error might be seen when mounting shares of Synology NAS servers. Use the mount option {{ic|1=vers=1.0}} to solve it.<br />
<br />
{{Note (简体中文)|SMB version 1 is known to have security vulnerabilities and was used in successful ransomware attacks.}}<br />
<br />
=== Software caused connection abort ===<br />
<br />
File managers that utilizes {{Pkg|gvfs-smb}} can show the error {{ic|Software caused connection abort}} when writing a file to a share/server. This may be due to the server running SMB/CIFS version 1, which many routers use for USB drive sharing (e.g. Belkin routers). To write to these shares specify the CIFS version with the option {{ic|1=vers=1.0}}. E.g.:<br />
<br />
{{hc|/etc/fstab|2=<br />
//SERVER/sharename /mnt/mountpoint cifs _netdev,guest,file_mode=0777,dir_mode=0777,vers=1.0 0 0<br />
}}<br />
<br />
This can also happen after updating Samba to version 4.11, which deactivates SMB1 as default, and accessing any Samba share. You can reenable it by adding<br />
<br />
{{hc|/etc/samba/smb.conf|2=<br />
[global]<br />
client min protocol = CORE<br />
}}<br />
<br />
=== Connection problem (due to authentification error) ===<br />
<br />
Be sure that you do not leave any space characters before your username in Samba client configuration file as follows:<br />
<br />
{{hc|~/.samba|2=<br />
username= user<br />
password=pass<br />
}}<br />
<br />
The correct format is:<br />
<br />
{{hc|~/.samba|2=<br />
username=user<br />
password=pass<br />
}}<br />
<br />
== See also ==<br />
<br />
* [https://www.samba.org/ Official website]<br />
* [https://www.samba.org/samba/docs/SambaIntro.html Samba: An Introduction]<br />
* [https://www.samba.org/samba/docs/Samba-HOWTO-Collection.pdf Samba 3.2.x HOWTO and Reference Guide] (outdated but still most extensive documentation)<br />
* [[Wikipedia:Samba (software)|Wikipedia]]<br />
* [[Gentoo:Samba/Guide]]<br />
* [[Debian:SambaServerSimple]]</div>Fincehttps://wiki.archlinux.org/index.php?title=KDE&diff=727318KDE2022-04-23T08:18:29Z<p>Fince: /* Widgets */ change the description of Plasmoids</p>
<hr />
<div>[[Category:KDE]]<br />
[[de:KDE]]<br />
[[es:KDE]]<br />
[[fa:KDE]]<br />
[[fr:KDE]]<br />
[[ja:KDE]]<br />
[[ko:KDE]]<br />
[[pt:KDE]]<br />
[[ru:KDE]]<br />
[[zh-hans:KDE]]<br />
{{Related articles start}}<br />
{{Related|Desktop environment}}<br />
{{Related|Display manager}}<br />
{{Related|Window manager}}<br />
{{Related|Qt}}<br />
{{Related|SDDM}}<br />
{{Related|Dolphin}}<br />
{{Related|KDE Wallet}}<br />
{{Related|KDevelop}}<br />
{{Related|Trinity}}<br />
{{Related|Uniform look for Qt and GTK applications}}<br />
{{Related|Official repositories#kde-unstable}}<br />
{{Related articles end}}<br />
<br />
KDE is a software project currently comprising a [[desktop environment]] known as Plasma, a collection of libraries and frameworks (KDE Frameworks) and several applications (KDE Applications) as well. KDE upstream has a well maintained [https://userbase.kde.org/ UserBase wiki]. Detailed information about most KDE applications can be found there.<br />
<br />
== Installation ==<br />
<br />
=== Plasma ===<br />
<br />
Before installing Plasma, make sure you have a working [[Xorg]] installation on your system.<br />
<br />
[[Install]] the {{Pkg|plasma-meta}} meta-package or the {{Grp|plasma}} group. For differences between {{Pkg|plasma-meta}} and {{Grp|plasma}} reference [[Package group]]. Alternatively, for a more minimal Plasma installation, install the {{Pkg|plasma-desktop}} package.<br />
<br />
To enable support for [[Wayland]] in Plasma, also [[install]] the {{Pkg|plasma-wayland-session}} package. If you are an [[NVIDIA]] user, also install {{Pkg|egl-wayland}}, and if the session does not start with the proprietary {{Pkg|nvidia}} driver, also enable the [[NVIDIA#DRM kernel mode setting|DRM kernel mode setting]]. If that does not work, too, check the instructions on the [https://community.kde.org/Plasma/Wayland/Nvidia KDE wiki].<br />
<br />
=== KDE applications ===<br />
<br />
To install the full set of KDE Applications, install the {{Grp|kde-applications}} group or the {{Pkg|kde-applications-meta}} meta-package. If you only want KDE applications for a certain category such as games or education, install the relevant dependency of {{Pkg|kde-applications-meta}}. Note that this will only install applications, it will not install any version of Plasma.<br />
<br />
=== Unstable releases ===<br />
<br />
See [[Official repositories#kde-unstable]] for beta releases.<br />
<br />
== Starting Plasma ==<br />
<br />
{{Note|Although it is possible to launch Plasma under [[Wayland]], there are some missing features and known problems. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for a list of issues and the [https://phabricator.kde.org/project/board/99/ Plasma on Wayland workboard] for the current state of development. Use [[Xorg]] for the most complete and stable experience.}}<br />
<br />
Plasma can be started either using a [[display manager]], or from the console.<br />
<br />
=== Using a display manager ===<br />
<br />
{{Tip|The preferred [[display manager]] is [[SDDM]].}}<br />
<br />
* Select ''Plasma (X11)'' to launch a new session in [[Xorg]].<br />
* Select ''Plasma (Wayland)'' to launch a new session in [[Wayland]].<br />
<br />
=== From the console ===<br />
<br />
* To start Plasma with [[xinit|xinit/startx]], append {{ic|1=export DESKTOP_SESSION=plasma}} and {{ic|exec startplasma-x11}} to your {{ic|.xinitrc}} file. If you want to start Xorg at login, please see [[Start X at login]].<br />
* To start a Plasma on Wayland session from a console, run {{ic|1=dbus-run-session startplasma-wayland}}[https://community.kde.org/KWin/Wayland#Start_a_Plasma_session_on_Wayland].<br />
<br />
== Configuration ==<br />
<br />
Most settings for KDE applications are stored in {{ic|~/.config/}}. However, configuring KDE is primarily done through the '''System Settings''' application. It can be started from a terminal by executing {{ic|systemsettings}}.<br />
<br />
=== Personalization ===<br />
<br />
==== Plasma desktop ====<br />
<br />
===== Themes =====<br />
<br />
[https://store.kde.org/browse?cat=104/ Plasma themes] define the look of panels and Plasma widgets. For easy system-wide installation, some themes are available in both the official repositories and the [https://aur.archlinux.org/packages?K=plasma+theme AUR].<br />
<br />
Plasma themes can also be installed through ''System Settings > Appearance > Global Theme > Get New Global Themes...''.<br />
<br />
The [https://store.kde.org/ KDE Store] offers more Plasma customizations, like [[SDDM]] themes and splash-screens.<br />
<br />
====== GTK application appearance ======<br />
<br />
{{Tip|For Qt and GTK theme consistency, see [[Uniform look for Qt and GTK applications]].}}<br />
<br />
The recommended theme for a pleasant appearance in GTK applications is {{Pkg|breeze-gtk}}, a GTK theme designed to mimic the appearance of Plasma's Breeze theme.<br />
Install {{Pkg|kde-gtk-config}} (part of the {{grp|plasma}} group) and select {{ic|Breeze}} as the GTK theme in ''System Settings > Appearance > Application Style > Configure GNOME/GTK Application Style...''.<br />
<br />
{{Out of date|The Plasma GTKd background service overwrites GTK settings on Plasma startup.}}<br />
<br />
In some themes, tooltips in GTK applications have white text on white backgrounds making it difficult to read. To change the colors in GTK2 applications, find the section for tooltips in the {{ic|.gtkrc-2.0}} file and change it. For GTK3 application two files need to be changed, {{ic|gtk.css}} and {{ic|settings.ini}}.<br />
<br />
Some GTK2 programs like {{AUR|vuescan-bin}} still look hardly usable due to invisible checkboxes with the Breeze or Adwaita skin in a Plasma session. To workaround this, install and select e.g. the Numix-Frost-Light skin of the {{AUR|numix-frost-themes}} under ''System Settings > Appearance > Application Style > Configure GNOME/GTK Application Style... > GTK theme''. Numix-Frost-Light looks similar to Breeze.<br />
<br />
===== Faces =====<br />
<br />
Plasma and [[SDDM]] will both use images found at {{ic|/var/lib/AccountsService/icons/}} as users' avatars. To configure with a graphical interface, you can use ''System Settings > Users'', which may first need to be [[install]]ed (see the {{Pkg|plasma-desktop}} package). The file corresponding to your username can be removed to restore the default avatar.<br />
<br />
===== Widgets =====<br />
<br />
Plasmoids are widgets for plasma desktop shell designed to enhance the functionality of desktop.<br />
<br />
The easiest way to install plasmoid scripts is by right-clicking onto a panel or the desktop and choosing ''Add Widgets > Get New Widgets... > Download New Plasma Widgets''. This will present a nice frontend for https://store.kde.org/ that allows you to install, uninstall, or update third-party plasmoid scripts with literally just one click.<br />
<br />
Many Plasmoid binaries are available from the [https://aur.archlinux.org/packages?K=plasmoid AUR].<br />
<br />
===== Sound applet in the system tray =====<br />
<br />
[[Install]] {{Pkg|plasma-pa}} or {{Pkg|kmix}} (start Kmix from the Application Launcher). {{Pkg|plasma-pa}} is now installed by default with {{Grp|plasma}}, no further configuration needed.<br />
<br />
{{Note|1=To adjust the [https://bugs.kde.org/show_bug.cgi?id=313579#c28 step size of volume increments/decrements], add e.g. {{ic|1=VolumePercentageStep=1}} in the {{ic|[Global]}} section of {{ic|~/.config/kmixrc}}.}}<br />
<br />
===== Disable panel shadow =====<br />
<br />
As the Plasma panel is on top of other windows, its shadow is drawn over them. [https://bbs.archlinux.org/viewtopic.php?pid=1228394#p1228394] To disable this behaviour without impacting other shadows, [[install]] {{Pkg|xorg-xprop}} and run:<br />
<br />
$ xprop -remove _KDE_NET_WM_SHADOW<br />
<br />
then select the panel with the plus-sized cursor. [https://forum.kde.org/viewtopic.php?f=285&t=121592] For automation, install {{Pkg|xorg-xwininfo}} and create the following script:<br />
<br />
{{hc|/usr/local/bin/kde-no-shadow|<nowiki><br />
#!/bin/bash<br />
for WID in $(xwininfo -root -tree | sed '/"Plasma": ("plasmashell" "plasmashell")/!d; s/^ *\([^ ]*\) .*/\1/g'); do<br />
xprop -id $WID -remove _KDE_NET_WM_SHADOW<br />
done<br />
</nowiki>}}<br />
<br />
Make the script [[executable]].<br />
<br />
The script can be run on login with ''Add Script'' in ''Autostart'':<br />
<br />
$ kcmshell5 autostart<br />
<br />
===== Display scaling / High DPI displays =====<br />
<br />
See [[HiDPI#KDE Plasma]].<br />
<br />
==== Window decorations ====<br />
<br />
[https://store.kde.org/browse/cat/114/ Window decorations] can be changed in ''System Settings > Appearance > Window Decorations''.<br />
<br />
There you can also directly download and install more themes with one click, and some are available in the [https://aur.archlinux.org/packages?K=kde+window+decoration AUR].<br />
<br />
==== Icon themes ====<br />
<br />
Icon themes can be installed and changed on ''System Settings > Appearance > Icons''.<br />
<br />
{{Note|Although all modern Linux desktops share the same icon theme format, desktops like [[GNOME]] use fewer icons (esp. in menus and toolbars). Themes developed for such desktops usually lack icons required by Plasma and KDE applications. It is recommended to install Plasma compatible icon themes instead.}}<br />
<br />
{{Tip|Since some icon themes do not inherit from the default icon theme, some icons may be missing. <br />
To inherit from the Breeze, add {{ic|breeze}} to the {{ic|1=Inherits=}} array in {{ic|/usr/share/icon/''theme-name''/index.theme}}, for example: {{ic|1=Inherits=breeze,hicolor}}. You need to reapply this patch after every update to the icon theme, consider using [[Pacman hooks]] to automate the process.}}<br />
<br />
==== Space efficiency ====<br />
<br />
The Plasma Netbook shell has been dropped from Plasma 5, see the following [https://forum.kde.org/viewtopic.php?f=289&t=126631&p=335947&hilit=plasma+netbook#p335899 KDE forum post]. However, you can achieve something similar by editing the file {{ic|~/.config/kwinrc}} adding {{ic|1=BorderlessMaximizedWindows=true}} in the {{ic|[Windows]}} section.<br />
<br />
==== Thumbnail generation ====<br />
<br />
To allow thumbnail generation for media or document files on the desktop and in Dolphin, install {{Pkg|kdegraphics-thumbnailers}} and {{Pkg|ffmpegthumbs}}.<br />
<br />
Then enable the thumbnail categories for the desktop via ''right click'' on the ''desktop background'' > ''Configure Desktop and Wallpaper...'' > ''Icons'' > ''Configure Preview Plugins...''.<br />
<br />
In ''Dolphin'', navigate to ''Configure > Configure Dolphin... > General > Previews''.<br />
<br />
=== Night Color ===<br />
<br />
Plasma provides a [[Redshift]]-like feature (working on both [[Xorg]] and [[Wayland]]) called Night Color. It makes the colors on the screen warmer to reduce eye strain at the time of your choosing. It can be enabled in ''System Settings > Display and Monitor > Night Color''.<br />
<br />
{{Tip|To have a handy System Tray on/off button for night color you need the {{Pkg|kdeplasma-addons}} and then you can add it.}}<br />
<br />
=== Printing ===<br />
<br />
{{Tip|Use the [[CUPS]] web interface for faster configuration. Printers configured in this way can be used in KDE applications. }}<br />
<br />
You can also configure printers in ''System Settings > Printers''. To use this method, you must first install the following packages {{Pkg|print-manager}}, {{Pkg|cups}}, {{Pkg|system-config-printer}}. See [[CUPS#Configuration]].<br />
<br />
=== Samba/Windows support ===<br />
<br />
If you want to have access to Windows services, install [[Samba]] (package {{Pkg|samba}}).<br />
<br />
The Dolphin share functionality requires the package {{Pkg|kdenetwork-filesharing}} and usershares, which the stock {{ic|smb.conf}} does not have enabled. Instructions to add them are in [[Samba#Enable Usershares]], after which sharing in Dolphin should work out of the box after restarting Samba.<br />
<br />
{{Tip|Use {{ic|*}} (asterisk) for both username and password when accessing a Windows share without authentication in Dolphin's prompt.}}<br />
<br />
Unlike GTK file browsers which utilize GVfs also for the launched program, opening files from Samba shares in Dolphin via KIO makes Plasma copy the whole file to the local system first with most programs (VLC is an exception).<br />
To workaround this, you can use a GTK based file browser like {{Pkg|thunar}} with {{Pkg|gvfs}} and {{Pkg|gvfs-smb}} (and {{Pkg|gnome-keyring}} for saving login credentials) to access SMB shares in a more able way.<br />
<br />
Another possibility is to [[mount]] a Samba share via {{Pkg|cifs-utils}} to make it look to Plasma like if the SMB share was just a normal local folder and thus can be accessed normally.<br />
See [[Samba#Manual mounting]] and [[Samba#Automatic mounting]].<br />
<br />
An GUI solution is available with {{AUR|samba-mounter-git}}, which offers basically the same functionality via an easy to use option located at ''System Settings'' > ''Network Drivers''. However, it might break with new KDE Plasma versions.<br />
<br />
=== KDE Desktop activities ===<br />
<br />
[https://userbase.kde.org/Plasma#Activities KDE Desktop Activities] are special workspaces where you can select specific settings for each activity that apply only when you are using said activity.<br />
<br />
=== Power management ===<br />
<br />
[[Install]] {{Pkg|powerdevil}} for an integrated Plasma power managing service. This service offers additional power saving features, monitor brightness control (if supported) and battery reporting including peripheral devices.<br />
<br />
{{Tip|<br />
* An alternative package without [[NetworkManager]] and [[Bluez]] dependencies is provided by {{AUR|powerdevil-light}}.<br />
* An alternative package with [[Wikipedia:DDC/CI|DDC/CI]]-enabled [[backlight]] control for external monitors is provided by {{AUR|powerdevil-ddcutil}}.<br />
* Integration with [https://pointieststick.com/2021/07/23/this-week-in-kde-power-profiles-and-a-more-polished-kickoff/ power profiles] requires the [[power-profiles-daemon]] optional dependency. <br />
}}<br />
<br />
{{Accuracy|1=Regarding the note below, it might be that the problem is the logind setting ''LidSwitchIgnoreInhibited'' which defaults to ''yes''. [https://bbs.archlinux.org/viewtopic.php?pid=1649022#p1649022]}}<br />
<br />
{{Note|Power Devil may not [[Power management#Power managers|inhibit]] all logind settings (such as the lid close action for laptops). In these cases, the logind setting itself will need to be changed - see [[Power management#Power management with systemd]].}}<br />
<br />
=== Autostart ===<br />
<br />
Plasma can autostart applications and run scripts on startup and shutdown. To autostart an application, navigate to ''System Settings > Startup and Shutdown > Autostart'' and add the program or shell script of your choice. For applications, a ''.desktop'' file will be created, for login scripts, a ''.desktop'' file launching the script will be created.<br />
<br />
{{Note|<br />
* Programs can be autostarted on login only, whilst shell scripts can also be run on shutdown or even before Plasma itself starts.<br />
* Shell scripts will only be run if they are marked [[executable]].<br />
* Shell scripts previously placed in {{ic|~/.config/autostart-scripts/}} will get [https://invent.kde.org/plasma/plasma-workspace/-/merge_requests/736 automatically migrated to .desktop files].<br />
}}<br />
<br />
* Place [[Desktop entries]] (i.e. ''.desktop'' files) in the appropriate [[XDG Autostart]] directory.<br />
* Place or symlink shell scripts in one of the following directories:<br />
<br />
:; {{ic|~/.config/plasma-workspace/env/}}: for executing scripts at login before launching Plasma.<br />
:; {{ic|~/.config/plasma-workspace/shutdown/}}: for executing scripts when Plasma exits.<br />
<br />
See [https://docs.kde.org/trunk5/en/plasma-workspace/kcontrol/autostart/index.html official documentation].<br />
<br />
=== Phonon ===<br />
<br />
From [[Wikipedia:Phonon (software)|Wikipedia]]:<br />
<br />
:Phonon is the multimedia API provided by KDE and is the standard abstraction for handling multimedia streams within KDE software and also used by several Qt applications.<br />
<br />
:Phonon was originally created to allow KDE and Qt software to be independent of any single multimedia framework such as GStreamer or xine and to provide a stable API for a major version's lifetime.<br />
<br />
Phonon is being widely used within KDE, for both audio (e.g., the System notifications or KDE audio applications) and video (e.g., the [[Dolphin]] video thumbnails).<br />
<br />
==== Which backend should I choose? ====<br />
<br />
You can choose between backends based on [[GStreamer]] and [[VLC]] – each available in versions for Qt4 applications and Qt5 applications ({{AUR|phonon-qt4-gstreamer}}, {{Pkg|phonon-qt5-gstreamer}} – {{AUR|phonon-qt4-vlc}}, {{Pkg|phonon-qt5-vlc}}).<br />
<br />
[https://www.phoronix.com/scan.php?page=news_item&px=MTUwNDM Upstream prefers VLC] but prominent Linux distributions (Kubuntu and Fedora-KDE for example) prefer GStreamer because that allows them to easily leave out patented MPEG codecs from the default installation. Both backends have a slightly different [https://community.kde.org/Phonon/FeatureMatrix features set]. The Gstreamer backend has some optional codec dependency, install them as needed:<br />
<br />
* {{Pkg|gst-libav}} — Libav codecs.<br />
* {{Pkg|gst-plugins-good}} — PulseAudio support and additional codecs.<br />
* {{Pkg|gst-plugins-ugly}} — additional codecs.<br />
* {{Pkg|gst-plugins-bad}} — additional codecs.<br />
<br />
In the past other backends were developed as well but are no longer maintained and their AUR packages have been deleted.<br />
<br />
{{Note|1=<br><br />
* Multiple backends can be installed at once and prioritized via the ''phononsettings'' application.<br />
* According to the [https://forum.kde.org/viewtopic.php?f=250&t=126476&p=335080 KDE forums], the VLC backend lacks support for [[wikipedia:ReplayGain|ReplayGain]].<br />
* If using the VLC backend, you may experience crashes every time Plasma wants to send you an audible warning and in quite a number of other cases as well [https://forum.kde.org/viewtopic.php?f=289&t=135956]. A possible fix is to rebuild the VLC plugins cache:<br />
{{bc|# /usr/lib/vlc/vlc-cache-gen /usr/lib/vlc/plugins}}<br />
}}<br />
<br />
=== Backup and restore ===<br />
<br />
KDE Plasma 5 stores personalized desktop settings as configuration files in the [[XDG Base Directory#Specification|XDG_CONFIG_HOME]] folder. Use the [https://github.com/shalva97/kde-configuration-files detail of configuration files] to select and choose a [https://www.addictivetips.com/ubuntu-linux-tips/backup-kde-plasma-5-desktop-linux/ method of backup and restore].<br />
<br />
=== systemd startup ===<br />
<br />
Plasma has introduced an optional new startup method which uses a [[systemd/User|systemd user]] instance to launch and manage all the Plasma services instead of the boot scripts. This is off by default, but can be [https://invent.kde.org/plasma/plasma-workspace/-/wikis/Plasma-and-the-systemd-boot enabled with the following command]:<br />
<br />
$ kwriteconfig5 --file startkderc --group General --key systemdBoot true<br />
<br />
To confirm the boot worked correctly you check the [[unit status|status]] of the {{ic|plasma-plasmashell.service}} [[user unit]].<br />
<br />
More details about the implementation can be read in [https://blog.davidedmundson.co.uk/blog/plasma-and-the-systemd-startup/ Edmundson's blog: plasma and the systemd startup].<br />
<br />
=== Spell checking ===<br />
<br />
KDE applications use {{Pkg|sonnet}} for spell checking. See its optional dependencies for the supported [[spell checker]]s.<br />
<br />
Configure it in ''System Settings > Regional Settings > Spell Check''.<br />
<br />
=== Running kwin wayland on NVIDIA ===<br />
<br />
See https://community.kde.org/Plasma/Wayland/Nvidia.<br />
<br />
== Applications ==<br />
<br />
The KDE project provides a suite of applications that integrate with the Plasma desktop. See the {{Grp|kde-applications}} group for a full listing of the available applications. Also see [[:Category:KDE]] for related KDE application pages.<br />
<br />
Aside from the programs provided in KDE Applications, there are many other applications available that can complement the Plasma desktop. Some of these are discussed below.<br />
<br />
=== System administration ===<br />
<br />
==== Terminate Xorg server through KDE System Settings ====<br />
<br />
Navigate to the submenu ''System Settings > Input Devices > Keyboard > Advanced (tab) > "Key Sequence to kill the X server"'' and ensure that the checkbox is ticked.<br />
<br />
==== KCM ====<br />
<br />
KCM stands for ''KC''onfig ''M''odule. KCMs can help you configure your system by providing interfaces in System Settings, or through the command line with ''kcmshell5''.<br />
<br />
* {{App|sddm-kcm|KDE Configuration Module for [[SDDM]].|https://invent.kde.org/plasma/sddm-kcm|{{Pkg|sddm-kcm}}}}<br />
* {{App|kde-gtk-config|GTK2 and GTK3 Configurator for KDE.|https://invent.kde.org/plasma/kde-gtk-config|{{Pkg|kde-gtk-config}}}}<br />
* {{App|System policies|Set of configuration modules which allows administrator to change [[PolicyKit]] settings.|https://invent.kde.org/system/polkit-kde-kcmodules-1|{{AUR|kcm-polkit-kde-git}}}}<br />
* {{App|wacom tablet|KDE GUI for the Wacom Linux Drivers.|https://www.linux-apps.com/p/1127862/|{{Pkg|kcm-wacomtablet}}}}<br />
* {{App|Kcmsystemd|systemd control module for KDE.|https://github.com/rthomsen/kcmsystemd|{{AUR|systemd-kcm}}}}<br />
<br />
More KCMs can be found at [https://www.linux-apps.com/search/projectSearchText/kcm linux-apps.com].<br />
<br />
=== Desktop search ===<br />
<br />
KDE implements desktop search with a software called [[Baloo]], a file indexing and searching solution.<br />
<br />
=== Web browsers ===<br />
<br />
The following web browsers can integrate with Plasma:<br />
<br />
* {{App|[[Wikipedia:Konqueror|Konqueror]]|Part of the KDE project, supports two rendering engines – KHTML and the [[Chromium]]-based Qt WebEngine.|https://konqueror.org/|{{Pkg|konqueror}}}}<br />
* {{App|[[Wikipedia:Falkon|Falkon]]|A Qt web browser with Plasma integration features, previously known as Qupzilla. It uses Qt WebEngine.|https://userbase.kde.org/Falkon/|{{Pkg|falkon}}}}<br />
* {{App|[[Chromium]]|Chromium and its proprietary variant Google Chrome have limited Plasma integration. [[KDE Wallet#KDE Wallet for Chrome and Chromium|They can use KWallet]] and KDE Open/Save windows.|https://www.chromium.org/|{{Pkg|chromium}}}}<br />
* {{App|[[Firefox]]|Firefox can be configured to better integrate with Plasma. See [[Firefox#KDE integration]] for details.|https://mozilla.org/firefox|{{Pkg|firefox}}}}<br />
<br />
{{Tip|Starting from Plasma 5.13, one can integrate [[Firefox]] or [[Chrome]] with Plasma: providing media playback control from the Plasma tray, download notifications and find open tabs in KRunner. [[Install]] {{pkg|plasma-browser-integration}} and the corresponding browser add-on. Chrome/Chromium support should already be included, for Firefox add-on see [[Firefox#KDE integration]].}}<br />
<br />
=== PIM ===<br />
<br />
KDE offers its own stack for [[Wikipedia:Personal information management|personal information management]] (PIM). This includes emails, contacts, calendar, etc. To install all the PIM packages, you could use the {{Grp|kde-pim}} package group or the {{Pkg|kde-pim-meta}} meta package.<br />
<br />
==== Akonadi ====<br />
<br />
Akonadi is a system meant to act as a local cache for PIM data, regardless of its origin, which can be then used by other applications. This includes the user's emails, contacts, calendars, events, journals, alarms, notes, and so on. Akonadi does not store any data by itself: the storage format depends on the nature of the data (for example, contacts may be stored in vCard format).<br />
<br />
Install {{Pkg|akonadi}}. For additional addons, install {{Pkg|kdepim-addons}}.<br />
<br />
{{Note|If you wish to use a database engine other than [[MariaDB]], then when installing the {{Pkg|akonadi}} package, use the following command to skip installing the {{Pkg|mariadb}} dependencies:<br />
<br />
# pacman -S akonadi --assume-installed mariadb<br />
<br />
See also {{Bug|32878}}.<br />
}}<br />
<br />
===== MySQL =====<br />
<br />
By default Akonadi will use {{ic|/usr/bin/mysqld}} ([[MariaDB]] by default, see [[MySQL]] for alternative providers) to run a managed MySQL instance with the database stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== System-wide MySQL instance ======<br />
<br />
Akonadi supports using the system-wide [[MySQL]] for its database.[https://techbase.kde.org/KDE_PIM/Akonadi#Can_Akonadi_use_a_normal_MySQL_server_running_on_my_system.3F]<br />
<br />
{{Expansion|Add instructions.}}<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QMYSQL<br />
<br />
[QMYSQL]<br />
Host=<br />
Name=akonadi_''username''<br />
Options="UNIX_SOCKET=/run/mysqld/mysqld.sock"<br />
StartServer=false<br />
}}<br />
<br />
===== PostgreSQL =====<br />
<br />
Akonadi supports either using the existing system-wide [[PostgreSQL]] instance, i.e. {{ic|postgresql.service}}, or running a PostgreSQL instance with user privileges and the database in {{ic|~/.local/share/akonadi/db_data/}}.<br />
<br />
====== Per-user PostgreSQL instance ======<br />
<br />
[[Install]] {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}.<br />
<br />
Edit Akonadi configuration file so that it has the following contents:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QPSQL]}} section and set the appropriate variables in it.<br />
* The database will be stored in {{ic|~/.local/share/akonadi/db_data/}}.<br />
}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
{{Note|<br />
* Starting with {{Pkg|akonadi}} 19.08.0-1 the PostgreSQL database cluster in {{ic|~/.local/share/akonadi/db_data/}} will get automatically upgraded when a major PostgreSQL version upgrade is detected.<br />
* For previous {{Pkg|akonadi}} versions major PostgreSQL version upgrades will require a manual database upgrade. Follow the [https://userbase.kde.org/Akonadi/Postgres_update update instructions on KDE UserBase Wiki]. Make sure to adjust the paths to PostgreSQL binaries to those used by {{Pkg|postgresql}} and {{Pkg|postgresql-old-upgrade}}, see [[PostgreSQL#Upgrading PostgreSQL]].<br />
}}<br />
<br />
====== System-wide PostgreSQL instance ======<br />
<br />
This requires an already configured and running [[PostgreSQL]].<br />
<br />
Create a PostgreSQL user account for your user:<br />
<br />
[postgres]$ createuser ''username''<br />
<br />
Create a database for Akonadi:<br />
<br />
[postgres]$ createdb -O ''username'' -E UTF8 --locale=C -T template0 akonadi-''username''<br />
<br />
Configure Akonadi to use the system-wide PostgreSQL:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QPSQL<br />
<br />
[QPSQL]<br />
Host=/run/postgresql<br />
Name=akonadi-''username''<br />
StartServer=false<br />
}}<br />
<br />
{{Note|Custom port, username and password can be specified with options {{ic|1=Port=}}, {{ic|1=User=}}, {{ic|1=Password=}} in the {{ic|[QPSQL]}} section.}}<br />
<br />
Start Akonadi with {{ic|akonadictl start}}, and check its status: {{ic|akonadictl status}}.<br />
<br />
===== SQLite =====<br />
<br />
{{Warning|Using the SQLite backend is not recommended and should be avoided.[https://invent.kde.org/pim/akonadi/-/blob/master/INSTALL#L37]}}<br />
<br />
To use [[SQLite]] edit Akonadi configuration file to match the configuration below:<br />
<br />
{{hc|~/.config/akonadi/akonadiserverrc|2=<br />
[%General]<br />
Driver=QSQLITE3<br />
}}<br />
<br />
{{Note|<br />
* When Akonadi starts, it will create the {{ic|[QSQLITE3]}} section and set the appropriate variables in it.<br />
* The database will be stored as {{ic|~/.local/share/akonadi/akonadi.db}}.<br />
}}<br />
<br />
===== Disabling Akonadi =====<br />
<br />
See this [https://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem section in the KDE userbase].<br />
<br />
=== KDE Telepathy ===<br />
<br />
[https://community.kde.org/KTp KDE Telepathy] is a project with the goal to closely integrate Instant Messaging with the KDE desktop. It utilizes the Telepathy framework as a backend and is intended to replace Kopete.<br />
<br />
To install all Telepathy protocols, install the {{Grp|telepathy}} group.<br />
To use the KDE Telepathy client, install the {{Pkg|telepathy-kde-meta}} package that includes all the packages contained in the {{Grp|telepathy-kde}} group.<br />
<br />
==== Use Telegram with KDE Telepathy ====<br />
<br />
{{Out of date|The ''telegram-purple'' project is [https://github.com/majn/telegram-purple#this-project-is-abandoned-see-instead-tdlib-purple abandoned]. See also [[Special:Diff/704779|Diff/704779]]. As mentioned in the previous links, {{AUR|telegram-tdlib-purple-git}} is its successor package.}}<br />
<br />
[[Telegram]] protocol is available using {{pkg|telepathy-haze}}, installing {{aur|telegram-purple}} or {{aur|telegram-purple-git}} and {{aur|telepathy-morse-git}}. The username is the Telegram account telephone number (complete with the national prefix {{ic|+''xx''}}, e.g. {{ic|+49}} for Germany).<br />
<br />
The configuration through the GUI may be tricky: if the phone number is not accepted when configuring a new account in the KDE Telepathy client (with an error message complaining about an invalid parameter which prevents the account creation), insert it between single quotes and then remove the quotes manually from the configuration file ({{ic|~/.local/share/telepathy/mission-control/accounts.cfg}}) after the account creation (if the quotes are not removed after, an authentication error should rise).<br />
<br />
{{Note|The configuration file should be edited manually when KDE Telepathy is not running, e.g. when there is no KDE desktop session active, otherwise manual changes may be overwritten by the software.}}<br />
<br />
=== KDE Connect ===<br />
<br />
[https://community.kde.org/KDEConnect KDE Connect] provides several features to connect your [[Android]] phone with your Linux desktop:<br />
<br />
* Share files and URLs to/from KDE from/to any app, without wires.<br />
* Touchpad emulation: Use your phone screen as your computer's touchpad.<br />
* Notifications sync (4.3+): Read your Android notifications from the desktop.<br />
* Shared clipboard: copy and paste between your phone and your computer.<br />
* Multimedia remote control: Use your phone as a remote for Linux media players.<br />
* WiFi connection: no usb wire or bluetooth needed.<br />
* RSA Encryption: your information is safe.<br />
<br />
You will need to install KDE Connect both on your computer and on your Android. For PC side, [[install]] {{Pkg|kdeconnect}} package. For Android side, install KDE Connect from [https://play.google.com/store/apps/details?id=org.kde.kdeconnect_tp Google Play] or from [https://f-droid.org/packages/org.kde.kdeconnect_tp/ F-Droid]. If you want to browse your phone's filesystem, you need to [[install]] {{Pkg|sshfs}} as well and configure filesystem exposes in your Android app.<br />
<br />
It is possible to use KDE Connect even if you do not use the Plasma desktop. For desktop environments that use AppIndicators, such as Unity, install {{AUR|indicator-kdeconnect}} package as well. For GNOME users, better integration can be achieved by installing {{AUR|gnome-shell-extension-gsconnect}} instead of {{Pkg|kdeconnect}}. To start the KDE Connect daemon manually, execute {{ic|/usr/lib/kdeconnectd}}.<br />
<br />
If you use a [[firewall]], you need to open UDP and TCP ports {{ic|1714}} through {{ic|1764}}.<br />
<br />
Sometimes, KDE Connect will not detect a phone. You can restart the services by running {{ic|killall kdeconnectd}} and then opening kdeconnect in system settings or running {{ic|kdeconnect-cli --refresh}} followed by {{ic|kdeconnect-cli -l}}.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Use a different window manager ===<br />
<br />
The component chooser settings in Plasma does not allow changing the window manager anymore. [https://github.com/KDE/plasma-desktop/commit/2f83a4434a888cd17b03af1f9925cbb054256ade]<br />
In order to change the window manager used you need to set the {{ic|KDEWM}} [[environment variable]] before KDE startup. The instructions are available on the KDE UserBase Wiki—[https://userbase.kde.org/Tutorials/Using_Other_Window_Managers_with_Plasma Tutorials/Using Other Window Managers with Plasma].<br />
<br />
{{Note|When using i3 window manager with Plasma, it may be necessary to manually set dialogs to open in floating mode in order for them to correctly appear. For more information, see [[i3#Correct handling of floating dialogs]].}}<br />
<br />
==== KDE/Openbox session ====<br />
<br />
The {{Pkg|openbox}} package provides a session for using KDE with [[Openbox]]. To make use of this session, select ''KDE/Openbox'' from the [[display manager]] menu.<br />
<br />
For those starting the session manually, add the following line to your [[xinit]] configuration:<br />
<br />
{{hc|~/.xinitrc|<br />
exec openbox-kde-session<br />
}}<br />
<br />
==== Re-enabling compositing effects ====<br />
<br />
When replacing Kwin with a window manager which does not provide a Compositor (such as Openbox), any desktop compositing effects e.g. transparency will be lost. In this case, install and run a separate Composite manager to provide the effects such as [[Xcompmgr]] or [[picom]].<br />
<br />
=== Configuring monitor resolution / multiple monitors ===<br />
<br />
To enable display resolution management and multiple monitors in Plasma, install {{Pkg|kscreen}}. This provides additional options to ''System Settings > Display and Monitor''.<br />
<br />
=== KWin-lowlatency ===<br />
<br />
{{Out of date|[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] is currently (February 2022) unmaintained/abandoned and will not work with Plasma 5.24.}}<br />
<br />
[https://github.com/tildearrow/kwin-lowlatency KWin-lowlatency] is a attempt to reduce latency and stuttering in the popular KWin compositor, and is available as {{AUR|kwin-lowlatency}}.<br />
<br />
=== Configuring ICC profiles ===<br />
<br />
To enable [[ICC profiles]] in Plasma, [[install]] {{Pkg|colord-kde}}. This provides additional options to ''System Settings > Color Corrections''.<br />
<br />
ICC profiles can be imported using ''Add Profile''.<br />
<br />
=== Disable opening application launcher with Super key (Windows key) ===<br />
<br />
To disable this feature you currently can run the following command:<br />
<br />
$ kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""<br />
<br />
=== Disable bookmarks showing in application menu ===<br />
<br />
With Plasma Browser integration installed, KDE will show bookmarks in the application launcher.<br />
<br />
To disable this feature you currently can run the following commands:<br />
<br />
$ mkdir ~/.local/share/kservices5<br />
$ sed 's/EnabledByDefault=true$/EnabledByDefault=false/' /usr/share/kservices5/plasma-runner-bookmarks.desktop > ~/.local/share/kservices5/plasma-runner-bookmarks.desktop<br />
<br />
=== IBus Integration ===<br />
<br />
[[IBus]] is an [[Input method#Input method framework|input method framework]] and can be integrated into KDE. See [[IBus#Integration]] for details.<br />
<br />
Using [[IBus]] may be required when using KDE on [[Wayland]] to offer accented characters and dead keys support [https://bugs.kde.org/show_bug.cgi?id=411729].<br />
<br />
=== Enable hotspot in plasma-nm ===<br />
<br />
See [[NetworkManager#Sharing internet connection over Wi-Fi]].<br />
<br />
=== Restore previous saved session ===<br />
<br />
If you have ''System Settings > Startup and Shutdown > Desktop Session > When logging in: Restore previous saved session'' (default) selected, ksmserver (KDE's session manager) will automatically save/load all open applications to/from {{ic|~/.config/ksmserverrc}} on logout/login.<br />
<br />
{{Note|Currently, native Wayland windows cannot be restored. See [https://community.kde.org/Plasma/Wayland_Showstoppers Wayland Showstoppers] for the current state of development.}}<br />
<br />
=== Receive local mail in KMail ===<br />
<br />
If you have set up local mail delivery with a [[mail server]] that uses the [[Wikipedia:Maildir|Maildir]] format, you may want to receive this mail in KMail. To do so, you can re-use KMail's default receiving account "Local Folders" that stores mail in {{ic|~/.local/share/local-mail/}}.<br />
<br />
Symlink the {{ic|~/Maildir}} directory (where Maildir format mail is commonly delivered) to the Local Folders' inbox:<br />
<br />
$ ln -s .local/share/local-mail/inbox ~/Maildir<br />
<br />
Alternatively, add a new receiving account with the type ''Maildir'' and set {{ic|~/Maildir}} as its directory.<br />
<br />
=== Configure Plasma for all users ===<br />
<br />
Edit {{ic|config/main.xml}} files in the {{ic|/usr/share/plasma}}. For example, to configure the Application Launcher for all users, edit {{ic|/usr/share/plasma/plasmoids/org.kde.plasma.kickoff/contents/config/main.xml}}. To prevent the files from being overwritten with package updates, add the files to [[Pacman#Skip_file_from_being_upgraded|Pacman's NoUpgrade]]<br />
<br />
=== Disable hibernate ===<br />
<br />
Properly disable the hibernate feature and hide it from the menu with a Polkit policy rule.<br />
<br />
{{hc|/etc/polkit-1/rules.d/99-disable-hibernate.rules|<nowiki><br />
// Disable hibernate for all users<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
polkit.addRule(function(action, subject) {<br />
if ((action.id == "org.freedesktop.login1.hibernate-multiple-sessions")) {<br />
return polkit.Result.NO;<br />
}<br />
});<br />
</nowiki>}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== qt5ct and kvantum bugs after upgrade ===<br />
<br />
{{Out of date|This was added 2021-02-15 : the "latest update" is one year old, is this fixed ?}}<br />
<br />
Latest update might cause incompatible HiDPI scaling that made some interfaces becomes too big for your screen, some icons are missing or can not be displayed, and missing panels or widgets.<br />
<br />
Try to remove {{Pkg|qt5ct}} and {{Pkg|kvantum}} related package, then apply default global Plasma theme. If the problem persists, try clearing all your KDE configuration and reinstalling {{Grp|plasma}} to overwrite the configuration. Be sure to check HiDPI scaling in KDE system settings as well.<br />
<br />
=== Fonts ===<br />
<br />
==== Fonts in a Plasma session look poor ====<br />
<br />
Try installing the {{Pkg|ttf-dejavu}} and {{Pkg|ttf-liberation}} packages.<br />
<br />
After the installation, be sure to log out and back in. You should not have to modify anything in ''System Settings > Appearance > Fonts''. If you are using {{Pkg|qt5ct}}, the settings in Qt5 Configuration Tool may override the font settings in System Settings.<br />
<br />
If you have personally set up how your [[Fonts]] render, be aware that System Settings may alter their appearance. When you go ''System Settings > Appearance > Fonts'' System Settings will likely alter your font configuration file ({{ic|fonts.conf}}).<br />
<br />
There is no way to prevent this, but, if you set the values to match your {{ic|fonts.conf}} file, the expected font rendering will return (it will require you to restart your application or in a few cases restart your desktop). Note that Gnome's Font Preferences also does this.<br />
<br />
==== Fonts are huge or seem disproportional ====<br />
<br />
Try to force font DPI to {{ic|'''96'''}} in ''System Settings > Appearance > Fonts''.<br />
<br />
If that does not work, try setting the DPI directly in your Xorg configuration as documented in [[Xorg#Setting DPI manually]].<br />
<br />
=== Configuration related ===<br />
<br />
Many problems in KDE are related to its configuration.<br />
<br />
==== Plasma desktop behaves strangely ====<br />
<br />
Plasma problems are usually caused by unstable ''Plasma widgets'' (colloquially called ''plasmoids'') or ''Plasma themes''. First, find which was the last widget or theme you had installed and disable or uninstall it.<br />
<br />
So, if your desktop suddenly exhibits "locking up", this is likely caused by a faulty installed widget. If you cannot remember which widget you installed before the problem began (sometimes it can be an irregular problem), try to track it down by removing each widget until the problem ceases. Then you can uninstall the widget, and file a bug report on the [https://bugs.kde.org/ KDE bug tracker] '''only if it is an official widget'''. If it is not, it is recommended to find the entry on the [https://store.kde.org/ KDE Store] and inform the developer of that widget about the problem (detailing steps to reproduce, etc.).<br />
<br />
If you cannot find the problem, but you do not want ''all'' the settings to be lost, navigate to {{ic|~/.config/}} and run the following command:<br />
<br />
$ for j in plasma*; do mv -- "$j" "${j%}.bak"; done<br />
<br />
This command will rename '''all''' Plasma related configuration files to ''*.bak'' (e.g. {{ic|plasmarc.bak}}) of your user and when you will relogin into Plasma, you will have the default settings back. To undo that action, remove the ''.bak'' file extension. If you already have ''*.bak'' files, rename, move, or delete them first. It is highly recommended that you create regular backups anyway. See [[Synchronization and backup programs]] for a list of possible solutions.<br />
<br />
==== Clean cache to resolve upgrade problems ====<br />
<br />
The [https://bbs.archlinux.org/viewtopic.php?id=135301 problem] may be caused by old cache. Sometimes, after an upgrade, the old cache might introduce strange, hard to debug behaviour such as unkillable shells, hangs when changing various settings, Ark being unable to extract archives or Amarok not recognizing any of your music. This solution can also resolve problems with KDE and Qt applications looking bad after an update.<br />
<br />
Rebuild the cache using the following commands:<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca5 --noincremental<br />
<br />
Optionally, empty the {{ic|~/.cache/}} folder contents, however, this will also clear the cache of other applications:<br />
<br />
$ rm -rf ~/.cache/*<br />
<br />
==== Plasma desktop does not respect locale/language settings ====<br />
<br />
Plasma desktop may use different settings than you set at KDE System Settings panel, or in {{ic|locale.conf}} (per [[Locale#Variables]]). First thing to do is log out and log in after removing {{ic|~/.config/plasma-localerc}}, if this does not fix the issue, try to edit the file manually. For example, to set {{ic|LANG}} variable to {{ic|es_ES.UTF-8}} and the {{ic|LC_MESSAGES}} variable to {{ic|en_US.UTF-8}}:<br />
<br />
{{hc|~/.config/plasma-localerc|2=<br />
[Formats]<br />
LANG=es_ES.UTF-8<br />
<br />
[Translations]<br />
LANGUAGE=en_US<br />
}}<br />
<br />
==== Cannot change theme, icons, fonts, colors in systemsettings; most icons are not displayed ====<br />
<br />
Make sure that {{ic|QT_QPA_PLATFORMTHEME}} [[environment variable]] is unset, the command {{ic|printenv QT_QPA_PLATFORMTHEME}} should show empty output. Otherwise if you had an environment set (most likely qt5ct) the variable will force qt5ct settings upon Qt applications, the command {{ic|1=export QT_QPA_PLATFORMTHEME=}} should unset the environment.<br />
<br />
An easier (and more reliable) solution can be to uninstall completely qt5ct.<br />
<br />
==== Volume control, notifications or multimedia keys do not work ====<br />
<br />
Hiding certain items in the System Tray settings (e.g. Audio Volume, Media Player or Notifications) also disables related features. Hiding the ''Audio Volume'' disables volume control keys, ''Media Player'' disables multimedia keys (rewind, stop, pause) and hiding ''Notifications'' disables showing notifications.<br />
<br />
==== Login Screen KCM does not sync cursor settings to SDDM ====<br />
<br />
The Login Screen KCM reads your cursor settings from {{ic|~/.config/kcminputrc}}, without this file no settings are synced. The easiest way to generate this file is to change your cursor theme in ''System Settings > Cursors'', then change it back to your preferred cursor theme.<br />
<br />
==== Missing panels/widgets ====<br />
<br />
A crash or hardware change can modify the screen numbers, even on a single monitor setup. The panels/widgets can be missing after such an event, this can be fixed in the {{ic|~/.config/plasma-org.kde.plasma.desktop-appletsrc}} file by changing the {{ic|lastScreen}} values.<br />
<br />
=== Graphical problems ===<br />
<br />
Make sure you have the proper driver for your GPU installed. See [[Xorg#Driver installation]] for more information. If you have an older card, it might help to [[#Disable desktop effects manually or automatically for defined applications]] or [[#Disable compositing]].<br />
<br />
==== Getting current state of KWin for support and debug purposes ====<br />
<br />
This command prints out a summary of the current state of KWin including used options, used compositing backend and relevant OpenGL driver capabilities. See more on [https://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ Martin's blog].<br />
<br />
$ qdbus org.kde.KWin /KWin supportInformation<br />
<br />
==== Disable desktop effects manually or automatically for defined applications ====<br />
<br />
Plasma has desktop effects enabled by default and e.g. not every game will disable them automatically. You can disable desktop effects in ''System Settings > Workspace Behavior > Desktop Effects'' and you can toggle desktop effects with {{ic|Alt+Shift+F12}}. <br />
<br />
Additionally, you can create custom KWin rules to automatically disable/enable compositing when a certain application/window starts under ''System Settings > Window Management > Window Rules''.<br />
<br />
==== Enable transparency ====<br />
<br />
If you use a transparent background without enabling the compositor, you will get the message:<br />
<br />
This color scheme uses a transparent background which does not appear to be supported on your desktop<br />
<br />
In ''System Settings > Display and Monitor > Compositor'', check ''Compositing: Enable on startup'' and restart Plasma.<br />
<br />
==== Disable compositing ====<br />
<br />
In ''System Settings > Display and Monitor > Compositor'', uncheck ''Compositing: Enable on startup'' and restart Plasma.<br />
<br />
==== Flickering in fullscreen when compositing is enabled ====<br />
<br />
In ''System Settings > Display and Monitor > Compositor'', uncheck ''Compositing: Allow applications to block compositing''. This may harm performance.<br />
<br />
==== Plasma cursor sometimes shown incorrectly ====<br />
<br />
Create the directory {{ic|~/.icons/default}} and inside a file named {{ic|index.theme}} with the following contents:<br />
<br />
{{hc|~/.icons/default/index.theme|2=<br />
[Icon Theme]<br />
Inherits=breeze_cursors<br />
}}<br />
<br />
Execute the following command:<br />
<br />
$ ln -s /usr/share/icons/breeze_cursors/cursors ~/.icons/default/cursors<br />
<br />
==== Cursor jerking/flicking when changing roles (e.g., when mousing over hyperlinks) ====<br />
<br />
Try installing the appropriate 2D acceleration driver for your system and window manager.<br />
<br />
==== Unusable screen resolution set ====<br />
<br />
Your local configuration settings for kscreen can override those set in {{ic|xorg.conf}}. Look for kscreen configuration files in {{ic|~/.local/share/kscreen/}} and check if mode is being set to a resolution that is not supported by your monitor.<br />
<br />
==== Blurry icons in system tray ====<br />
<br />
In order to add icons to tray, applications often make use of the library appindicator. If your icons are blurry, check which version of libappindicator you have installed. If you only have {{Pkg|libappindicator-gtk2}} installed, you can install {{Pkg|libappindicator-gtk3}} as an attempt to get clear icons.<br />
<br />
==== Cannot change screen resolution when running in a virtual machine ====<br />
<br />
When running Plasma in a [[VMware]], [[VirtualBox]] or [[QEMU]] virtual machine, kscreen may not allow changing the guest's screen resolution to a resolution higher than 800×600.<br />
<br />
The workaround is to set the {{ic|PreferredMode}} option in {{man|5|xorg.conf.d}}. Alternatively try using a different graphics adapter in the VM, e.g. VBoxSVGA instead of VMSVGA for VirtualBox and Virtio instead of QXL for QEMU. See [https://bugs.kde.org/show_bug.cgi?id=407058 KDE Bug 407058] for details.<br />
<br />
==== Dolphin, Kate, etc. stuck long time when opening ====<br />
<br />
Check whether your user directories ({{ic|Documents}}, {{ic|Downloads}}, etc.) are read-only.<br />
<br />
=== Sound problems ===<br />
<br />
{{Note|First make sure you have {{Pkg|alsa-utils}} installed.}}<br />
<br />
==== No sound after suspend ====<br />
<br />
If there is no sound after suspending and if KMix does not show audio devices which should be there, restarting plasmashell and pulseaudio may help:<br />
<br />
$ killall plasmashell<br />
$ systemctl --user restart pulseaudio.service<br />
$ plasmashell<br />
<br />
Some applications may also need to be restarted in order for sound to play from them again.<br />
<br />
==== MP3 files cannot be played when using the GStreamer Phonon backend ====<br />
<br />
This can be solved by installing the GStreamer libav plugin (package {{Pkg|gst-libav}}). If you still encounter problems, you can try changing the Phonon backend used by installing another such as {{AUR|phonon-qt4-vlc}} or {{Pkg|phonon-qt5-vlc}}.<br />
<br />
Then, make sure the backend is preferred via ''System Settings > Multimedia > Audio and Video > Backend''.<br />
<br />
If the settings does not show any, try {{ic|phononsettings}} in your terminal.<br />
<br />
=== Power management ===<br />
<br />
==== No Suspend/Hibernate options ====<br />
<br />
If your system is able to suspend or hibernate using [[systemd]] but do not have these options shown in KDE, make sure {{Pkg|powerdevil}} is installed.<br />
<br />
=== KMail ===<br />
<br />
==== Clean Akonadi configuration to fix KMail ====<br />
<br />
See [https://userbase.kde.org/KMail/FAQs_Hints_and_Tips#Clean_start_after_a_failed_migration] for details.<br />
<br />
If you want a backup, copy the following configuration directories:<br />
<br />
$ cp -a ~/.local/share/akonadi ~/.local/share/akonadi-old<br />
$ cp -a ~/.config/akonadi ~/.config/akonadi-old<br />
<br />
==== Empty IMAP inbox in KMail ====<br />
<br />
For some IMAP accounts KMail will show the inbox as a top-level container (so it will not be possible to read messages there) with all other folders of this account inside.[https://bugs.kde.org/show_bug.cgi?id=284172]. To solve this problem simply disable the server-side subscriptions in the KMail account settings.<br />
<br />
==== Authorization error for EWS account in KMail ====<br />
<br />
While setting up EWS account in KMail, you may keep getting errors about failed authorization even for valid and fully working credentials. This is likely caused by broken communication between [[KWallet]] and KMail. To workaround the issue set a passsword via qdbus:<br />
<br />
$ qdbus org.freedesktop.Akonadi.Resource.akonadi_ews_resource_0 /Settings org.kde.Akonadi.Ews.Wallet.setPassword "XXX"<br />
<br />
=== Aggressive QXcbConnection journal logging ===<br />
<br />
See [[Qt#Disable/Change Qt journal logging behaviour]].<br />
<br />
=== KF5/Qt 5 applications do not display icons in i3/FVWM/awesome ===<br />
<br />
See [[Qt#Configuration of Qt5 apps under environments other than KDE Plasma]].<br />
<br />
=== Problems with saving credentials and persistently occurring KWallet dialogs ===<br />
<br />
It is not recommended to turn off the [[KWallet]] password saving system in the user settings as it is required to save encrypted credentials like WiFi passphrases for each user. Persistently occuring KWallet dialogs can be the consequence of turning it off.<br />
<br />
In case you find the dialogs to unlock the wallet annoying when applications want to access it, you can let the [[Display manager|display managers]] [[SDDM]] and [[LightDM]] unlock the wallet at login automatically, see [[KDE Wallet#Unlock KDE Wallet automatically on login]]. The first wallet needs to be generated by KWallet (and not user-generated) in order to be usable for system program credentials.<br />
<br />
In case you want the wallet credentials not to be opened in memory for every application, you can restrict applications from accessing it with {{Pkg|kwalletmanager}} in the KWallet settings.<br />
<br />
If you do not care for credential encryption at all, you can simply leave the password forms blank when KWallet asks for the password while creating a wallet. In this case, applications can access passwords without having to unlock the wallet first.<br />
<br />
=== Discover does not show any applications ===<br />
<br />
This can be solved by installing {{Pkg|packagekit-qt5}}.<br />
<br />
=== High CPU usage of kscreenlocker_greet with NVIDIA drivers ===<br />
<br />
As described in [https://bugs.kde.org/show_bug.cgi?id=347772 KDE Bug 347772] NVIDIA OpenGL drivers and QML may not play well together with Qt 5. This may lead {{ic|kscreenlocker_greet}} to high CPU usage after unlocking the session. To work around this issue, set the {{ic|QSG_RENDERER_LOOP}} [[environment variable]] to {{ic|basic}}.<br />
<br />
Then kill previous instances of the greeter with {{ic|killall kscreenlocker_greet}}.<br />
<br />
=== OS error 22 when running Akonadi on ZFS ===<br />
<br />
If your home directory is on a [[ZFS]] pool, create a {{ic|~/.config/akonadi/mysql-local.conf}} file with the following contents:<br />
<br />
[mysqld]<br />
innodb_use_native_aio = 0<br />
<br />
See [[MariaDB#OS error 22 when running on ZFS]].<br />
<br />
=== Some programs are unable to scroll when their windows are inactive ===<br />
<br />
This is caused by the problematic way of GTK3 handling mouse scroll events. A workaround for this is to set [[environment variable]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}}. However, this workaround also breaks touchpad smooth scrolling and touchscreen scrolling.<br />
<br />
=== TeamViewer behaves slowly ===<br />
<br />
When using TeamViewer, it may behave slowly if you use smooth animations (such as windows minimizing). See [[#Disable compositing]] as a workaround.<br />
<br />
=== Kmail, Kontact and Wayland ===<br />
<br />
Kmail may become unresponsive, show a black messageviewer or similar, often after having been minimized and restored. A workaround may be to set [[environment variable]] {{ic|1=QT_QPA_PLATFORM="xcb;wayland"}}. See [https://bugs.kde.org/show_bug.cgi?id=397825 KDE Bug 397825].<br />
<br />
=== Unlock widgets (Plasma ≥ 5.18) ===<br />
<br />
If you previously locked your widgets, you will probably find yourself unable to unlock them again.<br />
You just have to run this command to do so:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(false)"<br />
<br />
The new {{ic|Customize Layout}} does not require to lock them back up but if want to do that:<br />
<br />
$ qdbus org.kde.plasmashell /PlasmaShell evaluateScript "lockCorona(true)"<br />
<br />
=== KIO opens URLs with error programs ===<br />
<br />
{{Style|The language in this section could use some improvements for clarity and grammar (mostly in regards to the first sentence and section heading).}}<br />
<br />
KIO had cached webpages and will try use cached files. Check file associations regarding html, php, etc. and change it to a browser. KIO's cache files are located in {{ic|$HOME/.cache/kioexec}}. See also [[xdg-utils#URL scheme handlers]].<br />
<br />
=== Custom Shortcuts tab is missing under Shortcuts in System Settings ===<br />
<br />
This is due to the {{Pkg|khotkeys}} package being missing. After installation, a restart of the System Settings application may be necessary to apply the changes.<br />
<br />
=== Lock the screen before suspending and hibernating ===<br />
<br />
In the System Settings application, KDE offers a setting to automatically lock the screen after waking up from sleep. Upon resuming, [https://www.reddit.com/r/kde/comments/obnpeb/how_to_lock_system_before_suspend/ some users] report that the screen is briefly showed before locking. To prevent this behavior and have KDE lock the screen before suspending, create a hook in {{man|1|systemd}} by creating the following file as the root user:<br />
<br />
{{hc|head=/usr/lib/systemd/system-sleep/lock_before_suspend.sh|output=#!/bin/bash<br />
<br />
case $1/$2 in<br />
pre/*)<br />
case $2 in<br />
suspend{{!}}hibernate)<br />
loginctl lock-session<br />
sleep 1 # necessary in order for the lock-session to complete before device is suspended. Lower value didn't allow for completion<br />
;;<br />
esac<br />
;;<br />
esac<br />
}}<br />
<br />
After creating the file, make it [[executable]]. <br />
<br />
Finally, make sure that the KDE setting is enabled by going to System Settings > Workspace Behavior > Screen Locking and checking the "After waking from sleep" checkbox.<br />
<br />
== See also ==<br />
<br />
* [https://www.kde.org/ KDE homepage]<br />
* [https://dot.kde.org/ KDE news]<br />
* [https://planet.kde.org/ KDE Blogs]<br />
* [https://forum.kde.org/ KDE Forums]<br />
* [https://wiki.kde.org/ KDE Wikis]<br />
* [https://bugs.kde.org/ KDE bug tracker and reporter]<br />
* [https://blog.martin-graesslin.com/blog/kategorien/kde/ Martin Graesslin's blog]<br />
* [https://community.kde.org/Matrix KDE Matrix Rooms]</div>Fincehttps://wiki.archlinux.org/index.php?title=Rime_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727232Rime (简体中文)2022-04-22T09:30:27Z<p>Fince: improve translation</p>
<hr />
<div>[[Category:Input methods (简体中文)]]<br />
[[en:Rime]]<br />
[[ja:Rime]]<br />
{{TranslationStatus (简体中文)|Rime|2022-04-22|726471}}<br />
'''[https://rime.im Rime]'''(中州韵输入法引擎)是一款支持多种输入方案的输入法引擎。<br />
<br />
Rime 本身没有用于处理用户输入的前端,需要配合输入法框架才能使用,比如 [[Fcitx5 (简体中文)]] 或 [[IBus (简体中文)]]。<br />
<br />
== 安装 ==<br />
<br />
分别安装提供 Rime 输入引擎的 {{Pkg|librime}} 和所使用输入法对应的集成:<br />
<br />
* 若使用 [[Fcitx5 (简体中文)|Fcitx5]] ,安装 {{Pkg|fcitx5-rime}};<br />
* 若使用[[Fcitx (简体中文)|Fcitx]] ,安装 {{Pkg|fcitx-rime}};<br />
* 若使用[[IBus (简体中文)|IBus]] ,安装 {{Pkg|ibus-rime}}。<br />
<br />
== 配置 ==<br />
<br />
Rime 需要输入方案才能工作,用户可以定制输入方案,也可以使用软件仓库中的一些官方输入方案:<br />
<br />
* {{Pkg|rime-luna-pinyin}} - 朙月拼音<br />
* {{Pkg|rime-terra-pinyin}} - 地球拼音<br />
* {{Pkg|rime-double-pinyin}} - 基于朙月拼音的双拼输入,包含自然码、MSPY、智能 ABC、小鹤双拼、拼音加加等<br />
* {{Pkg|rime-pinyin-simp}} - 袖珍简化字拼音<br />
* {{Pkg|rime-cantonese}} - 粤语拼音<br />
* {{Pkg|rime-cangjie}} - 仓颉五代<br />
* {{Pkg|rime-quick}} - 速成<br />
* {{Pkg|rime-stroke}} - 五笔画(笔画输入法)<br />
* {{Pkg|rime-wubi}} - 五笔字型86<br />
* {{Pkg|rime-wugniu}} - 上海吴语<br />
* {{Pkg|rime-bopomofo}} - 注音<br />
* {{Pkg|rime-emoji}} - Emoji 表情符号输入<br />
<br />
有些输入方式会默认同 {{Pkg|librime-data}} 元软件包一同安装,{{Pkg|librime}} 也依赖此元软件包。<br />
<br />
使用 Rime 时,默认可以按 {{ic|F4}} 或 {{ic|Ctrl+`}} 切换输入法,详见[[#选择输入方案]]。<br />
<br />
若要自定义 Rime,请先根据使用的输入法创建 Rime 的配置文件夹:<br />
<br />
若使用 {{Pkg|ibus-rime}}:<br />
$ mkdir ~/.config/ibus/rime<br />
<br />
若使用 {{Pkg|fcitx-rime}}:<br />
$ mkdir ~/.config/fcitx/rime/<br />
<br />
若使用 {{Pkg|fcitx5-rime}}:<br />
$ mkdir ~/.local/share/fcitx5/rime/<br />
<br />
在文件夹中创建 {{ic|default.custom.yaml}} 文件,以指定可选的输入法。例如,若要按声调输入拼音,添加下列内容以使用地球拼音:<br />
<br />
{{hc|default.custom.yaml|<br />
patch:<br />
schema_list:<br />
- schema: terra_pinyin<br />
}}<br />
<br />
添加内容时请注意行首缩进。此文件会覆盖默认的配置文件,若只在文件中添加地球拼音,则只能用地球拼音。<br />
<br />
请重新部署输入法以使自定义生效。如果使用图形界面的 IBus 或 Fcitx,请点击 ⟲(重新部署)按钮。也可以使用命令行重新部署:<br />
<br />
若使用 {{Pkg|ibus-rime}}:<br />
<br />
$ rm ~/.config/ibus/rime/default.yaml && ibus-daemon -drx<br />
<br />
若使用 {{Pkg|fcitx-rime}}:<br />
<br />
$ rm ~/.config/fcitx/rime/default.yaml && fcitx-remote -r<br />
<br />
若使用 {{Pkg|fcitx5-rime}}:<br />
<br />
$ rm ~/.local/share/fcitx5/rime/default.yaml<br />
$ fcitx5-remote -r<br />
<br />
注意:可以选择声调以过滤候选列表,对应按键如下:<br />
一声: -<br />
二声: /<br />
三声: <<br />
四声: \<br />
<br />
例如,若要打出拼音为 {{ic|hǎo}} 的字,输入 {{ic|hao<}} 即可。<br />
<br />
Rime 默认只会列出 5 个候选项,可以修改 {{ic|"menu/page_size"}} 的值以改变列出候选项的数量:<br />
<br />
{{hc|default.custom.yaml|<br />
patch:<br />
"menu/page_size": 9<br />
}}<br />
<br />
== 使用 ==<br />
<br />
=== 选择输入方案 ===<br />
<br />
使用 Rime 时,默认可以按 {{ic|F4}} 或 {{ic|Ctrl+`}} 调整基础设置。显示的设置项如下:<br />
<br />
1. ''输入法名称''<br />
2. 中文 -› 西文<br />
3. 全角 -› 半角<br />
4. 漢字 -› 汉字<br />
...<br />
<br />
第一项会显示输入方案的名称,可以在其中切换已启用的不同输入方案。<br />
<br />
第二项可以切换中文/英文输入。<br />
<br />
第三项可以切换全角/半角标点。<br />
<br />
第四项可以切换简体/繁体输入。<br />
<br />
=== 中文标点 ===<br />
<br />
按下列各键输入不同的符号:<br />
<br />
[ -> 「 【 〔 [<br />
] -> 」 】 〕 ]<br />
{ -> 『 〖 {<br />
} -> 』 〗 }<br />
< -> 《 〈 « ‹<br />
> -> 》 〉 » ›<br />
@ -> @ @ ☯<br />
/ -> / / ÷<br />
* -> * * ・ × ※<br />
% -> % % ° ℃<br />
$ -> ¥ $ € £ ¥<br />
| -> ・ | | § ¦<br />
_ -> ——<br />
\ -> 、 \ \<br />
^ -> ……<br />
~ -> 〜 ~ ~ 〰<br />
<br />
=== 进阶内容 ===<br />
<br />
若要查看详细的 Rime 定制指南,见 https://github.com/rime/home/wiki/CustomizationGuide 。<br />
<br />
== 疑难解答 ==<br />
<br />
=== GNOME 环境下,ibus-setup 无法更改候选方向 ===<br />
<br />
见 [https://github.com/rime/ibus-rime/issues/52 issue #52]。 创建 {{ic|~/.config/ibus/rime/build/ibus_rime.yaml}} 并写入以下内容:<br />
<br />
style:<br />
horizontal: true<br />
<br />
== 技巧 ==<br />
<br />
=== 输入希腊字母 ===<br />
<br />
若想输入希腊字母,请在 {{ic|luna_pinyin.custom.yaml}} 或自定义输入方案文件中追加以下内容:<br />
<br />
{{hc|luna_pinyin.custom.yaml|<br />
recognizer:<br />
patterns:<br />
# Use / as the identifier here<br />
# You can freely replace your favorite identifiers (such as: `~, .\; etc., characters that need not be displayed directly on the screen)<br />
# Replace the / before the Greek letter at the same time<br />
punct: "^/([0-9]0?{{!}}[A-Za-z]+)$"<br />
punctuator:<br />
symbols:<br />
# Here, the letter name is used as the code of the Greek letter, and you can replace it with your favorite code as needed.<br />
# For example, if you want to use a as the alpha code<br />
# just replace the alpha below with a<br />
"/alpha": ["Α", "α"]<br />
"/beta": ["Β", "β"]<br />
"/gamma": ["Γ", "γ"]<br />
"/delta": ["Δ", "δ"]<br />
"/epsilon": ["Ε", "ε"]<br />
"/zeta": ["Ζ", "ζ"]<br />
"/eta": ["Η", "η"]<br />
"/theta": ["Θ", "θ"]<br />
"/iota": ["Ι", "ι"]<br />
"/kappa": ["Κ", "κ"]<br />
"/lambda": ["Λ", "λ"]<br />
"/mu": ["Μ", "μ"]<br />
"/nu": ["Ν", "ν"]<br />
"/xi": ["Ξ", "ξ"]<br />
"/omicron": ["Ο", "ο"]<br />
"/pi": ["Π", "π"]<br />
"/rho": ["Ρ","ρ"]<br />
"/sigma": ["Σ", "σ", "ς"]<br />
"/tau": ["Τ", "τ"]<br />
"/upsilon": ["Υ", "υ"]<br />
"/phi": ["Φ", "φ"]<br />
"/chi": ["Χ", "χ"]<br />
"/psi": ["Ψ", "ψ"]<br />
"/omega": ["Ω", "ω"]<br />
}}<br />
<br />
在此输入配置下,输入 {{ic|/alpha}} 即会出现候选词 {{ic|α}} 。<br />
<br />
== 另见 ==<br />
<br />
* [https://rime.github.io/ 官网]<br />
* [https://github.com/rime/home/wiki GitHub wiki]</div>Fincehttps://wiki.archlinux.org/index.php?title=Unofficial_mirrors_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727083Unofficial mirrors (简体中文)2022-04-20T19:58:48Z<p>Fince: -</p>
<hr />
<div>[[Category:Package management (简体中文)]]<br />
[[Category:Lists (简体中文)]]<br />
[[en:Unofficial mirrors]]<br />
[[es:Unofficial mirrors]]<br />
[[pt:Unofficial mirrors]]<br />
[[ru:Unofficial mirrors]]<br />
{{TranslationStatus (简体中文)|Unofficial mirrors|2022-4-21|725200}}<br />
<br />
{{ic|/etc/pacman.d/mirrorlist}} 中'''没有'''列出这些[[Mirrors (简体中文)|镜像源]]。<br />
<br />
== 世界 ==<br />
<br />
* https://cloudflaremirrors.com/archlinux/ - ''CloudFlare运行的是准镜像服务,其将已有的镜像放到其全球CDN前端(pacman下无法正常工作,见{{Bug|67865}})''<br />
* https://sourceforge.net/projects/archlinux/files/ - ''仅ISO文件,2006年后不再更新,仅用于获取旧版ISO。''<br />
<br />
== 澳大利亚 ==<br />
<br />
* https://chestm007.ddns.net/archlinux/<br />
<br />
== 比利时 ==<br />
<br />
* https://ftp.belnet.be/mirror/archlinux.org/ - ''Belnet''<br />
<br />
== 智利 ==<br />
<br />
* http://ip62.inf.utfsm.cl/ ''UTFSM #62''<br />
<br />
== 中国 ==<br />
<br />
'''CDN'''<br />
<br />
* https://mirrors.aliyun.com/archlinux/ - ''阿里巴巴''<br />
* https://mirrors.cloud.tencent.com/archlinux/ - ''腾讯云''<br />
* https://repo.huaweicloud.com/archlinux/ - ''华为云''<br />
<br />
'''教育网'''<br />
<br />
* https://mirror.bit.edu.cn/archlinux/ - ''北京理工大学''<br />
* https://mirrors.nju.edu.cn/archlinux/ - ''南京大学''<br />
<br />
== 芬兰 ==<br />
<br />
* http://95.217.224.159:26704/ArchMirror/$repo/os/$arch - ''IPv4, HTTP''<br />
* http://arch.kyberorg.fi/$repo/os/$arch - ''IPv4, HTTP, HTTPS''<br />
<br />
== 法国 ==<br />
<br />
* http://delta.archlinux.fr/ - ''支持Delta包。需要{{Pkg|xdelta3}}才能运行。''<br />
* https://mirror.oldsql.cc/archlinux/<br />
* https://archlinux.moulticast.net/<br />
* https://mirror.lesviallon.fr - ''仅支持https,1Gb/s,可于 https://stats.lesviallon.fr/786053669 检查更新时间''<br />
<br />
== 印度尼西亚 ==<br />
<br />
* http://kambing.ui.ac.id/archlinux/<br />
<br />
== 伊朗 ==<br />
<br />
* http://repo.sadjad.ac.ir/arch/<br />
* http://77.238.121.45/archlinux/ - ''Asiatech数据传输公司''<br />
<br />
== 意大利 ==<br />
<br />
* http://mi.mirror.garr.it/mirrors/archlinux/<br />
<br />
== 日本 ==<br />
<br />
* http://ftp.nara.wide.ad.jp/pub/Linux/archlinux/ - ''奈良先端科学技术大学院大学''<br />
* https://ftp.kddilabs.jp/Linux/packages/archlinux/<br />
* http://srv2.ftp.ne.jp/Linux/packages/archlinux/<br />
<br />
== 荷兰 ==<br />
<br />
* https://mirror.transip.net/archlinux/ ''TransIP B.V.''<br />
* https://mirror.previder.nl/archlinux/ ''Previder B.V.''<br />
<br />
== 新西兰 ==<br />
<br />
* http://mirror.ece.auckland.ac.nz/archlinux/ ''仅限新西兰''<br />
* https://mirror.ece.auckland.ac.nz/archlinux/ ''仅限新西兰''<br />
<br />
== 挪威 ==<br />
<br />
* https://lysakermoen.com/Software/Linux/Mirrors/ArchLinux/ ''IPv4, HTTP, HTTPS''<br />
<br />
== 波兰 ==<br />
<br />
* ftp://ftp.icm.edu.pl/pub/Linux/dist/archlinux/ - ICM UW<br />
* https://ftp.icm.edu.pl/pub/Linux/dist/archlinux/ - ICM UW<br />
* rsync://ftp.icm.edu.pl/pub/Linux/dist/archlinux/ - ICM UW<br />
* http://repo.skni.umcs.pl/archlinux/ - UMCS<br />
* https://repo.skni.umcs.pl/archlinux/ - UMCS<br />
<br />
== 南非 ==<br />
<br />
* http://ftp.leg.uct.ac.za/pub/linux/arch/ - ''开普敦大学''<br />
* ftp://ftp.leg.uct.ac.za/pub/linux/arch/<br />
* http://mirror.ufs.ac.za/archlinux/ - ''自由州大学''<br />
* ftp://mirror.ufs.ac.za/os/linux/distros/archlinux/<br />
* http://archlinux.mirror.ac.za - ''TENET - 南非高等教育和研究网络''<br />
* ftp://archlinux.mirror.ac.za<br />
* http://archlinux.za.mirror.allworldit.com/archlinux-deltarepo/ - ''自动生成从3个月前到现在的delta。支持http、https、rsync和IPv6。详见[https://bbs.archlinux.org/viewtopic.php?id=243247 此贴]。''<br />
<br />
== 瑞典 ==<br />
<br />
* ftp://foss.dhyrule.se/linux/archlinux/<br />
<br />
== 台湾地区 ==<br />
<br />
* http://archlinux.ccns.ncku.edu.tw/archlinux/ - NCKU CCNS<br />
<br />
== 泰国 ==<br />
<br />
* http://mirror1.ku.ac.th/archlinux/<br />
<br />
== 土耳其 ==<br />
<br />
* http://mirror.veriteknik.net.tr/archlinux/ - ''VeriTeknik数据中心''<br />
* https://ftp.linux.org.tr/archlinux/<br />
<br />
== 英国 ==<br />
<br />
* http://archlinux.uk.mirror.allworldit.com/archlinux-deltarepo/ - ''自动生成从3个月前到现在的delta。支持http、https、rsync和IPv6。详见[https://bbs.archlinux.org/viewtopic.php?id=243247 此贴]。''<br />
<br />
== 美国 ==<br />
<br />
* https://mirror.clarkson.edu/archlinux/<br />
* http://mirror.pointysoftware.net/archlinux/<br />
* http://mirror.ziemer.bz/archlinux<br />
* https://lug.mines.edu/mirrors/archlinux/<br />
* http://mirror.cs.umn.edu/arch/<br />
<br />
== 乌兹别克斯坦 ==<br />
<br />
* http://mirror.dc.uz/arch/</div>Fincehttps://wiki.archlinux.org/index.php?title=Unofficial_mirrors_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727082Unofficial mirrors (简体中文)2022-04-20T19:58:19Z<p>Fince: update translation</p>
<hr />
<div>[[Category:Package management (简体中文)]]<br />
[[Category:Lists (简体中文)]]<br />
[[en:Unofficial mirrors]]<br />
[[es:Unofficial mirrors]]<br />
[[pt:Unofficial mirrors]]<br />
[[ru:Unofficial mirrors]]<br />
<br />
{{TranslationStatus (简体中文)|Unofficial mirrors|2022-4-21|725200}}<br />
<br />
{{ic|/etc/pacman.d/mirrorlist}} 中'''没有'''列出这些[[Mirrors (简体中文)|镜像源]]。<br />
<br />
== 世界 ==<br />
<br />
* https://cloudflaremirrors.com/archlinux/ - ''CloudFlare运行的是准镜像服务,其将已有的镜像放到其全球CDN前端(pacman下无法正常工作,见{{Bug|67865}})''<br />
* https://sourceforge.net/projects/archlinux/files/ - ''仅ISO文件,2006年后不再更新,仅用于获取旧版ISO。''<br />
<br />
== 澳大利亚 ==<br />
<br />
* https://chestm007.ddns.net/archlinux/<br />
<br />
== 比利时 ==<br />
<br />
* https://ftp.belnet.be/mirror/archlinux.org/ - ''Belnet''<br />
<br />
== 智利 ==<br />
<br />
* http://ip62.inf.utfsm.cl/ ''UTFSM #62''<br />
<br />
== 中国 ==<br />
<br />
'''CDN'''<br />
<br />
* https://mirrors.aliyun.com/archlinux/ - ''阿里巴巴''<br />
* https://mirrors.cloud.tencent.com/archlinux/ - ''腾讯云''<br />
* https://repo.huaweicloud.com/archlinux/ - ''华为云''<br />
<br />
'''教育网'''<br />
<br />
* https://mirror.bit.edu.cn/archlinux/ - ''北京理工大学''<br />
* https://mirrors.nju.edu.cn/archlinux/ - ''南京大学''<br />
<br />
== 芬兰 ==<br />
<br />
* http://95.217.224.159:26704/ArchMirror/$repo/os/$arch - ''IPv4, HTTP''<br />
* http://arch.kyberorg.fi/$repo/os/$arch - ''IPv4, HTTP, HTTPS''<br />
<br />
== 法国 ==<br />
<br />
* http://delta.archlinux.fr/ - ''支持Delta包。需要{{Pkg|xdelta3}}才能运行。''<br />
* https://mirror.oldsql.cc/archlinux/<br />
* https://archlinux.moulticast.net/<br />
* https://mirror.lesviallon.fr - ''仅支持https,1Gb/s,可于 https://stats.lesviallon.fr/786053669 检查更新时间''<br />
<br />
== 印度尼西亚 ==<br />
<br />
* http://kambing.ui.ac.id/archlinux/<br />
<br />
== 伊朗 ==<br />
<br />
* http://repo.sadjad.ac.ir/arch/<br />
* http://77.238.121.45/archlinux/ - ''Asiatech数据传输公司''<br />
<br />
== 意大利 ==<br />
<br />
* http://mi.mirror.garr.it/mirrors/archlinux/<br />
<br />
== 日本 ==<br />
<br />
* http://ftp.nara.wide.ad.jp/pub/Linux/archlinux/ - ''奈良先端科学技术大学院大学''<br />
* https://ftp.kddilabs.jp/Linux/packages/archlinux/<br />
* http://srv2.ftp.ne.jp/Linux/packages/archlinux/<br />
<br />
== 荷兰 ==<br />
<br />
* https://mirror.transip.net/archlinux/ ''TransIP B.V.''<br />
* https://mirror.previder.nl/archlinux/ ''Previder B.V.''<br />
<br />
== 新西兰 ==<br />
<br />
* http://mirror.ece.auckland.ac.nz/archlinux/ ''仅限新西兰''<br />
* https://mirror.ece.auckland.ac.nz/archlinux/ ''仅限新西兰''<br />
<br />
== 挪威 ==<br />
<br />
* https://lysakermoen.com/Software/Linux/Mirrors/ArchLinux/ ''IPv4, HTTP, HTTPS''<br />
<br />
== 波兰 ==<br />
<br />
* ftp://ftp.icm.edu.pl/pub/Linux/dist/archlinux/ - ICM UW<br />
* https://ftp.icm.edu.pl/pub/Linux/dist/archlinux/ - ICM UW<br />
* rsync://ftp.icm.edu.pl/pub/Linux/dist/archlinux/ - ICM UW<br />
* http://repo.skni.umcs.pl/archlinux/ - UMCS<br />
* https://repo.skni.umcs.pl/archlinux/ - UMCS<br />
<br />
== 南非 ==<br />
<br />
* http://ftp.leg.uct.ac.za/pub/linux/arch/ - ''开普敦大学''<br />
* ftp://ftp.leg.uct.ac.za/pub/linux/arch/<br />
* http://mirror.ufs.ac.za/archlinux/ - ''自由州大学''<br />
* ftp://mirror.ufs.ac.za/os/linux/distros/archlinux/<br />
* http://archlinux.mirror.ac.za - ''TENET - 南非高等教育和研究网络''<br />
* ftp://archlinux.mirror.ac.za<br />
* http://archlinux.za.mirror.allworldit.com/archlinux-deltarepo/ - ''自动生成从3个月前到现在的delta。支持http、https、rsync和IPv6。详见[https://bbs.archlinux.org/viewtopic.php?id=243247 此贴]。''<br />
<br />
== 瑞典 ==<br />
<br />
* ftp://foss.dhyrule.se/linux/archlinux/<br />
<br />
== 台湾地区 ==<br />
<br />
* http://archlinux.ccns.ncku.edu.tw/archlinux/ - NCKU CCNS<br />
<br />
== 泰国 ==<br />
<br />
* http://mirror1.ku.ac.th/archlinux/<br />
<br />
== 土耳其 ==<br />
<br />
* http://mirror.veriteknik.net.tr/archlinux/ - ''VeriTeknik数据中心''<br />
* https://ftp.linux.org.tr/archlinux/<br />
<br />
== 英国 ==<br />
<br />
* http://archlinux.uk.mirror.allworldit.com/archlinux-deltarepo/ - ''自动生成从3个月前到现在的delta。支持http、https、rsync和IPv6。详见[https://bbs.archlinux.org/viewtopic.php?id=243247 此贴]。''<br />
<br />
== 美国 ==<br />
<br />
* https://mirror.clarkson.edu/archlinux/<br />
* http://mirror.pointysoftware.net/archlinux/<br />
* http://mirror.ziemer.bz/archlinux<br />
* https://lug.mines.edu/mirrors/archlinux/<br />
* http://mirror.cs.umn.edu/arch/<br />
<br />
== 乌兹别克斯坦 ==<br />
<br />
* http://mirror.dc.uz/arch/</div>Fincehttps://wiki.archlinux.org/index.php?title=MATLAB_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727080MATLAB (简体中文)2022-04-20T19:31:55Z<p>Fince: translate</p>
<hr />
<div>[[Category:Numerical analysis (简体中文)]]<br />
[[en:MATLAB]]<br />
[[ja:MATLAB]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
<br />
{{TranslationStatus (简体中文)|Matlab|2020-9-23|636207}}<br />
<br />
引自[https://www.mathworks.com/products/matlab/ 官方网站]:<br />
<br />
:MATLAB是数百万工程师和科学家都在使用的编程和数值计算平台,支持数据分析、算法开发和建模。<br />
<br />
== 概览 ==<br />
<br />
MATLAB是MathWorks公司开发的专有软件。获取,安装和激活Matlab需要许可证。MATLAB一年发布两次新版本,发布名称由{{ic|R}},发布年份和{{ic|a}}或{{ic|b}}构成。从R2012b开始,只有64位Linux才可使用Matlab。Arch Linux 不受官方支持。参见[https://cn.mathworks.com/support/sysreq.html 系统要求]<br />
<br />
== 安装 ==<br />
<br />
在安装 MATLAB 前需要获取一份完整的软件副本。对于许可证持有者,MATLAB 软件可以通过 DVD 或者 [https://www.mathworks.com MathWorks 网站] 获取。 除了软件本身,安装还需要一份文件安装密钥。要安装 MATLAB,你既可以通过 {{aur|matlab}} 软件包也可以直接使用 MATLAB 安装软件。通过 {{aur|matlab}} 软件包安装的优势是它可以管理依赖和某些微妙的安装过程,而直接从安装软件安装则可由普通用户安装到他们的家目录从而不需要 root 权限,并且适用于任何版本的 MATLAB ({{aur|matlab}} 软件包只适用于 MATLAB 2010b 及以后的版本).<br />
<br />
=== 从 MATLAB 安装软件安装 ===<br />
<br />
MATLAB 安装软件是独立的,它不需要任何额外的依赖来静默安装。要通过图形界面安装, [[Xorg]] 图形显示是必要的。 [[Wayland]] 目前不受支持。安装过程由 {{ic|install}} 脚本处理。你可以以 root 用户运行此脚本来安装 MATLAB 到整个系统,或者以你自己运行来仅为你安装。<br />
<br />
MATLAB 2016a 及更早不兼容 {{Pkg|ncurses}} 6,因此你必须安装 {{AUR|ncurses5-compat-libs}} 。 要了解更多信息,查看 [[#启动时出现段错误]] 。<br />
<br />
在安装过程中,你会被询问是否创建符号链接。如果你选择不创建,你可以手动创建一个 {{ic|/usr/local/bin}} 使得 MATALB 更容易从终端启动:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
或者你也可以将 MATLAB 的安装路径加入 {{ic|PATH}} 环境变量。<br />
<br />
==== 桌面入口 ====<br />
<br />
你可以选择创建一个 [[desktop entry]]。 MATLAB 文件的 MIME 类型是 {{ic|text/x-matlab}}.<br />
<br />
这样启动 {{ic|matlab}}:<br />
<br />
* {{ic|-desktop}} 从而不使用终端。<br />
* {{ic|-nosplash}} 从而取消启动画面。<br />
<br />
要想让图标正确显示, {{ic|StartupWMClass}} 需要在桌面入口中设置。要找到它,执行 {{ic|xprop {{!}} grep WM_CLASS}} 然后选择 MATLAB 窗口<br />
<br />
桌面入口示例 (将 '''R2019a''' 替换为你的 MATLAB 版本):<br />
<br />
{{hc|1=/usr/share/applications/matlab.desktop|<br />
2=[Desktop Entry]<br />
Version='''R2019a'''<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=/usr/local/MATLAB/'''R2019a'''/bin/matlab -desktop<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
}}<br />
<br />
若需设置环境变量,可以在 {{ic|Exec}} 中预先准备 {{ic|env}}。例如, 到系统的 libfreetype:<br />
{{bc|<br />
<nowiki>Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab</nowiki><br />
}}<br />
<br />
你可能想要使用系统的 {{ic|libstdc++}}.<br />
<br />
=== 从 AUR 软件包安装 ===<br />
<br />
专用 MATLAB 软件的EULA是有限制的。{{aur|matlab}} 被设计成使 MATLAB 和 Arch 集成。 该软件包应当在目标系统上被编译,并且应当在安装后删除该软件包和 [[Pacman]] 缓存。分发该软件包显然违反了EULA。<br />
<br />
{{aur|matlab}} 默认安装最新版的64位 MATLAB。也可以安装更旧的版本,例如 {{aur|matlab-r2015b}}{{Broken package link (简体中文)|package not found}}。{{aur|matlab}} 需要在它的安装路径中有 MATLAB 安装软件和文件密钥。<br />
要想从 AUR 安装 MATLAB, 从 AUR 下载 PKGBUILD。下载包含 MATLAB 安装器的 zip 文件,然后执行以下命令来下载必要文件:<br />
bsdtar xC matlab -f matlab_R2019a_glnxa64.zip<br />
./matlab/install<br />
<br />
确保勾选你需要的所有工具包,然后等待下载。不要关闭安装窗口。你可以这样找到下载位置:<br />
<br />
sudo find /tmp -name "tmw*"<br />
<br />
or<br />
<br />
cd /tmp<br />
ls | grep tmw<br />
<br />
将下载文件合并到安装器:<br />
<br />
rsync -a /tmp/tmwXXXXXXXX/archives matlab<br />
<br />
然后打包:<br />
<br />
tar -cvf matlab.tar -C matlab/ .<br />
下载 .lic 文件:访问 [https://mathworks.com/mwaccount/ 你的 Mathworks 账户] 并点击你想要使用的许可证号。前往 Install and Activate 标签,选择 "Activate to Retrieve License File"。按照指导下载许可证文件并将将其命名为 {{ic|matlab.lic}}。另,会显示文件安装密钥 (FIK) -把它复制粘贴进一个空文件,命名为 {{ic|matlab.fik}}. <br />
<br />
把以上文件复制进包含 PKGBUILD 文件的路径。然后修改 PKGBUILD 来安装你需要的工具包,开始安装:<br />
<br />
makepkg -sri<br />
<br />
要了解更多细节,参考 PKGBUILD 文件<br />
<br />
== 配置 ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL加速 ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
If you experience a low-level graphics error, you can use a software implementation of OpenGL or use an older driver. According to [[Intel graphics#Old OpenGL Driver (i965)|this]] entry in the ArchWiki, in Mesa 20.0 the new Iris driver was promoted to be the default for Gen8+. You may disable it and revert to use the old i965 driver by setting the {{ic|1=MESA_LOADER_DRIVER_OVERRIDE=i965}} [[environment variable]] before starting Matlab or any OpenGL application. Alternatively, you can run Matlab with the following command:<br />
<br />
$ env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop<br />
<br />
If it works, you can edit the Matlab launcher script to add:<br />
<br />
export MESA_LOADER_DRIVER_OVERRIDE=i965<br />
<br />
=== 音频 ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU计算 ===<br />
<br />
MATLAB can take advantage of [https://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== 安装额外的编译器 ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note (简体中文)|Newer versions of Matlab (at least 2017a) does not seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note (简体中文)|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Matlab的帮助查看器的配置 ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Serial port access ===<br />
<br />
Matlab uses a bundled rxtx library to access serial ports. The built-in version requires the user to have write access directly to /var/run which is no good idea. The easiest way to fix this properly is to install the {{Pkg|java-rxtx}} package first. Follow the instructions shown while installing this package to get your user into the right groups. Then run the following commands to make Matlab use the system rxtx version:<br />
<br />
cd {MATLAB}/java/jarext<br />
mv RXTXcomm.jar RXTXcomm.jar.off<br />
ln -s /usr/share/java/rxtx/RXTXcomm.jar .<br />
<br />
cd {MATLAB}/bin/glnx64<br />
mv librxtxSerial.so librxtxSerial.so.off<br />
ln -s /usr/lib/librxtxSerial.so .<br />
<br />
=== HiDPI and 4k ===<br />
<br />
See [[HiDPI#MATLAB]]<br />
<br />
== 故障排除 ==<br />
<br />
=== 帮助浏览器和动态脚本黑屏 ===<br />
<br />
安装 {{aur|libselinux}}.<br />
<br />
=== 静态线程本地存储错误 ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [https://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]{{Dead link (简体中文)|2020|08|02|status=404}}<br />
* [https://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [https://stackoverflow.com/a/19468365]<br />
<br />
=== Matlab在显示图像时崩溃 ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Arch Linux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it does not resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the {{pkg|wmname}} utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it does not work, try the combination of both. (The second line works in bspwm) If it still does not work, try googling similar issues with java in general.<br />
<br />
=== 文本乱码或不可见 ===<br />
<br />
Set the environment variable {{ic|J2D_D3D}} to {{ic|false}}[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting {{ic|MATLAB_JAVA}} to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== 菜单和输入窗口的文字显示异常 ===<br />
<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== 安装依赖缺失 ===<br />
<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Installation error: archive is not a ZIP archive ===<br />
<br />
During the installation you can get:<br />
<br />
The following error was detected while installing ''package_name'': archive is not a ZIP archive <br />
Would you like to retry installing ''package_name''? If you press No, the installer will exit without completing the installation. More information can be found at /tmp/mathworks_root.log<br />
<br />
Matlab downloads all packages to {{ic|/tmp/}} directory which resides in RAM and is maximum size of half of available memory. In this case it is not enough for installation files and Matlab 2019a installer will warn you about this. If it did not, or if you ignored the warning, you will have got the above error.<br />
<br />
You can either [[Tmpfs#Examples|resize tmpfs]] (3,5 GB is not enough, 6 GB works), or remove packages from base install and add them later with built-in Matlab add-on installer.<br />
<br />
=== 安装时library错误 ===<br />
<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you are installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== 解决启动时警告/错误问题 ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}}{{Broken package link (简体中文)|package not found}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== 启动时出现段错误 ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
=== 与Intel显卡有关的错误 ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== 附加组件管理器无法使用 ===<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2017b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. {{Bug|54257}}<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Matlab的帮助查看器的配置]].<br />
<br />
=== LiveScript错误 ===<br />
<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
The steps in [[#附加组件管理器无法使用]] may resolve the issue.<br />
<br />
=== Using webcam/video device ===<br />
<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b does not recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
'''Warning:''' As of 2018-08-15 updating gst from 1.14.0 to 1.14.2 breaks video device operation (MATLAB does not see the video device anymore). Downgrading fixes this.<br />
<br />
=== 关闭帮助窗口时Matlab数秒无响应 ===<br />
<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround does not work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I have come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
{{bc|1=<br />
#!/bin/sh<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD {{!}}<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
}}<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== 一些下拉菜单无法被选中 ===<br />
<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== 因许可证问题造成的无法启动Matlab ===<br />
<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
https://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-activation might solve the problem.<br />
<br />
=== 启动Matlab时显示"Failure loading desktop class"并崩溃 ===<br />
<br />
In case MATLAB will not start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
=== Installer crashes with "Unable to launch the MATLABWindow application" ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the installer crashes before the splash in shown.<br />
{{hc<br />
|$ ./install |<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Unable to launch the MATLABWindow application<br />
Aborted (core dumped)<br />
}}<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} libraries of the MATLAB installer, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd matlab_R2020a_glnxa64/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* exclude/<br />
<br />
=== Add-on manager does not start in R2020a ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the Add-on manager does not start. Instead, the following error is shown<br />
<br />
Error using matlab.internal.cef.webwindow (line 385)<br />
MATLABWindow application failed to launch. Unable to launch the MATLABWindow application<br />
<br />
Error in matlab.internal.webwindow/createImplementation (line 288)<br />
implObj = matlab.internal.cef.webwindow(varargin{:});<br />
<br />
Error in matlab.internal.webwindow (line 144)<br />
obj.impl = obj.createImplementation(varargin{:});<br />
<br />
Error in matlab.internal.addons.AddOnsWindow/launch (line 51)<br />
obj.webwindow = matlab.internal.webwindow(char(url), obj.debugPort, obj.normalWindowPosition);<br />
<br />
Error in matlab.internal.addons.Explorer/loadUrlForNavigateToMessage (line 125)<br />
obj.addOnsWindowInstance.launch(url, obj.windowStateUtil.getExplorerWindowMaximizedSetting);<br />
<br />
Error in matlab.internal.addons.Explorer/show (line 56)<br />
obj.loadUrlForNavigateToMessage(url);<br />
<br />
Error in matlab.internal.addons.launchers.showExplorer (line 128)<br />
matlab.internal.addons.Explorer.getInstance.show(navigationData);<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} and {{ic|libgio*}} libraries of MATLAB, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd {MATLAB INSALLATION FOLDER}/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* libgio-2.0.so* exclude/<br />
<br />
== 在systemd-nspawn容器中运行 ==<br />
<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Fincehttps://wiki.archlinux.org/index.php?title=MATLAB_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727079MATLAB (简体中文)2022-04-20T19:27:43Z<p>Fince: update translation</p>
<hr />
<div>[[Category:Numerical analysis (简体中文)]]<br />
[[en:MATLAB]]<br />
[[ja:MATLAB]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Octave}}<br />
{{Related|Sage-mathematics}}<br />
{{Related|Mathematica}}<br />
{{Related articles end}}<br />
<br />
{{TranslationStatus (简体中文)|Matlab|2020-9-23|636207}}<br />
<br />
引自[https://www.mathworks.com/products/matlab/ 官方网站]:<br />
<br />
:MATLAB是一个编程和数值计算平台,数百万工程师和科学家用它分析数据、开发算法和创建模型。<br />
<br />
== 概览 ==<br />
<br />
MATLAB是MathWorks公司开发的专有软件。获取,安装和激活Matlab需要许可证。MATLAB的新版本一年发布两次,发布名称由{{ic|R}},发布年份和{{ic|a}}或{{ic|b}}构成。从R2012b开始,只有64位Linux才可使用Matlab。Arch Linux 不受官方支持。参见[https://cn.mathworks.com/support/sysreq.html 系统要求]<br />
<br />
== 安装 ==<br />
<br />
在安装 MATLAB 前需要获取一份完整的软件副本。对于许可证持有者,MATLAB 软件可以通过 DVD 或者 [https://www.mathworks.com MathWorks 网站] 获取。 除了软件本身,安装还需要一份文件安装密钥。要安装 MATLAB,你既可以通过 {{aur|matlab}} 软件包也可以直接使用 MATLAB 安装软件。通过 {{aur|matlab}} 软件包安装的优势是它可以管理依赖和某些微妙的安装过程,而直接从安装软件安装则可由普通用户安装到他们的家目录从而不需要 root 权限,并且适用于任何版本的 MATLAB ({{aur|matlab}} 软件包只适用于 MATLAB 2010b 及以后的版本).<br />
<br />
=== 从 MATLAB 安装软件安装 ===<br />
<br />
MATLAB 安装软件是独立的,它不需要任何额外的依赖来静默安装。要通过图形界面安装, [[Xorg]] 图形显示是必要的。 [[Wayland]] 目前不受支持。安装过程由 {{ic|install}} 脚本处理。你可以以 root 用户运行此脚本来安装 MATLAB 到整个系统,或者以你自己运行来仅为你安装。<br />
<br />
MATLAB 2016a 及更早不兼容 {{Pkg|ncurses}} 6,因此你必须安装 {{AUR|ncurses5-compat-libs}} 。 要了解更多信息,查看 [[#启动时出现段错误]] 。<br />
<br />
在安装过程中,你会被询问是否创建符号链接。如果你选择不创建,你可以手动创建一个 {{ic|/usr/local/bin}} 使得 MATALB 更容易从终端启动:<br />
<br />
# ln -s /{MATLAB}/bin/matlab /usr/local/bin<br />
<br />
或者你也可以将 MATLAB 的安装路径加入 {{ic|PATH}} 环境变量。<br />
<br />
==== 桌面入口 ====<br />
<br />
你可以选择创建一个 [[desktop entry]]。 MATLAB 文件的 MIME 类型是 {{ic|text/x-matlab}}.<br />
<br />
这样启动 {{ic|matlab}}:<br />
<br />
* {{ic|-desktop}} 从而不使用终端。<br />
* {{ic|-nosplash}} 从而取消启动画面。<br />
<br />
要想让图标正确显示, {{ic|StartupWMClass}} 需要在桌面入口中设置。要找到它,执行 {{ic|xprop {{!}} grep WM_CLASS}} 然后选择 MATLAB 窗口<br />
<br />
桌面入口示例 (将 '''R2019a''' 替换为你的 MATLAB 版本):<br />
<br />
{{hc|1=/usr/share/applications/matlab.desktop|<br />
2=[Desktop Entry]<br />
Version='''R2019a'''<br />
Type=Application<br />
Terminal=false<br />
MimeType=text/x-matlab<br />
Exec=/usr/local/MATLAB/'''R2019a'''/bin/matlab -desktop<br />
Name=MATLAB<br />
Icon=matlab<br />
Categories=Development;Math;Science<br />
Comment=Scientific computing environment<br />
StartupNotify=true<br />
}}<br />
<br />
若需设置环境变量,可以在 {{ic|Exec}} 中预先准备 {{ic|env}}。例如, 到系统的 libfreetype:<br />
{{bc|<br />
<nowiki>Exec=env LD_PRELOAD=/usr/lib/libfreetype.so.6 matlab</nowiki><br />
}}<br />
<br />
你可能想要使用系统的 {{ic|libstdc++}}.<br />
<br />
=== 从 AUR 软件包安装 ===<br />
<br />
专用 MATLAB 软件的EULA是有限制的。{{aur|matlab}} 被设计成使 MATLAB 和 Arch 集成。 该软件包应当在目标系统上被编译,并且应当在安装后删除该软件包和 [[Pacman]] 缓存。分发该软件包显然违反了EULA。<br />
<br />
{{aur|matlab}} 默认安装最新版的64位 MATLAB。也可以安装更旧的版本,例如 {{aur|matlab-r2015b}}{{Broken package link (简体中文)|package not found}}。{{aur|matlab}} 需要在它的安装路径中有 MATLAB 安装软件和文件密钥。<br />
要想从 AUR 安装 MATLAB, 从 AUR 下载 PKGBUILD。下载包含 MATLAB 安装器的 zip 文件,然后执行以下命令来下载必要文件:<br />
bsdtar xC matlab -f matlab_R2019a_glnxa64.zip<br />
./matlab/install<br />
<br />
确保勾选你需要的所有工具包,然后等待下载。不要关闭安装窗口。你可以这样找到下载位置:<br />
<br />
sudo find /tmp -name "tmw*"<br />
<br />
or<br />
<br />
cd /tmp<br />
ls | grep tmw<br />
<br />
将下载文件合并到安装器:<br />
<br />
rsync -a /tmp/tmwXXXXXXXX/archives matlab<br />
<br />
然后打包:<br />
<br />
tar -cvf matlab.tar -C matlab/ .<br />
下载 .lic 文件:访问 [https://mathworks.com/mwaccount/ 你的 Mathworks 账户] 并点击你想要使用的许可证号。前往 Install and Activate 标签,选择 "Activate to Retrieve License File"。按照指导下载许可证文件并将将其命名为 {{ic|matlab.lic}}。另,会显示文件安装密钥 (FIK) -把它复制粘贴进一个空文件,命名为 {{ic|matlab.fik}}. <br />
<br />
把以上文件复制进包含 PKGBUILD 文件的路径。然后修改 PKGBUILD 来安装你需要的工具包,开始安装:<br />
<br />
makepkg -sri<br />
<br />
要了解更多细节,参考 PKGBUILD 文件<br />
<br />
== 配置 ==<br />
<br />
=== Java ===<br />
<br />
The MATLAB software is bundled with a JVM and therefore it is not necessary to install [[Java]]. The JVM version supported by MATLAB is listed in [https://ww2.mathworks.cn/support/compilers.html System Requirements & Platform Availability] or simply type {{ic|version -java}} in MATLAB. One could set the {{ic|MATLAB_JAVA}} environment variable to use custom JVM, for example, to specify the {{pkg|jre8-openjdk}} JRE, launch MATLAB with:<br />
<br />
$ env MATLAB_JAVA=/usr/lib/jvm/java-8-openjdk/jre matlab<br />
<br />
=== OpenGL加速 ===<br />
<br />
MATLAB can take advantage of hardware based 2D and 3D OpenGL acceleration. Support for hardware acceleration needs to be configured outside of MATLAB. Appropriate [[video drivers]] need to be installed along with the OpenGL utility library {{Pkg|glu}} package. If X11 forwarding is being used, the video drivers need to be installed on both the client and server. To check if MATLAB is making use of hardware based OpenGL acceleration run:<br />
<br />
$ matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If "software rendering" is not "false", then there is a problem with your hardware acceleration. If this is the case make sure OpenGL is configured correctly on the system. This can be done with the {{ic|glxinfo}} program from the {{Pkg|mesa-demos}} package:<br />
<br />
$ glxinfo | grep "direct rendering"<br />
<br />
If "direct rendering" is not "yes", then there is likely a problem with your system configuration.<br />
<br />
If glxinfo works but not matlab, you can try to run:<br />
$ export LD_PRELOAD=/usr/lib/libstdc++.so; export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/; matlab -nodesktop -nosplash -r "opengl info; exit" | grep Software<br />
<br />
If its works, you can edit Matlab launcher script to add:<br />
<br />
export LD_PRELOAD=/usr/lib/libstdc++.so<br />
export LD_LIBRARY_PATH=/usr/lib/xorg/modules/dri/<br />
<br />
If you experience a low-level graphics error, you can use a software implementation of OpenGL or use an older driver. According to [[Intel graphics#Old OpenGL Driver (i965)|this]] entry in the ArchWiki, in Mesa 20.0 the new Iris driver was promoted to be the default for Gen8+. You may disable it and revert to use the old i965 driver by setting the {{ic|1=MESA_LOADER_DRIVER_OVERRIDE=i965}} [[environment variable]] before starting Matlab or any OpenGL application. Alternatively, you can run Matlab with the following command:<br />
<br />
$ env MESA_LOADER_DRIVER_OVERRIDE=i965 matlab -desktop<br />
<br />
If it works, you can edit the Matlab launcher script to add:<br />
<br />
export MESA_LOADER_DRIVER_OVERRIDE=i965<br />
<br />
=== 音频 ===<br />
<br />
To confirm that MATLAB is able to use the default soundcard to present sounds run:<br />
<br />
$ matlab -nodesktop -nosplash -r "load handel; sound(y, Fs); pause(length(y)/Fs); exit" > /dev/null<br />
<br />
This should play an except from Handel's "Hallelujah Chorus." If this fails make sure [[ALSA]] is properly configured. This can be done with the {{ic|speaker-test}} program from the {{Pkg|alsa-utils}} package from the [[official repositories]]:<br />
<br />
$ speaker-test<br />
<br />
If you do not hear anything, then there is likely a problem with your system configuration.<br />
<br />
=== GPU计算 ===<br />
<br />
MATLAB can take advantage of [https://www.mathworks.co.uk/discovery/matlab-gpu.html CUDA enabled GPUs] to speed up applications. In order to take advantage of a supported GPU install the {{Pkg|nvidia}}, {{Pkg|nvidia-utils}}, {{Pkg|ocl-icd}}, {{Pkg|opencl-nvidia}}, and {{Pkg|cuda}} packages from the [[official repositories]]. To check if MATLAB is able to utilize the GPU run:<br />
<br />
$ matlab -nodesktop -nosplash -r "x=rand(10, 'single'); g=gpuArray(x); Success=isequal(gather(g), x), exit" | sed -ne '/Success =/,$p'<br />
<br />
=== 安装额外的编译器 ===<br />
<br />
In order to access the full functionality of MATLAB (e.g., to use Simulink, Builder JA, and MEX-file compilation), supported versions of the {{ic|gcc}}, {{ic|g++}}, {{ic|gfortran}}, and {{ic|jdk}} compilers must be installed. Details about the supported compilers for the [https://www.mathworks.com/support/compilers/current_release/index.html?sec=glnxa64 current release] and [https://www.mathworks.com/support/sysreq/previous_releases.html previous releases] are available online. Many of the supported {{ic|gcc}}, {{ic|g++}}, {{ic|jdk}} compiler versions for past MATLAB releases are available from the [[AUR]] (e.g., {{AUR|gcc43}}, {{AUR|gcc44}}, {{AUR|gcc47}}, {{AUR|gcc49}}and {{AUR|jdk6}}), while past versions of the {{ic|gfortran}} compilers are not packaged.<br />
<br />
To use previous versions of the the {{ic|gcc}}, {{ic|g++}}, and {{ic|gfortran}} compilers with MEX files, edit {{ic|${MATLAB}/bin/mexopts.sh}} and replace all occurrences of {{ic|<nowiki>CC='gcc'</nowiki>}} with {{ic|<nowiki>CC='gcc-4.X'</nowiki>}}, {{ic|<nowiki>CXX='g++'</nowiki>}} with {{ic|<nowiki>CXX='g++-4.X'</nowiki>}}, and {{ic|<nowiki>FC='gfortran'</nowiki>}} with {{ic|<nowiki>FC='gfortran-4.X'</nowiki>}}, where {{ic|X}} is the compiler version appropriate for the particular MATLAB release.<br />
<br />
{{Note (简体中文)|Newer versions of Matlab (at least 2017a) does not seem to respect the {{ic|${MATLAB}/bin/mexopts.sh}} customization. Instead it uses {{ic|${MATLAB}/bin/glnxa64/mexopts/LANG_glnxa64.xml}} file.}}<br />
<br />
{{Note (简体中文)|Though, it's no officially supported, one could still use higher version of compiler, and ignore the warnings.}}<br />
<br />
=== Matlab的帮助查看器的配置 ===<br />
<br />
The help browser uses valuable slots in the dynamic thread vector and causes competition with core functionality provided by libraries like the BLAS that also depend on the dynamic thread vector. The help browser can be configured to use fewer slots in the dynamic thread vector with<br />
<br />
>> webutils.htmlrenderer('basic');<br />
<br />
This is a persistent change and to reverse it use<br />
<br />
>> webutils.htmlrenderer('default');<br />
<br />
=== Garbled Interface ===<br />
<br />
export J2D_D3D=false<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== Serial port access ===<br />
<br />
Matlab uses a bundled rxtx library to access serial ports. The built-in version requires the user to have write access directly to /var/run which is no good idea. The easiest way to fix this properly is to install the {{Pkg|java-rxtx}} package first. Follow the instructions shown while installing this package to get your user into the right groups. Then run the following commands to make Matlab use the system rxtx version:<br />
<br />
cd {MATLAB}/java/jarext<br />
mv RXTXcomm.jar RXTXcomm.jar.off<br />
ln -s /usr/share/java/rxtx/RXTXcomm.jar .<br />
<br />
cd {MATLAB}/bin/glnx64<br />
mv librxtxSerial.so librxtxSerial.so.off<br />
ln -s /usr/lib/librxtxSerial.so .<br />
<br />
=== HiDPI and 4k ===<br />
<br />
See [[HiDPI#MATLAB]]<br />
<br />
== 故障排除 ==<br />
<br />
=== 帮助浏览器和动态脚本黑屏 ===<br />
<br />
安装 {{aur|libselinux}}.<br />
<br />
=== 静态线程本地存储错误 ===<br />
<br />
MATLAB has a number of libraries that have been compiled with static thread local storage (TLS) including the help broswer {{ic|doc}} and the BLAS libraries. For example,<br />
<br />
>> doc('help');<br />
>> ones(10)*randn(10);<br />
Error using * <br />
BLAS loading error:<br />
dlopen: cannot load any more object with static TLS<br />
<br />
is related to the bugs:<br />
<br />
* [https://www.mathworks.de/support/bugreports/961964 961964] for which patched libraries are available from [http://www.mathworks.de/support/bugreports/license/accept_license/5730?fname=attachment_961964_12b_13a_13b_14a_glnxa64_2014-01-30.zip&geck_id=961964 MathWorks]{{Dead link (简体中文)|2020|08|02|status=404}}<br />
* [https://www.mathworks.com/support/bugreports/1003952 1003952] for which workarounds exist<br />
<br />
A more general solution of recompiling {{ic|glibc}} has also been suggested. [https://stackoverflow.com/a/19468365]<br />
<br />
=== Matlab在显示图像时崩溃 ===<br />
<br />
To identify this error, start MATLAB with<br />
<br />
LIBGL_DEBUG=verbose matlab<br />
<br />
from the terminal and try to collect OpenGL information with {{ic|opengl info}} from the MATLAB command prompt. If it crashes again and there is an output line like <br />
<br />
libGL error: dlopen /usr/lib/xorg/modules/dri/swrast_dri.so failed <br />
(/usr/local/MATLAB/R2011b/bin/glnxa64/../../sys/os/glnxa64/libstdc++.so.6: <br />
version `GLIBCXX_3.4.15' not found (required by /usr/lib/xorg/modules/dri/swrast_dri.so))<br />
<br />
then the problem is that MATLAB uses its own GNU C++ library, which is an older version than the up-to-date version on your Arch Linux system. Make MATLAB use the current C++ library for your system by<br />
<br />
cd /usr/local/MATLAB/R(your release)/sys/os/glnxa64<br />
sudo unlink libstdc++.so.6<br />
sudo ln -s /usr/lib/libstdc++.so.6<br />
<br />
If MATLAB still crashes or corrupts graphics (during startup or when plotting), make sure Java's 2D OpenGL rendering is disabled.<br />
The environment variable {{ic|_JAVA_OPTIONS}} should not contain {{ic|1=-Dsun.java2d.opengl=true}}.<br />
<br />
=== Blank/grey UI when using WM (non-reparenting window manager) ===<br />
<br />
This is a common issue in a number of window managers. (DWM, Awesome, bspwm) Java does not play well with these window managers. There are two methods.<br />
<br />
First try setting the environment variable by running<br />
<br />
$ export _JAVA_AWT_WM_NONREPARENTING=1<br />
<br />
If Matlab works afterwards, export the variable in your {{ic|.xinitrc}}.<br />
<br />
If it does not resolve, you have to fool Java into thinking the WM is named LG3D. (It's an old, depreciated WM that Java applications ironically support) Clean the previous environment variable, install the {{pkg|wmname}} utility, and run.<br />
<br />
wmname LG3D<br />
<br />
Try running Matlab. If it works, put the fix in your starting script. ({{ic|.xinitrc}}, {{ic|bspwmrc}} and similar should be OK) Do note that other applications (such as {{ic|neofetch}}, or {{ic|tdrop}}) will think your WM is named LG3D, so you will have to configure them accordingly. Another solution is to run the command only before launching Matlab, and fixing the name after you are done with Matlab.<br />
<br />
If it does not work, try the combination of both. (The second line works in bspwm) If it still does not work, try googling similar issues with java in general.<br />
<br />
=== 文本乱码或不可见 ===<br />
<br />
Set the environment variable {{ic|J2D_D3D}} to {{ic|false}}[https://stackoverflow.com/questions/22737535/swing-rendering-appears-broken-in-jdk-1-8-correct-in-jdk-1-7].<br />
<br />
In newer versions of MATLAB (R2015b) [https://www.reddit.com/r/archlinux/comments/3yaga8/matlab_installer_bonked/] this also requires setting {{ic|MATLAB_JAVA}} to something openjdk based. Example:<br />
<br />
export J2D_D3D=false<br />
./bin/glnxa64/install_unix -javadir /usr/lib/jvm/java-7-openjdk/jre<br />
<br />
=== 菜单和输入窗口的文字显示异常 ===<br />
<br />
If you notice that the menus or the input fields are corrupted or not appearing correctly then you can try to activate the ''"'''Use antialiasing to smooth desktop fonts'''"'' option in Matlab preferences, it seems to solve the problem. Go to '''''Preferences -> Matlab -> Fonts''''' and activate it. You will need to restart Matlab in order to take affect.<br />
<br />
=== 安装依赖缺失 ===<br />
<br />
As one installs Matlab, it might complain that it cannot find a package, for the most part just look at the package name and then install it with [[Pacman]], or in the case of x86_64 there are some libraries only in [[AUR]].<br />
<br />
=== Installation error: archive is not a ZIP archive ===<br />
<br />
During the installation you can get:<br />
<br />
The following error was detected while installing ''package_name'': archive is not a ZIP archive <br />
Would you like to retry installing ''package_name''? If you press No, the installer will exit without completing the installation. More information can be found at /tmp/mathworks_root.log<br />
<br />
Matlab downloads all packages to {{ic|/tmp/}} directory which resides in RAM and is maximum size of half of available memory. In this case it is not enough for installation files and Matlab 2019a installer will warn you about this. If it did not, or if you ignored the warning, you will have got the above error.<br />
<br />
You can either [[Tmpfs#Examples|resize tmpfs]] (3,5 GB is not enough, 6 GB works), or remove packages from base install and add them later with built-in Matlab add-on installer.<br />
<br />
=== 安装时library错误 ===<br />
<br />
* Make sure that the symlink {{ic|bin/glnx64/libstdc++.so.6}} is pointing to the correct version of {{ic|libstdc++.so.xx}} (which is also in the same directory and has numbers where 'xx' is). By default, it may be pointing to an older (and nonexistent) version (different value for 'xx').<br />
<br />
* Make sure the device you are installing from is not mounted as {{ic|noexec}}<br />
<br />
* If you downloaded the files from Mathworks' website, make sure they are not on an NTFS or FAT partition, because that can mess up the symlinks. Ext4 or Ext3 should work.<br />
<br />
=== 解决启动时警告/错误问题 ===<br />
<br />
* Even if all needed libraries are installed, Matlab when starting can still report some missing libraries. This is resolved by symbolic linking of needed libraries to directories that Matlab checks at start-up. For example, if Matlab triggers error/warning about missing {{ic|/lib64/libc.so.6}} library, this can be resolved by:<br />
<br />
# ln -s /lib/libc.so.6 /lib64<br />
<br />
* Matlab R2011b with an up-to-date Arch Linux (as of March 12, 2012) fails on startup with the familiar "Failure loading desktop class." A solution is to point Matlab to the system JVM (confirmed to work with the {{Pkg|jdk7-openjdk}}{{Broken package link (简体中文)|package not found}} package):<br />
<br />
export MATLAB_JAVA=/usr/lib/jvm/java-7-openjdk/jre<br />
<br />
* Matlab R2017b with an up-to-date Arch Linux (as of September 30, 2017) fails on startup with the familiar "Failure loading desktop class." A solution is to install outdated versions of the libraries in the packages {{Pkg|cairo}} (1.14.10 works) and {{Pkg|harfbuzz}} (1.4.6 works) to a local directory and add them to the LD_LIBRARY_PATH for matlab (See also: [https://bbs.archlinux.org/viewtopic.php?id=228944]): <br />
<br />
LD_LIBRARY_PATH="/opt/matlab/outdatedLibraries/:$LD_LIBRARY_PATH" /opt/matlab/R2017b/bin/matlab<br />
<br />
=== 启动时出现段错误 ===<br />
<br />
If Matlab (R2016a or earlier) stops working after upgrading {{Pkg|ncurses}} to v6.x, [[install]] the {{AUR|ncurses5-compat-libs}} package. See [https://bbs.archlinux.org/viewtopic.php?id=202575 BBS#202575].<br />
<br />
In newer versions (e.g. R2017b), the issue could also be due to a font display failing to load.<br />
Try moving the libfreetype.so.6 font display file in $MATLAB/bin/glnxa64/ to an 'exclude' directory; see [https://bbs.archlinux.org/viewtopic.php?id=231299 BBS#231299].<br />
<br />
=== 与Intel显卡有关的错误 ===<br />
<br />
Some users have reported issues with DRI3 enabled on Intel Graphics chips. A possible workaround is to disable DRI3 and run MATLAB with hardware rendering on DRI2; to do so, launch MATLAB with the environment variable LIBGL_DRI3_DISABLE set to 1:<br />
<br />
LIBGL_DRI3_DISABLE=1 /{MATLAB}/bin/matlab<br />
<br />
If the previous workaround does not work, the issue can be circumvented by selecting software rendering with the MATLAB command (beware, performance may be very poor when doing e.g. big or complex 3D plots):<br />
<br />
opengl('save','software')<br />
<br />
See [https://bugzilla.redhat.com/show_bug.cgi?id=1357571] and [https://bugs.freedesktop.org/show_bug.cgi?id=96671] for more.<br />
<br />
=== 附加组件管理器无法使用 ===<br />
<br />
Addon manager requires the {{AUR|libselinux}} package to work. (in Matlab 2017b)<br />
<br />
Since upgrade from pango-1.40.5 to pango-1.40.6, the MATLABWindow application (responsible for Add-On Manager, Simulation Data Inspector and perhaps something else) cannot be started. {{Bug|54257}}<br />
A workaround is to point MATLAB shipping glib libraries to those glib libraries from your system. There are 5 of those libraries in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}, namely, as of R2017b:<br />
<br />
libgio-2.0.so<br />
libglib-2.0.so<br />
libgmodule-2.0.so<br />
libgobject-2.0.so<br />
libgthread-2.0.so<br />
<br />
Make it so that these symlinks are pointing to your system glib libraries instead of versions located in {{ic|matlabroot/R2017b/cefclient/sys/os/glnxa64}}.<br />
On a standard arch install the local files reside in {{ic|/usr/lib/}}.<br />
<br />
Relinking of "libfreetype.so.6" is also necessary to open these interfaces. This is found in {{ic|matlabroot/R2017b/bin/glnxa64/}}.<br />
<br />
If the window opens but is blank, consider switching the html renderer to: " webutils.htmlrenderer('basic');" as described in [[#Matlab的帮助查看器的配置]].<br />
<br />
=== LiveScript错误 ===<br />
<br />
If you get the error when attempting to load or create a LiveScript:<br />
{{ic|Viewing matlab live script files is not currently supported by this operating system configuration}}<br />
The steps in [[#附加组件管理器无法使用]] may resolve the issue.<br />
<br />
=== Using webcam/video device ===<br />
<br />
Make sure the correct support package addons are installed (webcam or OS Generic Video Interface for example). If running matlab as a user, make sure your user has write permissions to wherever the support packages are being downloaded and installed.<br />
<br />
At least Matlab 2016b does not recognize webcams or imaq adapters correctly without gstreamer0.10. The gstreamer0.10 can be found in the aur and installed as a work around.<br />
<br />
Since MATLAB R2017a, Image Acqusition Toolbox is using GStreamer library version 1.0. It previously used version 0.10.<br />
<br />
In general, USB Webcam Support Package does a better job working with UVC and built-in cameras than OS Generic Video Interface Support Package.<br />
<br />
'''Warning:''' As of 2018-08-15 updating gst from 1.14.0 to 1.14.2 breaks video device operation (MATLAB does not see the video device anymore). Downgrading fixes this.<br />
<br />
=== 关闭帮助窗口时Matlab数秒无响应 ===<br />
<br />
Since upgrade of glibc from 2.24 to 2.25, MATLAB (at least R2017a) hangs when closing Help Browser. The issue is related to the particular version of jxbrowser-chromium shipped with MATLAB.<br />
This issue is still present with glibc 2.26 and MATLAB R2017b.<br />
<br />
To fix this issue, download the [https://www.teamdev.com/jxbrowser latest jxbrowser] and replace the following jars from MATLAB:<br />
<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-chromium.jar<br />
matlabroot/java/jarext/jxbrowser-chromium/jxbrowser-linux64.jar<br />
<br />
MATLAB should automatically unpack those jars into {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} when first opening Help Browser.<br />
Remove {{ic|matlabroot/sys/jxbrowser-chromium/glnxa64/chromium}} directory to make sure MATLAB uses the latest jxbrowser.<br />
<br />
Unfortunately, this workaround does not work in R2017b anymore. Going deeper into investigation of this issue, it is related to a crash of one of jxbrowser-chromium processes. The parent process of jxbrowser-chromium then sits there and waits for response from a process that is already dead. This causes MATLAB main window to freeze. You can easily unfreeze MATLAB by manually killing all leftover jxbrowser-chromium processes.<br />
<br />
I have come up with this simple script that uses inotify and waits for user to close Help browser in MATLAB. It triggers when user closes Help browser and sends kill signal to all leftover jxbrowser-chromium processes:<br />
<br />
{{bc|1=<br />
#!/bin/sh<br />
<br />
if [ -z "$1" ]; then<br />
REL=R2017b<br />
else<br />
REL=$1<br />
fi<br />
<br />
JXPATH="/path/to/MATLAB/$REL/sys/jxbrowser-chromium/glnxa64/chromium"<br />
CMD="inotifywait -m -e CLOSE $JXPATH/resources.pak"<br />
<br />
#Exit if the daemon is already active<br />
if ! pgrep -f "$CMD" > /dev/null; then<br />
#Wait for user to close Help Browser, then killall leftover jxbrowser processes<br />
$CMD {{!}}<br />
while read line<br />
do<br />
killall "$JXPATH/jxbrowser-chromium"<br />
done<br />
else<br />
exit<br />
fi<br />
}}<br />
<br />
I run this script as part of my MATLAB start script like that:<br />
~/bin/unfreeze_matlab.sh R2017b &<br />
<br />
To make sure that this background job is killed when I exit MATLAB, I use this in the beginning of MATLAB start script:<br />
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT<br />
<br />
=== 一些下拉菜单无法被选中 ===<br />
<br />
In some interfaces - such as Simulation Data Inspector or Simulink Test Manager - nothing happens when choosing an item in dropdown menu (for example, when trying to change a number of subplots in Simulation Data Inspector). To work around this issue, hold down the Shift key while clicking the item in dropdown menu.<br />
<br />
=== 因许可证问题造成的无法启动Matlab ===<br />
<br />
In case MATLAB will not start from a [[desktop environment]] by the call of its [[desktop file]] one should see the output as you start it from the terminal.<br />
For a ''Licensing error'' such as:<br />
{{hc<br />
|# matlab|<br />
MATLAB is selecting SOFTWARE OPENGL rendering.<br />
License checkout failed.<br />
License Manager Error -9<br />
This error may occur when: <br />
-The hostid of this computer does not match the hostid in the license file. <br />
-A Designated Computer installation is in use by another user. <br />
If no other user is currently running MATLAB, you may need to activate.<br />
<br />
Troubleshoot this issue by visiting: <br />
https://www.mathworks.com/support/lme/R2017a/9<br />
<br />
Diagnostic Information:<br />
Feature: MATLAB <br />
License path: /home/<USER>/.matlab/R2017a_licenses/license_<NUM>_R2017a.lic:/home/<USER>/.matlab/R2017a_licenses/lice<br />
nse_Darkness_<NUM>_R2017a.lic:/opt/MATLAB/R2017a/licenses/license.dat:/opt/MATLAB/R2017a/licenses/*<br />
.lic <br />
Licensing error: -9,57.<br />
}}<br />
a re-activation might solve the problem.<br />
<br />
=== 启动Matlab时显示"Failure loading desktop class"并崩溃 ===<br />
<br />
In case MATLAB will not start and starting it from command line gives you the following error:<br />
{{hc<br />
|$ matlab|<br />
Fatal Internal Error: Internal Error: Failure occurs during desktop startup. Details: Failure loading desktop class.<br />
}}<br />
and you have the option [[Java#GTK_LookAndFeel|{{ic|1=-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel}}]] set in your {{ic|_JAVA_OPTIONS}} environment variable, start MATLAB with<br />
<br />
$ _JAVA_OPTIONS= matlab<br />
<br />
If this works, add the line<br />
<br />
export _JAVA_OPTIONS=<br />
<br />
to your MATLAB launcher script. Optionally re-add other Java options.<br />
<br />
=== Unable to type in text fields of interfaces based on MATLABWindow ===<br />
<br />
Since R2018a, it is not possible to type text in interfaces based on MATLABWindow - like Signal Editor, Add-Ons Explorer and others.<br />
MATLABWindow and MATLAB's webwindow infrastructure is based on Chromium Embedded Framework, and it looks like a known and long standing bug: https://bitbucket.org/chromiumembedded/cef/issues/2026/multiple-major-keyboard-focus-issues-on<br />
<br />
One possible workaround is to switch focus from the MATLABWindow to another window and then switch back - so that you can type.<br />
<br />
To elaborate more on this workaround (since the problem is still there in R2018b), here is what i did in my Openbox config (note that the A-Middle keybinding already exist in default config):<br />
<br />
<mousebind button="A-Middle" action="Press"><br />
<action name="Unfocus"/><br />
<action name="Focus"/><br />
</mousebind><br />
<br />
Now, whenever it is not possible to type in a text field, I press Alt+Mouse middle mouse and then I can type again.<br />
<br />
=== Installer crashes with "Unable to launch the MATLABWindow application" ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the installer crashes before the splash in shown.<br />
{{hc<br />
|$ ./install |<br />
terminate called after throwing an instance of 'std::runtime_error'<br />
what(): Unable to launch the MATLABWindow application<br />
Aborted (core dumped)<br />
}}<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} libraries of the MATLAB installer, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd matlab_R2020a_glnxa64/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* exclude/<br />
<br />
=== Add-on manager does not start in R2020a ===<br />
<br />
In MATLAB version R2020a Update 5 (and possibly older), the Add-on manager does not start. Instead, the following error is shown<br />
<br />
Error using matlab.internal.cef.webwindow (line 385)<br />
MATLABWindow application failed to launch. Unable to launch the MATLABWindow application<br />
<br />
Error in matlab.internal.webwindow/createImplementation (line 288)<br />
implObj = matlab.internal.cef.webwindow(varargin{:});<br />
<br />
Error in matlab.internal.webwindow (line 144)<br />
obj.impl = obj.createImplementation(varargin{:});<br />
<br />
Error in matlab.internal.addons.AddOnsWindow/launch (line 51)<br />
obj.webwindow = matlab.internal.webwindow(char(url), obj.debugPort, obj.normalWindowPosition);<br />
<br />
Error in matlab.internal.addons.Explorer/loadUrlForNavigateToMessage (line 125)<br />
obj.addOnsWindowInstance.launch(url, obj.windowStateUtil.getExplorerWindowMaximizedSetting);<br />
<br />
Error in matlab.internal.addons.Explorer/show (line 56)<br />
obj.loadUrlForNavigateToMessage(url);<br />
<br />
Error in matlab.internal.addons.launchers.showExplorer (line 128)<br />
matlab.internal.addons.Explorer.getInstance.show(navigationData);<br />
<br />
The problem is solved by removing (or hiding) the {{ic|libgl*}} and {{ic|libgio*}} libraries of MATLAB, as suggested for an older issue [https://it.mathworks.com/matlabcentral/answers/397138-why-do-i-get-a-matlabwindow-application-failed-to-launch-error-when-launching-live-editor-app-des#answer_316968]<br />
<br />
$ cd {MATLAB INSALLATION FOLDER}/cefclient/sys/os/glnxa64/<br />
$ mkdir exclude<br />
$ mv libglib-2.0.so* libgio-2.0.so* exclude/<br />
<br />
== 在systemd-nspawn容器中运行 ==<br />
<br />
Matlab can be run within a systemd-nspawn container to maintain a static system and avoid the library issues that often plague matlab installs after significant updates to libraries in Arch. Refer to [[Systemd-nspawn]] for detailed information on setting up such containers.<br />
<br />
The following lists instruction to get a MATLAB 2017b install running in a minimal debian 9 environment. It assumes matlab is already installed as normal in "/usr/local/MATLAB/R2017b". <br />
<br />
Use [[Xhost]] to allow the nspawn environment to use the existing X server instance.<br />
<br />
Create a minimal debian environment in a folder ("deb9" here) with:<br />
<br />
$ debootstrap --arch=amd64 stretch deb9<br />
<br />
Set a password for the root user and then boot the environment with:<br />
<br />
$ systemd-nspawn --bind-ro=/dev/dri --bind=/tmp/.X11-unix --bind=/usr/local/MATLAB/ -b -D deb9<br />
<br />
Install the following packages to have the requisite libraries in the nspawn environment for MATLAB. "mesa-utils" and "usbutils" can be installed to debug graphics acceleration and usb interfaces for I/O with MATLAB.<br />
<br />
$ apt-get install xorg build-essential libgtk2.0-0 libnss3 libasound2 <br />
<br />
Install the MATLAB-support (from contrib source) package in the environment for some convenient integration. <br />
<br />
$ apt-get install matlab-support<br />
<br />
Set the $DISPLAY variable to use your existing X server instance.<br />
<br />
$ export DISPLAY=:0<br />
<br />
MATLAB can be launched from within the environment normally by using the binary at $MATLABROOT/bin.</div>Fincehttps://wiki.archlinux.org/index.php?title=Vi_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=727053Vi (简体中文)2022-04-20T08:28:19Z<p>Fince: 翻译了简介,移除了TranslationStatus</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Text editors (简体中文)]]<br />
[[de:Vi]]<br />
[[en:Vi]]<br />
[[es:Vi]]<br />
[[fr:Vi]]<br />
[[pt:Vi]]<br />
<br />
来自[[Wikipedia:Vi|Wikipedia]]:<br />
<br />
:vi是一款面向屏幕的文本编辑器,最初为Unix操作系统创建。《单一Unix规范》和POSIX描述(并标准化)了vi及其衍生程序的可移植行为子集,以及这些程序中支持的ex编辑器语言。<br />
<br />
== 安装 ==<br />
<br />
[[安装]] {{Pkg|vi}} 包。<br />
<br />
== Vi风格的软件 ==<br />
<br />
其他各种软件中也能见到<br />
vi的键绑定和模式已在其他各种软件中重新创建:<br />
<br />
* [[List of applications/Documents#Vi-style text editors|文本编辑器]],其中最受欢迎的是 [[Vim (简体中文)|Vim]]<br />
* [[List of applications/Utilities#File managers|文件管理器]],如 [[ranger (简体中文)|ranger]] 和 [[Vifm]]<br />
* [[Readline#Editing mode|Readline]] 输入库(由 [[Bash (简体中文)|Bash]] 使用)<br />
* [[shell]],如 [[Zsh#Key bindings|Zsh]]<br />
* [[web browser|网页浏览器]],如 [[Luakit]],[[qutebrowser]] 或 {{Pkg|vimb}};对于 [[Firefox (简体中文)|Firefox]] 和 [[Chromium (简体中文)|Chromium]],有可用的[[Browser extensions#Keyboard shortcuts|浏览器扩展]]。<br />
* 大多数[[平铺窗口管理器]]都可以配置为进行 vi 样式控制<br />
<br />
== 另见 ==<br />
<br />
* {{man|1|vi}}</div>Fincehttps://wiki.archlinux.org/index.php?title=Wine_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726994Wine (简体中文)2022-04-19T15:56:48Z<p>Fince: update translation</p>
<hr />
<div>[[Category:Emulation (简体中文)]]<br />
[[Category:Gaming (简体中文)]]<br />
[[de:Wine]]<br />
[[en:Wine]]<br />
[[fr:Wine]]<br />
[[ja:Wine]]<br />
[[ru:Wine]]<br />
{{Related articles start}}<br />
{{Related|CrossOver}}<br />
{{Related|Deepin-wine}}<br />
{{Related|Wine package guidelines}}<br />
{{Related articles end}}<br />
<br />
{{translateme (简体中文)| 进度:35%}}<br />
<br />
{{TranslationStatus (简体中文)|Wine|2022-04-19|724914}}<br />
<br />
[[Wikipedia:Wine (software)|Wine]] 是一款可以在类 unix 操作系统上运行微软 Windows 应用程序的''兼容层''。在 Wine 中运行的程序可以像本地程序一样运行,而不会像模拟器那样影响性能/内存。<br />
<br />
{{警告|<br />
* Wine并非与你的系统分离。<br />
* 如果您可以使用您的用户帐户访问文件或资源,那么在 Wine 中运行的程序也可以。参见[[#Running Wine under a separate user account]]和[[Security#sandboxing applications]]了解可能的预防措施。<br />
* Wine 也可以运行恶意软件(参见 [https://wiki.winehq.org/FAQ#is_wine_malware-compatible.3f Wine常见问题])}}<br />
<br />
== 安装 ==<br />
<br />
可以通过启用[[multilib]] 库来 [[install|安装]] {{Pkg|wine}}(开发版),{{AUR|wine-stable}} (稳定) 或 {{Pkg|wine-staging}} (测试) 软件包。 [https://wine-staging.com/ Wine Staging]是[https://www.winehq.org/ Wine]的修补版本, 其中包含了bug修复和尚未集成到稳定或开发分支中的特性。<br />
<br />
其它需求见[[#图形驱动程序]]和[[#声音]]。<br />
<br />
可以考虑为依赖于 Internet Explorer 和 .NET 的应用程序分别安装{{pkg|wine-gecko}}和{{pkg|wine-mono}}。这两个软件包不是需要强制安装的依赖,因为Wine会根据需要自行下载相关文件。反过来说,如果提前安装了软件包,Wine就不需要再下载文件了。<br />
<br />
=== 第三方Wine应用 ===<br />
<br />
这些都有自己的社区和网站,并不受主要Wine社区的支持。详见[https://wiki.winehq.org/Third_Party_Applications Wine Wiki]。<br />
<br />
* {{App|[[CrossOver]]|Wine 的付费商业版,提供更全面的终端用户支持。|https://www.codeweavers.com|{{AUR|crossover}}}}<br />
* {{App|exe-thumbnailer|为 Windows 可执行文件(exe、lnk、msi和dll格式)生成缩略图。|https://github.com/exe-thumbnailer/exe-thumbnailer|{{AUR|exe-thumbnailer}}}}<br />
* {{App|[[Wikipedia:Lutris|Lutris]]|所有类型游戏的游戏启动器,包括 Wine 游戏(带前缀管理)、原生 Linux 游戏和模拟器。|https://lutris.net|{{Pkg|lutris}}}}<br />
* {{App|[[Wikipedia:PlayOnLinux|PlayOnLinux]]|Wine 的图形化前缀管理器。包含帮助程序安装和配置的脚本。|https://www.playonlinux.com|{{Pkg|playonlinux}}}}<br />
* {{App|Proton|基于Wine和其它部件,为[Wikipedia:Steam]制造的Proton兼容性工具。兼容性列表见 [https://www.protondb.com/ ProtonDB] list.|https://github.com/ValveSoftware/Proton|{{AUR|proton}}}}<br />
* {{App|PyWinery|Wine 的简单图形化前缀管理器。|https://github.com/ergoithz/pywinery|{{AUR|pywinery}}}}<br />
* {{App|Q4Wine|Wine 的图形前缀管理器。可以将 [[Qt]] 主题导出到 Wine 配置中,以便更好地集成。|https://sourceforge.net/projects/q4wine/|{{AUR|q4wine-git}}}}<br />
* {{App|Bottles|基于 GTK 的 Wine 的图形化前缀和管理器。|https://usebottles.com/|{{AUR|bottles}}}}<br />
<br />
== 配置 ==<br />
<br />
配置Wine通常使用以下方法:<br />
<br />
* [https://wiki.winehq.org/Winecfg winecfg] 是 Wine 的 GUI 配置工具,可以通过运行{{ic|winecfg}}启动它。 <br />
* [https://wiki.winehq.org/Regedit regedit] 是 Wine 的注册表编辑工具,可以通过运行{{ic|regedit}} 来启动。See WineHQ's article on [https://wiki.winehq.org/Useful_Registry_Keys Useful Registry Keys].<br />
* [https://wiki.winehq.org/Control control] 是 Wine 的 Windows 控件面板的实现,它可以通过运行{{ic|wine control}}来启动。<br />
* 完整列表见 WineHQ 的[https://wiki.winehq.org/List_of_Commands 命令列表]。<br />
<br />
=== WINEPREFIX ===<br />
<br />
默认情况下,Wine 将其配置文件和安装的 Windows 程序存储在 {{ic|~/.wine}} ,通常会把此目录叫作“Wine prefix”或“Wine bottle”。当您运行 Windows 程序或 Wine 的捆绑程序(如 winecfg)时,它会自动创建/更新。前缀目录还包含一个目录,您的 Windows 程序将其视为 {{ic|c:}} (C盘)。<br />
<br />
您可以使用 {{ic|WINEPREFIX}}环境变量覆盖 Wine 使用的前缀位置。如果您希望为不同的 Windows 程序使用单独的配置,这将非常有用。第一次运行带有新 Wine 前缀的程序时,Wine 将自动创建一个带有 c 驱动器和注册表的目录。<br />
<br />
例如,如果您运行一个带有{{ic|1= $ env WINEPREFIX=~/.win-a wine program-a.exe}}的程序,和另一个 {{ic|1= $ env WINEPREFIX=~/.win-b wine program-b.exe}}这两个程序将分别有一个单独的 c 驱动器和单独的注册。<br />
<br />
{{注意: Wine不是[[Wikipedia:Sandbox (computer security)|沙盒]]!在 Wine 下运行的程序仍然可以访问系统的其余部分!(例如, {{ic|Z:}} 映射到 {{ic|/}}, 与 Wine 前缀无关)}}<br />
<br />
若要在不运行 Windows 程序或其他 GUI 工具的情况下创建默认前缀,可以使用:<br />
<br />
$ env WINEPREFIX=~/.customprefix wineboot -u<br />
<br />
=== WINEARCH ===<br />
<br />
Wine will start a 64-bit environment by default. You can change this behavior using the {{ic|WINEARCH}} [[environment variable]]. Rename your {{ic|~/.wine}} directory and create a new Wine environment by running {{ic|1=$ WINEARCH=win32 winecfg}}. This will get you a 32-bit Wine environment. Not setting {{ic|WINEARCH}} will get you a 64-bit one.<br />
<br />
You can combine this with {{ic|WINEPREFIX}} to make a separate {{ic|win32}} and {{ic|win64}} environment:<br />
<br />
$ WINEARCH=win32 WINEPREFIX=~/win32 winecfg<br />
$ WINEPREFIX=~/win64 winecfg<br />
<br />
You can also use {{ic|WINEARCH}} in combination with other Wine programs, such as ''winetricks'' (using Steam as an example):<br />
<br />
WINEARCH=win32 WINEPREFIX=~/.local/share/wineprefixes/steam winetricks steam<br />
<br />
In order to see the architecture of an existing prefix you can check its registry file. The command below reads the system registry of the {{ic|~/.wine}} prefix and returns {{ic|1=#arch=win32}} or {{ic|1=#arch=win64}} depending on the architecture type:<br />
<br />
$ grep '#arch' ~/.wine/system.reg<br />
<br />
=== 图形驱动程序 ===<br />
<br />
You need to install the 32-bit version of your graphics driver. Please install the package that is listed in the ''OpenGL (multilib)'' column in the table in [[Xorg#Driver installation]].<br />
<br />
A good sign that your drivers are inadequate or not properly configured is when Wine reports the following in your terminal window:<br />
<br />
Direct rendering is disabled, most likely your OpenGL drivers have not been installed correctly<br />
<br />
{{Note|You might need to restart X after having installed the correct library.}}<br />
<br />
=== 声音 ===<br />
<br />
By default sound issues may arise when running Wine applications. Ensure only one sound device is selected in ''winecfg''.<br />
<br />
Install the correct packages for the audio driver you want to use:<br />
<br />
* For [[ALSA]] install {{Pkg|lib32-alsa-lib}} and {{Pkg|lib32-alsa-plugins}}<br />
* For [[PulseAudio]] install {{Pkg|lib32-libpulse}} <br />
* For [[PipeWire]] install either {{Pkg|pipewire-pulse}} and {{Pkg|lib32-libpulse}} or {{Pkg|pipewire-alsa}} and {{Pkg|lib32-alsa-lib}} + {{Pkg|lib32-alsa-plugins}}<br />
* For [[OSS]] install {{Pkg|lib32-alsa-oss}}<br />
<br />
Additional packages: <br />
<br />
* Games that use advanced sound systems (''e.g.'' TESV: Skyrim) may additionally require installations of {{Pkg|lib32-openal}}.<br />
<br />
If ''winecfg'' '''still''' fails to detect the audio driver (Selected driver: (none)), [https://wiki.winehq.org/Wine_User's_Guide#Using_Regedit configure it via the registry]. For example, in a case where the microphone was not working in a 32-bit Windows application on a 64-bit stock install of wine-1.9.7, this provided full access to the sound hardware (sound playback and mic): open ''regedit'', look for the key HKEY_CURRENT_USER → Software → Wine → Drivers, and add a string called ''Audio'' and give it the value ''alsa''. Also, it may help to [[#WINEARCH|recreate the prefix]].<br />
<br />
==== MIDI支持 ====<br />
<br />
在90年代,[[MIDI]]是相当流行的游戏音乐系统。尝试游玩老游戏时,音乐可能无法直接播放。<br />
Wine对MIDI有良好的支持,但首先需要让它在系统上工作,如[[MIDI]]中所解释的。最后,需要确保Wine使用了正确的MIDI输出。<br />
<br />
=== 其它依赖 ===<br />
<br />
对于以下情况,部分应用软件可能需要额外的软件包:<br />
<br />
* 播放音乐: {{Pkg|lib32-mpg123}}<br />
* 原生图像处理库: {{Pkg|lib32-giflib}} and {{Pkg|lib32-libpng}}<br />
* 加密服务: {{Pkg|lib32-gnutls}}<br />
* 32位视频编解码器: {{Pkg|lib32-gst-plugins-base}}, {{Pkg|lib32-gst-plugins-good}}, {{Aur|lib32-gst-plugins-bad}} and {{Aur|lib32-gst-plugins-ugly}}<br />
* NTLM身份验证: {{Pkg|samba}}<br />
<br />
=== 字体 ===<br />
<br />
如果 Wine 应用程序没有显示易读的字体,则可能没有安装任何字体。轻松链接所有的系统字体,使其可以从Wine:<br />
<br />
$ cd ${WINEPREFIX:-~/.wine}/drive_c/windows/Fonts && for i in /usr/share/fonts/**/*.{ttf,otf}; do ln -s "$i" ; done<br />
<br />
Wine 使用 FreeType 渲染字体,而 FreeType 的默认设置在几个版本之前已经改变了。尝试在Wine项目中使用这种环境设置:<br />
<br />
FREETYPE_PROPERTIES="truetype:interpreter-version=35"<br />
<br />
另一种可能性是在Wine前缀中安装微软的 TrueType 字体。 See [[MS Fonts]]. If this does not help, try running {{ic|winetricks corefonts}} first, then {{ic|winetricks allfonts}} as a last resort.<br />
<br />
运行此类程序后,关闭所有 Wine 服务并运行{{ic| winecfg }}。字体现在应该是可读的。<br />
<br />
如果字体看起来模糊不清,导入以下文本文件到 Wine 注册表[https://wiki.winehq.org/FAQ#How_do_I_edit_the_Wine_registry.3F regedit]:<br />
<br />
Windows Registry Editor Version 5.00<br />
[HKEY_CURRENT_USER\Software\Wine\X11 Driver]<br />
"ClientSideWithRender"="N"<br />
<br />
对于高分辨率显示,可以在 winecfg 中调整 dpi 值。<br />
<br />
另见[[Font configuration#Applications without fontconfig support]]。<br />
<br />
==== 启用平滑字体 ====<br />
<br />
提高Wine渲染效果的一个好方法是使用cleartype平滑字体。<br />
若要启用“次像素平滑(ClearType) RGB”:<br />
<br />
{{bc|<nowiki><br />
$ cat << EOF > /tmp/fontsmoothing<br />
REGEDIT4<br />
<br />
[HKEY_CURRENT_USER\Control Panel\Desktop]<br />
"FontSmoothing"="2"<br />
"FontSmoothingOrientation"=dword:00000001<br />
"FontSmoothingType"=dword:00000002<br />
"FontSmoothingGamma"=dword:00000578<br />
EOF<br />
<br />
$ WINE=${WINE:-wine} WINEPREFIX=${WINEPREFIX:-$HOME/.wine} $WINE regedit /tmp/fontsmoothing 2> /dev/null<br />
</nowiki>}}<br />
<br />
详见[https://askubuntu.com/a/219795]。<br />
<br />
=== 桌面启动器 ===<br />
<br />
当使用 Windows 应用安装程序创建一个快捷方式时,Wine 会创建 [[.desktop]] 文件。Arch Linux 中这些文件的默认位置是:<br />
<br />
* 桌面快捷方式位于 {{ic|~/Desktop}} 下。<br />
* 开始菜单图标位于 {{ic|~/.local/share/applications/wine/Programs/}} 下。<br />
<br />
{{Note|1=Wine 不支持为所有用户安装 Winidows 应用程序,所以 Wine 不会把 ''.desktop'' 文件放到 {{ic|/usr/share/applications}} 下。详见 WineHQ bug [https://bugs.winehq.org/show_bug.cgi?id=11112 11112]}}<br />
<br />
{{Tip|如果安装软件时桌面启动器并没有创建或已经丢失,{{ic|wine winemenubuilder}} 也许能帮得上忙。}}<br />
<br />
==== 为Wine utilities创建菜单项 ====<br />
<br />
默认情况下,Wine 的安装不会为 Wine 附带的软件创建桌面菜单/图标(例如“ winecfg”、“ winebroserer”等)。这可以通过安装 {{AUR|wine-installer}}或 {{AUR|wine-installer-git}} meta-package (后者没有附加依赖项)来实现,否则这些说明将为这些应用程序添加条目。<br />
<br />
首先,使用 Wine 安装一个 Windows 程序来创建基本菜单。创建基本菜单后,可以在 {{ic|~/.local/share/applications/wine/}}:<br />
<br />
{{hc|wine-browsedrive.desktop|2=<br />
[Desktop Entry]<br />
Name=Browse C: Drive<br />
Comment=Browse your virtual C: drive<br />
Exec=wine winebrowser c:<br />
Terminal=false<br />
Type=Application<br />
Icon=folder-wine<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-uninstaller.desktop|2=<br />
[Desktop Entry]<br />
Name=Uninstall Wine Software<br />
Comment=Uninstall Windows applications for Wine<br />
Exec=wine uninstaller<br />
Terminal=false<br />
Type=Application<br />
Icon=wine-uninstaller<br />
Categories=Wine;<br />
}}<br />
<br />
{{hc|wine-winecfg.desktop|2=<br />
[Desktop Entry]<br />
Name=Configure Wine<br />
Comment=Change application-specific and general Wine options<br />
Exec=winecfg<br />
Terminal=false<br />
Icon=wine-winecfg<br />
Type=Application<br />
Categories=Wine;<br />
}}<br />
<br />
并在{{ic|~/.config/menus/applications-merged/}}目录下创建如下文件:<br />
<br />
{{hc|wine.menu|<nowiki><br />
<!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN"<br />
"http://www.freedesktop.org/standards/menu-spec/menu-1.0.dtd"><br />
<Menu><br />
<Name>Applications</Name><br />
<Menu><br />
<Name>wine-wine</Name><br />
<Directory>wine-wine.directory</Directory><br />
<Include><br />
<Category>Wine</Category><br />
</Include><br />
</Menu><br />
</Menu><br />
</nowiki>}}<br />
<br />
如果这些设置产生了一个难看的/不存在的图标,这意味着在您所启用的图标集中没有这些启动程序的图标。您应该将图标设置替换为所需图标的位置。单击启动器属性菜单中的图标将会产生同样的效果。一个支持这些快捷方式的图标集是[https://www.gnome-look.org/content/show.php/GNOME-colors?content=82562 GNOME-colors]。<br />
<br />
==== Removing menu entries ====<br />
<br />
由 Wine 创建的菜单条目位于 {{ic|~/.local/share/applications/wine/Programs/}}.<br />
除了通过 Wine 删除不需要的扩展绑定,还可以执行以下命令(摘自 Wine 官网) :<br />
<br />
$ rm ~/.local/share/mime/packages/x-wine*<br />
$ rm ~/.local/share/applications/wine-extension*<br />
$ rm ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
$ rm ~/.local/share/mime/application/x-wine-extension*<br />
<br />
Sometimes you should also remove {{ic|wine-*.menu}} files from {{ic|/.config/menus/}} to completely remove items from wine submenu in kde.<br />
<br />
=== 主题 ===<br />
<br />
类似于 xp 外观的主题可以在这里 [https://archive.org/download/zune-desktop-theme/ZuneDesktopTheme.msi 下载]. To install it, see [https://wiki.winehq.org/Wine_User%27s_Guide#Running_.msi_files this upstream wiki article]. Lastly, use ''winecfg'' to select it.<br />
<br />
{{Note|上面链接的主题只能安装在32位前缀上,前缀版本为 windowsxp。要将其安装在64位前缀上,可能需要创建一个临时的32位前缀,install the theme and copy the {{ic|Zune}} folder and {{ic|Zune.theme}} files from {{ic|drive_c/Windows/Resources/Themes}} in that prefix to the same location in your usual prefix.}}<br />
<br />
Wine staging users may instead want to try enabling the option ''Enable GTK3 Theming'' under the Staging section of ''winecfg'' for a theme that matches the current GTK theme.<br />
<br />
=== 打印 ===<br />
<br />
In order to use your installed printers (both local and network) with wine applications in ''win32 prefixes'' (e.g. MS Word), install the {{Pkg|lib32-libcups}} package, reboot wine (''wineboot'') and restart your wine application.<br />
<br />
=== 网络 ===<br />
<br />
After installation, the {{pkg|lib32-gnutls}} package may need to be [[install]]ed for applications making TLS or HTTPS connections to work.<br />
<br />
For ICMP (ping), Wine may need the network access as described in the [https://wiki.winehq.org/FAQ#Failed_to_use_ICMP_.28network_ping.29.2C_this_requires_special_permissions WineHQ FAQ]:<br />
<br />
# setcap cap_net_raw+epi /usr/bin/wine-preloader<br />
<br />
If issues arise after this (such as an unhandled exception or privileged instruction), remove via:<br />
<br />
# setcap -r /usr/bin/wine-preloader<br />
<br />
== 使用 ==<br />
<br />
{{Warning|Do not run or install Wine applications as root! See [https://wiki.winehq.org/FAQ#Should_I_run_Wine_as_root.3F Wine FAQ] for details.}}<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Using_Wine Wine User's Guide] for general information on Wine usage.<br />
<br />
See [https://appdb.winehq.org/ Wine Application Database (AppDB)] for additional information on specific Windows applications in Wine.<br />
<br />
=== Wayland ===<br />
<br />
Currently Wine does not support Wayland directly, but you can use [[Wayland#XWayland|XWayland]] instead.<br />
<br />
There are some efforts to support Wayland though:<br />
<br />
* Experimental Wayland driver for Wine, which supports using OpenGL- and Windows GDI-applications. See [https://www.winehq.org/pipermail/wine-devel/2020-December/178575.html this] and [https://www.winehq.org/pipermail/wine-devel/2021-February/181325.html this] wine-devel maillist entries.<br />
* [https://github.com/varmd/wine-wayland wine-wayland]: a custom version of Wine, which supports Wayland via Vulkan (so it supports only: DirectX 9, 10 and 11 via [[#DXVK]] and Vulkan-compatible applications).<br />
<br />
== 提示与技巧 ==<br />
<br />
=== Wineconsole ===<br />
<br />
Often you may need to run ''.exe'''s to patch game files, for example a widescreen mod for an old game, and running the ''.exe'' normally through Wine might yield nothing happening. In this case, you can open a terminal and run the following command:<br />
<br />
$ wineconsole cmd<br />
<br />
Then navigate to the directory and run the ''.exe'' file from there.<br />
<br />
=== Winetricks ===<br />
<br />
[https://wiki.winehq.org/Winetricks Winetricks] is a script to allow one to install base requirements needed to run Windows programs. Installable components include DirectX 9.x, MSXML (required by Microsoft Office 2007 and Internet Explorer), Visual Runtime libraries and many more.<br />
<br />
[[Install]] the {{pkg|winetricks}} package (or alternatively {{AUR|winetricks-git}}). Then run it with:<br />
$ winetricks<br />
<br />
For using GUI you should [[install]] the {{pkg|zenity}}.<br />
<br />
=== 性能 ===<br />
<br />
==== CSMT ====<br />
<br />
CSMT is a technology used by Wine to use a separate thread for the OpenGL calls to improve performance noticeably. Since Wine 3.2, CSMT is enabled by default. However, CSMT support needs to be enabled manually for Wine versions lower than 3.2. For vanilla Wine run {{ic|wine regedit}} and set the DWORD value for ''HKEY_CURRENT_USER -> Software > Wine > Direct3D > csmt'' to 0x01 (enabled). For wine-staging run {{ic|winecfg}} and enable it in the staging tab.<br />
<br />
Note that CSMT may actually hurt performance for some applications - if this is the case, disable it by creating/setting the registry value to 0x00 (disabled).<br />
<br />
Further information:<br />
*[https://www.phoronix.com/forums/showthread.php?93967-Wine-s-Big-Command-Stream-D3D-Patch-Set-Updated/page3&s=7775d7c3d4fa698089d5492bb7b1a435 Phoronix Forum discussion] with the CSMT developer Stefan Dösinger<br />
<br />
==== 强制使用OpenGL模式运行游戏 ====<br />
<br />
Some games might have an OpenGL mode which ''may'' perform better than their default DirectX mode. While the steps to enable OpenGL rendering is ''application specific'', many games accept the {{Ic|-opengl}} parameter.<br />
<br />
$ wine ''/path/to/3d_game.exe'' -opengl<br />
<br />
You should of course refer to your application's documentation and Wine's [https://appdb.winehq.org AppDB] for such application specific information.<br />
<br />
==== DXVK ====<br />
<br />
[https://github.com/doitsujin/dxvk DXVK] is a promising new implementation for DirectX 9, 10 & 11 over Vulkan. This should allow for greater performance, and in some cases, even better compatibility. Battlefield 1 for example, only runs under DXVK. On the other hand, DXVK does not support all Wine games (yet).<br />
<br />
To use it, install {{aur|dxvk-bin}}. Then run the following command to activate it in your Wineprefix (by default {{ic|~/.wine}}):<br />
<br />
$ WINEPREFIX=''your-prefix'' setup_dxvk install<br />
<br />
{{Warning|DXVK overrides the DirectX 10 and 11 DLLs, which may be considered cheating in online multiplayer games, and may get your account '''banned'''. Use at your own risk!}}<br />
<br />
==== Gallium Nine ====<br />
<br />
With the open-source gallium-based drivers (mostly AMD and Intel cards) there is a [https://wiki.ixit.cz/d3d9 Gallium Direct3D state tracker] that aims to provide nearly-native performance for DirectX 9. In most cases it has less visual glitches than the upstream wine and doubles the performances. It consumes much less CPU time than CSMT.<br />
<br />
Install {{Pkg|wine-nine}} to use it. This is a standalone package that can be installed with any Wine version. Use {{ic|wine ninewinecfg}} to check if it is enabled.<br />
<br />
For older Intel graphics (gen4-7: GMA 3000, GMA 4500, HD 2000-5000; year 2006-2014) Crocus Gallium driver should be used instead of i965 since Mesa 21.2. [[Export]] the following environment variable before running Wine: <br />
<br />
MESA_LOADER_DRIVER_OVERRIDE=crocus<br />
<br />
=== Unregister existing Wine file associations ===<br />
<br />
By default, Wine takes over as the default application for a lot of formats. Some (e.g. {{ic|vbs}} or {{ic|chm}}) are Windows-specific, and opening them with Wine can be a convenience. However, having other formats (e.g. {{ic|gif}}, {{ic|jpeg}}, {{ic|txt}}, {{ic|js}}) open in Wine's bare-bones simulations of Internet Explorer and Notepad can be annoying.<br />
<br />
Wine's file associations are set in {{ic|~/.local/share/applications/}} as {{ic|wine-extension-''extension''.desktop}} files. Delete the files corresponding to the extensions you want to unregister. Or, to remove all wine extensions:<br />
<br />
$ rm -f ~/.local/share/applications/wine-extension*.desktop<br />
$ rm -f ~/.local/share/icons/hicolor/*/*/application-x-wine-extension*<br />
<br />
Next, remove the old cache:<br />
<br />
$ rm -f ~/.local/share/applications/mimeinfo.cache<br />
$ rm -f ~/.local/share/mime/packages/x-wine*<br />
$ rm -f ~/.local/share/mime/application/x-wine-extension*<br />
<br />
And, update the cache:<br />
<br />
$ update-desktop-database ~/.local/share/applications<br />
$ update-mime-database ~/.local/share/mime/<br />
<br />
Please note Wine will still create new file associations and even recreate the file associations if the application sets the file associations again.<br />
<br />
=== Prevent Wine from creating filetype associations ===<br />
<br />
{{Note|This has to be done for each WINEPREFIX which should not update file associations unless you opt to change {{ic|/usr/share/wine/wine.inf}} .}}<br />
This method prevents the creation of filetype associations but retains the creation of XDG .desktop files (that you might see e.g. in menus).<br />
<br />
If you want to stop wine from creating filetype associations via winecfg you have to uncheck the "Manage File Associations" checkbox under the Desktop Integration tab. See [https://wiki.winehq.org/FAQ#How_can_I_prevent_Wine_from_changing_the_filetype_associations_on_my_system_or_adding_unwanted_menu_entries.2Fdesktop_links.3F Wine FAQ]<br />
<br />
To make the same change via registry add the string {{ic|Enable}} with value {{ic|N}} under:<br />
<br />
HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations<br />
<br />
''You might have to create the key {{ic|FileOpenAssociations}} first!''<br />
<br />
To make this change via the command-line, run the following command:<br />
<br />
$ wine reg add "HKEY_CURRENT_USER\Software\Wine\FileOpenAssociations" /v Enable /d N<br />
<br />
If you want to apply this by default for new WINEPREFIXES, edit {{ic|/usr/share/wine/wine.inf}} and add this line for example under the {{ic|[Services]}} section:<br />
HKCU,"Software\Wine\FileOpenAssociations","Enable",2,"N"<br />
<br />
To prevent a package upgrade from overriding the modified file, create a pacman hook to make the change automatically:<br />
<br />
{{hc|1=/etc/pacman.d/hooks/stop-wine-associations.hook|2=<br />
<br />
[Trigger]<br />
Operation = Install<br />
Operation = Upgrade<br />
Type = Path<br />
Target = usr/share/wine/wine.inf<br />
<br />
[Action]<br />
Description = Stopping Wine from hijacking file associations...<br />
When = PostTransaction<br />
<nowiki>Exec = /bin/sh -c '/usr/bin/grep -q "HKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"" /usr/share/wine/wine.inf || /usr/bin/sed -i "s/\[Services\]/\[Services\]\nHKCU,\"Software\\\Wine\\\FileOpenAssociations\",\"Enable\",2,\"N\"/g" /usr/share/wine/wine.inf'</nowiki><br />
}}<br />
<br />
See [[Pacman#Hooks]]<br />
<br />
=== Execute Windows binaries with Wine implicitly ===<br />
<br />
The {{pkg|wine}} package installs a ''binfmt'' file which will allows you to run Windows programs directly, e.g. {{ic|''./myprogram.exe''}} will launch as if you had typed {{ic|wine ''./myprogram.exe''}}. Service starts by default on boot, if you have not rebooted after installing Wine you can [[start]] {{ic|systemd-binfmt.service}} to use it right away.<br />
<br />
{{Note|Make sure the Windows binary is [[executable]], otherwise the binary will not run.}}<br />
<br />
=== Dual Head with different resolutions ===<br />
<br />
If you have issues with dual-head setups and different display resolutions you are probably missing {{Pkg|lib32-libxrandr}}.<br />
<br />
Also installing {{Pkg|lib32-libxinerama}} might fix dual-head issues with wine (for example, unclickable buttons and menus of application in the right most or bottom most monitor, not redrawable interface of application in that zone, dragging mouse cursor state stucked after leaving application area).<br />
<br />
=== Burning optical media ===<br />
<br />
To burn CDs or DVDs, you will need to load the {{ic|sg}} [[kernel module]].<br />
<br />
=== Proper mounting of optical media images ===<br />
<br />
Some applications will check for the optical media to be in drive. They may check for data only, in which case it might be enough to configure the corresponding path as being a CD-ROM drive in ''winecfg''.<br />
However, other applications will look for a media name and/or a serial number, in which case the image has to be mounted with these special properties.<br />
<br />
Some virtual drive tools do not handle these metadata, like fuse-based virtual drives (Acetoneiso for instance). [[CDemu]] will handle it correctly.<br />
<br />
=== 游戏内覆盖显示帧数 ===<br />
<br />
Wine features an embedded FPS monitor which works for all graphical applications if the environment variable {{ic|1=WINEDEBUG=fps}} is set. This will output the framerate to stdout. You can display the FPS on top of the window thanks to {{ic|osd_cat}} from the {{pkg|xosd}} package. See [https://gist.github.com/anonymous/844aefd70bb50bf72b35 winefps.sh] for a helper script.<br />
<br />
=== Running Wine under a separate user account ===<br />
<br />
It may be desirable to run Wine under a specifically created user account in order to reduce concerns about Windows applications having access to your home directory.<br />
<br />
First, create a [[user account]] for Wine:<br />
<br />
# useradd -m -s /bin/bash wineuser<br />
<br />
Now switch to another TTY and start your X WM or DE as you normally would or keep reading...<br />
<br />
{{Note|The following approach only works when enabling root for Xorg. See [[Xorg#Rootless Xorg]] for more information on how to execute the {{ic|xhost}} command under your main user.}}<br />
<br />
Afterwards, in order to open Wine applications using this new user account you need to add the new user to the X server permissions list:<br />
<br />
$ xhost +SI:localuser:wineuser<br />
<br />
Finally, you can run Wine via the following command, which uses {{ic|env}} to launch Wine with the environment variables it expects:<br />
<br />
$ sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine ''arguments''<br />
<br />
It is possible to automate the process of running Windows applications with Wine via this method by using a shell script as follows:<br />
{{hc|1=/usr/local/bin/runaswine|2=<br />
#!/bin/bash<br />
xhost +SI:localuser:wineuser<br />
sudo -u wineuser env HOME=/home/wineuser USER=wineuser USERNAME=wineuser LOGNAME=wineuser wine "$@"}}<br />
<br />
Wine applications can then be launched via:<br />
<br />
$ runaswine ''"C:\path\to\application.exe"''<br />
<br />
In order to not be asked for a password each time Wine is run as another user the following entry can be added to the sudoers file: {{ic|1=''mainuser'' ALL=(wineuser) NOPASSWD: ALL}}. See [[Sudo#Configuration]] for more information.<br />
<br />
It is recommended to run {{ic|winecfg}} as the Wine user and remove all bindings for directories outside the home directory of the Wine user in the "Desktop Integration" section of the configuration window so no program run with Wine has read access to any file outside the special user's home directory.<br />
<br />
Keep in mind that audio will probably be non-functional in Wine programs which are run this way if [[PulseAudio]] is used. See [[PulseAudio/Examples#Allowing multiple users to share a PulseAudio daemon]] for information about allowing the Wine user to access the PulseAudio daemon of the principal user.<br />
<br />
=== Temp directory on tmpfs ===<br />
<br />
To prevent Wine from writing its temporary files to a physical disk, one can define an alternative location, like ''tmpfs''. Remove Wine's default directory for temporary files and creating a symlink:<br />
<br />
$ rm -r ~/.wine/drive_c/users/$USER/Temp ~/.wine/drive_c/windows/temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/users/$USER/Temp<br />
$ ln -s /tmp/ ~/.wine/drive_c/windows/temp<br />
<br />
=== Prevent installing Mono/Gecko ===<br />
<br />
If Gecko and/or Mono are not present on the system nor in the Wine prefix, Wine will prompt to download them from the internet. If you do not need Gecko and/or Mono, you might want to disable this dialog, by setting the {{ic|WINEDLLOVERRIDES}} [[environment variable]] to {{ic|1=mscoree=d;mshtml=d}}.<br />
<br />
=== Vulkan ===<br />
<br />
The default Wine Vulkan ICD loader works fine for most applications, but does not support advanced features, like Vulkan layers. To use these features, you have to install the official Vulkan SDK, see step 2-4 on the original Vulkan patches author's [https://github.com/roderickc/wine-vulkan GitHub page].<br />
<br />
=== Remove Wine file bindings ===<br />
<br />
For security reasons it may be useful to remove the preinstalled Wine bindings so Windows applications cannot be launched directly from a file manager or from the browser (Firefox offers to open EXE files directly with Wine!).<br />
If you want to do this, you may add the following to the {{ic|1= [options]}} section in {{ic|1= /etc/pacman.conf}}<br />
<br />
NoExtract = usr/lib/binfmt.d/wine.conf<br />
NoExtract = usr/share/applications/wine.desktop<br />
<br />
=== WineASIO ===<br />
<br />
If you need professional audio support under wine you can use {{Aur|wineasio}} which provides an ASIO interface for wine that you can then use with [[JACK]].<br />
<br />
In order to use wineasio you must add yourself to the {{ic|realtime}} [[user group]].<br />
<br />
Next you need to register wineasio in your desired wine prefix. Register the 32-bit and/or 64-bit version as needed:<br />
$ regsvr32 /usr/lib32/wine/i386-windows/wineasio.dll<br />
$ wine64 regsvr32 /usr/lib/wine/x86_64-windows/wineasio.dll<br />
<br />
== 疑难解答 ==<br />
<br />
See [https://wiki.winehq.org/Wine_User%27s_Guide#Troubleshooting_.2F_Reporting_bugs Wine User's Guide] and [https://wiki.winehq.org/FAQ Wine FAQ] (especially its [https://wiki.winehq.org/FAQ#Troubleshooting Troubleshooting] section) for general tips.<br />
<br />
Also refer to the [https://appdb.winehq.org/ Wine AppDB] for an advice on specific applications.<br />
<br />
=== XWayland问题 ===<br />
<br />
If you use Wine under [[Wayland#XWayland|XWayland]], you can activate the option for "Emulating a virtual desktop" in the Graphics Tab in winecfg, to avoid problems with:<br />
<br />
* flickering;<br />
* wrong window location;<br />
* wrong mouse cursor location and clicks;<br />
* keyboard detection.<br />
<br />
=== 键盘输入不工作 ===<br />
<br />
This could be caused by the window manager not switching focus. In the ''Graphics'' tab of ''winecfg'', disable the 'Allow the window manager...' options, or set windowed mode with 'Emulate a virtual desktop'.<br />
*Some suggest to toggle all the ''Window settings'', click ''Apply'', then change them back. If that does not work, try the above.<br />
<br />
If the keyboard does not work after unfocusing the application, try editing the registry:<br />
*Under ''HKEY_CURRENT_USER\Software\Wine\X11 Driver'', add a string value ''UseTakeFocus'' and set it to ''N''.<br />
*Alternatively, you can use winetricks to set the value.<br />
winetricks usetakefocus=n<br />
<br />
== 另见 ==<br />
<br />
* [https://www.winehq.org/ Wine Homepage]<br />
* [https://wiki.winehq.org/ Wine Wiki]<br />
* [https://appdb.winehq.org/ Wine Application Database (AppDB)] - Information about running specific Windows applications (Known issues, ratings, guides, etc tailored to specific applications)<br />
* [https://forum.winehq.org/ Wine Forums] - A great place to ask questions ''after'' you have looked through the FAQ and AppDB<br />
* [[Gentoo:Wine]]<br />
* [https://www.darlinghq.org/ Darling] - a similar project for MacOS software<br />
* [https://github.com/wineasio/wineasio WineASIO] - GitHub page of the WineASIO project with further information</div>Fincehttps://wiki.archlinux.org/index.php?title=Touhou_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726990Touhou (简体中文)2022-04-19T15:27:58Z<p>Fince: 其他→其它</p>
<hr />
<div>[[Category:Gaming (简体中文)]]<br />
[[en:Touhou]]<br />
[[ja:東方Project]]<br />
{{TranslationStatus (简体中文)|Touhou|2021-07-20|665468}}<br />
[[:w:zh:東方Project|东方Project]] 是一种 [https://baike.baidu.com/item/弹幕射击游戏/8682817?fr=aladdin 弹幕游戏] (在西方又被叫做 "bullet-hell shooters")<br />
<br />
东方Project(Touhou Project)是一个弹幕类游戏系列的合称。<br />
弹幕类游戏是一种2D射击类游戏,大多由美丽且难度极大的弹幕组成。<br />
东方Project作为现在最多同人作品的射击游戏,现在已经渗透到各个领域,比如说Linux这个与任何一款Windows游戏八杆子打不着的地方…<br />
<br />
虽然东方Project系列的原作游戏难度较大,但同时也是一个让人上瘾的游戏。<br />
<br />
本页的目标是帮助Arch Linux用户安装东方本作及其它与东方相关的包。<br />
<br />
== 关于东方Project的安装包 ==<br />
<br />
PC-98上的游戏可以使用 Linux-native X Neko Project II emulator ({{AUR|xnp2}})来运行。<br />
<br />
以下的AUR包都需要[[wine]]来运行(以及timidity++来播放MIDI音乐).有一个基于python的引擎正在开发中,并会用来代替wine。在AUR中的游戏都是免费试用版。你可以简单的用完整版把试用版换掉(如果你有完整版的话)。<br />
<br />
下面是已经在AUR中打包好的软件包:<br />
<br />
* th6:东方红魔乡 〜 the Embodiment of Scarlet Devil. &mdash; {{AUR|th06-demo-wine}} 或 {{AUR|th06-demo-pytouhou}}<br />
* th7:东方妖妖梦 〜 Perfect Cherry Blossom. &mdash; {{AUR|th07}}<br />
* th8:东方永夜抄 〜 Imperishable Night. &mdash; {{AUR|th08}}<br />
<br />
下面是一些尚未打包到AUR中,但有免费版放出,需要有人进行打包的:<br />
<br />
* th7.5:东方萃梦想 〜 Immaterial and Missing Power<br />
* th9:东方花映塚 〜 Phantasmagoria of Flower View<br />
* th10:东方风神录 〜 Mountain of Faith<br />
* th10.5:东方绯想天 〜 Scarlet Weather Rhapsody<br />
* th11:东方地灵殿 〜 Subterranean Animism<br />
* th12:东方星莲船 〜 Undefined Fantastic Object<br />
* th13:东方神灵庙 〜 Ten Desires<br />
* th13.5:东方心绮楼 〜 Hopeless Masquerade.<br />
* th14:东方辉针城 〜 Double Dealing Character<br />
* th14.5:东方深秘录 〜 Urban Legend in Limbo<br />
* th15:东方绀珠传 〜 Legacy of Lunatic Kingdom<br />
* th15.5:东方凭依华 〜 Antinomy of Common Flowers<br />
* th16:东方天空璋 〜 Hidden Star in Four Seasons<br />
* th17:东方鬼形兽 〜 Wily Beast and Weakest Creature<br />
* th18:东方虹龙洞 〜 Unconnected Marketeers<br />
<br />
=== Python引擎 ===<br />
<br />
[https://linkmauve.fr/doc/touhou/ Linkmauve] 制作了一个实验性质的基于python的游戏引擎。现在这个引擎还不稳定, 和正式作比起来更像是一个目标。参考 {{AUR|pytouhou-hg}} 和 {{AUR|th06-demo-data}}。<br />
<br />
== 其它 ==<br />
<br />
=== 安装完整版游戏 ===<br />
<br />
如果你有永夜抄或者妖妖梦的完整版的话,你可以放到你的主文件夹或者overlay里。这样就能在liveCD/磁盘里安装了。<br />
<br />
{{注意|'''.th08''' 是东方永夜抄的 wineprefix 文件夹,而'''.th07''' 东方妖妖梦的文件夹。}}<br />
<br />
#找到完整游戏的文件夹<br />
#在主文件夹(/home)下查看隐藏文件并找到“.th08”和“.th07”这2个文件夹<br />
#把完整游戏文件复制到隐藏文件(“.th08”和“.th07”)<br />
#运行游戏<br />
<br />
=== MIDI 音源 ===<br />
<br />
试用版只提供MIDI文件,所以你需要安装 {{Pkg|timidity++}} 和一些音源 ({{Pkg|freepats-general-midi}})。<br />
<br />
然后再把下面几行加入 Timidity++ 的配置文件中去:<br />
<br />
{{hc|/etc/timidity++/timidity.cfg|<br />
dir /usr/share/timidity/freepats<br />
source /etc/timidity++/freepats/freepats.cfg<br />
}}<br />
<br />
请记住要在玩游戏之前[[启动]] {{ic|timidity.service}} [[用户单元]]。<br />
<br />
=== Windows时代游戏中的音频 ===<br />
<br />
如果你发现你在任何Windows时代或以后的游戏(>=th06)没有音频,请确保安装{{Pkg|lib32-alsa-lib}}和{{Pkg|lib32-alsa-plugins}},并重新检查你的配置(在winecfg)。此外,设置游戏中的音频为“WAV”模式。<br />
<br />
== 相关链接 ==<br />
<br />
* [https://thwiki.cc/東方Project THBwiki上的东方Project]<br />
* [https://zh.moegirl.org.cn/东方Project 萌娘百科上的东方Project]<br />
* [[Wikipedia:zh:东方Project|维基百科上的东方Project]]<br />
* [https://zh.touhouwiki.net/wiki/于Linux运行 东方Project在LINUX运行]</div>Fincehttps://wiki.archlinux.org/index.php?title=User:Fince&diff=726977User:Fince2022-04-19T13:34:44Z<p>Fince: </p>
<hr />
<div>Translated:<br />
<br />
[[DaVinci Resolve (简体中文)]]<br />
<br />
[[GNOME (简体中文)/Files (简体中文)]]<br />
<br />
[[GNOME (简体中文)/Gedit (简体中文)]]<br />
<br />
Improved/Updated Translation:<br />
<br />
[[GNOME (简体中文)]]<br />
<br />
[[Steam (简体中文)]]<br />
<br />
[[GTK (简体中文)]]<br />
<br />
[[Java (简体中文)]]<br />
<br />
[[GDM (简体中文)]]</div>Fincehttps://wiki.archlinux.org/index.php?title=GDM_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726976GDM (简体中文)2022-04-19T13:30:13Z<p>Fince: minor fix</p>
<hr />
<div>[[Category:GNOME (简体中文)]]<br />
[[Category:Boot process (简体中文)]]<br />
[[Category:Display managers (简体中文)]]<br />
[[de:Login-Manager#GDM]]<br />
[[en:GDM]]<br />
[[fr:GDM]]<br />
[[ja:GDM]]<br />
[[pt:GDM]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|GNOME (简体中文)}}<br />
{{Related|GNOME Flashback}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|LightDM (简体中文)}}<br />
{{Related|LXDM (简体中文)}}<br />
{{Related articles end}}<br />
<br />
{{Translateme (简体中文)|文章部分内容没有翻译。}}<br />
<br />
{{TranslationStatus (简体中文)|GDM|2022-04-19|726892}}<br />
<br />
来自[https://wiki.gnome.org/Projects/GDM GDM - GNOME显示管理器]:“GNOME显示管理器(GDM)是一个管理图形显示服务并处理图形用户登录的程序。<br />
<br />
[[Display_manager_(简体中文)|显示管理器]]为[[Xorg_(简体中文)|X Window System]]和[[Wayland_(简体中文)|Wayland]]提供图形登录提示。<br />
<br />
== 安装 ==<br />
<br />
可通过安装{{Pkg|gdm}}包来安装GDM,或作为{{grp|gnome}}组的一部分安装。<br />
<br />
== 启动 ==<br />
<br />
若要开机启动GDM,[[enable|启用]]{{ic|gdm.service}}。<br />
<br />
=== 自动启动应用 ===<br />
<br />
To automatically start applications after logging in, follow the instructions in [[Autostarting#On desktop environment startup]] that pertain to your desktop environment.<br />
<br />
== 配置 ==<br />
<br />
=== 登录页面背景图片 ===<br />
<br />
{{Accuracy|Configuration is not persistent and changes will be undone after an update of GNOME Shell. Suggestion: Rewrite to use the "User Themes" Gnome extension.}}<br />
<br />
{{Note (简体中文)|<br />
* 自GNOME 3.16开始,GNOME Shell主题被存储为二进制文件(gresource)。<br />
* This change will be overwritten on subsequent updates of {{Pkg|gnome-shell}}.<br />
}}<br />
<br />
首先,您需要将现有的 GNOME Shell 主题解压到您的主目录中的一个文件夹中。 您可以使用以下脚本执行此操作:<br />
<br />
{{hc|extractgst.sh|2=<br />
#!/bin/sh<br />
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource<br />
workdir=${HOME}/shell-theme<br />
<br />
for r in `gresource list $gst`; do<br />
r=${r#\/org\/gnome\/shell/}<br />
if [ ! -d $workdir/${r%/*} ]; then<br />
mkdir -p $workdir/${r%/*}<br />
fi<br />
done<br />
<br />
for r in `gresource list $gst`; do<br />
gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell/}<br />
done<br />
}}<br />
<br />
主题文件应当已提取到创建的目录中。现在将您想要的背景图像复制到此目录。<br />
<br />
接下来,您需要在目录中创建一个文件,内容如下:<br />
<br />
{{hc|1=gnome-shell-theme.gresource.xml|2=<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<gresources><br />
<gresource prefix="/org/gnome/shell/theme"><br />
<file alias="icons/scalable/actions/color-pick.svg">color-pick.svg</file><br />
<file alias="icons/scalable/actions/pointer-double-click-symbolic.svg">pointer-double-click-symbolic.svg</file><br />
<file alias="icons/scalable/actions/pointer-drag-symbolic.svg">pointer-drag-symbolic.svg</file><br />
<file alias="icons/scalable/actions/pointer-primary-click-symbolic.svg">pointer-primary-click-symbolic.svg</file><br />
<file alias="icons/scalable/actions/pointer-secondary-click-symbolic.svg">pointer-secondary-click-symbolic.svg</file><br />
<file alias="icons/scalable/actions/preview-close-symbolic.svg">window-close-24-symbolic.svg</file><br />
<file alias="icons/scalable/status/carousel-arrow-next-24-symbolic.svg">carousel-arrow-next-24-symbolic.svg</file><br />
<file alias="icons/scalable/status/carousel-arrow-back-24-symbolic.svg">carousel-arrow-back-24-symbolic.svg</file><br />
<file alias="icons/scalable/status/eye-open-negative-filled-symbolic.svg">eye-open-negative-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/eye-not-looking-symbolic.svg">eye-not-looking-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-caps-lock-filled-symbolic.svg">keyboard-caps-lock-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-enter-symbolic.svg">keyboard-enter-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-hide-symbolic.svg">keyboard-hide-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-layout-filled-symbolic.svg">keyboard-layout-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-shift-filled-symbolic.svg">keyboard-shift-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/message-indicator-symbolic.svg">message-indicator-symbolic.svg</file><br />
<file>calendar-today.svg</file><br />
<file>checkbox-focused.svg</file><br />
<file>checkbox-off-focused.svg</file><br />
<file>checkbox-off.svg</file><br />
<file>checkbox.svg</file><br />
<file>'''filename'''</file><br />
<file>gnome-shell.css</file><br />
<file>gnome-shell-high-contrast.css</file><br />
<file>gnome-shell-start.svg</file><br />
<file>no-events.svg</file><br />
<file>no-notifications.svg</file><br />
<file>pad-osd.css</file><br />
<file>process-working.svg</file><br />
<file>toggle-off.svg</file><br />
<file>toggle-off-dark.svg</file><br />
<file>toggle-off-hc.svg</file><br />
<file>toggle-on.svg</file><br />
<file>toggle-on-dark.svg</file><br />
<file>toggle-on-hc.svg</file><br />
<file>workspace-placeholder.svg</file><br />
</gresource><br />
</gresources><br />
}}<br />
<br />
将 '''filename''' 替换为背景图像的文件名,或移除此行后用16位色彩值替代。<br />
<br />
现在,打开 {{ic|gnome-shell.css}} 文件并更改 {{ic|#lockDialogGroup}} 定义如下:<br />
<br />
#lockDialogGroup {<br />
background: #2e3436 url('''filename''');<br />
background-size: '''[WIDTH]'''px '''[HEIGHT]'''px;<br />
background-repeat: no-repeat;<br />
}<br />
<br />
将 {{ic|background-size}} 设置为GDM使用的分辨率, 这可能不一定是图像的分辨率。显示分辨率列表见[[wikipedia:Display_resolution#Computer_monitors|Display resolution]]。同样,将 '''filename''' 替换为背景图像的文件名。<br />
<br />
If you only want to change the background color, adjust the {{ic|#lockDialogGroup}} definition as follows:<br />
<br />
#lockDialogGroup {<br />
background-color: #'''color''';<br />
}<br />
<br />
where '''color''' is the new hex-encoded background color.<br />
<br />
最后,使用以下命令编译主题:<br />
<br />
$ glib-compile-resources gnome-shell-theme.gresource.xml<br />
<br />
然后将生成的 {{ic|gnome-shell-theme.gresource}} 文件复制到 {{ic|/usr/share/gnome-shell}} 目录下。<br />
<br />
然后重启 {{ic|gdm.service}} (注意:重启而不是退出) ,它就会使用您想要的背景图片了。<br />
<br />
更多信息见[https://bbs.archlinux.org/viewtopic.php?id&#61;197036 此贴]。A shell script to automate the above steps is available on [https://github.com/DimaZirix/fedora-gdm-wallpaper DimaZirix's github repository].<br />
<br />
=== dconf配置 ===<br />
<br />
一些 GDM 设置存储在 DConf database中。 可以通过将 ''keyfiles'' 添加到 {{ic|/etc/dconf/db/gdm.d}} 目录,然后以root身份运行 {{ic|dconf update}} 重新编译GDM数据库来配置它们,或者通过登陆系统上的GDM用户并使用"gsettings" 命令直接更改设置。 需要一个 GDM 配置文件 - 这必须手动创建,因为它不再向上游发送,见下文:<br />
<br />
{{hc|/etc/dconf/profile/gdm|<br />
user-db:user<br />
system-db:gdm<br />
file-db:/usr/share/gdm/greeter-dconf-defaults<br />
}}<br />
<br />
For the latter approach, you can log into the GDM user with the command below:<br />
<br />
# machinectl shell gdm@ /bin/bash<br />
<br />
==== 登录页面的logo ====<br />
<br />
创建以下密钥文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/02-logo|2=<br />
[org/gnome/login-screen]<br />
logo='<nowiki/>''/path/to/logo.png''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.login-screen logo '<nowiki/>''/path/to/logo.png''<nowiki/>'<br />
<br />
==== 更改光标主题 ====<br />
<br />
GDM会忽略[[GNOME]]光标主题设置,也忽略根据[[Cursor themes#XDG specification|XDG specification]]设置的光标主题。若要更改GDM使用的光标,请创建以下密钥文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/10-cursor-settings|2=<br />
[org/gnome/desktop/interface]<br />
cursor-theme='<nowiki/>''theme-name''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.interface cursor-theme '<nowiki/>''theme-name''<nowiki/>'<br />
<br />
==== 在登录页面显示大字体 ====<br />
<br />
单击屏幕右上角的辅助功能图标(一个白色圆圈,中间有一个人的轮廓),然后选中 ''大号文本'' 选项。<br />
<br />
要设置特定的缩放比例,可以创建以下密钥文件(以1.25为例):<br />
<br />
{{hc|/etc/dconf/db/gdm.d/03-scaling|2=<br />
[org/gnome/desktop/interface]<br />
text-scaling-factor='<nowiki/>''1.25''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.interface text-scaling-factor '<nowiki/>''1.25''<nowiki/>'<br />
<br />
==== 关闭声音 ====<br />
<br />
此调整禁用在登录屏幕上(通过键盘)调整系统音量时听到的声音反馈。<br />
<br />
创建以下密钥文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/04-sound|2=<br />
[org/gnome/desktop/sound]<br />
event-sounds=false<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.sound event-sounds 'false'<br />
<br />
==== 更改电源按钮行为 ====<br />
<br />
{{Note (简体中文)|1=<nowiki></nowiki><br />
* The [[Power management#ACPI events|logind settings]] for the power button are overriden by GNOME Settings Daemon. [https://bugzilla.gnome.org/show_bug.cgi?id=755953#c4]<br />
* As of GDM 3.18, the power button cannot be set to ''interactive''. [https://bugzilla.gnome.org/show_bug.cgi?id=753713#c6]<br />
* In some cases, this setting will be ignored and hardcoded defaults will be used. [https://bugzilla.gnome.org/show_bug.cgi?id=755953#c17]<br />
}}<br />
<br />
{{Warning (简体中文)|Please note that the [[acpid]] daemon also handles the "power button" and "hibernate button" events. Running both systems at the same time may lead to unexpected behaviour.}}<br />
<br />
Create the following keyfile:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/05-power|2=<br />
[org/gnome/settings-daemon/plugins/power]<br />
power-button-action='<nowiki/>''action''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power power-button-action '<nowiki/>''action''<nowiki/>'<br />
<br />
where ''action'' can be one of {{ic|nothing}}, {{ic|suspend}} or {{ic|hibernate}}.<br />
<br />
==== 开启触摸板轻触以点击 ====<br />
<br />
GDM(和GNOME)中默认关闭轻触以点击,但可以使用dconf设置开启它。<br />
<br />
{{Note (简体中文)|如果想要在X下这么做,必须先正确配置X服务器的访问权限,见[[#配置X服务器的访问权限]]。}}<br />
<br />
若要启用轻触以点击,创建以下key文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/06-tap-to-click|2=<br />
[org/gnome/desktop/peripherals/touchpad]<br />
tap-to-click=true<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click 'true'<br />
<br />
==== 开启或关闭无障碍菜单 ====<br />
<br />
若要禁用或启用无障碍菜单,创建以下key文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/07-accessibility|2=<br />
[org/gnome/desktop/interface]<br />
toolkit-accessibility='<nowiki/>''boolean''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.interface toolkit-accessibility '<nowiki/>''boolean''<nowiki/>'<br />
<br />
当key的值为{{ic|false}}时,无障碍菜单默认关闭;{{ic|true}}则开启。<br />
<br />
==== Enable Night Light on GDM ====<br />
<br />
To enable [[GNOME#Night Light|Night Light]] on GDM, run<br />
<br />
{{bc|$ sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true}}<br />
<br />
=== 键盘布局 ===<br />
<br />
GDM会应用系统键盘布局。见[[Keyboard configuration in Xorg#Using X configuration files]]。<br />
<br />
{{Tip (简体中文)|See [[Wikipedia:ISO 3166-1]] for a list of keymaps.}}<br />
<br />
When using Wayland, you may need to specify the X keyboard layout manually with ''localectl'':<br />
<br />
$ localectl set-x11-keymap ''fr''<br />
<br />
If a system has multiple users, it is possible to specify a keyboard layout for GDM to use which is different from the system keyboard layout. Firstly, ensure the package {{Pkg|gnome-control-center}} is installed. Then start ''gnome-control-center'' and navigate to ''Region & Language > Input Sources''. In the header bar, hit the ''Login Screen'' toggle button and then choose a keyboard layout from the list. Note that the ''Login Screen'' button will not be visible in the header bar unless multiple users are present on the system [https://bugzilla.gnome.org/show_bug.cgi?id=741500].<br />
<br />
GDM 2.x(传统GDM)的用户需要将{{ic|~/.dmrc}}更改为以下内容:<br />
<br />
{{hc|~/.dmrc|2=<br />
[Desktop]<br />
Language=de_DE.UTF-8 # change to your default lang<br />
Layout=de nodeadkeys # change to your keyboard layout<br />
}}<br />
<br />
=== 更改语言 ===<br />
<br />
The system language will be applied to GDM. If a system has multiple users, it is possible to set a language for GDM different to the system language. In this case, firstly ensure that {{Pkg|gnome-control-center}} is installed. Then, start ''gnome-control-center'' and choose ''Region & Language''. In the header bar, check the ''Login Screen'' toggle button. Finally, click on ''Language'' and choose your language from the list. You will be prompted for your root password. Note that the ''Login Screen'' button will not be visible in the header bar unless multiple users are present on the system [https://bugzilla.gnome.org/show_bug.cgi?id=741500].<br />
<br />
{{Tip (简体中文)|By adding 2 different input languages, logging out then selecting your default language GDM will remember your choice once the second option is removed.}}<br />
<br />
=== 用户与登录 ===<br />
<br />
==== 自动登录 ====<br />
<br />
{{Warning (简体中文)|Do not attempt to do this for users managed by [[systemd-homed]]. This is currently [https://github.com/systemd/systemd/issues/20844 not implemented] and will crash GDM.}}<br />
<br />
将以下内容添加至{{ic|/etc/gdm/custom.conf}}以开启自动登陆(将''username''替换为您的用户名):<br />
<br />
{{hc|1=/etc/gdm/custom.conf|<br />
2=# Enable automatic login for user<br />
[daemon]<br />
AutomaticLogin=''username''<br />
AutomaticLoginEnable=True<br />
}}<br />
<br />
{{Tip (简体中文)|If GDM fails after adding these lines, comment them out from a TTY.}}<br />
<br />
or for an automatic login with a delay:<br />
<br />
{{hc|1=/etc/gdm/custom.conf|<br />
2=[daemon]<br />
TimedLoginEnable=true<br />
TimedLogin=''username''<br />
TimedLoginDelay=1<br />
}}<br />
<br />
You can set the session used for automatic login (replace {{ic|gnome-xorg}} with desired session):<br />
<br />
{{hc|1=/var/lib/AccountsService/users/''username''|<br />
2=XSession=gnome-xorg<br />
}}<br />
<br />
==== 免密登录 ====<br />
<br />
If you want to bypass the password prompt in GDM then simply add the following line on the first line of {{ic|/etc/pam.d/gdm-password}}:<br />
<br />
auth sufficient pam_succeed_if.so user ingroup nopasswdlogin<br />
<br />
Then, add the group {{ic|nopasswdlogin}} to your system. See [[User group]] for group descriptions and group management commands.<br />
<br />
Now, add your user to the {{ic|nopasswdlogin}} group and you will only have to click on your username to login.<br />
<br />
{{Warning (简体中文)|<br />
* '''不要'''对'''root'''账户这么做。<br />
* You will not be able to change your session type at login with GDM anymore. If you want to change your default session type, you will first need to remove your user from the {{ic|nopasswdlogin}} group.<br />
}}<br />
<br />
==== Passwordless shutdown for multiple sessions ====<br />
<br />
GDM uses polkit and logind to gain permissions for shutdown. You can shutdown the system when multiple users are logged in by setting:<br />
<br />
{{hc|1=/etc/polkit-1/localauthority.conf.d/org.freedesktop.logind.policy|2=<nowiki><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE policyconfig PUBLIC<br />
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"<br />
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"><br />
<br />
<!-- <br />
Policy definitions for logind<br />
--><br />
<br />
<policyconfig><br />
<br />
<action id="org.freedesktop.login1.power-off-multiple-sessions"><br />
<description>Shutdown the system when multiple users are logged in</description><br />
<message>System policy prevents shutting down the system when other users are logged in</message><br />
<defaults><br />
<allow_inactive>yes</allow_inactive><br />
<allow_active>yes</allow_active><br />
</defaults><br />
</action><br />
<br />
</policyconfig><br />
</nowiki>}}<br />
<br />
You can find all available logind options (e.g. reboot-multiple-sessions) in {{man|5|org.freedesktop.login1}}.<br />
<br />
==== 在GDM中开启root登录 ====<br />
<br />
It is not advised to login as root, but if necessary you can edit {{ic|/etc/pam.d/gdm-password}} and add the following line before the line {{ic|auth required pam_deny.so}}:<br />
<br />
{{hc|/etc/pam.d/gdm-password|<br />
auth sufficient pam_succeed_if.so uid eq 0 quiet<br />
}}<br />
<br />
The file should look something like this:<br />
<br />
{{hc|/etc/pam.d/gdm-password|2=<br />
...<br />
auth sufficient pam_succeed_if.so uid eq 0 quiet<br />
auth sufficient pam_succeed_if.so uid >= 1000 quiet<br />
auth required pam_deny.so<br />
...<br />
}}<br />
<br />
You should be able to login as root after restarting GDM.<br />
<br />
==== 在登录列表中隐藏用户 ====<br />
<br />
The users for the gdm user list are gathered by [https://www.freedesktop.org/wiki/Software/AccountsService/ AccountsService]. It will automatically hide system users (UID < 1000). To hide ordinary users from the login list create or edit a file named after the user to hide in {{ic|/var/lib/AccountsService/users/}} to contain at least:<br />
<br />
{{hc|/var/lib/AccountsService/users/''username''|2=<br />
[User]<br />
SystemAccount=true<br />
}}<br />
<br />
=== 设置默认显示器 ===<br />
<br />
一些[[Desktop environment (简体中文)|桌面环境]]将显示设置保存在 {{ic|~/.config/monitors.xml}}。''xrandr'' 命令基于该文件内容生成信息。在GDM中类似内容保存在{{ic|/var/lib/gdm/.config/monitors.xml}}。 <br />
<br />
若有显示器设置(例如朝向,缩放,主屏幕等等)信息记录于{{ic|~/.config/monitors.xml}}中,并且想要让这些设置用于GDM:<br />
<br />
# cp ~/.config/monitors.xml /var/lib/gdm/.config/<br />
# chown gdm:gdm /var/lib/gdm/.config/monitors.xml<br />
<br />
{{ic|monitors.xml}}文件中屏幕旋转和缩放的部分内容如下:<br />
<br />
<monitors version="2"><br />
<configuration><br />
<logicalmonitor><br />
...<br />
<scale>2</scale><br />
...<br />
<transform><br />
<rotation>right</rotation><br />
<flipped>no</flipped><br />
</transform><br />
...<br />
</logicalmonitor><br />
</configuration><br />
</monitors><br />
<br />
必须登出才能使更改生效,因为GDM不遵守{{ic|xorg.conf}}。<br />
<br />
{{Note (简体中文)|<br />
* 如果在Wayland下使用GDM,则必须使用在Wayland下创建的{{ic|monitors.xml}}。详见[https://gitlab.gnome.org/GNOME/gdm/issues/224 GDM bug 224]。也可以强制让GDM [[#使用Xorg作为后端]],并使用在Xorg下创建的{{ic|monitors.xml}}。}}<br />
* If you use [[HiDPI#Fractional_scaling|fractional scaling]], you need to enable it for user {{ic|gdm}}.<br />
}}<br />
<br />
=== 配置X服务器的访问权限 ===<br />
<br />
You can use the {{ic|xhost}} command to configure X server access permissions.<br />
<br />
For instance, to grant GDM the right to access the X server, use the following command:<br />
<br />
{{bc|# xhost +SI:localuser:gdm}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== Wayland与NVIDIA专有驱动 ===<br />
<br />
To use Wayland in GDM with the [[NVIDIA]] driver, you must first enable [[NVIDIA#DRM kernel mode setting]].<br />
<br />
As of GDM 42 and NVIDIA driver 510, GDM defaults to Wayland. For older NVIDIA drivers (in between version 470 and 510), GDM has chipset-dependent [https://gitlab.gnome.org/GNOME/gdm/-/blob/main/data/61-gdm.rules.in udev rules] to use Xorg rather than Wayland. To force-enable Wayland, override these rules by creating the following symlink:<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/61-gdm.rules<br />
<br />
{{Note|This command works because rules in {{ic|/etc/udev/rules.d/}} override those in {{ic|/usr/lib/udev/rules.d/}} (see [[udev#About udev rules]]). It is also advised to modify files in {{ic|/etc/}} rather than in {{ic|/usr/}} as those are managed by [[pacman]].}}<br />
<br />
If, instead of GDM, a black screen appears, try disabling integrated graphics in your computer's BIOS settings.<br />
<br />
=== 注销失败 ===<br />
<br />
If GDM starts up properly on boot, but fails after repeated attempts on logout, try adding this line to the daemon section of {{ic|/etc/gdm/custom.conf}}:<br />
<br />
GdmXserverTimeout=60<br />
<br />
=== Rootless Xorg ===<br />
<br />
见[[Xorg#Rootless Xorg]]。<br />
<br />
=== 使用Xorg后端 ===<br />
<br />
The [[Wayland]] backend is used by default, and the [[Xorg]] backend is used only if the Wayland backend cannot be started. You may wish to use the Xorg backend instead if, for example:<br />
<br />
* GDM [https://bbs.archlinux.org/viewtopic.php?pid=1869534#p1869534 crashes]<br />
<br />
To use the Xorg backend by default, uncomment the following line in {{ic|/etc/gdm/custom.conf}}:<br />
<br />
#WaylandEnable=false<br />
<br />
=== GDM does not start until input is provided ===<br />
<br />
If, after booting, the screen stays black and GDM does not start until the mouse is moved or something is typed on the keyboard, it may be due to a lack of entropy required for random number generation. To confirm, check that the following line appears inside ''systemd-random-seed''’s log (which can be read by running {{ic|journalctl --unit systemd-random-seed}} with root privileges):<br />
<br />
Kernel entropy pool is not initialized yet, waiting until it is.<br />
<br />
To fix this, you can pass the {{ic|<nowiki>random.trust_cpu=on</nowiki>}} [[kernel parameter]] if your CPU supports the ''RDRAND'' instruction, or you can use [[haveged]] which also provides entropy, albeit it is of allegedly low quality. See [[debian:BoottimeEntropyStarvation|Debian’s article on the topic]] for other solutions.<br />
<br />
=== Incomplete removal of gdm ===<br />
<br />
After removing {{Pkg|gdm}}, [[systemd]] may report the following:<br />
<br />
user 'gdm': directory '/var/lib/gdm' does not exist<br />
<br />
To remove this warning, login as root and [[Users and groups#Other examples of user management|delete the primary user]] {{ic|gdm}} and then [[Users and groups#Group management|delete the group]] {{ic|gdm}}:<br />
<br />
Verify that {{ic|gdm}} is successfully removed via {{ic|pwck}} and {{ic|grpck}} with root privileges. To round it off, you may want to double-check no [[Pacman/Tips and tricks#Identify files not owned by any package|unowned files]] for ''gdm'' remain.<br />
<br />
=== GDM自动挂起(GNOME 3.28) ===<br />
<br />
GDM uses a separate dconf database to control power management. To apply your user's power settings, copy them to GDM's dconf database:<br />
<br />
$ IFS=$'\n'; for x in $(sudo -u ''username'' gsettings list-recursively org.gnome.settings-daemon.plugins.power); do eval "sudo -u gdm dbus-launch gsettings set $x"; done; unset IFS<br />
<br />
where {{ic|''username''}} is your username.<br />
<br />
To only disable auto-suspend on AC, run:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'<br />
<br />
(To also disable auto-suspend on battery, run the command with {{ic|battery}} instead of {{ic|ac}}.)<br />
<br />
Restart GDM to activate your changes.<br />
<br />
=== GDM ignores Wayland and uses X.Org by default ===<br />
<br />
Wayland requires Kernel Mode Setting (KMS) running in order to work, and on some machines the GDM process start earlier than KMS, resulting in GDM unable to see Wayland and working only with X.Org. This might result in messages like the following showing up in your log:<br />
<br />
gnome-shell[569]: Failed to open gpu '/dev/dri/card0': GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Operation not permitted<br />
gnome-shell[569]: Failed to create backend: No GPUs found<br />
systemd[505]: org.gnome.Shell@wayland.service: Failed with result 'protocol'.<br />
systemd[505]: Failed to start GNOME Shell on Wayland.<br />
<br />
Alternatively, the same issue may lead to GDM not appearing or monitor only displaying the TTY output.<br />
<br />
You can solve this problem by [[Kernel mode setting#Early KMS start|starting KMS earlier]].<br />
<br />
Also, if you use a [[NVIDIA]] driver, the Wayland session might be blocked by a [[udev]] rule (see the notes under [[GNOME#Wayland sessions]]). This might result in messages like the following:<br />
<br />
systemd[1022]: Condition check resulted in GNOME Shell on Wayland being skipped.<br />
systemd[1022]: org.gnome.Shell@wayland.service: Skipped due to 'exec-condition'.<br />
systemd[1022]: org.gnome.Shell@wayland.service: Control process exited, code=exited, status=2/INVALIDARGUMENT<br />
<br />
See [[#Wayland and the proprietary NVIDIA driver]] for a workaround.<br />
<br />
=== Black screen on AMD or Intel GPUs when an NVidia (e)GPU is present ===<br />
<br />
At first, without an NVidia device, GDM starts and works normally on Wayland, but stops working once an NVidia eGPU is plugged in (or the {{ic|nvidia}} module is loaded for other reasons). A typical symptom of the problem is a black screen with a blinking cursor upon logouts and GDM restarts and the following message in GDM's logs (accessed by running {{ic|journalctl -u gdm -b}} as root):<br />
<br />
Gdm: Child process -<some PID> was already dead.<br />
<br />
The solution is the same as [[#GDM ignores Wayland and uses X.Org by default|above]]: Prevent {{ic|/usr/lib/gdm-disable-wayland}} from running upon {{ic|nvidia}} module loading.<br />
<br />
Notice that GDM on Wayland will no longer work once {{ic|/usr/lib/gdm-disable-wayland}} has run. This is because {{ic|1=WaylandEnable=false}} has been written into {{ic|/run/gdm/custom.conf}}, which overrides {{ic|/etc/gdm/custom.conf}}. To fix the situation without a reboot, remove {{ic|/run/gdm/custom.conf}} and then restart GDM.<br />
<br />
=== GDM cannot be enabled ===<br />
<br />
See [[systemd/FAQ#Failure to enable unit due to preexisting symlink]].<br />
<br />
== 另见 ==<br />
<br />
* [https://help.gnome.org/admin/gdm/stable/index.html.en GDM Reference Manual]</div>Fincehttps://wiki.archlinux.org/index.php?title=GDM_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726975GDM (简体中文)2022-04-19T13:29:28Z<p>Fince: update translation</p>
<hr />
<div>[[Category:GNOME (简体中文)]]<br />
[[Category:Boot process (简体中文)]]<br />
[[Category:Display managers (简体中文)]]<br />
[[de:Login-Manager#GDM]]<br />
[[en:GDM]]<br />
[[fr:GDM]]<br />
[[ja:GDM]]<br />
[[pt:GDM]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|GNOME (简体中文)}}<br />
{{Related|GNOME Flashback}}<br />
{{Related|Display_manager_(简体中文)}}<br />
{{Related|LightDM_(简体中文)}}<br />
{{Related|LXDM_(简体中文)}}<br />
{{Related articles end}}<br />
<br />
{{Translateme (简体中文)|文章部分内容没有翻译。}}<br />
<br />
{{TranslationStatus (简体中文)|GDM|2022-04-19|726892}}<br />
<br />
来自[https://wiki.gnome.org/Projects/GDM GDM - GNOME显示管理器]:“GNOME显示管理器(GDM)是一个管理图形显示服务并处理图形用户登录的程序。<br />
<br />
[[Display_manager_(简体中文)|显示管理器]]为[[Xorg_(简体中文)|X Window System]]和[[Wayland_(简体中文)|Wayland]]提供图形登录提示。<br />
<br />
== 安装 ==<br />
<br />
可通过安装{{Pkg|gdm}}包来安装GDM,或作为{{grp|gnome}}组的一部分安装。<br />
<br />
== 启动 ==<br />
<br />
若要开机启动GDM,[[enable|启用]]{{ic|gdm.service}}。<br />
<br />
=== 自动启动应用 ===<br />
<br />
To automatically start applications after logging in, follow the instructions in [[Autostarting#On desktop environment startup]] that pertain to your desktop environment.<br />
<br />
== 配置 ==<br />
<br />
=== 登录页面背景图片 ===<br />
<br />
{{Accuracy|Configuration is not persistent and changes will be undone after an update of GNOME Shell. Suggestion: Rewrite to use the "User Themes" Gnome extension.}}<br />
<br />
{{Note (简体中文)|<br />
* 自GNOME 3.16开始,GNOME Shell主题被存储为二进制文件(gresource)。<br />
* This change will be overwritten on subsequent updates of {{Pkg|gnome-shell}}.<br />
}}<br />
<br />
首先,您需要将现有的 GNOME Shell 主题解压到您的主目录中的一个文件夹中。 您可以使用以下脚本执行此操作:<br />
<br />
{{hc|extractgst.sh|2=<br />
#!/bin/sh<br />
gst=/usr/share/gnome-shell/gnome-shell-theme.gresource<br />
workdir=${HOME}/shell-theme<br />
<br />
for r in `gresource list $gst`; do<br />
r=${r#\/org\/gnome\/shell/}<br />
if [ ! -d $workdir/${r%/*} ]; then<br />
mkdir -p $workdir/${r%/*}<br />
fi<br />
done<br />
<br />
for r in `gresource list $gst`; do<br />
gresource extract $gst $r >$workdir/${r#\/org\/gnome\/shell/}<br />
done<br />
}}<br />
<br />
主题文件应当已提取到创建的目录中。现在将您想要的背景图像复制到此目录。<br />
<br />
接下来,您需要在目录中创建一个文件,内容如下:<br />
<br />
{{hc|1=gnome-shell-theme.gresource.xml|2=<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<gresources><br />
<gresource prefix="/org/gnome/shell/theme"><br />
<file alias="icons/scalable/actions/color-pick.svg">color-pick.svg</file><br />
<file alias="icons/scalable/actions/pointer-double-click-symbolic.svg">pointer-double-click-symbolic.svg</file><br />
<file alias="icons/scalable/actions/pointer-drag-symbolic.svg">pointer-drag-symbolic.svg</file><br />
<file alias="icons/scalable/actions/pointer-primary-click-symbolic.svg">pointer-primary-click-symbolic.svg</file><br />
<file alias="icons/scalable/actions/pointer-secondary-click-symbolic.svg">pointer-secondary-click-symbolic.svg</file><br />
<file alias="icons/scalable/actions/preview-close-symbolic.svg">window-close-24-symbolic.svg</file><br />
<file alias="icons/scalable/status/carousel-arrow-next-24-symbolic.svg">carousel-arrow-next-24-symbolic.svg</file><br />
<file alias="icons/scalable/status/carousel-arrow-back-24-symbolic.svg">carousel-arrow-back-24-symbolic.svg</file><br />
<file alias="icons/scalable/status/eye-open-negative-filled-symbolic.svg">eye-open-negative-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/eye-not-looking-symbolic.svg">eye-not-looking-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-caps-lock-filled-symbolic.svg">keyboard-caps-lock-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-enter-symbolic.svg">keyboard-enter-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-hide-symbolic.svg">keyboard-hide-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-layout-filled-symbolic.svg">keyboard-layout-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/keyboard-shift-filled-symbolic.svg">keyboard-shift-filled-symbolic.svg</file><br />
<file alias="icons/scalable/status/message-indicator-symbolic.svg">message-indicator-symbolic.svg</file><br />
<file>calendar-today.svg</file><br />
<file>checkbox-focused.svg</file><br />
<file>checkbox-off-focused.svg</file><br />
<file>checkbox-off.svg</file><br />
<file>checkbox.svg</file><br />
<file>'''filename'''</file><br />
<file>gnome-shell.css</file><br />
<file>gnome-shell-high-contrast.css</file><br />
<file>gnome-shell-start.svg</file><br />
<file>no-events.svg</file><br />
<file>no-notifications.svg</file><br />
<file>pad-osd.css</file><br />
<file>process-working.svg</file><br />
<file>toggle-off.svg</file><br />
<file>toggle-off-dark.svg</file><br />
<file>toggle-off-hc.svg</file><br />
<file>toggle-on.svg</file><br />
<file>toggle-on-dark.svg</file><br />
<file>toggle-on-hc.svg</file><br />
<file>workspace-placeholder.svg</file><br />
</gresource><br />
</gresources><br />
}}<br />
<br />
将 '''filename''' 替换为背景图像的文件名,或移除此行后用16位色彩值替代。<br />
<br />
现在,打开 {{ic|gnome-shell.css}} 文件并更改 {{ic|#lockDialogGroup}} 定义如下:<br />
<br />
#lockDialogGroup {<br />
background: #2e3436 url('''filename''');<br />
background-size: '''[WIDTH]'''px '''[HEIGHT]'''px;<br />
background-repeat: no-repeat;<br />
}<br />
<br />
将 {{ic|background-size}} 设置为GDM使用的分辨率, 这可能不一定是图像的分辨率。显示分辨率列表见[[wikipedia:Display_resolution#Computer_monitors|Display resolution]]。同样,将 '''filename''' 替换为背景图像的文件名。<br />
<br />
If you only want to change the background color, adjust the {{ic|#lockDialogGroup}} definition as follows:<br />
<br />
#lockDialogGroup {<br />
background-color: #'''color''';<br />
}<br />
<br />
where '''color''' is the new hex-encoded background color.<br />
<br />
最后,使用以下命令编译主题:<br />
<br />
$ glib-compile-resources gnome-shell-theme.gresource.xml<br />
<br />
然后将生成的 {{ic|gnome-shell-theme.gresource}} 文件复制到 {{ic|/usr/share/gnome-shell}} 目录下。<br />
<br />
然后重启 {{ic|gdm.service}} (注意:重启而不是退出) ,它就会使用您想要的背景图片了。<br />
<br />
更多信息见[https://bbs.archlinux.org/viewtopic.php?id&#61;197036 此贴]。A shell script to automate the above steps is available on [https://github.com/DimaZirix/fedora-gdm-wallpaper DimaZirix's github repository].<br />
<br />
=== dconf配置 ===<br />
<br />
一些 GDM 设置存储在 DConf database中。 可以通过将 ''keyfiles'' 添加到 {{ic|/etc/dconf/db/gdm.d}} 目录,然后以root身份运行 {{ic|dconf update}} 重新编译GDM数据库来配置它们,或者通过登陆系统上的GDM用户并使用"gsettings" 命令直接更改设置。 需要一个 GDM 配置文件 - 这必须手动创建,因为它不再向上游发送,见下文:<br />
<br />
{{hc|/etc/dconf/profile/gdm|<br />
user-db:user<br />
system-db:gdm<br />
file-db:/usr/share/gdm/greeter-dconf-defaults<br />
}}<br />
<br />
For the latter approach, you can log into the GDM user with the command below:<br />
<br />
# machinectl shell gdm@ /bin/bash<br />
<br />
==== 登录页面的logo ====<br />
<br />
创建以下密钥文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/02-logo|2=<br />
[org/gnome/login-screen]<br />
logo='<nowiki/>''/path/to/logo.png''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.login-screen logo '<nowiki/>''/path/to/logo.png''<nowiki/>'<br />
<br />
==== 更改光标主题 ====<br />
<br />
GDM会忽略[[GNOME]]光标主题设置,也忽略根据[[Cursor themes#XDG specification|XDG specification]]设置的光标主题。若要更改GDM使用的光标,请创建以下密钥文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/10-cursor-settings|2=<br />
[org/gnome/desktop/interface]<br />
cursor-theme='<nowiki/>''theme-name''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.interface cursor-theme '<nowiki/>''theme-name''<nowiki/>'<br />
<br />
==== 在登录页面显示大字体 ====<br />
<br />
单击屏幕右上角的辅助功能图标(一个白色圆圈,中间有一个人的轮廓),然后选中 ''大号文本'' 选项。<br />
<br />
要设置特定的缩放比例,可以创建以下密钥文件(以1.25为例):<br />
<br />
{{hc|/etc/dconf/db/gdm.d/03-scaling|2=<br />
[org/gnome/desktop/interface]<br />
text-scaling-factor='<nowiki/>''1.25''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.interface text-scaling-factor '<nowiki/>''1.25''<nowiki/>'<br />
<br />
==== 关闭声音 ====<br />
<br />
此调整禁用在登录屏幕上(通过键盘)调整系统音量时听到的声音反馈。<br />
<br />
创建以下密钥文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/04-sound|2=<br />
[org/gnome/desktop/sound]<br />
event-sounds=false<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.sound event-sounds 'false'<br />
<br />
==== 更改电源按钮行为 ====<br />
<br />
{{Note (简体中文)|1=<nowiki></nowiki><br />
* The [[Power management#ACPI events|logind settings]] for the power button are overriden by GNOME Settings Daemon. [https://bugzilla.gnome.org/show_bug.cgi?id=755953#c4]<br />
* As of GDM 3.18, the power button cannot be set to ''interactive''. [https://bugzilla.gnome.org/show_bug.cgi?id=753713#c6]<br />
* In some cases, this setting will be ignored and hardcoded defaults will be used. [https://bugzilla.gnome.org/show_bug.cgi?id=755953#c17]<br />
}}<br />
<br />
{{Warning (简体中文)|Please note that the [[acpid]] daemon also handles the "power button" and "hibernate button" events. Running both systems at the same time may lead to unexpected behaviour.}}<br />
<br />
Create the following keyfile:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/05-power|2=<br />
[org/gnome/settings-daemon/plugins/power]<br />
power-button-action='<nowiki/>''action''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power power-button-action '<nowiki/>''action''<nowiki/>'<br />
<br />
where ''action'' can be one of {{ic|nothing}}, {{ic|suspend}} or {{ic|hibernate}}.<br />
<br />
==== 开启触摸板轻触以点击 ====<br />
<br />
GDM(和GNOME)中默认关闭轻触以点击,但可以使用dconf设置开启它。<br />
<br />
{{Note (简体中文)|如果想要在X下这么做,必须先正确配置X服务器的访问权限,见[[#配置X服务器的访问权限]]。}}<br />
<br />
若要启用轻触以点击,创建以下key文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/06-tap-to-click|2=<br />
[org/gnome/desktop/peripherals/touchpad]<br />
tap-to-click=true<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.peripherals.touchpad tap-to-click 'true'<br />
<br />
==== 开启或关闭无障碍菜单 ====<br />
<br />
若要禁用或启用无障碍菜单,创建以下key文件:<br />
<br />
{{hc|/etc/dconf/db/gdm.d/07-accessibility|2=<br />
[org/gnome/desktop/interface]<br />
toolkit-accessibility='<nowiki/>''boolean''<nowiki/>'<br />
}}<br />
<br />
然后重新编译GDM database,或登录GDM用户并执行以下操作:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.desktop.interface toolkit-accessibility '<nowiki/>''boolean''<nowiki/>'<br />
<br />
当key的值为{{ic|false}}时,无障碍菜单默认关闭;{{ic|true}}则开启。<br />
<br />
==== Enable Night Light on GDM ====<br />
<br />
To enable [[GNOME#Night Light|Night Light]] on GDM, run<br />
<br />
{{bc|$ sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.color night-light-enabled true}}<br />
<br />
=== 键盘布局 ===<br />
<br />
GDM会应用系统键盘布局。见[[Keyboard configuration in Xorg#Using X configuration files]]。<br />
<br />
{{Tip (简体中文)|See [[Wikipedia:ISO 3166-1]] for a list of keymaps.}}<br />
<br />
When using Wayland, you may need to specify the X keyboard layout manually with ''localectl'':<br />
<br />
$ localectl set-x11-keymap ''fr''<br />
<br />
If a system has multiple users, it is possible to specify a keyboard layout for GDM to use which is different from the system keyboard layout. Firstly, ensure the package {{Pkg|gnome-control-center}} is installed. Then start ''gnome-control-center'' and navigate to ''Region & Language > Input Sources''. In the header bar, hit the ''Login Screen'' toggle button and then choose a keyboard layout from the list. Note that the ''Login Screen'' button will not be visible in the header bar unless multiple users are present on the system [https://bugzilla.gnome.org/show_bug.cgi?id=741500].<br />
<br />
GDM 2.x(传统GDM)的用户需要将{{ic|~/.dmrc}}更改为以下内容:<br />
<br />
{{hc|~/.dmrc|2=<br />
[Desktop]<br />
Language=de_DE.UTF-8 # change to your default lang<br />
Layout=de nodeadkeys # change to your keyboard layout<br />
}}<br />
<br />
=== 更改语言 ===<br />
<br />
The system language will be applied to GDM. If a system has multiple users, it is possible to set a language for GDM different to the system language. In this case, firstly ensure that {{Pkg|gnome-control-center}} is installed. Then, start ''gnome-control-center'' and choose ''Region & Language''. In the header bar, check the ''Login Screen'' toggle button. Finally, click on ''Language'' and choose your language from the list. You will be prompted for your root password. Note that the ''Login Screen'' button will not be visible in the header bar unless multiple users are present on the system [https://bugzilla.gnome.org/show_bug.cgi?id=741500].<br />
<br />
{{Tip (简体中文)|By adding 2 different input languages, logging out then selecting your default language GDM will remember your choice once the second option is removed.}}<br />
<br />
=== 用户与登录 ===<br />
<br />
==== 自动登录 ====<br />
<br />
{{Warning (简体中文)|Do not attempt to do this for users managed by [[systemd-homed]]. This is currently [https://github.com/systemd/systemd/issues/20844 not implemented] and will crash GDM.}}<br />
<br />
将以下内容添加至{{ic|/etc/gdm/custom.conf}}以开启自动登陆(将''username''替换为您的用户名):<br />
<br />
{{hc|1=/etc/gdm/custom.conf|<br />
2=# Enable automatic login for user<br />
[daemon]<br />
AutomaticLogin=''username''<br />
AutomaticLoginEnable=True<br />
}}<br />
<br />
{{Tip (简体中文)|If GDM fails after adding these lines, comment them out from a TTY.}}<br />
<br />
or for an automatic login with a delay:<br />
<br />
{{hc|1=/etc/gdm/custom.conf|<br />
2=[daemon]<br />
TimedLoginEnable=true<br />
TimedLogin=''username''<br />
TimedLoginDelay=1<br />
}}<br />
<br />
You can set the session used for automatic login (replace {{ic|gnome-xorg}} with desired session):<br />
<br />
{{hc|1=/var/lib/AccountsService/users/''username''|<br />
2=XSession=gnome-xorg<br />
}}<br />
<br />
==== 免密登录 ====<br />
<br />
If you want to bypass the password prompt in GDM then simply add the following line on the first line of {{ic|/etc/pam.d/gdm-password}}:<br />
<br />
auth sufficient pam_succeed_if.so user ingroup nopasswdlogin<br />
<br />
Then, add the group {{ic|nopasswdlogin}} to your system. See [[User group]] for group descriptions and group management commands.<br />
<br />
Now, add your user to the {{ic|nopasswdlogin}} group and you will only have to click on your username to login.<br />
<br />
{{Warning (简体中文)|<br />
* '''不要'''对'''root'''账户这么做。<br />
* You will not be able to change your session type at login with GDM anymore. If you want to change your default session type, you will first need to remove your user from the {{ic|nopasswdlogin}} group.<br />
}}<br />
<br />
==== Passwordless shutdown for multiple sessions ====<br />
<br />
GDM uses polkit and logind to gain permissions for shutdown. You can shutdown the system when multiple users are logged in by setting:<br />
<br />
{{hc|1=/etc/polkit-1/localauthority.conf.d/org.freedesktop.logind.policy|2=<nowiki><br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE policyconfig PUBLIC<br />
"-//freedesktop//DTD PolicyKit Policy Configuration 1.0//EN"<br />
"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd"><br />
<br />
<!-- <br />
Policy definitions for logind<br />
--><br />
<br />
<policyconfig><br />
<br />
<action id="org.freedesktop.login1.power-off-multiple-sessions"><br />
<description>Shutdown the system when multiple users are logged in</description><br />
<message>System policy prevents shutting down the system when other users are logged in</message><br />
<defaults><br />
<allow_inactive>yes</allow_inactive><br />
<allow_active>yes</allow_active><br />
</defaults><br />
</action><br />
<br />
</policyconfig><br />
</nowiki>}}<br />
<br />
You can find all available logind options (e.g. reboot-multiple-sessions) in {{man|5|org.freedesktop.login1}}.<br />
<br />
==== 在GDM中开启root登录 ====<br />
<br />
It is not advised to login as root, but if necessary you can edit {{ic|/etc/pam.d/gdm-password}} and add the following line before the line {{ic|auth required pam_deny.so}}:<br />
<br />
{{hc|/etc/pam.d/gdm-password|<br />
auth sufficient pam_succeed_if.so uid eq 0 quiet<br />
}}<br />
<br />
The file should look something like this:<br />
<br />
{{hc|/etc/pam.d/gdm-password|2=<br />
...<br />
auth sufficient pam_succeed_if.so uid eq 0 quiet<br />
auth sufficient pam_succeed_if.so uid >= 1000 quiet<br />
auth required pam_deny.so<br />
...<br />
}}<br />
<br />
You should be able to login as root after restarting GDM.<br />
<br />
==== 在登录列表中隐藏用户 ====<br />
<br />
The users for the gdm user list are gathered by [https://www.freedesktop.org/wiki/Software/AccountsService/ AccountsService]. It will automatically hide system users (UID < 1000). To hide ordinary users from the login list create or edit a file named after the user to hide in {{ic|/var/lib/AccountsService/users/}} to contain at least:<br />
<br />
{{hc|/var/lib/AccountsService/users/''username''|2=<br />
[User]<br />
SystemAccount=true<br />
}}<br />
<br />
=== 设置默认显示器 ===<br />
<br />
一些[[Desktop environment (简体中文)|桌面环境]]将显示设置保存在 {{ic|~/.config/monitors.xml}}。''xrandr'' 命令基于该文件内容生成信息。在GDM中类似内容保存在{{ic|/var/lib/gdm/.config/monitors.xml}}。 <br />
<br />
若有显示器设置(例如朝向,缩放,主屏幕等等)信息记录于{{ic|~/.config/monitors.xml}}中,并且想要让这些设置用于GDM:<br />
<br />
# cp ~/.config/monitors.xml /var/lib/gdm/.config/<br />
# chown gdm:gdm /var/lib/gdm/.config/monitors.xml<br />
<br />
{{ic|monitors.xml}}文件中屏幕旋转和缩放的部分内容如下:<br />
<br />
<monitors version="2"><br />
<configuration><br />
<logicalmonitor><br />
...<br />
<scale>2</scale><br />
...<br />
<transform><br />
<rotation>right</rotation><br />
<flipped>no</flipped><br />
</transform><br />
...<br />
</logicalmonitor><br />
</configuration><br />
</monitors><br />
<br />
必须登出才能使更改生效,因为GDM不遵守{{ic|xorg.conf}}。<br />
<br />
{{Note (简体中文)|<br />
* 如果在Wayland下使用GDM,则必须使用在Wayland下创建的{{ic|monitors.xml}}。详见[https://gitlab.gnome.org/GNOME/gdm/issues/224 GDM bug 224]。也可以强制让GDM [[#使用Xorg作为后端]],并使用在Xorg下创建的{{ic|monitors.xml}}。}}<br />
* If you use [[HiDPI#Fractional_scaling|fractional scaling]], you need to enable it for user {{ic|gdm}}.<br />
}}<br />
<br />
=== 配置X服务器的访问权限 ===<br />
<br />
You can use the {{ic|xhost}} command to configure X server access permissions.<br />
<br />
For instance, to grant GDM the right to access the X server, use the following command:<br />
<br />
{{bc|# xhost +SI:localuser:gdm}}<br />
<br />
== 疑难解答 ==<br />
<br />
=== Wayland与NVIDIA专有驱动 ===<br />
<br />
To use Wayland in GDM with the [[NVIDIA]] driver, you must first enable [[NVIDIA#DRM kernel mode setting]].<br />
<br />
As of GDM 42 and NVIDIA driver 510, GDM defaults to Wayland. For older NVIDIA drivers (in between version 470 and 510), GDM has chipset-dependent [https://gitlab.gnome.org/GNOME/gdm/-/blob/main/data/61-gdm.rules.in udev rules] to use Xorg rather than Wayland. To force-enable Wayland, override these rules by creating the following symlink:<br />
<br />
# ln -s /dev/null /etc/udev/rules.d/61-gdm.rules<br />
<br />
{{Note|This command works because rules in {{ic|/etc/udev/rules.d/}} override those in {{ic|/usr/lib/udev/rules.d/}} (see [[udev#About udev rules]]). It is also advised to modify files in {{ic|/etc/}} rather than in {{ic|/usr/}} as those are managed by [[pacman]].}}<br />
<br />
If, instead of GDM, a black screen appears, try disabling integrated graphics in your computer's BIOS settings.<br />
<br />
=== 注销失败 ===<br />
<br />
If GDM starts up properly on boot, but fails after repeated attempts on logout, try adding this line to the daemon section of {{ic|/etc/gdm/custom.conf}}:<br />
<br />
GdmXserverTimeout=60<br />
<br />
=== Rootless Xorg ===<br />
<br />
见[[Xorg#Rootless Xorg]]。<br />
<br />
=== 使用Xorg后端 ===<br />
<br />
The [[Wayland]] backend is used by default, and the [[Xorg]] backend is used only if the Wayland backend cannot be started. You may wish to use the Xorg backend instead if, for example:<br />
<br />
* GDM [https://bbs.archlinux.org/viewtopic.php?pid=1869534#p1869534 crashes]<br />
<br />
To use the Xorg backend by default, uncomment the following line in {{ic|/etc/gdm/custom.conf}}:<br />
<br />
#WaylandEnable=false<br />
<br />
=== GDM does not start until input is provided ===<br />
<br />
If, after booting, the screen stays black and GDM does not start until the mouse is moved or something is typed on the keyboard, it may be due to a lack of entropy required for random number generation. To confirm, check that the following line appears inside ''systemd-random-seed''’s log (which can be read by running {{ic|journalctl --unit systemd-random-seed}} with root privileges):<br />
<br />
Kernel entropy pool is not initialized yet, waiting until it is.<br />
<br />
To fix this, you can pass the {{ic|<nowiki>random.trust_cpu=on</nowiki>}} [[kernel parameter]] if your CPU supports the ''RDRAND'' instruction, or you can use [[haveged]] which also provides entropy, albeit it is of allegedly low quality. See [[debian:BoottimeEntropyStarvation|Debian’s article on the topic]] for other solutions.<br />
<br />
=== Incomplete removal of gdm ===<br />
<br />
After removing {{Pkg|gdm}}, [[systemd]] may report the following:<br />
<br />
user 'gdm': directory '/var/lib/gdm' does not exist<br />
<br />
To remove this warning, login as root and [[Users and groups#Other examples of user management|delete the primary user]] {{ic|gdm}} and then [[Users and groups#Group management|delete the group]] {{ic|gdm}}:<br />
<br />
Verify that {{ic|gdm}} is successfully removed via {{ic|pwck}} and {{ic|grpck}} with root privileges. To round it off, you may want to double-check no [[Pacman/Tips and tricks#Identify files not owned by any package|unowned files]] for ''gdm'' remain.<br />
<br />
=== GDM自动挂起(GNOME 3.28) ===<br />
<br />
GDM uses a separate dconf database to control power management. To apply your user's power settings, copy them to GDM's dconf database:<br />
<br />
$ IFS=$'\n'; for x in $(sudo -u ''username'' gsettings list-recursively org.gnome.settings-daemon.plugins.power); do eval "sudo -u gdm dbus-launch gsettings set $x"; done; unset IFS<br />
<br />
where {{ic|''username''}} is your username.<br />
<br />
To only disable auto-suspend on AC, run:<br />
<br />
$ sudo -u gdm dbus-launch gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type 'nothing'<br />
<br />
(To also disable auto-suspend on battery, run the command with {{ic|battery}} instead of {{ic|ac}}.)<br />
<br />
Restart GDM to activate your changes.<br />
<br />
=== GDM ignores Wayland and uses X.Org by default ===<br />
<br />
Wayland requires Kernel Mode Setting (KMS) running in order to work, and on some machines the GDM process start earlier than KMS, resulting in GDM unable to see Wayland and working only with X.Org. This might result in messages like the following showing up in your log:<br />
<br />
gnome-shell[569]: Failed to open gpu '/dev/dri/card0': GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Operation not permitted<br />
gnome-shell[569]: Failed to create backend: No GPUs found<br />
systemd[505]: org.gnome.Shell@wayland.service: Failed with result 'protocol'.<br />
systemd[505]: Failed to start GNOME Shell on Wayland.<br />
<br />
Alternatively, the same issue may lead to GDM not appearing or monitor only displaying the TTY output.<br />
<br />
You can solve this problem by [[Kernel mode setting#Early KMS start|starting KMS earlier]].<br />
<br />
Also, if you use a [[NVIDIA]] driver, the Wayland session might be blocked by a [[udev]] rule (see the notes under [[GNOME#Wayland sessions]]). This might result in messages like the following:<br />
<br />
systemd[1022]: Condition check resulted in GNOME Shell on Wayland being skipped.<br />
systemd[1022]: org.gnome.Shell@wayland.service: Skipped due to 'exec-condition'.<br />
systemd[1022]: org.gnome.Shell@wayland.service: Control process exited, code=exited, status=2/INVALIDARGUMENT<br />
<br />
See [[#Wayland and the proprietary NVIDIA driver]] for a workaround.<br />
<br />
=== Black screen on AMD or Intel GPUs when an NVidia (e)GPU is present ===<br />
<br />
At first, without an NVidia device, GDM starts and works normally on Wayland, but stops working once an NVidia eGPU is plugged in (or the {{ic|nvidia}} module is loaded for other reasons). A typical symptom of the problem is a black screen with a blinking cursor upon logouts and GDM restarts and the following message in GDM's logs (accessed by running {{ic|journalctl -u gdm -b}} as root):<br />
<br />
Gdm: Child process -<some PID> was already dead.<br />
<br />
The solution is the same as [[#GDM ignores Wayland and uses X.Org by default|above]]: Prevent {{ic|/usr/lib/gdm-disable-wayland}} from running upon {{ic|nvidia}} module loading.<br />
<br />
Notice that GDM on Wayland will no longer work once {{ic|/usr/lib/gdm-disable-wayland}} has run. This is because {{ic|1=WaylandEnable=false}} has been written into {{ic|/run/gdm/custom.conf}}, which overrides {{ic|/etc/gdm/custom.conf}}. To fix the situation without a reboot, remove {{ic|/run/gdm/custom.conf}} and then restart GDM.<br />
<br />
=== GDM cannot be enabled ===<br />
<br />
See [[systemd/FAQ#Failure to enable unit due to preexisting symlink]].<br />
<br />
== 另见 ==<br />
<br />
* [https://help.gnome.org/admin/gdm/stable/index.html.en GDM Reference Manual]</div>Fincehttps://wiki.archlinux.org/index.php?title=GNOME_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726973GNOME (简体中文)2022-04-19T12:18:31Z<p>Fince: edit related articles</p>
<hr />
<div>[[Category:Desktop environments (简体中文)]]<br />
[[de:GNOME]]<br />
[[en:GNOME]]<br />
[[es:GNOME]]<br />
[[fr:GNOME]]<br />
[[it:GNOME]]<br />
[[ja:GNOME]]<br />
[[pt:GNOME]]<br />
[[ru:GNOME]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Desktop environment (简体中文)}}<br />
{{Related|Display manager (简体中文)}}<br />
{{Related|Window manager (简体中文)}}<br />
{{Related|GTK (简体中文)}}<br />
{{Related|GDM (简体中文)}}<br />
{{Related|GNOME/Tips and tricks (简体中文)}}<br />
{{Related|GNOME/Troubleshooting (简体中文)}}<br />
{{Related|GNOME (简体中文)/Files (简体中文)}}<br />
{{Related|GNOME (简体中文)/Gedit (简体中文)}}<br />
{{Related|GNOME/Web}}<br />
{{Related|GNOME/Evolution}}<br />
{{Related|GNOME/Flashback}}<br />
{{Related|GNOME (简体中文)/Keyring (简体中文)}}<br />
{{Related|Cinnamon (简体中文)}}<br />
{{Related|MATE}}<br />
{{Related|Official repositories#gnome-unstable}}<br />
{{Related articles end}}<br />
{{TranslationStatus (简体中文)|GNOME|2022-04-19|725684}}<br />
<br />
[https://www.gnome.org/ GNOME](读音为/(ɡ)noʊm/)是一个追求简单易用的[[Desktop environment (简体中文)|桌面环境]]。它由 [[Wikipedia:zh:GNOME計劃|GNOME项目]]设计,并且完全由自由开源的软件组成。GNOME默认使用 [[Wayland (简体中文)|Wayland]] 而不是 [[Xorg (简体中文)|Xorg]] 作为显示服务器,并同时提供多个对话可供选择:<br />
<br />
* '''GNOME'''是在[[Wayland]]上运行GNOME Shell的默认选项。传统的X应用使用Xwayland运行。<br />
* '''GNOME Classic'''通过[https://web.archive.org/web/20190503163814/http://www.worldofgnome.org/welcome-to-gnome-3-8-flintstones-mode/ 特定的扩展和数值],提供了“[https://help.gnome.org/users/gnome-help/stable/gnome-classic.html 传统的桌面体验]”(类似GNOME2的界面)。因此,它是GNOME Shell的定制样式,而非真正的不同模式Thus。<br />
* '''GNOME on Xorg'''使用[[Xorg]]运行GNOME Shell。<br />
<br />
== 安装 ==<br />
<br />
有两个软件组可用:<br />
<br />
* {{Grp|gnome}}包含基本的桌面环境和一些集成良好的[https://wiki.gnome.org/Apps 应用];<br />
<br />
* {{Grp|gnome-extra}}包含其它GNOME应用,如邮件客户端、IRC客户端、[[#Advanced settings|GNOME Tweaks]]和一些游戏。请注意,这个组建立在{{Grp|gnome}}之上。 <br />
<br />
GNOME的基础桌面环境由[[Wikipedia:zh:Mutter_(software)|Mutter]]窗口管理器的插件[[Wikipedia:zh:GNOME_Shell|GNOME Shell]]组成。可以用{{Pkg|gnome-shell}}单独安装它。<br />
<br />
{{注意|''mutter''是桌面的混成器。它利用硬件图形加速减少屏幕的混乱。GNOME会话管理器会自动检测显卡驱动是否能够运行GNOME Shell,如果不行则用''llvmpipe''软件渲染。}}<br />
<br />
也可以使用不稳定版本,见[[Official repositories#gnome-unstable]].<br />
<br />
== 运行 GNOME ==<br />
<br />
GNOME 可以使用[[display manager (简体中文)|显示管理器]]以图形方式启动,也可以从控制台手动启动(可能会缺少某些功能)。{{Grp|gnome}}的显示管理器是[[GDM]]。<br />
{{注意|GDM提供了GNOME的锁屏功能(及其它)支持。如果没有使用GDM启动GNOME,则需要使用其它屏幕锁定器。见[[List of applications/Security#Screen lockers]]。}}<br />
<br />
=== 图形界面启动 ===<br />
<br />
如果安装了{{Grp|gnome}}并希望GNOME在下次启动时自动启动, 请[[enable|启用]]{{ic|gdm.service}},随后可以在显示管理器的会话菜单中选择想要使用的会话:''GNOME'', ''GNOME Classic'' (仅在{{Pkg|gnome-shell-extensions}} 已安装时显示), 或''GNOME on Xorg''。<br />
<br />
If you prefer to start GNOME right away, thereby avoiding a reboot, [[start]] the aforementioned {{ic|gdm.service}} from a graphically unoccupied tty instead.<br />
如果想立即启动GNOME以避免重启,可以从一个没有图形占用的tty上[[start|启动]]{{ic|gdm.service}}以代替。<br />
<br />
=== 手动启动 ===<br />
<br />
==== Xorg 会话 ====<br />
<br />
* 对于 GNOME on Xorg 会话,在 {{ic|~/.xinitrc}} 中添加(详见[https://gitlab.gnome.org/GNOME/gtk/issues/1390#note_344758]):{{bc|<nowiki><br />
export XDG_SESSION_TYPE=x11<br />
export GDK_BACKEND=x11<br />
exec gnome-session<br />
</nowiki>}}<br />
* 对于 GNOME Classic 会话,在 {{ic|~/.xinitrc}} 中添加:{{bc|<nowiki><br />
export XDG_CURRENT_DESKTOP=GNOME-Classic:GNOME<br />
export GNOME_SHELL_SESSION_MODE=classic<br />
exec gnome-session<br />
</nowiki>}}<br />
<br />
修改完 {{ic|~/.xinitrc}} 后,即可使用 {{ic|startx}} 启动 GNOME(有关其它详细信息,例如如何保留 logind 会话,详见 [[xinit (简体中文)|xinitrc]])。设置完 {{ic|~/.xinitrc}} 后,也可以设定[[xinit (简体中文)#在登录时自动启用 X|在登录时自动启动X]]。例如要在tty1上默认启动,可以在{{ic|.bash_profile}}中添加:<br />
{{bc|<nowiki><br />
if [[ -z $DISPLAY && $(tty) == /dev/tty1 ]]; then<br />
XDG_SESSION_TYPE=x11 GDK_BACKEND=x11 exec startx<br />
fi<br />
</nowiki>}}<br />
<br />
==== Wayland 会话 ====<br />
<br />
{{注意|X服务器仍然需要用于运行尚未移植到[[Wayland (简体中文)|Wayland]]的应用,详见[[Wayland#XWayland]]。使用Qt等特定图形库的应用,可以通过强制设置环境变量使用Wayland。详见[[Wayland#GUI libraries]]。}}<br />
<br />
可以使用 {{ic|<nowiki>XDG_SESSION_TYPE=wayland dbus-run-session gnome-session</nowiki>}} 手动启动 Wayland 会话。或者,可以在任何可用的tty直接调用带wayland选项的{{ic|gnome-shell}}:<br />
<br />
$ gnome-shell --wayland<br />
<br />
请注意,手动调用Gnome'''不需要'''{{ic|gdm}}(因此也不需要附带的{{ic|gdm.service}}),因此对于安装了Gnome最小安装的用户来说,可以根据个人喜好,选择一些包含在更广泛的{{ic|gnome}}组中的软件包。<br />
<br />
若要在 tty1 登录时启动,将以下内容添加到 {{ic|.bash_profile}} 中。Firefox和Qt应用不遵守{{ic|XDG_SESSION_TYPE}},所以最好给它们加上变量:<br />
<br />
{{bc|<nowiki><br />
if [[ -z $DISPLAY && $(tty) == /dev/tty1 && $XDG_SESSION_TYPE == tty ]]; then<br />
MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session<br />
fi<br />
</nowiki>}}<br />
<br />
=== Wayland中的GNOME应用 ===<br />
<br />
在使用 ''GNOME'' 会话时,GNOME 应用将使用 Wayland 运行。出于调试需要, https://docs.gtk.org/gtk3/running.html 和 https://docs.gtk.org/gtk4/running.html 列出的选项和环境变量。<br />
<br />
== 浏览 ==<br />
<br />
[https://wiki.gnome.org/Projects/GnomeShell/CheatSheet GNOME Shell cheat sheet] 中解释了如何高效地使用 GNOME shell,它展示了 GNOME shell 的特色和快捷键,包括切换任务,使用键盘,窗口控制,面板,概览模式等等。以下是部分常用的快捷键:<br />
<br />
* {{ic|Super+m}}:显示消息列表<br />
* {{ic|Super+a}}:显示应用菜单<br />
* {{ic|Alt+Tab}}:切换当前使用的应用<br />
* {{ic|Alt+`}} (美式键盘{{ic|Tab}}上面的按键):切换正在前台使用的应用的窗口<br />
* {{ic|Alt+F2}},然后输入 {{ic|r}} 或 {{ic|restart}}:在图形界面出问题时重启界面(仅用于X/传统模式,不适用于Wayland模式)。<br />
<br />
更多快捷键见[https://help.gnome.org/users/gnome-help/stable/keyboard-nav.html 键盘导航]。<br />
<br />
{{Tip|若要让{{ic|Alt+Tab}}只在当前工作区切换应用,可以将{{ic|current-workspace-only}}设为{{ic|true}}:<br />
<br />
$ gsettings set org.gnome.shell.app-switcher current-workspace-only true<br />
}}<br />
<br />
== 遗留名称 ==<br />
<br />
{{注意|一些GNOME应用在文档和对话框中的名称已经更改,但执行文件名称却没有。下面表格列出了一些这样的应用。}}<br />
<br />
{{提示|在搜索栏中搜索应用的遗留名称将成功找到对应的应用,例如搜索 ''nautilus'' 会出现 ''文件''。}}<br />
<br />
{| class="wikitable"<br />
! 当前<br />
! 遗留<br />
|-<br />
| [[GNOME/Files|文件]]<br />
| Nautilus<br />
|-<br />
| [[GNOME/Web|Web]]<br />
| Epiphany<br />
|-<br />
| 视频<br />
| Totem<br />
|-<br />
| 主菜单<br />
| Alacarte<br />
|-<br />
| [[GNOME/Document viewer|文档查看器]]<br />
| Evince<br />
|-<br />
| 磁盘使用情况分析器<br />
| Baobab<br />
|-<br />
| 图像查看器<br />
| EoG (Eye of GNOME)<br />
|-<br />
| [[GNOME/Keyring|密码和密钥]]<br />
| Seahorse<br />
|-<br />
| 翻译编辑器<br />
| Gtranslator<br />
|}<br />
<br />
== 配置 ==<br />
<br />
GNOME系统设置面板(''gnome-control-center'')和GNOME应用使用[[wikipedia:Dconf|dconf]]配置系统存储设置。<br />
<br />
您可以使用{{man|1|gsettings}}命令行工具直接访问 dconf 数据库。这也可以让您修改用户界面不公开的设置。Command line tool {{man|1|dconf}} can directly modify the underlying database, bypassing validation.<br />
<br />
直到GNOME 3.24,设置由GNOME设置进程应用(位于{{ic|/usr/lib/gnome-settings-daemon/gnome-settings-daemon}}),其也可以在GNOME会话之外运行。<br />
<br />
然而GNOME 3.24用几个相互独立的设置插件({{ic|/usr/lib/gnome-settings-daemon/gsd-*}},后来移动到{{ic|/usr/lib/gsd-*}})取代了 GNOME 设置进程。这些插件通过 {{ic|/etc/xdg/autostart}} (匹配org.gnome.SettingsDaemon.*.desktop) 下的桌面文件进行控制。若要在 GNOME 会话之外运行这些插件,您需要复制或编辑相应的[[desktop entries (简体中文)|桌面条目]]到 {{ic|~/.config/autostart}}。<br />
<br />
配置通常是用户特定的,本文将不介绍如何为多个用户创建配置模板。<br />
<br />
=== GNOME 系统设置 ===<br />
<br />
==== 色彩 ====<br />
<br />
{{ic|colord}} 守护进程会读取显示器的 EDID 信息并提取出合适的色彩配置内容。大多数情况下,色彩配置都是正确的,不需要额外设置;但是对于某些偏差情况或使用较旧的显示器时,可以把色彩配置文件放在 {{ic|~/.local/share/icc/}} 下并被指向。<br />
<br />
==== 夜间模式 ====<br />
<br />
GNOME 内置了类似于 [[Redshift]] 的蓝光过滤功能。夜间模式可以在设置面板中启动及自定义启动时间。此外,夜间模式的色温可以使用以下{{Pkg|dconf}}设置进行调整,5000是一个示例值:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.color night-light-temperature 5000<br />
<br />
{{提示|若要在Wayland中调整白天的色温,请安装[https://extensions.gnome.org/extension/1276/night-light-slider/ Night Light Slider扩展]。}}<br />
<br />
==== 日期与时间 ====<br />
<br />
如果系统已有配置好的 [[Network_Time_Protocol_daemon_(简体中文)|网络时间协议<br />
守护进程]],它同样会对 GNOME 起作用。如果需要,同步设置可以在菜单内设为手动控制。<br />
<br />
GNOME支持自动选择时区,可在系统设置里的''日期和时间''选项中开启。前提是已开启定位服务 (见设置中的''隐私''选项)。<br />
<br />
若要在顶栏内显示日期,请运行:<br />
<br />
$ gsettings set org.gnome.desktop.interface clock-show-date true<br />
<br />
另外,若要在顶栏的日历中显示周数,请运行:<br />
<br />
$ gsettings set org.gnome.shell.calendar show-weekdate true<br />
<br />
==== 默认应用程序 ====<br />
<br />
首次安装 GNOME 时,您可能会发现某些格式由错误的应用处理,比如视频被''totem''打开而不是以前使用的 [[VLC]]。某些格式关联可以使用系统设置中的''默认应用程序''进行调整。<br />
<br />
有关其它协议和方法,请参阅[[Default applications (简体中文)|默认应用程序]]进行配置。<br />
<br />
==== 鼠标和触摸板 ====<br />
<br />
大多数触摸板设置可以使用系统设置中的''鼠标和触摸板''进行调整。<br />
<br />
根据您的设备,其它配置可能可用,但不会显示在默认界面内,例如不同的触摸板点击方法:<br />
{{hc|$ gsettings range org.gnome.desktop.peripherals.touchpad click-method|<br />
enum<br />
'default'<br />
'none'<br />
'areas'<br />
'fingers'<br />
}}<br />
手动设置:<br />
<br />
$ gsettings set org.gnome.desktop.peripherals.touchpad click-method 'fingers'<br />
或使用{{Pkg|gnome-tweaks}}设置。<br />
<br />
{{Note (简体中文)|1=GNOME 不支持 [[synaptics]] 并默认使用 [[libinput]]。参考 [https://bugzilla.gnome.org/show_bug.cgi?id=764257#c12 这个缺陷报告]。}}<br />
<br />
==== 网络 ====<br />
<br />
[[NetworkManager (简体中文)|NetworkManager]] 是GNOME项目中控制网络设置的工具,它也是{{Grp|gnome}}的一部分。如果尚未安装,则[[安装]]{{Pkg|networkmanager}}软件包并[[启用]]{{ic|NetworkManager.service}} systemd单元。<br />
<br />
虽然可以使用任何其它[[network manager|网络管理器]],但 NetworkManager 可以使用网络设置和状态指示器 {{Pkg|network-manager-applet}}( GNOME不需要 )整合到桌面环境当中。<br />
<br />
{{注意|1=用{{Pkg|networkmanager}}的''nmtui''设置隐藏的无线网络不会自动连接。您需要在GNOME设置中创建一个新配置文件,以恢复该网络的自动连接功能。}}<br />
<br />
==== 在线帐户 ====<br />
<br />
部分在线账户,比如 [[ownCloud]],需要安装 {{Pkg|gvfs-goa}} 以在 GNOME 应用比如 [[GNOME Files|GNOME 文件]] 以及 GNOME 文档中发挥全部功能[https://wiki.gnome.org/ThreePointSeven/Features/Owncloud]。<br />
<br />
详见[https://help.gnome.org/users/gnome-help/stable/accounts.html 在线账户]。<br />
<br />
==== 搜索 ====<br />
<br />
GNOME shell在按下{{ic|Super}}键并开始输入时会启动搜索。{{Pkg|tracker}}软件包默认作为{{Grp|gnome}}组的一部分被安装。它提供一个应用和数据的索引数据库。它可以被“搜索及索引”菜单项配置,通过"tracker-control"监视状态。它在用户登录时自动被"gnome-session"启动。索引可以被{{ic|tracker-control -s}}手动启动。搜索设置也可以在系统设置中配置。<br />
<br />
Tracker数据库可以使用"tracker-sparql“命令查询。详见{{man|1|tracker-sparql}}。<br />
<br />
=== 高级设置 ===<br />
<br />
如上文所述,改变[[GTK (简体中文)|GTK]]主题或[[Window manager (简体中文)|窗口管理器]]主题等选项,并不会出现在GNOME设置(gnome-control-center)里。想要修改这些设置可以使用GNOME Tweaks ({{Pkg|gnome-tweaks}}),这是一个展示了许多这类设置的图形化工具。<br />
<br />
(存储在 DConf 数据库中的)GNOME设置也可以使用{{man|1|dconf-editor}}(一个图形化的DConf配置工具)或[https://developer.gnome.org/gio/stable/GSettings.html gsettings]命令行工具进行配置。GNOME Tweaks 不会在 GUI 背后做任何其他事情;note though that you will not find all settings described in the following sections in it.<br />
<br />
==== 外观 ====<br />
<br />
===== 主题 =====<br />
<br />
{{Note|从[https://release.gnome.org/42/ Gnome 42]开始,许多默认的Gnome应用程序使用GTK 4和libadwaita。这些应用程序目前不支持通过gsettings或{{pkg|gnome-tweaks}}改变主题,只能通过系统设置的外观选项来调整配置。若要设置Adwaita或Adwaita-dark以外的GTK主题,见[[GTK#Themes]]。}}<br />
<br />
GNOME默认使用Adwaita。若要只将Adwaita-dark应用于GTK 2应用,请使用以下符号链接:<br />
<br />
$ ln -s /usr/share/themes/Adwaita-dark ~/.themes/Adwaita<br />
<br />
{{Note|Adwaita-dark主题由{{Pkg|gnome-themes-extra}}提供,因此GNOME的最小安装可能不会包含此主题。}}<br />
<br />
若要选择新的主题,(将它们移到适当的目录中,并)使用GNOME Tweaks或下面的GSettings命令。<br />
<br />
对于GTK主题:<br />
<br />
$ gsettings set org.gnome.desktop.interface gtk-theme ''theme-name''<br />
<br />
对于图标主题:<br />
<br />
$ gsettings set org.gnome.desktop.interface icon-theme ''theme-name''<br />
<br />
{{Note|窗口管理器的主题会跟随GTK主题。使用{{ic|org.gnome.desktop.wm.preferences theme}}的方法已被废弃和忽略。}}<br />
<br />
见[[GTK#Themes]]和[[Icons#Manually]].<br />
<br />
====== 标题栏高度 ======<br />
<br />
{{注意|应用此配置可以缩小不使用 GNOME风格CSD的应用程序的标题栏。带有CSD的原生GNOME应用程序不受影响。}}<br />
<br />
{{hc|~/.config/gtk-3.0/gtk.css|<br />
headerbar.default-decoration {<br />
padding-top: 0px;<br />
padding-bottom: 0px;<br />
min-height: 0px;<br />
font-size: 0.6em;<br />
}<br />
<br />
headerbar.default-decoration button.titlebutton {<br />
padding: 0px;<br />
min-height: 0px;<br />
}<br />
}}<br />
<br />
详见[https://askbot.fedoraproject.org/en/question/10035/shrink-title-bar/?answer=86149#post-id-86149]。<br />
<br />
====== 标题栏按钮排序 ======<br />
<br />
设置 GNOME 窗口管理器顺序 (Mutter, Metacity): <br />
<br />
$ gsettings set org.gnome.desktop.wm.preferences button-layout ':minimize,maximize,close'<br />
<br />
{{提示|冒号表示窗口标题栏按钮出现的方向}}<br />
<br />
====== 最大化时隐藏标题栏 ======<br />
<br />
* [[Install]] {{AUR|gnome-shell-extension-gtktitlebar-git}},在最大化时移除标题栏,非GTK窗口.<br />
<br />
*[[安装]] {{AUR|gnome-shell-extension-pixel-saver-git}}或{{AUR|gnome-shell-extension-pixel-saver}}。最大化窗口的标题栏将与活动栏整合以节省空间。<br />
<br />
===== GNOME Shell主题 =====<br />
<br />
GNOME Shell本身的主题是可配置的。首先确认您已安装{{Pkg|gnome-shell-extensions}}软件包以应用Shell主题。然后通过GNOME Tweaks或通过[https://extensions.gnome.org GNOME Shell Extensions] 网站启用“User Themes”扩展。Shel主题可以通过使用GNOME Tweaks软件加载并选用。<br />
<br />
[https://aur.archlinux.org/packages?O=0&K=gnome-shell-theme&do_Search=Go&PP=50&SB=v&SO=d AUR]里有大量可用的GNOME Shell主题。Shell主题也可在[https://gnome-look.org/ gnome-look.org]里下载。<br />
<br />
===== AppIndicators/顶部菜单栏图标 =====<br />
<br />
To enable AppIndicators, which is useful for controlling/monitoring certain applications running in the background, Install {{Pkg|gnome-shell-extension-appindicator}} or {{AUR|gnome-shell-extension-appindicator-git}}, [[#Navigation|restart the GNOME Shell]], then enable the AppIndicator extension in the GNOME Extensions application or by running {{ic|$ gnome-extensions enable $(gnome-extensions list {{!}} grep -m 1 appindicatorsupport)}}<br />
<br />
==== 应用列表中的文件夹 ====<br />
<br />
{{提示| [https://github.com/prurigro/gnome-catgen gnome-catgen] ({{AUR|gnome-catgen-git}}) 脚本允许您通过创建{{ic|~/.local/share/applications-categories}}}下与分类同名的文件并在文件中包含您想包括在内的应用。或者,您可以使其在没有文件夹的情况下遍历各个应用直到您摁下{{ic|Ctrl+c}}或遍历完应用,然后输入想要的文件夹名称}}<br />
<br />
在'''dconf-editor'''中导航至 {{ic|org.gnome.desktop.app-folders}} 并设置{{ic|folder-children}}的值为一个由逗号分隔的文件夹的序列:<br />
<br />
['Utilities', 'Sundry']<br />
<br />
使用{{ic|gsettings}}加入应用:<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ apps "['alacarte.desktop', 'dconf-editor.desktop']"<br />
<br />
上述命令将{{ic|alacarte.desktop}}及{{ic|dconf-editor.desktop}}加入到Sundry文件夹。 该命令也创建{{ic|org.gnome.desktop.app-folders.folders.Sundry}}。<br />
<br />
要显示文件夹名称(如果其在应用上部没有显示名称):<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ name "Sundry"<br />
<br />
应用也可以通过它们的分类整理 (在它们的''.desktop''文件中):<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ categories "['Office']"<br />
<br />
如果某一个应用不想被加入某一文件夹,运行下列命令以设置例外:<br />
<br />
$ gsettings set org.gnome.desktop.app-folders.folder:/org/gnome/desktop/app-folders/folders/Sundry/ excluded-apps "['libreoffice-draw.desktop']"<br />
<br />
详情参考[https://git.gnome.org/browse/gsettings-desktop-schemas/tree/schemas/org.gnome.desktop.app-folders.gschema.xml.in]和[[Gentoo:Gnome Applications Folders]].<br />
<br />
==== 自启动 ====<br />
<br />
GNOME提供[[XDG Autostart]]。<br />
<br />
{{Pkg|gnome-tweaks}} 程序可以用来管理自启动项。<br />
<br />
{{提示|如果Tweaks中自启动应用选项下加号按钮为灰色不可用,尝试在终端下通过{{ic|gnome-tweaks}}命令启动Tweaks。见[https://bbs.archlinux.org/viewtopic.php?pid&#61;1413631#p1413631 此贴]。}}<br />
<br />
{{注意|已经弃用的''gnome-session-properties''对话框可以通过[[安装]] {{AUR|gnome-session-properties}} 添加。这同样提供了禁用系统范围自启动应用的功能,这是''gnome-tweaks''所不能做到的。}}<br />
<br />
==== 桌面 ====<br />
<br />
===== 桌面图标 =====<br />
<br />
GNOME 3.28之前,桌面图标通过[[GNOME/Files|Files]]在桌面上绘制一个透明的带图标的窗口实现。在GNOME 3.28中,该功能被移除,桌面图标不再在GNOME上可用。可能的方案包括使用[[Nemo]](GNOME File的一个分支,目前仍支持桌面图标)或安装{{AUR|gnome-shell-extension-desktop-icons}}插件以复刻GNOME 3.26以下支持的桌面图标功能,但略有差异。详见[https://bbs.archlinux.org/viewtopic.php?id=235633 Arch论坛中的讨论]。<br />
<br />
===== 锁屏和背景 =====<br />
<br />
在设置桌面及锁屏背景的时候,注意Picture标签下只显示{{ic|~/Pictures}}文件夹下的图片。如果您想使用不在该文件夹下的图片,请使用下列命令:<br />
<br />
对于桌面背景:<br />
<br />
$ gsettings set org.gnome.desktop.background picture-uri 'file:///path/to/my/picture.jpg'<br />
<br />
对于锁屏背景:<br />
<br />
$ gsettings set org.gnome.desktop.screensaver picture-uri 'file:///path/to/my/picture.jpg'<br />
<br />
===== 禁用顶部左侧的热区 =====<br />
<br />
从GNOME 3.34开始,可以使用以下命令禁用它:<br />
<br />
$ gsettings set org.gnome.desktop.interface enable-hot-corners false<br />
<br />
或在{{Pkg|gnome-tweaks}}中的''顶栏 > 活动概览热区''中禁用。<br />
<br />
GNOME 42后,可在系统设置的多任务选项中禁用。<br />
<br />
===== 启动到概览模式 =====<br />
<br />
从GNOME 40开始,桌面会直接启动到概览模式,而不是桌面(如以前的版本)。若要模仿经典的行为,可以安装[https://extensions.gnome.org/extension/4099/no-overview/ No overview at start-up]插件。<br />
<br />
详见[https://discourse.gnome.org/t/gnome-40-login-is-to-the-activities-overview-mode-how-do-you-disable-this/5783 此讨论]。<br />
<br />
==== 扩展 ====<br />
<br />
在 [https://extensions.gnome.org extensions.gnome.org] 里可以找到扩展。只要把屏幕做上方的按钮按成 '''ON''' 然后点击弹出窗口里的 '''Install''' 就能够安装并启用那个插件了。已经安装的扩展可以在 [https://extensions.gnome.org/local/ extensions.gnome.org/local] 里查看,而且还能看到哪个能够升级。用{{Pkg|gnome-tweaks}}也可以开关某个扩展。<br />
<br />
{{注意|[[GNOME/Web]]可以直接安装[https://extensions.gnome.org extensions.gnome.org]里的扩展。其它浏览器则需先安装 {{AUR|chrome-gnome-shell}} ,并安装对应的浏览器插件。}}<br />
<br />
GNOME Shell 的插件自定义可以是限定于某个用户的,也可以是全局的。用 [[pacman]] 安装的扩展是全局的,而且会随着系统更新而更新。<br />
<br />
{{Pkg|gnome-shell-extensions}} 提供了包含在 GNOME project 里的(即有官方支持的)插件包,其中包含的插件有很多都会被 GNOME Classic session 使用。如果想要一个任务栏但是又不想用 GNOME Classic session,那就可以用 ''Window list'' 扩展。<br />
<br />
用以下命令查看已启用的扩展:<br />
<br />
$ gsettings get org.gnome.shell enabled-extensions<br />
<br />
上述命令可能会列出已经删除的扩展。若要只列出已启用''和''已安装的扩展,使用''gnome-extensions'':<br />
<br />
$ gnome-extensions list --enabled<br />
<br />
更多有关GNOME Shell的信息,见[https://extensions.gnome.org/about/]。<br />
<br />
==== 字体 ====<br />
<br />
{{提示|如果您把"Scaling factor"调至1.00以上的某值,辅助功能菜单将自动启用}}<br />
<br />
GNOME可以设置窗体标题,界面(应用),文档及等宽字体。查看Tweaks下的字体选项卡以获得相关选项。<br />
<br />
对于字体渲染来说,RGBA可能适合更多的显示器类型,如果字体看起来过分拥挤,可以将字体渲染调至“Slight”或“None”。<br />
<br />
==== WEBP,缩略图 ====<br />
<br />
[[Install|安装]]{{Pkg|webp-pixbuf-loader}}使GNOME的图像查看器({{Pkg|eog}})能够查看WEBP图像并为其创建缩略图,以便在[[GNOME Files]]中查看。<br />
<br />
==== 输入法 ====<br />
<br />
GNOME集成了的通过[[IBus]]的输入法, 只有{{Pkg|ibus}}和添加想要的输入法引擎 (例如:{{Pkg|ibus-libpinyin}} for Intelligent Pinyin) 需要安装,安装后,输入法引擎可以加入GNOME的区域和语言设置键盘布局。<br />
<br />
==== Keyboard Layout quirks ====<br />
<br />
If you are using an alternative keyboard layout like Neo2 which uses multiple layers/modifiers, you might need to go to ''Keyboard > Type Special Characters'' in GNOME Settings (''gnome-control-center'') and change the ''Alternate Characters Key'' away from ''Right Alt'' so that it can be used as a native modifier of the keyboard layout. Setting it to e.g. ''Left Alt'' prevents ''Alt+Tab'', so be careful what you change it to.<br />
Without this change, your left ''Mod3'' key might work, but the right one (''AltGr'') does not. (As of 2021-05-18)<br />
<br />
==== 电源 ====<br />
<br />
当您使用笔记本时,可能想修改以下设置,包括控制闲置、按下电源按钮和盖子关闭时的行为。<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.power button-power ''hibernate''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-timeout ''3600''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-ac-type ''hibernate''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-timeout ''1800''<br />
$ gsettings set org.gnome.settings-daemon.plugins.power sleep-inactive-battery-type ''hibernate''<br />
$ gsettings set org.gnome.desktop.lockdown disable-lock-screen ''true''<br />
<br />
如需在合上盖子后依然保持显示器开启:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xrandr default-monitors-setup do-nothing<br />
<br />
GNOME 3.24中不建议使用以下设置:<br />
<br />
org.gnome.settings-daemon.plugins.power button-hibernate<br />
org.gnome.settings-daemon.plugins.power button-power<br />
org.gnome.settings-daemon.plugins.power button-sleep<br />
org.gnome.settings-daemon.plugins.power button-suspend<br />
org.gnome.settings-daemon.plugins.power critical-battery-action<br />
<br />
===== 笔记本合盖时不挂起 =====<br />
<br />
The settings panel of GNOME does not provide an option for the user to change the action triggered when the laptop lid is closed. However {{Pkg|gnome-tweaks}} can override the setting applied by {{Pkg|systemd}}. On the tab ''General'' turn off the switch ''Suspend when laptop lid is closed''. The system will then not ''Suspend to RAM (S3)'' on lid close.<br />
<br />
To change the lid switch action system-wide, ensure that the setting described above is '''not turned off''' and edit the systemd settings in {{ic|/etc/systemd/logind.conf}}. To turn off suspend on lid close, set {{ic|1=HandleLidSwitch=ignore}}, as described in [[Power management#ACPI events]].<br />
<br />
===== 修改电池电量严重不足时的行为 =====<br />
<br />
设置面板不提供对电池电量严重不足行为的设置。这些设置也从dconf中移除。不过它们现在由uppower管理。按需编辑{{ic|/etc/UPower/Upower.conf}}中upower设置。<br />
<br />
{{hc|head=/etc/UPower/UPower.conf|output=<br />
PercentageLow=10<br />
PercentageCritical=3<br />
PercentageAction=2<br />
CriticalPowerAction=HybridSleep<br />
}}<br />
<br />
===== 电源模式 =====<br />
<br />
安装{{Pkg|gnome-control-center}}的可选依赖[[power-profiles-daemon]]以支持电源配置文件。<br />
由于''gnome-shell''和GNOME设置都请求在启动时激活{{ic|power-profiles-daemon}}服务,所以不需要特意将其[[starting/enabling|启动或启用]]。<br />
<br />
When the service is active, power profiles can be managed through the ''Power'' section of GNOME Settings and in the system menu.<br />
当服务激活时,可以通过GNOME设置的''电源''选项和系统菜单管理电源配置文件。<br />
<br />
=== 使用其它window manager ===<br />
<br />
GNOME Shell 不支持更改 [[window manager]], 但是 [[GNOME Flashback]] 提供使用 Metacity 和 [[Compiz]] 的session。此外,可以通过 [[GNOME/Tips and tricks#Custom GNOME sessions|自定义 GNOME sessions]] 来使用别的组件。<br />
<br />
== 参见 ==<br />
<br />
* [https://www.gnome.org/ 官方网站]<br />
* [https://blogs.gnome.org/tbernard/2021/06/15/community-power-2/ Contributing to GNOME, feature requests, bugs, code]<br />
* [https://extensions.gnome.org/ GNOME-shell 扩展]<br />
* 主题、图标和壁纸:<br />
** [https://art.gnome.org/ GNOME Art]<br />
** [https://www.gnome-look.org/ GNOME 外观]<br />
* GTK/GNOME 程序:<br />
** [https://www.gnomefiles.org/ GNOME 文件管理]<br />
** [https://www.gnome.org/projects/ GNOME 项目列表]<br />
* [https://blog.fpmurphy.com/2011/03/customizing-the-gnome-3-shell.html 自定义 GNOME Shell] <br />
* GNOME 代码和镜像:<br />
** [https://gitlab.gnome.org/ GNOME GitLab]<br />
** [https://github.com/GNOME GNOME Github 镜像]</div>Fincehttps://wiki.archlinux.org/index.php?title=User:Fince&diff=726972User:Fince2022-04-19T12:13:45Z<p>Fince: </p>
<hr />
<div>Translated:<br />
<br />
[[DaVinci Resolve (简体中文)]]<br />
<br />
[[GNOME (简体中文)/Files (简体中文)]]<br />
<br />
[[GNOME (简体中文)/Gedit (简体中文)]]<br />
<br />
Improved/Updated Translation:<br />
<br />
[[GNOME (简体中文)]]<br />
<br />
[[Steam (简体中文)]]<br />
<br />
[[GTK (简体中文)]]<br />
<br />
[[Java (简体中文)]]</div>Fincehttps://wiki.archlinux.org/index.php?title=GNOME/Gedit&diff=726971GNOME/Gedit2022-04-19T12:12:27Z<p>Fince: add Chinese translate link</p>
<hr />
<div>[[Category:GNOME]]<br />
[[Category:Text editors]]<br />
[[de:Gedit]]<br />
[[es:GNOME (Español)/Gedit]]<br />
[[ja:Gedit]]<br />
[[zh-hans:GNOME (简体中文)/Gedit]]<br />
[[Wikipedia:gedit|gedit]] is a general-purpose text editor for GNOME.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|gedit}} package.<br />
<br />
For additional features, install the {{Pkg|gedit-plugins}} package.<br />
<br />
Gedit can use multiple spell checking dictionaries, see [[Language checking]].<br />
<br />
== Configuration ==<br />
<br />
=== Do not end files with a new line ===<br />
<br />
If you want to ensure that gedit does not end files with a newline, execute the following:<br />
<br />
$ gsettings set org.gnome.gedit.preferences.editor ensure-trailing-newline false<br />
<br />
=== Save backup versions of edited files ===<br />
<br />
If desired, gedit can create a backup copy of an edited file - the contents of the backup file will be the same as the contents of the original file before the edit was made and then saved. The backup file's name will be the same as original file's name but suffixed with a ~ symbol. Hence, for the file called {{ic|file1}} the backup copy would have the name {{ic|file1~}}. Backup files are hidden by default.<br />
<br />
To enable this behaviour, access gedit's Preferences panel (for GNOME Shell users, this can be found in gedit's global menu). In the preferences panel, click on the ''Editor'' tab and tick the option ''Create a backup copy of files before saving.''<br />
<br />
== See also ==<br />
<br />
* [https://wiki.gnome.org/Apps/Gedit Apps/Gedit - GNOME Wiki!]</div>Fincehttps://wiki.archlinux.org/index.php?title=GNOME_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)/Gedit_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726969GNOME (简体中文)/Gedit (简体中文)2022-04-19T12:11:59Z<p>Fince: Fince moved page GNOME (简体中文)/Gedit (简体中文) to GNOME (简体中文)/Gedit (简体中文): A wrong bracket</p>
<hr />
<div>[[Category:GNOME]]<br />
[[Category:Text editors]]<br />
[[de:Gedit]]<br />
[[en:GNOME/Gedit]]<br />
[[es:GNOME (Español)/Gedit]]<br />
[[ja:Gedit]]<br />
[[Wikipedia:gedit|gedit]]是GNOME的通用文本编辑器。<br />
<br />
== 安装 ==<br />
<br />
[[Install|安装]]{{Pkg|gedit}}软件包。<br />
<br />
若要使用额外功能,请安装{{Pkg|gedit-plugins}}软件包。<br />
<br />
Gedit有许多拼写检查词典可供使用,见[[Language checking]]。<br />
<br />
== 配置 ==<br />
<br />
=== 不在新的一行结束文档 ===<br />
<br />
若想确保gedit不会在新的一行结束文档,请执行以下操作:<br />
<br />
$ gsettings set org.gnome.gedit.preferences.editor ensure-trailing-newline false<br />
<br />
=== 为编辑过的文件保存备份 ===<br />
<br />
若有需要,gedit可以为编辑过的文件创建备份副本,副本的名称和内容将与编辑前的原始文件的内容相同,但名称后面添加了“~”后缀。例如文件{{ic|file1}}的副本名称为{{ic|file1~}}。备份文件默认隐藏。<br />
<br />
若要开启此功能,请访问gedit的首选项(GNOME Shell用户可以在gedit的全局菜单中找到)。在首选项中点击“编辑器”标签栏,勾选“在保存前创建备份文件”选项。<br />
<br />
== 另见 ==<br />
<br />
* [https://wiki.gnome.org/Apps/Gedit Apps/Gedit - GNOME Wiki!]</div>Fincehttps://wiki.archlinux.org/index.php?title=GNOME_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)/Gedit_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726968GNOME (简体中文)/Gedit (简体中文)2022-04-19T12:08:55Z<p>Fince: create page</p>
<hr />
<div>[[Category:GNOME]]<br />
[[Category:Text editors]]<br />
[[de:Gedit]]<br />
[[en:GNOME/Gedit]]<br />
[[es:GNOME (Español)/Gedit]]<br />
[[ja:Gedit]]<br />
[[Wikipedia:gedit|gedit]]是GNOME的通用文本编辑器。<br />
<br />
== 安装 ==<br />
<br />
[[Install|安装]]{{Pkg|gedit}}软件包。<br />
<br />
若要使用额外功能,请安装{{Pkg|gedit-plugins}}软件包。<br />
<br />
Gedit有许多拼写检查词典可供使用,见[[Language checking]]。<br />
<br />
== 配置 ==<br />
<br />
=== 不在新的一行结束文档 ===<br />
<br />
若想确保gedit不会在新的一行结束文档,请执行以下操作:<br />
<br />
$ gsettings set org.gnome.gedit.preferences.editor ensure-trailing-newline false<br />
<br />
=== 为编辑过的文件保存备份 ===<br />
<br />
若有需要,gedit可以为编辑过的文件创建备份副本,副本的名称和内容将与编辑前的原始文件的内容相同,但名称后面添加了“~”后缀。例如文件{{ic|file1}}的副本名称为{{ic|file1~}}。备份文件默认隐藏。<br />
<br />
若要开启此功能,请访问gedit的首选项(GNOME Shell用户可以在gedit的全局菜单中找到)。在首选项中点击“编辑器”标签栏,勾选“在保存前创建备份文件”选项。<br />
<br />
== 另见 ==<br />
<br />
* [https://wiki.gnome.org/Apps/Gedit Apps/Gedit - GNOME Wiki!]</div>Fincehttps://wiki.archlinux.org/index.php?title=HiDPI_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726965HiDPI (简体中文)2022-04-19T11:51:05Z<p>Fince: add Translateme</p>
<hr />
<div>[[Category:Graphics (简体中文)]]<br />
[[en:HiDPI]]<br />
[[ja:HiDPI]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
<br />
{{TranslationStatus (简体中文)|HiDPI|2018-09-04|532530}}<br />
<br />
{{Translateme (简体中文)}}<br />
<br />
HiDPI (High Dots Per Inch) 显示器,指的是在较小尺寸下却拥有较高分辨率的显示器。Apple 将其称作“[[wikipedia:Retina Display|视网膜屏幕]]”,这项技术主要存在于高端笔记本电脑和显示器中。<br />
<br />
并非所有的软件都在高分辨率屏幕下工作良好。此页列出了一些常见的调整方法,让您更好的使用 HiDPI 显示器。<br />
<br />
== 桌面环境 ==<br />
<br />
=== GNOME ===<br />
<br />
可以在'''设置''' > '''设备''' > '''显示''' (Settings > Devices > Displays) 中开启 HiDPI 支持,也可以使用 gsettings 进行设置:<br />
<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{注意|1={{ic|scaling-factor}}仅能设置为整数。1 = 100%,2 = 200%……等等}}<br />
<br />
==== 非整数倍缩放 ====<br />
<br />
在某些设备(例如小平板电脑)上使用 {{ic|scaling-factor}}设置整数倍缩放的效果可能并不理想。<br />
<br />
*wayland<br />
启用实验性的非整数倍缩放功能:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
之后再次打开 '''设置''' > '''设备''' > '''显示'''。<br />
<br />
*xorg<br />
<br />
您可以同时使用 {{ic|scaling-factor}} 和 [[xrandr]] 来实现任意的非整数倍缩放。这可以使 TTF 字体被正确缩放,防止出现单独使用 xrandr 时出现的模糊现象。您可以使用 {{ic|gsettings}} 来指定放大系数,并用 [[xrandr]] 指定缩小系数。<br />
<br />
首先使将缩放设为“UI看起来太大”的最小值。通常“2”已经太大,如果不够大就继续尝试“3”以及更大的数。之后使用 [[xrandr]] 设置缩小系数。首先获取相关的输出名称,下面的例子将使用 {{ic|eDP1}} 。先试着将缩小系数设为1.25,如果 UI 看起来仍然太大,则增大缩放系数。反之则缩小缩放系数。<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{注意|如果你的鼠标光标移动范围和屏幕显示并不匹配,你可能需要同时使用 {{ic|--panning}}。参阅[[#Side display]]。}}<br />
<br />
{{Accuracy|The following was initially added under [[#X Resources]]. Clarify how it integrates with the info there or that above for GNOME.|section=GNOME ignores X settings}}<br />
<br />
在GNOME设置守护进程中的xsettings插件中,DPI设置是硬编码的。这将忽略Xorg的设置。这里有一篇[http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html 重编译 Gnome Settings Daemon]的博客文章。在文档中还介绍了另一种方法来设置 xsettings 的DPI:<br />
<br />
你可以使用dconf编辑器转到这个键值:<br />
<br />
/org/gnome/settings-daemon/plugins/xsettings/overrides<br />
<br />
加入这个条目:<br />
<br />
'Xft/DPI': <153600><br />
<br />
来自 README.xsettings<br />
<br />
注意必须使用这种方式指定(使用<>)。<br />
<br />
另外,上面的例子中一英寸以1024ths定义。(Note also that DPI in the above example is expressed in 1024ths of an inch.)<br />
<br />
=== KDE ===<br />
<br />
您可以使用KDE的设置来微调字体、图标和部件缩放,这些改动会同时影响 Qt 和 GTK+ 程序。<br />
<br />
要调整整体缩放:<br />
<br />
# '''系统设置'''→'''显示和监控'''→'''显示配置'''→'''缩放显示'''<br />
# 将滑块调整至适合的位置<br />
# 重新启动以使设置生效<br />
<br />
要仅调整字体缩放:<br />
<br />
# '''系统设置'''→'''字体'''<br />
# 勾选'''“固定字体DPI”'''并调整DPI的值。调整之后重新启动应用程序即可生效。要在整个桌面上生效,您需要注销之后重新登录。<br />
<br />
要仅调整图标缩放:<br />
<br />
# '''系统设置'''→'''图标'''→'''配置图标大小'''<br />
# 为每一项选择合适的图标大小,更改将会立即生效。<br />
<br />
==== 非整数倍缩放下的Bug ====<br />
<br />
当您使用非整数倍的缩放比例时,这可能导致一些 Qt 应用程序的字体渲染出现问题(例如 okular)。<br />
<br />
有一个办法可以绕过这个问题:<br />
# 将缩放比例设为1<br />
# 用上面的方法调整字体和图标缩放(这会影响所有的应用程序,且不会导致字体问题)<br />
# 重新启动KDE<br />
# 如果需要缩放 GTK 程序,设置环境变量{{ic|GDK_SCALE/GDK_DPI_SCALE}}(参见下文)。<br />
<br />
==== 托盘图标不缩放 ====<br />
<br />
托盘图标不会随着整体而缩放。Plasma 默认会忽略 Qt 设置。要让 Plasma 使用 Qt 设置,将{{ic|PLASMA_USE_QT_SCALING}} 设为1.<br />
<br />
=== Xfce ===<br />
<br />
打开'''设置管理器'''→'''外观'''→'''字体''',修改 DPI 的值。在 HiDPI 显示器上,通常可以设为180或者192。要获得更精确的数字,可以使用{{ic|<nowiki>xdpyinfo | grep resolution</nowiki>}},使用输出DPI两倍的值。<br />
<br />
要增大托盘图标,右键点击托盘的空白处,选择属性,将最大图标大小设置为32,48或者64。<br />
<br />
=== Cinnamon ===<br />
<br />
应当开箱即用。<br />
<br />
=== Enlightenment ===<br />
<br />
对于E18,首先打开设置面板,在 '''外观'''→'''缩放''' 中,你可以调整缩放倍数。在MBPr 15 上,你可以选择1.2。<br />
<br />
== X Server ==<br />
<br />
某些程序使用 X Server 所提供的 DPI 值。比如 i3 ([https://github.com/i3/i3/blob/next/libi3/dpi.c 来源]) 和 Chromium([https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/widget/desktop_aura/desktop_screen_x11.cc 来源])。<br />
<br />
{{Accuracy|1=Xorg always sets dpi to 96. See [https://bugs.freedesktop.org/show_bug.cgi?id=23705 this], [https://bugs.freedesktop.org/show_bug.cgi?id=41115 this] and finally [https://pastebin.com/vtzyBK6e this].}}<br />
<br />
要验证 X Server 是否正确检测到了您的显示器的DPI,使用 {{Pkg|xorg-xdpyinfo}} 中的 {{ic|xdpyinfo}} 工具。<br />
<br />
$ xdpyinfo | grep -B 2 resolution<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
<br />
这个例子中 X Server 检测到的屏幕尺寸并不准确(423mm x 328mm,实际上Dell XPS 9530的屏幕尺寸是346mm x 194mm),但报告的 DPI 是96的整数倍。通常这往往比正确的DPI更好,可以保证字体渲染正确。<br />
<br />
如果 {{ic|xdpyinfo}} 显示的DPI不正确,参阅[[Xorg#Display size and DPI]]了解如何修复。<br />
<br />
== X Resources ==<br />
<br />
如果你没有使用一个桌面环境,比如 KDE,Xfce,或是没有一个为您操作 Xorg 设置的程序,你可以通过在 [[Xresources]] 中的 {{ic|Xft.dpi}} 变量手动修改DPI设置。<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.dpi: 180<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
确保设置在X启动时已经被载入。例如在{{ic|~/.xinitrc}}中使用{{ic|xrdb -merge ~/.Xresources}}。有关详细信息,请参阅 [[Xresources]]。<br />
<br />
通常这会让大多数地方的字体大小正确,但这并不会影响图标大小。<br />
<br />
在设置{{ic|Xft.dpi}}的同时设置 GUI toolkit 缩放(例如{{ic|GDK_SCALE}})可能导致某些程序界面元素过大(例如firefox)。<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
自从 Qt 5.6 开始,Qt 5 应用程序可以遵守屏幕DPI。设置环境变量{{ic|QT_AUTO_SCREEN_SCALE_FACTOR}}以启用这项功能。<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
如果自动检测的 DPI 并不理想,你也可以按屏幕({{ic|QT_SCREEN_SCALE_FACTORS}})或全局({{ic|QT_SCALE_FACTOR}})手动设置缩放,有关详细信息,请参阅 [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt 博客文章]。<br />
<br />
{{注意|<br />
* 如果您手动设置了缩放,则需要设置{{ic|1=QT_AUTO_SCREEN_SCALE_FACTOR=0}}。否则某些明确启用 HiDPI 支持的程序会被缩放两次。<br />
* {{ic|QT_SCALE_FACTOR}}缩放字体,但{{ic|QT_SCREEN_SCALE_FACTORS}}并不会。<br />
* 如果您还在'''xrdb'''中手动设置过DPI以支持其他toolkits,同时使用{{ic|QT_SCALE_FACTORS}}会使字体过大。<br />
* 如果您有多个不同DPI的屏幕,即 [[#Side display]],您可能需要设置{{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}。<br />
}}<br />
<br />
=== GDK 3 (GTK+ 3) ===<br />
<br />
要将UI缩放为两倍大小:<br />
<br />
export GDK_SCALE=2<br />
<br />
并同时不影响字体:<br />
<br />
export GDK_DPI_SCALE=0.5<br />
<br />
=== GTK+ 2 ===<br />
<br />
GTK+ 2本身并不支持缩放UI。但您可以使用 {{AUR|oomox-git}} 创建预缩放过的主题。<br />
<br />
=== Elementary (EFL) ===<br />
<br />
要将缩放倍数设为1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
更多信息请查看 https://phab.enlightenment.org/w/elementary/<br />
<br />
== 引导程序 ==<br />
<br />
=== GRUB ===<br />
<br />
==== 降低帧缓冲分辨率 ====<br />
<br />
参见[[GRUB/Tips and tricks#Setting the framebuffer resolution]]。<br />
<br />
==== 改变GRUB字体大小 ====<br />
<br />
在{{ic|/usr/share/fonts/}}中找一个你喜欢的字体。<br />
<br />
使用GRUB工具转换:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/''FontFamily/FontName.ttf''<br />
<br />
{{注意|{{ic|-s 30}}是字体大小。}}<br />
<br />
编辑{{ic|/etc/default/grub}}来设置字体。参见[[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
使用{{ic|grub-mkconfig -o /boot/grub/grub.cfg}}重新生成 GRUB 配置。<br />
<br />
== 应用程序 ==<br />
<br />
=== 浏览器 ===<br />
<br />
==== Firefox ====<br />
<br />
Firefox 应到使用 [[#GDK 3 (GTK+ 3)]] 的设置。但是,建议的 {{ic|GDK_SCALE}} 可能会使 Firefox 界面的缩放并不一致,并且不能使用小数.你可以使用{{ic|GDK_DPI_SCALE}}来代替。<br />
<br />
要覆盖这些设置,请打开 Firefox 的高级选项页面({{ic|about:config}})并将 {{ic|layout.css.devPixelsPerPx}} 设置为 {{ic|2}}(或是其它需要的数值),但这个选项也可能导致 Firefox 界面的缩放不一致。如果 Firefox 没有缩放字体,您可能需要创建 {{ic|userChrome.css}} 并添加适当的样式。有关 {{ic|userChrome.css}},请访问[http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine]。<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|@namespace url("https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{警告|下面的扩展不支持 Firefox Quantum (57版本及以上)。}}<br />
<br />
如果你将 HiDPI 显示器与另一台显示器一起使用,你可以使用 [https://github.com/ertug/autohidpi AutoHiDPI] 来自动调整。另外,从 Firefox 49 以来,它会自动根据您的屏幕分辨率调整缩放,从而更容易处理多个屏幕的情况。<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium 应当使用[[#GDK 3 (GTK+ 3)]]设置。<br />
<br />
要覆盖这一选项,请使用{{ic|1=--force-device-scale-factor}} flags。这将缩放所有内容。例如:{{ic|1=chromium --force-device-scale-factor=2}}。<br />
<br />
当此选项设为1时将会采用正常缩放,此选项也可以使用小数。要永久应用此更改,对于Chromium,可以将其添加到{{ic|~/.config/chromium-flags.conf}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=--force-device-scale-factor=2}}<br />
<br />
对于Chrome,使用 {{ic|~/.config/chrome-flags.conf}}。<br />
<br />
如果你将 HiDPI 显示器与另一台显示器一起使用,你可以使用 [https://chrome.google.com/webstore/detail/resolution-zoom/enjjhajnmggdgofagbokhmifgnaophmh reszoom] 扩展。这个扩展将会根据所在屏幕自动调整缩放。<br />
<br />
==== Opera ====<br />
<br />
Opera 应当使用 [[#GDK 3 (GTK+ 3)]] 设置。<br />
<br />
要覆盖这一选项,请使用 {{ic|1=--alt-high-dpi-setting=X}} 命令行选项。其中 X 是所需的 DPI。例如,使用 {{ic|1=--alt-high-dpi-setting=144}} Opera 将认为 DPI 是 144。在较新版本中,Opera 将使用字体DPI(在 KDE 中可以强制设置字体 DPI)。<br />
<br />
=== Thunderbird ===<br />
<br />
参见[[#Firefox]]。要访问 {{ic|about:config}},打开 '''首选项'''→'''高级'''→'''配置编辑器'''。<br />
<br />
=== Wine程序 ===<br />
<br />
运行<br />
$ winecfg<br />
并且更改'''显示'''选项卡中的 DPI。这仅影响字体大小。<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}}) 使用 [[#GDK 3 (GTK+ 3)]]。<br />
<br />
=== Spotify ===<br />
<br />
您可以简单的使用 {{ic|Ctrl++}} 和 {{ic|Ctrl+-}} 来调整缩放。使用 {{ic|Ctrl+0}} 来恢复默认缩放。缩放设置保存在{{ic|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs}},您可能需要自行创建该设置文件:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|<nowiki><br />
app.browser.zoom-level=100<br />
</nowiki>}}<br />
<br />
Spotify 也可以使用自定义的缩放启动。这个系数和{{ic|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs}}中的系数相乘的积是实际的缩放倍数。<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Zathura 文档查看器 ===<br />
<br />
文档缩放应当开箱即用。<br />
<br />
UI缩放可以在[https://pwmt.org/projects/zathura/documentation/ 配置文件]中设置 (注意 "font" 是一个[https://pwmt.org/projects/girara/options/ girara option]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Sublime Text 3 ===<br />
<br />
Sublime Text 3 完整支持显示缩放。在 '''设置''' → '''用户设置''' 中添加 {{ic|"dpi_scale": 2.0}} [https://blog.wxm.be/2014/08/30/sublime-text-3-and-high-dpi-on-linux.html (来源)]。<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
IntelliJ IDEA 15 及以上应有对 HiDPI 的支持,[https://blog.jetbrains.com/idea/2015/07/intellij-idea-15-eap-comes-with-true-hidpi-support-for-windows-and-linux/] 如果这不能工作最简便的解决办法可能是覆盖默认的字体设置:<br />
<br />
:''File -> Settings -> Behaviour & Appearance -> Appearance''<br />
<br />
[https://youtrack.jetbrains.com/issue/IDEA-114944 14版本]中将 {{ic|1=-Dhidpi=true}} 添加到 {{ic|$HOME/.IdeaC14/}} 或 {{ic|/usr/share/intelligj-idea-ultimate-edition/bin/}} 的方法应该不再需要了。<br />
<br />
=== NetBeans ===<br />
<br />
NetBeans 可以在启动时用{{ic|1=--fontsize}}选项设置字体大小。要要使此设置永久生效,编辑{{ic|1=/usr/share/netbeans/etc/netbeans.conf}},添加{{ic|1=--fontsize}}到{{ic|1=netbeans_default_options}}。[https://web.archive.org/web/20210117211145/http://wiki.netbeans.org/FaqFontSize]<br />
<br />
编辑器字体大小可以在 Tools → Option → Fonts & Color 中设置。<br />
<br />
输出窗口的字体大小可以在Tools → Options → Miscelaneous → Output中控制。<br />
<br />
=== Gimp 2.8 ===<br />
<br />
使用 HiDPI主题,或是更改现有主题的 {{ic|1=gtkrc}}。(Change all occurrences of the size {{ic|1=button}} to {{ic|1=dialog}},例如{{ic|1=GimpToolPalette::tool-icon-size}}。)<br />
<br />
另外也有 [https://github.com/jedireza/gimp-hidpi gimp-hidpi]。<br />
<br />
=== Steam ===<br />
<br />
==== 官方 HiDPI支持 ====<br />
<br />
* 从2018年1月25日开始,测试版本已经支持HiDPI并能自动启用。<br />
* '''Steam''' → '''设置''' → '''界面''' → '''勾选''' '''"按照显示器大小放大图标和文本(需要重启)"'''<br />
* 如果自动检测并不能正确工作,使用{{ic|1=GDK_SCALE=2}}来指定缩放级别。<br />
<br />
==== 非官方 ====<br />
<br />
使用 [https://github.com/MoriTanosuke/HiDPI-Steam-Skin HiDPI-Steam-Skin] 可以增大字体大小,虽然并不完美,但至少能用。<br />
<br />
{{注意|皮肤的 README 列出了皮肤应当放置的位置。正确的位置下面应该有一个叫 {{ic|1=skins_readme.txt}}的文件。}}<br />
<br />
[https://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] 也可以使用。<br />
<br />
=== Java 程序 ===<br />
<br />
可以通过设置 {{ic|sun.java2d.uiScale}} 来缩放使用 AWT/Swing 框架的 Java 程序。例如:<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_application.jar<br />
<br />
从 Java 9 开始,{{ic|GDK_SCALE}} 也可以缩放 Swing 程序。<br />
<br />
=== Mono 程序 ===<br />
<br />
根据 [https://bugzilla.xamarin.com/35/35870/bug.html],Mono 程序应像 [[#GDK 3 (GTK+ 3)|GTK3]] 程序一样缩放。<br />
<br />
=== MATLAB ===<br />
<br />
[[MATLAB]] 的近期版本(R2017b)可以设置缩放:<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
此设置将在重启 Matlab 后生效。<br />
<br />
=== VirtualBox ===<br />
<br />
{{注意|仅适用于启用了缩放的 KDE。}}<br />
<br />
VirtualBox 按照系统的缩放级别缩放虚拟监视器,从而降低虚拟机的最大分辨率(参见[https://www.virtualbox.org/ticket/16604])。<br />
<br />
可以单独缩小 VirtualBox 来绕过这个问题:<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<br />
<br />
=== Zoom ===<br />
<br />
可以指定{{ic|1=QT_SCALE_FACTOR}}来启动 Zoom:<br />
<br />
$ QT_SCALE_FACTOR=2 zoom<br />
<br />
=== 不支持的程序 ===<br />
<br />
{{AUR|run_scaled-git}} 可以缩放应用程序(内部使用{{Pkg|xpra}})。<br />
<br />
另一个办法是使每个程序在各自的 VNC 桌面上运行。要缩放 VNC 查看器,使用{{AUR|vncdesk-git}}。你可以为每个程序设置单独的桌面,使用简单的命令启动客户端和服务端,例如{{ic|vncdesk 2}}。<br />
<br />
[[x11vnc]] 有一个实验性的选项 {{ic|-appshare}},可以为每个窗口单独打开一个 VNC 查看器。也许我们可以在上面做些文章。<br />
<br />
== 多显示器 ==<br />
<br />
HIDPI 将会对整个桌面生效,所以如果你同时使用普通显示器,那么在普通显示器上元素会变得过于巨大。但是[[Wayland]] 已经支持为每个显示器设置单独的缩放。<br />
<br />
=== Side display ===<br />
<br />
{{Out of date|1=The bug with the mouse unable to reach the whole screen should be [https://bugs.freedesktop.org/show_bug.cgi?id=39949#c80 fixed in xorg 1.20].}}<br />
<br />
One workaround is to use [[xrandr]]'s scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:<br />
<br />
xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
When extending above the internal display, you may see part of the internal display on the external monitor. In that case, specify the position manually, e.g. using [https://gist.github.com/wvengen/178642bbc8236c1bdb67 this script].<br />
<br />
You may run into problems with your mouse not being able to reach the whole screen. That is a [https://bugs.freedesktop.org/show_bug.cgi?id=39949 known bug] with an xserver-org patch (or try the panning option, but that might cause other problems).<br />
<br />
An example of the panning syntax for a 4k laptop with an external 1920x1080 monitor to the right:<br />
<br />
xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning 3840x2160+3840+0 --scale 2x2 --right-of eDP-1<br />
<br />
Generically if your HiDPI monitor is AxB pixels and your regular monitor is CxD and you are scaling by [ExF], the commandline for right-of is:<br />
<br />
xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning [C*E]x[D*F]+[A]+0 --scale [E]x[F] --right-of eDP-1<br />
<br />
If panning is not a solution for you it may be better to set position of monitors and fix manually the total display screen.<br />
<br />
An example of the syntax for a 2560x1440 WQHD 210 DPI laptop monitor (eDP1) using native resolution placed below a 1920x1080 FHD 96 DPI external monitor (HDMI) scaled to match global DPI settings:<br />
<br />
xrandr --output eDP-1 --auto --pos 0x1458 --output HDMI-1 --scale 1.35x1.35 --auto --pos 0x0 --fb 2592x2898<br />
<br />
The total screen size (--fb) and positioning (--pos) are to be calculated taking into account the scaling factor.<br />
<br />
In this case laptop monitor (eDP1) has no scaling and uses native mode for resolution so it will total 2560x1440, but external monitor (HDMI) is scaled and it has to be considered a larger screen so (1920*1.35)x(1080*1.35) from where the eDP1 Y position came 1080*1.35=1458 and the total screen size: since one on top of the other X=(greater between eDP1 and HDMI, so 1920*1.35=2592) and Y=(sum of the calculated heights of eDP1 and HDMI, so 1440+(1080*1.35)=2898).<br />
<br />
Generically if your hidpi monitor is AxB pixels and your regular monitor is CxD and you are scaling by [ExF] and hidpi is placed below regular one, the commandline for right-of is:<br />
<br />
xrandr --output eDP-1 --auto --pos 0x(DxF) --output HDMI-1 --auto --scale [E]x[F] --pos 0x0 --fb [greater between A and (C*E)]x[B+(D*F)]<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{Note (简体中文)|1=Above solution with {{ic|--scale 2x2}} does not work on some Nvidia cards. No solution is currently available. [https://bbs.archlinux.org/viewtopic.php?pid=1670840] A potential workaround exists with configuring {{ic|1=ForceFullCompositionPipeline=On}} on the {{ic|CurrentMetaMode}} via {{ic|nvidia-settings}}. For more info see [https://askubuntu.com/a/979551].}}<br />
<br />
=== 多外部监视器 ===<br />
<br />
如果你有多于个低于内置的 HiDPI 显示器 DPI 的显示器,那么可能会碰到一些问题。这种情况下您可以想要缩小 HiDPI 显示器的内容,例如:<br />
<br />
xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
另外,当您缩小内置 HIDPI 显示器中的内容时,内置显示器的字体可能会变得有些模糊。但这与扩大外置显示器内容时带来的模糊并不相同。您可以对比之后选择自己想要的方案。<br />
<br />
=== 镜像 ===<br />
<br />
如果你只想使用镜像的话,可以按照如下操作:<br />
<br />
A×B是你 HiDPI 显示器的原生分辨率,CxD 是你的另一个显示器的原生分辨率。<br />
<br />
xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
一个 QHD 的例子(3200/1920 = 1.66 and 1800/1200 = 1.5):<br />
<br />
xrandr --output HDMI --scale 1.66x1.5<br />
<br />
UHD和1080p的例子 (3840/1920=2 2160/1080=2):<br />
<br />
xrandr --output HDMI --scale 2x2<br />
<br />
您可以调整显示器上的清晰度选项以减少模糊感。<br />
<br />
== Linux 控制台 ==<br />
<br />
默认的 [[w:Linux console|Linux 控制台]]在 HiDPI 显示器上太小了。{{Pkg|kbd}}中最大的字体是{{ic|latarcyrheb-sun32}},其他软件包中包含一些更大的字体,例如{{Pkg|terminus-font}}中的{{ic|ter-132n}}和{{ic|ter-132b}}(粗体)。参阅[[Linux console#Fonts]]获取配置详情。<br />
<br />
在改变字体之后,当您切换到其他控制台时,屏幕上的内容可能无法读取。要修复这一问题,你可以设置[[Kernel_mode_setting#Forcing_modes_and_EDID|force specific mode]],例如{{ic|1=video=2560x1600@60}}(设为您显示器的原生分辨率)并重新启动。<br />
<br />
== 另请参阅 ==<br />
<br />
* [https://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [https://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]</div>Fincehttps://wiki.archlinux.org/index.php?title=ArchWiki:Translation_Team_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726963ArchWiki:Translation Team (简体中文)2022-04-19T11:44:29Z<p>Fince: 修改页面维护列表</p>
<hr />
<div>[[Category:ArchWiki (简体中文)]]<br />
[[Category:Teams (简体中文)]]<br />
[[ar:ArchWiki:Translation Team]]<br />
[[cs:ArchWiki:Translation Team]]<br />
[[el:ArchWiki:Translation Team]]<br />
[[en:ArchWiki:Translation Team]]<br />
[[es:ArchWiki:Translation Team]]<br />
[[fi:ArchWiki:Translation Team]]<br />
[[fr:ArchWiki:Translation Team]]<br />
[[hr:ArchWiki:Translation Team]]<br />
[[it:ArchWiki:Translation Team]]<br />
[[ja:ArchWiki:翻訳チーム]]<br />
[[ko:ArchWiki:Translation Team]]<br />
[[nl:ArchWiki:Translation Team]]<br />
[[pl:ArchWiki:Translation Team]]<br />
[[pt:ArchWiki:Translation Team]]<br />
[[ru:ArchWiki:Translation Team]]<br />
[[sk:ArchWiki:Translation Team]]<br />
[[tr:ArchWiki:Translation Team]]<br />
[[uk:ArchWiki:Translation Team]]<br />
[[zh-hant:ArchWiki:Translation Team]]<br />
ArchWiki 上有许多中文页面,这其中大部分是从外文翻译过来的,这些页面是无数中文志愿者劳动的结晶。随着时间推移,有些页面因为没有及时维护,内容严重过时。而目前的翻译工作缺少组织,效率偏低。所以参照西班牙和意大利翻译组的做法,添加这个页面。<br />
<br />
如果你希望对 ArchWiki 做贡献,参与 Wiki 建设,比如翻译英文页面和对已翻译过的中文页面进行维护,只需要编辑下面的[[#页面维护列表]],添加相应的条目,并将自己加为相关页面的维护者。如果你在列表中还没有找到想要翻译的页面,可以自行添加。另外,如果因为时间原因无法再维护页面,请及时将自己从维护者列表中删除。<br />
<br />
== 创建翻译 ==<br />
<br />
{{警告|如果不准备翻译页面的大部分内容,请尽量不要新建简体中文页面。检查英文页面的更新需要花费不少精力,没有翻译的页面会增加维护负担。}}<br />
# 如果还不知道如何编辑 wiki,请阅读[[Help:Editing (简体中文)|编辑帮助]]。<br />
# 阅读 [[Help:i18n (简体中文)|i18n 帮助]],文章给出了 ArchWiki 国际化和本地化的指南。<br />
# [[Special:UserLogin|登录]]以进行编辑。<br />
# 选择要翻译的页面,例如从[[Special:Random|随机页面]]或[[#页面维护列表|页面维护列表]]中选择一个未翻译完成的页面。假设要翻译 [[ArchWiki:Translation Team]]。<br />
# 进入选择的英文页面,点击页面顶部的'''编辑'''。<br />
# 添加要翻译文件的语言间链接, 简体中文的话加入 <nowiki>[[zh-hans:Some Page]]</nowiki>,其它语言参见 [[Help:i18n#Interlanguage links]])。<br />
# 复制所有页面代码。<br />
# 预览页面 (新加了语言链接)<br />
# 访问页面左边新添加的语言链接,应该会进到 [[ArchWiki Translation Team (Language)]](打开新标签页,不要关闭预览的页面)<br />
# 因为页面不存在,点击'''创建'''。<br />
# 将显示一个编辑器 - 粘贴复制的英文页面。<br />
# 将文章分类修改为本地化版本,例如将 {{ic|<nowiki>[[Category:ArchWiki]]</nowiki>}} 修改为 {{ic|<nowiki>[[Category:ArchWiki (简体中文)]]</nowiki>}},参阅 [[Help:Category (简体中文)]].<br />
# 修改语言间链接,指向英文页面(将 {{ic|zh-hans}} 修改为 {{ic|en}},并将英文页面的语言间链接移到文章顶部)。<br />
# 翻译页面,进行保存,还需要使用合适的[[Help:Style (简体中文)#编辑摘要|编辑摘要]],例如 {{ic|translate <nowiki>[[ArchWiki Translation Team]]</nowiki>}}。碰到不好翻译的段落,可以保留英文。尽量不要让原文和不太确认的翻译同时存在,会让页面看上去比较杂乱。<br />
# 在翻译页面的底部,列出了该页面所包含的类别。检查所有这些类别是否存在,即,链接不应为红色。否则,请点击红色链接,然后创建所有缺少的类别 - 类别的创建方式与常规页面相同。<br />
# 返回预览的页面并保存页面。<br />
# (可选)将 [[Template:TranslationStatus (简体中文)]] 添加到已翻译的页面。有关使用方法,请参见 [[Template:TranslationStatus (简体中文)#用法]]。<br />
# (可选)创建另一个页面,例如 [[ArchWiki Translation Team 的翻译后的标题]],其标题将是 [[ArchWiki Translation Team (语言)]] 的标题的翻译,输入 {{ic|<nowiki>#redirect [[ArchWiki Translation Team (Language)</nowiki>]]}} 作为其唯一内容并保存。<br />
<br />
== 模板 ==<br />
<br />
下表列出了应翻译的英文[[Help:Template (简体中文)|模板]]及其等效的简体中文模板。<br />
<br />
{| class=wikitable<br />
! 英文模板 || 简体中文模板<br />
|-<br />
! colspan=2| 文章模板<br />
|-<br />
| [[Template:Related articles start]] || [[Template:Related articles start (简体中文)]]<br />
|-<br />
| [[Template:Unsupported]] || [[Template:Unsupported (简体中文)]]<br />
|-<br />
| [[Template:Yes]] || [[Template:是]]<br />
|-<br />
| [[Template:No]] || [[Template:否]]<br />
|-<br />
| [[Template:Tip]] || [[Template:提示]]<br />
|-<br />
| [[Template:Note]] || [[Template:注意]]<br />
|-<br />
| [[Template:Warning]] || [[Template:警告]]<br />
|-<br />
| [[Template:Dead link]] || [[Template:Dead link (简体中文)]]<br />
|-<br />
| [[Template:Broken package link]] || [[Template:Broken package link (简体中文)]]<br />
|-<br />
| [[Template:Broken section link]] || [[Template:Broken section link (简体中文)]]<br />
|-<br />
! colspan=2| 翻译状态模板<br />
|-<br />
| [[Template:Bad translation]] || [[Template:Bad translation (简体中文)]]<br />
|-<br />
| [[Template:Translateme]] || [[Template:Translateme (简体中文)]]<br />
|-<br />
| [[Template:TranslationStatus]] || [[Template:TranslationStatus (简体中文)]]<br />
|-<br />
! colspan=2| 导航模板<br />
|-<br />
| [[Template:Laptops table header]] || [[Template:Laptops table header (简体中文)]]<br />
|-<br />
| [[Template:Laptops navigation]] || [[Template:Laptops navigation (简体中文)]]<br />
|-<br />
| [[Template:List of applications navigation]] || [[Template:List of applications navigation (简体中文)]]<br />
|-<br />
| [[Template:Package guidelines]] || [[Template:Package guidelines (简体中文)]]<br />
|-<br />
! colspan=2| 特殊模板<br />
|-<br />
| [[Template:Cat main]] || [[Template:Cat main (简体中文)]]<br />
|-<br />
| [[Template:Template]] || [[Template:Template (简体中文)]]<br />
|-<br />
| [[Template:META Error]] || [[Template:META Error (简体中文)]]<br />
|-<br />
| [[Template:META Unexplained Status Template]] || [[Template:META Unexplained Status Template (简体中文)]]<br />
|-<br />
| [[Template:Comment]] || [[Template:Comment (简体中文)]]<br />
|-<br />
| [[Template:Committed identity]] || [[Template:Committed identity (简体中文)]]<br />
|-<br />
| [[Template:Unsigned]] || [[Template:Unsigned (简体中文)]]<br />
|}<br />
<br />
== 翻译中应省略的模板 ==<br />
<br />
当页面或部分标记有 [[Template:Accuracy]],[[Template:Style]],[[Template:Archive]],[[Template:Remove]] 或 [[Template:Out of date]] 时 — 在解决问题并且删除模板之前,不要翻译有问题的页面/部分。<br />
<br />
如果看到 [[Template:Expansion]],[[Template:Merge]],[[Template:Move]] 或 [[Template:Redirect]],则可以安全地翻译页面,但不要将这些模板复制到翻译的文章中。<br />
<br />
如果看到 [[Template:Broken package link]],[[Template:Broken section link]] 或 [[Template:Dead link]],请不要将这些模板复制到翻译的文章中。要么在原始文本中将其修复,然后复制并在要翻译时翻译修复的链接,要么在翻译时忽略与它们有关的整个句子或部分。<br />
<br />
== 完善翻译 ==<br />
<br />
[https://wiki.archlinux.org/index.php?title=Special:WhatLinksHere/Template:Translateme_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&limit=100 这个特殊页面]包含了需要完善翻译的简体中文页面。完善翻译的基本步骤:<br />
# 选择自己比较熟悉的文章进行翻译<br />
# 先检查英文页面的对应段落,更新成最新的英文后再翻译,避免翻译过时的内容,减少信息遗漏。<br />
# 翻译完成后删除页面中的 <nowiki>{{translateme (简体中文)}}</nowiki> 标记<br />
# (可选)给翻译完成的页面加上[[Template:TranslationStatus (简体中文)|翻译状态]],请参见 [[#创建翻译]]。<br />
<br />
== 更新过期页面 ==<br />
<br />
如果发现有 Wiki 页面过期或错误:<br />
* 小的改动,有时间可以立即进行修改同步,维护者并不控制页面的编辑权限,越多的人参与维护越好。如果改动较大,请先联系维护者,避免重复劳动。<br />
* 没有时间查看更改,请给页面加上 {{ic|<nowiki>{{out of date}}</nowiki>}} 模板,这样其他贡献者更容易发现需要更新的页面,而读者看到过期标记就可以直接查看英文页面,以免被错误内容误导,白白耽误时间。<br />
* 没有时间翻译,请将过期的中文部分删去,从英文页面中复制更改的部分到中文页面的相应部分,去掉{{ic|<nowiki>{{out of date}}</nowiki>}}模板(如果页面上有的话)并加上{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他贡献者就更容易发现需要翻译的页面,而读者也不会被过期的内容误导。<br />
如果发现有页面未翻译:<br />
* 有时间的话,请将页面中的英文部分翻译为中文,并去掉{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板。<br />
* 没有时间翻译,请为页面添加{{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}}模板,这样其他的贡献者就能更容易发现需要翻译的页面。<br />
{{注意|在修改页面上的模板时,请同时更新页面维护列表的翻译状态。}}<br />
<br />
== 维护翻译 ==<br />
<br />
完成页面的翻译只是初步完成任务,及时同步英文页面改动、更新翻译是一个持续性的工作,可能会耗费更多的时间。<br />
<br />
=== 页面认领 ===<br />
<br />
所有人都可以认领页面。认领后的责任包括进行翻译,关注英文页面的改动,及时同步翻译。<br />
<br />
为了更好的跟踪英文页面的修改,请务必在设置中启用监视列表邮件通知,并监视对应的英文页面(从设置中找到监视列表,加入英文页面。或者直接到英文页面点击页面顶端的监视标签。这样只要有改动,就会收到邮件通知)。<br />
<br />
{{小贴士|如果收到邮件通知后没有访问页面或者访问了页面却没有登录用户,下次页面改动时就不会再发邮件通知。可以点击监视列表中的'''标记所有页面为已读'''再次获取更新。}}<br />
<br />
如果页面有维护者但长期得不到更新,将会在维护列表中删除维护者。<br />
<br />
=== 翻译状态模板 ===<br />
<br />
Arch 作为滚动发行版,软件变化比较快,对应的文档变化也比较快。许多翻译的文章由于缺乏更新,会产生命令运行出错或不起作用等问题。而由于这些过期页面没有及时标记出来,所以用户无法及时获得更新。[[Template:TranslationStatus (简体中文)|翻译状态模板]]就是为了解决这个问题而创建。<br />
<br />
此模板可以起到如下作用:<br />
* 为用户提供翻译状况,包括翻译时间、英文页面的最后版本等<br />
* 用户可以点击查看翻译后,英文页面的改动,这样英文不是很好的用户可以只查看很小一部分英文内容,并判断出是否影响操作。<br />
* 翻译人员可以跟踪页面状况,通过[[Special:WhatLinksHere/Template:TranslationStatus_(简体中文)|模板的反向链接]]可以查找到所有标记页面,查看需要更新翻译的部分。<br />
<br />
[[Template:TranslationStatus (简体中文)|模板页面]]有详细的使用方法。<br />
<br />
=== 页面维护列表 ===<br />
<br />
{{注意|请按照拉丁字母顺序添加页面。}}<br />
<br />
翻译状态说明:<br />
;过期:页面内容未与英文页面同步,对应 {{ic|<nowiki>{{out of date}}</nowiki>}} 模板<br />
;未翻译:页面中含有英文内容,对应 {{ic|<nowiki>{{translateme (简体中文)}}</nowiki>}} 模板<br />
;完成:页面已与英文页面同步<br />
<br />
{| class="wikitable sortable collapsible" border="1"<br />
|-<br />
! 页面<br />
! 翻译状态<br />
! 维护者<br />
! class="unsortable" width="30%" | 备注<br />
|-<br />
| [[Arch-based distributions (简体中文)]]<br />
| 完成<br />
| Joshua<br />
| 勘误中<br />
|-<br />
| [[Arch boot process (简体中文)]]<br />
| 翻译中<br />
| Bangbo Zheng<br />
| <br />
|-<br />
| [[Arch Security Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Arch Testing Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[ArchWiki:Maintenance Team (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[ArchWiki:News (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Aria2 (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[ASCII art (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[AUR helpers (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 部分用词可能需要修改<br />
|-<br />
| [[Bash (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[Common Desktop Environment (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Conky (简体中文)]]<br />
| 完成<br />
| upi<br />
| 无<br />
|-<br />
| [[ConnMan (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[Core utilities (简体中文)]]<br />
| 完成<br />
| rentaro, Arisaka<br />
| 无<br />
|-<br />
| [[Dark mode switching (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Discord (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Django (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Dynamic Kernel Module Support (简体中文)]]<br />
| 完成<br />
| Mithrandir<br />
| 完善中<br />
|-<br />
| [[Emacs (简体中文)]]<br />
| 翻译中<br />
| Jaurung yuanhang<br />
| 未完成<br />
|-<br />
| [[Equinox Desktop Environment (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[FHEM (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中 <br />
|-<br />
| [[Flatpak (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Fwupd (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Gcin (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[GIMP (简体中文)]]<br />
| 完成<br />
| [[User:驿窗|驿窗]]<br />
| 长期维护中<br />
|-<br />
| [[GNOME (简体中文)]]<br />
| 完成<br />
| skywet<br />
| <br />
|-<br />
| [[Google Authenticator (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[GRUB (简体中文)]]<br />
| 完成<br />
| [[User:Reverier|Reverier]]<br />
| 长期维护中<br />
|-<br />
| [[GRUB/Tips and tricks (简体中文)]]<br />
| 完成<br />
| [[User:Reverier|Reverier]]<br />
| 长期维护中<br />
|-<br />
| [[Heirloom (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Inkscape (简体中文)]]<br />
| 完成<br />
| [[User:驿窗|驿窗]]<br />
| 长期维护中<br />
|-<br />
| [[Install Arch Linux from existing Linux (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[Install Arch Linux with accessibility options (简体中文)]]<br />
| 完成<br />
| [[User:Albertwang1988|Albert Wang]]<br />
| 长期维护中<br />
|-<br />
| [[Installation guide (简体中文)]]<br />
| 完成<br />
| [[User:Whiredplanck|WhiredPlanck]]<br />
| 长期维护中<br />
|-<br />
| [[International communities (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Java (简体中文)]]<br />
| 完成<br />
| [[User:Fince|Fince]]<br />
| 长期维护中<br />
|-<br />
| [[Kernel live patching (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[KRunner (简体中文)]]<br />
| 完成<br />
| [[User:Reverier|Reverier]]<br />
| 长期维护中<br />
|-<br />
| [[Lenovo Thinkpad T14 (AMD) Gen 1 (简体中文)]]<br />
| 完成<br />
| [[User:Albertwang1988|Albert Wang]]<br />
| 长期维护中<br />
|-<br />
| [[Libvirt (简体中文)]]<br />
| 完成<br />
| Kurobac<br />
| 需要格式改进<br />
|-<br />
| [[Liri (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|- <br />
| [[List of applications (简体中文)]]<br />
| 部分翻译<br />
| DavidChen<br />
| 翻译中<br />
|-<br />
| [[Lua (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Lumina (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Minecraft (简体中文)]]<br />
| 完成<br />
| Xavier Lau<br />
| 页面已经与英文版同步,长期维护中<br />
|-<br />
| [[Mirrors (简体中文)]]<br />
| 完成<br />
| [[User:IInfo|IInfo]]<br />
| 长期维护中<br />
|-<br />
| [[Moksha (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[MySQL (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Network configuration (简体中文)]]<br />
| 完成<br />
| [[User:Chirsz|Chirsz]]<br />
| 更新相关页面<br />
|-<br />
| [[Node.js package guidelines (简体中文)]]<br />
| 完成<br />
| [[User:FENPRACE|FENPRACE]]<br />
| 长期维护中<br />
|-<br />
| [[Notion (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Openbox (简体中文)]]<br />
| 未完成<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
| 翻译中<br />
|-<br />
| [[OpenSSH (简体中文)]]<br />
| 完成<br />
| Arisaka<br />
| 无<br />
|-<br />
| [[Pacman (简体中文)]]<br />
| 翻译中<br />
| [[User:Miswanting|Miswanting]]<br />
| 同步中<br />
|-<br />
| [[pkgstats (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|- <br />
| [[PKGBUILD (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|- <br />
| [[Polybar (简体中文)]]<br />
| 完成<br />
| [[User:Wjhmrc|Wjhmrc]]<br />
| 长期维护中<br />
|- <br />
| [[QEMU (简体中文)]]<br />
| 完成<br />
| Heersin<br />
| 长期维护中<br />
|- <br />
| [[ranger (简体中文)]]<br />
| 完成<br />
| Jason Zhang<br />
| 完善中<br />
|-<br />
| [[Rockbox (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Roles (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Rxvt-unicode (简体中文)]]<br />
| 完成<br />
| KyanCh<br />
| 无<br />
|-<br />
| [[Scheme (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[SDDM (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Steam (简体中文)]]<br />
| 完成<br />
| C0n5t4ntK<br />
| 长期维护中<br />
|-<br />
| [[Syslinux (简体中文)]]<br />
| 完成<br />
| [[User:VictriD|VictriD]]<br />
| 无<br />
|-<br />
| [[TLP (简体中文)]]<br />
| 完成<br />
| Skywet<br />
| 持续更新中<br />
|-<br />
| [[Trac (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Trusted Users (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Twm (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Unofficial mirrors (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Unofficial user repositories (简体中文)]]<br />
| 翻译中<br />
| TransistorLogic<br />
| 无<br />
|-<br />
| [[UP Squared (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Vivaldi (简体中文)]]<br />
| 完成<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
| 长期维护<br />
|-<br />
| [[Webmin (简体中文)]]<br />
| 完成<br />
| [[User:Blackteahamburger|Blackteahamburger]]<br />
| 长期维护中<br />
|-<br />
| [[Wine (简体中文)]]<br />
| 翻译中<br />
| [[User:InsaneGuo|InsaneGuo]]<br />
| <br />
|-<br />
| [[Windows PE (简体中文)]]<br />
| 完成<br />
| [[User:呼啦呼啦~|呼啦呼啦~]]<br />
| 无<br />
|-<br />
| [[WireGuard (简体中文)]]<br />
| 翻译中<br />
| [[User:Johnpoint|Johnpoint]]<br />
| 正在翻译现有版本,未同步英文版本<br />
|- <br />
| [[X2Go (简体中文)]]<br />
| 过期<br />
| [[User:Aaron Chen|Aaron Chen]]<br />
|</div>Fincehttps://wiki.archlinux.org/index.php?title=Java_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726962Java (简体中文)2022-04-19T11:38:18Z<p>Fince: /* 提示和技巧 */ minor fix</p>
<hr />
<div>[[Category:Programming languages (简体中文)]]<br />
[[Category:Oracle (简体中文)]]<br />
[[de:Java]]<br />
[[en:Java]]<br />
[[fa:Java]]<br />
[[ja:Java]]<br />
[[pt:Java]]<br />
[[ru:Java]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Java package guidelines (简体中文)}}<br />
{{Related|Java Runtime Environment Fonts}}<br />
{{Related articles end}}<br />
<br />
{{TranslationStatus (简体中文)|Java|2022-04-19|726950}}<br />
<br />
<br />
<br />
摘自维基百科中的 [[Wikipedia:Java (programming language)|Java]] 词条:<br />
<br />
:Java是一种编程语言,最初由Sun Microsystems开发,并于1995年作为Sun Microsystems的Java平台的核心组件发布。它有很多语法来自C和C++,但对象模型更简洁,底层组件更少。Java的应用一般会编译成能在任何Java虚拟机([[Wikipedia:Java virtual machine|JVM]])而不是特定架构上运行的字节码。<br />
<br />
Arch Linux官方支持开源的第7、8、11和17版的 [https://openjdk.java.net/ OpenJDK]。这些JVM可以并存,并能够通过帮助脚本{{Ic|archlinux-java}}切换。在 [[Arch User Repository (简体中文)|AUR]]中也有一些不受官方支持的Java环境。<br />
<br />
== 安装 ==<br />
<br />
{{Note (简体中文)|<br />
* Arch Linux官方只支持 [[#OpenJDK|OpenJDK]] 实现.<br />
* 刚安装完成的Java环境还无法被Shell({{Ic|$PATH}} 变量)识别。可以在命令行中使用{{Ic|source}}命令读取{{Ic|/etc/profile}},重启,或者注销并重新登入桌面环境来正确更新。}}<br />
<br />
两个''常见的''包经常作为其它包的依赖,分别是 {{Pkg|java-runtime-common}} (包含Java运行环境(JRE)的公共文件) 和 {{Pkg|java-environment-common}} (包括Java开发包(JDK)的公共文件)。包提供的环境配置文件 {{Ic|/etc/profile.d/jre.sh}} 指向由 {{ic|archlinux-java}} 帮助脚本设置的链接 {{Ic|/usr/lib/jvm/default/bin}}。<br />
<br />
{{警告| '''务必'''使用 {{Ic|archlinux-java}}编辑 {{Ic|/usr/lib/jvm/default}} 和 {{Ic|/usr/lib/jvm/default-runtime}} 这两个链接。 }}<br />
<br />
这些链接用来指示位于 {{Ic|<nowiki>/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME}</nowiki>}} 的默认Java运行环境,或位于 {{Ic|<nowiki>/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME}/jre</nowiki>}} 的Java运行环境。<br />
<br />
大多数安装的可执行文件都以链接的形式放在 {{Ic|/usr/bin}} 中,其他可执行文件则在 {{Ic|$PATH}} 指向的位置处。{{Ic|/etc/profile.d/jdk.sh}} 已经不再在包中提供了。<br />
<br />
=== OpenJDK ===<br />
<br />
[[Wikipedia:OpenJDK|OpenJDK]]是Java平台标准版(Java SE)的开源实现,也是官方的参考实现。有几个OpenJDK构建的分发,如[https://adoptium.net Adoptium](以前称为AdvertOpenJDK)和[https://aws.amazon.com/corretto/ Amazon Corretto]。Arch Linux的OpenJDK包由[https://hg.openjdk.java.net/ 上游的OpenJDK源代码]构建。<br />
<br />
;Headless JRE: Java的最小运行环境 - 执行非GUI的Java程序所需。<br />
;Full JRE: 完全的Java运行环境 - 执行Java GUI程序所需,依赖于headless JRE。<br />
;JDK:[[Wikipedia:Java Development Kit|Java Development Kit]] - Java开发所需, 依赖于 full JRE。<br />
<br />
{| class="wikitable"<br />
! 版本 !! Headless JRE !! Full JRE !! JDK !! 文献 !! 源码<br />
|-<br />
| [https://openjdk.java.net/projects/jdk/17/ OpenJDK 17] || {{Pkg|jre-openjdk-headless}} || {{Pkg|jre-openjdk}} || {{Pkg|jdk-openjdk}} || {{Pkg|openjdk-doc}} || {{Pkg|openjdk-src}}<br />
|-<br />
| [https://openjdk.java.net/projects/jdk/11/ OpenJDK 11] || {{Pkg|jre11-openjdk-headless}} || {{Pkg|jre11-openjdk}} || {{Pkg|jdk11-openjdk}} || {{Pkg|openjdk11-doc}} || {{Pkg|openjdk11-src}}<br />
|-<br />
| [https://openjdk.java.net/projects/jdk8/ OpenJDK 8] || {{Pkg|jre8-openjdk-headless}} || {{Pkg|jre8-openjdk}} || {{Pkg|jdk8-openjdk}} || {{Pkg|openjdk8-doc}} || {{Pkg|openjdk8-src}}<br />
|}<br />
<br />
{{App|OpenJDK GA|Latest OpenJDK General-Availability Release build from Oracle.|https://jdk.java.net|{{AUR|java-openjdk-bin}}}}<br />
{{App|OpenJDK EA|Latest OpenJDK Early-Access build for development version from Oracle.|https://jdk.java.net|{{AUR|java-openjdk-ea-bin}}}}<br />
<br />
{{App|IcedTea-Web|Java Web Start and the deprecated Java browser plugin.|https://icedtea.classpath.org/download/icedtea-web-docs/1.8/html/en/icedtea-web.html|{{Pkg|icedtea-web}}}}<br />
<br />
=== OpenJFX ===<br />
<br />
[https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX] is the open-source implementation of [[Wikipedia:JavaFX|JavaFX]]. You [https://wiki.openjdk.java.net/display/OpenJFX/Repositories+and+Releases do not need] to install this package if you are using Oracle JDK. This package only concerns users of the open source implementation of Java (OpenJDK project), and its derivatives.<br />
<br />
{| class="wikitable"<br />
! 版本 !! 运行环境与开发 !! 文档 !! 源码<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 18] || {{Pkg|java-openjfx}} || {{Pkg|java-openjfx-doc}} || {{Pkg|java-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 17] || {{Pkg|java17-openjfx}} || {{Pkg|java17-openjfx-doc}} || {{Pkg|java17-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 11] || {{Pkg|java11-openjfx}} || {{Pkg|java11-openjfx-doc}} || {{Pkg|java11-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 8] || {{AUR|java8-openjfx}} || {{AUR|java8-openjfx-doc}} || {{AUR|java8-openjfx-src}}<br />
|}<br />
<br />
{{App|OpenJFX GA|Latest OpenJFX General-Availability Release build from Gluon.|https://openjfx.io/|{{AUR|java-openjfx-bin}}}}<br />
{{App|OpenJFX EA|Latest OpenJFX Early-Access build for development version from Gluon.|https://openjfx.io/|{{AUR|java-openjfx-ea-bin}}}}<br />
<br />
=== 其他实现 ===<br />
<br />
{{App|Oracle JDK|Oracle's commercially licensed build of OpenJDK.|https://www.oracle.com/technetwork/java/javase/downloads/index.html|{{AUR|jre}} {{AUR|jre12}} {{AUR|jre11}} {{AUR|jre10}} {{AUR|jre9}} {{AUR|jre8}} {{AUR|jre7}} {{AUR|jre6}} {{AUR|jdk}} {{AUR|jdk12}} {{AUR|jdk11}} {{AUR|jdk10}} {{AUR|jdk9}} {{AUR|jdk8}} {{AUR|jdk7}} {{AUR|jdk6}} {{AUR|jdk-devel}}}}<br />
{{App|OpenJ9|Eclipse's implementation of JRE, contributed by IBM.|https://www.eclipse.org/openj9/|{{AUR|jdk-openj9-bin}} {{AUR|jdk14-openj9-bin}} {{AUR|jdk13-openj9-bin}} {{AUR|jdk12-openj9-bin}} {{AUR|jdk11-openj9-bin}} {{AUR|jdk10-openj9-bin}} {{AUR|jdk9-openj9-bin}} {{AUR|jdk8-openj9-bin}}}}<br />
{{App|IBM Certified|IBM Semeru Runtime Certified Edition.|https://www.ibm.com/semeru-runtimes/downloads|{{AUR|jdk11-j9-bin}}}}<br />
{{App|IBM J9|IBM's implementation of JRE, using OpenJ9 contributions.|https://www.ibm.com/support/pages/java-sdk-downloads|{{AUR|jdk8-j9-bin}} {{AUR|jdk7-j9-bin}} {{AUR|jdk7r1-j9-bin}}}}<br />
{{App|Parrot VM|a VM with experimental support for Java [http://trac.parrot.org/parrot/wiki/Languages] through two different methods: either as a [https://code.google.com/p/parrot-jvm/ Java VM bytecode translator], or as a [https://github.com/chrisdolan/perk Java compiler targeting the Parrot VM]. Parrot is [https://github.com/parrot/parrot/issues/1243 not actively developed since 2017].|http://www.parrot.org/|{{AUR|parrot}}}}<br />
<br />
{{Note|Oracle JDK的32位版本可以通过前缀{{ic|bin32-}}找到,如{{AUR|bin32-jre}}。其使用{{AUR|java32-runtime-common}},功能与{{Pkg|java-runtime-common}}相同,但添加了{{ic|32}}的后缀,如{{ic|java32}}。{{AUR|java32-environment-common}}也是同理,只有32位的JDK包使用它。}}<br />
<br />
=== 开发工具 ===<br />
<br />
对于集成开发环境,见[[List of applications#Integrated development environments]] 和''Java IDEs''子分区。<br />
<br />
为了阻止逆向工程,可以使用{{AUR|proguard}}等混淆器。<br />
<br />
==== 反编译器 ====<br />
<br />
* {{App|CFR|Java decompiler, supporting modern features of Java 9, 10 and beyond.|https://www.benf.org/other/cfr/|{{AUR|cfr}}}}<br />
* {{App|Fernflower|Analytical decompiler for Java, developed as part of [[IntelliJ IDEA]].|https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine|{{AUR|fernflower-git}}}}<br />
* {{App|Krakatau|Java decompiler, assembler, and disassembler.|https://github.com/Storyyeller/Krakatau|{{AUR|krakatau-git}}}}<br />
* {{App|Procyon decompiler|Experimental Java decompiler, inspired by ILSpy and Mono.Cecil.|https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler|{{AUR|procyon-decompiler}}}}<br />
* {{App|Java Decompiler (JD-Core)|Popular Java decompiler providing a GUI (see JD-GUI) and supporting Java 1-10.|https://java-decompiler.github.io/|{{AUR|jd-core-java}}}}<br />
* {{App|Jadx|Android DEX to Java decompiler with an optional GUI (see Jadx-GUI)|https://github.com/skylot/jadx|{{Pkg|jadx}}}}<br />
* {{App|[[Wikipedia:JAD (software)|JAD]]|Unmaintained Java decompiler (last release 2006).|https://varaneckas.com/jad|{{Pkg|jad}}}}<br />
<br />
==== GUI前端 ====<br />
<br />
* {{App|Bytecode Viewer|Java reverse engineering suite, including a decompiler, editor and debugger; Frontend for CFR/Fernflower/Procyon|https://bytecodeviewer.com|{{AUR|bytecode-viewer}}}}<br />
* {{App|Recaf|An easy to use modern Java bytecode editor that abstracts away the complexities of Java programs; Frontend for CFR/Fernflower/Procyon|https://www.coley.software/Recaf/|{{AUR|recaf-bin}}}}<br />
* {{App|Java Decompiler (JD-GUI)|Popular Java decompiler providing a GUI and supporting Java 1-10; Frontend for JD-Core|https://java-decompiler.github.io/|{{AUR|jd-gui}}}}<br />
* {{App|Jadx-GUI|Android APK DEX to Java decompiler with an optional GUI; Frontend for Jadx|https://github.com/skylot/jadx|{{Pkg|jadx}}}}<br />
* {{App|Luyten|An Open Source Java Decompiler Gui; Frontend for Procyon|https://github.com/deathmarine/Luyten|{{AUR|luyten}}}}<br />
<br />
== 在JVM间切换 ==<br />
<br />
帮助脚本 {{Ic|archlinux-java}} 提供了如下功能:<br />
<br />
archlinux-java <COMMAND><br />
<br />
COMMAND:<br />
status List installed Java environments and enabled one<br />
get Return the short name of the Java environment set as default<br />
set <JAVA_ENV> Force <JAVA_ENV> as default<br />
unset Unset current default Java environment<br />
fix Fix an invalid/broken default Java environment configuration<br />
<br />
=== 列出兼容的安装了的Java环境 ===<br />
<br />
$ archlinux-java status<br />
<br />
例如:<br />
<br />
$ archlinux-java status<br />
Available Java environments:<br />
java-7-openjdk (default)<br />
java-8-openjdk/jre<br />
<br />
这里的''(default)''表示目前默认使用{{Ic|java-7-openjdk}},Java和其他二进制文件的调用都将依赖于此Java安装。前面的输出中也显示,这里只安装了OpenJDK 8的JRE部分。<br />
<br />
=== 改变默认Java环境 ===<br />
<br />
# archlinux-java set <JAVA_ENV_NAME><br />
<br />
例如:<br />
<br />
# archlinux-java set java-8-openjdk/jre<br />
<br />
{{Tip (简体中文)|若要看到可用的{{ic|<JAVA_ENV_NAME>}}名称, 请使用{{ic|archlinux-java status}}。}}<br />
<br />
注意,{{Ic|archlinux-java}} 不会允许您设置无效的Java环境。在前面的例子中,只安装了{{pkg|jre8-openjdk}},而'''没有'''安装{{pkg|jdk8-openjdk}},所以设置{{Ic|java-8-openjdk}}将会失败:<br />
<br />
# archlinux-java set java-8-openjdk<br />
'/usr/lib/jvm/java-8-openjdk' is not a valid Java environment path<br />
<br />
=== 取消设置的默认Java环境 ===<br />
<br />
无需取消Java环境的设置,因为提供环境的软件包通常会考虑到这一点。但若想这样做,只需使用{{ic|unset}}命令:<br />
<br />
# archlinux-java unset<br />
<br />
=== 解决默认Java环境的问题 ===<br />
<br />
如果设置了一个无效的Java环境链接,尝试调用{{ic|archlinux-java fix}}命令以修复它。还要注意,如果没有设置默认的Java环境,它将寻找有效的环境并尝试设置。它会优先考虑官方支持的软件包"OpenJDK 8"。<br />
<br />
# archlinux-java fix<br />
<br />
=== 运行非默认Java版本的程序 ===<br />
<br />
如果想用另一个版本的Java启动一个程序(例如系统同时安装了Java 18和11),可以用一个bash脚本包装应用程序,在本地改变Java的默认路径。例如默认版本是Java 18,而您要使用java 11:<br />
<br />
#!/bin/sh <br />
<br />
export PATH=/usr/lib/jvm/java-8-openjdk/jre/bin/:$PATH<br />
exec /path/to/application "$@"<br />
<br />
For a [[Systemd|systemd]] service you can append {{ic|JAVA_HOME}} to environment variables in the [[Systemd#Drop-in_files|drop-in file]]:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/override.conf|2=<br />
[Service]<br />
Environment=JAVA_HOME=/usr/lib/jvm/java-11-openjdk<br />
}}<br />
<br />
== 软件包支持{{ic|archlinux-java}}的先决条件 ==<br />
<br />
{{Note (简体中文)|这条信息同样适用于 {{ic|archlinux32-java}} 的32位Java包, 如果它们的包或者可执行名字里有 {{ic|32}} ,都可适用.}}<br />
<br />
这个分区的信息针对愿意提供包作为备份JVM给 [[Arch User Repository (简体中文)|AUR]] 的贡献者, 并且能够用 {{Ic|archlinux-java}}集成Arch Linux JVM方案. 如果要这样的话,这些包应该:<br />
<br />
* 把所有文件放在{{Ic|/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME} }}<br />
* 确认所有的 [https://archlinux.org/packages/extra/any/java-runtime-common/files/ java-runtime-common] 和 [https://archlinux.org/packages/extra/any/java-environment-common/files/ java-environment-common] 提供的可执行链接在相关包里都可用 <br />
* 把所有链接从 {{Ic|/usr/bin}} 移动到可执行文件里, 除非这些链接不属于 [https://archlinux.org/packages/extra/any/java-runtime-common/files/ java-runtime-common] 和 [https://archlinux.org/packages/extra/any/java-environment-common/files/ java-environment-common]<br />
* 用 {{Ic|-${VENDOR_NAME}${JAVA_MAJOR_VERSION} }} 的格式给手册页添加后缀 (查阅 [https://archlinux.org/packages/extra/x86_64/jre8-openjdk/files/ jre8-openjdk file list] 它的手册页用 {{Ic|-openjdk8}}做后缀)<br />
* 不要定义任何 [[PKGBUILD (简体中文)#conflicts|冲突]] 和[[PKGBUILD (简体中文)#replaces|替代]] ,用其他的JDK, {{Ic|java-runtime}}, {{Ic|java-runtime-headless}} 和 {{Ic|java-environment}}<br />
* 在''安装函数'' 里使用{{Ic|archlinux-java}} 脚本以将Java环境设置为默认 '''如果没有其他可用的Java环境准备设置的话''' (即: 这些包不应该 '''强制''' 被装为默认). 查阅 [https://github.com/archlinux/svntogit-packages/blob/packages/java7-openjdk/trunk officially supported Java environment package sources] 做例子<br />
<br />
同时也要注意:<br />
* 包需要的'''任何'''Java环境都应声明依赖,和通常一样在{{Ic|java-runtime}}、{{Ic|java-runtime-headless}}或{{Ic|java-environment}}里声明。<br />
* 包如果需要'''特定的Java提供商''',应该在相关包里声明依赖。<br />
* OpenJDK 包现在应该声明 {{Ic|1=provides="java-runtime-openjdk=${pkgver}"}} 等. 这能让第三方的包在没有特定版本要求的OpenJDK里声明依赖<br />
<br />
== 疑难解答 ==<br />
<br />
=== MySQL ===<br />
<br />
由于JDBC-drivers经常使用URL中的端口来建立与数据库的连接,它被认为是 “远程”的(即MySQL不会按照其默认设置监听该端口),尽管它们可能运行在同一台主机上,因此,若要使用JDBC和MySQL,应按照[[MariaDB#Grant remote access]]中的说明,启用对MySQL的远程访问。<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
如果在设置JDK的时候选择了系统的JDK,同时碰到了错误提示{{ic|The selected directory is not a valid home for JDK}},此时应重新安装另一个JDK包,并在IDEA设置中选择它。<br />
<br />
=== 伪装成另一个窗口管理器 ===<br />
<br />
可以使用[https://tools.suckless.org/x/wmname suckless.org]中的{{Pkg|wmname}}来使JVM相信其正运行于其它窗口管理器。这也许能解决在[[Awesome (简体中文)|Awesome]]或[[Dwm (简体中文)|Dwm]]或[[Ratpoison (简体中文)|Ratpoison]]等窗口管理器中出现的Java GUI渲染问题。尝试设置 "compiz "或 "LG3D":<br />
<br />
$ wmname LG3D<br />
<br />
运行了这条命令后,必须重启有问题的程序。<br />
<br />
这种做法能够有效,是因为JVM包含了一个已知的、non-re-parenting窗口管理器的硬编码列表。<br />
<br />
=== 字体难以辨认 ===<br />
<br />
除了下面[[#更好的字体渲染]]中的建议,有些字体可能依然难以辨认。使用微软的字体或许能有所改善,安装{{AUR|ttf-ms-fonts}}即可。<br />
<br />
=== 某些应用没有文字 ===<br />
<br />
如果某些应用完全没有文字,使用{{Bug|40871}}中建议的[[#Tips and tricks]]下的选项可能会有所帮助。<br />
<br />
=== 灰色窗口/应用不随窗口管理器调整大小/菜单自动关闭 ===<br />
<br />
标准的Java GUI工具包有一个non-re-parenting窗口管理器的硬编码列表,如果使用不在该列表中的窗口管理器,在运行某些Java应用时可能会有问题。最常见的问题之一是Java应用渲染成了一个灰色盒子而不是GUI。另一个问题是菜单能够响应点击,但马上又会关闭。<br />
<br />
以下内容也许有所帮助:<br />
<br />
* 见[[#伪装成另一个窗口管理器]]。<br />
* 对于{{Pkg|jre8-openjdk}},在{{ic|/etc/profile.d/jre.sh}}中添加一行{{ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}},然后重新登录系统。<br />
* 对于最新版本的JDK,执行窗口管理器之前,在{{ic|~/.xinitrc}}中添加一行{{ic|1=export AWT_TOOLKIT=MToolkit}}。<br />
* 对于Oracle的JRE/JDK,使用[https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Using_SetWMName SetWMName],但当同时使用{{ic|XMonad.Hooks.EwmhDesktops}}时可能无效。这种情况下,在{{ic|>> setWMName "LG3D"}}中添加{{ic|LogHook}}可能会有帮助。<br />
* 对于[[sway]], {{ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}}可能可以解决问题。<br />
<br />
详见[https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Problems_with_Java_applications.2C_Applet_java_console]。<br />
<br />
=== 调试JavaFX应用时系统卡住 ===<br />
<br />
如果调试JavaFX应用时系统卡住了,可以尝试提供JVM选项{{ic|1=-Dsun.awt.disablegrab=true}}。<br />
<br />
见[https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6714678]。<br />
<br />
=== JavaFX's MediaPlayer constructor throws an exception ===<br />
<br />
从JavaFX的声音模块中创建MediaPlayer类的实例可能会产生以下异常(Oracle JDK和OpenJDK都是如此):<br />
<br />
... (i.e. FXMLLoader construction exceptions) ...<br />
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!<br />
at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)<br />
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)<br />
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)<br />
at <constructor call><br />
...<br />
<br />
这是因为JavaFX和Arch Linux仓库中的{{pkg|ffmpeg}}构建不兼容。<br />
<br />
安装{{AUR|ffmpeg-compat-55}}以解决问题。<br />
<br />
见[https://www.reddit.com/r/archlinux/comments/70o8o6/using_a_javafx_mediaplayer_in_arch]。<br />
<br />
=== Java程序无法打开外部链接 ===<br />
<br />
如果Java应用无法将链接打开到浏览器等应用,请安装{{Pkg|gvfs}},因为Desktop.Action.BROWSE办法依赖于它。<br />
<br />
见[https://bugs.launchpad.net/ubuntu/+source/openjdk-8/+bug/1574879/comments/2]。<br />
<br />
=== Error initializing QuantumRenderer: no suitable pipeline found ===<br />
<br />
可能的问题和解决方法:<br />
<br />
* 没有GTK2。安装{{Pkg|gtk2}}。<br />
* 没有OpenJFX。安装{{Pkg|java-openjfx}}。<br />
<br />
== 提示和技巧 ==<br />
<br />
{{Note (简体中文)|本节中的建议适用于所有使用明确安装(外部)的Java运行环境的应用。有些应用捆绑了自己(私有)的运行环境,或使用自己的GUI、字体渲染等机制,以下内容不一定完全适用于这种情况。}}<br />
<br />
大多数Java应用的行为都可以通过向Java运行时提供预定义变量来控制。从[https://bbs.archlinux.org/viewtopic.php?id=72892 这个论坛帖子]来看,一种方法是在{{ic|~/.bash_profile}}中添加以下一行 (或在{{ic|/etc/profile.d/jre.sh}}添加来影响那些不通过{{ic|~/.bash_profile}}运行的程序):<br />
<br />
export _JAVA_OPTIONS="-D'''<option 1>''' -D'''<option 2>'''..."<br />
<br />
例如,使用系统抗锯齿字体并使swing使用GTK的外观与体验(look and feel):<br />
<br />
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'<br />
<br />
存在三个这样的变量,在下表中解释的选项优先考虑。<br />
<br />
{| class="wikitable" <br />
|-<br />
| JAVA_TOOL_OPTIONS<br />
| 影响应用程序以及javac、jshell等工具。<br />
|-<br />
| JDK_JAVA_OPTIONS<br />
| 影响通过java命令启动的一切应用程序,需要Java 9。<br />
|-<br />
| (命令行选项)<br />
| 在 "class name"参数前指定的参数是Java选项。<br />
|-<br />
| _JAVA_OPTIONS<br />
| 旧方法,影响应用程序和工具。<br />
|}<br />
<br />
=== 更好的字体渲染 ===<br />
<br />
开源和闭源的Java实现都有不合适的抗锯齿字体实现. 这可以通过以下办法来解决: {{Ic|1=-Dawt.useSystemAAFontSettings=on}}, {{Ic|1=-Dswing.aatext=true}}<br />
无论Java的开源还是闭源实现,其中都有字体抗锯齿不恰当的问题,可以通过以下选项解决:{{ic|1=-Dawt.useSystemAAFontSettings=on}},{{ic|1=-Dswing.aatext=true}}。<br />
<br />
详见[[Java Runtime Environment fonts]]。<br />
<br />
=== 禁止命令行里的 'Picked up _JAVA_OPTIONS' 消息 ===<br />
<br />
设置 JDK_JAVA_OPTIONS 环境变量会使Java(openjdk)向stderr写出以下形式的信息:'Picked up JDK_JAVA_OPTIONS=...'。为了禁止终端中显示这些信息,可以在{{ic|~/.bashrc}}中取消设置环境变量,并alias java,将这些选项传递为命令行参数:<br />
<br />
_SILENT_JAVA_OPTIONS="$_JAVA_OPTIONS"<br />
unset _JAVA_OPTIONS<br />
alias java='java "$_SILENT_JAVA_OPTIONS"'<br />
<br />
非交互式的Shell,如Java程序的启动脚本,(通常)不读取{{ic|~/.bashrc}},但仍从其父进程中继承了导出的变量(而父进程又在某个时间从读取了{{ic|~/.bash_profile}}的登录Shell中继承了它)。<br />
<br />
至于这种情况,一般会在{{ic|~/.bashrc}}的开头放一个声明,以避免读取文件。这样变量就会传递到通过桌面菜单启动的程序,如果是交互式Shell,则会使用alias来代替(这则不能用于脚本)。<br />
<br />
=== GTK LookAndFeel(外观与体验) ===<br />
<br />
如果你的Java程序看起来很丑, 你可能想为swing组件设置默认外观与体验:<br />
<br />
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel<br />
<br />
一些Java程序坚持用跨平台的金属风格外观与体验。在这些情况下,你可以通过设置下面的属性强制这些app用GTK外观和外观:<br />
<br />
swing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel<br />
<br />
==== GTK3支持 ====<br />
<br />
在Java 9以前,GTK LookAndFeel是针对GTK2链接的,而许多较新的桌面应用程序使用GTK3。这种GTK版本之间的不兼容可能会破坏使用Java插件的GUI应用程序,因为在Java不支持在同一进程中混合使用GTK2和GTK3(如LibreOffice 5.0)。<br />
<br />
GTK LookAndFeel可以针对GTK{{ic|2}}、{{ic|2.2}}和{{ic|3}}运行,默认为GTK3。可以修改以下属性以调整。<br />
<br />
{{Ic|1=jdk.gtk.version=3}}<br />
<br />
=== HiDPI ===<br />
<br />
根据GUI框架的不同,[[HiDPI#Java applications]]可以使用不同的方法启用。<br />
<br />
=== 更好的2D性能 ===<br />
<br />
切换到基于OpenGL的硬件加速管道可以提高2D性能:<br />
<br />
export _JAVA_OPTIONS='-Dsun.java2d.opengl=true'<br />
<br />
{{Note (简体中文)|启用该选项可能会导致像JetBrains IDEs这样的软件的UI出现问题,如只绘制部分绘制窗口、弹出窗口和工具栏。}}<br />
<br />
== 另见 ==<br />
<br />
* [https://math.hws.edu/javanotes8/ Introduction to Programming Using Java]</div>Fincehttps://wiki.archlinux.org/index.php?title=Java_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726961Java (简体中文)2022-04-19T11:37:03Z<p>Fince: /* 提示和技巧 */ improve translation</p>
<hr />
<div>[[Category:Programming languages (简体中文)]]<br />
[[Category:Oracle (简体中文)]]<br />
[[de:Java]]<br />
[[en:Java]]<br />
[[fa:Java]]<br />
[[ja:Java]]<br />
[[pt:Java]]<br />
[[ru:Java]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Java package guidelines (简体中文)}}<br />
{{Related|Java Runtime Environment Fonts}}<br />
{{Related articles end}}<br />
<br />
{{TranslationStatus (简体中文)|Java|2022-04-19|726950}}<br />
<br />
<br />
<br />
摘自维基百科中的 [[Wikipedia:Java (programming language)|Java]] 词条:<br />
<br />
:Java是一种编程语言,最初由Sun Microsystems开发,并于1995年作为Sun Microsystems的Java平台的核心组件发布。它有很多语法来自C和C++,但对象模型更简洁,底层组件更少。Java的应用一般会编译成能在任何Java虚拟机([[Wikipedia:Java virtual machine|JVM]])而不是特定架构上运行的字节码。<br />
<br />
Arch Linux官方支持开源的第7、8、11和17版的 [https://openjdk.java.net/ OpenJDK]。这些JVM可以并存,并能够通过帮助脚本{{Ic|archlinux-java}}切换。在 [[Arch User Repository (简体中文)|AUR]]中也有一些不受官方支持的Java环境。<br />
<br />
== 安装 ==<br />
<br />
{{Note (简体中文)|<br />
* Arch Linux官方只支持 [[#OpenJDK|OpenJDK]] 实现.<br />
* 刚安装完成的Java环境还无法被Shell({{Ic|$PATH}} 变量)识别。可以在命令行中使用{{Ic|source}}命令读取{{Ic|/etc/profile}},重启,或者注销并重新登入桌面环境来正确更新。}}<br />
<br />
两个''常见的''包经常作为其它包的依赖,分别是 {{Pkg|java-runtime-common}} (包含Java运行环境(JRE)的公共文件) 和 {{Pkg|java-environment-common}} (包括Java开发包(JDK)的公共文件)。包提供的环境配置文件 {{Ic|/etc/profile.d/jre.sh}} 指向由 {{ic|archlinux-java}} 帮助脚本设置的链接 {{Ic|/usr/lib/jvm/default/bin}}。<br />
<br />
{{警告| '''务必'''使用 {{Ic|archlinux-java}}编辑 {{Ic|/usr/lib/jvm/default}} 和 {{Ic|/usr/lib/jvm/default-runtime}} 这两个链接。 }}<br />
<br />
这些链接用来指示位于 {{Ic|<nowiki>/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME}</nowiki>}} 的默认Java运行环境,或位于 {{Ic|<nowiki>/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME}/jre</nowiki>}} 的Java运行环境。<br />
<br />
大多数安装的可执行文件都以链接的形式放在 {{Ic|/usr/bin}} 中,其他可执行文件则在 {{Ic|$PATH}} 指向的位置处。{{Ic|/etc/profile.d/jdk.sh}} 已经不再在包中提供了。<br />
<br />
=== OpenJDK ===<br />
<br />
[[Wikipedia:OpenJDK|OpenJDK]]是Java平台标准版(Java SE)的开源实现,也是官方的参考实现。有几个OpenJDK构建的分发,如[https://adoptium.net Adoptium](以前称为AdvertOpenJDK)和[https://aws.amazon.com/corretto/ Amazon Corretto]。Arch Linux的OpenJDK包由[https://hg.openjdk.java.net/ 上游的OpenJDK源代码]构建。<br />
<br />
;Headless JRE: Java的最小运行环境 - 执行非GUI的Java程序所需。<br />
;Full JRE: 完全的Java运行环境 - 执行Java GUI程序所需,依赖于headless JRE。<br />
;JDK:[[Wikipedia:Java Development Kit|Java Development Kit]] - Java开发所需, 依赖于 full JRE。<br />
<br />
{| class="wikitable"<br />
! 版本 !! Headless JRE !! Full JRE !! JDK !! 文献 !! 源码<br />
|-<br />
| [https://openjdk.java.net/projects/jdk/17/ OpenJDK 17] || {{Pkg|jre-openjdk-headless}} || {{Pkg|jre-openjdk}} || {{Pkg|jdk-openjdk}} || {{Pkg|openjdk-doc}} || {{Pkg|openjdk-src}}<br />
|-<br />
| [https://openjdk.java.net/projects/jdk/11/ OpenJDK 11] || {{Pkg|jre11-openjdk-headless}} || {{Pkg|jre11-openjdk}} || {{Pkg|jdk11-openjdk}} || {{Pkg|openjdk11-doc}} || {{Pkg|openjdk11-src}}<br />
|-<br />
| [https://openjdk.java.net/projects/jdk8/ OpenJDK 8] || {{Pkg|jre8-openjdk-headless}} || {{Pkg|jre8-openjdk}} || {{Pkg|jdk8-openjdk}} || {{Pkg|openjdk8-doc}} || {{Pkg|openjdk8-src}}<br />
|}<br />
<br />
{{App|OpenJDK GA|Latest OpenJDK General-Availability Release build from Oracle.|https://jdk.java.net|{{AUR|java-openjdk-bin}}}}<br />
{{App|OpenJDK EA|Latest OpenJDK Early-Access build for development version from Oracle.|https://jdk.java.net|{{AUR|java-openjdk-ea-bin}}}}<br />
<br />
{{App|IcedTea-Web|Java Web Start and the deprecated Java browser plugin.|https://icedtea.classpath.org/download/icedtea-web-docs/1.8/html/en/icedtea-web.html|{{Pkg|icedtea-web}}}}<br />
<br />
=== OpenJFX ===<br />
<br />
[https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX] is the open-source implementation of [[Wikipedia:JavaFX|JavaFX]]. You [https://wiki.openjdk.java.net/display/OpenJFX/Repositories+and+Releases do not need] to install this package if you are using Oracle JDK. This package only concerns users of the open source implementation of Java (OpenJDK project), and its derivatives.<br />
<br />
{| class="wikitable"<br />
! 版本 !! 运行环境与开发 !! 文档 !! 源码<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 18] || {{Pkg|java-openjfx}} || {{Pkg|java-openjfx-doc}} || {{Pkg|java-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 17] || {{Pkg|java17-openjfx}} || {{Pkg|java17-openjfx-doc}} || {{Pkg|java17-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 11] || {{Pkg|java11-openjfx}} || {{Pkg|java11-openjfx-doc}} || {{Pkg|java11-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 8] || {{AUR|java8-openjfx}} || {{AUR|java8-openjfx-doc}} || {{AUR|java8-openjfx-src}}<br />
|}<br />
<br />
{{App|OpenJFX GA|Latest OpenJFX General-Availability Release build from Gluon.|https://openjfx.io/|{{AUR|java-openjfx-bin}}}}<br />
{{App|OpenJFX EA|Latest OpenJFX Early-Access build for development version from Gluon.|https://openjfx.io/|{{AUR|java-openjfx-ea-bin}}}}<br />
<br />
=== 其他实现 ===<br />
<br />
{{App|Oracle JDK|Oracle's commercially licensed build of OpenJDK.|https://www.oracle.com/technetwork/java/javase/downloads/index.html|{{AUR|jre}} {{AUR|jre12}} {{AUR|jre11}} {{AUR|jre10}} {{AUR|jre9}} {{AUR|jre8}} {{AUR|jre7}} {{AUR|jre6}} {{AUR|jdk}} {{AUR|jdk12}} {{AUR|jdk11}} {{AUR|jdk10}} {{AUR|jdk9}} {{AUR|jdk8}} {{AUR|jdk7}} {{AUR|jdk6}} {{AUR|jdk-devel}}}}<br />
{{App|OpenJ9|Eclipse's implementation of JRE, contributed by IBM.|https://www.eclipse.org/openj9/|{{AUR|jdk-openj9-bin}} {{AUR|jdk14-openj9-bin}} {{AUR|jdk13-openj9-bin}} {{AUR|jdk12-openj9-bin}} {{AUR|jdk11-openj9-bin}} {{AUR|jdk10-openj9-bin}} {{AUR|jdk9-openj9-bin}} {{AUR|jdk8-openj9-bin}}}}<br />
{{App|IBM Certified|IBM Semeru Runtime Certified Edition.|https://www.ibm.com/semeru-runtimes/downloads|{{AUR|jdk11-j9-bin}}}}<br />
{{App|IBM J9|IBM's implementation of JRE, using OpenJ9 contributions.|https://www.ibm.com/support/pages/java-sdk-downloads|{{AUR|jdk8-j9-bin}} {{AUR|jdk7-j9-bin}} {{AUR|jdk7r1-j9-bin}}}}<br />
{{App|Parrot VM|a VM with experimental support for Java [http://trac.parrot.org/parrot/wiki/Languages] through two different methods: either as a [https://code.google.com/p/parrot-jvm/ Java VM bytecode translator], or as a [https://github.com/chrisdolan/perk Java compiler targeting the Parrot VM]. Parrot is [https://github.com/parrot/parrot/issues/1243 not actively developed since 2017].|http://www.parrot.org/|{{AUR|parrot}}}}<br />
<br />
{{Note|Oracle JDK的32位版本可以通过前缀{{ic|bin32-}}找到,如{{AUR|bin32-jre}}。其使用{{AUR|java32-runtime-common}},功能与{{Pkg|java-runtime-common}}相同,但添加了{{ic|32}}的后缀,如{{ic|java32}}。{{AUR|java32-environment-common}}也是同理,只有32位的JDK包使用它。}}<br />
<br />
=== 开发工具 ===<br />
<br />
对于集成开发环境,见[[List of applications#Integrated development environments]] 和''Java IDEs''子分区。<br />
<br />
为了阻止逆向工程,可以使用{{AUR|proguard}}等混淆器。<br />
<br />
==== 反编译器 ====<br />
<br />
* {{App|CFR|Java decompiler, supporting modern features of Java 9, 10 and beyond.|https://www.benf.org/other/cfr/|{{AUR|cfr}}}}<br />
* {{App|Fernflower|Analytical decompiler for Java, developed as part of [[IntelliJ IDEA]].|https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine|{{AUR|fernflower-git}}}}<br />
* {{App|Krakatau|Java decompiler, assembler, and disassembler.|https://github.com/Storyyeller/Krakatau|{{AUR|krakatau-git}}}}<br />
* {{App|Procyon decompiler|Experimental Java decompiler, inspired by ILSpy and Mono.Cecil.|https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler|{{AUR|procyon-decompiler}}}}<br />
* {{App|Java Decompiler (JD-Core)|Popular Java decompiler providing a GUI (see JD-GUI) and supporting Java 1-10.|https://java-decompiler.github.io/|{{AUR|jd-core-java}}}}<br />
* {{App|Jadx|Android DEX to Java decompiler with an optional GUI (see Jadx-GUI)|https://github.com/skylot/jadx|{{Pkg|jadx}}}}<br />
* {{App|[[Wikipedia:JAD (software)|JAD]]|Unmaintained Java decompiler (last release 2006).|https://varaneckas.com/jad|{{Pkg|jad}}}}<br />
<br />
==== GUI前端 ====<br />
<br />
* {{App|Bytecode Viewer|Java reverse engineering suite, including a decompiler, editor and debugger; Frontend for CFR/Fernflower/Procyon|https://bytecodeviewer.com|{{AUR|bytecode-viewer}}}}<br />
* {{App|Recaf|An easy to use modern Java bytecode editor that abstracts away the complexities of Java programs; Frontend for CFR/Fernflower/Procyon|https://www.coley.software/Recaf/|{{AUR|recaf-bin}}}}<br />
* {{App|Java Decompiler (JD-GUI)|Popular Java decompiler providing a GUI and supporting Java 1-10; Frontend for JD-Core|https://java-decompiler.github.io/|{{AUR|jd-gui}}}}<br />
* {{App|Jadx-GUI|Android APK DEX to Java decompiler with an optional GUI; Frontend for Jadx|https://github.com/skylot/jadx|{{Pkg|jadx}}}}<br />
* {{App|Luyten|An Open Source Java Decompiler Gui; Frontend for Procyon|https://github.com/deathmarine/Luyten|{{AUR|luyten}}}}<br />
<br />
== 在JVM间切换 ==<br />
<br />
帮助脚本 {{Ic|archlinux-java}} 提供了如下功能:<br />
<br />
archlinux-java <COMMAND><br />
<br />
COMMAND:<br />
status List installed Java environments and enabled one<br />
get Return the short name of the Java environment set as default<br />
set <JAVA_ENV> Force <JAVA_ENV> as default<br />
unset Unset current default Java environment<br />
fix Fix an invalid/broken default Java environment configuration<br />
<br />
=== 列出兼容的安装了的Java环境 ===<br />
<br />
$ archlinux-java status<br />
<br />
例如:<br />
<br />
$ archlinux-java status<br />
Available Java environments:<br />
java-7-openjdk (default)<br />
java-8-openjdk/jre<br />
<br />
这里的''(default)''表示目前默认使用{{Ic|java-7-openjdk}},Java和其他二进制文件的调用都将依赖于此Java安装。前面的输出中也显示,这里只安装了OpenJDK 8的JRE部分。<br />
<br />
=== 改变默认Java环境 ===<br />
<br />
# archlinux-java set <JAVA_ENV_NAME><br />
<br />
例如:<br />
<br />
# archlinux-java set java-8-openjdk/jre<br />
<br />
{{Tip (简体中文)|若要看到可用的{{ic|<JAVA_ENV_NAME>}}名称, 请使用{{ic|archlinux-java status}}。}}<br />
<br />
注意,{{Ic|archlinux-java}} 不会允许您设置无效的Java环境。在前面的例子中,只安装了{{pkg|jre8-openjdk}},而'''没有'''安装{{pkg|jdk8-openjdk}},所以设置{{Ic|java-8-openjdk}}将会失败:<br />
<br />
# archlinux-java set java-8-openjdk<br />
'/usr/lib/jvm/java-8-openjdk' is not a valid Java environment path<br />
<br />
=== 取消设置的默认Java环境 ===<br />
<br />
无需取消Java环境的设置,因为提供环境的软件包通常会考虑到这一点。但若想这样做,只需使用{{ic|unset}}命令:<br />
<br />
# archlinux-java unset<br />
<br />
=== 解决默认Java环境的问题 ===<br />
<br />
如果设置了一个无效的Java环境链接,尝试调用{{ic|archlinux-java fix}}命令以修复它。还要注意,如果没有设置默认的Java环境,它将寻找有效的环境并尝试设置。它会优先考虑官方支持的软件包"OpenJDK 8"。<br />
<br />
# archlinux-java fix<br />
<br />
=== 运行非默认Java版本的程序 ===<br />
<br />
如果想用另一个版本的Java启动一个程序(例如系统同时安装了Java 18和11),可以用一个bash脚本包装应用程序,在本地改变Java的默认路径。例如默认版本是Java 18,而您要使用java 11:<br />
<br />
#!/bin/sh <br />
<br />
export PATH=/usr/lib/jvm/java-8-openjdk/jre/bin/:$PATH<br />
exec /path/to/application "$@"<br />
<br />
For a [[Systemd|systemd]] service you can append {{ic|JAVA_HOME}} to environment variables in the [[Systemd#Drop-in_files|drop-in file]]:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/override.conf|2=<br />
[Service]<br />
Environment=JAVA_HOME=/usr/lib/jvm/java-11-openjdk<br />
}}<br />
<br />
== 软件包支持{{ic|archlinux-java}}的先决条件 ==<br />
<br />
{{Note (简体中文)|这条信息同样适用于 {{ic|archlinux32-java}} 的32位Java包, 如果它们的包或者可执行名字里有 {{ic|32}} ,都可适用.}}<br />
<br />
这个分区的信息针对愿意提供包作为备份JVM给 [[Arch User Repository (简体中文)|AUR]] 的贡献者, 并且能够用 {{Ic|archlinux-java}}集成Arch Linux JVM方案. 如果要这样的话,这些包应该:<br />
<br />
* 把所有文件放在{{Ic|/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME} }}<br />
* 确认所有的 [https://archlinux.org/packages/extra/any/java-runtime-common/files/ java-runtime-common] 和 [https://archlinux.org/packages/extra/any/java-environment-common/files/ java-environment-common] 提供的可执行链接在相关包里都可用 <br />
* 把所有链接从 {{Ic|/usr/bin}} 移动到可执行文件里, 除非这些链接不属于 [https://archlinux.org/packages/extra/any/java-runtime-common/files/ java-runtime-common] 和 [https://archlinux.org/packages/extra/any/java-environment-common/files/ java-environment-common]<br />
* 用 {{Ic|-${VENDOR_NAME}${JAVA_MAJOR_VERSION} }} 的格式给手册页添加后缀 (查阅 [https://archlinux.org/packages/extra/x86_64/jre8-openjdk/files/ jre8-openjdk file list] 它的手册页用 {{Ic|-openjdk8}}做后缀)<br />
* 不要定义任何 [[PKGBUILD (简体中文)#conflicts|冲突]] 和[[PKGBUILD (简体中文)#replaces|替代]] ,用其他的JDK, {{Ic|java-runtime}}, {{Ic|java-runtime-headless}} 和 {{Ic|java-environment}}<br />
* 在''安装函数'' 里使用{{Ic|archlinux-java}} 脚本以将Java环境设置为默认 '''如果没有其他可用的Java环境准备设置的话''' (即: 这些包不应该 '''强制''' 被装为默认). 查阅 [https://github.com/archlinux/svntogit-packages/blob/packages/java7-openjdk/trunk officially supported Java environment package sources] 做例子<br />
<br />
同时也要注意:<br />
* 包需要的'''任何'''Java环境都应声明依赖,和通常一样在{{Ic|java-runtime}}、{{Ic|java-runtime-headless}}或{{Ic|java-environment}}里声明。<br />
* 包如果需要'''特定的Java提供商''',应该在相关包里声明依赖。<br />
* OpenJDK 包现在应该声明 {{Ic|1=provides="java-runtime-openjdk=${pkgver}"}} 等. 这能让第三方的包在没有特定版本要求的OpenJDK里声明依赖<br />
<br />
== 疑难解答 ==<br />
<br />
=== MySQL ===<br />
<br />
由于JDBC-drivers经常使用URL中的端口来建立与数据库的连接,它被认为是 “远程”的(即MySQL不会按照其默认设置监听该端口),尽管它们可能运行在同一台主机上,因此,若要使用JDBC和MySQL,应按照[[MariaDB#Grant remote access]]中的说明,启用对MySQL的远程访问。<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
如果在设置JDK的时候选择了系统的JDK,同时碰到了错误提示{{ic|The selected directory is not a valid home for JDK}},此时应重新安装另一个JDK包,并在IDEA设置中选择它。<br />
<br />
=== 伪装成另一个窗口管理器 ===<br />
<br />
可以使用[https://tools.suckless.org/x/wmname suckless.org]中的{{Pkg|wmname}}来使JVM相信其正运行于其它窗口管理器。这也许能解决在[[Awesome (简体中文)|Awesome]]或[[Dwm (简体中文)|Dwm]]或[[Ratpoison (简体中文)|Ratpoison]]等窗口管理器中出现的Java GUI渲染问题。尝试设置 "compiz "或 "LG3D":<br />
<br />
$ wmname LG3D<br />
<br />
运行了这条命令后,必须重启有问题的程序。<br />
<br />
这种做法能够有效,是因为JVM包含了一个已知的、non-re-parenting窗口管理器的硬编码列表。<br />
<br />
=== 字体难以辨认 ===<br />
<br />
除了下面[[#更好的字体渲染]]中的建议,有些字体可能依然难以辨认。使用微软的字体或许能有所改善,安装{{AUR|ttf-ms-fonts}}即可。<br />
<br />
=== 某些应用没有文字 ===<br />
<br />
如果某些应用完全没有文字,使用{{Bug|40871}}中建议的[[#Tips and tricks]]下的选项可能会有所帮助。<br />
<br />
=== 灰色窗口/应用不随窗口管理器调整大小/菜单自动关闭 ===<br />
<br />
标准的Java GUI工具包有一个non-re-parenting窗口管理器的硬编码列表,如果使用不在该列表中的窗口管理器,在运行某些Java应用时可能会有问题。最常见的问题之一是Java应用渲染成了一个灰色盒子而不是GUI。另一个问题是菜单能够响应点击,但马上又会关闭。<br />
<br />
以下内容也许有所帮助:<br />
<br />
* 见[[#伪装成另一个窗口管理器]]。<br />
* 对于{{Pkg|jre8-openjdk}},在{{ic|/etc/profile.d/jre.sh}}中添加一行{{ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}},然后重新登录系统。<br />
* 对于最新版本的JDK,执行窗口管理器之前,在{{ic|~/.xinitrc}}中添加一行{{ic|1=export AWT_TOOLKIT=MToolkit}}。<br />
* 对于Oracle的JRE/JDK,使用[https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Using_SetWMName SetWMName],但当同时使用{{ic|XMonad.Hooks.EwmhDesktops}}时可能无效。这种情况下,在{{ic|>> setWMName "LG3D"}}中添加{{ic|LogHook}}可能会有帮助。<br />
* 对于[[sway]], {{ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}}可能可以解决问题。<br />
<br />
详见[https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Problems_with_Java_applications.2C_Applet_java_console]。<br />
<br />
=== 调试JavaFX应用时系统卡住 ===<br />
<br />
如果调试JavaFX应用时系统卡住了,可以尝试提供JVM选项{{ic|1=-Dsun.awt.disablegrab=true}}。<br />
<br />
见[https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6714678]。<br />
<br />
=== JavaFX's MediaPlayer constructor throws an exception ===<br />
<br />
从JavaFX的声音模块中创建MediaPlayer类的实例可能会产生以下异常(Oracle JDK和OpenJDK都是如此):<br />
<br />
... (i.e. FXMLLoader construction exceptions) ...<br />
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!<br />
at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)<br />
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)<br />
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)<br />
at <constructor call><br />
...<br />
<br />
这是因为JavaFX和Arch Linux仓库中的{{pkg|ffmpeg}}构建不兼容。<br />
<br />
安装{{AUR|ffmpeg-compat-55}}以解决问题。<br />
<br />
见[https://www.reddit.com/r/archlinux/comments/70o8o6/using_a_javafx_mediaplayer_in_arch]。<br />
<br />
=== Java程序无法打开外部链接 ===<br />
<br />
如果Java应用无法将链接打开到浏览器等应用,请安装{{Pkg|gvfs}},因为Desktop.Action.BROWSE办法依赖于它。<br />
<br />
见[https://bugs.launchpad.net/ubuntu/+source/openjdk-8/+bug/1574879/comments/2]。<br />
<br />
=== Error initializing QuantumRenderer: no suitable pipeline found ===<br />
<br />
可能的问题和解决方法:<br />
<br />
* 没有GTK2。安装{{Pkg|gtk2}}。<br />
* 没有OpenJFX。安装{{Pkg|java-openjfx}}。<br />
<br />
== 提示和技巧 ==<br />
<br />
{{Note (简体中文)|本节中的建议适用于所有使用明确安装(外部)的Java运行环境的应用。有些应用捆绑了自己(私有)的运行环境,或使用自己的GUI、字体渲染等机制,以下内容不一定完全适用于这种情况。}}<br />
<br />
大多数Java应用的行为都可以通过向Java运行时提供预定义变量来控制。从[https://bbs.archlinux.org/viewtopic.php?id=72892 这个论坛帖子]来看,一种方法是在{{ic|~/.bash_profile}}中添加以下一行 (或在{{ic|/etc/profile.d/jre.sh}}添加来影响那些不通过{{ic|~/.bash_profile}}运行的程序):<br />
<br />
export _JAVA_OPTIONS="-D'''<option 1>''' -D'''<option 2>'''..."<br />
<br />
例如,使用系统抗锯齿字体并使swing使用GTK的外观与体验(look and feel):<br />
<br />
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'<br />
<br />
存在三个这样的变量,在下表中解释的选项优先考虑。<br />
<br />
{| class="wikitable" <br />
|-<br />
| JAVA_TOOL_OPTIONS<br />
| 影响应用程序以及javac、jshell等工具。<br />
|-<br />
| JDK_JAVA_OPTIONS<br />
| 影响通过java命令启动的一切应用程序,需要Java 9。<br />
|-<br />
| (命令行选项)<br />
| 在 "class name"参数前指定的参数是Java选项。<br />
|-<br />
| _JAVA_OPTIONS<br />
| 旧方法,影响应用程序和工具。<br />
|}<br />
<br />
=== 更好的字体渲染 ===<br />
<br />
开源和闭源的Java实现都有不合适的抗锯齿字体实现. 这可以通过以下办法来解决: {{Ic|1=-Dawt.useSystemAAFontSettings=on}}, {{Ic|1=-Dswing.aatext=true}}<br />
无论Java的开源还是闭源实现,其中都有字体抗锯齿不恰当的问题,可以通过以下选项解决:{{ic|1=-Dawt.useSystemAAFontSettings=on}},{{ic|1=-Dswing.aatext=true}}。<br />
<br />
详见[[Java Runtime Environment fonts]]。<br />
<br />
=== 禁止命令行里的 'Picked up _JAVA_OPTIONS' 消息 ===<br />
<br />
设置 JDK_JAVA_OPTIONS 环境变量会使 java (openjdk) 向stderr写出以下形式的信息:'Picked up JDK_JAVA_OPTIONS=...'。为了禁止终端中显示这些信息,可以在{{ic|~/.bashrc}}中取消设置环境变量,并alias java,将这些选项传递为命令行参数:<br />
<br />
_SILENT_JAVA_OPTIONS="$_JAVA_OPTIONS"<br />
unset _JAVA_OPTIONS<br />
alias java='java "$_SILENT_JAVA_OPTIONS"'<br />
<br />
非交互式的Shell,如Java程序的启动脚本,(通常)不读取{{ic|~/.bashrc}},但仍从其父进程中继承了导出的变量(而父进程又在某个时间从读取了{{ic|~/.bash_profile}}的登录Shell中继承了它)。<br />
<br />
至于这种情况,一般会在{{ic|~/.bashrc}}的开头放一个声明,以避免读取文件。这样变量就会传递到通过桌面菜单启动的程序,如果是交互式Shell,则会使用alias来代替(这则不能用于脚本)。<br />
<br />
=== GTK LookAndFeel(外观与体验) ===<br />
<br />
如果你的Java程序看起来很丑, 你可能想为swing组件设置默认外观与体验:<br />
<br />
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel<br />
<br />
一些Java程序坚持用跨平台的金属风格外观与体验。在这些情况下,你可以通过设置下面的属性强制这些app用GTK外观和外观:<br />
<br />
swing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel<br />
<br />
==== GTK3支持 ====<br />
<br />
在Java 9以前,GTK LookAndFeel是针对GTK2链接的,而许多较新的桌面应用程序使用GTK3。这种GTK版本之间的不兼容可能会破坏使用Java插件的GUI应用程序,因为在Java不支持在同一进程中混合使用GTK2和GTK3(如LibreOffice 5.0)。<br />
<br />
GTK LookAndFeel可以针对GTK{{ic|2}}、{{ic|2.2}}和{{ic|3}}运行,默认为GTK3。可以修改以下属性以调整。<br />
<br />
{{Ic|1=jdk.gtk.version=3}}<br />
<br />
=== HiDPI ===<br />
<br />
根据GUI框架的不同,[[HiDPI#Java applications]]可以使用不同的方法启用。<br />
<br />
=== 更好的2D性能 ===<br />
<br />
切换到基于OpenGL的硬件加速管道可以提高2D性能:<br />
<br />
export _JAVA_OPTIONS='-Dsun.java2d.opengl=true'<br />
<br />
{{Note (简体中文)|启用该选项可能会导致像JetBrains IDEs这样的软件的UI出现问题,如只绘制部分绘制窗口、弹出窗口和工具栏。}}<br />
<br />
== 另见 ==<br />
<br />
* [https://math.hws.edu/javanotes8/ Introduction to Programming Using Java]</div>Fincehttps://wiki.archlinux.org/index.php?title=HiDPI_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726960HiDPI (简体中文)2022-04-19T11:26:00Z<p>Fince: add TranslationStatus</p>
<hr />
<div>[[Category:Graphics (简体中文)]]<br />
[[en:HiDPI]]<br />
[[ja:HiDPI]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Font configuration}}<br />
{{Related articles end}}<br />
<br />
{{TranslationStatus (简体中文)|HiDPI|2018-09-04|532530}}<br />
<br />
HiDPI (High Dots Per Inch) 显示器,指的是在较小尺寸下却拥有较高分辨率的显示器。Apple 将其称作“[[wikipedia:Retina Display|视网膜屏幕]]”,这项技术主要存在于高端笔记本电脑和显示器中。<br />
<br />
并非所有的软件都在高分辨率屏幕下工作良好。此页列出了一些常见的调整方法,让您更好的使用 HiDPI 显示器。<br />
<br />
== 桌面环境 ==<br />
<br />
=== GNOME ===<br />
<br />
可以在'''设置''' > '''设备''' > '''显示''' (Settings > Devices > Displays) 中开启 HiDPI 支持,也可以使用 gsettings 进行设置:<br />
<br />
$ gsettings set org.gnome.desktop.interface scaling-factor 2<br />
<br />
{{注意|1={{ic|scaling-factor}}仅能设置为整数。1 = 100%,2 = 200%……等等}}<br />
<br />
==== 非整数倍缩放 ====<br />
<br />
在某些设备(例如小平板电脑)上使用 {{ic|scaling-factor}}设置整数倍缩放的效果可能并不理想。<br />
<br />
*wayland<br />
启用实验性的非整数倍缩放功能:<br />
<br />
$ gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"<br />
<br />
之后再次打开 '''设置''' > '''设备''' > '''显示'''。<br />
<br />
*xorg<br />
<br />
您可以同时使用 {{ic|scaling-factor}} 和 [[xrandr]] 来实现任意的非整数倍缩放。这可以使 TTF 字体被正确缩放,防止出现单独使用 xrandr 时出现的模糊现象。您可以使用 {{ic|gsettings}} 来指定放大系数,并用 [[xrandr]] 指定缩小系数。<br />
<br />
首先使将缩放设为“UI看起来太大”的最小值。通常“2”已经太大,如果不够大就继续尝试“3”以及更大的数。之后使用 [[xrandr]] 设置缩小系数。首先获取相关的输出名称,下面的例子将使用 {{ic|eDP1}} 。先试着将缩小系数设为1.25,如果 UI 看起来仍然太大,则增大缩放系数。反之则缩小缩放系数。<br />
<br />
$ xrandr --output eDP1 --scale 1.25x1.25<br />
<br />
{{注意|如果你的鼠标光标移动范围和屏幕显示并不匹配,你可能需要同时使用 {{ic|--panning}}。参阅[[#Side display]]。}}<br />
<br />
{{Accuracy|The following was initially added under [[#X Resources]]. Clarify how it integrates with the info there or that above for GNOME.|section=GNOME ignores X settings}}<br />
<br />
在GNOME设置守护进程中的xsettings插件中,DPI设置是硬编码的。这将忽略Xorg的设置。这里有一篇[http://blog.drtebi.com/2012/12/changing-dpi-setting-on-gnome-34.html 重编译 Gnome Settings Daemon]的博客文章。在文档中还介绍了另一种方法来设置 xsettings 的DPI:<br />
<br />
你可以使用dconf编辑器转到这个键值:<br />
<br />
/org/gnome/settings-daemon/plugins/xsettings/overrides<br />
<br />
加入这个条目:<br />
<br />
'Xft/DPI': <153600><br />
<br />
来自 README.xsettings<br />
<br />
注意必须使用这种方式指定(使用<>)。<br />
<br />
另外,上面的例子中一英寸以1024ths定义。(Note also that DPI in the above example is expressed in 1024ths of an inch.)<br />
<br />
=== KDE ===<br />
<br />
您可以使用KDE的设置来微调字体、图标和部件缩放,这些改动会同时影响 Qt 和 GTK+ 程序。<br />
<br />
要调整整体缩放:<br />
<br />
# '''系统设置'''→'''显示和监控'''→'''显示配置'''→'''缩放显示'''<br />
# 将滑块调整至适合的位置<br />
# 重新启动以使设置生效<br />
<br />
要仅调整字体缩放:<br />
<br />
# '''系统设置'''→'''字体'''<br />
# 勾选'''“固定字体DPI”'''并调整DPI的值。调整之后重新启动应用程序即可生效。要在整个桌面上生效,您需要注销之后重新登录。<br />
<br />
要仅调整图标缩放:<br />
<br />
# '''系统设置'''→'''图标'''→'''配置图标大小'''<br />
# 为每一项选择合适的图标大小,更改将会立即生效。<br />
<br />
==== 非整数倍缩放下的Bug ====<br />
<br />
当您使用非整数倍的缩放比例时,这可能导致一些 Qt 应用程序的字体渲染出现问题(例如 okular)。<br />
<br />
有一个办法可以绕过这个问题:<br />
# 将缩放比例设为1<br />
# 用上面的方法调整字体和图标缩放(这会影响所有的应用程序,且不会导致字体问题)<br />
# 重新启动KDE<br />
# 如果需要缩放 GTK 程序,设置环境变量{{ic|GDK_SCALE/GDK_DPI_SCALE}}(参见下文)。<br />
<br />
==== 托盘图标不缩放 ====<br />
<br />
托盘图标不会随着整体而缩放。Plasma 默认会忽略 Qt 设置。要让 Plasma 使用 Qt 设置,将{{ic|PLASMA_USE_QT_SCALING}} 设为1.<br />
<br />
=== Xfce ===<br />
<br />
打开'''设置管理器'''→'''外观'''→'''字体''',修改 DPI 的值。在 HiDPI 显示器上,通常可以设为180或者192。要获得更精确的数字,可以使用{{ic|<nowiki>xdpyinfo | grep resolution</nowiki>}},使用输出DPI两倍的值。<br />
<br />
要增大托盘图标,右键点击托盘的空白处,选择属性,将最大图标大小设置为32,48或者64。<br />
<br />
=== Cinnamon ===<br />
<br />
应当开箱即用。<br />
<br />
=== Enlightenment ===<br />
<br />
对于E18,首先打开设置面板,在 '''外观'''→'''缩放''' 中,你可以调整缩放倍数。在MBPr 15 上,你可以选择1.2。<br />
<br />
== X Server ==<br />
<br />
某些程序使用 X Server 所提供的 DPI 值。比如 i3 ([https://github.com/i3/i3/blob/next/libi3/dpi.c 来源]) 和 Chromium([https://code.google.com/p/chromium/codesearch#chromium/src/ui/views/widget/desktop_aura/desktop_screen_x11.cc 来源])。<br />
<br />
{{Accuracy|1=Xorg always sets dpi to 96. See [https://bugs.freedesktop.org/show_bug.cgi?id=23705 this], [https://bugs.freedesktop.org/show_bug.cgi?id=41115 this] and finally [https://pastebin.com/vtzyBK6e this].}}<br />
<br />
要验证 X Server 是否正确检测到了您的显示器的DPI,使用 {{Pkg|xorg-xdpyinfo}} 中的 {{ic|xdpyinfo}} 工具。<br />
<br />
$ xdpyinfo | grep -B 2 resolution<br />
screen #0:<br />
dimensions: 3200x1800 pixels (423x238 millimeters)<br />
resolution: 192x192 dots per inch<br />
<br />
这个例子中 X Server 检测到的屏幕尺寸并不准确(423mm x 328mm,实际上Dell XPS 9530的屏幕尺寸是346mm x 194mm),但报告的 DPI 是96的整数倍。通常这往往比正确的DPI更好,可以保证字体渲染正确。<br />
<br />
如果 {{ic|xdpyinfo}} 显示的DPI不正确,参阅[[Xorg#Display size and DPI]]了解如何修复。<br />
<br />
== X Resources ==<br />
<br />
如果你没有使用一个桌面环境,比如 KDE,Xfce,或是没有一个为您操作 Xorg 设置的程序,你可以通过在 [[Xresources]] 中的 {{ic|Xft.dpi}} 变量手动修改DPI设置。<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
Xft.dpi: 180<br />
Xft.autohint: 0<br />
Xft.lcdfilter: lcddefault<br />
Xft.hintstyle: hintfull<br />
Xft.hinting: 1<br />
Xft.antialias: 1<br />
Xft.rgba: rgb<br />
</nowiki>}}<br />
<br />
确保设置在X启动时已经被载入。例如在{{ic|~/.xinitrc}}中使用{{ic|xrdb -merge ~/.Xresources}}。有关详细信息,请参阅 [[Xresources]]。<br />
<br />
通常这会让大多数地方的字体大小正确,但这并不会影响图标大小。<br />
<br />
在设置{{ic|Xft.dpi}}的同时设置 GUI toolkit 缩放(例如{{ic|GDK_SCALE}})可能导致某些程序界面元素过大(例如firefox)。<br />
<br />
== GUI toolkits ==<br />
<br />
=== Qt 5 ===<br />
<br />
自从 Qt 5.6 开始,Qt 5 应用程序可以遵守屏幕DPI。设置环境变量{{ic|QT_AUTO_SCREEN_SCALE_FACTOR}}以启用这项功能。<br />
<br />
export QT_AUTO_SCREEN_SCALE_FACTOR=1<br />
<br />
如果自动检测的 DPI 并不理想,你也可以按屏幕({{ic|QT_SCREEN_SCALE_FACTORS}})或全局({{ic|QT_SCALE_FACTOR}})手动设置缩放,有关详细信息,请参阅 [https://blog.qt.io/blog/2016/01/26/high-dpi-support-in-qt-5-6/ Qt 博客文章]。<br />
<br />
{{注意|<br />
* 如果您手动设置了缩放,则需要设置{{ic|1=QT_AUTO_SCREEN_SCALE_FACTOR=0}}。否则某些明确启用 HiDPI 支持的程序会被缩放两次。<br />
* {{ic|QT_SCALE_FACTOR}}缩放字体,但{{ic|QT_SCREEN_SCALE_FACTORS}}并不会。<br />
* 如果您还在'''xrdb'''中手动设置过DPI以支持其他toolkits,同时使用{{ic|QT_SCALE_FACTORS}}会使字体过大。<br />
* 如果您有多个不同DPI的屏幕,即 [[#Side display]],您可能需要设置{{ic|1=QT_SCREEN_SCALE_FACTORS="2;2"}}。<br />
}}<br />
<br />
=== GDK 3 (GTK+ 3) ===<br />
<br />
要将UI缩放为两倍大小:<br />
<br />
export GDK_SCALE=2<br />
<br />
并同时不影响字体:<br />
<br />
export GDK_DPI_SCALE=0.5<br />
<br />
=== GTK+ 2 ===<br />
<br />
GTK+ 2本身并不支持缩放UI。但您可以使用 {{AUR|oomox-git}} 创建预缩放过的主题。<br />
<br />
=== Elementary (EFL) ===<br />
<br />
要将缩放倍数设为1.5:<br />
<br />
export ELM_SCALE=1.5<br />
<br />
更多信息请查看 https://phab.enlightenment.org/w/elementary/<br />
<br />
== 引导程序 ==<br />
<br />
=== GRUB ===<br />
<br />
==== 降低帧缓冲分辨率 ====<br />
<br />
参见[[GRUB/Tips and tricks#Setting the framebuffer resolution]]。<br />
<br />
==== 改变GRUB字体大小 ====<br />
<br />
在{{ic|/usr/share/fonts/}}中找一个你喜欢的字体。<br />
<br />
使用GRUB工具转换:<br />
<br />
# grub-mkfont -s 30 -o /boot/grubfont.pf2 /usr/share/fonts/''FontFamily/FontName.ttf''<br />
<br />
{{注意|{{ic|-s 30}}是字体大小。}}<br />
<br />
编辑{{ic|/etc/default/grub}}来设置字体。参见[[GRUB/Tips and tricks#Background image and bitmap fonts]]:<br />
<br />
GRUB_FONT="/boot/grubfont.pf2"<br />
<br />
使用{{ic|grub-mkconfig -o /boot/grub/grub.cfg}}重新生成 GRUB 配置。<br />
<br />
== 应用程序 ==<br />
<br />
=== 浏览器 ===<br />
<br />
==== Firefox ====<br />
<br />
Firefox 应到使用 [[#GDK 3 (GTK+ 3)]] 的设置。但是,建议的 {{ic|GDK_SCALE}} 可能会使 Firefox 界面的缩放并不一致,并且不能使用小数.你可以使用{{ic|GDK_DPI_SCALE}}来代替。<br />
<br />
要覆盖这些设置,请打开 Firefox 的高级选项页面({{ic|about:config}})并将 {{ic|layout.css.devPixelsPerPx}} 设置为 {{ic|2}}(或是其它需要的数值),但这个选项也可能导致 Firefox 界面的缩放不一致。如果 Firefox 没有缩放字体,您可能需要创建 {{ic|userChrome.css}} 并添加适当的样式。有关 {{ic|userChrome.css}},请访问[http://kb.mozillazine.org/index.php?title=UserChrome.css mozillaZine]。<br />
<br />
{{hc|~/.mozilla/firefox/<em><profile></em>/chrome/userChrome.css|@namespace url("https://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul");<br />
<br />
/* #tabbrowser-tabs, #navigator-toolbox, menuitem, menu, ... */<br />
* {<br />
font-size: 15px !important;<br />
}<br />
<br />
/* exception for badge on adblocker */<br />
.toolbarbutton-badge {<br />
font-size: 8px !important;<br />
}<br />
}}<br />
<br />
{{警告|下面的扩展不支持 Firefox Quantum (57版本及以上)。}}<br />
<br />
如果你将 HiDPI 显示器与另一台显示器一起使用,你可以使用 [https://github.com/ertug/autohidpi AutoHiDPI] 来自动调整。另外,从 Firefox 49 以来,它会自动根据您的屏幕分辨率调整缩放,从而更容易处理多个屏幕的情况。<br />
<br />
==== Chromium / Google Chrome ====<br />
<br />
Chromium 应当使用[[#GDK 3 (GTK+ 3)]]设置。<br />
<br />
要覆盖这一选项,请使用{{ic|1=--force-device-scale-factor}} flags。这将缩放所有内容。例如:{{ic|1=chromium --force-device-scale-factor=2}}。<br />
<br />
当此选项设为1时将会采用正常缩放,此选项也可以使用小数。要永久应用此更改,对于Chromium,可以将其添加到{{ic|~/.config/chromium-flags.conf}}:<br />
<br />
{{hc|~/.config/chromium-flags.conf|2=--force-device-scale-factor=2}}<br />
<br />
对于Chrome,使用 {{ic|~/.config/chrome-flags.conf}}。<br />
<br />
如果你将 HiDPI 显示器与另一台显示器一起使用,你可以使用 [https://chrome.google.com/webstore/detail/resolution-zoom/enjjhajnmggdgofagbokhmifgnaophmh reszoom] 扩展。这个扩展将会根据所在屏幕自动调整缩放。<br />
<br />
==== Opera ====<br />
<br />
Opera 应当使用 [[#GDK 3 (GTK+ 3)]] 设置。<br />
<br />
要覆盖这一选项,请使用 {{ic|1=--alt-high-dpi-setting=X}} 命令行选项。其中 X 是所需的 DPI。例如,使用 {{ic|1=--alt-high-dpi-setting=144}} Opera 将认为 DPI 是 144。在较新版本中,Opera 将使用字体DPI(在 KDE 中可以强制设置字体 DPI)。<br />
<br />
=== Thunderbird ===<br />
<br />
参见[[#Firefox]]。要访问 {{ic|about:config}},打开 '''首选项'''→'''高级'''→'''配置编辑器'''。<br />
<br />
=== Wine程序 ===<br />
<br />
运行<br />
$ winecfg<br />
并且更改'''显示'''选项卡中的 DPI。这仅影响字体大小。<br />
<br />
=== Skype ===<br />
<br />
Skype for Linux ({{AUR|skypeforlinux-stable-bin}}) 使用 [[#GDK 3 (GTK+ 3)]]。<br />
<br />
=== Spotify ===<br />
<br />
您可以简单的使用 {{ic|Ctrl++}} 和 {{ic|Ctrl+-}} 来调整缩放。使用 {{ic|Ctrl+0}} 来恢复默认缩放。缩放设置保存在{{ic|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs}},您可能需要自行创建该设置文件:<br />
<br />
{{hc|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs|<nowiki><br />
app.browser.zoom-level=100<br />
</nowiki>}}<br />
<br />
Spotify 也可以使用自定义的缩放启动。这个系数和{{ic|~/.config/spotify/Users/YOUR-SPOTIFY-USER-NAME/prefs}}中的系数相乘的积是实际的缩放倍数。<br />
$ spotify --force-device-scale-factor=1.5<br />
<br />
=== Zathura 文档查看器 ===<br />
<br />
文档缩放应当开箱即用。<br />
<br />
UI缩放可以在[https://pwmt.org/projects/zathura/documentation/ 配置文件]中设置 (注意 "font" 是一个[https://pwmt.org/projects/girara/options/ girara option]):<br />
<br />
set font "monospace normal 20"<br />
<br />
=== Sublime Text 3 ===<br />
<br />
Sublime Text 3 完整支持显示缩放。在 '''设置''' → '''用户设置''' 中添加 {{ic|"dpi_scale": 2.0}} [https://blog.wxm.be/2014/08/30/sublime-text-3-and-high-dpi-on-linux.html (来源)]。<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
IntelliJ IDEA 15 及以上应有对 HiDPI 的支持,[https://blog.jetbrains.com/idea/2015/07/intellij-idea-15-eap-comes-with-true-hidpi-support-for-windows-and-linux/] 如果这不能工作最简便的解决办法可能是覆盖默认的字体设置:<br />
<br />
:''File -> Settings -> Behaviour & Appearance -> Appearance''<br />
<br />
[https://youtrack.jetbrains.com/issue/IDEA-114944 14版本]中将 {{ic|1=-Dhidpi=true}} 添加到 {{ic|$HOME/.IdeaC14/}} 或 {{ic|/usr/share/intelligj-idea-ultimate-edition/bin/}} 的方法应该不再需要了。<br />
<br />
=== NetBeans ===<br />
<br />
NetBeans 可以在启动时用{{ic|1=--fontsize}}选项设置字体大小。要要使此设置永久生效,编辑{{ic|1=/usr/share/netbeans/etc/netbeans.conf}},添加{{ic|1=--fontsize}}到{{ic|1=netbeans_default_options}}。[https://web.archive.org/web/20210117211145/http://wiki.netbeans.org/FaqFontSize]<br />
<br />
编辑器字体大小可以在 Tools → Option → Fonts & Color 中设置。<br />
<br />
输出窗口的字体大小可以在Tools → Options → Miscelaneous → Output中控制。<br />
<br />
=== Gimp 2.8 ===<br />
<br />
使用 HiDPI主题,或是更改现有主题的 {{ic|1=gtkrc}}。(Change all occurrences of the size {{ic|1=button}} to {{ic|1=dialog}},例如{{ic|1=GimpToolPalette::tool-icon-size}}。)<br />
<br />
另外也有 [https://github.com/jedireza/gimp-hidpi gimp-hidpi]。<br />
<br />
=== Steam ===<br />
<br />
==== 官方 HiDPI支持 ====<br />
<br />
* 从2018年1月25日开始,测试版本已经支持HiDPI并能自动启用。<br />
* '''Steam''' → '''设置''' → '''界面''' → '''勾选''' '''"按照显示器大小放大图标和文本(需要重启)"'''<br />
* 如果自动检测并不能正确工作,使用{{ic|1=GDK_SCALE=2}}来指定缩放级别。<br />
<br />
==== 非官方 ====<br />
<br />
使用 [https://github.com/MoriTanosuke/HiDPI-Steam-Skin HiDPI-Steam-Skin] 可以增大字体大小,虽然并不完美,但至少能用。<br />
<br />
{{注意|皮肤的 README 列出了皮肤应当放置的位置。正确的位置下面应该有一个叫 {{ic|1=skins_readme.txt}}的文件。}}<br />
<br />
[https://steamcommunity.com/groups/metroskin/discussions/0/517142253861033946/ MetroSkin Unofficial Patch] 也可以使用。<br />
<br />
=== Java 程序 ===<br />
<br />
可以通过设置 {{ic|sun.java2d.uiScale}} 来缩放使用 AWT/Swing 框架的 Java 程序。例如:<br />
<br />
java -Dsun.java2d.uiScale=2 -jar some_application.jar<br />
<br />
从 Java 9 开始,{{ic|GDK_SCALE}} 也可以缩放 Swing 程序。<br />
<br />
=== Mono 程序 ===<br />
<br />
根据 [https://bugzilla.xamarin.com/35/35870/bug.html],Mono 程序应像 [[#GDK 3 (GTK+ 3)|GTK3]] 程序一样缩放。<br />
<br />
=== MATLAB ===<br />
<br />
[[MATLAB]] 的近期版本(R2017b)可以设置缩放:<br />
>> s = settings;s.matlab.desktop.DisplayScaleFactor<br />
>> s.matlab.desktop.DisplayScaleFactor.PersonalValue = 2<br />
此设置将在重启 Matlab 后生效。<br />
<br />
=== VirtualBox ===<br />
<br />
{{注意|仅适用于启用了缩放的 KDE。}}<br />
<br />
VirtualBox 按照系统的缩放级别缩放虚拟监视器,从而降低虚拟机的最大分辨率(参见[https://www.virtualbox.org/ticket/16604])。<br />
<br />
可以单独缩小 VirtualBox 来绕过这个问题:<br />
<br />
$ QT_SCALE_FACTOR=0.5 VirtualBox --startvm vm-name<br />
<br />
=== Zoom ===<br />
<br />
可以指定{{ic|1=QT_SCALE_FACTOR}}来启动 Zoom:<br />
<br />
$ QT_SCALE_FACTOR=2 zoom<br />
<br />
=== 不支持的程序 ===<br />
<br />
{{AUR|run_scaled-git}} 可以缩放应用程序(内部使用{{Pkg|xpra}})。<br />
<br />
另一个办法是使每个程序在各自的 VNC 桌面上运行。要缩放 VNC 查看器,使用{{AUR|vncdesk-git}}。你可以为每个程序设置单独的桌面,使用简单的命令启动客户端和服务端,例如{{ic|vncdesk 2}}。<br />
<br />
[[x11vnc]] 有一个实验性的选项 {{ic|-appshare}},可以为每个窗口单独打开一个 VNC 查看器。也许我们可以在上面做些文章。<br />
<br />
== 多显示器 ==<br />
<br />
HIDPI 将会对整个桌面生效,所以如果你同时使用普通显示器,那么在普通显示器上元素会变得过于巨大。但是[[Wayland]] 已经支持为每个显示器设置单独的缩放。<br />
<br />
=== Side display ===<br />
<br />
{{Out of date|1=The bug with the mouse unable to reach the whole screen should be [https://bugs.freedesktop.org/show_bug.cgi?id=39949#c80 fixed in xorg 1.20].}}<br />
<br />
One workaround is to use [[xrandr]]'s scale option. To have a non-HiDPI monitor (on DP1) right of an internal HiDPI display (eDP1), one could run:<br />
<br />
xrandr --output eDP-1 --auto --output DP-1 --auto --scale 2x2 --right-of eDP-1<br />
<br />
When extending above the internal display, you may see part of the internal display on the external monitor. In that case, specify the position manually, e.g. using [https://gist.github.com/wvengen/178642bbc8236c1bdb67 this script].<br />
<br />
You may run into problems with your mouse not being able to reach the whole screen. That is a [https://bugs.freedesktop.org/show_bug.cgi?id=39949 known bug] with an xserver-org patch (or try the panning option, but that might cause other problems).<br />
<br />
An example of the panning syntax for a 4k laptop with an external 1920x1080 monitor to the right:<br />
<br />
xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning 3840x2160+3840+0 --scale 2x2 --right-of eDP-1<br />
<br />
Generically if your HiDPI monitor is AxB pixels and your regular monitor is CxD and you are scaling by [ExF], the commandline for right-of is:<br />
<br />
xrandr --output eDP-1 --auto --output HDMI-1 --auto --panning [C*E]x[D*F]+[A]+0 --scale [E]x[F] --right-of eDP-1<br />
<br />
If panning is not a solution for you it may be better to set position of monitors and fix manually the total display screen.<br />
<br />
An example of the syntax for a 2560x1440 WQHD 210 DPI laptop monitor (eDP1) using native resolution placed below a 1920x1080 FHD 96 DPI external monitor (HDMI) scaled to match global DPI settings:<br />
<br />
xrandr --output eDP-1 --auto --pos 0x1458 --output HDMI-1 --scale 1.35x1.35 --auto --pos 0x0 --fb 2592x2898<br />
<br />
The total screen size (--fb) and positioning (--pos) are to be calculated taking into account the scaling factor.<br />
<br />
In this case laptop monitor (eDP1) has no scaling and uses native mode for resolution so it will total 2560x1440, but external monitor (HDMI) is scaled and it has to be considered a larger screen so (1920*1.35)x(1080*1.35) from where the eDP1 Y position came 1080*1.35=1458 and the total screen size: since one on top of the other X=(greater between eDP1 and HDMI, so 1920*1.35=2592) and Y=(sum of the calculated heights of eDP1 and HDMI, so 1440+(1080*1.35)=2898).<br />
<br />
Generically if your hidpi monitor is AxB pixels and your regular monitor is CxD and you are scaling by [ExF] and hidpi is placed below regular one, the commandline for right-of is:<br />
<br />
xrandr --output eDP-1 --auto --pos 0x(DxF) --output HDMI-1 --auto --scale [E]x[F] --pos 0x0 --fb [greater between A and (C*E)]x[B+(D*F)]<br />
<br />
You may adjust the "sharpness" parameter on your monitor settings to adjust the blur level introduced with scaling.<br />
<br />
{{Note (简体中文)|1=Above solution with {{ic|--scale 2x2}} does not work on some Nvidia cards. No solution is currently available. [https://bbs.archlinux.org/viewtopic.php?pid=1670840] A potential workaround exists with configuring {{ic|1=ForceFullCompositionPipeline=On}} on the {{ic|CurrentMetaMode}} via {{ic|nvidia-settings}}. For more info see [https://askubuntu.com/a/979551].}}<br />
<br />
=== 多外部监视器 ===<br />
<br />
如果你有多于个低于内置的 HiDPI 显示器 DPI 的显示器,那么可能会碰到一些问题。这种情况下您可以想要缩小 HiDPI 显示器的内容,例如:<br />
<br />
xrandr --output eDP1 --scale 0.5x0.5 --output DP2 --right-of eDP1 --output HDMI1 --right-of DP2<br />
<br />
另外,当您缩小内置 HIDPI 显示器中的内容时,内置显示器的字体可能会变得有些模糊。但这与扩大外置显示器内容时带来的模糊并不相同。您可以对比之后选择自己想要的方案。<br />
<br />
=== 镜像 ===<br />
<br />
如果你只想使用镜像的话,可以按照如下操作:<br />
<br />
A×B是你 HiDPI 显示器的原生分辨率,CxD 是你的另一个显示器的原生分辨率。<br />
<br />
xrandr --output HDMI --scale [A/C]x[B/D]<br />
<br />
一个 QHD 的例子(3200/1920 = 1.66 and 1800/1200 = 1.5):<br />
<br />
xrandr --output HDMI --scale 1.66x1.5<br />
<br />
UHD和1080p的例子 (3840/1920=2 2160/1080=2):<br />
<br />
xrandr --output HDMI --scale 2x2<br />
<br />
您可以调整显示器上的清晰度选项以减少模糊感。<br />
<br />
== Linux 控制台 ==<br />
<br />
默认的 [[w:Linux console|Linux 控制台]]在 HiDPI 显示器上太小了。{{Pkg|kbd}}中最大的字体是{{ic|latarcyrheb-sun32}},其他软件包中包含一些更大的字体,例如{{Pkg|terminus-font}}中的{{ic|ter-132n}}和{{ic|ter-132b}}(粗体)。参阅[[Linux console#Fonts]]获取配置详情。<br />
<br />
在改变字体之后,当您切换到其他控制台时,屏幕上的内容可能无法读取。要修复这一问题,你可以设置[[Kernel_mode_setting#Forcing_modes_and_EDID|force specific mode]],例如{{ic|1=video=2560x1600@60}}(设为您显示器的原生分辨率)并重新启动。<br />
<br />
== 另请参阅 ==<br />
<br />
* [https://www.phoronix.com/scan.php?page=article&item=linux_uhd4k_gpus Ultra HD 4K Linux Graphics Card Testing] (Nov 2013)<br />
* [https://www.eizo.com/library/basics/pixel_density_4k/ Understanding pixel density]</div>Fincehttps://wiki.archlinux.org/index.php?title=User:Fince&diff=726958User:Fince2022-04-19T11:20:01Z<p>Fince: </p>
<hr />
<div>Translated:<br />
<br />
[[DaVinci Resolve (简体中文)]]<br />
<br />
[[GNOME (简体中文)/Files (简体中文)]]<br />
<br />
Improved/Updated Translation:<br />
<br />
[[GNOME (简体中文)]]<br />
<br />
[[Steam (简体中文)]]<br />
<br />
[[GTK (简体中文)]]<br />
<br />
[[Java (简体中文)]]</div>Fincehttps://wiki.archlinux.org/index.php?title=Java_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)&diff=726956Java (简体中文)2022-04-19T11:12:46Z<p>Fince: minor edit /* 调试JavaFX应用时系统卡住 */</p>
<hr />
<div>[[Category:Programming languages (简体中文)]]<br />
[[Category:Oracle (简体中文)]]<br />
[[de:Java]]<br />
[[en:Java]]<br />
[[fa:Java]]<br />
[[ja:Java]]<br />
[[pt:Java]]<br />
[[ru:Java]]<br />
{{Related articles start (简体中文)}}<br />
{{Related|Java package guidelines (简体中文)}}<br />
{{Related|Java Runtime Environment Fonts}}<br />
{{Related articles end}}<br />
<br />
{{TranslationStatus (简体中文)|Java|2022-04-19|726950}}<br />
<br />
<br />
<br />
摘自维基百科中的 [[Wikipedia:Java (programming language)|Java]] 词条:<br />
<br />
:Java是一种编程语言,最初由Sun Microsystems开发,并于1995年作为Sun Microsystems的Java平台的核心组件发布。它有很多语法来自C和C++,但对象模型更简洁,底层组件更少。Java的应用一般会编译成能在任何Java虚拟机([[Wikipedia:Java virtual machine|JVM]])而不是特定架构上运行的字节码。<br />
<br />
Arch Linux官方支持开源的第7、8、11和17版的 [https://openjdk.java.net/ OpenJDK]。这些JVM可以并存,并能够通过帮助脚本{{Ic|archlinux-java}}切换。在 [[Arch User Repository (简体中文)|AUR]]中也有一些不受官方支持的Java环境。<br />
<br />
== 安装 ==<br />
<br />
{{Note (简体中文)|<br />
* Arch Linux官方只支持 [[#OpenJDK|OpenJDK]] 实现.<br />
* 刚安装完成的Java环境还无法被Shell({{Ic|$PATH}} 变量)识别。可以在命令行中使用{{Ic|source}}命令读取{{Ic|/etc/profile}},重启,或者注销并重新登入桌面环境来正确更新。}}<br />
<br />
两个''常见的''包经常作为其它包的依赖,分别是 {{Pkg|java-runtime-common}} (包含Java运行环境(JRE)的公共文件) 和 {{Pkg|java-environment-common}} (包括Java开发包(JDK)的公共文件)。包提供的环境配置文件 {{Ic|/etc/profile.d/jre.sh}} 指向由 {{ic|archlinux-java}} 帮助脚本设置的链接 {{Ic|/usr/lib/jvm/default/bin}}。<br />
<br />
{{警告| '''务必'''使用 {{Ic|archlinux-java}}编辑 {{Ic|/usr/lib/jvm/default}} 和 {{Ic|/usr/lib/jvm/default-runtime}} 这两个链接。 }}<br />
<br />
这些链接用来指示位于 {{Ic|<nowiki>/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME}</nowiki>}} 的默认Java运行环境,或位于 {{Ic|<nowiki>/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME}/jre</nowiki>}} 的Java运行环境。<br />
<br />
大多数安装的可执行文件都以链接的形式放在 {{Ic|/usr/bin}} 中,其他可执行文件则在 {{Ic|$PATH}} 指向的位置处。{{Ic|/etc/profile.d/jdk.sh}} 已经不再在包中提供了。<br />
<br />
=== OpenJDK ===<br />
<br />
[[Wikipedia:OpenJDK|OpenJDK]]是Java平台标准版(Java SE)的开源实现,也是官方的参考实现。有几个OpenJDK构建的分发,如[https://adoptium.net Adoptium](以前称为AdvertOpenJDK)和[https://aws.amazon.com/corretto/ Amazon Corretto]。Arch Linux的OpenJDK包由[https://hg.openjdk.java.net/ 上游的OpenJDK源代码]构建。<br />
<br />
;Headless JRE: Java的最小运行环境 - 执行非GUI的Java程序所需。<br />
;Full JRE: 完全的Java运行环境 - 执行Java GUI程序所需,依赖于headless JRE。<br />
;JDK:[[Wikipedia:Java Development Kit|Java Development Kit]] - Java开发所需, 依赖于 full JRE。<br />
<br />
{| class="wikitable"<br />
! 版本 !! Headless JRE !! Full JRE !! JDK !! 文献 !! 源码<br />
|-<br />
| [https://openjdk.java.net/projects/jdk/17/ OpenJDK 17] || {{Pkg|jre-openjdk-headless}} || {{Pkg|jre-openjdk}} || {{Pkg|jdk-openjdk}} || {{Pkg|openjdk-doc}} || {{Pkg|openjdk-src}}<br />
|-<br />
| [https://openjdk.java.net/projects/jdk/11/ OpenJDK 11] || {{Pkg|jre11-openjdk-headless}} || {{Pkg|jre11-openjdk}} || {{Pkg|jdk11-openjdk}} || {{Pkg|openjdk11-doc}} || {{Pkg|openjdk11-src}}<br />
|-<br />
| [https://openjdk.java.net/projects/jdk8/ OpenJDK 8] || {{Pkg|jre8-openjdk-headless}} || {{Pkg|jre8-openjdk}} || {{Pkg|jdk8-openjdk}} || {{Pkg|openjdk8-doc}} || {{Pkg|openjdk8-src}}<br />
|}<br />
<br />
{{App|OpenJDK GA|Latest OpenJDK General-Availability Release build from Oracle.|https://jdk.java.net|{{AUR|java-openjdk-bin}}}}<br />
{{App|OpenJDK EA|Latest OpenJDK Early-Access build for development version from Oracle.|https://jdk.java.net|{{AUR|java-openjdk-ea-bin}}}}<br />
<br />
{{App|IcedTea-Web|Java Web Start and the deprecated Java browser plugin.|https://icedtea.classpath.org/download/icedtea-web-docs/1.8/html/en/icedtea-web.html|{{Pkg|icedtea-web}}}}<br />
<br />
=== OpenJFX ===<br />
<br />
[https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX] is the open-source implementation of [[Wikipedia:JavaFX|JavaFX]]. You [https://wiki.openjdk.java.net/display/OpenJFX/Repositories+and+Releases do not need] to install this package if you are using Oracle JDK. This package only concerns users of the open source implementation of Java (OpenJDK project), and its derivatives.<br />
<br />
{| class="wikitable"<br />
! 版本 !! 运行环境与开发 !! 文档 !! 源码<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 18] || {{Pkg|java-openjfx}} || {{Pkg|java-openjfx-doc}} || {{Pkg|java-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 17] || {{Pkg|java17-openjfx}} || {{Pkg|java17-openjfx-doc}} || {{Pkg|java17-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 11] || {{Pkg|java11-openjfx}} || {{Pkg|java11-openjfx-doc}} || {{Pkg|java11-openjfx-src}}<br />
|-<br />
| [https://wiki.openjdk.java.net/display/OpenJFX/Main OpenJFX 8] || {{AUR|java8-openjfx}} || {{AUR|java8-openjfx-doc}} || {{AUR|java8-openjfx-src}}<br />
|}<br />
<br />
{{App|OpenJFX GA|Latest OpenJFX General-Availability Release build from Gluon.|https://openjfx.io/|{{AUR|java-openjfx-bin}}}}<br />
{{App|OpenJFX EA|Latest OpenJFX Early-Access build for development version from Gluon.|https://openjfx.io/|{{AUR|java-openjfx-ea-bin}}}}<br />
<br />
=== 其他实现 ===<br />
<br />
{{App|Oracle JDK|Oracle's commercially licensed build of OpenJDK.|https://www.oracle.com/technetwork/java/javase/downloads/index.html|{{AUR|jre}} {{AUR|jre12}} {{AUR|jre11}} {{AUR|jre10}} {{AUR|jre9}} {{AUR|jre8}} {{AUR|jre7}} {{AUR|jre6}} {{AUR|jdk}} {{AUR|jdk12}} {{AUR|jdk11}} {{AUR|jdk10}} {{AUR|jdk9}} {{AUR|jdk8}} {{AUR|jdk7}} {{AUR|jdk6}} {{AUR|jdk-devel}}}}<br />
{{App|OpenJ9|Eclipse's implementation of JRE, contributed by IBM.|https://www.eclipse.org/openj9/|{{AUR|jdk-openj9-bin}} {{AUR|jdk14-openj9-bin}} {{AUR|jdk13-openj9-bin}} {{AUR|jdk12-openj9-bin}} {{AUR|jdk11-openj9-bin}} {{AUR|jdk10-openj9-bin}} {{AUR|jdk9-openj9-bin}} {{AUR|jdk8-openj9-bin}}}}<br />
{{App|IBM Certified|IBM Semeru Runtime Certified Edition.|https://www.ibm.com/semeru-runtimes/downloads|{{AUR|jdk11-j9-bin}}}}<br />
{{App|IBM J9|IBM's implementation of JRE, using OpenJ9 contributions.|https://www.ibm.com/support/pages/java-sdk-downloads|{{AUR|jdk8-j9-bin}} {{AUR|jdk7-j9-bin}} {{AUR|jdk7r1-j9-bin}}}}<br />
{{App|Parrot VM|a VM with experimental support for Java [http://trac.parrot.org/parrot/wiki/Languages] through two different methods: either as a [https://code.google.com/p/parrot-jvm/ Java VM bytecode translator], or as a [https://github.com/chrisdolan/perk Java compiler targeting the Parrot VM]. Parrot is [https://github.com/parrot/parrot/issues/1243 not actively developed since 2017].|http://www.parrot.org/|{{AUR|parrot}}}}<br />
<br />
{{Note|Oracle JDK的32位版本可以通过前缀{{ic|bin32-}}找到,如{{AUR|bin32-jre}}。其使用{{AUR|java32-runtime-common}},功能与{{Pkg|java-runtime-common}}相同,但添加了{{ic|32}}的后缀,如{{ic|java32}}。{{AUR|java32-environment-common}}也是同理,只有32位的JDK包使用它。}}<br />
<br />
=== 开发工具 ===<br />
<br />
对于集成开发环境,见[[List of applications#Integrated development environments]] 和''Java IDEs''子分区。<br />
<br />
为了阻止逆向工程,可以使用{{AUR|proguard}}等混淆器。<br />
<br />
==== 反编译器 ====<br />
<br />
* {{App|CFR|Java decompiler, supporting modern features of Java 9, 10 and beyond.|https://www.benf.org/other/cfr/|{{AUR|cfr}}}}<br />
* {{App|Fernflower|Analytical decompiler for Java, developed as part of [[IntelliJ IDEA]].|https://github.com/JetBrains/intellij-community/tree/master/plugins/java-decompiler/engine|{{AUR|fernflower-git}}}}<br />
* {{App|Krakatau|Java decompiler, assembler, and disassembler.|https://github.com/Storyyeller/Krakatau|{{AUR|krakatau-git}}}}<br />
* {{App|Procyon decompiler|Experimental Java decompiler, inspired by ILSpy and Mono.Cecil.|https://bitbucket.org/mstrobel/procyon/wiki/Java%20Decompiler|{{AUR|procyon-decompiler}}}}<br />
* {{App|Java Decompiler (JD-Core)|Popular Java decompiler providing a GUI (see JD-GUI) and supporting Java 1-10.|https://java-decompiler.github.io/|{{AUR|jd-core-java}}}}<br />
* {{App|Jadx|Android DEX to Java decompiler with an optional GUI (see Jadx-GUI)|https://github.com/skylot/jadx|{{Pkg|jadx}}}}<br />
* {{App|[[Wikipedia:JAD (software)|JAD]]|Unmaintained Java decompiler (last release 2006).|https://varaneckas.com/jad|{{Pkg|jad}}}}<br />
<br />
==== GUI前端 ====<br />
<br />
* {{App|Bytecode Viewer|Java reverse engineering suite, including a decompiler, editor and debugger; Frontend for CFR/Fernflower/Procyon|https://bytecodeviewer.com|{{AUR|bytecode-viewer}}}}<br />
* {{App|Recaf|An easy to use modern Java bytecode editor that abstracts away the complexities of Java programs; Frontend for CFR/Fernflower/Procyon|https://www.coley.software/Recaf/|{{AUR|recaf-bin}}}}<br />
* {{App|Java Decompiler (JD-GUI)|Popular Java decompiler providing a GUI and supporting Java 1-10; Frontend for JD-Core|https://java-decompiler.github.io/|{{AUR|jd-gui}}}}<br />
* {{App|Jadx-GUI|Android APK DEX to Java decompiler with an optional GUI; Frontend for Jadx|https://github.com/skylot/jadx|{{Pkg|jadx}}}}<br />
* {{App|Luyten|An Open Source Java Decompiler Gui; Frontend for Procyon|https://github.com/deathmarine/Luyten|{{AUR|luyten}}}}<br />
<br />
== 在JVM间切换 ==<br />
<br />
帮助脚本 {{Ic|archlinux-java}} 提供了如下功能:<br />
<br />
archlinux-java <COMMAND><br />
<br />
COMMAND:<br />
status List installed Java environments and enabled one<br />
get Return the short name of the Java environment set as default<br />
set <JAVA_ENV> Force <JAVA_ENV> as default<br />
unset Unset current default Java environment<br />
fix Fix an invalid/broken default Java environment configuration<br />
<br />
=== 列出兼容的安装了的Java环境 ===<br />
<br />
$ archlinux-java status<br />
<br />
例如:<br />
<br />
$ archlinux-java status<br />
Available Java environments:<br />
java-7-openjdk (default)<br />
java-8-openjdk/jre<br />
<br />
这里的''(default)''表示目前默认使用{{Ic|java-7-openjdk}},Java和其他二进制文件的调用都将依赖于此Java安装。前面的输出中也显示,这里只安装了OpenJDK 8的JRE部分。<br />
<br />
=== 改变默认Java环境 ===<br />
<br />
# archlinux-java set <JAVA_ENV_NAME><br />
<br />
例如:<br />
<br />
# archlinux-java set java-8-openjdk/jre<br />
<br />
{{Tip (简体中文)|若要看到可用的{{ic|<JAVA_ENV_NAME>}}名称, 请使用{{ic|archlinux-java status}}。}}<br />
<br />
注意,{{Ic|archlinux-java}} 不会允许您设置无效的Java环境。在前面的例子中,只安装了{{pkg|jre8-openjdk}},而'''没有'''安装{{pkg|jdk8-openjdk}},所以设置{{Ic|java-8-openjdk}}将会失败:<br />
<br />
# archlinux-java set java-8-openjdk<br />
'/usr/lib/jvm/java-8-openjdk' is not a valid Java environment path<br />
<br />
=== 取消设置的默认Java环境 ===<br />
<br />
无需取消Java环境的设置,因为提供环境的软件包通常会考虑到这一点。但若想这样做,只需使用{{ic|unset}}命令:<br />
<br />
# archlinux-java unset<br />
<br />
=== 解决默认Java环境的问题 ===<br />
<br />
如果设置了一个无效的Java环境链接,尝试调用{{ic|archlinux-java fix}}命令以修复它。还要注意,如果没有设置默认的Java环境,它将寻找有效的环境并尝试设置。它会优先考虑官方支持的软件包"OpenJDK 8"。<br />
<br />
# archlinux-java fix<br />
<br />
=== 运行非默认Java版本的程序 ===<br />
<br />
如果想用另一个版本的Java启动一个程序(例如系统同时安装了Java 18和11),可以用一个bash脚本包装应用程序,在本地改变Java的默认路径。例如默认版本是Java 18,而您要使用java 11:<br />
<br />
#!/bin/sh <br />
<br />
export PATH=/usr/lib/jvm/java-8-openjdk/jre/bin/:$PATH<br />
exec /path/to/application "$@"<br />
<br />
For a [[Systemd|systemd]] service you can append {{ic|JAVA_HOME}} to environment variables in the [[Systemd#Drop-in_files|drop-in file]]:<br />
<br />
{{hc|/etc/systemd/system/''unit''.d/override.conf|2=<br />
[Service]<br />
Environment=JAVA_HOME=/usr/lib/jvm/java-11-openjdk<br />
}}<br />
<br />
== 软件包支持{{ic|archlinux-java}}的先决条件 ==<br />
<br />
{{Note (简体中文)|这条信息同样适用于 {{ic|archlinux32-java}} 的32位Java包, 如果它们的包或者可执行名字里有 {{ic|32}} ,都可适用.}}<br />
<br />
这个分区的信息针对愿意提供包作为备份JVM给 [[Arch User Repository (简体中文)|AUR]] 的贡献者, 并且能够用 {{Ic|archlinux-java}}集成Arch Linux JVM方案. 如果要这样的话,这些包应该:<br />
<br />
* 把所有文件放在{{Ic|/usr/lib/jvm/java-${JAVA_MAJOR_VERSION}-${VENDOR_NAME} }}<br />
* 确认所有的 [https://archlinux.org/packages/extra/any/java-runtime-common/files/ java-runtime-common] 和 [https://archlinux.org/packages/extra/any/java-environment-common/files/ java-environment-common] 提供的可执行链接在相关包里都可用 <br />
* 把所有链接从 {{Ic|/usr/bin}} 移动到可执行文件里, 除非这些链接不属于 [https://archlinux.org/packages/extra/any/java-runtime-common/files/ java-runtime-common] 和 [https://archlinux.org/packages/extra/any/java-environment-common/files/ java-environment-common]<br />
* 用 {{Ic|-${VENDOR_NAME}${JAVA_MAJOR_VERSION} }} 的格式给手册页添加后缀 (查阅 [https://archlinux.org/packages/extra/x86_64/jre8-openjdk/files/ jre8-openjdk file list] 它的手册页用 {{Ic|-openjdk8}}做后缀)<br />
* 不要定义任何 [[PKGBUILD (简体中文)#conflicts|冲突]] 和[[PKGBUILD (简体中文)#replaces|替代]] ,用其他的JDK, {{Ic|java-runtime}}, {{Ic|java-runtime-headless}} 和 {{Ic|java-environment}}<br />
* 在''安装函数'' 里使用{{Ic|archlinux-java}} 脚本以将Java环境设置为默认 '''如果没有其他可用的Java环境准备设置的话''' (即: 这些包不应该 '''强制''' 被装为默认). 查阅 [https://github.com/archlinux/svntogit-packages/blob/packages/java7-openjdk/trunk officially supported Java environment package sources] 做例子<br />
<br />
同时也要注意:<br />
* 包需要的'''任何'''Java环境都应声明依赖,和通常一样在{{Ic|java-runtime}}、{{Ic|java-runtime-headless}}或{{Ic|java-environment}}里声明。<br />
* 包如果需要'''特定的Java提供商''',应该在相关包里声明依赖。<br />
* OpenJDK 包现在应该声明 {{Ic|1=provides="java-runtime-openjdk=${pkgver}"}} 等. 这能让第三方的包在没有特定版本要求的OpenJDK里声明依赖<br />
<br />
== 疑难解答 ==<br />
<br />
=== MySQL ===<br />
<br />
由于JDBC-drivers经常使用URL中的端口来建立与数据库的连接,它被认为是 “远程”的(即MySQL不会按照其默认设置监听该端口),尽管它们可能运行在同一台主机上,因此,若要使用JDBC和MySQL,应按照[[MariaDB#Grant remote access]]中的说明,启用对MySQL的远程访问。<br />
<br />
=== IntelliJ IDEA ===<br />
<br />
如果在设置JDK的时候选择了系统的JDK,同时碰到了错误提示{{ic|The selected directory is not a valid home for JDK}},此时应重新安装另一个JDK包,并在IDEA设置中选择它。<br />
<br />
=== 伪装成另一个窗口管理器 ===<br />
<br />
可以使用[https://tools.suckless.org/x/wmname suckless.org]中的{{Pkg|wmname}}来使JVM相信其正运行于其它窗口管理器。这也许能解决在[[Awesome (简体中文)|Awesome]]或[[Dwm (简体中文)|Dwm]]或[[Ratpoison (简体中文)|Ratpoison]]等窗口管理器中出现的Java GUI渲染问题。尝试设置 "compiz "或 "LG3D":<br />
<br />
$ wmname LG3D<br />
<br />
运行了这条命令后,必须重启有问题的程序。<br />
<br />
这种做法能够有效,是因为JVM包含了一个已知的、non-re-parenting窗口管理器的硬编码列表。<br />
<br />
=== 字体难以辨认 ===<br />
<br />
除了下面[[#更好的字体渲染]]中的建议,有些字体可能依然难以辨认。使用微软的字体或许能有所改善,安装{{AUR|ttf-ms-fonts}}即可。<br />
<br />
=== 某些应用没有文字 ===<br />
<br />
如果某些应用完全没有文字,使用{{Bug|40871}}中建议的[[#Tips and tricks]]下的选项可能会有所帮助。<br />
<br />
=== 灰色窗口/应用不随窗口管理器调整大小/菜单自动关闭 ===<br />
<br />
标准的Java GUI工具包有一个non-re-parenting窗口管理器的硬编码列表,如果使用不在该列表中的窗口管理器,在运行某些Java应用时可能会有问题。最常见的问题之一是Java应用渲染成了一个灰色盒子而不是GUI。另一个问题是菜单能够响应点击,但马上又会关闭。<br />
<br />
以下内容也许有所帮助:<br />
<br />
* 见[[#伪装成另一个窗口管理器]]。<br />
* 对于{{Pkg|jre8-openjdk}},在{{ic|/etc/profile.d/jre.sh}}中添加一行{{ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}},然后重新登录系统。<br />
* 对于最新版本的JDK,执行窗口管理器之前,在{{ic|~/.xinitrc}}中添加一行{{ic|1=export AWT_TOOLKIT=MToolkit}}。<br />
* 对于Oracle的JRE/JDK,使用[https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Using_SetWMName SetWMName],但当同时使用{{ic|XMonad.Hooks.EwmhDesktops}}时可能无效。这种情况下,在{{ic|>> setWMName "LG3D"}}中添加{{ic|LogHook}}可能会有帮助。<br />
* 对于[[sway]], {{ic|1=export _JAVA_AWT_WM_NONREPARENTING=1}}可能可以解决问题。<br />
<br />
详见[https://wiki.haskell.org/Xmonad/Frequently_asked_questions#Problems_with_Java_applications.2C_Applet_java_console]。<br />
<br />
=== 调试JavaFX应用时系统卡住 ===<br />
<br />
如果调试JavaFX应用时系统卡住了,可以尝试提供JVM选项{{ic|1=-Dsun.awt.disablegrab=true}}。<br />
<br />
见[https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6714678]。<br />
<br />
=== JavaFX's MediaPlayer constructor throws an exception ===<br />
<br />
从JavaFX的声音模块中创建MediaPlayer类的实例可能会产生以下异常(Oracle JDK和OpenJDK都是如此):<br />
<br />
... (i.e. FXMLLoader construction exceptions) ...<br />
Caused by: MediaException: UNKNOWN : com.sun.media.jfxmedia.MediaException: Could not create player! : com.sun.media.jfxmedia.MediaException: Could not create player!<br />
at javafx.scene.media.MediaException.exceptionToMediaException(MediaException.java:146)<br />
at javafx.scene.media.MediaPlayer.init(MediaPlayer.java:511)<br />
at javafx.scene.media.MediaPlayer.<init>(MediaPlayer.java:414)<br />
at <constructor call><br />
...<br />
<br />
这是因为JavaFX和Arch Linux仓库中的{{pkg|ffmpeg}}构建不兼容。<br />
<br />
安装{{AUR|ffmpeg-compat-55}}以解决问题。<br />
<br />
见[https://www.reddit.com/r/archlinux/comments/70o8o6/using_a_javafx_mediaplayer_in_arch]。<br />
<br />
=== Java程序无法打开外部链接 ===<br />
<br />
如果Java应用无法将链接打开到浏览器等应用,请安装{{Pkg|gvfs}},因为Desktop.Action.BROWSE办法依赖于它。<br />
<br />
见[https://bugs.launchpad.net/ubuntu/+source/openjdk-8/+bug/1574879/comments/2]。<br />
<br />
=== Error initializing QuantumRenderer: no suitable pipeline found ===<br />
<br />
可能的问题和解决方法:<br />
<br />
* 没有GTK2。安装{{Pkg|gtk2}}。<br />
* 没有OpenJFX。安装{{Pkg|java-openjfx}}。<br />
<br />
== 提示和技巧 ==<br />
<br />
{{Note (简体中文)|本节中的建议适用于所有使用明确安装(外部)的Java运行环境的应用。有些应用捆绑了自己(私有)的运行环境,或使用自己的GUI、字体渲染等机制,以下内容不一定完全适用于这种情况。}}<br />
<br />
大多数Java应用的行为都可以通过向Java运行时提供预定义变量来控制。从[https://bbs.archlinux.org/viewtopic.php?id=72892 这个论坛帖子]来看,一种方法是在{{ic|~/.bash_profile}}中添加以下一行 (或在{{ic|/etc/profile.d/jre.sh}}添加来影响那些不通过{{ic|~/.bash_profile}}运行的程序):<br />
<br />
export _JAVA_OPTIONS="-D'''<option 1>''' -D'''<option 2>'''..."<br />
<br />
例如,使用系统抗锯齿字体并使swing使用GTK的外观与体验(look and feel):<br />
<br />
export _JAVA_OPTIONS='-Dawt.useSystemAAFontSettings=on -Dswing.aatext=true -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel'<br />
<br />
Three such variables exist, the options which are explained later in the table below take priority.<br />
<br />
{| class="wikitable" <br />
|-<br />
| JAVA_TOOL_OPTIONS<br />
| Affects applications as well as tools like javac or the jshell.<br />
|-<br />
| JDK_JAVA_OPTIONS<br />
| Affects applications (everything started via the java command). Requires Java 9.<br />
|-<br />
| (command line options)<br />
| Arguments specified before the "class name" argument are Java options.<br />
|-<br />
| _JAVA_OPTIONS<br />
| The old way, affects applications and tools.<br />
|}<br />
<br />
=== 更好的字体渲染 ===<br />
<br />
开源和闭源的Java实现都有不合适的抗锯齿字体实现. 这可以通过以下办法来解决: {{Ic|1=-Dawt.useSystemAAFontSettings=on}}, {{Ic|1=-Dswing.aatext=true}}<br />
无论Java的开源还是闭源实现,其中都有字体抗锯齿不恰当的问题,可以通过以下选项解决:{{ic|1=-Dawt.useSystemAAFontSettings=on}},{{ic|1=-Dswing.aatext=true}}。<br />
<br />
详见[[Java Runtime Environment fonts]]。<br />
<br />
=== 禁止命令行里的 'Picked up _JAVA_OPTIONS' 消息 ===<br />
<br />
设置 JDK_JAVA_OPTIONS 环境变量会使 java (openjdk) 向stderr写出以下形式的信息:'Picked up JDK_JAVA_OPTIONS=...'。为了禁止终端中显示这些信息,可以在{{ic|~/.bashrc}}中取消设置环境变量,并alias java,将这些选项传递为命令行参数:<br />
<br />
_SILENT_JAVA_OPTIONS="$_JAVA_OPTIONS"<br />
unset _JAVA_OPTIONS<br />
alias java='java "$_SILENT_JAVA_OPTIONS"'<br />
<br />
非交互式的Shell,如Java程序的启动脚本,(通常)不读取{{ic|~/.bashrc}},但仍从其父进程中继承了导出的变量(而父进程又在某个时间从读取了{{ic|~/.bash_profile}}的登录Shell中继承了它)。<br />
<br />
至于这种情况,一般会在{{ic|~/.bashrc}}的开头放一个声明,以避免读取文件。这样变量就会传递到通过桌面菜单启动的程序,如果是交互式Shell,则会使用alias来代替(这则不能用于脚本)。<br />
<br />
=== GTK LookAndFeel(外观与体验) ===<br />
<br />
如果你的Java程序看起来很丑, 你可能想为swing组件设置默认外观与体验:<br />
<br />
swing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel<br />
<br />
一些Java程序坚持用跨平台的金属风格外观与体验。在这些情况下,你可以通过设置下面的属性强制这些app用GTK外观和外观:<br />
<br />
swing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel<br />
<br />
==== GTK3支持 ====<br />
<br />
在Java 9以前,GTK LookAndFeel是针对GTK2链接的,而许多较新的桌面应用程序使用GTK3。这种GTK版本之间的不兼容可能会破坏使用Java插件的GUI应用程序,因为在Java不支持在同一进程中混合使用GTK2和GTK3(如LibreOffice 5.0)。<br />
<br />
GTK LookAndFeel可以针对GTK{{ic|2}}、{{ic|2.2}}和{{ic|3}}运行,默认为GTK3。可以修改以下属性以调整。<br />
<br />
{{Ic|1=jdk.gtk.version=3}}<br />
<br />
=== HiDPI ===<br />
<br />
根据GUI框架的不同,[[HiDPI#Java applications]]可以使用不同的方法启用。<br />
<br />
=== 更好的2D性能 ===<br />
<br />
切换到基于OpenGL的硬件加速管道可以提高2D性能:<br />
<br />
export _JAVA_OPTIONS='-Dsun.java2d.opengl=true'<br />
<br />
{{Note (简体中文)|启用该选项可能会导致像JetBrains IDEs这样的软件的UI出现问题,如只绘制部分绘制窗口、弹出窗口和工具栏。}}<br />
<br />
== 另见 ==<br />
<br />
* [https://math.hws.edu/javanotes8/ Introduction to Programming Using Java]</div>Fince