Arch下的Kde配置

2024年的第一篇文章,祝大家新年快乐(虽然有点迟了)

这段时间重装了6次Arch,1次Debian Testing,几乎将主流桌面体验完了,血与泪的教训,wayland目前还不成熟,高分屏还得老老实实用x11

起因

逛B站时偶然看到了有人发Hyprland的配置,再看我的Kde瞬间就不香了

拿出我珍藏多年的Arch Live CD ,F12选择U盘启动,在经过一系列分区,生成fstab,引导后,成功来到了熟悉的tty界面,接下来照着B站的教程,开始安装Hyprland

Hyprland

Hyprland is a highly customizable dynamic tiling Wayland compositor that doesn’t sacrifice on its looks.

Hyprland 是一款高度可定制的动态平铺 Wayland 合成器,不会牺牲其外观。

安装

  1. 首先安装Wayland
1
pacman -S xorg-xwayland qt5-wayland qt6-wayland glfw-wayland
  1. 安装Hyprland
1
paru -S hyprland-bin
  1. 复制配置文件
1
2
mkdir -pv ~/.config/hypr
sudo cp /usr/share/hyprland/hyprland.conf ~/.config/hypr/
  1. Hyprland启动

通过编辑~/.bash_profile启动(不使用显示管理器)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# 启动 wayland 桌面前设置一些环境变量
function set_wayland_env
{
	cd ${HOME}
	# 设置语言环境为中文
	export LANG=zh_CN.UTF-8
	# 解决QT程序缩放问题
	export QT_AUTO_SCREEN_SCALE_FACTOR=1
	# QT使用wayland和gtk
	export QT_QPA_PLATFORM="wayland;xcb"
	export QT_WAYLAND_DISABLE_WINDOWDECORATION=1
	# 使用qt5ct软件配置QT程序外观
	export QT_QPA_PLATFORMTHEME=qt5ct

	# 一些游戏使用wayland
	export SDL_VIDEODRIVER=wayland
	# 解决java程序启动黑屏错误
	export _JAVA_AWT_WM_NONEREPARENTING=1
	# GTK后端为 wayland和x11,优先wayland
	export GDK_BACKEND="wayland,x11"

}

# 命令行输入这个命令启动hyprland,可以自定义
function start_hyprland
{
	set_wayland_env

	export XDG_SESSION_TYPE=wayland
	export XDG_SESSION_DESKTOP=Hyprland
	export XDG_CURRENT_DESKTOP=Hyprland
	# 启动 Hyprland程序
	exec Hyprland

}

重启或直接source ~/.bash_profile使配置生效,输入start_hyprland启动

应用安装

刚进入桌面,你会发现什么也没有,先装个终端和中文字体

1
sudo pacman -S kitty wqy-zenhei

使用快捷键Super+Q即可启动(Super键默认为WIN)

貌似一切都很完美,让我们装个QQ试逝

1
paru -S linuxqq

打开后你会发现字体变得很模糊,不止qq,其他程序在wayland缩放下的显示都不太好

Gnome

GNOME originally an acronym for GNU Network Object Model Environment,is a free and open-source desktop environment for Linux and other Unix-like operating systems.

GNOME是一个完全由自由软件组成的桌面环境。它的目标操作系统是Linux,但是大部分的BSD系统亦支持GNOME。

因为Hyprland的字体问题,我回到了一开始用的gnome;但因为使用wayland的原因,qq下的字体还是模糊,而且缩放有问题,200%会使字体和窗口过大,100%字又太小

1
gsettings set org.gnome.mutter experimental-features "['scale-monitor-framebuffer']"

使用此命令开启分数缩放

缩放是解决了,但字体的问题依旧,目前没找到完美的解决方案,只能用Tweaks工具调整字体大小

Cinnamon

Cinnamon, forked from GNOME Shell, is the “shell” of Cinnamon. It provides the user interface such as panels, hot corners, menus etc. The ui is written in JavaScript, while its core libraries are written in C.

Cinnamon是类Unix系统下的一个桌面环境。最初是GNOME Shell的一个派生版本,由Linux Mint开发,提供了相似于GNOME 2,易于使用的传统用户界面,从Cinnamon 2.0开始,成为独立的桌面环境。

一个由Mint开发的桌面,也是Linux Mint的默认桌面

Cinnamon不同于前两个,使用的是x11,所以基本没有字体和缩放问题,而且桌面和发生版都很适合新手,Debian系的包也比较多

