ZhangZhihui's Blog  

The settings showed by clicking the settings icon:

 

复制代码
frank@ZZHPC:~$ sudo apt install gnome-shell-extension-dashtodock
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Package gnome-shell-extension-dashtodock is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  gnome-shell-extension-ubuntu-dock

E: Package 'gnome-shell-extension-dashtodock' has no installation candidate
复制代码

 

frank@ZZHPC:~$ sudo apt install gnome-shell-extension-ubuntu-dock
[sudo] password for frank: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
gnome-shell-extension-ubuntu-dock is already the newest version (90ubuntu2).
gnome-shell-extension-ubuntu-dock set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

 

复制代码
frank@ZZHPC:~$ XDG_CURRENT_DESKTOP=ubuntu:GNOME gnome-control-center
libEGL warning: DRI2: failed to authenticate
MESA: error: ZINK: failed to choose pdev
libEGL warning: egl: failed to create dri2 screen
MESA: error: ZINK: failed to choose pdev
glx: failed to create drisw screen
11:22:23.0501        cc-wwan-panel[ 3035]: WARNING: Error connecting to ModemManager: Error calling StartServiceByName for org.freedesktop.ModemManager1: Failed to activate service 'org.freedesktop.ModemManager1': timed out (service_start_timeout=25000ms)
11:22:23.1298      cc-ubuntu-panel[ 3035]: WARNING: No gedit is installed here. Colors won't be updated. Please fix your installation.
11:23:31.6135                  Gtk[ 3035]: WARNING: Finalizing AdwPreferencesPage 0x562f7a48dc60, but it still has children left:
   - GtkCenterBox 0x562f7a1d3680
复制代码

The settings showed by this command is different than the default:

 

The file ~/.xsessionrc didn't exist.

frank@ZZHPC:~$ echo 'export XDG_CURRENT_DESKTOP=ubuntu:GNOME' >> ~/.xsessionrc

 

PS C:\Users\ZhangZhihui> wsl -d Ubuntu
frank@ZZHPC:/mnt/c/Users/ZhangZhihui$ exit
logout
PS C:\Users\ZhangZhihui> wsl --list --verbose
  NAME      STATE           VERSION
* Ubuntu    Running         2

 

创建.xsessionrc并在其中加入“export XDG_CURRENT_DESKTOP=ubuntu:GNOME”后收藏栏出现,一切正常了:

 

 

frank@ZZHPC:~$ hostname -I
172.26.76.164

 

远程桌面登录失败是因为一旦没有用户在登录,WSL2 Ubuntu会自动停止:

PS C:\Users\ZhangZhihui> wsl --list --verbose
  NAME      STATE           VERSION
* Ubuntu    Stopped         2

 

在WSL2(Windows Subsystem for Linux 2)中,Ubuntu实例可能会在一段时间不活动后自动关闭。这是因为WSL2的设计会在没有活动进程时自动终止Linux实例以节省资源。


你可以通过运行一个后台任务来保持实例活跃。

 直接执行”sleep 96400 &“,然后退出,WSL2不会自动shutdown。但把它加在.bashrc中(如下所示)却达不到想要的效果:

if [[ $(ps -ef | grep 'sleep 86400' | grep -v 'grep' | wc -l) == 0 ]]; then
  sleep 86400 &
fi

加上nohup就可以了:

if [[ $(ps -ef | grep 'sleep 86400' | grep -v 'grep' | wc -l) == 0 ]]; then
  nohup sleep 86400 > /dev/null 2>&1 &
fi

 

posted on   ZhangZhihuiAAA  阅读(8)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 上周热点回顾(3.3-3.9)
历史上的今天:
2022-01-07 Pandas - Use multiindex
2022-01-07 Pandas - Get distinct values of a level of multiindex
 
点击右上角即可分享
微信分享提示