gsetting 已停止工作 ubuntu 20.04

gsetting 已停止工作 ubuntu 20.04

我编写了一个 bash 脚本来自动化我的设置和安装,但是,在我的脚本完成后设定命令停止工作。

gsettings set org.gnome.settings-daemon.plugins.media-keys area-screenshot-clip "['<Ctrl>P']"
gsettings get org.gnome.settings-daemon.plugins.media-keys area-screenshot-clip
output: ['<Ctrl>P'] #correct!

终端输出正确,但我的键绑定没有改变,使用 dconf-editor 检查我的设置时显示没有变化。运行任何设定命令导致相同的行为。

在此处输入图片描述

以下是我的完整 bash 脚本

##################Update Drivers##################

sudo tee /etc/sudoers.d/$USER <<END
$USER $(hostname) = NOPASSWD: ALL
END

sudo apt-get remove --purge '^nvidia-.*' -y
sudo ubuntu-drivers autoinstall -y


##################Wake on Wifi (wowl)##################
sudo iw phy0 wowlan enable magic-packet

##################SSH server##################
sudo apt install openssh-server -y
    
##################Language Format##################
FILE=/etc/default/locale
sudo echo LC_ALL="en_US.UTF-8" >> $FILE
##################Download Files##################
FILE=./Anaconda3-2021.11-Linux-x86_64.sh
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading Anaconda3-2021.11"
    wget https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh
fi


FILE=./google-chrome-stable_current_amd64.deb
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading google-chrome-stable_current_amd64"
    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
fi



FILE=./teamviewer_amd64.deb
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading teamviewer_amd64"
    wget https://download.teamviewer.com/download/linux/teamviewer_amd64.deb
fi

FILE=./teams_1.4.00.26453_amd64.deb
if [ -f "$FILE" ]; then
    echo "$FILE exists..."
else 
    echo "Downloading teams_1.4.00.26453_amd64.deb"
    wget https://packages.microsoft.com/repos/ms-teams/pool/main/t/teams/teams_1.4.00.26453_amd64.deb
fi

##################Install Favourite apps##################

#Chrome
sudo dpkg -i google-chrome-stable_current_amd64.deb
#Discord
sudo snap install discord
#teamviewer
sudo apt install ./teamviewer_amd64.deb -y
#Microsoft teams
sudo apt install ./teams_1.4.00.26453_amd64.deb -y
#signal
sudo snap install signal-desktop
#whatsapp
sudo snap install whatsapp-for-linux
#unetbootin
sudo add-apt-repository ppa:gezakovacs/ppa -y
sudo apt-get update
sudo apt-get install unetbootin -y
#timeshaft
sudo add-apt-repository -y ppa:teejee2008/ppa
sudo apt install timeshift -y
#pycharm
sudo snap install pycharm-community --classic

#Anaconda pre-requisites
sudo apt-get update -y
sudo apt-get install curl -y
sudo apt-get install libgl1-mesa-glx libegl1-mesa libxrandr2 libxrandr2 libxss1 libxcursor1 libxcomposite1 libasound2 libxi6 libxtst6 -y

##################Uninstall Games/firefox##################
sudo apt remove aisleriot gnome-mahjongg gnome-mines gnome-sudoku -y
sudo apt-get remove firefox -y

# then, remove the sudo access
sudo /bin/rm /etc/sudoers.d/$USER
sudo -k

##################Install Anaconda##################



bash Anaconda3-2021.11-Linux-x86_64.sh -b -p $HOME/anaconda3
source ~/.bashrc
eval "$($HOME/anaconda3/bin/conda shell.bash hook)"
conda init

###add anaconda-navigator to menue####
FILE=$HOME/anaconda.sh
echo export CONDA_PYTHON_EXE=$HOME/anaconda3/bin/python > $FILE
echo export PATH=$HOME/anaconda3/bin:$PATH >> $FILE
echo python $HOME/anaconda3/bin/anaconda-navigator >> $FILE

FILE=$HOME/anaconda.desktop

echo [Desktop Entry] > $FILE
echo Version=1.0 >> $FILE
echo Type=Application >> $FILE
echo Name=Anaconda-Navigator >> $FILE
echo GenericName=Anaconda >> $FILE
echo Exec=/bin/bash "$HOME/bin/anaconda.sh" >> $FILE
echo Icon=$HOME/anaconda3/lib/python3.9/site-packages/anaconda_navigator/static/images/anaconda-icon-256x256.png >> $FILE
echo Terminal=false >> $FILE
echo StartupNotify=true >> $FILE    
conda update -n base -c defaults conda -y
###Create conda basic virtual environments####
conda create cudatoolkit=10.2 -n cuda -c conda-forge -y
#conda install -c anaconda cudnn -y
conda create --name torch --clone cuda
conda install pytorch torchvision torchaudio -n torch -c pytorch -y



#DOESN"T WORK??!
##################Key Bindings##################
gsettings set org.gnome.settings-daemon.plugins.media-keys area-screenshot-clip "['<Ctrl>P']"

##################Favourite Apps##################
gsettings set org.gnome.shell favorite-apps "['org.gnome.Nautilus.desktop', 'org.gnome.Terminal.desktop', 'google-chrome.desktop', 'pycharm-community_pycharm-community.desktop', 'anaconda.desktop', 'discord_discord.desktop', 'signal-desktop_signal-desktop.desktop', 'whatsapp-for-linux_whatsapp-for-linux.desktop', 'snap-store_ubuntu-software.desktop']"

答案1

问题可能出在 Anaconda 安装/初始化上。请确保明确运行/usr/bin/gsettings,否则您可能会运行~/anaconda3/bin/gsettings,这似乎对 GNOME 设置没有任何影响。

相关内容