¿Cómo puedo configurar un fondo de pantalla de desplazamiento lateral?


10

Quiero que mi fondo de pantalla sea un desplazamiento lateral de Super Mario World Yoshi's Island 1 . Una vez que el fondo de pantalla se desplazara completamente, volvería sin problemas al inicio.

¿Hay algún programa o XML que pueda lograr esto por mí? Estoy usando GNOME Shell.


66
Entonces . . . básicamente quieres tener un fondo de pantalla animado?
Sergiy Kolodyazhnyy

Está animado, pero no pude encontrar nada que pudiera desplazarlo lateralmente.
Soren

3
Lo que creo que se puede hacer es dividir esa imagen en múltiples "instantáneas" y usar un archivo XML para configurar las transiciones con un período de tiempo establecido. De esa manera, será algo así como en los viejos juegos de consola, donde tienes una "vista", luego cruzas el borde y aparece otra vista en la pantalla, y así sucesivamente. ¿Crees que sería una buena idea?
Sergiy Kolodyazhnyy

2
Estoy pensando en escribir un guión para eso. Podría llevarme un par de días. Te lo haré saber una vez que encuentre un código de trabajo, ¿de acuerdo?
Sergiy Kolodyazhnyy

1
Pasaría esta solicitud al desarrollador de XScreenSaver. Parece una idea maravillosa que espero que el desarrollador considere. No sería un fondo de pantalla como lo solicitó, pero es una solución alternativa para satisfacer sus "deseos gráficos". Del mismo modo, la carpeta ones / Pictures también se puede poner en cola para desplazarse. Realmente me gusta tu solicitud!
WinEunuuchs2Unix

Respuestas:


4

Actualización 22/10/16

El script se ha actualizado para cumplir con los requisitos de esta pregunta: /ubuntu//a/840381/295286

La transición y la duración se hicieron opcionales y tenían valores predeterminados. -sLa opción también se agrega para cambiar el tamaño de los fondos de pantalla (igual que las opciones de mosaico, escala, estiramiento desde la configuración del sistema).


Tal como dije en los comentarios, tendrías que cortar la imagen en partes iguales o superpuestas y crear una presentación de diapositivas. No conozco la licencia de esa imagen específica que desea, por lo que se la dejaré a usted para que la corte ( Sugerencia ).

Sin embargo, aquí hay un script generador de fondos de pantalla animados que he escrito. El uso es muy simple. Como se muestra por -hopción:

usage: xml_wallpaper_maker.py [-h] -d DIRECTORY -t TRANSITION -l LENGTH [-o]

Serg's XML slideshow creator

optional arguments:
  -h, --help            show this help message and exit
  -d DIRECTORY, --directory DIRECTORY
                        Directory where images stored
  -t TRANSITION, --transition TRANSITION
                        transition time in seconds
  -l LENGTH, --length LENGTH
                        Time length in seconds per image
  -o, --overlay         Enables use of overlay transition

Ejemplo:

./xml_wallpaper_maker.py -d Pictures/My_SideScroller_Images/ -t 5 -l 10 

Código fuente

También disponible en GitHub

#!/usr/bin/env python3
# -*- coding: utf-8 -*- 

#
# Author: Serg Kolo , contact: 1047481448@qq.com
# Date: September 2 , 2016
# Purpose: A program that creates and launches XML slideshow
#      
# Tested on: Ubuntu 16.04 LTS
#
#
# Licensed under The MIT License (MIT).
# See included LICENSE file or the notice below.
#
# Copyright © 2016 Sergiy Kolodyazhnyy
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.


from gi.repository import Gio
import xml.etree.cElementTree as ET
import lxml.etree as etree
import argparse
import sys
import os

def gsettings_set(schema, path, key, value):
    """Set value of gsettings schema"""
    if path is None:
        gsettings = Gio.Settings.new(schema)
    else:
        gsettings = Gio.Settings.new_with_path(schema, path)
    if isinstance(value,list ):
        return gsettings.set_strv(key, value)
    if isinstance(value,int):
        return gsettings.set_int(key, value)
    if isinstance(value,str):
        return gsettings.set_string(key,value)

def parse_args():
        """ Parses command-line arguments """
        arg_parser = argparse.ArgumentParser(
        description='Serg\'s XML slideshow creator',
        )

        arg_parser.add_argument(
                                '-d', '--directory',
                                help='Directory where images stored',
                                type=str,
                                required=True
                                )

        arg_parser.add_argument(
                                '-t','--transition', 
                                type=float,
                                help='transition time in seconds',
                                required=True
                                )


        arg_parser.add_argument(
                                '-l','--length', 
                                type=float,
                                help='Time length in seconds per image',
                                required=True
                                )

        arg_parser.add_argument(
                                '-o','--overlay', 
                                action='store_true',
                                help='Enables use of overlay transition',
                                required=False
                                )
        return arg_parser.parse_args()



def main():
    """ Program entry point"""
    args = parse_args()
    xml_file = os.path.join(os.path.expanduser('~'),'.local/share/slideshow.xml')
    path = os.path.abspath(args.directory)
    duration = args.length
    transition_time = args.transition

    if not os.path.isdir(path):
       print(path," is not a directory !")
       sys.exit(1)

    filepaths = [os.path.join(path,item) for item in os.listdir(path) ]
    images = [ img for img in filepaths if os.path.isfile(img)]
    filepaths = None
    images.sort()
    root = ET.Element("background")
    previous = None

    # Write the xml data of images and transitions
    for index,img in enumerate(images):

        if index == 0:
           previous = img
           continue

        image = ET.SubElement(root, "static")
        ET.SubElement(image,"duration").text = str(duration)
        ET.SubElement(image,"file").text = previous

        if args.overlay: 
            transition = ET.SubElement(root,"transition",type='overlay')
        else:
            transition = ET.SubElement(root,"transition")
        ET.SubElement(transition,"duration").text = str(transition_time)
        ET.SubElement(transition, "from").text = previous
        ET.SubElement(transition, "to").text = img

        previous = img

    # Write out the final image
    image = ET.SubElement(root, "static")
    ET.SubElement(image,"duration").text = str(duration)
    ET.SubElement(image,"file").text = previous

    # Write out the final xml data to file
    tree = ET.ElementTree(root)
    tree.write(xml_file)

    # pretty print the data
    data = etree.parse(xml_file)
    formated_xml = etree.tostring(data, pretty_print = True)
    with open(xml_file,'w') as f:
        f.write(formated_xml.decode())

    gsettings_set('org.gnome.desktop.background',None,'picture-uri','file://' + xml_file)

if __name__ == '__main__':
    main()

¿Sabes cómo cortar programáticamente una imagen en n* npedazos, moviéndose a lo largo de los npíxeles xy npíxeles y en cada corte? Por ejemplo, el comando para el fondo de pantalla YI1 sería command 1920 1080 1 0y se repetirá en sí mismo.
Soren

@moo_we_all_do en realidad, esto se ha preguntado antes: askubuntu.com/a/143501/295286
Sergiy Kolodyazhnyy

así que para dar la vuelta, ¿tomaría los primeros 1920 píxeles y los copiaría en la parte posterior?
Soren

@moo_we_all_do, ¿qué quieres decir con bucle? Lo que debe hacer es dividir esa imagen en partes pares, ponerlas en la carpeta y simplemente indicar la ruta del script a esa carpeta. El fondo de pantalla xml pasará automáticamente y volverá a la primera imagen
Sergiy Kolodyazhnyy

Por bucle me refiero a desplazamiento, y lo descubrí, ¡gracias! : D
Soren
Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.