Adding graphic support through WSL2 and other stuff.
WSL2 Personalization
XUbuntu-Desktop Setup
The complete WSL2 + GUI setup. | Medium
1 | sudo apt update && sudo apt -y upgrade |
then push the following commands into ~/.bashrc
1 | export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2; exit;}'):0.0 |
Then setup X-server on Windows 10
https://sourceforge.net/projects/vcxsrv/
Open Linux desktop:
1 | xfce4-session |
Themes
Adapta-gtk-theme-colorpack - Eyecandy for your XFCE-Desktop - xfce-look.org
Get it set using Settings Manager --> Appearance
Icons
Kora - Eyecandy for your XFCE-Desktop - xfce-look.org
Wallpaper
https://docs.xfce.org/xfce/xfdesktop/preferences
- Download some wallpapers in a folder, e.g.
Desktop/Wallpaper
- Right click, select
Desktop Settings
, then selectFolder
to the designated one. - Choose whichever wallpaper you like
Zsh
zsh 安装与配置:9步打造高效命令行 - 知乎 (zhihu.com)
1 | sudo apt-get install zsh |
oh-my-zsh
https://github.com/ohmyzsh/ohmyzsh
1 | sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" |
powerlevel10k
https://github.com/romkatv/powerlevel10k
1 | git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k |
zsh-plugins
[Mac/Linux配置oh-my-zsh 安装必用插件 - 腾讯云开发者社区-腾讯云 (tencent.com)](https://cloud.tencent.com/developer/article/2231632#:~:text=4.1 oh-my-zsh内置自动补全 1 自动列出目录: 输入 cd 按 tab,例如 %2Fopt%2Flocal%2Fbin 这个长路径,只需要 cd %2Fo%2Fl%2Fb 按 tab 键自动补全)
zsh-autosuggestions
zsh-syntax-highlighting
z
zsh-completions
Incremental completion on zsh
##创建文件夹 mkdir $ZSH_CUSTOM/plugins/incr ##下载 curl -fsSL https://mimosa-pudica.net/src/incr-0.2.zsh -o $ZSH_CUSTOM/plugins/incr/incr.zsh ##配置 echo 'source $ZSH_CUSTOM/plugins/incr/incr.zsh' >> ~/.zshrc ##激活 source ~/.zshrc
1
2
3
4
5
6
7
8
9
10
11
12
13
-
## Chinese Pinyin Support on xfce4-session(postponed)
[Support Chinese under Ubuntu XFCE · zeerd's blog](https://blog.zeerd.com/support-CN-under-xfce/)
[language support - How do I get Chinese input to work? - Ask Ubuntu](https://askubuntu.com/questions/59356/how-do-i-get-chinese-input-to-work)
[iBus doesn't seem to restart - Ask Ubuntu](https://askubuntu.com/questions/389903/ibus-doesnt-seem-to-restart)
sudo apt install ibus-sunpinyin
ibus start
ibus-daemon -d
1 |
|
\wsl$
1 |
|
In this example, the fullscreen
would override the other settings, so the entire background of vscode would be changed, and to different pics at the chosen intervals.
Proxy
By configuring .bashrc
or .zshrc
, we can set proxy automatically. By the way, we can also use proxychains4
to manually use proxy.
终端使用代理加速的正确方式(Clash) | Ln’s Blog (weilining.github.io)
windows终端命令行下使用网络代理 - Macrored - 博客园 (cnblogs.com)
on Linux(unfinished)
WSL2内使用windows的v2ray代理配置方式。 - 知乎 (zhihu.com)
https://www.bilibili.com/read/cv22203257
(155条消息) windows powershell配置http代理_$env:http_proxy_脱发小阿毛。的博客-CSDN博客
These settings are based on ip tables
but I think I can’t get it correctly.
Anyway, I can still use proxychains4
but each time I change my Windows network settings, the WSL2 configuration will also be changed manually as well through /etc/proxychains4.conf
.
on Windows
Do notice that on Windows we have two types of terminals: one is the classic CMD, the other is Windows Powershell. These two may seem similar in daily use, but their modes of configuration ain’t the same.
Windows Powershell
The environment variable $PROFILE
is the path where the PS setting file lies in. So we use the code $PROFILE
command to add our things:
1 | function set_http_proxy { |
Then we have it! To put in a nutshell, the core environment variables are $env:HTTP_PROXY
and $env:HTTPS_PROXY
. Change these two, then the proxy will be set in this terminal.
Windows CMD—-through Windows env settings
Actually the Windows original command line isn’t that user-friendly. according to this website:
cmd - How to run a command on command prompt startup in Windows - Stack Overflow
One may need to alter the registry to achieve the “Autorun” every time you start a command.
Anyway, let’s just say we don’t need the automatic proxy setting right now, so what we need to do is to run these following commands each time we start the cmd:
1 | set http_proxy="http://127.0.0.1:10867" |
10867 is the host http proxy port in my computer. Change this value according to your own.
new solve: use env settings
Windows系统下设置cmd命令行(终端)走代理的方法 - zhuibo6 - 博客园 (cnblogs.com)
Open the Windows environmental variables panel, then add two following variables in the system variables:
- http_proxy
- https_proxy
With the exact “http://127.0.0.1:10867“ as the value respectively just like we did before.
Problems
Charset error on Windows Terminal in Zsh
安装zsh解决zsh下terminal终端字符乱码问题_zsh ago 乱码_王一诺Eno的博客-CSDN博客
You have to make the font configuration consistent with that set in Zsh. I use “MesloLGS NF” on the Linux Terminal, so just set the same on the Windows Terminal by changing the font setting on settings.json
with “MesloLGS NF”
References
- 本文作者: Taardis
- 本文链接: https://taardisaa.github.io/2023/04/17/WSL2_Personalization/
- 版权声明: 本博客所有文章除特别声明外,均采用 Apache License 2.0 许可协议。转载请注明出处!