Merge pull request #24 from TravonteD/position
Add the ability to set the windows position
This commit is contained in:
commit
df51619bf3
|
@ -59,6 +59,7 @@ Download and display album art or display embedded album art
|
||||||
optional arguments:
|
optional arguments:
|
||||||
-h, --help show this help message and exit
|
-h, --help show this help message and exit
|
||||||
--size what size to display the album art in
|
--size what size to display the album art in
|
||||||
|
--position The position where the album art should be displayed
|
||||||
--music_dir the music directory which MPD plays from
|
--music_dir the music directory which MPD plays from
|
||||||
--silent dont show the output
|
--silent dont show the output
|
||||||
--version show the version of kunst you are using
|
--version show the version of kunst you are using
|
||||||
|
@ -78,6 +79,9 @@ You can configure `kunst` through environment variables.
|
||||||
# The size of the album art to be displayed
|
# The size of the album art to be displayed
|
||||||
export KUNST_SIZE="250x250"
|
export KUNST_SIZE="250x250"
|
||||||
|
|
||||||
|
# The position where the album art should be displayed
|
||||||
|
export KUNST_POSITION="+0+0"
|
||||||
|
|
||||||
# Where your music is located
|
# Where your music is located
|
||||||
export KUNST_MUSIC_DIR="/home/username/Music/"
|
export KUNST_MUSIC_DIR="/home/username/Music/"
|
||||||
```
|
```
|
||||||
|
|
13
kunst
13
kunst
|
@ -11,10 +11,11 @@ VERSION=1.2.4
|
||||||
COVER=/tmp/kunst.jpg
|
COVER=/tmp/kunst.jpg
|
||||||
MUSIC_DIR=~/Music/
|
MUSIC_DIR=~/Music/
|
||||||
SIZE=250x250
|
SIZE=250x250
|
||||||
|
POSITION="+0+0"
|
||||||
|
|
||||||
|
|
||||||
show_help() {
|
show_help() {
|
||||||
echo "usage: kunst [-h] [--size "px"] [--music_dir "path/to/dir"] [--silent] [--version]"
|
echo "usage: kunst [-h] [--size "px"] [--position "+x+y"][--music_dir "path/to/dir"] [--silent] [--version]"
|
||||||
echo " "
|
echo " "
|
||||||
echo "┬┌─┬ ┬┌┐┌┌─┐┌┬┐"
|
echo "┬┌─┬ ┬┌┐┌┌─┐┌┬┐"
|
||||||
echo "├┴┐│ ││││└─┐ │"
|
echo "├┴┐│ ││││└─┐ │"
|
||||||
|
@ -24,6 +25,7 @@ show_help() {
|
||||||
echo "optional arguments:"
|
echo "optional arguments:"
|
||||||
echo " -h, --help show this help message and exit"
|
echo " -h, --help show this help message and exit"
|
||||||
echo " --size what size to display the album art in"
|
echo " --size what size to display the album art in"
|
||||||
|
echo " --position The position where the album art should be displayed"
|
||||||
echo " --music_dir the music directory which MPD plays from"
|
echo " --music_dir the music directory which MPD plays from"
|
||||||
echo " --silent dont show the output"
|
echo " --silent dont show the output"
|
||||||
echo " --version show the version of kunst you are using"
|
echo " --version show the version of kunst you are using"
|
||||||
|
@ -31,7 +33,7 @@ show_help() {
|
||||||
|
|
||||||
|
|
||||||
# Parse the arguments
|
# Parse the arguments
|
||||||
options=$(getopt -o h --long size:,music_dir:,version,silent,help -- "$@")
|
options=$(getopt -o h --long position:,size:,music_dir:,version,silent,help -- "$@")
|
||||||
eval set -- "$options"
|
eval set -- "$options"
|
||||||
|
|
||||||
while true; do
|
while true; do
|
||||||
|
@ -40,6 +42,10 @@ while true; do
|
||||||
shift;
|
shift;
|
||||||
SIZE=$1
|
SIZE=$1
|
||||||
;;
|
;;
|
||||||
|
--position)
|
||||||
|
shift;
|
||||||
|
POSITION=$1
|
||||||
|
;;
|
||||||
--music_dir)
|
--music_dir)
|
||||||
shift;
|
shift;
|
||||||
MUSIC_DIR=$1
|
MUSIC_DIR=$1
|
||||||
|
@ -182,6 +188,7 @@ main() {
|
||||||
|
|
||||||
[[ $KUNST_MUSIC_DIR != "" ]] && MUSIC_DIR=$KUNST_MUSIC_DIR
|
[[ $KUNST_MUSIC_DIR != "" ]] && MUSIC_DIR=$KUNST_MUSIC_DIR
|
||||||
[[ $KUNST_SIZE != "" ]] && SIZE=$KUNST_SIZE
|
[[ $KUNST_SIZE != "" ]] && SIZE=$KUNST_SIZE
|
||||||
|
[[ $KUNST_POSITION != "" ]] && POSITION=$KUNST_POSITION
|
||||||
|
|
||||||
# Flag to run some commands only once in the loop
|
# Flag to run some commands only once in the loop
|
||||||
FIRST_RUN=true
|
FIRST_RUN=true
|
||||||
|
@ -209,7 +216,7 @@ main() {
|
||||||
FIRST_RUN=false
|
FIRST_RUN=false
|
||||||
|
|
||||||
# Display the album art using sxiv
|
# Display the album art using sxiv
|
||||||
sxiv -g $SIZE -b $COVER -N "Kunst" &
|
sxiv -g $SIZE$POSITION -b $COVER -N "Kunst" &
|
||||||
|
|
||||||
# Save the process ID so that we can kill
|
# Save the process ID so that we can kill
|
||||||
# sxiv when the user exits the script
|
# sxiv when the user exits the script
|
||||||
|
|
Loading…
Reference in New Issue