Commits

Xu Xiaodong committed cfff394

minor update

  • Participants
  • Parent commits 70d5511

Comments (0)

Files changed (1)

 #!/bin/sh
 #
-# name:      gsd, a simple gui for sdcv
-# author:    Xu Xiaodong <xxdlhy@gmail.com>
-# license:   GPL
-# created:   2009 Dec 23
-# modified:  2011 Apr 13
+# name     : gsd, a simple gui for sdcv
+# author   : Xu Xiaodong <xxdlhy@gmail.com>
+# license  : GPL
+# created  : 2009 Dec 23
+# modified : 2012 Jun 03
 #
 
-word=`yad --title 'gsd' \
-          --center \
-          --no-buttons \
-          --entry`
-output=`sdcv -n -u '朗道英汉字典5.0' "$word"`
+# Directly type
+input=`yad --title 'gsd' \
+  --center \
+  --no-buttons \
+  --entry`
 
+# Read from clipboard
+clip=`xclip -o`
+
+# Get keyword
+if [ -n "$input" ]
+then
+  word="$input"
+else
+  word="$clip"
+fi
+
+# Search keyword
+output=`sdcv -n -u '简明英汉字典' "$word"`
+
+# Display result
 if [ -n "$output" ]
 then
-    yad --title 'gsd' \
-        --center \
-        --no-buttons \
-        --timeout '5' \
-        --text "$output"
+  yad --title 'gsd' \
+    --center \
+    --no-buttons \
+    --timeout '10' \
+    --text "$output"
 fi
 
 exit 0