Skip to content

Commit

Permalink
sway
Browse files Browse the repository at this point in the history
  • Loading branch information
huataihuang committed Sep 13, 2023
1 parent c27c1e7 commit 76138f3
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 8 deletions.
55 changes: 50 additions & 5 deletions source/linux/desktop/sway/sway_gentoo.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,73 @@ Sway有一些 USE flags 可以微调:
:caption: ``mesa`` 的USE Flag会触发 ``libglvnd`` 安装
:emphasize-lines: 10

我最终没有配置USE flag,使用默认参数安装

配置
======

- 将系统配置文件复制:
- 先将全局配置复制到个人目录下:

.. literalinclude:: run_sway/cp_sway_config
:language: bash
:caption: 复制sway个人配置

- 启动:

.. literalinclude:: sway_gentoo/run_sway
:caption: 直接运行 ``sway``

报错处理
----------

这里我遇到一个报错:

.. literalinclude:: sway_gentoo/run_sway_err
:caption: 直接运行 ``sway`` 报错

这是因为:

- 没有安装和配置 ``seatd``
- 没有设置好用户的环境变量 ``XDG_RUNTIME_DIR`` (也就是每个用户需要有独立分离的运行时目录)

解决方法:

- 安装 ``sys-auth/seatd`` 并且配置用户 ``huatai`` 到对应组,以及启动服务:

.. literalinclude:: sway_gentoo/seatd
:language: bash
:caption: 安装和配置 ``seatd``

- 然后为用户 ``huatai`` 配置 ``~/.bashrc`` 添加如下内容设置用户环境变量:

.. literalinclude:: sway_gentoo/bashrc
:language: bash
:caption: 配置用户环境变量 ``~/.bashrc``

- 补充安装 ``foot`` (因为默认配置中使用了 ``foot`` 作为终端):

.. literalinclude:: sway_gentoo/install_foot
:caption: 安装foot终端软件

.. note::

我发现在安装 ``foot`` 的依赖包 ``dev-libs/libutf8proc`` 提供了一个 USE flag ``cjk`` 是用来支持Multi-byte character languages (Chinese, Japanese, Korean)

现在就能正常启动 ``sway`` 了,不过此时还不能充分发挥高分辨率屏幕特性,待继续优化...

终端模拟器
============

默认终端模拟器是 ``foot`` ,一个非常轻量级的终端,但是可能对中文支持不好
默认终端模拟器是 ``foot`` ,一个非常轻量级的终端, :strike:`但是可能对中文支持不好` (我这次实践开启了cjk支持,待验证)

Gentoo的wiki中推荐 ``x11-terms/alacritty`` 是原生Wayland程序,而且使用 :ref:`rust` 编写,性能卓越。

应用程序加载器
=================

默认的应用程序加载器是 ``dmeuu`` 但是这个程序依赖X,所以推荐使用 ``dev-libs/bemenu`` (原生Wayland)替代
默认的应用程序加载器是 ``dmenu`` 但是这个程序依赖X,所以推荐使用 ``dev-libs/bemenu`` (原生Wayland)替代

参考
======

- `gentoo wiki: Sway <https://wiki.gentoo.org/wiki/Sway>`_
- `“XDG_RUNTIME_DIR is not set in the environment. Aborting.” error reported by sway whenever I attempt to launch it. <https://www.reddit.com/r/freebsd/comments/lryw8a/xdg_runtime_dir_is_not_set_in_the_environment/>`_
- `gentoo wiki: Seatd <https://wiki.gentoo.org/wiki/Seatd>`_
5 changes: 5 additions & 0 deletions source/linux/desktop/sway/sway_gentoo/bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export XDG_RUNTIME_DIR="/tmp/user/"`id -u`
if [ ! -d $XDG_RUNTIME_DIR ]; then
mkdir -p $XDG_RUNTIME_DIR
chmod 0700 $XDG_RUNTIME_DIR
fi
1 change: 1 addition & 0 deletions source/linux/desktop/sway/sway_gentoo/install_foot
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
emerge --ask gui-apps/foot
1 change: 1 addition & 0 deletions source/linux/desktop/sway/sway_gentoo/run_sway
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
sway
1 change: 1 addition & 0 deletions source/linux/desktop/sway/sway_gentoo/run_sway_err
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
XDG_RUNTIME_DIR is not set in the environment. Aborting
7 changes: 7 additions & 0 deletions source/linux/desktop/sway/sway_gentoo/seatd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
emerge --ask sys-auth/seatd

# 针对OpenRC配置
gpasswd -a huatai video
gpasswd -a huatai seat
rc-update add seatd default
rc-service seatd start
11 changes: 8 additions & 3 deletions source/linux/desktop/sway/sway_gentoo/sway
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# tray 依赖 dbus, dbus 依赖systemd,和我的openrc配置冲突,所以去除
#gui-wm/sway swaybar swaynag tray wallpapers

# 当sway启用wallpapers时需要安装swaybg,此时需要启用 gdk-pixbuf 来支持PNG之外的图片类型
gui-apps/swaybg gdk-pixbuf
gui-wm/sway swaybar swaynag wallpapers

# seatd 用于设置sway环境
sys-auth/seatd server

# foot终端支持cjk多字节语言(中文,日文,韩文)
dev-libs/libutf8proc cjk

0 comments on commit 76138f3

Please sign in to comment.