sway - 共通事項 - 定義


クラウディア 


1. 概要
2. 定義
3. キー定義

1. 概要

 まずは、大元になる定義の話から。  各プラットフォームとの比較も掲載しておきます。

2. 定義

 定義ファイルは、下記にあります。
プラットフォーム システムファイル ユーザファイル 備考
Fedora /etc/sway ~/.config/sway/config ※1
/usr/share/sway/config.d
FreeBSD /usr/local/etc/sway/config ~/.config/sway/config ※2
Garuda Linux /etc/skel/.config/sway ~/.config/sway/config ※3
Manjaro /etc/sway ~/.config/sway/config ※4
CachyOS /etc/sway ~/.config/sway/config ※5

 ※1 「Fedora」では、2つのシステムファイル用のフォルダを持っています。
 「/etc/sway」配下は、下記のフォルダ・ファイル構成になっています。


/etc/sway
|-- config
|-- config.d
|   |-- 10-systemd-cgroups.conf
|   `-- 10-systemd-session.conf
`-- environment
 「/usr/share/sway/config.d/」配下は、下記のファイル構成になっています。

/usr/share/sway/config.d/
|-- 50-rules-browser.conf
|-- 50-rules-pavucontrol.conf
|-- 50-rules-policykit-agent.conf
|-- 60-bindings-brightness.conf
|-- 60-bindings-media.conf
|-- 60-bindings-screenshot.conf
|-- 60-bindings-volume.conf
|-- 65-mode-passthrough.conf
|-- 90-bar.conf
|-- 90-swayidle.conf_
|-- 95-autostart-policykit-agent.conf
|-- 95-xdg-desktop-autostart.conf
`-- 95-xdg-user-dirs.conf
 デフォルトでは、ユーザ用のフォルダは用意されていませんが、作成してファイルを置けば、有効になります。
 ※2 「FreeBSD」での設定は、「Garuda Linux」を見習いたいと思います。


mkdir -pv ~/.config/sway/config.d
cp /usr/local/etc/sway/config ~/.config/sway/.
vi ~/.config/sway/config
 末尾の下記を

include /usr/local/etc/sway/config.d/*
 下記へ変更します。

include $HOME/.config/sway/config.d/*
 ※3 「Garuda Linux」では「/etc/skel/.config/sway」配下も「~/.config/sway」配下も、下記のフォルダ・ファイル構成になっています。


|-- cheatsheet
|-- config
|-- config.d
|   |-- application_defaults
|   |-- autostart_applications
|   |-- clamshell
|   |-- default
|   |-- input
|   |-- output
|   `-- theme
`-- scripts
    |-- clamshell.sh
    |-- import-gsettings
    |-- light.sh
    |-- lockman.sh
    |-- screenshot.sh
    `-- swayfader.py
 ※4 「Manjaro」では「/etc/sway」配下と「~/.config/sway」配下が、それぞれ、下記のフォルダ・ファイル構成になっています。


/etc/sway
|-- config
|-- config.d
|   |-- 50-systemd-user.conf
|   |-- 90-enable-gtk-theme.conf
|   |-- 95-generate-help.conf
|   |-- 96-waybar-config.conf
|   |-- 98-application-defaults.conf
|   `-- 99-autostart-applications.conf
|-- definitions
|-- inputs
|   |-- default-keyboard
|   `-- default-touchpad
|-- modes
|   |-- default
|   |-- recording
|   |-- resize
|   |-- scratchpad
|   |-- screenshot
|   `-- shutdown
`-- outputs
    `-- default-screen

~/.config/sway
|-- config
|-- config.d
|   |-- README.md
|   `-- XX-keyboard.conf.example
|-- definitions.d
|   `-- README.md
`-- help.man
 すべてのファイルの中身までは見ていませんが、「~/.config/sway/config」の中は

# Config for sway
#
# Read `man 5 sway` for a complete reference.

# user config directory
include $HOME/.config/sway/config.d/*

# only enable this if every app you use is compatible with wayland
# xwayland disable
 となっており、デフォルトの定義は、「~/.config/sway/config.d」配下で定義しており、カスタマイズする際は、上記に続けて記述していけばいいようです。
 ※5 「CachyOS」では「/etc/sway」配下が、それぞれ、下記のフォルダ・ファイル構成になっています。


/etc/sway
|-- config
`-- config.d
    `-- 50-systemd-user.conf
 デフォルトでは、ユーザファイルが用意されていないので、下記でコピーします。  ログインユーザで。

cp -R /etc/sway ~/.config/sway
 コピーしているので、システムとユーザ用はこの時点で、全く同じです。  一か所、書き直しておきます。

vi ~/.config/sway/config
 末尾の。

include /etc/sway/config.d/*
 の箇所を、ログインユーザ用に書き換えます。

include ~/.config/sway/config.d/*

3. キー定義

 主なキー定義のデフォルトの状態と、わたしがカスタマイズした状態を記述します。
プラットフォームキー定義備考
mod端末を開くウィンドウを
閉じる
表示切替リロードログアウト
CachyOSWinmod+Entermod+Shift+qmod+Shift+spacemod+Shift+cmod+Shift+e
FedoraWinmod+Entermod+Shift+qmod+Shift+spacemod+Shift+cmod+Shift+e
FreeBSDWinmod+Entermod+Shift+qmod+Shift+spacemod+Shift+cmod+Shift+e
Garuda LinuxWinmod+Entermod+qmod+Shift+spacemod+Shift+cmod+Shift+e
ManjaroWinmod+Entermod+Shift+qmod+Shift+spacemod+Shift+cmod+Shift+e


 端末を開くに関して、「Garuda Linux」では、デフォルトの端末を「alacritty」にしているのですが。
 「Wayfire」でもそうでしたが、「alacritty」は起動するとこけます。
 「FreeBSD」で動作した、「foot」をインストールして使用します。
 「Manjaro」では、そのままデフォルトの端末が「foot」になっています。
 「i3wm」には、再起動が「restart」で定義されているのですが、「sway」にはないようです。

 「FreeBSD」は、下記のように編集しています。


vi ~/.config/sway/config

    # Kill focused window
    bindsym $mod+Shift+q kill
 を下記へ。

    # Kill focused window
    bindsym $mod+Shift+q kill
    bindsym $mod+q kill

    # Toggle the current focus between tiling and floating mode
    bindsym $mod+Shift+space floating toggle

    # Swap focus between the tiling area and the floating area
    bindsym $mod+space focus mode_toggle
 を下記へ

    # Toggle the current focus between tiling and floating mode
    bindsym $mod+space focus mode_toggle

    # Swap focus between the tiling area and the floating area
    bindsym $mod+Shift+space floating toggle

AbemaTV 無料体験
世界最大級のオンライン英会話EF English Live