commit bc989b60adebbc9c904b20ed3e48e236daa189d7 Author: Sergey-V Markov Date: Sat Nov 19 15:00:22 2022 +0300 initial commit diff --git a/.gear/rules b/.gear/rules new file mode 100644 index 0000000..3068f87 --- /dev/null +++ b/.gear/rules @@ -0,0 +1 @@ +tar: ./@name@ name=@name@-@version@ diff --git a/komorebi.spec b/komorebi.spec new file mode 100644 index 0000000..d3afebd --- /dev/null +++ b/komorebi.spec @@ -0,0 +1,133 @@ +%define system_apps /System/Applications +%define system_resources /System/Resources/Komorebi + +Name: komorebi +Version: 2.1 +Release: alt1 + +Url: http://www.luminal.org/phpwiki/index.php/IMMS +Source: %name-%version.tar + +Summary: Animated Wallpapers for Linux +License: GNU GENERAL PUBLIC LICENSE Version 3 +Group: System/Libraries + +BuildRequires(pre): rpm-macros-cmake +BuildRequires: cmake gcc-c++ libclutter-devel libclutter-gtk3-devel libclutter-gst3.0-devel libgee0.8-devel libwebkit2gtk-devel +Requires: libclutter libclutter-gtk3 libclutter-gst3.0 libgee0.8 libwebkit2gtk + +%description +Komorebi is an awesome animated wallpapers manager for all Linux platforms. It provides fully customizeable image, video, and web page wallpapers that can be tweaked at any time! + +%prep +%setup -n %name-%version + +%build +%cmake +%cmake_build + +%install +%cmake_install + +%files +%system_apps/komorebi +%system_apps/komorebi-wallpaper-creator +%_desktopdir/komorebi.desktop +%_desktopdir/wallpapercreator.desktop + +%system_resources/dark_forest/config +%system_resources/dark_forest/wallpaper.jpg +%system_resources/dark_forest/assets.png +%system_resources/icy_mountains/config +%system_resources/icy_mountains/wallpaper.jpg +%system_resources/abstract_light_lines/config +%system_resources/abstract_light_lines/wallpaper.jpg +%system_resources/abstract_light_lines/assets.png +%system_resources/parallax_sky/config +%system_resources/parallax_sky/wallpaper.jpg +%system_resources/parallax_sky/assets.png +%system_resources/sunny_sand/config +%system_resources/sunny_sand/wallpaper.jpg +%system_resources/sunny_sand/assets.png +%system_resources/graffiti/config +%system_resources/graffiti/wallpaper.jpg +%system_resources/graffiti/assets.png +%system_resources/grainy_day/config +%system_resources/grainy_day/wallpaper.jpg +%system_resources/sahara-day-and-night/config +%system_resources/sahara-day-and-night/wallpaper.jpg +%system_resources/sahara-day-and-night/assets.png +%system_resources/beach_space_view/config +%system_resources/beach_space_view/wallpaper.jpg +%system_resources/beach_space_view/assets.png +%system_resources/yosemite_cloudy/config +%system_resources/yosemite_cloudy/wallpaper.jpg +%system_resources/yosemite_cloudy/assets.png +%system_resources/aerial_mountain_and_ocean/video.mp4 +%system_resources/aerial_mountain_and_ocean/config +%system_resources/aerial_mountain_and_ocean/wallpaper.jpg +%system_resources/cloudy_forest/config +%system_resources/cloudy_forest/wallpaper.jpg +%system_resources/cloudy_forest/assets.png +%system_resources/on_a_mountain_hill/config +%system_resources/on_a_mountain_hill/wallpaper.jpg +%system_resources/underground_passageway/config +%system_resources/underground_passageway/wallpaper.jpg +%system_resources/city_lights/config +%system_resources/city_lights/wallpaper.jpg +%system_resources/city_lights/assets.png +%system_resources/saharan_adventure/config +%system_resources/saharan_adventure/wallpaper.jpg +%system_resources/unsplash/config +%system_resources/unsplash/wallpaper.jpg +%system_resources/foggy_sunny_mountain +%system_resources/foggy_sunny_mountain/config +%system_resources/foggy_sunny_mountain/wallpaper.jpg +%system_resources/foggy_sunny_mountain/assets.png +%system_resources/tree_reflection_video +%system_resources/tree_reflection_video/video.mp4 +%system_resources/tree_reflection_video/config +%system_resources/tree_reflection_video/wallpaper.jpg +%system_resources/deck_sea_fog +%system_resources/deck_sea_fog/config +%system_resources/deck_sea_fog/wallpaper.jpg +%system_resources/direction_to_time +%system_resources/direction_to_time/config +%system_resources/direction_to_time/wallpaper.jpg +%system_resources/aurora_video/video.mp4 +%system_resources/aurora_video/config +%system_resources/aurora_video/wallpaper.jpg +%system_resources/canyon_night_sky/config +%system_resources/canyon_night_sky/wallpaper.jpg +%system_resources/canyon_night_sky/assets.png +%system_resources/plane_window/config +%system_resources/plane_window/wallpaper.jpg +%system_resources/plane_window/assets.png +%system_resources/day_night_mountain/config +%system_resources/day_night_mountain/wallpaper.jpg +%system_resources/day_night_mountain/assets.png +%system_resources/mountain_lake_at_night/config +%system_resources/mountain_lake_at_night/wallpaper.jpg +%system_resources/parallax_cartoon_mountain/config +%system_resources/parallax_cartoon_mountain/wallpaper.jpg +%system_resources/parallax_cartoon_mountain/assets.png +%system_resources/close_btn.svg +%system_resources/done.svg +%system_resources/wallpaper_creator.svg +%system_resources/thumbnail_border.svg +%system_resources/blank.svg +%system_resources/blank_backup.svg +%system_resources/info.svg +%system_resources/add_bubble_item.svg +%system_resources/thumbnail_add.svg +%system_resources/komorebi.svg +%_datadir/fonts/Lato-Hairline.ttf +%_datadir/fonts/VT323-Regular.ttf +%_datadir/fonts/BubblerOne-Regular.ttf +%_datadir/fonts/Lato-Light.ttf +%_datadir/fonts/AmaticSC-Regular.ttf +%_datadir/fonts/Bangers-Regular.ttf + +%changelog +* Sat Nov 19 2022 Sergey-V Markow 2.1-alt1 +- 2.1 diff --git a/komorebi/.gitignore b/komorebi/.gitignore new file mode 100644 index 0000000..378eac2 --- /dev/null +++ b/komorebi/.gitignore @@ -0,0 +1 @@ +build diff --git a/komorebi/.travis.yml b/komorebi/.travis.yml new file mode 100644 index 0000000..5997a53 --- /dev/null +++ b/komorebi/.travis.yml @@ -0,0 +1,17 @@ +language: c +compiler: gcc +sudo: required +dist: xenial +cache: + - apt +before_install: + - sudo add-apt-repository ppa:gnome3-team/gnome3 -y + - sudo add-apt-repository ppa:vala-team -y + - sudo add-apt-repository ppa:gnome3-team/gnome3-staging -y + - sudo apt update + - sudo apt install -y cmake valac libgtk-3-dev libgee-0.8-dev libclutter-gtk-1.0-dev libclutter-1.0-dev libclutter-gst-3.0-dev libwebkit2gtk-4.0-dev +script: + - mkdir build + - cd build + - cmake .. + - sudo make install diff --git a/komorebi/CMakeLists.txt b/komorebi/CMakeLists.txt new file mode 100644 index 0000000..9e37d63 --- /dev/null +++ b/komorebi/CMakeLists.txt @@ -0,0 +1,123 @@ +project (komorebi) +cmake_minimum_required (VERSION 2.8) +list (APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) + +set (DATADIR "${CMAKE_INSTALL_PREFIX}/share") +set (PKGDATADIR "${DATADIR}/komorebi") +set (RELEASE_NAME "summit") +set (VERSION "2.1") +set (VERSION_INFO "Release") +set (ARCHIVE_NAME komorebi-${VERSION}) + + +find_package(PkgConfig) +pkg_check_modules(DEPS REQUIRED gtk+-3.0 glib-2.0>=2.38 gee-0.8 webkit2gtk-4.0 clutter-gtk-1.0 clutter-1.0 clutter-gst-3.0) +add_definitions(${DEPS_CFLAGS}) + +link_directories(${DEPS_LIBRARY_DIRS}) +find_package(Vala REQUIRED) +include(ValaVersion) +include(ValaPrecompile) + + +find_package(Vala REQUIRED) + + +ensure_vala_version("0.16" MINIMUM) +vala_precompile(VALA_C + src/Main.vala + + src/OnScreen/BackgroundWindow.vala + src/OnScreen/DateTimeBox.vala + src/OnScreen/DesktopIcons.vala + src/OnScreen/ResponsiveGrid.vala + src/OnScreen/Icon.vala + src/OnScreen/InfoWindow.vala + src/OnScreen/RowLabel.vala + src/OnScreen/WallpapersSelector.vala + src/OnScreen/Thumbnail.vala + src/OnScreen/BubbleMenu.vala + src/OnScreen/BubbleMenuItem.vala + src/OnScreen/AssetActor.vala + src/OnScreen/PreferencesWindow.vala + + src/Utilities.vala + + +PACKAGES + gtk+-3.0 + gee-0.8 + clutter-gtk-1.0 + clutter-gst-3.0 + webkit2gtk-4.0 +OPTIONS + --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi/ + --disable-warnings + +) +vala_precompile(WALLPAPER_CREATOR + extra/wallpaper-creator/Main.vala + + extra/wallpaper-creator/OnScreen/NewWallpaperWindow.vala + extra/wallpaper-creator/OnScreen/InitialPage.vala + extra/wallpaper-creator/OnScreen/OptionsPage.vala + extra/wallpaper-creator/OnScreen/FinalPage.vala + + +PACKAGES + gee-0.8 + gtk+-3.0 + gstreamer-1.0 + webkit2gtk-4.0 +OPTIONS + --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi/ + --disable-warnings + +) + +add_definitions(${CFLAGS} -Wall -Winit-self -Wwrite-strings -Wunreachable-code -Wstrict-prototypes) +add_executable(komorebi ${VALA_C}) +add_executable(komorebi-wallpaper-creator ${WALLPAPER_CREATOR}) +target_link_libraries(komorebi ${DEPS_LIBRARIES} -lm) +target_link_libraries(komorebi-wallpaper-creator ${DEPS_LIBRARIES} -lm) + +install(TARGETS komorebi RUNTIME DESTINATION /System/Applications/) +install(TARGETS komorebi-wallpaper-creator RUNTIME DESTINATION /System/Applications/) + + +######### Wallpapers ############ +install(DIRECTORY data/Wallpapers/ DESTINATION /System/Resources/Komorebi) + + +######### Fonts ############ +install(DIRECTORY data/Fonts/ DESTINATION /usr/share/fonts) + +######### Icons ############ +install(DIRECTORY data/Icons/ DESTINATION /System/Resources/Komorebi) + +######### Other ############ +install(FILES data/Other/komorebi.desktop DESTINATION /usr/share/applications/) +install(FILES data/Other/wallpapercreator.desktop DESTINATION /usr/share/applications/) + +######### Run the upgrade script ######### +install(CODE "execute_process(COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/data/Other/postinst.sh)") + +# Packaging configuration +set(CPACK_GENERATOR "DEB") +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Komorebi - An awesome desktop manager for Linux") +set(CPACK_PACKAGE_VENDOR "") +set(CPACK_PACKAGE_CONTACT "Abraham Masri @cheesecakeufo") +set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_CURRENT_SOURCE_DIR}/README.md") +set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE") +set(CPACK_PACKAGE_ICON screenshots/komorebi-icon.png) +set(CPACK_PACKAGE_VERSION_MAJOR 2) +set(CPACK_PACKAGE_VERSION_MINOR 1) +set(CPACK_PACKAGE_VERSION_PATCH 0) +set(CPACK_PACKAGE_INSTALL_DIRECTORY "Komorebi") +set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/data/Other/postinst;${CMAKE_CURRENT_SOURCE_DIR}/data/Other/postrm;") + +set(CPACK_DEBIAN_PACKAGE_DEPENDS "libgtk-3-0 (>= 3.14), libglib2.0-0 (>= 2.38), libgee-0.8-2, libclutter-gtk-1.0-0, libclutter-1.0-0, libclutter-gst-3.0-0, libwebkit2gtk-4.0-37") +set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") +set(CPACK_DEBIAN_PACKAGE_SECTION "system") + +include(CPack) diff --git a/komorebi/LICENSE b/komorebi/LICENSE new file mode 100644 index 0000000..9cecc1d --- /dev/null +++ b/komorebi/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + {one line to give the program's name and a brief idea of what it does.} + Copyright (C) {year} {name of author} + + 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 3 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, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + {project} Copyright (C) {year} {fullname} + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/komorebi/README.md b/komorebi/README.md new file mode 100644 index 0000000..40718d5 --- /dev/null +++ b/komorebi/README.md @@ -0,0 +1,111 @@ +

+

Komorebi - Animated Wallpapers for Linux

+

(n) sunlight filtering through trees.

+ + + +

+ Platform (GNU/Linux) + Awesome + Build Status +

+ +

+
Watch demo
+

