├── Backup.md ├── NVIDIA.md ├── README.md ├── config.sh ├── i3wm ├── .zshrc ├── README.md ├── i3 │ └── config ├── mpd │ └── mpd.conf ├── my_desktop.png └── polybar │ ├── config │ ├── config1 │ └── launch.sh ├── setup.sh └── v2ray.md /Backup.md: -------------------------------------------------------------------------------- 1 | # rsync+btrfs+dm-crypt 备份整个系统 2 | 3 | ## 备份系统(可在图形界面进行) 4 | 5 | ### dm-crypt 加密备份盘 6 | 7 | * 加载dm-crypt模块 8 | * 初始化加密分区 9 | * /dev/sda1:预备的加密分区;该指令输入后需要设定密码 10 | * 打开加密分区 11 | * LzqBackup:设定的加密分区名称;该指令下达后需要输入密码打开 12 | * 建立文件系统 13 | * 将加密分区格式化为 btrfs 格式;主要借助其快照功能实现增量备份 14 | * 挂载加密分区备用 15 | 16 | ```sudo modprobe dm-crypt 17 | cryptsetup luksFormat /dev/sda1 18 | cryptsetup open /dev/sda1 Backup 19 | mkfs.btrfs /dev/mapper/Backup 20 | sudo mount /dev/mapper/Backup /mnt 21 | ``` 22 | 23 | ### 建立相应的目录和子卷结构 24 | 25 | * 备份策略:备份数据放到 backup 目录下,/ 和主目录 /home/primary 分开备份。每个备份是使用日期和时间命名的快照子卷。除了用于每次同步的 current 目录外其它的子卷都是只读的,以免被意外修改。(在 run 目录下是用于直接运行的,可写。这些可以按需建立。) 26 | 27 | ``` 28 | /mnt 29 | |-- backup(dir) 30 | | |-- home(dir) 31 | | | |-- current (subvol, rw) 32 | | | |-- 20131016_1423 (subvol, ro) 33 | | | |-- 20131116_2012 (subvol, ro) 34 | | | |-- ... 35 | | |-- root(dir) 36 | | |-- current (subvol, rw) 37 | | | |-- 20131016_1423 (subvol, ro) 38 | | | |-- 20131116_2012 (subvol, ro) 39 | | | |-- ... 40 | |-- run,for boot up directly, with edited /etc/fstab (dir) 41 | | |-- home (dir) 42 | | | |-- 20131116 (subvol, rw) 43 | | | |-- ... 44 | | |-- root(dir) 45 | | | |-- 20131116 (subvol, rw) 46 | | | |-- ... 47 | |-- etc, store information and scripts (subvol, rw) 48 | ``` 49 | 50 | * 操作步骤 51 | 52 | ``` 53 | sudo mkdir -p /mnt/backup/home 54 | sudo mkdir -p /mnt/backup/root 55 | sudo btrfs subvolume create /mnt/backup/home/current 56 | sudo btrfs subvolume create /mnt/backup/root/current 57 | # 可选: 58 | sudo mkdir -p /mnt/run/home 59 | sudo mkdir -p /mnt/run/root 60 | sudo btrfs subvolume create /mnt/etc 61 | ``` 62 | 63 | ### 使用rysnc备份系统 64 | 65 | * 备份参数含义 66 | * --archive --acls --xattrs --hard-links --sparse --one-file-system 缩写:-aAXHSx 67 | * --archive: 组合选项,用于保留权限、所有者、时间戳和软链接等。通常用于制作备份。 68 | * --acls 和 --xattrs: 包含 ACL(访问控制列表)和扩展属性在传输中。 69 | * --hard-links: 保留硬链接。对于维护硬链接结构很重要。 70 | * --sparse: 高效处理稀疏文件(备份稀疏文件,例如虚拟磁盘、Docker 镜像)。 71 | * --one-file-system: 不越过文件系统边界。确保只同步挂载在 / 的文件系统(不要备份挂载点)。 72 | * --delete: 删除目标中在源中不存在的文件(多次备份时,删除不存在原系统的文件)。 73 | * --delete-excluded: 从目标中删除被排除的文件(多次备份时,删除被排除的文件)。 74 | * --numeric-ids: 不要通过用户/组名映射uid/gid值,使用数值ID(避免在跨系统使用时出差错)。 75 | * --progress: 在传输过程中显示进度(显示备份文件与进度)。 76 | * --info=progress2: 提供详细的进度信息(显示总备份进度)。 77 | * --human-readable: 使用人类可读的格式输出数字。 78 | * --itemize-changes: 输出所有更新的更改摘要。 79 | * --verbose: 增加详细信息。 80 | * --exclude={"/dev/*"}: 从同步中排除指定的目录 81 | 82 | * 运行备份程序 83 | * 可先模拟运行,加入以下指令:--dry-run 84 | 85 | ``` 86 | # 根目录 87 | sudo rsync --archive --acls --xattrs --hard-links --sparse --one-file-system --delete --delete-excluded --numeric-ids --progress --info=progress2 88 | --human-readable --itemize-changes --verbose --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found","/home/*"} / /mnt/backup/root/current 89 | # 主目录 90 | sudo rsync --archive --acls --xattrs --hard-links --sparse --one-file-system --delete --delete-excluded --numeric-ids --progress --info=progress2 91 | --human-readable --itemize-changes --verbose --exclude={"Desktop","Documents","Downloads","Music","Pictures","Public","Templates","Videos"} /home/primary /mnt/backup/home/current 92 | ``` 93 | 94 | ### 增量备份 95 | 96 | * 在/home目录下创建只读快照 97 | * 在/root目录下创建只读快照 98 | * 删除多余备份 99 | * 整理碎片(存疑) 100 | * 卸载备份盘 101 | 102 | ``` 103 | cd /mnt/backup/home 104 | sudo btrfs subvolume snapshot -r current $(date +'%Y%m%d_%H%M') 105 | cd /mnt/backup/root 106 | sudo btrfs subvolume snapshot -r current $(date +'%Y%m%d_%H%M') 107 | sudo btrfs subvolume delete /mnt/backup/home/subvol_name 108 | sudo btrfs subvolume delete /mnt/backup/root/subvol_name 109 | sudo btrfs filesystem defragment /mnt/backup(存疑) 110 | sudo umount /mnt 111 | ``` 112 | 113 | ## 还原(必须在live系统,chroot前进行同步还原) 114 | 115 | ### 挂载主系统文件系统与备份盘 116 | 117 | * 挂载主系统文件系统 118 | * 挂载备份盘 119 | * 加载 dm-crypt 模块 120 | * 解锁加密盘 121 | * 挂载解锁的设备 122 | 123 | ``` 124 | sudo mount /dev/sdb3 /mnt 125 | sudo swapon /dev/sdb2 126 | sudo mkdir /mnt/boot 127 | sudo mount /dev/sdb1 /mnt/boot 128 | sudo mkdir /mnt/home 129 | sudo mount /dev/sdb4 /mnt/home 130 | sudo modprobe dm-crypt 131 | sudo cryptsetup luksOpen /dev/sda1 Backup 132 | sudo mkdir /run/d1 133 | sudo mount /dev/mapper/Backup /run/d1 134 | ``` 135 | 136 | ### 同步还原系统 137 | 138 | * 注意路径最后的斜杠 139 | * 注意删除命令,防止误删 140 | * --delete delete files that don't exist on the sending side 141 | * --delete-excluded also delete excluded files on the receiving side 142 | * 在接收方删除存在于接收方但不存在于发送方的文件,同时也删除被excluded掉的文件(即使这些文件也存在于发送方) 143 | 144 | ``` 145 | # 根目录 146 | rsync -aAXHSx --delete --numeric-ids --progress --info=progress2 --exclude={"/lost+found","/home/*"} /run/d1/backup/root/subvol_name/ /mnt/ 147 | # 主目录 148 | rsync -aAXHSx --delete --numeric-ids --progress --info=progress2 --exclude={"Desktop","Documents","Downloads","Music","Pictures","Public","Templates","Videos"} /run/d1/backup/home/subvol_name/ /mnt/home/ 149 | ``` 150 | 151 | ### 删除与卸载备份盘 152 | 153 | ``` 154 | sudo umount /run/d1 155 | sudo rm -r /run/d1 156 | sudo cryptsetup luksClose /dev/mapper/Backup 157 | ``` 158 | 159 | ### 之后需要完成的事项(很疑惑!!!) 160 | 161 | * 重新生成 fstab 162 | * 将根目录 / 改为 /mnt 163 | * 编辑 /etc/mkinitcpio.conf,在 HOOKS 这一行加入以下模块 164 | * HOOKS=(base udev keyboard autodetect keymap modconf block encrypt filesystems resume fsck) 165 | * 重装内核与 microcode 166 | * 重新生成 initramfs 167 | * 重新生成启动项 168 | * 退出、卸载并重启 169 | 170 | ``` 171 | genfstab -U /mnt > /mnt/etc/fstab 172 | arch-chroot /mnt 173 | nano /etc/mkinitcpio.conf 174 | HOOKS=(base udev keyboard autodetect keymap modconf block encrypt filesystems resume fsck) 175 | pacman -Syu linux-firmware linux-zen linux-zen-headers amd-ucode 176 | mkinitcpio -P 177 | pacman -S grub os-prober efibootmgr 178 | grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=Arch 179 | grub-mkconfig -o /boot/grub/grub.cfg 180 | exit 181 | umount -R /mnt 182 | reboot 183 | ``` 184 | 185 | -------------------------------------------------------------------------------- /NVIDIA.md: -------------------------------------------------------------------------------- 1 | ## 安装NVIDIA驱动注意事项 2 | 3 | 4 | 5 | ### -笔记本电脑 6 | 7 | #### 1.安装x环境 8 | ``` 9 | pacman -S xorg-xinit xorg-server 10 | ``` 11 | 12 | #### 2.安装多显卡显卡管理程序 13 | - 大黄蜂方案(不支持DXVK) 14 | ``` 15 | pacman -S nvidia 16 | pacman -S bumblebee 17 | systemctl enable bumblebeed 18 | ``` 19 | - bbswitch方案 20 | ``` 21 | pacman -S nvidia bbswitch optimus-manager-qt 22 | # 自定义内核则: 23 | pacman -S nvidia-dkms bbswitch-dkms optimus-manager-qt 24 | # KDE桌面 25 | pacman -S nvidia-dkms bbswitch-dkms optimus-manager-qt-kde 26 | 27 | # 重启后,托盘出现显卡logo图标,右键设置,第二项optimus的switching method选择bbswitch,确定即可,使用时可在托盘手动选择显卡 28 | # 以上为arch发行版下最好的方案,ubuntu可使用prime方案 29 | ``` 30 | 31 | 32 | 33 | 34 | ### -台式电脑 35 | 36 | #### 1.安装x环境 37 | ``` 38 | pacman -S xorg-xinit xorg-server 39 | ``` 40 | 41 | #### 2.安装闭源驱动 42 | ``` 43 | pacman -S nvidia nvidia-utils nvidia-settings 44 | ``` 45 | * **如果内核安装为 linux-lts,则驱动安装编译驱动,安装完驱动后结束,后面的不用看了!** 46 | ``` 47 | pacman -S nvidia-dkms nvidia-utils nvidia-settings 48 | ``` 49 | 50 | #### 3.查看n卡的BusID 51 | ``` 52 | $ lspci | egrep 'VGA|3D' 53 | 出现如下格式: 54 | ---------------------------------------------------------------------- 55 | 00:02.0 VGA compatible controller: Intel Corporation UHD Graphics 630 (Desktop) 56 | 01:00.0 VGA compatible controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Ti Mobile] (rev a1) 57 | ``` 58 | 59 | #### 4.自动生成配置文件 60 | ``` 61 | $ nvidia-xconfig 62 | ``` 63 | 64 | #### 5.启动脚本配置 65 | - LightDM 66 | ``` 67 | $ nano /etc/lightdm/display_setup.sh 68 | ---------------------------------------------------------------------- 69 | #!/bin/sh 70 | xrandr --setprovideroutputsource modesetting NVIDIA-0 71 | xrandr --auto 72 | ---------------------------------------------------------------------- 73 | $ chmod +x /etc/lightdm/display_setup.sh 74 | $ nano /etc/lightdm/lightdm.conf 75 | ---------------------------------------------------------------------- 76 | [Seat:*] 77 | display-setup-script=/etc/lightdm/display_setup.sh 78 | ``` 79 | 80 | - SDDM 81 | ``` 82 | $ nano /usr/share/sddm/scripts/Xsetup 83 | ---------------------------------------------------------------------- 84 | xrandr --setprovideroutputsource modesetting NVIDIA-0 85 | xrandr --auto 86 | ``` 87 | 88 | - GDM 89 | ``` 90 | 创建两个桌面文件 91 | /usr/share/gdm/greeter/autostart/optimus.desktop 92 | /etc/xdg/autostart/optimus.desktop 93 | ---------------------------------------------------------------------- 94 | [Desktop Entry] 95 | Type=Application 96 | Name=Optimus 97 | Exec=sh -c "xrandr --setprovideroutputsource modesetting NVIDIA-0; xrandr --auto" 98 | NoDisplay=true 99 | X-GNOME-Autostart-Phase=DisplayServer 100 | ``` 101 | 102 | #### 6.修改配置文件 103 | ``` 104 | $ nano /etc/X11/xorg.conf 105 | ---------------------------------------------------------------------- 106 | Section "Module" #此部分可能没有,自行添加 107 | load "modesetting" 108 | EndSection 109 | 110 | Section "Device" 111 | Identifier "Device0" 112 | Driver "nvidia" 113 | VendorName "NVIDIA Corporation" 114 | BusID "1:0:0" #此处填刚刚查询到的BusID 115 | Option "AllowEmptyInitialConfiguration" 116 | EndSection 117 | ``` 118 | 119 | #### 7.解决画面撕裂问题 120 | ``` 121 | $ nano /etc/mkinitcpio.conf 122 | ---------------------------------------------------------------------- 123 | MODULES=(nvidia nvidia_modeset nvidia_uvm nvidia_drm) 124 | ---------------------------------------------------------------------- 125 | 126 | $ nano /etc/default/grub # 此处必须是grub引导,其他引导自行百度 127 | ---------------------------------------------------------------------- 128 | GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia-drm.modeset=1" #此处加nvidia-drm.modeset=1参数 129 | ---------------------------------------------------------------------- 130 | 131 | $ grub-mkconfig -o /boot/grub/grub.cfg # 就算grub引导,配置文件也可能不在一个地方,请查看清楚 132 | ``` 133 | 134 | #### 8.nvidia升级时自动更新initramfs 135 | ``` 136 | $ mkdir /etc/pacman.d/hooks 137 | $ nano /etc/pacman.d/hooks/nvidia.hook 138 | ----------------------------------------------------------------- 139 | [Trigger] 140 | Operation=Install 141 | Operation=Upgrade 142 | Operation=Remove 143 | Type=Package 144 | Target=nvidia 145 | Target=linux 146 | # Change the linux part above and in the Exec line if a different kernel is used 147 | 148 | [Action] 149 | Description=Update Nvidia module in initcpio 150 | Depends=mkinitcpio 151 | When=PostTransaction 152 | NeedsTargets 153 | Exec=/bin/sh -c 'while read -r trg; do case $trg in linux) exit 0; esac; done; /usr/bin/mkinitcpio -P' 154 | ``` 155 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # archlinux setup script 2 | 3 | 关于arch安装的一个脚本 4 | 5 | ### Download 6 | ``` 7 | dhcpcd 8 | wget raw.githubusercontent.com/xylzq/arch/master/setup.sh 9 | ``` 10 | 无法链接github的朋友可以使用下面的链接 11 | ``` 12 | wget gitee.com/xylzq/arch/raw/master/setup.sh 13 | ``` 14 | ### Usage 15 | - 执行 bash setup.sh 16 | - 脚本运行前可根据需要更改分区位置大小格式及启动项等. 17 | - 脚本运行中需要确定是否更新,填写域名,用户名及密码等. 18 | - 脚本运行结束后重启即可基本使用. 19 | - 桌面环境可重启后根据需要自行安装 20 | - 内核安装的是linux-lts,可根据需求自行更改,在安装基本系统处 21 | 22 | ### 几个桌面环境安装方法 23 | - KDE: 24 | ``` 25 | pacman -S kf5 kf5-aids plasma kdebase kdegraphics kde-l10n-zh_cn sddm 26 | systemctl enable sddm 27 | ``` 28 | - Gnome: 29 | ``` 30 | pacman -S gnome gnome-terminal gnome-tweak-tool chrome-gnome-shell gdm 31 | systemctl enable gdm 32 | ``` 33 | - Xfce: 34 | ``` 35 | pacman -S xfce4 xfce4-goodies sddm 36 | systemctl enable sddm 37 | ``` 38 | - Deepin: 39 | ``` 40 | pacman -S deepin deepin-extra deepin-terminal lightdm lightdm-gtk-greeter 41 | systemctl enable lightdm 42 | nano /etc/lightdm/lightdm.conf 43 | # 将greeter-session=example-gtk-gnome改为greeter-session=lightdm-deepin-greeter 44 | ``` 45 | 46 | # archlinux config script 47 | 48 | 关于arch配置美化的一个脚本 49 | 50 | ### Download 51 | ``` 52 | sudo pacman -S wget git 53 | wget raw.githubusercontent.com/xylzq/arch/master/config.sh 54 | ``` 55 | 56 | ### explain 57 | - 主要配置有,添加archlinuxcn等源 58 | - 桌面环境汉化及中文输入法 59 | - 一些基本主题美化,如zsh,图标主题包等 60 | - 一些必要软件如压缩,挂载,声音管理器 61 | - 一些实用软件如文档管理器,播放器,网易云音乐,wps,火狐浏览器等 62 | - 大家可根据需要自由增减 63 | - 安装完zsh后脚本会自动退出,所以zsh的配置脚本无法运行,大家可以手动操作脚本的内容 64 | 65 | 66 | # 安装完archlinux后要做的几件事 67 | 68 | 1.更换内核(linux比较激进,不够稳定) 69 | ``` 70 | sudo pacman -S linux-lts 71 | sudo grub-mkconfig -o /boot/grub/grub.cfg 72 | # 安装内核头文件(某些软件需要,如virtualbox) 73 | # sudo pacman -S linux-lts-headers 74 | sudo pacman -Rs linux 75 | # 启用清理服务 76 | systemctl enable linux-modules-cleanup.service 77 | ``` 78 | 79 | 2.安装微代码microcode(可修正cpu硬件错误) 80 | ``` 81 | # intel 82 | sudo pacman -S intel-ucode 83 | # amd 84 | sudo pacman -S amd-ucode 85 | sudo grub-mkconfig -o /boot/grub/grub.cfg 86 | ``` 87 | 88 | 3.提升显卡性能 89 | ``` 90 | 一、CUDA 91 | sudo pacman -S cuda 92 | 二、opencl 93 | # intel和amd 94 | sudo pacman -S opencl-headers opencl-mesa lib32-opencl-mesa 95 | # nvidia 96 | opencl-nvidia lib32-opencl-nvidia 97 | ``` 98 | 4.添加window字体 99 | ``` 100 | sudo mkdir /usr/share/fonts/WindowsFonts 101 | 将windows字体全部复制到这个文件夹,一般在C:/windows/Fonts 里面 102 | cd /usr/share/fonts/WindowsFonts 103 | sudo fc-cache -fv 104 | # archlinux则直接: 105 | yaourt -S ttf-ms-fonts 106 | ``` 107 | 108 | 5.安装防火墙 109 | ``` 110 | sudo pacman -S ufw 111 | sudo ufw enable 112 | sudo ufw status verbose 113 | sudo systemctl enable ufw.service 114 | ``` 115 | 116 | 6.加密家目录 117 | ``` 118 | # 使用eCryptFS 119 | # 重启进入tty2 120 | # root进入查看$home进程(如果有程序为活跃状态,则杀死它) 121 | ps -U $home 122 | # 安装必要安装包 123 | pacman -S rsync lsof ecryptfs-utils 124 | modprobe ecryptfs 125 | ecryptfs-migrate-home -u $username 126 | exit 127 | ls 128 | cat README.txt 129 | ecryptfs-mount-private 130 | ecryptfs-unwrap-passphrase 131 | # 然后配置 132 | ``` 133 | 134 | 7.删除孤立的包 135 | ``` 136 | sudo pacman -Rns $(pacman -Qtdq) 137 | ``` 138 | 139 | 8.提高数据库访问速度(固态硬盘不可使用) 140 | ``` 141 | sudo pacman-optimize && sync 142 | ``` 143 | 9.检查系统文件错误 144 | ``` 145 | sudo systemctl --failed 146 | sudo journalctl -p 3 -xb 147 | ``` 148 | 10.多系统管理 149 | 150 | - 生成多系统引导程序 151 | ``` 152 | # 探寻其他系统 153 | sudo pacman -S os-prober 154 | # 生成配置文件 155 | sudo grub-mkconfig -o /boot/grub/grub.cf 156 | ``` 157 | - 多系统时间同步 158 | ``` 159 | # 安装 Windows 和 Linux 系统后 Windows 的时间会比慢8个小时 160 | ———————————————— 161 | # 原因: 162 | 163 | # 电脑系统中有两个时间: 164 | # 硬件时间:保存在主板中,信息比较少没时区、夏令时的概念 165 | # 系统时间:又系统维护,独立于硬件时间,拥有时区、夏令时等信息 166 | # 系统时间又因为系统的不同使用了两种时间管理办法: 167 | # localtime:本地时间,目前只有 Windows 在使用。 168 | # UTC:是一种世界标准时间,Linux 这类类 UNIX 多数会使用,UTC 加减时区之后才是本地时间。 169 | # Windows 认为硬件时间就是本地时间,所以会直接把主板中的时间拿来当做当前的时间。设置或同步时间后也会把“正确”的时间写入主板 170 | # Linux 认为硬件时间是 UTC 标准时间,Linux 时间同步后会把“正确”的时间 -8 之后作为标准 UTC 标准时间写入主板 171 | ———————————————— 172 | # 解决办法: 173 | 174 | # windows: 175 | # 以管理员身份使用运行 176 | reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_DWORD /f 177 | # 以上方法无效或64位系统: 178 | reg add "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\TimeZoneInformation" /v RealTimeIsUniversal /d 1 /t REG_QWORD /f 179 | ———————————————— 180 | # linux: 181 | sudo timedatectl set-local-rtc true 182 | ``` 183 | - 将其他系统(分区)自动挂载到家目录 184 | ``` 185 | # 在家目录创建挂载点(挂载点最好为空文件夹,非空文件夹文件在挂载后将不会显示,除非卸载此挂载点) 186 | mkdir win7 187 | # 查看挂载分区uuid 188 | sudo blkid 189 | # 查看挂载分区类型 190 | sudo fdisk -l 191 | # 将挂载信息填入fstab文件(除了结尾的00之间使用空格,其他全部用跳格tab分割) 192 | 193 | sudo nano /etc/fstab 194 | ---------------------------------------------------------------------- 195 | # /dev/sdb3 196 | UUID=xxxxxxxx /home/$username/win7 ntfs defaults 0 0 197 | 198 | ``` 199 | **11.备份!!!** 200 | 201 | # archlinux application 202 | 203 | 关于arch的一些实用软件 204 | 205 | 1.录屏软件 206 | ``` 207 | sudo pacman -S simplescreenrecorder 208 | ``` 209 | 2.显示按键软件 210 | ``` 211 | sudo pacman -S screenkey 212 | ``` 213 | 3.剪辑视频软件 214 | ``` 215 | sudo pacman -S kdenlive 216 | ``` 217 | 4.修图软件 218 | ``` 219 | sudo pacman -S gimp 220 | ``` 221 | 5.vmware 222 | ``` 223 | # 安装必要依赖 224 | sudo pacman -S fuse2 gtkmm linux-headers pcsclite libcanberra 225 | yay -S --noconfirm --needed ncurses5-compat-libs 226 | 227 | # 安装虚拟机 228 | yay -S --noconfirm --needed vmware-workstation 229 | 230 | # 根据需要,启用以下某些服务: 231 | # 1]、用于访客网络访问的vmware-networks.service 232 | # 2]、vmware-usbarbitrator.service用于将USB设备连接到guest虚拟机 233 | # 3]、vmware-hostd.service用于共享虚拟机 234 | sudo systemctl enable vmware-networks.service vmware-usbarbitrator.service vmware-hostd.service 235 | sudo systemctl start vmware-networks.service vmware-usbarbitrator.service vmware-hostd.service 236 | # 确认服务状态: 237 | sudo systemctl status vmware-networks.service vmware-usbarbitrator.service vmware-hostd.service 238 | # 加载VMware模块: 239 | sudo modprobe -a vmw_vmci vmmon 240 | 241 | # 启动虚拟机,填写密钥 242 | sudo vmware 243 | ``` 244 | 245 | 6.virtualbox 246 | ``` 247 | # 安装virtualbox虚拟机 248 | 1]、安装软件包 249 | sudo pacman -S virtualbox 250 | 2]、安装内核模块 251 | sudo pacman -S virtualbox-host-dkms 252 | 3]、加载模块 253 | modprobe vboxdrv (vboxnetadp vboxnetflt vboxpci) 254 | 4]、从客体系统访问主机 USB 设备 255 | - 将需要运行 VirtualBox 的用户名添加到 vboxusers 用户组 256 | sudo usermod -G vboxusers -a $USERS(如primary) 257 | 258 | # 开启VT-x/AMD-V功能 259 | 1]、查看系统列表 260 | VBoxManage list vms 261 | 2]、开启指定系统次功能 262 | VBoxManage modifyvm "$SYSTEMS(如:win7)" --nested-hw-virt on 263 | 264 | # virtualbox内的linux系统无法打开共享文件夹解决办法 265 | 1]、方法一:将虚拟机中,使用者加入虚拟用户组,重启 266 | sudo usermod -a -G vboxsf $USERS(如primary) 267 | 2]、方法二:修改虚拟机中,共享文件夹权限 268 | sudo chmod -R 777 /media 269 | 270 | # 安装MacOS系统 271 | 1]、查看硬件信息 272 | xrandr & sysinfo 273 | 2]、创建虚拟机 MacOSx 274 | # 寻找网上资源(.vmdk文件)并按文件配置创建该系统 275 | - 主机命令行调整该系统参数 276 | # VBoxManage modifyvm MacOSx --cpuidset 00000001 000306a9 00020800 80000201 178bfbff 277 | VBoxManage setextradata "MacOSx" "VBoxInternal/Devices/efi/0/Config/DmiSystemProduct" "iMac11,3" 278 | VBoxManage setextradata "MacOSx" "VBoxInternal/Devices/efi/0/Config/DmiSystemVersion" "1.0" 279 | VBoxManage setextradata "MacOSx" "VBoxInternal/Devices/efi/0/Config/DmiBoardProduct" "Iloveapple" 280 | VBoxManage setextradata "MacOSx" "VBoxInternal/Devices/smc/0/Config/DeviceKey" "ourhardworkbythesewordsguardedpleasedontsteal(c)AppleComputerInc" 281 | VBoxManage setextradata "MacOSx" "VBoxInternal/Devices/smc/0/Config/GetKeyFromRealSMC" 1 282 | 3]、安装系统 283 | 284 | ``` 285 | 286 | 6.邮件 287 | ``` 288 | sudo pacman -S thunderbird 289 | ``` 290 | 7.下载器 291 | ``` 292 | sudo pacman -S transmission-qt 或者 transmission-gtk 293 | sudo pacman -S qbittorrent 294 | ``` 295 | 8.打印机 296 | ``` 297 | # 安装通用打印驱动系统cups 298 | sudo pacman -S cups 299 | # 启动cups并加入自启动 300 | sudo systemctl start cups 301 | sudo systemctl enable cups 302 | # 下载开源驱动程序包(库) 303 | sudo pacman gutenprint 304 | 305 | # 其他驱动程序包 306 | - 佳能 307 | sudo pacman -S cndrvcups-lb 308 | - 惠普 309 | sudo pacman -S hplip 310 | ``` 311 | 9.游戏管理器lutris 312 | ``` 313 | # 安装必备驱动: 314 | # 进入官网https://github.com/lutris/docs/blob/master/InstallingDrivers.md按照提示根据系统下载相应驱动: 315 | sudo pacman -S nvidia-dkms nvidia-utils lib32-nvidia-utils nvidia-settings vulkan-icd-loader lib32-vulkan-icd-loader 316 | (lts内核再安装 pacman -S nvidia-lts ) 317 | 318 | # 安装安装litris和它相关的包: 319 | sudo pacman -S dxvk wine-staging lutris 320 | 321 | # 安装wine-staging的可选依赖(为了完整运行window程序,最好都安装好): 322 | # 进入官网https://github.com/lutris/docs/blob/master/WineDependencies.md按照提示根据系统下载相应依赖: 323 | sudo pacman -S wine-staging giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader 324 | sudo pacman -S wine-mono giflib lib32-giflib libpng lib32-libpng libldap lib32-libldap gnutls lib32-gnutls mpg123 lib32-mpg123 openal lib32-openal v4l-utils lib32-v4l-utils libpulse lib32-libpulse libgpg-error lib32-libgpg-error alsa-plugins lib32-alsa-plugins alsa-lib lib32-alsa-lib libjpeg-turbo lib32-libjpeg-turbo sqlite lib32-sqlite libxcomposite lib32-libxcomposite libxinerama lib32-libgcrypt libgcrypt lib32-libxinerama ncurses lib32-ncurses opencl-icd-loader lib32-opencl-icd-loader libxslt lib32-libxslt libva lib32-libva gtk3 lib32-gtk3 gst-plugins-base-libs lib32-gst-plugins-base-libs vulkan-icd-loader lib32-vulkan-icd-loader 325 | # 提升游戏性能的程序: 326 | yaourt -S gamemode lib32-gamemode 327 | # 配置gamemode: 328 | 一、查找gamemode路径 329 | find /usr -iname 'libgamemodeauto*' 330 | 二、复制路径 331 | /usr/lib/libgamemodeauto.so.0 332 | 三、添加路径 333 | 运行lutris,点击preferences中的system options里面的add, 334 | key输入LD_PRELOAD,Value输入上述路径/usr/lib/libgamemodeauto.so.0,save。 335 | # 继续提升性能: 336 | 参照 https://github.com/lutris/https://github.com/lutris/docs/blob/master/Performance-Tweaks.md 最下面 337 | 其中,NIVDIA可按照上述添加路径的方法, 338 | key输入__GL_THREADED_OPTIMIZATION,Value输入1; 339 | AMD可可按照上述添加路径的方法, 340 | key输入mesa_glthread,Value输入true,save。 341 | 342 | # 继续提升性能: 343 | 使用带tkg的wine版本,manager version,因为带tkg的wine都启用了ESyns,对性能的提升极大; 344 | 但是要发挥ESyns的效果,需要优化内核: 345 | sudo pacman -S ulimit 346 | ulimit -Hn 347 | 若出现的数字比524288大(不小于就行),就不用配置了,若没有,则继续: 348 | sudo nano /etc/systemd/system.conf 349 | 将 DefaultLimitNOFILE 前面的#去掉,= 后面的数字改为524288; 350 | sudo nano /etc/systemd/user.conf 351 | 将 DefaultLimitNOFILE 前面的#去掉,= 后面的数字改为524288. 352 | 353 | # 其他配置可参照https://github.com/lutris/lutris/wiki/ 修改。 354 | -------------------------------------------------------------------------------- /config.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | print_line() { 4 | printf "%$(tput cols)s\n"|tr ' ' '-' 5 | } 6 | 7 | print_title() { 8 | clear 9 | print_line 10 | echo -e "# ${Bold}$1${Reset}" 11 | print_line 12 | echo "" 13 | } 14 | 15 | #配置汉化 16 | configure_Chinese(){ 17 | print_title "configure_Chinese" 18 | sudo chmod 777 /etc/pacman.d/mirrorlist 19 | sudo sh -c 'echo -e "[archlinuxcn]\nServer = https://mirrors.tuna.tsinghua.edu.cn/archlinuxcn/\$arch" >> /etc/pacman.conf' 20 | sudo pacman -Syy 21 | sudo pacman -S --noconfirm archlinuxcn-keyring -y 22 | sudo sh -c "sed -i 's/\# \[multilib]/\[multilib]/g' /etc/pacman.conf" 23 | sudo sh -c "sed -i 's/\# \Include = /etc/pacman.d/mirrorlist/\Include = /etc/pacman.d/mirrorlist/g' /etc/pacman.conf" 24 | sudo pacman -Syy --noconfirm 25 | #echo "LANG=zh_CN.UTF-8" >> /etc/locale.conf 26 | touch ~/.xprofile 27 | echo -e "export LANG=zh_CN.UTF-8\nexport LANGUAGE=zh_CN:en_US" >> ~/.xprofile 28 | } 29 | 30 | #安装基本软件 31 | add_baseapplication(){ 32 | print_title "add_baseapplication" 33 | sudo pacman -S --noconfirm pavucontrol alsa-utils pulseaudio pulseaudio-alsa -y 34 | sudo pacman -S --noconfirm nano gvfs ntfs-3g gvfs-mtp p7zip file-roller unrar netease-cloud-music wps-office ttf-wps-fonts leafpad -y 35 | sudo pacman -S --noconfirm vlc ark -y 36 | sudo pacman -S --noconfirm firefox firefox-i18n-zh-cn -y 37 | sudo pacman -S --noconfirm git wget yaourt yay fakeroot -y 38 | sudo systemctl start alsa-state.service 39 | sudo systemctl enable alsa-state.service 40 | } 41 | 42 | #安装中文输入法 43 | add_ChineseInput(){ 44 | print_title "add_ChineseInput" 45 | sudo pacman -S --noconfirm fcitx fcitx-im fcitx-configtool -y 46 | echo -e "export GTK_IM_MODULE=fcitx\nexport QT_IM_MODULE=fcitx\nexport XMODIFIERS=“@im=fcitx”" >> ~/.xprofile 47 | echo -e "export GTK_IM_MODULE=fcitx\nexport QT_IM_MODULE=fcitx\nexport XMODIFIERS=“@im=fcitx”" >> ~/.bashrc 48 | } 49 | 50 | 51 | #安装系统图标字体主题包(重启后把shell,gtk.图标等改成这些就好了) 52 | add_theme(){ 53 | print_title "add_theme" 54 | yaourt -S --noconfirm gtk-theme-arc-git numix-circle-icon-theme-git 55 | git clone https://github.com/powerline/fonts.git --depth=1 56 | mv fonts source-code-pro-medium-italic 57 | sudo mv source-code-pro-medium-italic /usr/share/fonts/ 58 | cd /usr/share/fonts/source-code-pro-medium-italic 59 | sudo bash install.sh 60 | cd 61 | } 62 | #安装zsh(安装完zsh后好像会自动退出脚本,这样子的话,插件就得重启后自己复制输入了,不过问题不大,反正添加插件也得输入一下) 63 | add_zsh(){ 64 | print_title "add_zsh" 65 | sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" 66 | # nano ~/.zshrc,将主题改成:ZSH_THEME="agnoster" (zsh-syntax-highlighting必须放最下面。这个不会写,只能这样子备注了,重启后照着这个改就好了) 67 | # 下载命令补全以及高亮插件 68 | # cd ~/.oh-my-zsh/custom/plugins/ 69 | # git clone https://github.com/zsh-users/zsh-syntax-highlighting.git 70 | # git clone https://github.com/zsh-users/zsh-autosuggestions 71 | # 加入插件,即 nano ~/.zshrc 在 plugins=(git) 上加入插件名字,改成 72 | # plugins=( 73 | # git 74 | # zsh-autosuggestions 75 | # zsh-syntax-highlighting 76 | # ) 77 | cd 78 | zsh 79 | clear 80 | print_title "config has been.please reboot ." 81 | } 82 | 83 | configure_Chinese 84 | add_baseapplication 85 | add_ChineseInput 86 | add_theme 87 | add_zsh 88 | -------------------------------------------------------------------------------- /i3wm/.zshrc: -------------------------------------------------------------------------------- 1 | # init environment 2 | export TERM=xterm-256color 3 | export ZSH=$HOME/.oh-my-zsh 4 | export LANG=zh_CN.UTF-8 5 | export LANGUAGE=zh_CN:en_US 6 | export LC_CTYPE=en_US.UTF-8 7 | export GTK_IM_MODULE=fcitx 8 | export QT_IM_MOUDLE=fcitx 9 | export XMODIFIERS=@im=fcitx 10 | export VISUAL="vim" 11 | 12 | 13 | alias c='clear' 14 | # -s是说后缀以gz结尾的run tar这个命令 15 | alias -s gz='tar -xzvf' 16 | alias -s tgz='tar -xzvf' 17 | alias -s zip='unzip' 18 | alias -s bz2='tar -xjvf' 19 | 20 | 21 | #POWERLEVEL9K_MODE='awesome-fontconfig' 22 | POWERLEVEL9K_MODE='nerdfont-complete' 23 | ZSH_THEME="powerlevel9k/powerlevel9k" 24 | 25 | # Add wisely, as too many plugins slow down shell startup. 26 | plugins=( 27 | git 28 | zsh-completions 29 | zsh-autosuggestions 30 | zsh-syntax-highlighting 31 | ) 32 | 33 | source $ZSH/oh-my-zsh.sh 34 | 35 | #-------- powerlevel9k --------- 36 | 37 | POWERLEVEL9K_PROMPT_ON_NEWLINE=true 38 | POWERLEVEL9K_RPROMPT_ON_NEWLINE=true 39 | POWERLEVEL9K_STATUS_CROSS=true 40 | #POWERLEVEL9K_STATUS_VERBOSE=false 41 | 42 | POWERLEVEL9K_LEFT_PROMPT_ELEMENTS=(os_icon dir vcs status) 43 | POWERLEVEL9K_RIGHT_PROMPT_ELEMENTS=(time background_jobs ram virtualenv rbenv rvm) 44 | #POWERLEVEL9K_MODE='awesome-patched' 45 | POWERLEVEL9K_MODE='nerdfont-complete' 46 | POWERLEVEL9K_SHORTEN_DIR_LENGTH=4 47 | POWERLEVEL9K_SHORTEN_STRATEGY="truncate_middle" 48 | POWERLEVEL9K_TIME_FORMAT="%D{\uf073 %y.%m.%d}" 49 | 50 | POWERLEVEL9K_MULTILINE_LAST_PROMPT_PREFIX="╰ " 51 | 52 | POWERLEVEL9K_OS_ICON_BACKGROUND="white" 53 | POWERLEVEL9K_OS_ICON_FOREGROUND="red" 54 | POWERLEVEL9K_DIR_HOME_BACKGROUND="black" 55 | POWERLEVEL9K_DIR_HOME_FOREGROUND="white" 56 | POWERLEVEL9K_DIR_HOME_SUBFOLDER_FOREGROUND="white" 57 | POWERLEVEL9K_DIR_DEFAULT_FOREGROUND="white" 58 | POWERLEVEL9K_DIR_DEFAULT_BACKGROUND="black" 59 | 60 | #进入powerlevel9k/powerlevel9k主题文件,修改当前路径背景颜色 61 | #nano ~/.oh-my-zsh/custom/themes/powerlevel9k/powerlevel9k.zsh-theme 62 | #将"$1_prompt_segment" "$0_${current_state}" "$2" "blue" "$DEFAULT_COLOR" "${current_path}" "${dir_states[$current_state]}" 63 | #改为 "$1_prompt_segment" "$0_${current_state}" "$2" "black" "$DEFAULT_COLOR" "${current_path}" "${dir_states[$current_state]}" 64 | 65 | #POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_FOREGROUND="white" 66 | #POWERLEVEL9K_DIR_WRITABLE_FORBIDDEN_BACKGROUND="black" 67 | 68 | #POWERLEVEL9K_DIR_ETC_BACKGROUND="black" 69 | #POWERLEVEL9K_DIR_ETC_FOREGROUND="white" 70 | 71 | POWERLEVEL9K_STATUS_OK_FOREGROUND="green" 72 | POWERLEVEL9K_STATUS_ERROR_FOREGROUND="red" 73 | POWERLEVEL9K_STATUS_OK_BACKGROUND="white" 74 | POWERLEVEL9K_STATUS_ERROR_BACKGROUND="white" 75 | 76 | -------------------------------------------------------------------------------- /i3wm/README.md: -------------------------------------------------------------------------------- 1 | # 我的i3配置文件 2 | 3 | 4 | 5 | ## 截图 6 | 7 | ![my_desktop](my_desktop.png) 8 | 9 | 10 | 11 | ## 需要的软件 12 | 13 | * *i3-gaps* : 窗口管理器 14 | * *feh* : 设置背景图片 15 | * *compton* : 终端透明 16 | * *xfce4-terminal* : 终端 17 | * *polybar* : 状态栏 18 | * *i3lock-fancy-git* : 锁屏 19 | * *mpd* : 音乐播放器守护程序 20 | * *rofi* : 程序启动项 21 | 22 | 23 | ## 安装 24 | 25 | ### 1.安装基础包 26 | ``` 27 | pacman -S xfce4-terminal feh compton i3-gaps mpd rofi base-devel yaourt 28 | yaourt -S polybar-git i3lock-fancy-git 29 | ``` 30 | ### 2.安装字体图标 31 | ``` 32 | pacman -S adobe-source-han-sans-cn-fonts 33 | pacman -S adobe-source-han-sans-tw-fonts 34 | pacman -S adobe-source-han-sans-jp-fonts 35 | pacman -S ttf-liberation 36 | yaourt -S otf-font-awesome 37 | yaourt -S ttf-material-icons-git 38 | ``` 39 | ### 3.安装必要依赖 40 | #### - mpd依赖(i3配置文件中调节音乐所需) 41 | ``` 42 | pacman -S ncmpcpp mpc 43 | ``` 44 | #### - alsaer依赖(i3配置文件中调节音量所需) 45 | ``` 46 | pacman -S pavucontrol alsa-utils pulseaudio pulseaudio-alsa 47 | ``` 48 | #### - polybar依赖 49 | ``` 50 | pacman -S cmake git wget python python2 pkg-config 51 | pacman -S cairo xcb-util-image xcb-util-wm xcb-util-xrm xcb-util-cursor curl 52 | yaourt -S alsa-lib libmpdclient wireless_tools jsoncpp i3ipc-glib-git ttf-unifont siji-git 53 | ``` 54 | ### 4.根据需要修改i3/polybar/mpd配置文件 55 | #### - i3 56 | 进入i3配置文件,并按需求更改 57 | ``` 58 | nano ~/.config/i3/config 59 | ``` 60 | #### - polybar 61 | 在家目录下的配置文件夹中创建polybar文件夹,将polybar的配置文件复制到这里,并按需要修改 62 | ``` 63 | mkdir ~/.config/polybar 64 | cp /usr/share/doc/polybar/config ~/.config/polybar 65 | ``` 66 | 创建polybar启动脚本launch.sh 67 | ``` 68 | cd ~/.config/polybar 69 | touch launch.sh 70 | ``` 71 | 写入代码: 72 | ``` 73 | #!/bin/bash 74 | killall -q polybar 75 | polybar mybar 76 | ``` 77 | 将启动脚本设为可执行文件 78 | ``` 79 | chmod +x launch.sh 80 | ``` 81 | 将启动文件设为i3登录时自动启动 82 | ``` 83 | nano ~/.config/i3/config 84 | exec_always ~/.config/polybar/launch.sh 85 | ``` 86 | #### - mpd 87 | 在家目录下的配置文件夹中创建mpd文件夹,将mpd的配置文件复制到这里,并按需要修改 88 | ``` 89 | mkdir ~/.config/mpd 90 | cp /usr/share/doc/mpd/mpdconf.example ~/.config/mpd/mpd.conf 91 | ``` 92 | 将启动文件设为i3登录时自动启动 93 | ``` 94 | exec --no-startup-id mpd ~/.config/mpd/mpd.conf 95 | ``` 96 | ### 5.安装oh-my-zsh 97 | #### - oh-my-zsh 98 | ``` 99 | sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" 100 | sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" 101 | sudo pacman -S oh-my-zsh-git 102 | ``` 103 | #### - oh-my-zsh 插件 104 | ``` 105 | cd ~/.oh-my-zsh/custom/plugins 106 | git clone https://github.com/zsh-users/zsh-syntax-highlighting.git(高亮光标,修改插件配置时必须放最下面) 107 | git clone https://github.com/zsh-users/zsh-autosuggestions(命令补全插件) 108 | ``` 109 | #### - oh-my-zsh 主题 110 | ``` 111 | sudo pacman -S zsh-theme-powerlevel9k 112 | 113 | #选择Powerlevel9k默认主题的话,也可自己配置 114 | #To enable Powerlevel9k theme for your user type: 115 | echo 'source /usr/share/zsh-theme-powerlevel9k/powerlevel9k.zsh-theme' >> ~/.zshrc 116 | ``` 117 | #### - oh-my-zsh 字体 118 | ``` 119 | # nerd-fonts 含有大量字体图标,oh-my-zsh缺少则许多图标无法显示 120 | sudo pacman -S nerd-fonts-complete 121 | 122 | #上面的字体模式可选的有:nerdfont-complete & awesome-fontconfig & awesome-patched 123 | ``` 124 | #### - oh-my-zsh配置 125 | ``` 126 | nano ~/.zshrc 127 | 128 | #强制指定终端色彩解决终端色彩不够256色问题 129 | export TERM="xterm-256color" 130 | 131 | #字体设定 (注意,字体设定必须放在主题之前) 132 | POWERLEVEL9K_MODE='nerdfont-complete' 133 | 134 | #主题设定 135 | ZSH_THEME="powerlevel9k/powerlevel9k" 136 | 137 | #插件设定 138 | plugins=( 139 | git 140 | zsh-autosuggestions 141 | zsh-syntax-highlighting 142 | ) 143 | ``` 144 | 145 | ### 5.安装实用软件 146 | #### - 文件管理器 147 | ``` 148 | sudo pacman -S pcmanfm 149 | ``` 150 | #### - 主题管理器 151 | ``` 152 | sudo pacman -S lxappearance 153 | 154 | 所需依赖: 155 | sudo pacman -S gnome-themes-standard 156 | 157 | 可选主题: 158 | yaourt -S gtk-theme-arc-git 159 | sudo pacman -S gtk-engine-murrine gtk-engines 160 | ``` 161 | 162 | ## 注意事项 163 | 164 | ### 1.polybar配置文件 165 | #### - 查看自己的显示器设备,并将[bar/mybar]下的monitor设置为自己显示器的名字 166 | ``` 167 | polybar -m 168 | ``` 169 | #### - 查看自己的网卡设备,并将[module/eth] 或[module/wlan]下的interface设置为自己网卡设备的名字 170 | ``` 171 | ip link show 172 | ``` 173 | #### - 检查配置文件 174 | 可将配置文件中的[bar/mybar]改为[bar/example],再输入: 175 | ``` 176 | polybar example 177 | ``` 178 | - 查看配置文件模板是否加载成功,也可按需求开启或者关闭某些模板。 179 | 180 | - 修改完成后,将[bar/example]改回[bar/mybar] 181 | 182 | ### 2.mpd配置文件 183 | - 重启后音乐模块图标并没有显示是因为mpd默认目录里没有文件可通过修改.config/mpd/mpd.conf文件来改变这个路径。 184 | - 可通过命令行键入ncmpcpp或者$mod+ctrl+m进入音乐控制,按u刷新音乐数据库,接着按2浏览数据库文件,选择播放即可。 185 | -------------------------------------------------------------------------------- /i3wm/i3/config: -------------------------------------------------------------------------------- 1 | # This file has been auto-generated by i3-config-wizard(1). 2 | # It will not be overwritten, so edit it as you like. 3 | # 4 | # Should you change your keyboard layout some time, delete 5 | # this file and re-run i3-config-wizard(1). 6 | # 7 | 8 | # i3 config file (v4) 9 | # 10 | # Please see https://i3wm.org/docs/userguide.html for a complete reference! 11 | 12 | # 设置循环变量 13 | # 设置Mod键,1-Alt;2-win 14 | set $mod Mod1 15 | # 设置方向键 16 | set $up k 17 | set $down j 18 | set $left h 19 | set $right l 20 | 21 | # 设置屏幕锁定 22 | bindsym $mod+F12 exec i3lock-fancy 23 | 24 | #设置窗口边框等等 25 | new_window none 26 | new_float normal 27 | hide_edge_borders both 28 | 29 | # use window title, but no border 30 | #使用窗口标题,但不使用边框 31 | bindsym $mod+t border normal 0 32 | # use no window title and a thick border 33 | #不使用窗口标题和粗边框 34 | bindsym $mod+y border pixel 3 35 | # use neither window title nor border 36 | #既不使用窗口标题也不使用边框 37 | bindsym $mod+u border none 38 | 39 | #设置窗口间距 40 | gaps inner 4 41 | gaps outer 2 42 | 43 | # 设置截图快捷键 ,先安装mate-utils, sudo pacman -S mate-utils 44 | bindsym $mod+p exec mate-screenshot -i 45 | 46 | 47 | # 登录时总是关掉所有的screenkey 48 | # exec_always killall screenkey 49 | # 1.5s后启动screenkey 50 | # exec_always sleep 1.5; screenkey 51 | 52 | # screen timeout 53 | exec --no-startup-id xset dpms 600 800 900 54 | 55 | # 登陆时启动polybar 56 | exec --no-startup-id ~/.config/polybar/launch.sh 57 | 58 | # 登录时启动fcitx 59 | exec --no-startup-id fcitx 60 | 61 | # 登陆时启动mpd 62 | exec --no-startup-id mpd ~/.config/mpd/mpd.conf 63 | 64 | # 登录时 启用窗口透明 65 | exec --no-startup-id compton -b 66 | 67 | # 登陆时 随机选择壁纸 ,~/Pictures/DesktopBackground 下要放几张图片 68 | #exec --no-startup-id feh --randomize --bg-fill ~/Pictures/DesktopBackground 69 | # 登录时选择壁纸 70 | exec --no-startup-id feh --randomize --bg-center ~/Pictures/58d3341f0cfe9.jpg 71 | 72 | # Font for window titles. Will also be used by the bar unless a different font 73 | # is used in the bar {} block below. 74 | # 窗口标签字体,也将被bar使用,除非在下面的bar{}中使用其他的字体 75 | font pango:ttf-liberation-mono 14 76 | 77 | # This font is widely installed, provides lots of unicode glyphs, right-to-left 78 | # text rendering and scalability on retina/hidpi displays (thanks to pango). 79 | # 这种字体被广泛安装,提供了大量的unicode字形、从右到左的文本渲染 80 | # 和retina/hidpi显示器上的可伸缩性 81 | # font pango:DejaVu Sans Mono 8 82 | 83 | # The combination of xss-lock, nm-applet and pactl is a popular choice, so 84 | # they are included here as an example. Modify as you see fit. 85 | # xss-lock, nm-applet and pactl的结合是个不错的选择 86 | # 所以以它们为例. 根据需要修改. 87 | 88 | # xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the 89 | # screen before suspend. Use loginctl lock-session to lock your screen. 90 | # xss-lock获取登录信息,i3lock锁定屏幕 91 | # exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork 92 | 93 | # NetworkManager is the most popular way to manage wireless networks on Linux, 94 | # and nm-applet is a desktop environment-independent system tray GUI for it. 95 | # NetworkManager是Linux上最流行的无线网络管理方式, 96 | # 而nm-applet是一个独立于桌面环境的系统托盘GUI。 97 | exec --no-startup-id nm-applet 98 | 99 | 100 | # Use pactl to adjust volume in PulseAudio. 101 | # 使用pactl调整PulseAudio中的音量 102 | # amixer 103 | bindsym $mod+F11 exec amixer set Master 5%+ 104 | bindsym $mod+F10 exec amixer set Master 5%- 105 | bindsym $mod+F9 exec amixer set Master toggle 106 | 107 | # control music(管理音乐) 108 | bindsym $mod+Ctrl+m exec i3-sensible-terminal -e ncmpcpp 109 | bindsym $mod+Ctrl+p exec mpc play 110 | bindsym $mod+Ctrl+o exec mpc pause 111 | bindsym $mod+Ctrl+l exec mpc next 112 | bindsym $mod+Ctrl+k exec mpc prev 113 | 114 | # start the firefox 115 | bindsym $mod+Shift+f exec firefox 116 | 117 | # start the chrome 118 | bindsym $mod+Shift+g exec google-chrome-stable 119 | 120 | # start the bluetooth 121 | bindsym $mod+Shift+b exec blueberry 122 | 123 | # start the vmware 124 | bindsym $mod+Shift+v exec vmware 125 | 126 | # wps, et, wpp 127 | bindsym $mod+shift+w exec wps 128 | bindsym $mod+shift+e exec et 129 | bindsym $mod+shift+p exec wpp 130 | 131 | # start cmatrix 132 | bindsym $mod+Shift+x exec i3-sensible-terminal -e cmatrix 133 | 134 | # start a terminal 135 | bindsym $mod+Return exec i3-sensible-terminal 136 | 137 | # kill focused window 138 | bindsym $mod+Shift+q kill 139 | 140 | #设置快捷程序启动为rofi 141 | # start dmenu (a program launcher) 142 | # bindsym $mod+d exec dmenu_run 143 | # There also is the (new) i3-dmenu-desktop which only displays applications 144 | # shipping a .desktop file. It is a wrapper around dmenu, so you need that 145 | # installed. 146 | # bindsym $mod+d exec --no-startup-id i3-dmenu-desktop 147 | bindsym $mod+d exec --no-startup-id rofi -show drun 148 | bindsym $mod+q exec --no-startup-id rofi -show window 149 | 150 | # change focus (改变焦点) 151 | bindsym $mod+$Left focus left 152 | bindsym $mod+$Down focus down 153 | bindsym $mod+$Up focus up 154 | bindsym $mod+$Right focus right 155 | 156 | # move focused window(移动聚焦窗口) 157 | bindsym $mod+Shift+$left move left 158 | bindsym $mod+Shift+$down move down 159 | bindsym $mod+Shift+$up move up 160 | bindsym $mod+Shift+$right move right 161 | 162 | # alternatively, you can use the cursor keys(或者,可以使用光标键) 163 | bindsym $mod+Shift+Left move left 164 | bindsym $mod+Shift+Down move down 165 | bindsym $mod+Shift+Up move up 166 | bindsym $mod+Shift+Right move right 167 | 168 | # Use Mouse+$mod to drag floating windows to their wanted position 169 | # 使用鼠标+$mod将浮动窗口拖动到所需位置 170 | floating_modifier $mod 171 | 172 | # split in horizontal orientation 173 | # 水平分裂(如:$mod+g+enter可在焦点右方新建一个终端) 174 | bindsym $mod+g split h 175 | 176 | # split in vertical orientation 177 | # 垂直分裂(如:$mod+v+enter可在焦点下方新建一个终端) 178 | bindsym $mod+v split v 179 | 180 | # enter fullscreen mode for the focused container 181 | # 进入焦点所在窗口的全屏模式 182 | bindsym $mod+f fullscreen toggle 183 | 184 | # change container layout (stacked, tabbed, toggle split) 185 | # 更改容器布局(s-前后堆叠、w-左右选项卡式、e-切换拆分) 186 | bindsym $mod+s layout stacking 187 | bindsym $mod+w layout tabbed 188 | bindsym $mod+e layout toggle split 189 | 190 | # toggle tiling / floating(切换平铺/浮动) 191 | bindsym $mod+Shift+space floating toggle 192 | 193 | # change focus between tiling / floating windows 194 | # 在平铺/浮动窗口之间更改焦点 195 | bindsym $mod+space focus mode_toggle 196 | 197 | # focus the parent container(聚焦父容器) 198 | bindsym $mod+a focus parent 199 | 200 | # focus the child container(聚焦子容器) 201 | #bindsym $mod+d focus child 202 | 203 | # hide | show window(隐藏|显示窗口) 204 | bindsym $mod+minus move scratchpad 205 | bindsym $mod+plus scratchpad show 206 | 207 | # navigate workspaces next /previous(导航下一个/上一个工作区) 208 | bindsym $mod+Tab workspace next 209 | bindsym $mod+Shift+Tab workspace prev 210 | 211 | # Define names for default workspaces for which we configure key bindings later on. 212 | # We use variables to avoid repeating the names in multiple places. 213 | # 为下列工作区定义名称,我们使用变量避免在多个位置重复这些名称 214 | 215 | set $ws1 "1:  " 216 | set $ws2 "2:  " 217 | set $ws3 "3:  " 218 | set $ws4 "4:  " 219 | set $ws5 "5:  " 220 | set $ws6 "6:  " 221 | set $ws7 "7:  " 222 | set $ws8 "8:  " 223 | set $ws9 "9:  " 224 | set $ws10 "10:  " 225 | 226 | # switch to workspace(切换到工作区) 227 | bindsym $mod+1 workspace $ws1 228 | bindsym $mod+2 workspace $ws2 229 | bindsym $mod+3 workspace $ws3 230 | bindsym $mod+4 workspace $ws4 231 | bindsym $mod+5 workspace $ws5 232 | bindsym $mod+6 workspace $ws6 233 | bindsym $mod+7 workspace $ws7 234 | bindsym $mod+8 workspace $ws8 235 | bindsym $mod+9 workspace $ws9 236 | bindsym $mod+0 workspace number $ws10 237 | 238 | # move focused container to workspace(将聚焦容器移动到工作区) 239 | bindsym $mod+Shift+1 move container to workspace $ws1 240 | bindsym $mod+Shift+2 move container to workspace $ws2 241 | bindsym $mod+Shift+3 move container to workspace $ws3 242 | bindsym $mod+Shift+4 move container to workspace $ws4 243 | bindsym $mod+Shift+5 move container to workspace $ws5 244 | bindsym $mod+Shift+6 move container to workspace $ws6 245 | bindsym $mod+Shift+7 move container to workspace $ws7 246 | bindsym $mod+Shift+8 move container to workspace $ws8 247 | bindsym $mod+Shift+9 move container to workspace $ws9 248 | bindsym $mod+Shift+0 move container to workspace number $ws10 249 | 250 | # Automatically putting clients on specific workspaces 251 | # 自动将客户端置于特定工作区 252 | assign [class="wps"] $ws5 253 | assign [class="netease-cloud-music"] $ws7 254 | assign [class="vmware"] $ws10 255 | 256 | # resize window (you can also use the mouse for that) 257 | # 调整窗口大小(也可以使用鼠标) 258 | mode "resize" { 259 | # These bindings trigger as soon as you enter the resize mode 260 | # 一旦您进入resize模式,这些绑定就会触发 261 | # Pressing left will shrink the window’s width. 262 | # 按左键将缩小窗口的宽度。 263 | # Pressing right will grow the window’s width. 264 | # 按右键将增大窗口的宽度。 265 | # Pressing up will shrink the window’s height. 266 | # 按上键将缩小窗口的高度。 267 | # Pressing down will grow the window’s height. 268 | # 按下将增大窗口的高度。 269 | bindsym $left resize shrink width 10 px or 10 ppt 270 | bindsym $down resize grow height 10 px or 10 ppt 271 | bindsym $up resize shrink height 10 px or 10 ppt 272 | bindsym $right resize grow width 10 px or 10 ppt 273 | 274 | # same bindings, but for the arrow keys 275 | # 相同的绑定,但对于箭头键 276 | bindsym Left resize shrink width 10 px or 10 ppt 277 | bindsym Down resize grow height 10 px or 10 ppt 278 | bindsym Up resize shrink height 10 px or 10 ppt 279 | bindsym Right resize grow width 10 px or 10 ppt 280 | 281 | # back to normal: Enter or Escape or $mod+Shift+r 282 | # 恢复正常:Enter or Escape or $mod+Shift+r 283 | bindsym Return mode "default" 284 | bindsym Escape mode "default" 285 | bindsym $mod+r mode "default" 286 | } 287 | bindsym $mod+r mode "resize" 288 | 289 | # reload the configuration file(重新加载配置文件) 290 | bindsym $mod+ctrl+c reload 291 | # restart i3 inplace (preserves your layout/session, can be used to upgrade i3) 292 | bindsym $mod+ctrl+r restart 293 | # exit i3 (logs you out of your X session) 294 | bindsym $mod+ctrl+e exec "i3-nagbar -t warning -m 'You pressed the exit shortcut. Do you really want to exit i3? This will end your X session.' -B 'Yes, exit i3' 'i3-msg exit'" 295 | 296 | 297 | 298 | # window set(窗口设定) 299 | for_window[class=^.*] border pixel 0 300 | for_window[window_role="pop-up"] floating enable 301 | for_window[window_role="task_dialog"] floating enbale 302 | for_window[class="netease-cloud-music"] floating enable 303 | for_window[class="VirtualBox Manager"] floating enable 304 | for_window[class="wechat"] floating enable 305 | for_window[class="vokoscreen"] floating enable 306 | for_window[class="vlc"] floating enable 307 | 308 | # disable follows_mouse(禁用跟随鼠标) 309 | # focus_follows_mouse no 310 | 311 | # 关掉i3bar 312 | # Start i3bar to display a workspace bar (plus the system information i3status 313 | # finds out, if available) 314 | #bar { 315 | # status_command i3status 316 | #} 317 | 318 | # exec --no-startup-id conky -c ~/.conkyrc 319 | -------------------------------------------------------------------------------- /i3wm/mpd/mpd.conf: -------------------------------------------------------------------------------- 1 | music_directory "~/Music/CloudMusic" 2 | playlist_directory "~/.config/mpd/playlists" 3 | db_file "~/.config/mpd/database" 4 | log_file "~/.config/mpd/log" 5 | state_file "~/.config/mpd/state" 6 | sticker_file "~/.config/mpd/sticker.sql" 7 | 8 | bind_to_address "127.0.0.1" 9 | port "6600" 10 | 11 | input { 12 | plugin "curl" 13 | # proxy "proxy.isp.com:8080" 14 | # proxy_user "user" 15 | # proxy_password "password" 16 | } 17 | 18 | audio_output { 19 | type "alsa" 20 | name "pcm" 21 | mixer_type "software" # optional 22 | } 23 | -------------------------------------------------------------------------------- /i3wm/my_desktop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/xylzq/arch/e1c82cd7be1e4de6a99a7426919348ad15d151bb/i3wm/my_desktop.png -------------------------------------------------------------------------------- /i3wm/polybar/config: -------------------------------------------------------------------------------- 1 | ;========================================================== 2 | ; 3 | ; 4 | ; ██████╗ ██████╗ ██╗ ██╗ ██╗██████╗ █████╗ ██████╗ 5 | ; ██╔══██╗██╔═══██╗██║ ╚██╗ ██╔╝██╔══██╗██╔══██╗██╔══██╗ 6 | ; ██████╔╝██║ ██║██║ ╚████╔╝ ██████╔╝███████║██████╔╝ 7 | ; ██╔═══╝ ██║ ██║██║ ╚██╔╝ ██╔══██╗██╔══██║██╔══██╗ 8 | ; ██║ ╚██████╔╝███████╗██║ ██████╔╝██║ ██║██║ ██║ 9 | ; ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═╝ 10 | ; 11 | ; 12 | ; To learn more about how to configure Polybar 13 | ; go to https://github.com/polybar/polybar 14 | ; 15 | ; The README contains a lot of information 16 | ; 17 | ;========================================================== 18 | 19 | [colors] 20 | ;background = ${xrdb:color0:#222} 21 | background = #b0222222 22 | background-alt = #444 23 | ;foreground = ${xrdb:color7:#222} 24 | foreground = #dfdfdf 25 | foreground-alt = #555 26 | primary = #ffb52a 27 | secondary = #e60053 28 | alert = #bd2c40 29 | 30 | [bar/mybar] 31 | monitor = ${env:MONITOR:HDMI-0} 32 | width = 100% 33 | height = 30 34 | ;offset-x = 1% 35 | ;offset-y = 1% 36 | radius = 6.0 37 | fixed-center = true 38 | 39 | background = ${colors.background} 40 | foreground = ${colors.foreground} 41 | 42 | line-size = 3 43 | line-color = #f00 44 | 45 | border-size = 4 46 | border-color = #00000000 47 | 48 | padding-left = 0 49 | padding-right = 2 50 | 51 | module-margin-left = 1 52 | module-margin-right = 2 53 | 54 | font-0 = ttf-liberation-sans:fixed:pixelsize=12;1 55 | font-1 = source han sans cn:pixelsize=12:antialias=false;1 56 | font-2 = "Font Awesome 5 Free:style=Solid:pixelsize=12;1" 57 | font-3 = "Font Awesome 5 Brands:style=Regular:pixelsize=12;1" 58 | font-4 = "material icons:pixelsize=16;3" 59 | 60 | modules-left = i3 xwindow 61 | modules-center = mpd 62 | modules-right = alsa eth memory cpu temperature date powermenu 63 | 64 | 65 | tray-position = right 66 | tray-padding = 2 67 | ;tray-background = #0063ff 68 | tray-background = ${colors.background} 69 | 70 | ;wm-restack = bspwm 71 | ;wm-restack = i3 72 | 73 | ;override-redirect = true 74 | 75 | ;scroll-up = bspwm-desknext 76 | ;scroll-down = bspwm-deskprev 77 | 78 | ;scroll-up = i3wm-wsnext 79 | ;scroll-down = i3wm-wsprev 80 | 81 | cursor-click = pointer 82 | cursor-scroll = ns-resize 83 | 84 | [module/xwindow] 85 | type = internal/xwindow 86 | label = %title:0:30:...% 87 | 88 | [module/xkeyboard] 89 | type = internal/xkeyboard 90 | blacklist-0 = num lock 91 | 92 | format-prefix = " " 93 | format-prefix-foreground = ${colors.foreground-alt} 94 | format-prefix-underline = ${colors.secondary} 95 | 96 | label-layout = %layout% 97 | label-layout-underline = ${colors.secondary} 98 | 99 | label-indicator-padding = 2 100 | label-indicator-margin = 1 101 | label-indicator-background = ${colors.secondary} 102 | label-indicator-underline = ${colors.secondary} 103 | 104 | [module/filesystem] 105 | type = internal/fs 106 | interval = 25 107 | 108 | mount-0 = / 109 | 110 | label-mounted = %{F#0a81f5}%mountpoint%%{F-}: %percentage_used%% 111 | label-unmounted = %mountpoint% not mounted 112 | label-unmounted-foreground = ${colors.foreground-alt} 113 | 114 | [module/bspwm] 115 | type = internal/bspwm 116 | 117 | label-focused = %index% 118 | label-focused-background = ${colors.background-alt} 119 | label-focused-underline= ${colors.primary} 120 | label-focused-padding = 2 121 | 122 | label-occupied = %index% 123 | label-occupied-padding = 2 124 | 125 | label-urgent = %index%! 126 | label-urgent-background = ${colors.alert} 127 | label-urgent-padding = 2 128 | 129 | label-empty = %index% 130 | label-empty-foreground = ${colors.foreground-alt} 131 | label-empty-padding = 2 132 | 133 | ; Separator in between workspaces 134 | ; label-separator = | 135 | 136 | [module/i3] 137 | type = internal/i3 138 | format = 139 | index-sort = true 140 | wrapping-scroll = false 141 | 142 | ; Only show workspaces on the same output as the bar 143 | ;pin-workspaces = true 144 | 145 | label-mode-padding = 2 146 | label-mode-foreground = #000 147 | label-mode-background = ${colors.primary} 148 | 149 | ; focused = Active workspace on focused monitor 150 | ;label-focused = %index% 151 | ;label-focused-background = ${colors.background-alt} 152 | ;label-focused-underline= ${colors.primary} 153 | ;label-focused-padding = 2 154 | 155 | ; unfocused = Inactive workspace on any monitor 156 | ;label-unfocused = %index% 157 | ;label-unfocused-padding = 2 158 | 159 | ; visible = Active workspace on unfocused monitor 160 | ;label-visible = %index% 161 | ;label-visible-background = ${self.label-focused-background} 162 | ;label-visible-underline = ${self.label-focused-underline} 163 | ;label-visible-padding = ${self.label-focused-padding} 164 | 165 | ; urgent = Workspace with urgency hint set 166 | ;label-urgent = %index% 167 | ;label-urgent-background = ${colors.alert} 168 | ;label-urgent-padding = 2 169 | 170 | ; Separator in between workspaces 171 | ; label-separator = | 172 | 173 | label-focused-background = ${module/bspwm.label-focused-background} 174 | label-focused-underline = ${module/bspwm.label-focused-underline} 175 | label-focused-padding = ${module/bspwm.label-focused-padding} 176 | 177 | label-unfocused-padding = ${module/bspwm.label-occupied-padding} 178 | 179 | label-visible-background = ${self.label-focused-background} 180 | label-visible-underline = ${self.label-focused-underline} 181 | label-visible-padding = ${self.label-focused-padding} 182 | 183 | label-urgent-background = ${module/bspwm.label-urgent-background} 184 | label-urgent-padding = ${module/bspwm.label-urgent-padding} | 185 | 186 | [module/mpd] 187 | type = internal/mpd 188 | format-online = 189 | 190 | ;label-offline = mpd is offline 191 | 192 | icon-prev =  193 | icon-stop =  194 | icon-play =  195 | icon-pause =  196 | icon-next =  197 | icon-repeat =  198 | icon-repeatone =  199 | icon-random =  200 | 201 | toggle-on-foreground = #ff 202 | toggle-off-foreground = #55 203 | 204 | label-song-maxlen = 25 205 | label-song-ellipsis = true 206 | 207 | [module/xbacklight] 208 | type = internal/xbacklight 209 | 210 | format =