Альтернативы HydraPaper для обоев парного монитора?

Я искал способ иметь двойные обои. До сих пор единственной вещью, которая подошла, является HydraPaper. Проблема - то, что я должен был бы также установить Flatpak. Я уже использую apt и snap для пакетов, таким образом, я не хочу устанавливать другой диспетчер пакетов только для обоев. Существует ли альтернатива HydraPaper?

0
задан 6 December 2019 в 08:38

1 ответ

Это могло бы быть тем, что Вы ищете.

я сделал это с помощью "удара", "преобразовываю" и "gsettings". Это работает с моими 2 экранами.

В схеме:

  • получают два изображения с той же высотой
  • новая ширина изображения = ширина экрана * исходная высота изображения / высота экранного
  • изображения фрагмента к новой ширине
  • присоединяется к 2 изображениям, которые теперь соответствуют полной ширине 2 экранов

, я запускаю Ubuntu 18.04. Не стесняйтесь взламывать к содержанию своей основы

#! /bin/bash
#! /bin/bash -vx

# input:
# new_background.sh -reset - to reset background to the previous picture
# new_background.sh -set - to set a new background

lastImage=$HOME/.new_background_last_image.txt
DIR="/usr/share/backgrounds"
joinImage=$HOME/.new_background_last_image.jpg
# choose 2 images from dir
number=$(ls -1 $DIR | wc -l | awk '{print $1}')
mapfile -t screenSize < <( xrandr | grep  -e "^DP" | awk ' { print [110] }'  )
if [ ${#screenSize[@]} != 2 ]
then
echo there don\'t appear to be 2 screens - jobs ends
exit
fi

tot=0
prevH=0
prevW=0
prevFile=""
found=0
SET=-1
case "$1" in
-reset ) SET=0
;;
-set ) SET=1
;;
esac 

if [ "$SET" -eq -1 ]
then
echo enter either -set or -reset
exit
fi

# reset previous picture
if [ "$SET" -eq 0 ]
then
URI=$(cat $lastImage)
gsettings set org.gnome.desktop.background picture-options 'zoom'
gsettings set org.gnome.desktop.background picture-uri "${URI}"
exit
fi

# find 2 pictures
while [ $tot -lt $number ]
do
# go throguh files at random until 2 have the same height
  randomN=$[ ( $RANDOM % $number ) ]
  fileName=$(ls -1 $DIR/*  | grep -e jpg -e png | awk 'NR=='$randomN' {print [110]}')
  if [ x$prevFile == x$fileName ]
  then
    continue
  fi
  if [ x"" == x$fileName ]
  then
    continue
  fi
  if [ x$prevFile != x$fileName ] && [ x"" != x$fileName ]
  then
    ww=$(convert $fileName -print "Size: %wx%h\n" /dev/null | awk '{ print $2}')
    w=$(echo $ww | awk -F x ' {print $1 }')
    h=$(echo $ww | awk -F x ' {print $2 }') 
    if [ $h -eq $prevH ]
    then
      found=1
      break
    fi
  fi
  prevW=$w
  prevH=$h
  prevFile=$fileName
  tot=$[$tot+1]
done

if [ $found -eq 0 ]
then
  echo no files found   # may be solved by running the program again
  exit
fi

# new width = width of screen * original height of image / height of screen
#           =      1920                 2160(e.g.)           1080

pref=$(expr $(mktemp -u) :  ".*\.\(.*\)")
outputFile=(${pref}_1 ${pref}_2)

files=( $fileName $prevFile )
widths=( $w $prevW)
heights=( $h $prevH)

# do each file
reverse=0      # if the second screen is the first in the screenSize list reverse=1
for I in 0 1;
do
# size of screen I
mapfile -t tt < <(echo ${screenSize[$I]}   |  grep -E -o  '[0-9]+x[0-9]+\+[0-9]+\+[0-9]+'  | sed s'/[x+]/ /g' | awk ' { print $1,"\n", $2, "\n", $3, "\n", $4 } ')

# this is the start position of the screen 
# if not 0 and I=0 then it is the 2nd screen and reverse images when joining
offset=${tt[2]}
if [ $I == 0 ] && [ $offset != 0 ]
then
reverse=1
fi
let "newWidth = ${heights[$I]}*${tt[0]}/${tt[1]}" 
convert -resize ${newWidth}x${heights[$I]}! ${files[$I]} ${outputFile[$I]}
done

# join the files
if [ $reverse == 0 ]
then
convert +append ${outputFile[0]} ${outputFile[1]} $joinImage
else
convert +append ${outputFile[1]} ${outputFile[0]} $joinImage
fi

URI=$(gsettings get org.gnome.desktop.background picture-uri)
# save the previous file name
echo $URI > $lastImage
uri=file:"//$joinImage"
gsettings set org.gnome.desktop.background picture-options 'spanned'
gsettings set org.gnome.desktop.background picture-uri "${uri}"
rm ${outputFile[0]} ${outputFile[1]}
# end-of-file
0
ответ дан 21 December 2019 в 23:40

Другие вопросы по тегам:

Похожие вопросы: