Open30

Ubuntu Sway Remix 24.10 環境構築

goropikarigoropikari

Ubuntu 24.04 に sway をあとから入れたら動作が不安定になってしまったので sway remix を素直に使ってみる。
desktop 用途で LTS にこだわる必要ないので 24.10 を選択
https://ubuntusway.com/

goropikarigoropikari

インストールの設定の時点で日本語を選んだ.

とりあえず、update とブラウザが何も入っていないので firefox を入れた

sudo apt update && sudo apt upgrade -y
sudo apt install -y firefox

ディレクトリが日本語で作られているので英語に変更

LANG=C xdg-user-dirs-update --force
reboot
rm -rf ダウンロード  デスクトップ  ビデオ    ミュージック テンプレート  ドキュメント  ピクチャ  公開
goropikarigoropikari

mozc を入れる

sudo apt install -y fcitx5-mozc
mkdir -p ~/.config/sway/config.d/
echo 'exec fcitx5 -dr' > ~/.config/sway/config.d/fcitx5.conf 
reboot
goropikarigoropikari

適当に要りそうなものを入れる

sudo apt install git ripgrep unzip python3 python3-venv build-essential gdb lldb libreadline-dev alacritty

neovim を最新のものに置き換え

sudo apt remove neovim
mkdir -p ~/.local
cd ~/.local
wget https://github.com/neovim/neovim/releases/download/v0.10.2/nvim.appimage
chmod +x nvim.appimage
sudo ln -sf $HOME/.local/squashfs-root/usr/bin/nvim /usr/local/bin/nvim
git clone https://github.com/goropikari/kickstart.nvim.git ~/.config/nvim
goropikarigoropikari
mkdir -p ~/.config/alacritty
nvim  ~/.config/alacritty/alacritty.toml
[font]
normal = {family = "UbuntuMono Nerd Font Mono", style = "Regular"}
size = 10.5

[terminal.shell]
program = "/usr/bin/zsh"

# neovim で ctrl-p が効くようにするための設定
# https://github.com/alacritty/alacritty/issues/7565#issuecomment-1877828701
[[keyboard.bindings]]
chars = "\u001F"
key = "Slash"
mods = "Control"
goropikarigoropikari

terminal を foot から alacritty に変更

nvim ~/.config/sway/variables.d/terminal.conf
set $term alacritty
set $term_cwd $term --working-directory "$(/usr/share/sway/scripts/swaycwd.sh 2>/dev/null || echo $HOME)"

