Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Tim-ats-d committed Oct 17, 2020
0 parents commit 07cf6eb
Show file tree
Hide file tree
Showing 147 changed files with 107 additions and 0 deletions.
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## A journey with Richard Stallman

A script to dynamically change your wallpaper with a travel photo by Richard Stallman.
All given time intervals (by default 15 minutes), a randomly selected photo is selected from [these](https://www.stallman.org/photos/rms-working/index.html).

To change the time between changes of each wallpaper, just change the value of `sleep_duration` in the [config.conf](https://github.com/Tim-ats-d/A-journey-with-rms/blob/master/config.conf) file.

## Requirements

* A plasma 5 desktop environment
* Python 3

## License

* GNU General Public Licenses

## Contact me

* Mail : tim.arnouts@protonmail.com
5 changes: 5 additions & 0 deletions config.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
; config.conf file

[parameters]
; Time between changes of each wallpaper in seconds.
sleep_duration=900
Binary file added img/IMG_4459.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/MVC-465F.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/MVC-661F.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/P1010981.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/PC130500.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/PC130502.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SAM_1109.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/SAM_1110.JPG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/baths-of-tarapaya.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/dsc00367.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/hacker-at-work-in-the-mine.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0355.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0356.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0395.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0554.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0555.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0608.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0609.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0629.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0630.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0631.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0632.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0775.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0776.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0792.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added img/img_0793.jpg
Binary file added img/img_0794.jpg
Binary file added img/img_0823.jpg
Binary file added img/img_0824.jpg
Binary file added img/img_0834.jpg
Binary file added img/img_0835.jpg
Binary file added img/img_0851.jpg
Binary file added img/img_0900.jpg
Binary file added img/img_0902.jpg
Binary file added img/img_0906.jpg
Binary file added img/img_1096.jpg
Binary file added img/img_1097.jpg
Binary file added img/img_1277.jpg
Binary file added img/img_1323.jpg
Binary file added img/img_1400.jpg
Binary file added img/img_1421.jpg
Binary file added img/img_1422.jpg
Binary file added img/img_1423.jpg
Binary file added img/img_1667.jpg
Binary file added img/img_1668.jpg
Binary file added img/img_1669.jpg
Binary file added img/img_1747.jpg
Binary file added img/img_1748.jpg
Binary file added img/img_1749.jpg
Binary file added img/img_1755.jpg
Binary file added img/img_1761.jpg
Binary file added img/img_1762.jpg
Binary file added img/img_1775.jpg
Binary file added img/img_1776.jpg
Binary file added img/img_1777.jpg
Binary file added img/img_2227.jpg
Binary file added img/img_2362.jpg
Binary file added img/img_2363.jpg
Binary file added img/img_2364.jpg
Binary file added img/img_2402.jpg
Binary file added img/img_2403.jpg
Binary file added img/img_2404.jpg
Binary file added img/img_2405.jpg
Binary file added img/img_2406.jpg
Binary file added img/img_2933-retouch.jpg
Binary file added img/img_3014.jpg
Binary file added img/img_3015.jpg
Binary file added img/img_3016.jpg
Binary file added img/img_3234.jpg
Binary file added img/img_3235.jpg
Binary file added img/img_3625.jpg
Binary file added img/img_3626.jpg
Binary file added img/img_3627.jpg
Binary file added img/img_3628.jpg
Binary file added img/img_3629.jpg
Binary file added img/img_3658.jpg
Binary file added img/img_3659.jpg
Binary file added img/img_3660.jpg
Binary file added img/img_3661.jpg
Binary file added img/img_3662.jpg
Binary file added img/img_3663.jpg
Binary file added img/img_4083.jpg
Binary file added img/img_4084.jpg
Binary file added img/img_4085.jpg
Binary file added img/img_4188.jpg
Binary file added img/img_4189.jpg
Binary file added img/img_4329.jpg
Binary file added img/img_4330.jpg
Binary file added img/img_4331.jpg
Binary file added img/img_4332.jpg
Binary file added img/img_4598.jpg
Binary file added img/img_4599.jpg
Binary file added img/img_4767.jpg
Binary file added img/img_4768.jpg
Binary file added img/img_4769.jpg
Binary file added img/img_4770.jpg
Binary file added img/img_4771.jpg
Binary file added img/img_4778.jpg
Binary file added img/img_4779.jpg
Binary file added img/img_4780.jpg
Binary file added img/img_4781.jpg
Binary file added img/img_4782.jpg
Binary file added img/img_5332.jpg
Binary file added img/img_5333.jpg
Binary file added img/img_5387.jpg
Binary file added img/img_6715.jpg
Binary file added img/img_6716.jpg
Binary file added img/img_7555.jpg
Binary file added img/img_7556.jpg
Binary file added img/img_7925.jpg
Binary file added img/img_7926.jpg
Binary file added img/img_9135.jpg
Binary file added img/img_9136.jpg
Binary file added img/img_9138.jpg
Binary file added img/p1000275.jpg
Binary file added img/p1000276.jpg
Binary file added img/p1000277.jpg
Binary file added img/p1000278.jpg
Binary file added img/p1000541.jpg
Binary file added img/p1000542.jpg
Binary file added img/p1000543.jpg
Binary file added img/p1000544.jpg
Binary file added img/p1000841.jpg
Binary file added img/p1000842.jpg
Binary file added img/p1000843.jpg
Binary file added img/p1000844.jpg
Binary file added img/p1010265.jpg
Binary file added img/p1010266.jpg
Binary file added img/p1010267.jpg
Binary file added img/p1010268.jpg
Binary file added img/p1010269.jpg
Binary file added img/p1010270.jpg
Binary file added img/p1010271.jpg
Binary file added img/p1010272.jpg
Binary file added img/p1010273.jpg
Binary file added img/p1010274.jpg
Binary file added img/p1280037.jpg
Binary file added img/p1280038.jpg
Binary file added img/p1280039.jpg
Binary file added img/p1280040.jpg
Binary file added img/picture-007-retouch.jpg
Binary file added img/picture-032-retouch.jpg
Binary file added img/pressconf-01-nov2002.jpg
Binary file added img/working-with-the-devil.jpg
83 changes: 83 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# main.py
#
# Copyright 2020 Timéo Arnouts <dogm@dogm-s-pc>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#

import configparser
import dbus
import os
import random
import time


stallman_images_path = os.path.join(os.getcwd(), "img")
list_stallman_images = os.listdir(stallman_images_path)

def settings_reader(parameter, configuration_file_path):
"""Returns the value of the parameter contained in "parameters" section of given .conf file. """
config_file = os.path.join(os.getcwd(), configuration_file_path)

settings = configparser.ConfigParser()
settings.read(config_file)

return settings["parameters"][parameter]


def image_selector(directory_path):
"""Returns the path of a new randomly selected wallpaper in the given directory path."""
return random.choice(list_stallman_images)


def path_formatter(path):
"""Returns the script formatted with the path of a given image """

return """var allDesktops = desktops();
print (allDesktops);
for (i=0;i<allDesktops.length;i++) {
d = allDesktops[i];
d.wallpaperPlugin = "org.kde.image";
d.currentConfigGroup = Array("Wallpaper", "org.kde.image", "General");
d.writeConfig("Image", "file:%s")
}
""" % path


def main():
"""Main function."""
# Time between changes of each wallpaper in seconds.
sleep_duration = int(settings_reader("sleep_duration", "config.conf"))

bus = dbus.SessionBus()
plasma_shell = dbus.Interface(
bus.get_object("org.kde.plasmashell", "/PlasmaShell"),
dbus_interface="org.kde.PlasmaShell"
)

while 1:
selected_wallpaper_path = os.path.join(stallman_images_path, image_selector(list_stallman_images))
print(selected_wallpaper_path)
plasma_shell.evaluateScript(path_formatter(selected_wallpaper_path))
time.sleep(sleep_duration)


if __name__ == "__main__":
main()

0 comments on commit 07cf6eb

Please sign in to comment.