web-dev-qa-db-ja.com

壁紙に別の検索ディレクトリを設定するにはどうすればよいですか?

私はすべてのドキュメントを自分のubuntuインストールとは別のドライブに保管しており、そのドライブには素敵な壁紙でいっぱいのフォルダーがあります。デスクトップを右クリックしてデスクトップの壁紙を変更を選択すると、壁紙が壁紙チェンジャーダイアログに表示されるようにubuntuがこのディレクトリを自動的に検索するようにするにはどうすればよいですか?

編集:/ usr/share/backgroundsフォルダーに他のドライブへのシンボリックリンクを配置しようとしましたが、動作しませんでした。

12
Slipstream

*編集-2回目の試行-すべての端末作業についてすぐに謝罪-これは、強調表示されたエントリをコピーアンドペーストするだけです*

gnomeの壁紙の詳細を保持するフォルダーは/usr/share/gnome-background-properties/ubuntu-wallpapers.xmlと呼ばれます

このファイルを編集して、新しいフォルダーと壁紙ファイルを指す壁紙... /壁紙サブセクションを作成できます

以下は、このフォーラムから修正されたスクリプトです entry .pngおよび.jpgファイルを含むフォルダーのubuntu-wallpapers.xmlファイルを自動的に再生成します。

内容をコピーして「ubuntu-wallpaper-generator」という新しいテキストファイルに貼り付けます

次に、構文でファイルを実行します

sh ubuntu-wallpaper-generator <path to new wallpaper folder>

これにより、このスクリプトを実行しているフォルダーと同じフォルダーにubuntu-wallpapers.xmlというファイルが生成されます。

現在のxmlファイルを安全にバックアップします。

Sudo cp /usr/share/gnome-background-properties/ubuntu-wallpapers.xml /usr/share/gnome-background-properties/ubuntu-wallpapers.xml.backup

新しく生成されたファイルのコピー

Sudo cp ubuntu-wallpapers.xml /usr/share/gnome-background-properties/ubuntu-wallpapers.xml

私が参照したスクリプトファイルは次のとおりです。

#!/bin/bash
#
# This script will take all wallpapers in a given folder and
# make them available as "default" background in the "Change Background" gui
# frontend in Ubuntu.
#
################################################################################

#CONFIG_DIR="/usr/share/gnome-background-properties"
CONFIG_DIR="./"
XML_FILE="$CONFIG_DIR/ubuntu-wallpapers.xml"