+ +## What is Komorebi? + +Komorebi is an awesome animated wallpapers manager for all Linux platforms. +It provides fully customizeable image, video, and web page wallpapers that can be tweaked at any time! + +![s1](https://raw.githubusercontent.com/iabem97/komorebi/master/screenshots/collage.jpg) + + +## How do I install Komorebi? + +Two ways: + +### Packaged install (easy) + +1. Download `Komorebi` from the [Komorebi releases page](https://github.com/iabem97/komorebi/releases). +2. Install Komorebi using your favorite package installer (aka. double click on it) +3. Launch Komorebi! + +### Manual Installing (advanced) + +Run the following: +``` +sudo add-apt-repository ppa:gnome3-team/gnome3 -y +sudo add-apt-repository ppa:vala-team -y +sudo add-apt-repository ppa:gnome3-team/gnome3-staging -y +sudo apt install cmake valac libgtk-3-dev libgee-0.8-dev libclutter-gtk-1.0-dev libclutter-1.0-dev libwebkit2gtk-4.0-dev libclutter-gst-3.0-dev +git clone https://github.com/iabem97/komorebi.git +cd komorebi +mkdir build && cd build +cmake .. && sudo make install && ./komorebi +``` + +## Change Wallpaper & Desktop Preferences +To change desktop preferences or your wallpaper, right click anywhere on the desktop to show the menu. + +![s1](https://raw.githubusercontent.com/iabem97/komorebi/master/screenshots/preferences.jpg) + +## How do I create my own wallpaper? + +Komorebi provides a simple tool to create your own wallpapers! Simply, open your apps and search for 'Wallpaper Creator' + +![s1](https://raw.githubusercontent.com/iabem97/komorebi/master/screenshots/wallpaper_creator.jpg) + +You can use either an image, a video, or a web page as a wallpaper and you have many different options to customize your very own wallpaper! + +## Uninstall + +### If you installed a packaged version of Komorebi + +1. Open Terminal +2. `sudo apt remove komorebi` + +### If you manually installed Komorebi + +1. Open Terminal +2. `cd komorebi/build` +3. `sudo make uninstall` + +## Questions? Issues? + +### Komorebi is slow. What can I do about it? + +Komorebi includes support for video wallpapers that might slow your computer down. You can disable support for video wallpapers in 'Desktop Preferences' → uncheck 'Enable Video Wallpapers'. + +_note: you need to quit and re-open Komorebi after changing this option_ + + +### After uninstalling, my desktop isn't working right (blank or no icons) + +The latest Komorebi should already have a fix for this issue. If you've already uninstalled Komorebi and would like to fix the issue, simply run this (in the Terminal): +`curl -s https://raw.githubusercontent.com/iabem97/komorebi/master/data/Other/postrm | bash -s` + +If your issue has not already been reported, please report it *[`here`](https://github.com/iabem97/komorebi/issues/new)* and I'll try my best to fix them. + +### Why does Komorebi install files in a macOS-like structure? + +Komorebi was originally intended to run on an unreleased OS project. Since many people already use Komorebi, an update could potentially break Komorebi and custom-made wallpapers. + +It is possible to change the file structure with code changes and a `postinst` script but I'd rather keep it as is for now or if you have the time to make one, feel free to do so and submit a PR! + + +## Status of Development + +Komorebi still receives updates but they are not as frequent due to my involvement in other open-source projects. + + +## Credits: + +Komorebi is made by Abraham Masri ([@cheesecakeufo](https://twitter.com/cheesecakeufo)) + +### Thanks To: + +Pete Lewis ([@PJayB](https://github.com/PJayB)) for adding mult-monitor support diff --git a/komorebi/_config.yml b/komorebi/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/komorebi/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/komorebi/cmake/FindVala.cmake b/komorebi/cmake/FindVala.cmake new file mode 100644 index 0000000..aa3a6e7 --- /dev/null +++ b/komorebi/cmake/FindVala.cmake @@ -0,0 +1,65 @@ +## +# Copyright 2009-2010 Jakob Westhoff. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# The views and conclusions contained in the software and documentation are those +# of the authors and should not be interpreted as representing official policies, +# either expressed or implied, of Jakob Westhoff +## + +## +# Find module for the Vala compiler (valac) +# +# This module determines wheter a Vala compiler is installed on the current +# system and where its executable is. +# +# Call the module using "find_package(Vala) from within your CMakeLists.txt. +# +# The following variables will be set after an invocation: +# +# VALA_FOUND Whether the vala compiler has been found or not +# VALA_EXECUTABLE Full path to the valac executable if it has been found +# VALA_VERSION Version number of the available valac +## + + +# Search for the valac executable in the usual system paths. +find_program(VALA_EXECUTABLE + NAMES valac) + +# Handle the QUIETLY and REQUIRED arguments, which may be given to the find call. +# Furthermore set VALA_FOUND to TRUE if Vala has been found (aka. +# VALA_EXECUTABLE is set) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Vala DEFAULT_MSG VALA_EXECUTABLE) + +mark_as_advanced(VALA_EXECUTABLE) + +# Determine the valac version +if(VALA_FOUND) + execute_process(COMMAND ${VALA_EXECUTABLE} "--version" + OUTPUT_VARIABLE "VALA_VERSION") + string(REPLACE "Vala" "" "VALA_VERSION" ${VALA_VERSION}) + string(STRIP ${VALA_VERSION} "VALA_VERSION") +endif(VALA_FOUND) diff --git a/komorebi/cmake/GObjectIntrospectionMacros.cmake b/komorebi/cmake/GObjectIntrospectionMacros.cmake new file mode 100644 index 0000000..31185b0 --- /dev/null +++ b/komorebi/cmake/GObjectIntrospectionMacros.cmake @@ -0,0 +1,96 @@ +# Copyright (C) 2010, Pino Toscano, +# +# Redistribution and use is allowed according to the terms of the BSD license. +# For details see the accompanying COPYING-CMAKE-SCRIPTS file. + +macro(_gir_list_prefix _outvar _listvar _prefix) +set(${_outvar}) +foreach(_item IN LISTS ${_listvar}) +list(APPEND ${_outvar} ${_prefix}${_item}) +endforeach() +endmacro(_gir_list_prefix) + +macro(gir_add_introspections introspections_girs) + +set(_gir_girs) +set(_gir_typelibs) + +foreach(gir IN LISTS ${introspections_girs}) + +set(_gir_name "${gir}") + +## Transform the gir filename to something which can reference through a variable +## without automake/make complaining, eg Gtk-2.0.gir -> Gtk_2_0_gir +string(REPLACE "-" "_" _gir_name "${_gir_name}") +string(REPLACE "." "_" _gir_name "${_gir_name}") + +# Namespace and Version is either fetched from the gir filename +# or the _NAMESPACE/_VERSION variable combo +set(_gir_namespace "${${_gir_name}_NAMESPACE}") +if (_gir_namespace STREQUAL "") +string(REGEX REPLACE "([^-]+)-.*" "\\1" _gir_namespace "${gir}") +endif () +set(_gir_version "${${_gir_name}_VERSION}") +if (_gir_version STREQUAL "") +string(REGEX REPLACE ".*-([^-]+).gir" "\\1" _gir_version "${gir}") +endif () + +# _PROGRAM is an optional variable which needs it's own --program argument +set(_gir_program "${${_gir_name}_PROGRAM}") +if (NOT _gir_program STREQUAL "") +set(_gir_program "--program=${_gir_program}") +endif () + +# Variables which provides a list of things +_gir_list_prefix(_gir_libraries ${_gir_name}_LIBS "--library=") +_gir_list_prefix(_gir_packages ${_gir_name}_PACKAGES "--pkg=") +_gir_list_prefix(_gir_includes ${_gir_name}_INCLUDES "--include=") +_gir_list_prefix(_gir_export_packages ${_gir_name}_EXPORT_PACKAGES "--pkg-export=") + +# Reuse the LIBTOOL variable from by automake if it's set +set(_gir_libtool "--no-libtool") + +add_custom_command( +COMMAND ${INTROSPECTION_SCANNER} +${INTROSPECTION_SCANNER_ARGS} +--namespace=${_gir_namespace} +--nsversion=${_gir_version} +${_gir_libtool} +${_gir_program} +${_gir_libraries} +${_gir_packages} +${_gir_includes} +${_gir_export_packages} +${${_gir_name}_SCANNERFLAGS} +${${_gir_name}_CFLAGS} +${${_gir_name}_FILES} +--output ${CMAKE_CURRENT_BINARY_DIR}/${gir} +DEPENDS ${${_gir_name}_FILES} +${${_gir_name}_LIBS} +OUTPUT ${gir} +WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} +VERBATIM +) +list(APPEND _gir_girs ${CMAKE_CURRENT_BINARY_DIR}/${gir}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${gir} DESTINATION share/gir-1.0) + +string(REPLACE ".gir" ".typelib" _typelib "${gir}") +add_custom_command( +COMMAND ${INTROSPECTION_COMPILER} +${INTROSPECTION_COMPILER_ARGS} +--includedir=. +${CMAKE_CURRENT_BINARY_DIR}/${gir} +-o ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} +DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${gir} +OUTPUT ${_typelib} +WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +) +list(APPEND _gir_typelibs ${CMAKE_CURRENT_BINARY_DIR}/${_typelib}) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${_typelib} DESTINATION lib${LIB_SUFFIX}/girepository-1.0) + +endforeach() + +add_custom_target(gir-girs ALL DEPENDS ${_gir_girs}) +add_custom_target(gir-typelibs ALL DEPENDS ${_gir_typelibs}) + +endmacro(gir_add_introspections) diff --git a/komorebi/cmake/GSettings.cmake b/komorebi/cmake/GSettings.cmake new file mode 100644 index 0000000..18f1a9a --- /dev/null +++ b/komorebi/cmake/GSettings.cmake @@ -0,0 +1,32 @@ + +option (GSETTINGS_COMPILE "Compile GSettings Schemas after installation" ON) + +if(GSETTINGS_COMPILE) + message(STATUS "GSettings shemas will be compiled.") +endif() + +macro(add_schema SCHEMA_NAME) + + set(PKG_CONFIG_EXECUTABLE pkg-config) + # Have an option to not install the schema into where GLib is + execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} glib-2.0 --variable prefix OUTPUT_VARIABLE _glib_prefix OUTPUT_STRIP_TRAILING_WHITESPACE) + SET (GSETTINGS_DIR "${_glib_prefix}/share/glib-2.0/schemas/") + + # Run the validator and error if it fails + execute_process (COMMAND ${PKG_CONFIG_EXECUTABLE} gio-2.0 --variable glib_compile_schemas OUTPUT_VARIABLE _glib_comple_schemas OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process (COMMAND ${_glib_comple_schemas} --dry-run --schema-file=${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} ERROR_VARIABLE _schemas_invalid OUTPUT_STRIP_TRAILING_WHITESPACE) + + if (_schemas_invalid) + message (SEND_ERROR "Schema validation error: ${_schemas_invalid}") + endif (_schemas_invalid) + + # Actually install and recomple schemas + message (STATUS "Found ${SCHEMA_NAME}") + message (STATUS "I'll compile and install it to ${GSETTINGS_DIR}") + install (FILES ${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME} DESTINATION ${GSETTINGS_DIR} OPTIONAL) + + if (GSETTINGS_COMPILE) + install (CODE "message (STATUS \"running glib-compile-schemas for ${SCHEMA_NAME}\")") + install (CODE "execute_process (COMMAND ${_glib_comple_schemas} ${GSETTINGS_DIR})") + endif () +endmacro() diff --git a/komorebi/cmake/ParseArguments.cmake b/komorebi/cmake/ParseArguments.cmake new file mode 100644 index 0000000..717c0f5 --- /dev/null +++ b/komorebi/cmake/ParseArguments.cmake @@ -0,0 +1,36 @@ +## +# This is a helper Macro to parse optional arguments in Macros/Functions +# It has been taken from the public CMake wiki. +# See http://www.cmake.org/Wiki/CMakeMacroParseArguments for documentation and +# licensing. +## +macro(parse_arguments prefix arg_names option_names) + set(DEFAULT_ARGS) + foreach(arg_name ${arg_names}) + set(${prefix}_${arg_name}) + endforeach(arg_name) + foreach(option ${option_names}) + set(${prefix}_${option} FALSE) + endforeach(option) + + set(current_arg_name DEFAULT_ARGS) + set(current_arg_list) + foreach(arg ${ARGN}) + set(larg_names ${arg_names}) + list(FIND larg_names "${arg}" is_arg_name) + if(is_arg_name GREATER -1) + set(${prefix}_${current_arg_name} ${current_arg_list}) + set(current_arg_name ${arg}) + set(current_arg_list) + else(is_arg_name GREATER -1) + set(loption_names ${option_names}) + list(FIND loption_names "${arg}" is_option) + if(is_option GREATER -1) + set(${prefix}_${arg} TRUE) + else(is_option GREATER -1) + set(current_arg_list ${current_arg_list} ${arg}) + endif(is_option GREATER -1) + endif(is_arg_name GREATER -1) + endforeach(arg) + set(${prefix}_${current_arg_name} ${current_arg_list}) +endmacro(parse_arguments) diff --git a/komorebi/cmake/README.Vala.rst b/komorebi/cmake/README.Vala.rst new file mode 100644 index 0000000..bcc59b7 --- /dev/null +++ b/komorebi/cmake/README.Vala.rst @@ -0,0 +1,173 @@ +========== +Vala CMake +========== +:Author: + Jakob Westhoff +:Version: + Draft + + +Overview +======== + +Vala CMake is a collection of macros for the CMake_ build system to allow the +creation and management of projects developed using the Vala_ programming +language or its "Genie" flavor (less tested). + + +Installation +============ + +To use the Vala macros in your own project you need to copy the macro files to +an arbitrary folder in your projects directory and reference them in your +``CMakeLists.txt`` file. + +Assuming the macros are stored under ``cmake/vala`` in your projects folder you +need to add the following information to your base ``CMakeLists.txt``:: + + list(APPEND CMAKE_MODULE_PATH + ${CMAKE_SOURCE_DIR}/cmake/vala + ) + +After the new module path as been added you can simply include the provided +modules or use the provided find routines. + + +Finding Vala +============ + +The find module for vala works like any other Find module in CMake. +You can use it by simply calling the usual ``find_package`` function. Default +parameters like ``REQUIRED`` and ``QUIETLY`` are supported. + +:: + + find_package(Vala REQUIRED) + +After a successful call to the find_package function the following variables +will be set: + +VALA_FOUND + Whether the vala compiler has been found or not + +VALA_EXECUTABLE + Full path to the valac executable if it has been found + +VALA_VERSION + Version number of the available valac + + +Precompiling Vala sources +========================= + +CMake is mainly supposed to handle c or c++ based projects. Luckily every vala +program is translated into plain c code using the vala compiler, followed by +normal compilation of the generated c program using gcc. + +The macro ``vala_precompile`` uses that fact to create c files from your .vala +sources for further CMake processing. + +The first parameter provided is a variable, which will be filled with a list of +c files outputted by the vala compiler. This list can than be used in +conjunction with functions like ``add_executable`` or others to create the +necessary compile rules with CMake. + +The initial variable is followed by a list of .vala files to be compiled. +Please take care to add every vala file belonging to the currently compiled +project or library as Vala will otherwise not be able to resolve all +dependencies. + +The following sections may be specified afterwards to provide certain options +to the vala compiler: + +PACKAGES + A list of vala packages/libraries to be used during the compile cycle. The + package names are exactly the same, as they would be passed to the valac + "--pkg=" option. + +OPTIONS + A list of optional options to be passed to the valac executable. This can be + used to pass "--thread" for example to enable multi-threading support. + +DIRECTORY + Specify the directory where the output source files will be stored. If + ommitted, the source files will be stored in CMAKE_CURRENT_BINARY_DIR. + +CUSTOM_VAPIS + A list of custom vapi files to be included for compilation. This can be + useful to include freshly created vala libraries without having to install + them in the system. + +GENERATE_VAPI + Pass all the needed flags to the compiler to create an internal vapi for + the compiled library. The provided name will be used for this and a + .vapi file will be created. + +GENERATE_HEADER + Let the compiler generate a header file for the compiled code. There will + be a header file as well as an internal header file being generated called + .h and _internal.h + +The following call is a simple example to the vala_precompile macro showing an +example to every of the optional sections:: + + vala_precompile(VALA_C + source1.vala + source2.vala + source3.vala + PACKAGES + gtk+-2.0 + gio-1.0 + posix + OPTIONS + --thread + CUSTOM_VAPIS + some_vapi.vapi + GENERATE_VAPI + myvapi + GENERATE_HEADER + myheader + ) + +Most important is the variable VALA_C which will contain all the generated c +file names after the call. The easiest way to use this information is to tell +CMake to create an executable out of it. + +:: + + add_executable(myexecutable ${VALA_C}) + + +Further reading +=============== + +The `Pdf Presenter Console`__ , which is a vala based project of mine, makes +heavy usage of the here described macros. To look at a real world example of +these macros the mentioned project is the right place to take a look. The svn +trunk of it can be found at:: + + svn://pureenergy.cc/pdf_presenter_console/trunk + + +__ http://westhoffswelt.de/projects/pdf_presenter_console.html + + +Acknowledgments +=============== + +Thanks go out to Florian Sowade, a fellow local PHP-Usergroupie, who helped me +a lot with the initial version of this macros and always answered my mostly +dumb CMake questions. + +.. _CMake: http://cmake.org +.. _Vala: http://live.gnome.org/Vala +.. _Genie: http://live.gnome.org/Genie + + + +.. + Local Variables: + mode: rst + fill-column: 79 + End: + vim: et syn=rst tw=79 diff --git a/komorebi/cmake/Translations.cmake b/komorebi/cmake/Translations.cmake new file mode 100644 index 0000000..be53b74 --- /dev/null +++ b/komorebi/cmake/Translations.cmake @@ -0,0 +1,41 @@ +# Translations.cmake, CMake macros written for Marlin, feel free to re-use them + +macro(add_translations_directory NLS_PACKAGE) + add_custom_target (i18n ALL COMMENT “Building i18n messages.”) + find_program (MSGFMT_EXECUTABLE msgfmt) + file (GLOB PO_FILES ${CMAKE_CURRENT_SOURCE_DIR}/*.po) + foreach (PO_INPUT ${PO_FILES}) + get_filename_component (PO_INPUT_BASE ${PO_INPUT} NAME_WE) + set (MO_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${PO_INPUT_BASE}.mo) + add_custom_command (TARGET i18n COMMAND ${MSGFMT_EXECUTABLE} -o ${MO_OUTPUT} ${PO_INPUT}) + + install (FILES ${MO_OUTPUT} DESTINATION + share/locale/${PO_INPUT_BASE}/LC_MESSAGES + RENAME ${NLS_PACKAGE}.mo) + endforeach (PO_INPUT ${PO_FILES}) +endmacro(add_translations_directory) + + +macro(add_translations_catalog NLS_PACKAGE) + add_custom_target (pot COMMENT “Building translation catalog.”) + find_program (XGETTEXT_EXECUTABLE xgettext) + + + set(C_SOURCE "") + + foreach(FILES_INPUT ${ARGN}) + file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.c) + foreach(C_FILE ${SOURCE_FILES}) + set(C_SOURCE ${C_SOURCE} ${C_FILE}) + endforeach() + file (GLOB SOURCE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${FILES_INPUT}/*.vala) + foreach(C_FILE ${SOURCE_FILES}) + set(C_SOURCE ${C_SOURCE} ${C_FILE}) + endforeach() + endforeach() + + add_custom_command (TARGET pot COMMAND + ${XGETTEXT_EXECUTABLE} -d ${NLS_PACKAGE} -o ${CMAKE_CURRENT_SOURCE_DIR}/${NLS_PACKAGE}.pot + ${VALA_SOURCE} ${C_SOURCE} --keyword="_" --from-code=UTF-8 + ) +endmacro() diff --git a/komorebi/cmake/ValaPrecompile.cmake b/komorebi/cmake/ValaPrecompile.cmake new file mode 100644 index 0000000..2f07668 --- /dev/null +++ b/komorebi/cmake/ValaPrecompile.cmake @@ -0,0 +1,187 @@ +## +# Copyright 2009-2010 Jakob Westhoff. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# The views and conclusions contained in the software and documentation are those +# of the authors and should not be interpreted as representing official policies, +# either expressed or implied, of Jakob Westhoff +## + +include(ParseArguments) +find_package(Vala REQUIRED) + +## +# Compile vala files to their c equivalents for further processing. +# +# The "vala_precompile" macro takes care of calling the valac executable on the +# given source to produce c files which can then be processed further using +# default cmake functions. +# +# The first parameter provided is a variable, which will be filled with a list +# of c files outputted by the vala compiler. This list can than be used in +# conjuction with functions like "add_executable" or others to create the +# neccessary compile rules with CMake. +# +# The initial variable is followed by a list of .vala files to be compiled. +# Please take care to add every vala file belonging to the currently compiled +# project or library as Vala will otherwise not be able to resolve all +# dependencies. +# +# The following sections may be specified afterwards to provide certain options +# to the vala compiler: +# +# PACKAGES +# A list of vala packages/libraries to be used during the compile cycle. The +# package names are exactly the same, as they would be passed to the valac +# "--pkg=" option. +# +# OPTIONS +# A list of optional options to be passed to the valac executable. This can be +# used to pass "--thread" for example to enable multi-threading support. +# +# CUSTOM_VAPIS +# A list of custom vapi files to be included for compilation. This can be +# useful to include freshly created vala libraries without having to install +# them in the system. +# +# GENERATE_VAPI +# Pass all the needed flags to the compiler to create an internal vapi for +# the compiled library. The provided name will be used for this and a +# .vapi file will be created. +# +# GENERATE_HEADER +# Let the compiler generate a header file for the compiled code. There will +# be a header file as well as an internal header file being generated called +# .h and _internal.h +# +# The following call is a simple example to the vala_precompile macro showing +# an example to every of the optional sections: +# +# vala_precompile(VALA_C +# source1.vala +# source2.vala +# source3.vala +# PACKAGES +# gtk+-2.0 +# gio-1.0 +# posix +# DIRECTORY +# gen +# OPTIONS +# --thread +# CUSTOM_VAPIS +# some_vapi.vapi +# GENERATE_VAPI +# myvapi +# GENERATE_HEADER +# myheader +# ) +# +# Most important is the variable VALA_C which will contain all the generated c +# file names after the call. +## + +macro(vala_precompile output) + parse_arguments(ARGS "PACKAGES;OPTIONS;DIRECTORY;GENERATE_HEADER;GENERATE_VAPI;CUSTOM_VAPIS" "" ${ARGN}) + if(ARGS_DIRECTORY) + set(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${ARGS_DIRECTORY}) + else(ARGS_DIRECTORY) + set(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) + endif(ARGS_DIRECTORY) + include_directories(${DIRECTORY}) + set(vala_pkg_opts "") + foreach(pkg ${ARGS_PACKAGES}) + list(APPEND vala_pkg_opts "--pkg=${pkg}") + endforeach(pkg ${ARGS_PACKAGES}) + set(in_files "") + set(out_files "") + set(${output} "") + foreach(src ${ARGS_DEFAULT_ARGS}) + string(REPLACE ${CMAKE_CURRENT_SOURCE_DIR}/ "" src ${src}) + string(REGEX MATCH "^/" IS_MATCHED ${src}) + if(${IS_MATCHED} MATCHES "/") + list(APPEND in_files "${src}") + else() + list(APPEND in_files "${CMAKE_CURRENT_SOURCE_DIR}/${src}") + endif() + string(REPLACE ".vala" ".c" src ${src}) + string(REPLACE ".gs" ".c" src ${src}) + if(${IS_MATCHED} MATCHES "/") + get_filename_component(VALA_FILE_NAME ${src} NAME) + set(out_file "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}") + list(APPEND out_files "${CMAKE_CURRENT_BINARY_DIR}/${VALA_FILE_NAME}") + else() + set(out_file "${DIRECTORY}/${src}") + list(APPEND out_files "${DIRECTORY}/${src}") + endif() + list(APPEND ${output} ${out_file}) + endforeach(src ${ARGS_DEFAULT_ARGS}) + + set(custom_vapi_arguments "") + if(ARGS_CUSTOM_VAPIS) + foreach(vapi ${ARGS_CUSTOM_VAPIS}) + if(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR}) + list(APPEND custom_vapi_arguments ${vapi}) + else (${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR}) + list(APPEND custom_vapi_arguments ${CMAKE_CURRENT_SOURCE_DIR}/${vapi}) + endif(${vapi} MATCHES ${CMAKE_SOURCE_DIR} OR ${vapi} MATCHES ${CMAKE_BINARY_DIR}) + endforeach(vapi ${ARGS_CUSTOM_VAPIS}) + endif(ARGS_CUSTOM_VAPIS) + + set(vapi_arguments "") + if(ARGS_GENERATE_VAPI) + list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_VAPI}.vapi") + set(vapi_arguments "--internal-vapi=${ARGS_GENERATE_VAPI}.vapi") + + # Header and internal header is needed to generate internal vapi + if (NOT ARGS_GENERATE_HEADER) + set(ARGS_GENERATE_HEADER ${ARGS_GENERATE_VAPI}) + endif(NOT ARGS_GENERATE_HEADER) + endif(ARGS_GENERATE_VAPI) + + set(header_arguments "") + if(ARGS_GENERATE_HEADER) + list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}.h") + list(APPEND out_files "${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h") + list(APPEND header_arguments "--header=${DIRECTORY}/${ARGS_GENERATE_HEADER}.h") + list(APPEND header_arguments "--internal-header=${DIRECTORY}/${ARGS_GENERATE_HEADER}_internal.h") + endif(ARGS_GENERATE_HEADER) + + add_custom_command(OUTPUT ${out_files} + COMMAND + ${VALA_EXECUTABLE} + ARGS + "-C" + ${header_arguments} + ${vapi_arguments} + "-b" ${CMAKE_CURRENT_SOURCE_DIR} + "-d" ${DIRECTORY} + ${vala_pkg_opts} + ${ARGS_OPTIONS} + ${in_files} + ${custom_vapi_arguments} + DEPENDS + ${in_files} + ${ARGS_CUSTOM_VAPIS} + ) +endmacro(vala_precompile) diff --git a/komorebi/cmake/ValaVersion.cmake b/komorebi/cmake/ValaVersion.cmake new file mode 100644 index 0000000..3fff193 --- /dev/null +++ b/komorebi/cmake/ValaVersion.cmake @@ -0,0 +1,96 @@ +## +# Copyright 2009-2010 Jakob Westhoff. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# 1. Redistributions of source code must retain the above copyright notice, +# this list of conditions and the following disclaimer. +# +# 2. Redistributions in binary form must reproduce the above copyright notice, +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY JAKOB WESTHOFF ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL JAKOB WESTHOFF OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE +# OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# The views and conclusions contained in the software and documentation are those +# of the authors and should not be interpreted as representing official policies, +# either expressed or implied, of Jakob Westhoff +## + +include(ParseArguments) +find_package(Vala REQUIRED) + +## +# Ensure a certain valac version is available +# +# The initial argument is the version to check for +# +# It may be followed by a optional parameter to specifiy a version range. The +# following options are valid: +# +# EXACT +# Vala needs to be available in the exact version given +# +# MINIMUM +# The provided version is the minimum version. Therefore Vala needs to be +# available in the given version or any higher version +# +# MAXIMUM +# The provided version is the maximum. Therefore Vala needs to be available +# in the given version or any version older than this +# +# If no option is specified the version will be treated as a minimal version. +## +macro(ensure_vala_version version) + parse_arguments(ARGS "" "MINIMUM;MAXIMUM;EXACT" ${ARGN}) + set(compare_message "") + set(error_message "") + if(ARGS_MINIMUM) + set(compare_message "a minimum ") + set(error_message "or greater ") + elseif(ARGS_MAXIMUM) + set(compare_message "a maximum ") + set(error_message "or less ") + endif(ARGS_MINIMUM) + + message(STATUS + "checking for ${compare_message}Vala version of ${version}" + ) + + unset(version_accepted) + + # MINIMUM is the default if no option is specified + if(ARGS_EXACT) + if(${VALA_VERSION} VERSION_EQUAL ${version} ) + set(version_accepted TRUE) + endif(${VALA_VERSION} VERSION_EQUAL ${version}) + elseif(ARGS_MAXIMUM) + if(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) + set(version_accepted TRUE) + endif(${VALA_VERSION} VERSION_LESS ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) + else(ARGS_MAXIMUM) + if(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) + set(version_accepted TRUE) + endif(${VALA_VERSION} VERSION_GREATER ${version} OR ${VALA_VERSION} VERSION_EQUAL ${version}) + endif(ARGS_EXACT) + + if (NOT version_accepted) + message(FATAL_ERROR + "Vala version ${version} ${error_message}is required." + ) + endif(NOT version_accepted) + + message(STATUS + " found Vala, version ${VALA_VERSION}" + ) +endmacro(ensure_vala_version) diff --git a/komorebi/data/Fonts/AmaticSC-Regular.ttf b/komorebi/data/Fonts/AmaticSC-Regular.ttf new file mode 100644 index 0000000..9d85bbd Binary files /dev/null and b/komorebi/data/Fonts/AmaticSC-Regular.ttf differ diff --git a/komorebi/data/Fonts/Bangers-Regular.ttf b/komorebi/data/Fonts/Bangers-Regular.ttf new file mode 100644 index 0000000..073f3ef Binary files /dev/null and b/komorebi/data/Fonts/Bangers-Regular.ttf differ diff --git a/komorebi/data/Fonts/BubblerOne-Regular.ttf b/komorebi/data/Fonts/BubblerOne-Regular.ttf new file mode 100644 index 0000000..45122e0 Binary files /dev/null and b/komorebi/data/Fonts/BubblerOne-Regular.ttf differ diff --git a/komorebi/data/Fonts/Lato-Hairline.ttf b/komorebi/data/Fonts/Lato-Hairline.ttf new file mode 100644 index 0000000..288be29 Binary files /dev/null and b/komorebi/data/Fonts/Lato-Hairline.ttf differ diff --git a/komorebi/data/Fonts/Lato-Light.ttf b/komorebi/data/Fonts/Lato-Light.ttf new file mode 100644 index 0000000..a958067 Binary files /dev/null and b/komorebi/data/Fonts/Lato-Light.ttf differ diff --git a/komorebi/data/Fonts/VT323-Regular.ttf b/komorebi/data/Fonts/VT323-Regular.ttf new file mode 100644 index 0000000..afa6909 Binary files /dev/null and b/komorebi/data/Fonts/VT323-Regular.ttf differ diff --git a/komorebi/data/Icons/add_bubble_item.svg b/komorebi/data/Icons/add_bubble_item.svg new file mode 100644 index 0000000..5362985 --- /dev/null +++ b/komorebi/data/Icons/add_bubble_item.svg @@ -0,0 +1,82 @@ + + + + + + + + +Created by potrace 1.13, written by Peter Selinger 2001-2015 + + + image/svg+xml + + + + + + + + + + diff --git a/komorebi/data/Icons/blank.svg b/komorebi/data/Icons/blank.svg new file mode 100644 index 0000000..d26de91 --- /dev/null +++ b/komorebi/data/Icons/blank.svg @@ -0,0 +1,98 @@ + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/komorebi/data/Icons/blank_backup.svg b/komorebi/data/Icons/blank_backup.svg new file mode 100644 index 0000000..abc3f4c --- /dev/null +++ b/komorebi/data/Icons/blank_backup.svg @@ -0,0 +1,70 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/komorebi/data/Icons/close_btn.svg b/komorebi/data/Icons/close_btn.svg new file mode 100644 index 0000000..5904d3c --- /dev/null +++ b/komorebi/data/Icons/close_btn.svg @@ -0,0 +1,88 @@ + + + + + + + + +Created by potrace 1.13, written by Peter Selinger 2001-2015 + + + image/svg+xml + + + + + + + + + + + diff --git a/komorebi/data/Icons/done.svg b/komorebi/data/Icons/done.svg new file mode 100644 index 0000000..73f72ee --- /dev/null +++ b/komorebi/data/Icons/done.svg @@ -0,0 +1,211 @@ + + + + + + + + Gnome Symbolic Icon Theme + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + Gnome Symbolic Icon Theme + + + + + + + + + + + diff --git a/komorebi/data/Icons/info.svg b/komorebi/data/Icons/info.svg new file mode 100644 index 0000000..d2aa3b9 --- /dev/null +++ b/komorebi/data/Icons/info.svg @@ -0,0 +1,175 @@ + + + + + + + + image/svg+xml + + elementary Symbolic Icon Theme + + + + + + + + elementary Symbolic Icon Theme + + + + + + + + + + + + + + + + + + + + + diff --git a/komorebi/data/Icons/komorebi.svg b/komorebi/data/Icons/komorebi.svg new file mode 100644 index 0000000..aae5c86 --- /dev/null +++ b/komorebi/data/Icons/komorebi.svg @@ -0,0 +1,1939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/komorebi/data/Icons/thumbnail_add.svg b/komorebi/data/Icons/thumbnail_add.svg new file mode 100644 index 0000000..e661274 --- /dev/null +++ b/komorebi/data/Icons/thumbnail_add.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + diff --git a/komorebi/data/Icons/thumbnail_border.svg b/komorebi/data/Icons/thumbnail_border.svg new file mode 100644 index 0000000..1223360 --- /dev/null +++ b/komorebi/data/Icons/thumbnail_border.svg @@ -0,0 +1,65 @@ + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/komorebi/data/Icons/wallpaper_creator.svg b/komorebi/data/Icons/wallpaper_creator.svg new file mode 100644 index 0000000..97d7f9c --- /dev/null +++ b/komorebi/data/Icons/wallpaper_creator.svg @@ -0,0 +1,1939 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/komorebi/data/Other/komorebi.desktop b/komorebi/data/Other/komorebi.desktop new file mode 100755 index 0000000..3ca7c22 --- /dev/null +++ b/komorebi/data/Other/komorebi.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Komorebi +Comment=An awesome wallpapers manager +Keywords=wallpaper;settings; preferences; +Icon=/System/Resources/Komorebi/komorebi.svg +Exec=/System/Applications/komorebi +Terminal=false +Type=Application +StartupNotify=true +Categories=GNOME;GTK;System; +X-GNOME-Autostart-enabled=true \ No newline at end of file diff --git a/komorebi/data/Other/postinst b/komorebi/data/Other/postinst new file mode 100644 index 0000000..2ca7d53 --- /dev/null +++ b/komorebi/data/Other/postinst @@ -0,0 +1,199 @@ +#!/bin/bash + +# A script that updates existing Komorebi wallpapers +# and add us to the start up with the new updated syntax + +echo "[INFO]: Removing old Komorebi properties file.." +users="$(ls -d -1 /home/*/ | xargs -n 1 basename)" + +for user in $users; do + + rm -rf "/home/$user/.Komorebi.prop" + + mkdir -p "/home/$user/.config/autostart" + cp "/usr/share/applications/komorebi.desktop" "/home/$user/.config/autostart/komorebi.desktop" + chown "$user:$user" "/home/$user/.config/autostart" -R + +done + +echo "[INFO]: Updating existing Komorebi Wallpapers.." + +wallpapers=$(ls -d -1 /System/Resources/Komorebi/*/) + +for wallpaper in $wallpapers; do + + configtemplate="[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=DATETIMEPARALLAX + +MarginLeft=MARGINLEFT +MarginTop=MARGINTOP +MarginBottom=MARGINBOTTOM +MarginRight=MARGINRIGHT + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=POSITION +Alignment=ALIGNMENT +AlwaysOnTop=DATETIMEALWAYSONTOP + +Color=TIMECOLOR +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=TIMEFONT +DateFont=DATEFONT + +[Wallpaper] +Parallax=WALLPAPERPARALLAX + +[Asset] +Visible=ASSETVISIBLE +AnimationMode=ANIMATIONMODE +AnimationSpeed=ANIMATIONSPEED + +Width=0 +Height=0 +" + + + # Skip wallpapers with videos (cause they're new) + if [ -e $wallpaper"video.mp4" ]; then + continue + fi + + if [ -e $wallpaper"wallpaper.jpg" ]; then + continue + fi + + # Remove incompatible wallpapers + if [ "$wallpaper" == "blue_pink_gradient" ]; then + continue + fi + + if [ "$wallpaper" == "dark_night_gradient" ]; then + continue + fi + + echo "Updating $wallpaper" + oldfile=$wallpaper"bg.jpg" + mv $oldfile $wallpaper"wallpaper.jpg" 2>/dev/null + rm -rf $wallpaper"thumb.jpg" + + entirecontent="" + + halign="" + valign="" + + + while read -r line + do + entirecontent+=$line + + + if [[ $line =~ "=" ]]; then + + IFS='=' read -r -a array <<< "$line" + + key="${array[0]}" + value="${array[1]}" + + if [ "$key" == "DateTimeBoxParallax" ]; then + configtemplate=${configtemplate/DATETIMEPARALLAX/$value} + + elif [ "$key" == "AnimationMode" ]; then + + if [ "$value" == "parallax-bg" ]; then + configtemplate=${configtemplate/WALLPAPERPARALLAX/"true"} + configtemplate=${configtemplate/ANIMATIONMODE/"noanimation"} + else + configtemplate=${configtemplate/WALLPAPERPARALLAX/"false"} + configtemplate=${configtemplate/ANIMATIONMODE/$value} + fi + + elif [ "$key" == "AnimationSpeed" ]; then + configtemplate=${configtemplate/ANIMATIONSPEED/$value} + + elif [ "$key" == "DateTimeBoxMarginLeft" ]; then + configtemplate=${configtemplate/MARGINLEFT/$value} + + elif [ "$key" == "DateTimeBoxMarginTop" ]; then + configtemplate=${configtemplate/MARGINTOP/$value} + + elif [ "$key" == "DateTimeBoxMarginBottom" ]; then + configtemplate=${configtemplate/MARGINBOTTOM/$value} + + elif [ "$key" == "DateTimeBoxMarginRight" ]; then + configtemplate=${configtemplate/MARGINRIGHT/$value} + + elif [ "$key" == "TimeLabelAlignment" ]; then + configtemplate=${configtemplate/ALIGNMENT/$value} + + elif [ "$key" == "DateTimeBoxHAlign" ]; then + halign=$value + + elif [ "$key" == "DateTimeBoxVAlign" ]; then + valign=$value + + elif [ "$key" == "DateTimeColor" ]; then + configtemplate=${configtemplate/TIMECOLOR/$value} + + elif [ "$key" == "TimeLabelFont" ]; then + configtemplate=${configtemplate/TIMEFONT/$value} + + elif [ "$key" == "DateLabelFont" ]; then + configtemplate=${configtemplate/DATEFONT/$value} + + elif [ "$key" == "DateTimeBoxOnTop" ]; then + configtemplate=${configtemplate/DATETIMEALWAYSONTOP/$value} + fi + fi + done < $wallpaper"config" + + + if [ -e $wallpaper"assets.png" ]; then + configtemplate=${configtemplate/ASSETVISIBLE/"true"} + else + configtemplate=${configtemplate/ASSETVISIBLE/"false"} + fi + + + if [[ $halign =~ "start" ]] && [[ $valign =~ "start" ]]; then + configtemplate=${configtemplate/POSITION/"top_left"} + + elif [[ $halign =~ "start" ]] && [[ $valign =~ "center" ]]; then + configtemplate=${configtemplate/POSITION/"center_left"} + + elif [[ $halign =~ "start" ]] && [[ $valign =~ "end" ]]; then + configtemplate=${configtemplate/POSITION/"bottom_left"} + + elif [[ $halign =~ "center" ]] && [[ $valign =~ "start" ]]; then + configtemplate=${configtemplate/POSITION/"top_center"} + + elif [[ $halign =~ "center" ]] && [[ $valign =~ "center" ]]; then + configtemplate=${configtemplate/POSITION/"center"} + + elif [[ $halign =~ "center" ]] && [[ $valign =~ "end" ]]; then + configtemplate=${configtemplate/POSITION/"bottom_center"} + + elif [[ $halign =~ "end" ]] && [[ $valign =~ "start" ]]; then + configtemplate=${configtemplate/POSITION/"top_right"} + + elif [[ $halign =~ "end" ]] && [[ $valign =~ "center" ]]; then + configtemplate=${configtemplate/POSITION/"center_right"} + + elif [[ $halign =~ "end" ]] && [[ $valign =~ "end" ]]; then + configtemplate=${configtemplate/POSITION/"bottom_right"} + fi + + + echo "$configtemplate" >$wallpaper"config" + +done \ No newline at end of file diff --git a/komorebi/data/Other/postrm b/komorebi/data/Other/postrm new file mode 100755 index 0000000..642ad6e --- /dev/null +++ b/komorebi/data/Other/postrm @@ -0,0 +1,5 @@ +#!/bin/bash +echo "[INFO] Ignore any errors" +echo "[*] Resetting desktop configuration" +gsettings set org.gnome.desktop.background show-desktop-icons true || true +gsettings set org.nemo.desktop show-desktop-icons true || true diff --git a/komorebi/data/Other/wallpapercreator.desktop b/komorebi/data/Other/wallpapercreator.desktop new file mode 100755 index 0000000..714cf08 --- /dev/null +++ b/komorebi/data/Other/wallpapercreator.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Wallpaper Creator +Comment=Create wallpapers for Komorebi +Keywords=wallpaper; settings; preferences; +Icon=/System/Resources/Komorebi/wallpaper_creator.svg +Exec=/System/Applications/komorebi-wallpaper-creator +Terminal=false +Type=Application +StartupNotify=true +Categories=GNOME;GTK;System; +X-GNOME-Autostart-enabled=false diff --git a/komorebi/data/Wallpapers/abstract_light_lines/assets.png b/komorebi/data/Wallpapers/abstract_light_lines/assets.png new file mode 100644 index 0000000..a631acb Binary files /dev/null and b/komorebi/data/Wallpapers/abstract_light_lines/assets.png differ diff --git a/komorebi/data/Wallpapers/abstract_light_lines/config b/komorebi/data/Wallpapers/abstract_light_lines/config new file mode 100644 index 0000000..4a94644 --- /dev/null +++ b/komorebi/data/Wallpapers/abstract_light_lines/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=80 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=bottom_center +Alignment=center +AlwaysOnTop=true + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 50 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=light +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/abstract_light_lines/wallpaper.jpg b/komorebi/data/Wallpapers/abstract_light_lines/wallpaper.jpg new file mode 100644 index 0000000..8fa58e0 Binary files /dev/null and b/komorebi/data/Wallpapers/abstract_light_lines/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/aerial_mountain_and_ocean/config b/komorebi/data/Wallpapers/aerial_mountain_and_ocean/config new file mode 100644 index 0000000..d0d87d1 --- /dev/null +++ b/komorebi/data/Wallpapers/aerial_mountain_and_ocean/config @@ -0,0 +1,29 @@ +[Info] +WallpaperType=video +VideoFileName=video.mp4 + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=true + +Color=white +Alpha=140 + +ShadowColor=white +ShadowAlpha=0 + +TimeFont=Lato Light 50 +DateFont=Lato Light 40 diff --git a/komorebi/data/Wallpapers/aerial_mountain_and_ocean/video.mp4 b/komorebi/data/Wallpapers/aerial_mountain_and_ocean/video.mp4 new file mode 100644 index 0000000..0a8e9aa Binary files /dev/null and b/komorebi/data/Wallpapers/aerial_mountain_and_ocean/video.mp4 differ diff --git a/komorebi/data/Wallpapers/aerial_mountain_and_ocean/wallpaper.jpg b/komorebi/data/Wallpapers/aerial_mountain_and_ocean/wallpaper.jpg new file mode 100644 index 0000000..f13497c Binary files /dev/null and b/komorebi/data/Wallpapers/aerial_mountain_and_ocean/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/aurora_video/config b/komorebi/data/Wallpapers/aurora_video/config new file mode 100644 index 0000000..d8e8458 --- /dev/null +++ b/komorebi/data/Wallpapers/aurora_video/config @@ -0,0 +1,29 @@ +[Info] +WallpaperType=video +VideoFileName=video.mp4 + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=true + +Color=white +Alpha=255 + +ShadowColor=white +ShadowAlpha=0 + +TimeFont=Lato Light 50 +DateFont=Lato Light 40 diff --git a/komorebi/data/Wallpapers/aurora_video/video.mp4 b/komorebi/data/Wallpapers/aurora_video/video.mp4 new file mode 100644 index 0000000..f845d01 Binary files /dev/null and b/komorebi/data/Wallpapers/aurora_video/video.mp4 differ diff --git a/komorebi/data/Wallpapers/aurora_video/wallpaper.jpg b/komorebi/data/Wallpapers/aurora_video/wallpaper.jpg new file mode 100644 index 0000000..b6757d6 Binary files /dev/null and b/komorebi/data/Wallpapers/aurora_video/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/beach_space_view/assets.png b/komorebi/data/Wallpapers/beach_space_view/assets.png new file mode 100644 index 0000000..e9e6c14 Binary files /dev/null and b/komorebi/data/Wallpapers/beach_space_view/assets.png differ diff --git a/komorebi/data/Wallpapers/beach_space_view/config b/komorebi/data/Wallpapers/beach_space_view/config new file mode 100644 index 0000000..f2b003a --- /dev/null +++ b/komorebi/data/Wallpapers/beach_space_view/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=false + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 50 +DateFont=Lato Light 40 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/beach_space_view/wallpaper.jpg b/komorebi/data/Wallpapers/beach_space_view/wallpaper.jpg new file mode 100644 index 0000000..81df379 Binary files /dev/null and b/komorebi/data/Wallpapers/beach_space_view/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/canyon_night_sky/assets.png b/komorebi/data/Wallpapers/canyon_night_sky/assets.png new file mode 100644 index 0000000..a22a54e Binary files /dev/null and b/komorebi/data/Wallpapers/canyon_night_sky/assets.png differ diff --git a/komorebi/data/Wallpapers/canyon_night_sky/config b/komorebi/data/Wallpapers/canyon_night_sky/config new file mode 100644 index 0000000..6090e18 --- /dev/null +++ b/komorebi/data/Wallpapers/canyon_night_sky/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=true + +MarginLeft=0 +MarginTop=0 +MarginBottom=70 +MarginRight=50 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=false + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 60 +DateFont=Lato Light 50 + +[Wallpaper] +Parallax=true + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/canyon_night_sky/wallpaper.jpg b/komorebi/data/Wallpapers/canyon_night_sky/wallpaper.jpg new file mode 100644 index 0000000..8e8f920 Binary files /dev/null and b/komorebi/data/Wallpapers/canyon_night_sky/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/city_lights/assets.png b/komorebi/data/Wallpapers/city_lights/assets.png new file mode 100644 index 0000000..6614884 Binary files /dev/null and b/komorebi/data/Wallpapers/city_lights/assets.png differ diff --git a/komorebi/data/Wallpapers/city_lights/config b/komorebi/data/Wallpapers/city_lights/config new file mode 100644 index 0000000..5af0cc9 --- /dev/null +++ b/komorebi/data/Wallpapers/city_lights/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=false + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Bangers Regular 80 +DateFont=Bangers Regular 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=light +AnimationSpeed=300 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/city_lights/wallpaper.jpg b/komorebi/data/Wallpapers/city_lights/wallpaper.jpg new file mode 100644 index 0000000..8d65542 Binary files /dev/null and b/komorebi/data/Wallpapers/city_lights/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/cloudy_forest/assets.png b/komorebi/data/Wallpapers/cloudy_forest/assets.png new file mode 100644 index 0000000..7517a27 Binary files /dev/null and b/komorebi/data/Wallpapers/cloudy_forest/assets.png differ diff --git a/komorebi/data/Wallpapers/cloudy_forest/config b/komorebi/data/Wallpapers/cloudy_forest/config new file mode 100644 index 0000000..912ee9a --- /dev/null +++ b/komorebi/data/Wallpapers/cloudy_forest/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=true + +MarginLeft=0 +MarginTop=60 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=top_center +Alignment=center +AlwaysOnTop=false + +Color=black +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Hairline 80 +DateFont=Lato Hairline 60 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=clouds +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/cloudy_forest/wallpaper.jpg b/komorebi/data/Wallpapers/cloudy_forest/wallpaper.jpg new file mode 100644 index 0000000..b156f17 Binary files /dev/null and b/komorebi/data/Wallpapers/cloudy_forest/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/dark_forest/assets.png b/komorebi/data/Wallpapers/dark_forest/assets.png new file mode 100644 index 0000000..4d1f1f8 Binary files /dev/null and b/komorebi/data/Wallpapers/dark_forest/assets.png differ diff --git a/komorebi/data/Wallpapers/dark_forest/config b/komorebi/data/Wallpapers/dark_forest/config new file mode 100644 index 0000000..94458b8 --- /dev/null +++ b/komorebi/data/Wallpapers/dark_forest/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=true + +MarginLeft=50 +MarginTop=0 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center_left +Alignment=start +AlwaysOnTop=false + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Hairline 60 +DateFont=Lato Hairline 50 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/dark_forest/wallpaper.jpg b/komorebi/data/Wallpapers/dark_forest/wallpaper.jpg new file mode 100644 index 0000000..1f5c742 Binary files /dev/null and b/komorebi/data/Wallpapers/dark_forest/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/day_night_mountain/assets.png b/komorebi/data/Wallpapers/day_night_mountain/assets.png new file mode 100644 index 0000000..755a983 Binary files /dev/null and b/komorebi/data/Wallpapers/day_night_mountain/assets.png differ diff --git a/komorebi/data/Wallpapers/day_night_mountain/config b/komorebi/data/Wallpapers/day_night_mountain/config new file mode 100644 index 0000000..a8ad57f --- /dev/null +++ b/komorebi/data/Wallpapers/day_night_mountain/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=20 +MarginTop=0 +MarginBottom=80 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=bottom_left +Alignment=start +AlwaysOnTop=true + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 50 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=light +AnimationSpeed=1000 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/day_night_mountain/wallpaper.jpg b/komorebi/data/Wallpapers/day_night_mountain/wallpaper.jpg new file mode 100644 index 0000000..4eb5859 Binary files /dev/null and b/komorebi/data/Wallpapers/day_night_mountain/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/deck_sea_fog/config b/komorebi/data/Wallpapers/deck_sea_fog/config new file mode 100644 index 0000000..92e642c --- /dev/null +++ b/komorebi/data/Wallpapers/deck_sea_fog/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=60 +MarginRight=200 + +RotationX=90 +RotationY=0 +RotationZ=-2 + +Position=bottom_right +Alignment=center +AlwaysOnTop=false + +Color=black +Alpha=255 + +ShadowColor=black +ShadowAlpha=0 + +TimeFont=Lato Light 60 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/deck_sea_fog/wallpaper.jpg b/komorebi/data/Wallpapers/deck_sea_fog/wallpaper.jpg new file mode 100644 index 0000000..53b878f Binary files /dev/null and b/komorebi/data/Wallpapers/deck_sea_fog/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/direction_to_time/config b/komorebi/data/Wallpapers/direction_to_time/config new file mode 100644 index 0000000..942a675 --- /dev/null +++ b/komorebi/data/Wallpapers/direction_to_time/config @@ -0,0 +1,32 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false +MarginTop=40 +MarginRight=120 +MarginLeft=0 +MarginBottom=0 +RotationX=10 +RotationY=-55 +RotationZ=-14 +Position=center_right +Alignment=start +AlwaysOnTop=true +Color=#edd400 +Alpha=255 +ShadowColor=red +ShadowAlpha=255 +TimeFont=Lato Bold 120 +DateFont=Lato Medium 0 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 +Width=0 +Height=0 diff --git a/komorebi/data/Wallpapers/direction_to_time/wallpaper.jpg b/komorebi/data/Wallpapers/direction_to_time/wallpaper.jpg new file mode 100644 index 0000000..4fc41bd Binary files /dev/null and b/komorebi/data/Wallpapers/direction_to_time/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/foggy_sunny_mountain/assets.png b/komorebi/data/Wallpapers/foggy_sunny_mountain/assets.png new file mode 100644 index 0000000..d446ac3 Binary files /dev/null and b/komorebi/data/Wallpapers/foggy_sunny_mountain/assets.png differ diff --git a/komorebi/data/Wallpapers/foggy_sunny_mountain/config b/komorebi/data/Wallpapers/foggy_sunny_mountain/config new file mode 100644 index 0000000..ef43743 --- /dev/null +++ b/komorebi/data/Wallpapers/foggy_sunny_mountain/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=false + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=120 + +TimeFont=Lato Light 50 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=light +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/foggy_sunny_mountain/wallpaper.jpg b/komorebi/data/Wallpapers/foggy_sunny_mountain/wallpaper.jpg new file mode 100644 index 0000000..4ff15fa Binary files /dev/null and b/komorebi/data/Wallpapers/foggy_sunny_mountain/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/graffiti/assets.png b/komorebi/data/Wallpapers/graffiti/assets.png new file mode 100644 index 0000000..c151a3a Binary files /dev/null and b/komorebi/data/Wallpapers/graffiti/assets.png differ diff --git a/komorebi/data/Wallpapers/graffiti/config b/komorebi/data/Wallpapers/graffiti/config new file mode 100644 index 0000000..15b8f34 --- /dev/null +++ b/komorebi/data/Wallpapers/graffiti/config @@ -0,0 +1,32 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false +MarginTop=30 +MarginRight=30 +MarginLeft=-20 +MarginBottom=0 +RotationX=0 +RotationY=0 +RotationZ=0 +Position=center +Alignment=start +AlwaysOnTop=false +Color=#000000 +Alpha=255 +ShadowColor=#dd22dd22dd22 +ShadowAlpha=0 +TimeFont=Lato Light 100 +DateFont=Lato Light 60 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 +Width=0 +Height=0 diff --git a/komorebi/data/Wallpapers/graffiti/wallpaper.jpg b/komorebi/data/Wallpapers/graffiti/wallpaper.jpg new file mode 100644 index 0000000..19c95aa Binary files /dev/null and b/komorebi/data/Wallpapers/graffiti/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/grainy_day/config b/komorebi/data/Wallpapers/grainy_day/config new file mode 100644 index 0000000..a1ed4c3 --- /dev/null +++ b/komorebi/data/Wallpapers/grainy_day/config @@ -0,0 +1,32 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false +MarginTop=0 +MarginRight=0 +MarginLeft=60 +MarginBottom=0 +RotationX=0 +RotationY=0 +RotationZ=0 +Position=center_left +Alignment=start +AlwaysOnTop=true +Color=#2e3436 +Alpha=255 +ShadowColor=#2e3436 +ShadowAlpha=255 +TimeFont=VT323 20 +DateFont=VT323 20 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 +Width=0 +Height=0 diff --git a/komorebi/data/Wallpapers/grainy_day/wallpaper.jpg b/komorebi/data/Wallpapers/grainy_day/wallpaper.jpg new file mode 100644 index 0000000..b2af41a Binary files /dev/null and b/komorebi/data/Wallpapers/grainy_day/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/icy_mountains/config b/komorebi/data/Wallpapers/icy_mountains/config new file mode 100644 index 0000000..a78f6d2 --- /dev/null +++ b/komorebi/data/Wallpapers/icy_mountains/config @@ -0,0 +1,34 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false +MarginTop=0 +MarginRight=0 +MarginLeft=0 +MarginBottom=75 +RotationX=0 +RotationY=0 +RotationZ=0 +Position=center +Alignment=center +AlwaysOnTop=true +Color=#164b71 +Alpha=167 +ShadowColor=#dd22dd22dd22 +ShadowAlpha=255 +TimeFont=Bubbler One Bold 46 +DateFont=Bubbler One 15 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/icy_mountains/wallpaper.jpg b/komorebi/data/Wallpapers/icy_mountains/wallpaper.jpg new file mode 100644 index 0000000..ed1086f Binary files /dev/null and b/komorebi/data/Wallpapers/icy_mountains/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/mountain_lake_at_night/config b/komorebi/data/Wallpapers/mountain_lake_at_night/config new file mode 100644 index 0000000..2b473d4 --- /dev/null +++ b/komorebi/data/Wallpapers/mountain_lake_at_night/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=50 +MarginRight=0 + +RotationX=90 +RotationY=0 +RotationZ=0 + +Position=bottom_center +Alignment=center +AlwaysOnTop=false + +Color=black +Alpha=100 + +ShadowColor=black +ShadowAlpha=0 + +TimeFont=Lato Light 80 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/mountain_lake_at_night/wallpaper.jpg b/komorebi/data/Wallpapers/mountain_lake_at_night/wallpaper.jpg new file mode 100644 index 0000000..8b0de02 Binary files /dev/null and b/komorebi/data/Wallpapers/mountain_lake_at_night/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/on_a_mountain_hill/config b/komorebi/data/Wallpapers/on_a_mountain_hill/config new file mode 100644 index 0000000..af542ac --- /dev/null +++ b/komorebi/data/Wallpapers/on_a_mountain_hill/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=0 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=true + +Color=white +Alpha=140 + +ShadowColor=white +ShadowAlpha=0 + +TimeFont=AmaticSC 100 +DateFont=AmaticSC 20 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/on_a_mountain_hill/wallpaper.jpg b/komorebi/data/Wallpapers/on_a_mountain_hill/wallpaper.jpg new file mode 100644 index 0000000..900a845 Binary files /dev/null and b/komorebi/data/Wallpapers/on_a_mountain_hill/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/parallax_cartoon_mountain/assets.png b/komorebi/data/Wallpapers/parallax_cartoon_mountain/assets.png new file mode 100644 index 0000000..b32f682 Binary files /dev/null and b/komorebi/data/Wallpapers/parallax_cartoon_mountain/assets.png differ diff --git a/komorebi/data/Wallpapers/parallax_cartoon_mountain/config b/komorebi/data/Wallpapers/parallax_cartoon_mountain/config new file mode 100644 index 0000000..6682af5 --- /dev/null +++ b/komorebi/data/Wallpapers/parallax_cartoon_mountain/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=true + +MarginLeft=0 +MarginTop=0 +MarginBottom=70 +MarginRight=50 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center_right +Alignment=end +AlwaysOnTop=true + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 40 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=true + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/parallax_cartoon_mountain/wallpaper.jpg b/komorebi/data/Wallpapers/parallax_cartoon_mountain/wallpaper.jpg new file mode 100644 index 0000000..b5a6ac6 Binary files /dev/null and b/komorebi/data/Wallpapers/parallax_cartoon_mountain/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/parallax_sky/assets.png b/komorebi/data/Wallpapers/parallax_sky/assets.png new file mode 100644 index 0000000..55182e7 Binary files /dev/null and b/komorebi/data/Wallpapers/parallax_sky/assets.png differ diff --git a/komorebi/data/Wallpapers/parallax_sky/config b/komorebi/data/Wallpapers/parallax_sky/config new file mode 100644 index 0000000..174ab8c --- /dev/null +++ b/komorebi/data/Wallpapers/parallax_sky/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=70 +MarginRight=50 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=bottom_right +Alignment=end +AlwaysOnTop=true + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 40 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=true + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/parallax_sky/wallpaper.jpg b/komorebi/data/Wallpapers/parallax_sky/wallpaper.jpg new file mode 100644 index 0000000..2ce7595 Binary files /dev/null and b/komorebi/data/Wallpapers/parallax_sky/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/plane_window/assets.png b/komorebi/data/Wallpapers/plane_window/assets.png new file mode 100644 index 0000000..e0fc219 Binary files /dev/null and b/komorebi/data/Wallpapers/plane_window/assets.png differ diff --git a/komorebi/data/Wallpapers/plane_window/config b/komorebi/data/Wallpapers/plane_window/config new file mode 100644 index 0000000..2cbdd01 --- /dev/null +++ b/komorebi/data/Wallpapers/plane_window/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=130 +MarginRight=15 + +RotationX=20 +RotationY=-5 +RotationZ=0 + +Position=bottom_center +Alignment=center +AlwaysOnTop=true + +Color=black +Alpha=140 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 25 +DateFont=Lato Light 15 + +[Wallpaper] +Parallax=true + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/plane_window/wallpaper.jpg b/komorebi/data/Wallpapers/plane_window/wallpaper.jpg new file mode 100644 index 0000000..6eed8eb Binary files /dev/null and b/komorebi/data/Wallpapers/plane_window/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/sahara-day-and-night/assets.png b/komorebi/data/Wallpapers/sahara-day-and-night/assets.png new file mode 100644 index 0000000..1337a7c Binary files /dev/null and b/komorebi/data/Wallpapers/sahara-day-and-night/assets.png differ diff --git a/komorebi/data/Wallpapers/sahara-day-and-night/config b/komorebi/data/Wallpapers/sahara-day-and-night/config new file mode 100644 index 0000000..a40bb3d --- /dev/null +++ b/komorebi/data/Wallpapers/sahara-day-and-night/config @@ -0,0 +1,32 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false +MarginTop=0 +MarginRight=0 +MarginLeft=0 +MarginBottom=0 +RotationX=0 +RotationY=0 +RotationZ=0 +Position=center +Alignment=center +AlwaysOnTop=true +Color=#dd22dd22dd22 +Alpha=120 +ShadowColor=#dd22dd22dd22 +ShadowAlpha=255 +TimeFont=Lato Light 100 +DateFont=Lato Light 20 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=light +AnimationSpeed=200 +Width=0 +Height=0 diff --git a/komorebi/data/Wallpapers/sahara-day-and-night/wallpaper.jpg b/komorebi/data/Wallpapers/sahara-day-and-night/wallpaper.jpg new file mode 100644 index 0000000..d9b5c93 Binary files /dev/null and b/komorebi/data/Wallpapers/sahara-day-and-night/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/saharan_adventure/config b/komorebi/data/Wallpapers/saharan_adventure/config new file mode 100644 index 0000000..94bf69d --- /dev/null +++ b/komorebi/data/Wallpapers/saharan_adventure/config @@ -0,0 +1,32 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false +MarginTop=0 +MarginRight=0 +MarginLeft=0 +MarginBottom=185 +RotationX=0 +RotationY=0 +RotationZ=0 +Position=center +Alignment=center +AlwaysOnTop=true +Color=#ffffff +Alpha=128 +ShadowColor=#dd22dd22dd22 +ShadowAlpha=255 +TimeFont=Lato Light 21 +DateFont=Lato Light 33 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 +Width=0 +Height=0 diff --git a/komorebi/data/Wallpapers/saharan_adventure/wallpaper.jpg b/komorebi/data/Wallpapers/saharan_adventure/wallpaper.jpg new file mode 100644 index 0000000..94ba025 Binary files /dev/null and b/komorebi/data/Wallpapers/saharan_adventure/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/sunny_sand/assets.png b/komorebi/data/Wallpapers/sunny_sand/assets.png new file mode 100644 index 0000000..a69c2c9 Binary files /dev/null and b/komorebi/data/Wallpapers/sunny_sand/assets.png differ diff --git a/komorebi/data/Wallpapers/sunny_sand/config b/komorebi/data/Wallpapers/sunny_sand/config new file mode 100644 index 0000000..e1ee879 --- /dev/null +++ b/komorebi/data/Wallpapers/sunny_sand/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=true + +MarginLeft=0 +MarginTop=0 +MarginBottom=20 +MarginRight=0 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center +Alignment=center +AlwaysOnTop=false + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Hairline 80 +DateFont=Lato Hairline 50 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/sunny_sand/wallpaper.jpg b/komorebi/data/Wallpapers/sunny_sand/wallpaper.jpg new file mode 100644 index 0000000..5b632db Binary files /dev/null and b/komorebi/data/Wallpapers/sunny_sand/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/tree_reflection_video/config b/komorebi/data/Wallpapers/tree_reflection_video/config new file mode 100644 index 0000000..96bfe9f --- /dev/null +++ b/komorebi/data/Wallpapers/tree_reflection_video/config @@ -0,0 +1,29 @@ +[Info] +WallpaperType=video +VideoFileName=video.mp4 + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=0 +MarginBottom=0 +MarginRight=60 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=center_right +Alignment=center +AlwaysOnTop=true + +Color=black +Alpha=255 + +ShadowColor=white +ShadowAlpha=0 + +TimeFont=Lato Light 50 +DateFont=Lato Light 40 diff --git a/komorebi/data/Wallpapers/tree_reflection_video/video.mp4 b/komorebi/data/Wallpapers/tree_reflection_video/video.mp4 new file mode 100644 index 0000000..b19c750 Binary files /dev/null and b/komorebi/data/Wallpapers/tree_reflection_video/video.mp4 differ diff --git a/komorebi/data/Wallpapers/tree_reflection_video/wallpaper.jpg b/komorebi/data/Wallpapers/tree_reflection_video/wallpaper.jpg new file mode 100644 index 0000000..2eda4cb Binary files /dev/null and b/komorebi/data/Wallpapers/tree_reflection_video/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/underground_passageway/config b/komorebi/data/Wallpapers/underground_passageway/config new file mode 100644 index 0000000..ce52ab5 --- /dev/null +++ b/komorebi/data/Wallpapers/underground_passageway/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=100 +MarginBottom=0 +MarginRight=200 + +RotationX=0 +RotationY=-65 +RotationZ=0 + +Position=center_right +Alignment=end +AlwaysOnTop=false + +Color=white +Alpha=140 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Light 40 +DateFont=Lato Light 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=false +AnimationMode=noanimation +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/underground_passageway/wallpaper.jpg b/komorebi/data/Wallpapers/underground_passageway/wallpaper.jpg new file mode 100644 index 0000000..f1b9db1 Binary files /dev/null and b/komorebi/data/Wallpapers/underground_passageway/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/unsplash/config b/komorebi/data/Wallpapers/unsplash/config new file mode 100644 index 0000000..46eda9c --- /dev/null +++ b/komorebi/data/Wallpapers/unsplash/config @@ -0,0 +1,23 @@ +[Info] +WallpaperType=web_page +WebPageUrl=https://source.unsplash.com/random/{{screen_width}}x{{screen_height}} + +[DateTime] +Visible=true +Parallax=false +MarginTop=0 +MarginRight=0 +MarginLeft=0 +MarginBottom=0 +RotationX=0 +RotationY=0 +RotationZ=0 +Position=center +Alignment=center +AlwaysOnTop=true +Color=#ffffff +Alpha=128 +ShadowColor=#dd22dd22dd22 +ShadowAlpha=255 +TimeFont=Lato Light 100 +DateFont=Lato Light 50 \ No newline at end of file diff --git a/komorebi/data/Wallpapers/unsplash/wallpaper.jpg b/komorebi/data/Wallpapers/unsplash/wallpaper.jpg new file mode 100644 index 0000000..9f78123 Binary files /dev/null and b/komorebi/data/Wallpapers/unsplash/wallpaper.jpg differ diff --git a/komorebi/data/Wallpapers/yosemite_cloudy/assets.png b/komorebi/data/Wallpapers/yosemite_cloudy/assets.png new file mode 100644 index 0000000..c8378a4 Binary files /dev/null and b/komorebi/data/Wallpapers/yosemite_cloudy/assets.png differ diff --git a/komorebi/data/Wallpapers/yosemite_cloudy/config b/komorebi/data/Wallpapers/yosemite_cloudy/config new file mode 100644 index 0000000..b952443 --- /dev/null +++ b/komorebi/data/Wallpapers/yosemite_cloudy/config @@ -0,0 +1,40 @@ +[Info] +WallpaperType=image + +[DateTime] +Visible=true +Parallax=false + +MarginLeft=0 +MarginTop=20 +MarginBottom=0 +MarginRight=30 + +RotationX=0 +RotationY=0 +RotationZ=0 + +Position=top_right +Alignment=end +AlwaysOnTop=false + +Color=white +Alpha=255 + +ShadowColor=black +ShadowAlpha=190 + +TimeFont=Lato Regular 40 +DateFont=Lato Regular 30 + +[Wallpaper] +Parallax=false + +[Asset] +Visible=true +AnimationMode=clouds +AnimationSpeed=100 + +Width=0 +Height=0 + diff --git a/komorebi/data/Wallpapers/yosemite_cloudy/wallpaper.jpg b/komorebi/data/Wallpapers/yosemite_cloudy/wallpaper.jpg new file mode 100644 index 0000000..8aecac7 Binary files /dev/null and b/komorebi/data/Wallpapers/yosemite_cloudy/wallpaper.jpg differ diff --git a/komorebi/extra/wallpaper-creator/Main.vala b/komorebi/extra/wallpaper-creator/Main.vala new file mode 100644 index 0000000..8821070 --- /dev/null +++ b/komorebi/extra/wallpaper-creator/Main.vala @@ -0,0 +1,78 @@ +// +// Copyright (C) 2017-2018 Abraham Masri +// +// 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 3 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, see . +// + +using WallpaperCreator.OnScreen; + +namespace WallpaperCreator { + + string filePath; + string assetPath; + string thumbnailPath; + string webPageUrl; + + string wallpaperName; + string wallpaperType; // image/video/web_page + bool wallpaperParallax; + + // Properties + bool showDateTime; + bool dateTimeParallax; + + int marginTop; + int marginRight; + int marginLeft; + int marginBottom; + + string position; + string alignment; + bool dateTimeAlwaysOnTop; + + string dateTimeColor; + int dateTimeAlpha; + + string shadowColor; + int shadowAlpha; + + string timeFont; + string dateFont; + + bool showAsset = false; + string animationMode; + int animationSpeed; + + public static void main (string [] args) { + + print("Welcome to Komorebi Wallpaper Creator\n"); + + if(args[1] == "--version" || args[1] == "version") { + print("Version: 1.1 - Summit\nCreated by: Abraham Masri @cheesecakefuo\n\n"); + return; + } + Gtk.init (ref args); + + Gtk.Settings.get_default().gtk_application_prefer_dark_theme = true; + + new NewWallpaperWindow(); + + var mainSettings = Gtk.Settings.get_default (); + mainSettings.set("gtk-xft-antialias", 1, null); + mainSettings.set("gtk-xft-rgba" , "none", null); + mainSettings.set("gtk-xft-hintstyle" , "slight", null); + + Gtk.main(); + } +} diff --git a/komorebi/extra/wallpaper-creator/OnScreen/FinalPage.vala b/komorebi/extra/wallpaper-creator/OnScreen/FinalPage.vala new file mode 100644 index 0000000..a106607 --- /dev/null +++ b/komorebi/extra/wallpaper-creator/OnScreen/FinalPage.vala @@ -0,0 +1,166 @@ +// +// Copyright (C) 2016-2017 Abraham Masri +// +// 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 3 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, see . +// + +using Gtk; + +namespace WallpaperCreator.OnScreen { + + public class FinalPage : Box { + + Image logo = new Image.from_file("/System/Resources/Komorebi/done.svg"); + + Label titleLabel = new Label(""); + Label descLabel = new Label(""); + + Button closeButton = new Button.with_label("Close"); + + public FinalPage() { + + spacing = 10; + hexpand = true; + vexpand = true; + orientation = Orientation.VERTICAL; + halign = Align.CENTER; + valign = Align.CENTER; + + logo.margin_bottom = 30; + + descLabel.justify = Justification.CENTER; + descLabel.halign = Align.CENTER; + descLabel.hexpand = false; + descLabel.selectable = true; + + titleLabel.set_markup("Done"); + + var mv_command = @"sudo mv $(Environment.get_home_dir())/$(wallpaperName.replace(" ", "_").replace(".", "_").down()) /System/Resources/Komorebi"; + + descLabel.set_markup(@"Open 'Terminal' then paste the following:\n$mv_command\nOnce done, you can change the wallpaper in 'Change Wallpaper'."); + + closeButton.margin_top = 20; + closeButton.halign = Align.CENTER; + + // Signals + closeButton.released.connect(() => { + + print("My job is done. Good bye!\n"); + Gtk.main_quit(); + }); + + + add(logo); + add(titleLabel); + add(descLabel); + add(closeButton); + + createWallpaper(); + } + + /* Creates a wallpaper */ + private void createWallpaper() { + + // Create a new directory + wallpaperName = wallpaperName.replace(" ", "_").replace(".", "_").down(); + + var dirPath = @"$(Environment.get_home_dir())/$(wallpaperName)"; + File.new_for_path(dirPath).make_directory_with_parents(); + var configPath = dirPath + "/config"; + var configFile = File.new_for_path(configPath); + + var configKeyFile = new KeyFile(); + + configKeyFile.set_string("Info", "WallpaperType", wallpaperType); + + if(wallpaperType == "video") { + + var videoFileNameArray = filePath.split("/"); + var videoFileName = videoFileNameArray[videoFileNameArray.length - 1]; + configKeyFile.set_string("Info", "VideoFileName", videoFileName); + + // Copy the video into our new dir + File.new_for_path(filePath).copy(File.new_for_path(dirPath + @"/$videoFileName"), FileCopyFlags.NONE); + + + } else if (wallpaperType == "web_page") + configKeyFile.set_string("Info", "WebPageUrl", webPageUrl); + + + if(wallpaperType == "video" || wallpaperType == "web_page") { + + // Move the thumbnail + File.new_for_path(thumbnailPath).copy(File.new_for_path(dirPath + "/wallpaper.jpg"), FileCopyFlags.NONE); + + } else { + + // Copy the wallpaper into our new dir + File.new_for_path(filePath).copy(File.new_for_path(dirPath + "/wallpaper.jpg"), FileCopyFlags.NONE); + } + + configKeyFile.set_boolean("DateTime", "Visible", showDateTime); + configKeyFile.set_boolean("DateTime", "Parallax", dateTimeParallax); + + configKeyFile.set_integer("DateTime", "MarginTop", marginTop); + configKeyFile.set_integer("DateTime", "MarginRight", marginRight); + configKeyFile.set_integer("DateTime", "MarginLeft", marginLeft); + configKeyFile.set_integer("DateTime", "MarginBottom", marginBottom); + + // TODO: Add support for rotations + configKeyFile.set_integer("DateTime", "RotationX", 0); + configKeyFile.set_integer("DateTime", "RotationY", 0); + configKeyFile.set_integer("DateTime", "RotationZ", 0); + + configKeyFile.set_string("DateTime", "Position", position); + configKeyFile.set_string("DateTime", "Alignment", alignment); + configKeyFile.set_boolean("DateTime", "AlwaysOnTop", dateTimeAlwaysOnTop); + + configKeyFile.set_string("DateTime", "Color", dateTimeColor); + configKeyFile.set_integer("DateTime", "Alpha", dateTimeAlpha); + + configKeyFile.set_string("DateTime", "ShadowColor", shadowColor); + configKeyFile.set_integer("DateTime", "ShadowAlpha", shadowAlpha); + + configKeyFile.set_string("DateTime", "TimeFont", timeFont); + configKeyFile.set_string("DateTime", "DateFont", dateFont); + + + if(wallpaperType == "image") { + + configKeyFile.set_boolean("Wallpaper", "Parallax", wallpaperParallax); + + if(assetPath == null || assetPath == "") + showAsset = false; + + configKeyFile.set_boolean("Asset", "Visible", showAsset); + configKeyFile.set_string("Asset", "AnimationMode", animationMode); + configKeyFile.set_integer("Asset", "AnimationSpeed", animationSpeed); + + configKeyFile.set_integer("Asset", "Width", 0); + configKeyFile.set_integer("Asset", "Height", 0); + + if(assetPath != null) { + // Move the asset into our new dir + File.new_for_path(assetPath).copy(File.new_for_path(dirPath + "/assets.png"), FileCopyFlags.NONE); + } + } + + // save the key file + var stream = new DataOutputStream (configFile.create (0)); + stream.put_string (configKeyFile.to_data ()); + stream.close (); + + } + } +} diff --git a/komorebi/extra/wallpaper-creator/OnScreen/InitialPage.vala b/komorebi/extra/wallpaper-creator/OnScreen/InitialPage.vala new file mode 100644 index 0000000..86de192 --- /dev/null +++ b/komorebi/extra/wallpaper-creator/OnScreen/InitialPage.vala @@ -0,0 +1,187 @@ +// +// Copyright (C) 2016-2017 Abraham Masri +// +// 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 3 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, see . +// + +using Gtk; + +namespace WallpaperCreator.OnScreen { + + public class InitialPage : Box { + + Grid aboutGrid = new Grid(); + + Box titleBox = new Box(Orientation.VERTICAL, 5); + Label titleLabel = new Label(""); + Label aboutLabel = new Label(""); + + + Label nameLabel = new Label("Give your wallpaper a name:"); + Entry nameEntry = new Entry() { placeholder_text = "Mountain Summit" }; + + FileFilter imageFilter = new FileFilter (); + FileFilter videoFilter = new FileFilter (); + + Label typeLabel = new Label("My wallpaper is"); + ComboBoxText typeComboBox = new ComboBoxText(); + + Label chooseFileLabel = new Label("Where is the image located?"); + Box locationBox = new Box(Orientation.HORIZONTAL, 10); + Entry locationEntry = new Entry() { placeholder_text = "/Users/cheesecakeufo/my_picture.jpg" }; + FileChooserButton chooseFileButton = new FileChooserButton("Choose File", Gtk.FileChooserAction.OPEN); + + Revealer revealer = new Revealer(); + + Box thumbnailBox = new Box(Orientation.VERTICAL, 5); + Label chooseThumbnailLabel = new Label("Where is the thumbnail located?"); + FileChooserButton chooseThumbnailButton = new FileChooserButton("Choose Thumbnail", Gtk.FileChooserAction.OPEN); + + public InitialPage() { + + spacing = 10; + hexpand = true; + vexpand = true; + orientation = Orientation.VERTICAL; + halign = Align.CENTER; + valign = Align.CENTER; + + aboutGrid.halign = Align.CENTER; + aboutGrid.margin_bottom = 30; + aboutGrid.column_spacing = 0; + aboutGrid.row_spacing = 0; + + titleBox.margin_top = 15; + titleBox.margin_start = 10; + titleLabel.halign = Align.START; + + titleLabel.set_markup("Komorebi Wallpaper Creator"); + aboutLabel.set_markup("by Abraham Masri @cheesecakeufo"); + + aboutLabel.halign = Align.START; + + typeComboBox.append("image", "An image"); + typeComboBox.append("video", "A video"); + typeComboBox.append("web_page", "A web page"); + typeComboBox.active = 0; + + wallpaperType = "image"; + + imageFilter.add_mime_type ("image/*"); + videoFilter.add_mime_type ("video/*"); + + chooseFileButton.set_filter (imageFilter); + chooseFileButton.width_chars = 10; + + chooseThumbnailButton.set_filter (imageFilter); + chooseThumbnailButton.width_chars = 10; + + locationEntry.set_sensitive(false); + + // Signals + nameEntry.changed.connect(() => { + + if(nameEntry.text.length <= 0) + wallpaperName = null; + else + wallpaperName = nameEntry.text; + }); + + typeComboBox.changed.connect(() => { + wallpaperType = typeComboBox.get_active_id(); + + if(wallpaperType == "image") { + + chooseFileButton.set_filter (imageFilter); + chooseFileLabel.label = "Where is the image located?"; + locationEntry.placeholder_text = "/Users/cheesecakeufo/my_picture.jpg"; + locationEntry.set_sensitive(false); + + revealer.set_reveal_child(false); + + chooseFileButton.show(); + + } else if(wallpaperType == "web_page") { + + chooseFileButton.set_filter (imageFilter); + chooseFileLabel.label = "What is the URL?"; + locationEntry.placeholder_text = "https://sample.com/random/{{screen_width}}x{{screen_height}}"; + locationEntry.set_sensitive(true); + + revealer.set_reveal_child(true); + + chooseFileButton.hide(); + + } else { + + chooseFileButton.set_filter (videoFilter); + chooseFileLabel.label = "Where is the video located?"; + locationEntry.placeholder_text = "/Users/cheesecakeufo/my_video.mp4"; + locationEntry.set_sensitive(false); + + revealer.set_reveal_child(true); + + chooseFileButton.show(); + } + + }); + + chooseFileButton.file_set.connect (() => { + + filePath = chooseFileButton.get_file().get_path(); + + }); + + + chooseThumbnailButton.file_set.connect (() => { + + thumbnailPath = chooseThumbnailButton.get_file().get_path(); + }); + + locationEntry.changed.connect(() => { + + if(locationEntry.text.length <= 0 || !locationEntry.text.contains("http")) + webPageUrl = null; + else + webPageUrl = locationEntry.text; + }); + + titleBox.add(titleLabel); + titleBox.add(aboutLabel); + + aboutGrid.attach(new Image.from_file("/System/Resources/Komorebi/wallpaper_creator.svg"), 0, 0, 1, 1); + aboutGrid.attach(titleBox, 1, 0, 1, 1); + + thumbnailBox.add(chooseThumbnailLabel); + thumbnailBox.add(chooseThumbnailButton); + + revealer.add(thumbnailBox); + + locationBox.pack_start(locationEntry); + locationBox.add(chooseFileButton); + + add(aboutGrid); + add(nameLabel); + add(nameEntry); + + add(typeLabel); + add(typeComboBox); + + add(chooseFileLabel); + add(locationBox); + + add(revealer); + } + } +} diff --git a/komorebi/extra/wallpaper-creator/OnScreen/NewWallpaperWindow.vala b/komorebi/extra/wallpaper-creator/OnScreen/NewWallpaperWindow.vala new file mode 100644 index 0000000..e9aa286 --- /dev/null +++ b/komorebi/extra/wallpaper-creator/OnScreen/NewWallpaperWindow.vala @@ -0,0 +1,247 @@ +// +// Copyright (C) 2017-2018 Abraham Masri @cheesecakeufo +// +// 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 3 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, see . +// + + +using Gtk; +using Gdk; + + +namespace WallpaperCreator.OnScreen { + + public class NewWallpaperWindow : Gtk.Window { + + // Custom headerbar + HeaderBar headerBar = new HeaderBar(); + + Button closeButton = new Button.with_label("Close"); + Button addLayerButton = new Button.with_label("Add Layer") { visible = false }; + + Button nextButton = new Button.with_label("Next"); + + // Confirmation popover + Popover popover = new Popover(null); + Grid popoverGrid = new Grid(); + Label confirmationLabel = new Label("Are you sure?"); + Button cancelButton = new Button.with_label("Cancel"); + Button yesButton = new Button.with_label("Yes"); + + Gtk.Box mainBox = new Box(Orientation.VERTICAL, 0); + + // Used as a display for errors + Gtk.Revealer revealer = new Revealer(); + Gtk.InfoBar infoBar = new Gtk.InfoBar () { message_type = MessageType.ERROR }; + Gtk.Label errorLabel = new Label(""); + + Stack stack = new Stack(); + + OptionsPage optionsPage; + + /* Add some style */ + string CSS = " + *{ + background-color: rgba(0, 0, 0, 0.6); + box-shadow: none; + color: white; + border-width: 0px; + } + "; + + string headerCSS = " + *{ + background-color: rgba(0, 0, 0, 0); + box-shadow: none; + color: white; + border-width: 0px; + } + "; + + + public NewWallpaperWindow () { + + title = "New Komorebi Wallpaper"; + set_size_request(1050, 700); + resizable = false; + window_position = WindowPosition.CENTER; + set_titlebar(headerBar); + applyCSS({mainBox}, CSS); + applyCSS({headerBar}, headerCSS); + addAlpha({this}); + + // Properties + closeButton.margin_top = 6; + closeButton.margin_start = 6; + closeButton.halign = Align.START; + + addLayerButton.margin_top = 6; + addLayerButton.margin_start = 6; + addLayerButton.halign = Align.START; + + nextButton.margin_top = 6; + nextButton.margin_end = 6; + + popover.set_relative_to(closeButton); + + popoverGrid.margin = 15; + popoverGrid.row_spacing = 20; + popoverGrid.column_spacing = 5; + + revealer.set_transition_duration(200); + revealer.set_transition_type(RevealerTransitionType.SLIDE_DOWN); + + stack.set_transition_duration(400); + stack.set_transition_type(StackTransitionType.SLIDE_LEFT); + + // Signals + closeButton.released.connect(() => { + popover.show_all(); + }); + + addLayerButton.released.connect(() => { + + Gtk.FileChooserDialog fileChooseDialog = new Gtk.FileChooserDialog ( + "Select an image", this, Gtk.FileChooserAction.OPEN, + "Cancel", Gtk.ResponseType.CANCEL, + "Open", Gtk.ResponseType.ACCEPT + ); + + FileFilter filter = new FileFilter(); + filter.add_mime_type ("image/*"); + + fileChooseDialog.set_filter (filter); + + if (fileChooseDialog.run () == Gtk.ResponseType.ACCEPT) { + assetPath = fileChooseDialog.get_file().get_path(); + optionsPage.setAsset(assetPath); + } + + fileChooseDialog.close (); + }); + + nextButton.released.connect(() => { + + var currentPage = stack.get_visible_child_name(); + + if(currentPage == "initial") { + + if(wallpaperName == null || (wallpaperType == "image" || wallpaperType == "video") && filePath == null) { + + displayError("Please enter a wallpaper name and choose a file"); + return; + + } else if (wallpaperName == null || wallpaperType == "web_page" && webPageUrl == null) { + + displayError("Please enter a wallpaper name, a valid URL, and a thumbnail"); + return; + } + + + optionsPage = new OptionsPage(); + + if(wallpaperType == "image") { + + addLayerButton.visible = true; + optionsPage.setImage(filePath); + + } else { + addLayerButton.visible = false; + optionsPage.setImage("/System/Resources/Komorebi/blank.svg"); + } + + stack.add_named(optionsPage, "options"); + + optionsPage.show_all(); + + stack.set_visible_child_name("options"); + revealer.set_reveal_child(false); + } else { + + optionsPage.updateUI(); + stack.add_named(new FinalPage(), "final"); + + show_all(); + + stack.set_visible_child_name("final"); + closeButton.visible = false; + nextButton.visible = false; + addLayerButton.visible = false; + + } + + }); + + cancelButton.released.connect(() => popover.hide()); + yesButton.released.connect(() => Gtk.main_quit()); + + // Add Widgets + headerBar.add(closeButton); + headerBar.add(addLayerButton); + headerBar.pack_end(nextButton); + + popoverGrid.attach(confirmationLabel, 0, 0); + popoverGrid.attach(cancelButton, 0, 1); + popoverGrid.attach(yesButton, 1, 1); + + popover.add(popoverGrid); + + infoBar.get_content_area().add(errorLabel); + revealer.add(infoBar); + + stack.add_named(new InitialPage(), "initial"); + + mainBox.add(revealer); + mainBox.add(stack); + + add(mainBox); + show_all(); + + // Post-Show options + addLayerButton.visible = false; + + } + + private void displayError(string errorMessage) { + + errorLabel.label = errorMessage; + revealer.set_reveal_child(true); + } + + } + + + /* TAKEN FROM ACIS --- Until Acis is public */ + /* Applies CSS theming for specified GTK+ Widget */ + public void applyCSS (Widget[] widgets, string CSS) { + + var Provider = new Gtk.CssProvider (); + Provider.load_from_data (CSS, -1); + + foreach(var widget in widgets) + widget.get_style_context().add_provider(Provider,-1); + + } + + + /* TAKEN FROM ACIS --- Until Acis is public */ + /* Allow alpha layer in the window */ + public void addAlpha (Widget[] widgets) { + + foreach(var widget in widgets) + widget.set_visual (widget.get_screen ().get_rgba_visual () ?? widget.get_screen ().get_system_visual ()); + + } + +} diff --git a/komorebi/extra/wallpaper-creator/OnScreen/OptionsPage.vala b/komorebi/extra/wallpaper-creator/OnScreen/OptionsPage.vala new file mode 100644 index 0000000..dfb96bf --- /dev/null +++ b/komorebi/extra/wallpaper-creator/OnScreen/OptionsPage.vala @@ -0,0 +1,423 @@ +// +// Copyright (C) 2017-2018 Abraham Masri @cheesecakeufo +// +// 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 3 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, see . +// + +using Gtk; +using Gdk; + +namespace WallpaperCreator.OnScreen { + + public class OptionsPage : Box { + + // Contains the wallpaper image with buttons + Gtk.Box wallpaperBox = new Box(Orientation.VERTICAL, 10); + Overlay overlay = new Overlay(); + Image wallpaperImage = new Image(); + Box dateTimeBox = new Box(Orientation.VERTICAL, 5); + Label timeLabel = new Label(""); + Label dateLabel = new Label(""); + Image assetImage = new Image(); + + // List of long options + ScrolledWindow scrolledWindow = new ScrolledWindow(null, null); + Box optionsBox = new Box(Orientation.VERTICAL, 10); + + Label wallpaperTitleLabel = new Label(""); + + ComboBoxText wallpaperParallaxComboBox = new ComboBoxText(); + + Label dateTimeTitleLabel = new Label("") {margin_top = 15}; + + ComboBoxText dateTimeVisibleComboBox = new ComboBoxText(); + + ComboBoxText dateTimeParallaxComboBox = new ComboBoxText(); + + Label dateTimeMarginsLabel = new Label("Margins:"); + Grid dateTimeMarginsGrid = new Grid(); + SpinButton dateTimeMarginLeftEntry = new SpinButton.with_range(0,2000, 5); + SpinButton dateTimeMarginRightEntry = new SpinButton.with_range(0,2000, 5); + SpinButton dateTimeMarginTopEntry = new SpinButton.with_range(0,2000, 5); + SpinButton dateTimeMarginBottomEntry = new SpinButton.with_range(0,2000, 5); + + Label dateTimePositionLabel = new Label("Position:"); + ComboBoxText dateTimePositionComboBox = new ComboBoxText(); + + Label dateTimeAlignmentLabel = new Label("Alignment:"); + ComboBoxText dateTimeAlignmentComboBox = new ComboBoxText(); + + ComboBoxText dateTimeAlwaysOnTopComboBox = new ComboBoxText(); + + Label dateTimeColorLabel = new Label("Color and Alpha:"); + Box dateTimeColorBox = new Box(Orientation.HORIZONTAL, 10); + ColorButton dateTimeColorButton = new ColorButton.with_rgba({222, 222, 222, 255}); + SpinButton dateTimeAlphaEntry = new SpinButton.with_range(0, 255, 1) { value = 255 }; + + Label dateTimeShadowColorLabel = new Label("Shadow Color and Alpha:"); + Box dateTimeShadowColorBox = new Box(Orientation.HORIZONTAL, 10); + ColorButton dateTimeShadowColorButton = new ColorButton.with_rgba({222, 222, 222, 255}); + SpinButton dateTimeShadowAlphaEntry = new SpinButton.with_range(0, 255, 1) { value = 255 }; + + Label timeFontLabel = new Label("Time Font:"); + FontButton timeFontButton = new FontButton.with_font("Lato Light 30") { use_font = true }; + + Label dateFontLabel = new Label("Date Font:"); + FontButton dateFontButton = new FontButton.with_font("Lato Light 20") { use_font = true }; + + // Asset (Layer) + Label assetTitleLabel = new Label("") {margin_top = 15}; + + ComboBoxText assetVisibleComboBox = new ComboBoxText(); + + Label assetAnimationLabel = new Label("Animation Mode & Speed:"); + Box assetAnimationBox = new Box(Orientation.HORIZONTAL, 10); + ComboBoxText assetModeComboBox = new ComboBoxText(); + SpinButton assetSpeedEntry = new SpinButton.with_range(100, 1000, 1); + + public OptionsPage() { + + spacing = 10; + orientation = Orientation.HORIZONTAL; + halign = Align.CENTER; + valign = Align.CENTER; + hexpand = true; + vexpand = true; + + wallpaperBox.margin = 20; + wallpaperBox.margin_end = 0; + wallpaperBox.valign = Align.CENTER; + wallpaperBox.halign = Align.START; + + dateTimeBox.hexpand = true; + dateTimeBox.vexpand = true; + dateTimeBox.halign = Align.CENTER; + dateTimeBox.valign = Align.CENTER; + + scrolledWindow.hscrollbar_policy = PolicyType.NEVER; + + optionsBox.margin = 20; + optionsBox.margin_start = 0; + optionsBox.halign = Align.START; + optionsBox.hexpand = true; + + wallpaperTitleLabel.set_markup("Wallpaper Options:"); + + wallpaperParallaxComboBox.append("enable", "Enable parallax"); + wallpaperParallaxComboBox.append("disable", "Disable parallax"); + wallpaperParallaxComboBox.active = 1; + + dateTimeTitleLabel.set_markup("Date & Time Options:"); + + dateTimeVisibleComboBox.append("show", "Show date & time"); + dateTimeVisibleComboBox.append("hide", "Hide date & time"); + dateTimeVisibleComboBox.active = 0; + + dateTimeParallaxComboBox.append("enable", "Enable parallax"); + dateTimeParallaxComboBox.append("disable", "Disable parallax"); + dateTimeParallaxComboBox.active = 1; + + dateTimePositionComboBox.append_text("Top Left"); + dateTimePositionComboBox.append_text("Top Center"); + dateTimePositionComboBox.append_text("Top Right"); + dateTimePositionComboBox.append_text("Center Left"); + dateTimePositionComboBox.append_text("Center"); + dateTimePositionComboBox.append_text("Center Right"); + dateTimePositionComboBox.append_text("Bottom Left"); + dateTimePositionComboBox.append_text("Bottom Center"); + dateTimePositionComboBox.append_text("Bottom Right"); + dateTimePositionComboBox.active = 4; + + dateTimeAlignmentComboBox.append_text("Start"); + dateTimeAlignmentComboBox.append_text("Center"); + dateTimeAlignmentComboBox.append_text("End"); + dateTimeAlignmentComboBox.active = 1; + + dateTimeAlwaysOnTopComboBox.append("enable", "Always show on top"); + dateTimeAlwaysOnTopComboBox.append("disable", "Show under layer"); + dateTimeAlwaysOnTopComboBox.active = 0; + + assetTitleLabel.set_markup("Layer Options:"); + + assetVisibleComboBox.append("show", "Show layer"); + assetVisibleComboBox.append("hide", "Hide layer"); + assetVisibleComboBox.active = 0; + + + assetModeComboBox.append("noanimation", "No Animation"); + assetModeComboBox.append("light", "Glowing Light"); + assetModeComboBox.append("clouds", "Moving Clouds"); + assetModeComboBox.active = 0; + + // Signals + wallpaperParallaxComboBox.changed.connect(() => updateUI()); + dateTimeVisibleComboBox.changed.connect(() => updateUI()); + dateTimeParallaxComboBox.changed.connect(() => updateUI()); + dateTimeMarginTopEntry.changed.connect(() => updateUI()); + dateTimeMarginRightEntry.changed.connect(() => updateUI()); + dateTimeMarginLeftEntry.changed.connect(() => updateUI()); + dateTimeMarginBottomEntry.changed.connect(() => updateUI()); + dateTimePositionComboBox.changed.connect(() => updateUI()); + dateTimeAlignmentComboBox.changed.connect(() => updateUI()); + dateTimeColorButton.color_set.connect(() => updateUI()); + dateTimeAlphaEntry.changed.connect(() => updateUI()); + timeFontButton.font_set.connect(() => updateUI()); + dateFontButton.font_set.connect(() => updateUI()); + + // Add widgets + dateTimeBox.add(timeLabel); + dateTimeBox.add(dateLabel); + + overlay.add(wallpaperImage); + overlay.add_overlay(dateTimeBox); + overlay.add_overlay(assetImage); + + wallpaperBox.add(overlay); + + dateTimeMarginsGrid.attach(dateTimeMarginTopEntry, 0, 0); + dateTimeMarginsGrid.attach(dateTimeMarginRightEntry, 0, 1); + dateTimeMarginsGrid.attach(dateTimeMarginLeftEntry, 1, 0); + dateTimeMarginsGrid.attach(dateTimeMarginBottomEntry, 1, 1); + + if(wallpaperType == "image") { + optionsBox.add(wallpaperTitleLabel); + optionsBox.add(wallpaperParallaxComboBox); + } + + optionsBox.add(dateTimeTitleLabel); + + optionsBox.add(dateTimeVisibleComboBox); + optionsBox.add(dateTimeParallaxComboBox); + + optionsBox.add(dateTimePositionLabel); + optionsBox.add(dateTimePositionComboBox); + + optionsBox.add(dateTimeMarginsLabel); + optionsBox.add(dateTimeMarginsGrid); + + optionsBox.add(dateTimeAlignmentLabel); + optionsBox.add(dateTimeAlignmentComboBox); + + optionsBox.add(dateTimeAlwaysOnTopComboBox); + + // Date time + optionsBox.add(dateTimeColorLabel); + + dateTimeColorBox.add(dateTimeColorButton); + dateTimeColorBox.add(dateTimeAlphaEntry); + + optionsBox.add(dateTimeColorBox); + + // Date time shadow + optionsBox.add(dateTimeShadowColorLabel); + + dateTimeShadowColorBox.add(dateTimeShadowColorButton); + dateTimeShadowColorBox.add(dateTimeShadowAlphaEntry); + + optionsBox.add(dateTimeShadowColorBox); + + // Time Font + optionsBox.add(timeFontLabel); + optionsBox.add(timeFontButton); + + // Date Font + optionsBox.add(dateFontLabel); + optionsBox.add(dateFontButton); + + + + if(wallpaperType == "image") { + + optionsBox.add(assetTitleLabel); + optionsBox.add(assetVisibleComboBox); + optionsBox.add(assetAnimationLabel); + assetAnimationBox.add(assetModeComboBox); + assetAnimationBox.add(assetSpeedEntry); + optionsBox.add(assetAnimationBox); + } + + scrolledWindow.add(optionsBox); + + pack_start(wallpaperBox); + pack_start(scrolledWindow); + + // Post-show options + setDateTimeLabel(); + + foreach(var child in optionsBox.get_children()) + child.halign = Align.START; + } + + public void updateUI () { + + + wallpaperParallax = wallpaperParallaxComboBox.get_active_id() == "enable"; + + showDateTime = dateTimeVisibleComboBox.get_active_id() == "show"; + dateTimeParallax = dateTimeParallaxComboBox.get_active_id() == "enable"; + + marginTop = dateTimeMarginTopEntry.text.to_int(); + marginRight = dateTimeMarginRightEntry.text.to_int(); + marginLeft = dateTimeMarginLeftEntry.text.to_int(); + marginBottom = dateTimeMarginBottomEntry.text.to_int(); + + dateTimeBox.opacity = showDateTime ? 255 : 0; + dateTimeBox.visible = false; + + // Margins + dateTimeBox.margin_top = marginTop; + dateTimeBox.margin_end = marginRight; + dateTimeBox.margin_start = marginLeft; + dateTimeBox.margin_bottom = marginBottom; + + setPosition(); + setAlignment(); + + dateTimeAlwaysOnTop = dateTimeAlwaysOnTopComboBox.get_active_id() == "enable"; + + setColor(); + setFonts(); + setOpacity(); + + showAsset = assetVisibleComboBox.get_active_id() == "show"; + assetImage.opacity = showAsset ? 255 : 0; + + setAnimationMode(); + animationSpeed = assetSpeedEntry.text.to_int(); + + setDateTimeLabel(dateTimeColor, timeFont, dateFont); + show_all(); + } + + public void setPosition() { + + var active = dateTimePositionComboBox.get_active_text(); + + position = active.replace(" ", "_").down(); + + switch (active) { + + case "Top Left": + dateTimeBox.halign = Align.START; + dateTimeBox.valign = Align.START; + break; + case "Top Center": + dateTimeBox.halign = Align.CENTER; + dateTimeBox.valign = Align.START; + break; + case "Top Right": + dateTimeBox.halign = Align.END; + dateTimeBox.valign = Align.START; + break; + case "Center Right": + dateTimeBox.halign = Align.END; + dateTimeBox.valign = Align.CENTER; + break; + + case "Center": + dateTimeBox.halign = Align.CENTER; + dateTimeBox.valign = Align.CENTER; + break; + + case "Center Left": + dateTimeBox.halign = Align.START; + dateTimeBox.valign = Align.CENTER; + break; + + case "Bottom Right": + dateTimeBox.halign = Align.END; + dateTimeBox.valign = Align.END; + break; + + case "Bottom Center": + dateTimeBox.halign = Align.CENTER; + dateTimeBox.valign = Align.END; + break; + + case "Bottom Left": + dateTimeBox.halign = Align.START; + dateTimeBox.valign = Align.END; + break; + + default: + break; + } + } + + + public void setAlignment() { + + alignment = dateTimeAlignmentComboBox.get_active_text().down(); + + if(alignment == "start") + timeLabel.halign = Align.START; + else if(alignment == "center") + timeLabel.halign = Align.CENTER; + else + timeLabel.halign = Align.END; + } + + private void setColor() { + + RGBA rgba = dateTimeColorButton.rgba; + dateTimeColor = rgbaToHex(rgba); + + rgba = dateTimeShadowColorButton.rgba; + shadowColor = rgbaToHex(rgba); + } + + private void setFonts() { + + timeFont = timeFontButton.get_font_name (); + dateFont = dateFontButton.get_font_name (); + } + + private void setOpacity() { + + var alpha = dateTimeAlphaEntry.text.to_double(); + timeLabel.opacity = dateLabel.opacity = alpha / 255; + dateTimeAlpha = (int) alpha; + + alpha = dateTimeShadowAlphaEntry.text.to_int(); + shadowAlpha = (int)alpha; + } + + public void setImage(string path) { + + wallpaperImage.pixbuf = new Pixbuf.from_file_at_scale(path, 600, 400, true); + } + + public void setAsset(string path) { + + assetImage.pixbuf = new Pixbuf.from_file_at_scale(path, 600, 400, true); + } + + public void setAnimationMode() { + + animationMode = assetModeComboBox.get_active_id(); + + } + + private void setDateTimeLabel(string color = "white", string timeFont = "Lato Light 30", + string dateFont = "Lato Light 20") { + + timeLabel.set_markup(@"10:21 PM"); + dateLabel.set_markup(@"Sunday, August 22"); + } + + private string rgbaToHex(RGBA rgba) { + return "#%02x%02x%02x".printf((int)(rgba.red*255), (int)(rgba.green*255), (int)(rgba.blue*255)); + } + } +} diff --git a/komorebi/screenshots/collage.jpg b/komorebi/screenshots/collage.jpg new file mode 100644 index 0000000..1e91783 Binary files /dev/null and b/komorebi/screenshots/collage.jpg differ diff --git a/komorebi/screenshots/komorebi-icon.png b/komorebi/screenshots/komorebi-icon.png new file mode 100644 index 0000000..dec3789 Binary files /dev/null and b/komorebi/screenshots/komorebi-icon.png differ diff --git a/komorebi/screenshots/preferences.jpg b/komorebi/screenshots/preferences.jpg new file mode 100644 index 0000000..c1c7b66 Binary files /dev/null and b/komorebi/screenshots/preferences.jpg differ diff --git a/komorebi/screenshots/wallpaper_creator.jpg b/komorebi/screenshots/wallpaper_creator.jpg new file mode 100644 index 0000000..57e7e1a Binary files /dev/null and b/komorebi/screenshots/wallpaper_creator.jpg differ diff --git a/komorebi/src/Main.vala b/komorebi/src/Main.vala new file mode 100644 index 0000000..af13205 --- /dev/null +++ b/komorebi/src/Main.vala @@ -0,0 +1,88 @@ +// +// Copyright (C) 2016-2017 Abraham Masri +// +// 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 3 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, see . +// + +using Komorebi.OnScreen; +using Komorebi.Utilities; + +namespace Komorebi { + + BackgroundWindow[] backgroundWindows; + + public static bool checkDesktopCompatible() { + + // We're not supporting Wayland at the moment + // due to some restrictions + if(Environment.get_variable ("XDG_SESSION_DESKTOP").contains("wayland")) { + return false; + } + + return true; + } + + public static void main (string [] args) { + + print("Welcome to Komorebi\n"); + + if(args[1] == "--version" || args[1] == "version") { + print("Version: 2.1 - Summit\nCreated by: Abraham Masri @cheesecakeufo\n\n"); + return; + } + + if(!checkDesktopCompatible()) { + print("[ERROR]: Wayland detected. Not supported (yet) :(\n"); + print("[INFO]: Contribute to Komorebi and add the support! <3\n"); + return; + } + + GtkClutter.init (ref args); + Gtk.init (ref args); + + readConfigurationFile(); + + if(OnScreen.enableVideoWallpapers) { + + print("[INFO]: loading Gst\n"); + Gst.init (ref args); + } + + Gtk.Settings.get_default().gtk_application_prefer_dark_theme = true; + + var screen = Gdk.Screen.get_default (); + int monitorCount = screen.get_n_monitors(); + + + initializeClipboard(screen); + + readWallpaperFile(); + + backgroundWindows = new BackgroundWindow[monitorCount]; + for (int i = 0; i < monitorCount; ++i) + backgroundWindows[i] = new BackgroundWindow(i); + + + var mainSettings = Gtk.Settings.get_default (); + // mainSettings.set("gtk-xft-dpi", (int) (1042 * 100), null); + mainSettings.set("gtk-xft-antialias", 1, null); + mainSettings.set("gtk-xft-rgba" , "none", null); + mainSettings.set("gtk-xft-hintstyle" , "slight", null); + + for (int i = 0; i < monitorCount; ++i) + backgroundWindows[i].fadeIn(); + + Clutter.main(); + } +} diff --git a/komorebi/src/OnScreen/AssetActor.vala b/komorebi/src/OnScreen/AssetActor.vala new file mode 100644 index 0000000..2b0b3b5 --- /dev/null +++ b/komorebi/src/OnScreen/AssetActor.vala @@ -0,0 +1,197 @@ +// +// Copyright (C) 2015-2018 Abraham Masri @cheesecakeufo +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License version 3, as published +// by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranties of +// MERCHANTABILITY, SATISFACTORY QUALITY, 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, see + +using Clutter; + +using Komorebi.Utilities; + +namespace Komorebi.OnScreen { + + public class AssetActor : Actor { + + BackgroundWindow parent; + + // Image(Asset) and its pixbuf + Image image = new Image(); + Gdk.Pixbuf pixbuf; + + public uint assetAnimationTimeout; + + // Animation-specific variables + string cloudsDirection = "right"; + string fadeType = "in"; + + public AssetActor (BackgroundWindow parent) { + this.parent = parent; + set_content(image); + } + + public void setAsset() { + + if(!assetVisible) { + pixbuf = null; + image.set_data (pixbuf.get_pixels(), pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888, + pixbuf.get_width(), pixbuf.get_height(), + pixbuf.get_rowstride()); + fadeOut(); + return; + } + + if(assetWidth <= 0) + assetWidth = screenWidth; + if(assetHeight <= 0) + assetHeight = screenHeight; + + var assetPath = @"/System/Resources/Komorebi/$wallpaperName/assets.png"; + + // make sure the asset exists + if(!File.new_for_path(assetPath).query_exists()) { + print(@"[WARNING]: asset with path: $assetPath does not exist\n"); + return; + } + + if(assetWidth != 0 && assetHeight != 0) + pixbuf = new Gdk.Pixbuf.from_file_at_scale(assetPath, assetWidth, assetHeight, false); + else + pixbuf = new Gdk.Pixbuf.from_file(assetPath); + + image.set_data (pixbuf.get_pixels(), pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888, + pixbuf.get_width(), pixbuf.get_height(), + pixbuf.get_rowstride()); + + + x = 0; + y = 0; + opacity = 255; + remove_all_transitions(); + + setMargins(); + + if(shouldAnimate()) + animate(); + else + fadeIn(); + } + + void setMargins() { + + translation_y = 0; + translation_x = 0; + + translation_y += assetMarginTop; + translation_x -= assetMarginRight; + translation_x += assetMarginLeft; + translation_y -= assetMarginBottom; + } + + void animate () { + + if(assetAnimationSpeed <= 10) { + assetAnimationSpeed = 100; + print("[WARNING]: The Asset Animation Speed has been adjusted in this wallpaper. Please consider updating it to at least 100\n"); + } + + + assetAnimationTimeout = Timeout.add(assetAnimationSpeed * 30, () => { + + switch (assetAnimationMode) { + + case "clouds": + if(cloudsDirection == "right") { + + if(x + (width / 2) >= screenWidth) + cloudsDirection = "left"; + else { + save_easing_state (); + set_easing_duration (assetAnimationSpeed * 100); + x += 60; + set_easing_mode (Clutter.AnimationMode.LINEAR); + restore_easing_state (); + } + + } else { + + if(x <= 0) + cloudsDirection = "right"; + else { + save_easing_state (); + set_easing_duration (assetAnimationSpeed * 100); + x -= 60; + set_easing_mode (Clutter.AnimationMode.LINEAR); + restore_easing_state (); + } + } + + break; + + case "light": + + if(fadeType == "in") { + fadeIn(assetAnimationSpeed * 100); + fadeType = "out"; + } else { + fadeOut(assetAnimationSpeed * 100); + fadeType = "in"; + } + + + break; + } + + return true; + }); + } + + public void fadeIn (int custom_duration = 90) { + + save_easing_state (); + set_easing_duration (custom_duration); + opacity = 255; + set_easing_mode (Clutter.AnimationMode.LINEAR); + restore_easing_state (); + } + + public void fadeOut (int custom_duration = 90) { + + save_easing_state (); + set_easing_duration (custom_duration); + opacity = 0; + set_easing_mode (Clutter.AnimationMode.LINEAR); + restore_easing_state (); + } + + public bool shouldAnimate () { + + if(wallpaperType == "video" || + wallpaperType == "web_page" || + assetAnimationMode == "noanimation") { + + if(assetAnimationTimeout > 0) { + + Source.remove(assetAnimationTimeout); + assetAnimationTimeout = 0; + } + + remove_all_transitions(); + fadeOut(); + + return false; + } + + return true; + } + + } +} diff --git a/komorebi/src/OnScreen/BackgroundWindow.vala b/komorebi/src/OnScreen/BackgroundWindow.vala new file mode 100644 index 0000000..36e151d --- /dev/null +++ b/komorebi/src/OnScreen/BackgroundWindow.vala @@ -0,0 +1,437 @@ +// +// Copyright (C) 2017-2018 Abraham Masri @cheesecakeufo +// +// 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 3 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, see . +// + + +using Gtk; +using Gdk; +using Gst; +using WebKit; + +using Komorebi.Utilities; + +namespace Komorebi.OnScreen { + + // Global - Name of active wallpaper + string wallpaperName; + + // Global - 24 hr time + bool timeTwentyFour; + + // Global - Show desktop Icons + bool showDesktopIcons; + + // Global - Enable Video Wallpapers + bool enableVideoWallpapers; + + // Global - Whether we can open preferences window + bool canOpenPreferences = true; + + // Global - Clipboard + Gtk.Clipboard clipboard; + + public static void initializeClipboard(Gdk.Screen screen) { + clipboard = Gtk.Clipboard.get_for_display (screen.get_display (), Gdk.SELECTION_CLIPBOARD); + } + + public class BackgroundWindow : Gtk.Window { + + // this webview acts as a wallpaper (if necessary) + WebView webView = new WebView(); + GtkClutter.Actor webViewActor; + + GtkClutter.Embed embed; + + // Main container + public Clutter.Actor mainActor { get; private set; } + + // Video Wallpaper + ClutterGst.Playback videoPlayback; + ClutterGst.Content videoContent; + + // Wallpaper pixbuf & image + Clutter.Actor wallpaperActor = new Clutter.Actor(); + Pixbuf wallpaperPixbuf; + Clutter.Image wallpaperImage = new Clutter.Image(); + + // Date and time box itself + DateTimeBox dateTimeBox; + + // Asset Actor + AssetActor assetActor; + + // Bubble menu + public BubbleMenu bubbleMenu { get; private set; } + + // Desktop icons + public DesktopIcons desktopIcons { get; private set; } + + // Current animation mode + bool dateTimeBoxParallax = false; + + // Gradient bg animation (if available) + string gradientBackground = ""; + + const TargetEntry[] targets = { + { "text/uri-list", 0, 0} + }; + + + public BackgroundWindow (int monitorIndex) { + + title = "Desktop"; + + // Get current monitor size + getMonitorSize(monitorIndex); + + embed = new GtkClutter.Embed() {width_request = screenWidth, height_request = screenHeight}; + mainActor = embed.get_stage(); + desktopPath = Environment.get_user_special_dir(UserDirectory.DESKTOP); + desktopIcons = monitorIndex == 0 ? new DesktopIcons(this) : null; + bubbleMenu = new BubbleMenu(this); + assetActor = new AssetActor(this); + dateTimeBox = new DateTimeBox(this); + webViewActor = new GtkClutter.Actor.with_contents(webView); + + if(enableVideoWallpapers) { + videoPlayback = new ClutterGst.Playback (); + videoContent = new ClutterGst.Content(); + videoPlayback.set_seek_flags (ClutterGst.SeekFlags.ACCURATE); + + videoContent.player = videoPlayback; + + videoPlayback.notify["progress"].connect(() => { + + if(videoPlayback.progress >= 1.0 && wallpaperType == "video") { + videoPlayback.progress = 0.0; + videoPlayback.playing = true; + } + + }); + } + + + // Setup widgets + set_size_request(screenWidth, screenHeight); + resizable = false; + set_type_hint(WindowTypeHint.DESKTOP); + set_keep_below(true); + app_paintable = false; + skip_pager_hint = true; + skip_taskbar_hint = true; + accept_focus = true; + stick (); + decorated = false; + add_events (EventMask.ENTER_NOTIFY_MASK | EventMask.POINTER_MOTION_MASK | EventMask.SMOOTH_SCROLL_MASK); + Gtk.drag_dest_set (this, Gtk.DestDefaults.MOTION | Gtk.DestDefaults.DROP, targets, Gdk.DragAction.MOVE); + + mainActor.background_color = Clutter.Color.from_string("black"); + + webViewActor.set_size(screenWidth, screenHeight); + wallpaperActor.set_size(screenWidth, screenHeight); + assetActor.set_size(screenWidth, screenHeight); + wallpaperActor.set_pivot_point (0.5f, 0.5f); + + // Add widgets + mainActor.add_child(wallpaperActor); + mainActor.add_child(dateTimeBox); + mainActor.add_child(assetActor); + + if(desktopIcons != null) + mainActor.add_child(desktopIcons); + + mainActor.add_child(bubbleMenu); + + // add the widgets + add(embed); + + initializeConfigFile(); + signalsSetup(); + + } + + void getMonitorSize(int monitorIndex) { + + Rectangle rectangle; + var screen = Gdk.Screen.get_default (); + + screen.get_monitor_geometry (monitorIndex, out rectangle); + + screenHeight = rectangle.height; + screenWidth = rectangle.width; + + move(rectangle.x, rectangle.y); + + } + + void signalsSetup () { + + button_release_event.connect((e) => { + + // Hide the bubble menu + if(bubbleMenu.opacity > 0) { + bubbleMenu.fadeOut(); + unDimWallpaper(); + return true; + } + + // Show options + if(e.button == 3) { + + if(bubbleMenu.opacity > 0) + return false; + + if(desktopIcons != null) + if(e.x >= desktopIcons.x && e.x <= (desktopIcons.x + desktopIcons.width) && + e.y >= desktopIcons.y && e.y <= (desktopIcons.y + desktopIcons.height)) + return false; + + bubbleMenu.fadeIn(e.x, e.y, MenuType.DESKTOP); + dimWallpaper(); + } + + return false; + }); + + motion_notify_event.connect((event) => { + + // No parallax when menu is open + if(bubbleMenu.opacity > 0) { + return true; + } + + var layer_coeff = 70; + + if(dateTimeParallax) { + if(dateTimePosition == "center") { + dateTimeBox.x = (float)((mainActor.width - dateTimeBox.width) / 2 - (event.x - (mainActor.width / 2)) / layer_coeff); + dateTimeBox.y = (float)((mainActor.height - dateTimeBox.height) / 2 - (event.y - (mainActor.height / 2)) / layer_coeff); + } + } + + if(wallpaperParallax) { + wallpaperActor.x = (float)((mainActor.width - wallpaperActor.width) / 2 - (event.x - (mainActor.width / 2)) / layer_coeff); + wallpaperActor.y = (float)((mainActor.height - wallpaperActor.height) / 2 - (event.y - (mainActor.height / 2)) / layer_coeff); + } + + return true; + }); + + focus_out_event.connect(() => { + + // Hide the bubble menu + if(bubbleMenu.opacity > 0) { + bubbleMenu.fadeOut(); + unDimWallpaper(); + return true; + } + + return true; + }); + + drag_motion.connect(dimWallpaper); + + drag_leave.connect(() => unDimWallpaper()); + + drag_data_received.connect((widget, context, x, y, selectionData, info, time) => { + + foreach(var uri in selectionData.get_uris()) { + + // Path of the file + string filePath = uri.replace("file://","").replace("file:/",""); + filePath = GLib.Uri.unescape_string (filePath); + + // Get the actual GLib file + var file = File.new_for_path(filePath); + var desktopFile = File.new_for_path(desktopPath + "/" + file.get_basename()); + file.copy(desktopFile, FileCopyFlags.NONE, null); + } + + Gtk.drag_finish (context, true, false, time); + }); + + // disable interactions with webView + webView.button_press_event.connect(() => { + return true; + }); + + webView.button_release_event.connect((e) => { + + button_release_event(e); + return true; + }); + } + + public void initializeConfigFile () { + + setWallpaper(); + + if(desktopIcons != null) { + + if(!showDesktopIcons) + desktopIcons.fadeOut(); + else + desktopIcons.fadeIn(); + } + + if(dateTimeVisible) { + + if(dateTimeAlwaysOnTop) + mainActor.set_child_above_sibling(dateTimeBox, assetActor); + else + mainActor.set_child_below_sibling(dateTimeBox, assetActor); + + dateTimeBox.setDateTime(); + + } else + dateTimeBox.fadeOut(); + + if((wallpaperType != "video" && wallpaperType != "web_page") && assetVisible) + assetActor.setAsset(); + else + assetActor.shouldAnimate(); + } + + void setWallpaper() { + + var scaleWidth = screenWidth; + var scaleHeight = screenHeight; + + if(wallpaperParallax) { + + wallpaperActor.scale_y = 1.05f; + wallpaperActor.scale_x = 1.05f; + + } else { + + wallpaperActor.scale_y = 1.00f; + wallpaperActor.scale_x = 1.00f; + } + + if(enableVideoWallpapers) { + + if(wallpaperType == "video") { + + var videoPath = @"file:///System/Resources/Komorebi/$wallpaperName/$videoFileName"; + videoPlayback.uri = videoPath; + videoPlayback.playing = true; + + wallpaperActor.set_content(videoContent); + + return; + + } else { + + videoPlayback.playing = false; + videoPlayback.uri = ""; + } + } + + if (wallpaperType == "web_page") { + + wallpaperFromUrl(webPageUrl); + + wallpaperActor.set_content(null); + wallpaperPixbuf = null; + + if(webViewActor.get_parent() != wallpaperActor) + wallpaperActor.add_child(webViewActor); + + return; + + } else { + + // remove webViewActor + if(webViewActor.get_parent() == wallpaperActor) + wallpaperActor.remove_child(webViewActor); + } + + wallpaperActor.set_content(wallpaperImage); + + wallpaperPixbuf = new Gdk.Pixbuf.from_file_at_scale(@"/System/Resources/Komorebi/$wallpaperName/wallpaper.jpg", + scaleWidth, scaleHeight, false); + + wallpaperImage.set_data (wallpaperPixbuf.get_pixels(), Cogl.PixelFormat.RGB_888, + wallpaperPixbuf.get_width(), wallpaperPixbuf.get_height(), + wallpaperPixbuf.get_rowstride()); + } + + public bool dimWallpaper () { + + wallpaperActor.save_easing_state (); + wallpaperActor.set_easing_duration (400); + wallpaperActor.opacity = 100; + wallpaperActor.set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + wallpaperActor.restore_easing_state (); + + assetActor.opacity = 0; + dateTimeBox.opacity = 0; + + return true; + } + + bool unDimWallpaper () { + + wallpaperActor.save_easing_state (); + wallpaperActor.set_easing_duration (400); + wallpaperActor.opacity = 255; + wallpaperActor.set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + wallpaperActor.restore_easing_state (); + + if(assetVisible) + assetActor.opacity = 255; + dateTimeBox.fadeIn(200); + + if(desktopIcons != null) { + if(!showDesktopIcons) + desktopIcons.fadeOut(); + else + desktopIcons.fadeIn(); + } + + return true; + } + + // loads a web page from a URL + public void wallpaperFromUrl(owned string url) { + + url = url.replace("{{screen_width}}", @"$screenWidth").replace("{{screen_height}}", @"$screenHeight"); + + webView.load_uri(url); + } + + /* Shows the window */ + public void fadeIn() { + + show_all(); + dateTimeBox.setPosition(); + + if(desktopIcons != null) + desktopIcons.addIconsFromQueue(); + + } + + public bool contains_point(int x, int y) { + int wl, wt, wr, wb; + get_position(out wl, out wt); + get_size(out wr, out wb); + wr += wl; + wb += wt; + + return (x >= wl && y >= wt && x < wr && y < wb); + } + } +} diff --git a/komorebi/src/OnScreen/BubbleMenu.vala b/komorebi/src/OnScreen/BubbleMenu.vala new file mode 100644 index 0000000..a5d7c3a --- /dev/null +++ b/komorebi/src/OnScreen/BubbleMenu.vala @@ -0,0 +1,270 @@ +// +// Copyright (C) 2015-2016 Abraham Masri @cheesecakeufo +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License version 3, as published +// by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranties of +// MERCHANTABILITY, SATISFACTORY QUALITY, 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, see + +using Clutter; + +using Komorebi.Utilities; + +namespace Komorebi.OnScreen { + + public enum MenuType { + DESKTOP, + ICON + + } + + public class BubbleMenu : Actor { + + BackgroundWindow parent; + + // Horizontal Box Layout + BoxLayout horizontalBoxLayout = new BoxLayout() {orientation = Orientation.VERTICAL, spacing = 5}; + + // Bubble items (Desktop) + BubbleMenuItem newFolderMenuItem; + BubbleMenuItem refreshMenuItem; + BubbleMenuItem pasteMenuItem; + /*BubbleMenuItem hideAllWindowsMenuItem*/ + BubbleMenuItem changeWallpaperMenuItem; + BubbleMenuItem preferencesMenuItem; + + // Menu Items (Icon) + BubbleMenuItem moveToTrashMenuItem; + BubbleMenuItem copyMenuItem; + BubbleMenuItem makeAliasMenuItem; + BubbleMenuItem getInfoMenuItem; + + // Current icon (when right clicked) + OnScreen.Icon icon; + + // Type of this menu + MenuType menuType; + + construct { + + // Properties + opacity = 0; + + layout_manager = horizontalBoxLayout; + margin_top = 5; + margin_right = 5; + margin_left = 20; + margin_bottom = 5; + + } + + + public BubbleMenu (BackgroundWindow parent) { + this.parent = parent; + + // Desktop items + newFolderMenuItem = new BubbleMenuItem("New Folder"); + refreshMenuItem = new BubbleMenuItem("Refresh Wallpaper"); + pasteMenuItem = new BubbleMenuItem("Paste"); + changeWallpaperMenuItem = new BubbleMenuItem("Change Wallpaper"); + preferencesMenuItem = new BubbleMenuItem("Desktop Preferences"); + + // icon items + moveToTrashMenuItem = new BubbleMenuItem("Move to Trash"); + copyMenuItem = new BubbleMenuItem("Copy Path"); + makeAliasMenuItem = new BubbleMenuItem("Make Alias"); + getInfoMenuItem = new BubbleMenuItem("Get Info"); + + // Signals + signalsSetup(); + } + + void signalsSetup () { + + newFolderMenuItem.button_press_event.connect(() => { + parent.desktopIcons.createNewFolder(); + return true; + }); + + pasteMenuItem.button_press_event.connect(() => { + parent.desktopIcons.copyToDesktop(clipboard.wait_for_text()); + return true; + }); + + + refreshMenuItem.button_press_event.connect(() => { + + this.parent.wallpaperFromUrl(webPageUrl); + + return true; + }); + + changeWallpaperMenuItem.button_press_event.connect(() => { + + if(showDesktopIcons) + parent.desktopIcons.fadeOut(); + + fadeOut(); + + // Check if preferences window is already visible + if(canOpenPreferences) { + + canOpenPreferences = false; + new PreferencesWindow("wallpapers"); + + } + + return true; + }); + + preferencesMenuItem.button_press_event.connect(() => { + + // Check if preferences window is already visible + if(canOpenPreferences) { + + canOpenPreferences = false; + new PreferencesWindow(); + + } + return true; + }); + + + // Icon items + copyMenuItem.button_press_event.connect(() => { + + // Copy file/folder + clipboard.set_text(icon.filePath, icon.filePath.length); + clipboard.store(); + + return true; + }); + + moveToTrashMenuItem.button_press_event.connect(() => { + + icon.trash(); + + // Move file/folder to trash + var sourceFile = File.new_for_path(icon.filePath); + + try { + sourceFile.trash(); + } catch (Error e) { + + print ("Error deleting %s: %s\n", icon.titleName, e.message); + } + + return true; + }); + + getInfoMenuItem.button_press_event.connect(() => { + + // Display a window with file/directory info + infoWindow.setInfoFromPath(icon.filePath); + infoWindow.show_all(); + + return true; + }); + + } + + public void setIcon (OnScreen.Icon icon) { + + this.icon = icon; + + } + + public void fadeIn (double x, double y, MenuType menuType) { + + this.menuType = menuType; + + if(menuType == MenuType.ICON) { + + add_child(moveToTrashMenuItem); + add_child(copyMenuItem); + // add_child(makeAliasMenuItem); + add_child(getInfoMenuItem); + + } else { + + // Dim all icons + foreach (var icon in parent.desktopIcons.iconsList) + icon.dimIcon(); + + // Check if we have anything in the clipboard, + // if not, disable the 'Paste' menu item + var clipboardText = clipboard.wait_for_text (); + + if(clipboardText == "" || clipboardText == null) { + pasteMenuItem.opacity = 10; + pasteMenuItem.set_reactive(false); + } else { + pasteMenuItem.opacity = 255; + pasteMenuItem.set_reactive(true); + } + + // Hide 'New Folder' and 'Paste' item if we're not showing icons + if(showDesktopIcons) { + add_child(newFolderMenuItem); + add_child(pasteMenuItem); + } + + // If we have a web page wallpaper, show the 'refresh wallpaper' menu item + if(wallpaperType == "web_page") + add_child(refreshMenuItem); + + add_child(changeWallpaperMenuItem); + add_child(preferencesMenuItem); + + } + + // Make sure we don't display off the screen + if(x + 15 < 0) { + x = 0; + } else if (x >= screenWidth - width) { + x -= width + 15; + } + + if((y + height) >= parent.mainActor.height) + y -= (height + 10); + + opacity = 0; + this.x = (float)x; + this.y = (float)y; + + save_easing_state (); + set_easing_duration (90); + this.x += 15; + this.y += 15; + opacity = 255; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + } + + public void fadeOut () { + + save_easing_state (); + set_easing_duration (90); + scale_x = 0.9f; + scale_y = 0.9f; + opacity = 0; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + remove_all_children(); + + // Undim all icon + foreach (var icon in parent.desktopIcons.iconsList) + icon.unDimIcon(); + + icon = null; + } + } +} diff --git a/komorebi/src/OnScreen/BubbleMenuItem.vala b/komorebi/src/OnScreen/BubbleMenuItem.vala new file mode 100644 index 0000000..0c700dc --- /dev/null +++ b/komorebi/src/OnScreen/BubbleMenuItem.vala @@ -0,0 +1,69 @@ +// +// Copyright (C) 2015-2016 Abraham Masri @cheesecakeufo +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License version 3, as published +// by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranties of +// MERCHANTABILITY, SATISFACTORY QUALITY, 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, see + +using Gdk; +using Clutter; + +namespace Komorebi.OnScreen { + + public class BubbleMenuItem : Actor { + + public Text text = new Text(); + + public BubbleMenuItem (string title) { + + // Properties + set_reactive (true); + x_align = ActorAlign.START; + x_expand = true; + margin_top = 5; + + text.font_name = "Lato 15"; + text.text = title; + text.set_color(Clutter.Color.from_string("white")); + + // Signals + signalsSetup(); + + add_child(text); + + } + + void signalsSetup () { + + + button_press_event.connect((e) => { + + opacity = 100; + + return false; + }); + + motion_event.connect((e) => { + + opacity = 200; + + return false; + }); + + leave_event.connect((e) => { + + opacity = 255; + + return false; + }); + } + } +} diff --git a/komorebi/src/OnScreen/DateTimeBox.vala b/komorebi/src/OnScreen/DateTimeBox.vala new file mode 100644 index 0000000..8b2e6bf --- /dev/null +++ b/komorebi/src/OnScreen/DateTimeBox.vala @@ -0,0 +1,275 @@ +// +// Copyright (C) 2015-2016 Abraham Masri @cheesecakeufo +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License version 3, as published +// by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranties of +// MERCHANTABILITY, SATISFACTORY QUALITY, 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, see + +using Gtk; +using Cairo; + +using Komorebi.Utilities; + +namespace Komorebi.OnScreen { + + public class DateTimeBox : Clutter.Actor { + + public Clutter.Actor textContainerActor = new Clutter.Actor(); + public Clutter.Text timeText = new Clutter.Text(); + public Clutter.Text dateText = new Clutter.Text(); + + public Clutter.Actor shadowContainerActor = new Clutter.Actor(); + public Clutter.Text timeShadowText = new Clutter.Text(); + public Clutter.Text dateShadowText = new Clutter.Text(); + + // Vertical Box Layout + Clutter.BoxLayout boxLayout = new Clutter.BoxLayout() {orientation = Clutter.Orientation.VERTICAL}; + + // Time updater + public uint timeout; + + // Time format + string timeFormat = "%l:%M %p"; + + // Ability to drag + Clutter.DragAction dragAction = new Clutter.DragAction(); + + BackgroundWindow parent; + + public DateTimeBox (BackgroundWindow parent) { + + this.parent = parent; + + // Properties + textContainerActor.layout_manager = boxLayout; + shadowContainerActor.layout_manager = boxLayout; + + background_color = {0,0,0,0}; + opacity = 0; + reactive = true; + + textContainerActor.background_color = {0,0,0,0}; + shadowContainerActor.background_color = {0,0,0,0}; + + + timeText.x_expand = true; + timeText.y_expand = true; + + timeShadowText.x_expand = true; + timeShadowText.y_expand = true; + + // Signals + signalsSetup(); + + shadowContainerActor.add_effect(new Clutter.BlurEffect()); + + add_action (dragAction); + + textContainerActor.add_child(timeText); + textContainerActor.add_child(dateText); + + shadowContainerActor.add_child(timeShadowText); + shadowContainerActor.add_child(dateShadowText); + + add_child(shadowContainerActor); + add_child(textContainerActor); + } + + void signalsSetup () { + + dragAction.drag_end.connect ((actor, event_x, event_y) => { + + // Disable Parallax + dateTimeParallax = false; + + // Check if we're at the passing the edge of the screen + if(x < 0) { + moveTo(0); + } else if (x + width > screenWidth) { + moveTo(screenWidth - width, -1); + } + + if(y < 0) { + moveTo(-1, 0); + } else if (y + height > screenHeight) { + moveTo(-1, screenHeight - height); + } + }); + } + + public void setDateTime() { + + setAlignment(); + setRotation(); + + if(opacity < 1) + fadeIn(); + + opacity = dateTimeAlpha; + shadowContainerActor.opacity = dateTimeShadowAlpha; + + setPosition(); + + timeText.notify["width"].connect(() => { + + setPosition(); + setMargins(); + + }); + + if(timeout > 0) + return; // No need to rerun + + timeout = Timeout.add(200, () => { + + if(timeTwentyFour) + timeFormat = "%H:%M"; + else + timeFormat = "%l:%M %p"; + + var glibTime = new GLib.DateTime.now_local().format(timeFormat); + var glibDate = new GLib.DateTime.now_local().format("%A, %B %e"); + + timeText.set_markup(@"$glibTime"); + dateText.set_markup(@"$glibDate"); + + // Apply same to shadows + timeShadowText.set_markup(@"$glibTime"); + dateShadowText.set_markup(@"$glibDate"); + return true; + }); + } + + public void setAlignment() { + + if(dateTimeAlignment == "start") { + timeText.x_align = Clutter.ActorAlign.START; + timeShadowText.x_align = Clutter.ActorAlign.START; + } + else if(dateTimeAlignment == "center") { + timeText.x_align = Clutter.ActorAlign.CENTER; + timeShadowText.x_align = Clutter.ActorAlign.CENTER; + } + else { + timeText.x_align = Clutter.ActorAlign.END; + timeShadowText.x_align = Clutter.ActorAlign.END; + } + } + + public void setRotation() { + + rotation_angle_x = dateTimeRotationX; + rotation_angle_y = dateTimeRotationY; + rotation_angle_z = dateTimeRotationZ; + } + + public void setPosition() { + var mainActor = parent.mainActor; + + switch (dateTimePosition) { + + case "top_right": + x = mainActor.width - width; + y = 0; + break; + + case "top_center": + x = (mainActor.width / 2) - (width / 2); + y = 0; + break; + + case "top_left": + x = 0; + y = 0; + break; + + case "center_right": + x = mainActor.width - width; + y = (mainActor.height / 2) - (height / 2); + break; + + case "center": + x = (mainActor.width / 2) - (width / 2); + y = (mainActor.height / 2) - (height / 2); + break; + + case "center_left": + x = 0; + y = (mainActor.height / 2) - (height / 2); + break; + + case "bottom_right": + x = mainActor.width - width; + y = mainActor.height - height; + break; + + case "bottom_center": + x = (mainActor.width / 2) - (width / 2); + y = mainActor.height - height; + break; + + case "bottom_left": + x = 0; + y = mainActor.height - height; + break; + + default: + break; + } + } + + + public void setMargins() { + + translation_y = 0; + translation_x = 0; + + translation_y += dateTimeMarginTop; + translation_x -= dateTimeMarginRight; + translation_x += dateTimeMarginLeft; + translation_y -= dateTimeMarginBottom; + } + + + private void moveTo(float x = -1, float y = -1) { + + save_easing_state (); + set_easing_duration (90); + if(x != -1) this.x = x; + if(y != -1) this.y = y; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + } + + public void fadeIn (int custom_duration = 90) { + + save_easing_state (); + set_easing_duration (90); + opacity = dateTimeAlpha; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + reactive = true; + + } + + public void fadeOut () { + + save_easing_state (); + set_easing_duration (90); + opacity = 0; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + reactive = false; + } + } +} diff --git a/komorebi/src/OnScreen/DesktopIcons.vala b/komorebi/src/OnScreen/DesktopIcons.vala new file mode 100644 index 0000000..e37244e --- /dev/null +++ b/komorebi/src/OnScreen/DesktopIcons.vala @@ -0,0 +1,269 @@ +// +// Copyright (C) 2012-2017 Abraham Masri +// +// 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 3 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, see . +// +// +// Copied from ManagerForKedos - Abraham Masri +// + +using Gtk; +using Gee; +using Clutter; + +using Komorebi.Utilities; + +using GLib.Environment; + +namespace Komorebi.OnScreen { + + // File/Directory info Window + InfoWindow infoWindow; + + public class DesktopIcons : ResponsiveGrid { + + BackgroundWindow parent; + public BackgroundWindow window { get { return parent; } } + + /* Desktops path */ + string DesktopPath = Environment.get_user_special_dir(UserDirectory.DESKTOP); + + FileMonitor fileMonitor; + + // List of icons (used to make things faster when reloading) + public Gee.ArrayList iconsList { get; private set; } + + public DesktopIcons (BackgroundWindow parent) { + this.parent = parent; + + infoWindow = new InfoWindow(); + iconsList = new Gee.ArrayList(); + + margin_top = 60; + margin_left = 120; + y_expand = true; + iconSize = 64; + + monitorChanges(); + getDesktops(); + } + + /* Watch for Changes */ + void monitorChanges () { + + fileMonitor = File.new_for_path(DesktopPath).monitor(0); + + fileMonitor.changed.connect((e,a,event) => { + if(event == FileMonitorEvent.DELETED || event == FileMonitorEvent.CREATED) { + getDesktops(); + addIconsFromQueue(); + } + + + }); + } + + /* Get .desktop(s) */ + public void getDesktops () { + + iconsList.clear(); + grabDesktopPaths(); + addTrashIcon(); + } + + /* Adds all icons from the queue */ + public void addIconsFromQueue () { + + itemsLimit = (int)Math.round(screenHeight / (83 + verticalLayout.spacing)); + + clearIcons(); + destroy_all_children(); + + foreach (var icon in iconsList) { + append(icon); + icon.unDimIcon(); + } + } + + /* Async get desktop items */ + public void grabDesktopPaths () { + + var desktopFile = File.new_for_path (DesktopPath); + + // Reads all files in the directory + var Enum = desktopFile.enumerate_children ("standard::*", FileQueryInfoFlags.NOFOLLOW_SYMLINKS); + FileInfo info; + + while ((info = Enum.next_file ()) != null) { + + // Location of the file + string FilePath = DesktopPath + "/" + info.get_name (); + + string name = info.get_name(); + Gdk.Pixbuf iconPixbuf = null; + var Path = FilePath; + var DFile = File.new_for_path(FilePath); + OnScreen.Icon icon = null; + + /* Check if the file is .desktop */ + if(DFile.get_basename().has_suffix(".desktop")) { + + var keyFile = new KeyFile(); + keyFile.load_from_file(DFile.get_path(), 0); + + // make sure the keyFile has the required keys + if(!keyFile.has_key(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_NAME) || + !keyFile.has_key(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_ICON) || + !keyFile.has_key(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_EXEC)) + continue; + + name = keyFile.get_string(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_NAME); + + var iconPath = keyFile.get_string(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_ICON); + + iconPixbuf = Utilities.getIconFrom(iconPath, iconSize); + + Path = keyFile.get_string(KeyFileDesktop.GROUP, KeyFileDesktop.KEY_EXEC); + + icon = new Icon(this, name, iconPixbuf, Path, DFile.get_path(), true); + + + + } else { + + string iconPath = LoadIcon(DFile); + + if(iconPath == null) { + if(DFile.query_file_type(FileQueryInfoFlags.NONE) == FileType.DIRECTORY) + iconPath = "folder"; + else { + + var iconQuery = DFile.query_info("standard::icon", 0).get_icon ().to_string().split(" "); + if(iconQuery.length > 1) + iconPath = iconQuery[iconQuery.length - 1]; + } + + iconPixbuf = Utilities.getIconFrom(iconPath, iconSize); + + } else + iconPixbuf = new Gdk.Pixbuf.from_file_at_scale(iconPath, iconSize, iconSize, false); + + + icon = new Icon(this, name, iconPixbuf, "", DFile.get_path(), false); + } + + + iconsList.add(icon); + + } + } + + /* Adds trash icon */ + private void addTrashIcon() { + + iconsList.add(new Icon.Trash(this)); + } + + + /* Creates a new folder */ + public void createNewFolder () { + + var untitledFolder = File.new_for_path(getUntitledFolderName()); + untitledFolder.make_directory_async(); + + } + + /* Pastes a file from a given path to desktop */ + public void copyToDesktop (string path) { + + // Get the actual GLib file + var file = File.new_for_path(path); + var desktopFile = File.new_for_path(desktopPath + "/" + file.get_basename()); + file.copy(desktopFile, FileCopyFlags.NONE, null); + + } + + /* Finds the icon of a file and returns as string */ + string LoadIcon (File file) { + + /* Check if it's a .desktop */ + if(file.get_basename().has_suffix(".desktop")) { + + try { + + var _KeyFile = new KeyFile(); + + _KeyFile.load_from_file(file.get_path(), 0); + + return _KeyFile.get_string(KeyFileDesktop.GROUP, + KeyFileDesktop.KEY_ICON); + + } catch { + + + } + + } + + var Standard = FileAttribute.STANDARD_ICON; + var Thumb = FileAttribute.THUMBNAIL_PATH; + var CustomName = "metadata::custom-icon-name"; + var CustomIcon = "standard::icon"; + + var Query = "%s,%s,%s,%s".printf(Thumb, Standard, CustomIcon, CustomName); + + var Info = file.query_info (Query, 0); + + // look for a thumbnail + var thumb_icon = Info.get_attribute_byte_string (Thumb); + if (thumb_icon != null && thumb_icon != "") + return thumb_icon; + + // otherwise try to get the icon from the fileinfo + return null; + + } + + public void fadeIn () { + + save_easing_state (); + set_easing_duration (200); + opacity = 255; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + } + + public void fadeOut () { + + save_easing_state (); + set_easing_duration (200); + opacity = 0; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + } + + /* Returns a new Untitled Folder name */ + private string getUntitledFolderName(int count = 0) { + + string path = desktopPath + @"/New Folder($(count.to_string()))"; + if(File.new_for_path(path).query_exists()) + path = getUntitledFolderName(count + 1); + + return path; + } + + } +} diff --git a/komorebi/src/OnScreen/Icon.vala b/komorebi/src/OnScreen/Icon.vala new file mode 100644 index 0000000..9bd9db2 --- /dev/null +++ b/komorebi/src/OnScreen/Icon.vala @@ -0,0 +1,325 @@ +// +// Copyright (C) 2017-2018 Abraham Masri @cheesecakeufo +// +// 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 3 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, see . +// +// Copied from ManagerForKedos - Abraham Masri +// + +using Gtk; +using Gdk; +using GtkClutter; +using GLib.Environment; + +using Komorebi.Utilities; + +namespace Komorebi.OnScreen { + + public enum IconType { + NORMAL, + EDIT, + TRASH + } + + public class Icon : Clutter.Actor { + + DesktopIcons parent; + + /* Path of the file */ + public string filePath = ""; + + /* Path of executable path */ + public string execPath = ""; + + /* Title of the file */ + public string titleName = ""; + + Clutter.BoxLayout boxLayout = new Clutter.BoxLayout() {orientation = Clutter.Orientation.VERTICAL}; + + Clutter.Actor mainActor = new Clutter.Actor(); + Clutter.Actor iconActor = new Clutter.Actor(); + Clutter.Image iconImage = new Clutter.Image(); + Clutter.Text titleText = new Clutter.Text(); + + // Ability to drag + Clutter.DragAction dragAction = new Clutter.DragAction(); + + // Wether the path is executable + bool isExecutable = false; + + // Type of this icon + IconType iconType; + + + construct { + + // Properties + layout_manager = boxLayout; + reactive = true; + height = 83; + opacity = 0; + + set_pivot_point (0.5f, 0.5f); + + iconActor.set_size(iconSize, iconSize); + + titleText.set_line_wrap(true); + titleText.set_max_length(10); + titleText.ellipsize = Pango.EllipsizeMode.END; + + setupSignals(); + + // Add widgets + iconActor.add_action(dragAction); + + iconActor.set_content(iconImage); + add_child(iconActor); + add_child(titleText); + + } + + public Icon (DesktopIcons parent, string name, Pixbuf pixbuf, string execPath, string filePath, + bool isExecutable = false) { + this.parent = parent; + this.filePath = filePath; + this.execPath = execPath; + this.titleName = name; + this.isExecutable = isExecutable; + this.iconType = IconType.NORMAL; + + // Setup widgets + iconImage.set_data (pixbuf.get_pixels(), + pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888, + iconSize, iconSize, + pixbuf.get_rowstride()); + + titleText.set_markup(@"$titleName"); + + } + + public Icon.Trash (DesktopIcons parent) { + this.parent = parent; + this.titleName = "Trash"; + var pixbuf = Utilities.getIconFrom("user-trash", 64); + + iconImage.set_data (pixbuf.get_pixels(), + pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888, + iconSize, iconSize, + pixbuf.get_rowstride()); + + titleText.set_markup(@"Trash"); + + this.iconType = IconType.TRASH; + + } + + public Icon.NewFolder (DesktopIcons parent) { + this.parent = parent; + + var pixbuf = Utilities.getIconFrom("folder", 64); + + iconImage.set_data (pixbuf.get_pixels(), + pixbuf.has_alpha ? Cogl.PixelFormat.RGBA_8888 : Cogl.PixelFormat.RGB_888, + iconSize, iconSize, + pixbuf.get_rowstride()); + + this.iconType = IconType.EDIT; + /*mainBox.add(entry);*/ + + /*entry.grab_focus();*/ + } + + /* Setup all signals */ + private void setupSignals () { + + button_press_event.connect((e) => { + + // We don't show animations when right-click button is pressed + if (e.button != 3) { + scaledScale(); + } + + + return true; + }); + + button_release_event.connect ((e) => { + + if(!showDesktopIcons) + return true; + + save_easing_state (); + set_easing_duration (90); + scale_x = 1.0f; + scale_y = 1.0f; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + switch(iconType) { + + case IconType.NORMAL: + + if(e.button == 1) { + + // TODO: Replace event with 2BUTTON_PRESS + AppInfo.launch_default_for_uri (@"file://$filePath", null); + + } else if(e.button == 3) { // Show the menu + BackgroundWindow backgroundWindow = parent.window; + BubbleMenu bubbleMenu = backgroundWindow.bubbleMenu; + + backgroundWindow.dimWallpaper(); + + bubbleMenu.fadeIn(e.x, e.y, MenuType.ICON); + bubbleMenu.setIcon(this); + + // Dim our text + titleText.opacity = 50; + + // Dim other icons + foreach (var icon in parent.iconsList) { + if(icon.filePath != this.filePath) + icon.dimIcon(); + } + + + } + break; + + case IconType.TRASH: + + // TODO: Replace event with 2BUTTON_PRESS + AppInfo.launch_default_for_uri ("trash://", null); + break; + + } + + + return true; + }); +/* + entry.key_release_event.connect((e) => { + + switch (e.keyval) { + + case Gdk.Key.Return: + case Gdk.Key.KP_Enter: + mainBox.remove(entry); + buttonBox.pack_end(title); + + if(entry.text == "") + titleName = "New Folder"; + else + this.titleName = entry.text; + copyMenuItem.set_label(@"Copy \"$(titleName)\" "); + titleText.set_markup(@"$titleName"); + title.set_markup(@"$titleName"); + title.show_all(); + + // Set the type of the icon back to normal + this.iconType = IconType.NORMAL; + + // Create an actual folder + createNewFolder(titleName); + + break; + + case Gdk.Key.Menu: + entry.grab_focus(); + break; + } + + return false; + }); + + + makeAliasMenuItem.activate.connect(() => { + + // Makes an alias to the file/folder + var sourceFile = File.new_for_path(filePath); + var sourceFileName = sourceFile.get_basename(); + var targetFile = File.new_for_path(desktopPath + "/(Alias) " + sourceFileName); + + targetFile.make_symbolic_link(filePath); + });*/ + + + } + + /* Restores icon's scale to scaled down */ + private bool scaledScale () { + + save_easing_state (); + set_easing_duration (90); + scale_x = 0.9f; + scale_y = 0.9f; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + return true; + } + + /* Trashes the icon */ + public void trash () { + + save_easing_state (); + set_easing_duration (90); + scale_x = 0.9f; + scale_y = 0.9f; + opacity = 0; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + } + + public bool dimIcon () { + + save_easing_state (); + set_easing_duration (400); + opacity = 100; + titleText.opacity = 100; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + + return true; + } + + public bool unDimIcon (bool with_scale = false) { + + if(with_scale) { + scale_y = 0.5f; + scale_x = 0.5f; + } + + save_easing_state (); + set_easing_duration (400); + opacity = 255; + if(with_scale) { + scale_y = 1.0f; + scale_x = 1.0f; + } + titleText.opacity = 255; + set_easing_mode (Clutter.AnimationMode.EASE_IN_SINE); + restore_easing_state (); + return true; + } + + /* Activates rename mode */ + public void activateRenameMode () { + + + } + + } +} diff --git a/komorebi/src/OnScreen/InfoWindow.vala b/komorebi/src/OnScreen/InfoWindow.vala new file mode 100644 index 0000000..09c33d4 --- /dev/null +++ b/komorebi/src/OnScreen/InfoWindow.vala @@ -0,0 +1,176 @@ +// +// Copyright (C) 2012-2017 Abraham Masri +// +// 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 3 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, see . +// +// +// Copied from ManagerForKedos - Abraham Masri +// + +using Gtk; +using Komorebi.Utilities; + +using GLib.Environment; + +namespace Komorebi.OnScreen { + + + public class InfoWindow : Gtk.Window { + + // Box containing everything + private Box mainBox = new Box(Orientation.VERTICAL, 0); + + // Box contains close button (acts like HeaderBar) + private Box headerBar = new Box(Orientation.HORIZONTAL, 5); + + // Box contains title label, and size + private Box topBox = new Box(Orientation.VERTICAL, 5); + + // Close/Hide button + private Button closeButton = new Button(); + + // File/Directory title + public Label titleLabel = new Label("No name"); + + // File/Directory size + public Label sizeLabel = new Label("Size unknown"); + + // Separator + private Separator separator = new Separator(Orientation.HORIZONTAL); + + + // Box more file info and properties + private Box fileInfoBox = new Box(Orientation.VERTICAL, 5); + + // Location + public RowLabel locationLabel = new RowLabel("Location"); + + // Type + public RowLabel typeLabel = new RowLabel("Type"); + + // Accessed + public RowLabel accessedLabel = new RowLabel("Accessed"); + + // Modified + public RowLabel modifiedLabel = new RowLabel("Modified"); + + // Owner + public RowLabel ownerLabel = new RowLabel("Owner"); + + string headerBarCSS = "*{ + background-color: rgba(25,25,25,0.7); + border-width: 0px; + box-shadow: none; + border-top-left-radius: 0.6em; + border-top-right-radius: 0.6em; + border-color: @transparent; + }"; + + string windowCSS = "*{ + + background-color: rgba(25,25,25,0.7); + border-width: 0px; + box-shadow: none; + border-bottom-left-radius: 0.6em; + border-bottom-right-radius: 0.6em; + color: white; + }"; + + string separatorCSS = "*{ + color: rgba(51,51,51,0.6); + }"; + public InfoWindow() { + + // Configure the window + set_size_request(340, 390); + resizable = false; + set_titlebar(headerBar); + addAlpha({this}); + applyCSS({this}, windowCSS); + + // Configure widgets + applyCSS({headerBar}, headerBarCSS); + closeButton.set_halign(Align.START); + + titleLabel.set_halign(Align.CENTER); + titleLabel.set_line_wrap(true); + titleLabel.set_max_width_chars(19); + titleLabel.set_ellipsize(Pango.EllipsizeMode.MIDDLE); + titleLabel.set_selectable(true); + + separator.margin_top = 10; + separator.margin_bottom = 10; + applyCSS({separator}, separatorCSS); + + fileInfoBox.margin = 20; + + // Signals + closeButton.button_press_event.connect(() => { + this.hide(); + return true; + }); + + // Add widgets + closeButton.add(new Image.from_file("/System/Resources/Komorebi/close_btn.svg")); + headerBar.pack_start(closeButton, false, false); + + topBox.add(titleLabel); + topBox.add(sizeLabel); + + + fileInfoBox.add(locationLabel); + fileInfoBox.add(typeLabel); + fileInfoBox.add(accessedLabel); + fileInfoBox.add(modifiedLabel); + fileInfoBox.add(ownerLabel); + + mainBox.add(topBox); + mainBox.add(separator); + mainBox.add(fileInfoBox); + add(mainBox); + + closeButton.grab_focus(); + } + + /* Set window information */ + public void setInfoFromPath(string path) { + + File file = File.new_for_path(path); + FileInfo fileInfo = file.query_info("%s,%s,%s,%s,%s,%s".printf( + FileAttribute.STANDARD_SIZE, + FileAttribute.STANDARD_TYPE, + FileAttribute.STANDARD_CONTENT_TYPE, + FileAttribute.TIME_ACCESS, + FileAttribute.TIME_CHANGED, + FileAttribute.OWNER_USER + ) , 0); + + var accessedTime = (int64) fileInfo.get_attribute_uint64(FileAttribute.TIME_ACCESS); + var modifiedTime = (int64) fileInfo.get_attribute_uint64(FileAttribute.TIME_CHANGED); + var owner = fileInfo.get_attribute_string(FileAttribute.OWNER_USER); + + titleLabel.set_markup(@"$(file.get_basename())"); + sizeLabel.set_markup(@"$(GLib.format_size (fileInfo.get_size()))"); + + locationLabel.set_value(path); + typeLabel.set_value(fileInfo.get_content_type()); + accessedLabel.set_value(formatDateTime((new DateTime.from_unix_utc(accessedTime)).to_local())); + modifiedLabel.set_value(formatDateTime((new DateTime.from_unix_utc(modifiedTime)).to_local())); + ownerLabel.set_value(owner); + + } + } + + +} diff --git a/komorebi/src/OnScreen/PreferencesWindow.vala b/komorebi/src/OnScreen/PreferencesWindow.vala new file mode 100644 index 0000000..1ad7048 --- /dev/null +++ b/komorebi/src/OnScreen/PreferencesWindow.vala @@ -0,0 +1,298 @@ +// +// Copyright (C) 2016-2017 Abraham Masri +// +// 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 3 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, see . +// + + +using Gtk; +using Gdk; + +using Komorebi.Utilities; + +namespace Komorebi.OnScreen { + + public class PreferencesWindow : Gtk.Window { + + // Custom headerbar + HeaderBar headerBar = new HeaderBar(); + + Button hideButton = new Button.with_label("Hide"); + Button quitButton = new Button.with_label("Quit Komorebi"); + + // Contains two pages (Preferences and Wallpapers) + Gtk.Notebook notebook = new Gtk.Notebook(); + + // Contains preferences page widgets + Gtk.Box preferencesPage = new Box(Orientation.VERTICAL, 5); + + Gtk.Grid aboutGrid = new Gtk.Grid(); + + Box titleBox = new Box(Orientation.VERTICAL, 5); + Label titleLabel = new Label(""); + Label aboutLabel = new Label(""); + + Gtk.CheckButton twentyFourHoursButton = new Gtk.CheckButton.with_label ("Use 24-hour time"); + Gtk.CheckButton showDesktopIconsButton = new Gtk.CheckButton.with_label ("Show desktop icons"); + Gtk.CheckButton enableVideoWallpapersButton = new Gtk.CheckButton.with_label ("Enable Video Wallpapers (Restarting Komorebi is required)"); + + Gtk.Box bottomPreferencesBox = new Box(Orientation.HORIZONTAL, 10); + + Button donateButton = new Button.with_label("Donate"); + Button reportButton = new Button.with_label("Report an issue"); + + // Contains wallpapers page widgets + Gtk.Box wallpapersPage = new Box(Orientation.VERTICAL, 10); + + Gtk.InfoBar infoBar = new Gtk.InfoBar (); + + WallpapersSelector wallpapersSelector = new WallpapersSelector(); + + Gtk.Box bottomWallpapersBox = new Box(Orientation.HORIZONTAL, 10); + + Label currentWallpaperLabel = new Label(""); + + // Triggered when pointer leaves window + bool canDestroy = false; + + + /* Add some style */ + string notebookCSS = " + *{ + background: none; + background-color: rgba(0, 0, 0, 0.60); + box-shadow: none; + color: white; + border-width: 0; + } + .notebook.header { + background-color: rgb(0,0,0); + } + .notebook notebook:focus tab { + background: none; + border-width: 0; + border-radius: 0px; + border-color: transparent; + border-image-width: 0; + border-image: none; + background-color: red; + } + "; + + string headerCSS = " + *{ + background: rgba(0, 0, 0, 0.7); + background-color: rgb(0, 0, 0); + box-shadow: none; + color: white; + border-width: 0px; + box-shadow: none; + border-image: none; + border: none; + } + "; + + string infoBarCSS = " + *{ + background: #f44336; + background-color: #f44336; + box-shadow: none; + color: white; + border-width: 0px; + box-shadow: none; + border-image: none; + border: none; + } + "; + public PreferencesWindow (string selectedTab = "preferences") { + + title = ""; + set_size_request(760, 500); + resizable = false; + window_position = WindowPosition.CENTER; + set_titlebar(headerBar); + applyCSS({this.notebook}, notebookCSS); + applyCSS({this.infoBar}, infoBarCSS); + applyCSS({headerBar, hideButton, quitButton, donateButton, reportButton}, headerCSS); + addAlpha({this}); + + // Setup Widgets + titleLabel.set_markup("Komorebi"); + aboutLabel.set_markup("by Abraham Masri @cheesecakeufo"); + + // showSystemStatsButton.active = showInfoBox; + twentyFourHoursButton.active = timeTwentyFour; + showDesktopIconsButton.active = showDesktopIcons; + enableVideoWallpapersButton.active = enableVideoWallpapers; + + setWallpaperNameLabel(); + + // Properties + hideButton.margin_top = 6; + hideButton.margin_start = 6; + hideButton.halign = Align.START; + + quitButton.margin_top = 6; + quitButton.margin_end = 6; + + notebook.expand = true; + + preferencesPage.margin = 20; + preferencesPage.halign = Align.CENTER; + preferencesPage.margin_bottom = 10; + + aboutGrid.halign = Align.CENTER; + aboutGrid.margin_bottom = 30; + aboutGrid.column_spacing = 0; + aboutGrid.row_spacing = 0; + + titleBox.margin_top = 15; + titleBox.margin_start = 10; + titleLabel.halign = Align.START; + + bottomPreferencesBox.margin_top = 10; + + donateButton.valign = Align.CENTER; + reportButton.valign = Align.CENTER; + + infoBar.message_type = MessageType.WARNING; + infoBar.set_show_close_button(false); + + currentWallpaperLabel.selectable = true; + + bottomWallpapersBox.margin = 25; + bottomWallpapersBox.margin_top = 10; + + // Signals + destroy.connect(() => { canOpenPreferences = true;}); + + hideButton.released.connect(() => { destroy(); }); + quitButton.released.connect(() => { + + print("Quitting Komorebi. Good bye :)\n"); + Clutter.main_quit(); + + }); + + donateButton.released.connect(() => { + + print("Thank you <3\n"); + AppInfo.launch_default_for_uri("https://goo.gl/Yr1RQe", null); // Thank you <3 + destroy(); + + }); + + reportButton.released.connect(() => { + + AppInfo.launch_default_for_uri("https://goo.gl/aaJgN7", null); + destroy(); + }); + + + twentyFourHoursButton.toggled.connect (() => { + + timeTwentyFour = twentyFourHoursButton.active; + updateConfigurationFile(); + + }); + + showDesktopIconsButton.toggled.connect (() => { + showDesktopIcons = showDesktopIconsButton.active; + updateConfigurationFile(); + + if (showDesktopIcons) { + foreach (BackgroundWindow backgroundWindow in backgroundWindows) + backgroundWindow.desktopIcons.fadeIn(); + } else { + foreach (BackgroundWindow backgroundWindow in backgroundWindows) + backgroundWindow.desktopIcons.fadeOut(); + } + }); + + enableVideoWallpapersButton.toggled.connect (() => { + + enableVideoWallpapers = enableVideoWallpapersButton.active; + updateConfigurationFile(); + + }); + + wallpapersSelector.wallpaperChanged.connect(() => { + setWallpaperNameLabel(); + }); + + // Add Widgets + headerBar.add(hideButton); + headerBar.pack_end(quitButton); + + titleBox.add(titleLabel); + titleBox.add(aboutLabel); + + aboutGrid.attach(new Image.from_file("/System/Resources/Komorebi/komorebi.svg"), 0, 0, 1, 1); + aboutGrid.attach(titleBox, 1, 0, 1, 1); + + bottomPreferencesBox.pack_start(donateButton); + bottomPreferencesBox.pack_end(reportButton); + + preferencesPage.add(aboutGrid); + preferencesPage.add(twentyFourHoursButton); + preferencesPage.add(showDesktopIconsButton); + preferencesPage.add(enableVideoWallpapersButton); + preferencesPage.pack_end(bottomPreferencesBox); + + bottomWallpapersBox.add(new Image.from_file("/System/Resources/Komorebi/info.svg")); + bottomWallpapersBox.add(currentWallpaperLabel); + + if(!canPlayVideos()) { + + infoBar.get_content_area().add(new Label("gstreamer1.0-libav is missing. You won't be able to set video wallpapers without it.")); + wallpapersPage.add(infoBar); + } + + wallpapersPage.add(wallpapersSelector); + wallpapersPage.add(bottomWallpapersBox); + + + if(selectedTab == "wallpapers") { + notebook.append_page(wallpapersPage, new Label("Wallpapers")); + notebook.append_page(preferencesPage, new Label("Preferences")); + } else { + notebook.append_page(preferencesPage, new Label("Preferences")); + notebook.append_page(wallpapersPage, new Label("Wallpapers")); + } + + + notebook.child_set_property (preferencesPage, "tab-expand", true); + notebook.child_set_property (wallpapersPage, "tab-expand", true); + + add(notebook); + + show_all(); + } + + /* Changes the wallpaper name label */ + private void setWallpaperNameLabel() { + + var prettyName = beautifyWallpaperName(wallpaperName); + currentWallpaperLabel.set_markup(@"$prettyName"); + } + + /* Shows the window */ + public void FadeIn() { + + show_all(); + + } + + } +} diff --git a/komorebi/src/OnScreen/ResponsiveGrid.vala b/komorebi/src/OnScreen/ResponsiveGrid.vala new file mode 100644 index 0000000..ade1092 --- /dev/null +++ b/komorebi/src/OnScreen/ResponsiveGrid.vala @@ -0,0 +1,63 @@ +// +// Copyright (C) 2016-2017 Abarham Masri +// +// 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 3 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, see . +// +// + +using Clutter; + +namespace Komorebi.OnScreen { + + public class ResponsiveGrid : Actor { + + // Limit of items per column + public int itemsLimit = 8; + + // Layouts (HORIZONTAL/VERTICAL) + internal BoxLayout horizontalLayout = new BoxLayout() {orientation = Clutter.Orientation.HORIZONTAL, spacing = 50}; + internal BoxLayout verticalLayout = new BoxLayout() {orientation = Clutter.Orientation.VERTICAL, spacing = 30}; + + public ResponsiveGrid () { + + layout_manager = horizontalLayout; + y_align = ActorAlign.START; + } + + public void append (Actor item) { + + if(last_child != null) + if(last_child.get_n_children() < itemsLimit) { + last_child.add_child (item); + return; + } + + + // Create a new column and add the new item to it + var columnActor = new Actor() {layout_manager = verticalLayout, y_align = ActorAlign.START, y_expand = true}; + + columnActor.add_child(item); + add_child(columnActor); + } + + public void clearIcons () { + + foreach (var child in get_children()) { + child.destroy_all_children(); + remove_child(child); + } + + } + } +} diff --git a/komorebi/src/OnScreen/RowLabel.vala b/komorebi/src/OnScreen/RowLabel.vala new file mode 100644 index 0000000..bf78112 --- /dev/null +++ b/komorebi/src/OnScreen/RowLabel.vala @@ -0,0 +1,121 @@ +// +// Copyright (C) 2012-2017 Abraham Masri +// +// 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 3 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, see . +// +// +// Copied from ManagerForKedos - Abraham Masri +// + +using Gtk; +using Gdk; +using Komorebi.Utilities; + +using GLib.Environment; + +namespace Komorebi.OnScreen { + + public class RowLabel : Gtk.EventBox { + + // Switch between mainBox and 'Copied' label + private Stack stack = new Stack(); + + // Contains both labels + private Box mainBox = new Box(Orientation.HORIZONTAL, 20); + + public Label nameLabel = new Label("Row"); + public Label valueLabel = new Label("Value"); + + private Label copiedLabel = new Label("Copied"); + + string CSS = "*, *:disabled { + transition: 150ms ease-in; + + background-color: @transparent; + background-image: none; + border: none; + border-color: @transparent; + box-shadow: inset 1px 2px rgba(0,0,0,0); + border-radius: 3px; + color: white; + text-shadow:0px 2px 3px rgba(0,0,0,0.9); + -gtk-icon-shadow: 0px 1px 4px rgba(0, 0, 0, 0.4); + + } + + .:hover { + transition: 50ms ease-out; + border-style: outset; + background-color: rgba(0, 0, 0, 0.9); + + }"; + + public RowLabel(string nameString) { + + nameLabel.label = nameString; + copiedLabel.label = nameString + " copied"; + + margin = 10; + add_events (EventMask.ALL_EVENTS_MASK); + applyCSS({this}, CSS); + + + stack.set_transition_type(StackTransitionType.CROSSFADE); + stack.set_transition_duration(300); + + valueLabel.set_line_wrap(true); + valueLabel.set_max_width_chars(19); + valueLabel.set_ellipsize(Pango.EllipsizeMode.MIDDLE); + + nameLabel.set_halign(Align.START); + valueLabel.set_halign(Align.END); + + // Signals + button_press_event.connect(() => { + + // Set the clipboard's value + clipboard.set_text (valueLabel.label, -1); + + stack.set_visible_child(copiedLabel); + + Timeout.add(600, () => { + + stack.set_visible_child(mainBox); + + return false; + }); + + return true; + }); + + + mainBox.pack_start(nameLabel); + mainBox.pack_end(valueLabel); + + stack.add_named(mainBox, "mainBox"); + stack.add_named(copiedLabel, "copiedLabel"); + + stack.set_visible_child(mainBox); + + add(stack); + } + + public void set_value(string valueString) { + + valueLabel.label = valueString; + valueLabel.tooltip_text = valueString; + } + } + +} \ No newline at end of file diff --git a/komorebi/src/OnScreen/Thumbnail.vala b/komorebi/src/OnScreen/Thumbnail.vala new file mode 100644 index 0000000..55144e6 --- /dev/null +++ b/komorebi/src/OnScreen/Thumbnail.vala @@ -0,0 +1,101 @@ +// +// Copyright (C) 2012-2013 Abraham Masri @cheesecakeufo +// +// This program is free software: you can redistribute it and/or modify it +// under the terms of the GNU Lesser General Public License version 3, as published +// by the Free Software Foundation. +// +// This program is distributed in the hope that it will be useful, but +// WITHOUT ANY WARRANTY; without even the implied warranties of +// MERCHANTABILITY, SATISFACTORY QUALITY, 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, see + +using Gtk; + +using Komorebi.Utilities; + +namespace Komorebi.OnScreen { + + private class Thumbnail : EventBox { + + string name = ""; + + Overlay overlay = new Overlay(); + Image thumbnailImage = new Image(); + Image borderImage = new Image.from_file("/System/Resources/Komorebi/thumbnail_border.svg"); + Revealer revealer = new Revealer(); + + // Signaled when clicked + public signal void clicked (); + + construct { + + add_events (Gdk.EventMask.BUTTON_RELEASE_MASK); + + revealer.set_transition_duration(200); + revealer.set_transition_type(RevealerTransitionType.CROSSFADE); + + + overlay.add(thumbnailImage); + overlay.add_overlay(revealer); + add(overlay); + } + + public Thumbnail (string path, string name) { + + this.name = name; + + thumbnailImage.pixbuf = new Gdk.Pixbuf.from_file_at_scale(path + name + "/wallpaper.jpg", 150, 100, false); + + // Signals + button_release_event.connect(() => { + + wallpaperName = name; + showBorder(); + clicked(); + + readWallpaperFile(); + updateConfigurationFile(); + + foreach (BackgroundWindow backgroundWindow in backgroundWindows) + backgroundWindow.initializeConfigFile(); + + + foreach(var thumbnail in thumbnailsList) + if(thumbnail.name != name) + thumbnail.hideBorder(); + + return true; + }); + + revealer.set_reveal_child((wallpaperName == name)); + + // Add widgets + revealer.add(borderImage); + } + + + public Thumbnail.Add() { + + thumbnailImage.pixbuf = new Gdk.Pixbuf.from_file_at_scale("/System/Resources/Komorebi/thumbnail_add.svg", 150, 100, false); + + } + + + /* Shows the border */ + public void showBorder () { + + revealer.set_reveal_child(true); + + } + + /* Hides the border */ + public void hideBorder () { + + revealer.set_reveal_child(false); + } + } +} \ No newline at end of file diff --git a/komorebi/src/OnScreen/WallpapersSelector.vala b/komorebi/src/OnScreen/WallpapersSelector.vala new file mode 100644 index 0000000..288228e --- /dev/null +++ b/komorebi/src/OnScreen/WallpapersSelector.vala @@ -0,0 +1,130 @@ +// +// Copyright (C) 2017-2018 Abraham Masri @cheesecakeufo +// +// 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 3 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, see . +// + +using Gtk; +using Gdk; + +namespace Komorebi.OnScreen { + + List thumbnailsList; + + public class WallpapersSelector : ScrolledWindow { + + public string path = "/System/Resources/Komorebi/"; + + Gtk.Grid grid = new Grid(); + + int row = 0; + int column = 0; + + // Signaled when a thumbnail is clicked + public signal void wallpaperChanged (); + + public WallpapersSelector () { + + thumbnailsList = new List(); + + set_policy(PolicyType.NEVER, PolicyType.AUTOMATIC); + vexpand = true; + margin = 20; + + grid.halign = Align.CENTER; + grid.row_spacing = 5; + grid.column_spacing = 20; + + getWallpapers(); + + // add the 'create new' thumbnail + // var create_new_thumbnail = new Thumbnail.Add(); + + // // Signals + // create_new_thumbnail.clicked.connect(() => wallpaperChanged()); + + // addThumbnail(create_new_thumbnail); + // thumbnailsList.append(create_new_thumbnail); + + add(grid); + } + + + public void getWallpapers () { + + clearGrid(); + + foreach(var thumbnail in thumbnailsList) + thumbnailsList.remove(thumbnail); + + File wallpapersFolder = File.new_for_path("/System/Resources/Komorebi"); + + try { + + var enumerator = wallpapersFolder.enumerate_children ("standard::*", FileQueryInfoFlags.NOFOLLOW_SYMLINKS); + + FileInfo info; + + while ((info = enumerator.next_file ()) != null) + if (info.get_file_type () == FileType.DIRECTORY) { + + var name = info.get_name(); + var fullPath = path + name; + + // Check if we have a valid wallpaper + if (File.new_for_path(fullPath + "/wallpaper.jpg").query_exists() && + File.new_for_path(fullPath + "/config").query_exists()) { + + var thumbnail = new Thumbnail(path, name); + + // Signals + thumbnail.clicked.connect(() => wallpaperChanged()); + + addThumbnail(thumbnail); + thumbnailsList.append(thumbnail); + } else + print(@"[WARNING]: Found an invalid wallpaper with name: $name \n"); + } + + } catch { + print("Could not read directory '/System/Resources/Komorebi/'"); + } + } + + /* Adds a thumbnail to the grid */ + private void addThumbnail (Thumbnail thumbnail) { + + grid.attach (thumbnail, column, row, 1, 1); + + if(column >= 3) { + row++; + column = 0; + } else + column++; + + thumbnail.show_all(); + } + + /* Clears the grid */ + private void clearGrid() { + + foreach (var widget in grid.get_children ()) + grid.remove(widget); + + column = 0; + row = 0; + } + + } +} diff --git a/komorebi/src/Utilities.vala b/komorebi/src/Utilities.vala new file mode 100644 index 0000000..845f6de --- /dev/null +++ b/komorebi/src/Utilities.vala @@ -0,0 +1,378 @@ +// +// Copyright (C) 2012-2017 Abraham Masri +// +// 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 3 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, see . +// +// +// Copied from Acis - Abraham Masri +// + +using Gtk; +using Gdk; +using GLib; +using Cairo; + +using Komorebi.OnScreen; + +namespace Komorebi.Utilities { + + // Komorebi variables + string desktopPath; + string configFilePath; + File configFile; + KeyFile configKeyFile; + + // Screen variables + int screenHeight; + int screenWidth; + + // Icons variables + int iconSize; + + // DateTime variables + bool dateTimeParallax; + bool dateTimeVisible; + + int dateTimeMarginTop; + int dateTimeMarginRight; + int dateTimeMarginLeft; + int dateTimeMarginBottom; + + double dateTimeRotationX; + double dateTimeRotationY; + double dateTimeRotationZ; + + string dateTimePosition; + string dateTimeAlignment; + bool dateTimeAlwaysOnTop; + + string dateTimeColor; + int dateTimeAlpha; + + string dateTimeShadowColor; + int dateTimeShadowAlpha; + + string dateTimeTimeFont; + string dateTimeDateFont; + + // Wallpaper variables + KeyFile wallpaperKeyFile; + + string wallpaperType; + string videoFileName; + string webPageUrl; + + bool wallpaperParallax; + + // Asset variables + bool assetVisible; + + int assetWidth; + int assetHeight; + + string assetAnimationMode; + int assetAnimationSpeed; + + string assetPosition; + + int assetMarginTop; + int assetMarginRight; + int assetMarginLeft; + int assetMarginBottom; + + + + /* Returns an icon detected from file, IconTheme, etc .. */ + public Pixbuf getIconFrom (string icon, int size) { + + Pixbuf IconPixbuf = null; + + if(icon == null || icon == "") + return IconPixbuf; + + /* Try those methods: + * 1- Icon is a file, somewhere in '/'. + * 2- Icon is an icon in a IconTheme. + * 3- Icon isn't in the current IconTheme. + * 4- Icon is not available, use default. + */ + if(File.new_for_path(icon).query_exists()) { + IconPixbuf = new Pixbuf.from_file_at_scale(icon, size, size, false); + return IconPixbuf; + } + + + Gtk.IconTheme _IconTheme = Gtk.IconTheme.get_default (); + _IconTheme.prepend_search_path("/usr/share/pixmaps/"); + + + try { + IconPixbuf = _IconTheme.load_icon (icon, size, IconLookupFlags.FORCE_SIZE); + } catch (Error e) { + if(IconPixbuf == null) + IconPixbuf = _IconTheme.load_icon ("application-default-icon", size, IconLookupFlags.FORCE_SIZE); + } + + + return IconPixbuf; + + } + + /* TAKEN FROM ACIS --- Until Acis is public */ + /* Applies CSS theming for specified GTK+ Widget */ + public void applyCSS (Widget[] widgets, string CSS) { + + var Provider = new Gtk.CssProvider (); + Provider.load_from_data (CSS, -1); + + foreach(var widget in widgets) + widget.get_style_context().add_provider(Provider,-1); + + } + + + /* TAKEN FROM ACIS --- Until Acis is public */ + /* Allow alpha layer in the window */ + public void addAlpha (Widget[] widgets) { + + foreach(var widget in widgets) + widget.set_visual (widget.get_screen ().get_rgba_visual () ?? widget.get_screen ().get_system_visual ()); + + } + + /* Formats the date and time into a human read-able version */ + public string formatDateTime (DateTime dateTime) { + + if (OnScreen.timeTwentyFour) + return dateTime.format("%m/%d/%Y %H:%M"); + + return dateTime.format("%m/%d/%Y %l:%M %p"); + } + + /* Reads the .prop file */ + public void readConfigurationFile () { + + // Default values + wallpaperName = "foggy_sunny_mountain"; + timeTwentyFour = true; + showDesktopIcons = true; + enableVideoWallpapers = true; + + if(configFilePath == null) + configFilePath = Environment.get_home_dir() + "/.Komorebi.prop"; + + if(configFile == null) + configFile = File.new_for_path(configFilePath); + + if(configKeyFile == null) + configKeyFile = new KeyFile (); + + if(!configFile.query_exists()) { + print("No configuration file found. Creating one..\n"); + updateConfigurationFile(); + return; + } + + print("Reading config file..\n"); + + configKeyFile.load_from_file(configFilePath, KeyFileFlags.NONE); + + var key_file_group = "KomorebiProperties"; + + // make sure the config file has the required values + if(!configKeyFile.has_group(key_file_group) || + !configKeyFile.has_key(key_file_group, "WallpaperName") || + !configKeyFile.has_key(key_file_group, "TimeTwentyFour") || + !configKeyFile.has_key(key_file_group, "ShowDesktopIcons") || + !configKeyFile.has_key(key_file_group, "EnableVideoWallpapers")) { + + print("[WARNING]: invalid configuration file found. Fixing..\n"); + updateConfigurationFile(); + return; + } + + + wallpaperName = configKeyFile.get_string (key_file_group, "WallpaperName"); + timeTwentyFour = configKeyFile.get_boolean (key_file_group, "TimeTwentyFour"); + showDesktopIcons = configKeyFile.get_boolean (key_file_group, "ShowDesktopIcons"); + enableVideoWallpapers = configKeyFile.get_boolean (key_file_group, "EnableVideoWallpapers"); + fixConflicts(); + } + + /* Updates the .prop file */ + public void updateConfigurationFile () { + + var key_file_group = "KomorebiProperties"; + + configKeyFile.set_string (key_file_group, "WallpaperName", wallpaperName); + configKeyFile.set_boolean (key_file_group, "TimeTwentyFour", timeTwentyFour); + configKeyFile.set_boolean (key_file_group, "ShowDesktopIcons", showDesktopIcons); + configKeyFile.set_boolean (key_file_group, "EnableVideoWallpapers", enableVideoWallpapers); + + // Delete the file + if(configFile.query_exists()) + configFile.delete(); + + // save the key file + var stream = new DataOutputStream (configFile.create (0)); + stream.put_string (configKeyFile.to_data ()); + stream.close (); + + } + + /* Fixes conflicts with other environmnets */ + void fixConflicts() { + + // Disable/Enabled nautilus to fix bug when clicking on another monitor + new GLib.Settings("org.gnome.desktop.background").set_boolean("show-desktop-icons", false); + + // Check if we have nemo installed + SettingsSchemaSource settingsSchemaSource = new SettingsSchemaSource.from_directory ("/usr/share/glib-2.0/schemas", null, false); + SettingsSchema settingsSchema = settingsSchemaSource.lookup ("org.nemo.desktop", false); + + if (settingsSchema != null) + // Disable/Enable Nemo's desktop icons + new GLib.Settings("org.nemo.desktop").set_boolean("show-desktop-icons", false); + + + } + + void readWallpaperFile () { + + // check if the wallpaper exists + // also, make sure the wallpaper name is valid + var wallpaperPath = @"/System/Resources/Komorebi/$wallpaperName"; + var wallpaperConfigPath = @"$wallpaperPath/config"; + + if(wallpaperName == null || !File.new_for_path(wallpaperPath).query_exists() || + !File.new_for_path(wallpaperConfigPath).query_exists()) { + + wallpaperName = "foggy_sunny_mountain"; + wallpaperPath = @"/System/Resources/Komorebi/$wallpaperName"; + wallpaperConfigPath = @"$wallpaperPath/config"; + + print(@"[ERROR]: got an invalid wallpaper. Setting to default: $wallpaperName\n"); + } + + // init the wallpaperKeyFile (if we haven't already) + if(wallpaperKeyFile == null) + wallpaperKeyFile = new KeyFile (); + + // Read the config file + wallpaperKeyFile.load_from_file(wallpaperConfigPath, KeyFileFlags.NONE); + + // Wallpaper Info + wallpaperType = wallpaperKeyFile.get_string("Info", "WallpaperType"); + + // DateTime + dateTimeVisible = wallpaperKeyFile.get_boolean ("DateTime", "Visible"); + dateTimeParallax = wallpaperKeyFile.get_boolean ("DateTime", "Parallax"); + + dateTimeMarginLeft = wallpaperKeyFile.get_integer ("DateTime", "MarginLeft"); + dateTimeMarginTop = wallpaperKeyFile.get_integer ("DateTime", "MarginTop"); + dateTimeMarginBottom = wallpaperKeyFile.get_integer ("DateTime", "MarginBottom"); + dateTimeMarginRight = wallpaperKeyFile.get_integer ("DateTime", "MarginRight"); + + dateTimeRotationX = wallpaperKeyFile.get_double ("DateTime", "RotationX"); + dateTimeRotationY = wallpaperKeyFile.get_double ("DateTime", "RotationY"); + dateTimeRotationZ = wallpaperKeyFile.get_double ("DateTime", "RotationZ"); + + dateTimePosition = wallpaperKeyFile.get_string ("DateTime", "Position"); + dateTimeAlignment = wallpaperKeyFile.get_string ("DateTime", "Alignment"); + dateTimeAlwaysOnTop = wallpaperKeyFile.get_boolean ("DateTime", "AlwaysOnTop"); + + dateTimeColor = wallpaperKeyFile.get_string ("DateTime", "Color"); + dateTimeAlpha = wallpaperKeyFile.get_integer ("DateTime", "Alpha"); + + dateTimeShadowColor = wallpaperKeyFile.get_string ("DateTime", "ShadowColor"); + dateTimeShadowAlpha = wallpaperKeyFile.get_integer ("DateTime", "ShadowAlpha"); + + dateTimeTimeFont = wallpaperKeyFile.get_string ("DateTime", "TimeFont"); + dateTimeDateFont = wallpaperKeyFile.get_string ("DateTime", "DateFont"); + + + if(wallpaperType == "video") { + videoFileName = wallpaperKeyFile.get_string("Info", "VideoFileName"); + wallpaperParallax = assetVisible = false; + return; + } + + if(wallpaperType == "web_page") { + webPageUrl = wallpaperKeyFile.get_string("Info", "WebPageUrl"); + wallpaperParallax = assetVisible = false; + + return; + } + + // Wallpaper base image + wallpaperParallax = wallpaperKeyFile.get_boolean("Wallpaper", "Parallax"); + + // Asset + assetVisible = wallpaperKeyFile.get_boolean ("Asset", "Visible"); + + assetAnimationMode = wallpaperKeyFile.get_string ("Asset", "AnimationMode"); + assetAnimationSpeed = wallpaperKeyFile.get_integer ("Asset", "AnimationSpeed"); + + assetWidth = wallpaperKeyFile.get_integer ("Asset", "Width"); + assetHeight = wallpaperKeyFile.get_integer ("Asset", "Height"); + + // Set GNOME's wallpaper to this + var wallpaperJpgPath = @"/System/Resources/Komorebi/$wallpaperName/wallpaper.jpg"; + new GLib.Settings("org.gnome.desktop.background").set_string("picture-uri", ("file://" + wallpaperJpgPath)); + new GLib.Settings("org.gnome.desktop.background").set_string("picture-options", "stretched"); + } + + + /* Creates a new folder in desktop */ + public void createNewFolder(string name, int number = 0) { + + File newFolder; + + if(number > 0) + newFolder = File.new_for_path(desktopPath + @"/$name ($(number.to_string()))"); + else + newFolder = File.new_for_path(desktopPath + @"/$name"); + + if(newFolder.query_exists()) + createNewFolder(name, number + 1); + else + newFolder.make_directory_async(); + + } + + /* Beautifies the name of the wallpaper */ + public string beautifyWallpaperName (string wallpaperName) { + + var resultString = ""; + + foreach(var word in wallpaperName.split("_")) { + resultString += (word.@get(0).to_string().up() + word.substring(1).down() + " "); + } + + return resultString; + + } + + /* A dirty way to check if gstreamer is installed */ + public bool canPlayVideos() { + + if( File.new_for_path("/usr/lib/gstreamer-1.0/libgstlibav.so").query_exists() || + File.new_for_path("/usr/lib64/gstreamer-1.0/libgstlibav.so").query_exists() || + File.new_for_path("/usr/lib/i386-linux-gnu/gstreamer-1.0/libgstlibav.so").query_exists() || + File.new_for_path("/usr/lib/x86_64-linux-gnu/gstreamer-1.0/libgstlibav.so").query_exists()) + return true; + + return false; + } +}