但我不是很喜欢Cinnamon的设计,所以没有使用它

KDE Plasma

Plasma is a graphical shell developed by KDE for Unix-like operating systems. Plasma is a standard desktop interface.

KDE 是一套由 Plasma 桌面环境、一系列的库、框架(KDE Frameworks)和一些应用组成的软件项目。

目前在用的桌面,自定义程度很高,记录下配置过程

汉化不完全

表现为设置/文件管理器一半中文一半英文

编辑~/.config/plasma-localercLANG=h_CN改为LANG=zh_CN.UTF-8,重启后即可解决

系统代理

  1. 手机代理设置-允许来自局域网连接,记录端口;在设置-网络设置-代理服务器中选择-使用手动指定的的代理服务器配置

  2. 手机任意终端su后使用ifconfig获取本机IP,填入代理设置

  3. 终端走代理

1
export https_proxy=http://127.0.0.1:7890 http_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7891

7890/7891为端口号,127.0.0.1为IP

常用应用

1. neovim

使用nvimdots配置,另一选择NcChad

LazyVim is a Neovim setup powered by 💤 lazy.nvim to make it easy to customize and extend your config. Rather than having to choose between starting from scratch or using a pre-made distro, LazyVim offers the best of both worlds - the flexibility to tweak your config as needed, along with the convenience of a pre-configured setup.

1.1 安装
  1. 1.1.1 依赖1
  • Neovim >= 0.9.0 (needs to be built with LuaJIT)
  • Git >= 2.19.0 (for partial clones support)
  • a Nerd Font (optional)
  • a C compiler for nvim-treesitter. See here
  1. 1.1.2 安装

克隆配置

1
git clone https://github.com/LazyVim/starter ~/.config/nvim

nvim启动!

1
nvim
1.2 nvim下的复制粘贴

sudo pacman -S xclip安装xclip后,使用v选中要复制的内容,y复制,p粘贴,d剪切

2. neofetch

相信用过Linux的都听说过这个软件,它能显示系统Ascii art和硬件信息,可以通过修改~/.config/neofetch/config.conf进行配置

参考Kicamon的配置,进行了一些修改,用-代替图标

3. 网易云音乐

写文章时没点音乐怎么行,目前Arch下我认为比较好的解决方法一是yesplaymusic,第二个就是go-musicfox

不过yesplaymusic尝试过三种登陆方式均无法登陆,遂只能使用go-musicfox

go-musicfox是用Go写的又一款网易云音乐命令行客户端,支持UnblockNeteaseMusic、各种音质级别、lastfm、MPRIS、MacOS交互响应(睡眠暂停、蓝牙耳机连接断开响应、菜单栏控制等)…

  1. 使用pacman -S go-musicfox安装go-musicfox
  2. 输入musicfox进入tui
  3. 点击-我的歌单进行登陆
3.1 无法播放

如果你很幸运,能直接播放,可以忽略这一步

1
sudo pacman -S pulseaudio-alsa libavtp

安装缺少的两个包就可以播放了

3.2 快捷键
按键 作用
h 左方向
l 右方向
k 上方向
j 下方向
- 滚轮下 减小音量
= 滚轮上 增大音量
q 退出
Space (空格) 暂停/播放

更多快捷键请看README

Bash

这次安装我离开了Zsh,重新回到了Bash的怀抱,但默认的Prompt太丑了,只显示最后一级路径,于是参考Gentoo.bashrc,重新配置了下

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
# /etc/bash/bashrc
#
# This file is sourced by all *interactive* bash shells on startup,
# including some apparently interactive shells such as scp and rcp
# that can't tolerate any output.  So make sure this doesn't display
# anything or bad things will happen!

# Test for an interactive shell.  There is no need to set anything
# past this point for scp and rcp, and it's important to refrain from
# outputting anything in those cases.
if [[ $- != *i* ]]; then
	# Shell is non-interactive.  Be done now!
	return
fi

# Bash won't get SIGWINCH if another process is in the foreground.
# Enable checkwinsize so that bash will check the terminal size when
# it regains control.  #65623
# http://cnswww.cns.cwru.edu/~chet/bash/FAQ (E11)
shopt -s checkwinsize

# Disable completion when the input buffer is empty.  i.e. Hitting tab
# and waiting a long time for bash to expand all of $PATH.
shopt -s no_empty_cmd_completion