if [ $# -ne 1 ]; then
   echo "*** syntax ubuntu-wallpaper-generator <path to wallpaper folder> ***"
   echo "*** for example ***"
   echo "*** ubuntu-wallpaper-generator /usr/share/backgrounds ***"
   exit 1
else
   WALLPAPER_DIR=$1
   echo "*** parameters passed: $1 ***"
fi

#### First check if we have write permissions to the share dirctory. ####
touch $CONFIG_DIR/testfile >/dev/null 2>/dev/null
if [ $? -ne 0 ]; then
   echo "**** No permissions to the desktop share directory. ****"
   echo "**** $CONFIG_DIR ****"
   echo "**** Procedure Terminated. ****"
   exit 1
else
   rm $CONFIG_DIR/testfile 2>/dev/null
fi

#### Show the script description message. ###
cat <<EOF

################################################################################
     This script makes all pictures in the $WALLPAPER_DIR
     directory available to all users defined on this system as their
     system-wide GNOME wallpapers.
################################################################################
EOF

#### Fail if the wallpaper directory does not exist. ####
if [ ! -d $WALLPAPER_DIR ]; then
    echo "**** The wallpaper directory \"$WALLPAPER_DIR\" does not exist. ****"
    echo "**** Precedure Terminated. ****"
    exit 1
fi

#### Count the number of jpg/jpeg/png images. ####
numfiles=`ls -1 $WALLPAPER_DIR/*.jpg WALLPAPER_DIR/*.jpeg WALLPAPER_DIR/*.png 2>/dev/null | wc -l`

#### If there are no image files there then exit. ####
if [ $numfiles -eq 0 ]; then
    echo "**** The wallpaper directory \"$WALLPAPER_DIR\" has no images. ****"
    echo "**** Precedure Terminated. ****"
    exit 1
fi

#### Now we create the XML file containing the images for backgrounds. ####
#### Start by creating the header in the XML file. ####
cat <<EOF > $XML_FILE
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
<wallpapers>
EOF

#### Add each file to the XML file. ####
#### Doing it this way makes sure files with spaces in their names are ####
#### handled properly.   (ls .... | while read fname; do)              ####
ls -1 $WALLPAPER_DIR/*.jpg $WALLPAPER_DIR/*.png $WALLPAPER_DIR/*.jpeg 2> /dev/null |
while read image_name; do
   echo "   Adding: `basename "$image_name"`."
   fname=`basename "$image_name"`
   fname="${fname%%\.*}"
   echo "  <wallpaper>"                          >> $XML_FILE
   echo "    <name>$fname</name>"                >> $XML_FILE
   echo "    <filename>$image_name</filename>"   >> $XML_FILE
   echo "    <options>stretched</options>"       >> $XML_FILE
   echo "    <pcolor>#c58357</pcolor>"           >> $XML_FILE
   echo "    <scolor>#c58357</scolor>"           >> $XML_FILE
   echo "    <shade_type>solid</shade_type>"     >> $XML_FILE
   echo "  </wallpaper>"                         >> $XML_FILE
done

#### Create the footer for the XML file. ####
echo "</wallpapers>"                             >> $XML_FILE

cat <<EOF
################################################################################
     You're almost done. copy the generated file ubuntu-wallpapers.xml to the
     folder /usr/shared/gnome-background-properties
     REMEMBER to backup the current ubuntu-wallpaper.xml in that folder first!
################################################################################

EOF
9
fossfreedom

同じ問題に直面したので、pythonスクリプトを作成して、/usr/share/gnome-background-properties/my-backgrounds.xmlに配置できるカスタムxmlファイルを編集しました。 GitHub にあります。

使用例:

space_galaxy.jpegおよびfuzz_dog.pngをxmlファイルに追加するには:

python my-backgrounds.py -a space_galaxy.jpeg fuzzy_dog.png -n "Cool Galaxy" "Cute Dog"

デフォルトのxmlファイルは/usr/share/gnome-background-properties/my-backgrounds.xml(GNOMEがxmlを監視する場所)にあることに注意してください。別のxmlファイルを指定するには、-xオプションを使用します。

python my-backgrounds.py -a space_galaxy.jpeg -x ~/my-backgrounds.xml

Xmlファイルからエントリを削除するには、-rオプションを使用します。

python my-backgrounds.py -r "Cool Galaxy" fuzzy_dog.png

これはGNOME 3.6およびPython 3.3で動作します

1
jameh

CreBS(Create Background Slideshow)を使用すると、壁紙スライドショー用のXMLファイルを作成できます。画像へのフルパスはXMLに保存されるため、ファイルを移動する必要はありません。

https://launchpad.net/crebs

http://www.obfuscatepenguin.net/crebs/

1
type

ここに更新があります:

    #!/bin/bash

    ################################################################################
    # This script will take all wallpapers in a given folder and
    # make them available as options in the "change desktop background" OR "system->pref->apperances"
    # dialog boxes.
    # for ubuntu or debian
    #    wallpapers are in /usr/share/pixmaps/backgrounds/gnome OR /usr/share/backgrounds
    #    config file(s) for the dialog are in /usr/share/gnome-background-properties
    # --that will make them system wide. 
    #
    #ToDo:
    #  paths with spaces.
    ################################################################################

    # put the output in the same directory as this script
    OutDirectory="$( cd "$( dirname "$0" )" && pwd )"
    OutFile="$OutDirectory/gnome-added.xml"

    # options
    options="zoom"      #zoom is best but stretch,center,scale,tile,span
    shade_type="solid"  #horizontal-gradient, vertical-gradient    
    pcolor="#000000"
    scolor="#000000"


    if [ $# -ne 1 ]; then
       echo "*** need path to directory containing files to include."
       echo "*** for example:     /usr/share/backgrounds"
       exit 1
    else
       ScanDirectory=$1
    fi

    #------need to strip and trailing "/" or this writes incorrect file names.
    # not if [ "$lastchr" -eq "/" ]
    # lastchr=`expr substr $ScanDirectory ${#ScanDirectory} 1`  #--OR:
    lastchr=${ScanDirectory#${ScanDirectory%?}}
    if [ "${lastchr}" = "/" ]; then
       ScanDirectory=${ScanDirectory%?}
    fi
    #--operating in same directory as the script? set full path for the xml file
    if [ ${#ScanDirectory} -le 1 ]; then
            ScanDirectory=$OutDirectory
    fi

    # ---does directory exist
    if [ ! -d $ScanDirectory ]; then
        echo "**** The wallpaper directory \"$ScanDirectory\" does not exist. ****"
        echo "**** Precedure Terminated. ****"
        exit 1
    fi
    # ----can we write to it?
    # touch $OutDirectory/testfile >/dev/null 2>/dev/null
    # if [ $? -ne 0 ]; then
    if [ ! -w $OutDirectory ]; then
       echo "**** No permissions to the desktop share directory. ****"
       echo "**** $OutDirectory ****"
       echo "**** Procedure Terminated. ****"
       exit 1
    fi


    #### Count the number of jpg/jpeg/png/svg [tif(f)] images. ####
    numfiles=`ls -1 $ScanDirectory/*.jpg ScanDirectory/*.jpeg ScanDirectory/*.png ScanDirectory/*.svg 2>/dev/null | wc -l`

    #### If there are no image files there then exit. ####
    if [ $numfiles -eq 0 ]; then
        echo "**** The wallpaper directory \"$ScanDirectory\" has no images. ****"
        echo "**** Precedure Terminated. ****"
        exit 1
    fi

    #### Now we create the XML file containing the images for backgrounds. ####
    #### Start by creating the header in the XML file. ####
    cat <<EOF > $OutFile
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE wallpapers SYSTEM "gnome-wp-list.dtd">
    <wallpapers>
    EOF

    #### Add each file to the XML file. ####
    #### Doing it this way makes sure files with spaces in their names are ####
    #### handled properly.   (ls .... | while read fname; do)              ####
    ls -1 $ScanDirectory/*.jpg $ScanDirectory/*.png $ScanDirectory/*.jpeg $ScanDirectory/*.svg 2> /dev/null |
    while read image_name; do
       fname=`basename "$image_name"`
       echo "   Adding: $fname."

       echo "  <wallpaper deleted=\"false\">"          >> $OutFile
       echo "    <name>$fname</name>"                >> $OutFile
       echo "    <filename>$image_name</filename>"   >> $OutFile
       echo "      <options>$options</options>"       >> $OutFile
       echo "      <pcolor>$pcolor</pcolor>"           >> $OutFile
       echo "      <scolor>$scolor</scolor>"           >> $OutFile
       echo "      <shade_type>$shade_type</shade_type>"     >> $OutFile
       echo "  </wallpaper>"                         >> $OutFile
    done

    #### Create the footer for the XML file. ####
    echo "</wallpapers>"                             >> $OutFile
1
Alan Harcanon

これが私のやり方です。

  1. [デスクトップ]> [背景の変更]を右クリックします。

  2. [背景]タブで[追加]をクリックします。

  3. 移動intoフォルダー、すべての壁紙を選択するには、いずれかをクリックして、 Ctrl + A

セレクタに表示されるはずです。また、壁紙を自動的に変更するために使用した小さなアプリを探しています。見つけたら投稿します。

ウォーリーと呼ばれるものを見つけましたが、強くお勧めしますが、私はそれを使用していなかったことを覚えています。とにかく、次のように入力してインストールできます

Sudo apt-get install wally

ターミナルで。

フォルダーを手動で更新することなく、セレクターに壁紙を表示するには、/usr/share/backgroundsに追加する必要があります。

また、フォルダーにシンボリックリンクを作成することで、セレクターで壁紙を一覧表示することもできました。

$ cd /usr/share/backgrounds
$ ln -s /path/to/wallpapers

毎回rootが所有するフォルダーに壁紙を追加するのが常に便利であるとは限らない可能性があるため、これは役立つ場合があります。

0
theTuxRacer