keybind 定義している /etc/sway/modes/*.conf の読み込みよりも前にされるようにしなければならないっぽい

goropikarigoropikari

sway configuration

~/.config/sway/variables.d/user.conf

# Fonts
set $gui-font Ubuntu 11

# Terminal
set $term alacritty
set $term_cwd $term --working-directory "$(/usr/share/sway/scripts/swaycwd.sh 2>/dev/null || echo $HOME)"

~/.config/sway/config.d/default.conf

# Tittle bar font
font pango:Ubuntu 8

# The right button over a titlebar kills the window
bindsym button3 kill

# window border
default_border normal
smart_borders off
smart_gaps off
gaps inner 0
gaps outer 0
smart_gaps off
hide_edge_borders both

~/.config/sway/config.d/fcitx5.conf

exec fcitx5 -dr
goropikarigoropikari
sudo apt-get install keychain
/usr/bin/keychain -q --nogui $HOME/.ssh/id_ed25519
goropikarigoropikari

golang

wget https://go.dev/dl/go1.23.4.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go1.23.4.linux-amd64.tar.gz
goropikarigoropikari
sudo apt install libyaml-dev
asdf plugin add ruby https://github.com/asdf-vm/asdf-ruby.git
asdf install ruby latest
asdf global ruby latest

asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git
asdf install nodejs 22.12.0
asdf global nodejs 22.12.0
goropikarigoropikari

~/.config/sway/variables.d/user.conf

autotiling が邪魔なので適当なコマンドに置き換え

set $autotiling echo
goropikarigoropikari

rr

sudo apt install rr
echo 1 | sudo tee /proc/sys/kernel/perf_event_paranoid
g++ -g3 ex.cpp
rr record ./a.out
goropikarigoropikari

中華フォント対策を色々試してみたが、gtk settings から日本語フォントにすればいいだけかもしれない

過去ログ

$ fc-match :lang=ja
NotoSansCJK-Regular.ttc: "Noto Sans CJK JP" "Regular"
sudo apt install fonts-ipafont
fc-cache -f

https://chienomi.org/articles/linux/202312-droidsans.html
https://qiita.com/keith_campbell/items/3c3e2752dc44a58709b0

追記

句読点の表示位置が上のほうになっていたがこれを設定して直った
~/.config/fontconfig/fonts.conf

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
  <!-- 日本語用フォントを優先 -->
  <match target="pattern">
    <test qual="any" name="family">
      <string>serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Noto Sans CJK JP</string>
    </edit>
  </match>

  <match target="pattern">
    <test qual="any" name="family">
      <string>sans-serif</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
      <string>Noto Sans CJK JP</string>
    </edit>
  </match>

  <match target="pattern">
    <test qual="any" name="family">
      <string>monospace</string>
    </test>
    <edit name="family" mode="prepend" binding="strong">
        <string>UbuntuMono Nerd Font</string>
    </edit>
  </match>
</fontconfig>
fc-cache -fv
goropikarigoropikari
sudo apt remove libreoffice-common libreoffice-core
sudo apt autoremove
sudo apt intall libreoffice-calc
goropikarigoropikari

wlsunset が動かなくなった。https://freegeoip.live/json/ への curl が 502 返すのでこれのせいっぽい。
ip address から緯度経度を割り出しているらしい。$HOME/.config/wlsunset/config に longitude, latitude を設定すればそれを使うっぽいのでベタする

https://github.com/Ubuntu-Sway/ubuntu-sway-default-settings/blob/c721da627c5653b7b83d811006f7e89519ef3f49/common/etc/sway/variables#L88-L89
https://github.com/Ubuntu-Sway/ubuntu-sway-default-settings/blob/c721da627c5653b7b83d811006f7e89519ef3f49/common/usr/share/sway/scripts/sunset.sh

$HOME/.config/wlsunset/config
location=off
longitude=135
latitude=35
goropikarigoropikari

qmk firmware

sudo apt-get install -y git python3-pip pipx make gcc-avr binutils-avr avr-libc avrdude vim gcc-arm-none-eabi ripgrep wget libc6-i386 libc6-dev-arm64-cross
python -m venv venv
source venv/bin/activate
pip install qmk
qmk setup
goropikarigoropikari
sudo apt install libvirt-dbus

これを入れた影響かわからないが変換候補が出てくるようになった

下線引いたところにチェック入れた影響かもしれない

goropikarigoropikari

zsh

sudo apt install -y zsh
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
sed -i -e 's|robbyrussell|powerlevel10k/powerlevel10k|' ~/.zshrc
source ~/.zshrc
goropikarigoropikari

ctrl-y, ctrl-z で日本語英語切り替えするようにした
mozc 用の keymap

keymap.txt
status	key	command
Composition	Ctrl Backspace	Backspace
Composition	Ctrl Enter	Commit
Composition	Ctrl h	Backspace
Composition	Ctrl i	ConvertToFullKatakana
Composition	Ctrl m	Commit
Composition	Ctrl o	ConvertToHalfWidth
Composition	Ctrl p	ConvertToFullAlphanumeric
Composition	Ctrl t	ConvertToHalfAlphanumeric
Composition	Ctrl y	InputModeHiragana
Composition	Ctrl z	IMEOff
Composition	Delete	Delete
Composition	Down	MoveCursorToEnd
Composition	End	MoveCursorToEnd
Composition	Enter	Commit
Composition	F10	ConvertToHalfAlphanumeric
Composition	F6	ConvertToHiragana
Composition	F7	ConvertToFullKatakana
Composition	F8	ConvertToHalfWidth
Composition	F9	ConvertToFullAlphanumeric
Composition	Home	MoveCursorToBeginning
Composition	Left	MoveCursorLeft
Composition	Right	MoveCursorRight
Composition	Shift Backspace	Backspace
Composition	Shift Muhenkan	ConvertToFullAlphanumeric
Composition	Shift Space	Convert
Composition	Space	Convert
Composition	Tab	PredictAndConvert
Composition	VirtualEnter	Commit
Composition	VirtualLeft	MoveCursorLeft
Composition	VirtualRight	MoveCursorRight
Conversion	Ctrl Down	CommitOnlyFirstSegment
Conversion	Ctrl Enter	Commit
Conversion	Ctrl i	ConvertToFullKatakana
Conversion	Ctrl m	Commit
Conversion	Ctrl n	CommitOnlyFirstSegment
Conversion	Ctrl o	ConvertToHalfWidth
Conversion	Ctrl p	ConvertToFullAlphanumeric
Conversion	Ctrl t	ConvertToHalfAlphanumeric
Conversion	Ctrl y	InputModeHiragana
Conversion	Ctrl z	IMEOff
Conversion	Down	ConvertNext
Conversion	End	SegmentFocusLast
Conversion	Enter	Commit
Conversion	F10	ConvertToHalfAlphanumeric
Conversion	F6	ConvertToHiragana
Conversion	F7	ConvertToFullKatakana
Conversion	F8	ConvertToHalfWidth
Conversion	F9	ConvertToFullAlphanumeric
Conversion	Home	SegmentFocusFirst
Conversion	Left	SegmentFocusLeft
Conversion	PageDown	ConvertNextPage
Conversion	PageUp	ConvertPrevPage
Conversion	Right	SegmentFocusRight
Conversion	Shift Down	ConvertNextPage
Conversion	Shift Muhenkan	ConvertToFullAlphanumeric
Conversion	Shift Right	SegmentWidthExpand
Conversion	Shift Up	ConvertPrevPage
Conversion	Space	ConvertNext
Conversion	Tab	PredictAndConvert
Conversion	Up	ConvertPrev
Conversion	VirtualEnter	CommitOnlyFirstSegment
Conversion	VirtualLeft	SegmentWidthShrink
Conversion	VirtualRight	SegmentWidthExpand
DirectInput	Ctrl y	IMEOn
Precomposition	Backspace	Revert
Precomposition	Ctrl y	InputModeHiragana
Precomposition	Ctrl z	IMEOff
Precomposition	Shift Space	InsertAlternateSpace
Precomposition	Space	InsertSpace
Suggestion	Down	PredictAndConvert
Suggestion	Shift Enter	CommitFirstSuggestion
Composition	ASCII	InsertCharacter
Composition	Kanji	IMEOff
Composition	OFF	IMEOff
Composition	ON	IMEOn
Conversion	Kanji	IMEOff
Conversion	OFF	IMEOff
Conversion	ON	IMEOn
DirectInput	Kanji	IMEOn
DirectInput	ON	IMEOn
Precomposition	ASCII	InsertCharacter
Precomposition	Kanji	IMEOff
Precomposition	OFF	IMEOff
Precomposition	ON	IMEOn
~/.config/fcitx5/conf/mozc.conf
# Initial Mode
InitialMode=Direct
# Vertical candidate list
Vertical=True
# Expand Usage (Requires vertical candidate list)
ExpandMode="On Focus"
# Fix embedded preedit cursor at the beginning of the preedit
PreeditCursorPositionAtBeginning=False
# Hotkey to expand usage
ExpandKey=Control+Alt+H
goropikarigoropikari

terminal で日本語を打ってるときに変換候補がでない