Ubuntu 14.04のYandex.Diskのインターフェイス

画像

ご存じのように、UbuntuのYandex.Diskはコンソールクライアントとしてのみ存在します。 今日、私は「やめろ」と決め、それでの作業を大幅に簡素化する簡単なスクリプトを書きました(記事の最後にあるソースコード)。

このスクリプトは個人的な使用を目的として書かれていることを説明する価値がありますが、友人が私にここに投稿するよう説得しました。

作業には、次の3つのファイルのみが必要です。
  1. ユーザー操作起動ファイル
  2. クライアントと対話するためのBashスクリプト
  3. Yandex.Diskサービスのアイコン


BASHから始めましょう。 ya-disk.shファイルを便利な場所に作成します。

#!/bin/bash case $1 in start) #   deamon=`yandex-disk start` notify-send -i "$HOME//yandex-disk/icon.png" "$deamon" ;; stop) #   deamon=`yandex-disk stop` notify-send -i "$HOME//yandex-disk/icon.png" "$deamon" ;; *) #    deamon=`yandex-disk status` if [[ "$deamon" == ":   " ]] #         - . then deamon=`yandex-disk start` notify-send -i "$HOME//yandex-disk/icon.png" "$deamon" else #         status=`yandex-disk status | grep -o '^  : .*$' | grep -o ': .*$'` all=`yandex-disk status | grep -o ':.*'` nfree=`yandex-disk status | grep -o ':.*'` free=`yandex-disk status | grep -o ':.*'` maxfile=`yandex-disk status | grep -o '  :.*'` trash=`yandex-disk status | grep -o ' :.*'` if [[ "$status" == ": " ]] #      then SUNC=`yandex-disk status | grep -o ' : .*' | grep -o '[^:]*$'` notify-send -i "$HOME//yandex-disk/icon.png" "" ":$SUNC\n$all\n$nfree\n$free\n$maxfile\n$trash" elif [[ "$status" == ":  " ]]; then #      notify-send -i "$HOME//yandex-disk/icon.png" "$status" else #    notify-send -i "$HOME//yandex-disk/icon.png" "$status" "$all\n$nfree\n$free\n$maxfile\n$trash" fi fi ;; esac #  case. exit 0 


次に、スタートアップファイルを作成します。

アプリケーションのショートカットがすべてあるアドレスに移動します。

 cd /usr/share/applications/ 

次のコマンドを使用して、新しいアプリケーションへのショートカットを作成します。

 sudo gedit ya-disk.desktop 

次のコンテンツ:

 [Desktop Entry] Version=1.0 Type=Application Name=. Comment= ,        . Exec=/home/alex//yandex-disk/ya-disk.sh Terminal=false Icon=/home/alex//yandex-disk/icon.png StartupNotify=true Actions=Window;Document; [Desktop Action Window] Name= Exec=/home/alex//yandex-disk/ya-disk.sh start OnlyShowIn=Unity; [Desktop Action Document] Name= Exec=/home/alex//yandex-disk/ya-disk.sh stop OnlyShowIn=Unity; 

ExecおよびIconパラメーターの値を忘れずに変更してください。 それらはあなたの適切なファイルにつながるはずです。

そして最後の仕上げ。 Iconパラメーターで指定されたアドレスにアイコンをダウンロードして配置します。
私にとっては:

 /home/alex//yandex-disk/icon.png 

以上です。

Yandex.Diskアイコンがダッシュに表示されます。 Unityパネルに移動すると、右クリックしてデーモンを停止できます。

約束されたソース

Source: https://habr.com/ru/post/J249267/


All Articles