# Enable history appending instead of overwriting when exiting.  #139609
shopt -s histappend
# Save each command to the history file as it's executed.  #517342
# This does mean sessions get interleaved when reading later on, but this
# way the history is always up to date.  History is not synced across live
# sessions though; that is what `history -n` does.
# Disabled by default due to concerns related to system recovery when $HOME
# is under duress, or lives somewhere flaky (like NFS).  Constantly syncing
# the history will halt the shell prompt until it's finished.
#PROMPT_COMMAND='history -a'

# Change the window title of X terminals
case ${TERM} in
[aEkx]term* | rxvt* | gnome* | konsole* | interix | tmux*)
	PS1='\[\033]0;\u@\h:\w\007\]'
	;;
screen*)
	PS1='\[\033_\u@\h:\w\033\\\]'
	;;
*)
	unset PS1
	;;
esac

# Set colorful PS1 only on colorful terminals.
# dircolors --print-database uses its own built-in database
# instead of using /etc/DIR_COLORS.  Try to use the external file
# first to take advantage of user additions.
# We run dircolors directly due to its changes in file syntax and
# terminal name patching.
use_color=false
if type -P dircolors >/dev/null; then
	# Enable colors for ls, etc.  Prefer ~/.dir_colors #64489
	LS_COLORS=
	if [[ -f ~/.dir_colors ]]; then
		eval "$(dircolors -b ~/.dir_colors)"
	elif [[ -f /etc/DIR_COLORS ]]; then
		eval "$(dircolors -b /etc/DIR_COLORS)"
	else
		eval "$(dircolors -b)"
	fi
	# Note: We always evaluate the LS_COLORS setting even when it's the
	# default.  If it isn't set, then `ls` will only colorize by default
	# based on file attributes and ignore extensions (even the compiled
	# in defaults of dircolors). #583814
	if [[ -n ${LS_COLORS:+set} ]]; then
		use_color=true
	else
		# Delete it if it's empty as it's useless in that case.
		unset LS_COLORS
	fi
else
	# Some systems (e.g. BSD & embedded) don't typically come with
	# dircolors so we need to hardcode some terminals in here.
	case ${TERM} in
	[aEkx]term* | rxvt* | gnome* | konsole* | screen | tmux | cons25 | *color) use_color=true ;;
	esac
fi

if ${use_color}; then
	if [[ ${EUID} == 0 ]]; then
		PS1+='\[\033[01;31m\]\h\[\033[01;34m\] \w \$\[\033[00m\] '
	else
		PS1+='\[\033[01;32m\]\u@\h\[\033[01;34m\] \w \$\[\033[00m\] '
	fi

	#BSD#@export CLICOLOR=1

	alias ls='ls --color=auto'
	alias grep='grep --colour=auto'
	alias la='ls -A'
	alias ll='ls -alF'
	alias l='ls -CF'
	alias n='neofetch'
else
	# show root@ when we don't have colors
	PS1+='\u@\h \w \$ '
fi

for sh in /etc/bash/bashrc.d/*; do
	[[ -r ${sh} ]] && source "${sh}"
done

# Try to keep environment pollution down, EPA loves us.
u

主要添加了别名,其他的可以自己修改

还有一个镰刀锤子配置也蛮好看的,但使用键查看历史命令时有Bug,不介意的可以用

1
 PS1="\e[1;32m\w\n\e[1;33m☭ \[$(tput sgr0)\]"

配置来源: https://www.zhihu.com/question/19803678/answer/1001803388

SDDM美化

我们更换壁纸后一般连同SDDM的背景一起换了,但设置里的SDDM主题管理实在是难用,经常打不开更换界面,推荐直接到主题目录下更换

  1. cd到需要配置的SDDM主题目录/usr/share/sddm/themes/

  2. 进入主题文件夹,你会看见之前设置的背景(若有的话),和两个配置文件,分别是预设配置theme.conf和用户配置theme.conf.user

  3. 编辑用户配置theme.conf.user,找到background=100857791_p113767970.png这一行,可以看到目前我的背景为100857791_p113767970.png

  4. 将要设置的背景移入主题文件夹,将background=后的文件名改为要设置的文件名

  5. 重启即可

内核编译

Arch下的内核编译只需要安装两个包即可

1
sudo pacman -S bc inetutils

# inetutils提供hostsname

到这里Arch的配置也基本完成了,我也可以睡个好觉了…

再插一嘴,uu们有好的图床或对象储存推荐吗,博客老没图片也不行,最好能便宜点

参考|引用

Inuyasha 支付宝支付宝
Inuyasha 微信微信
0%