- #!/bin/bash
- def_str=`grep 'Background.File' /root/.ideskrc`
- def_length=${#def_str}
- temp_str=`echo $def_str | cut -c 41-$def_length`
- export MAIN_DIALOG='
- <window title="idesk_bg_changer">
- <vbox>
- <text><label>idesk用壁紙変更ツール(AO_o10yan)</label></text>
- <frame ファイル名入力 OKで壁紙変更>
- <hbox>
- <text>
- <label>ファイル名:</label>
- </text>
- <entry><variable>FILENAME</variable>
- <default>'$temp_str'</default>
- </entry>
- </hbox>
- <hbox>
- <button ok>
- <action>"./desktop_bg_function2.sh 'onclick' $FILENAME '$temp_str' &"</action>
- </button>
- </hbox>
- </frame>
- <frame ファイル選択で壁紙変更>
- <hbox>
- <entry accept="filename">
- <label>Select an Existing File</label>
- <variable>FILE_FILENAME</variable>
- <default>/usr/share/backgrounds/'$temp_str'</default>
- <action>"./desktop_bg_function2.sh 'onchange' $FILE_FILENAME '$temp_str' &"</action>
- </entry>
- <button>
- <input file stock="gtk-open"></input>
- <variable>FILE_BROWSE_FILENAME</variable>
- <action type="fileselect">FILE_FILENAME</action>
- </button>
- </hbox>
- </frame>
- <hbox>
- <button cancel></button>
- </hbox>
- </vbox>
- </window>
- '
- gtkdialog3 --center --program=MAIN_DIALOG
#!/bin/bash new_str=$2 if [ $1 = 'onchange' ];then new_str=`basename ${new_str}` fi sed --in-place=.bak --expression=s/$3/$new_str/ /root/.ideskrc idesk選択されたファイル名を basename で取り出す。
使用中のファイル名を第3引数で渡し、$3で参照。
0 件のコメント :
コメントを投稿