How to create an ambience manually (without SDK)?

what im trying to do:

  • i want to create some ambiences (image, sound files, text files) by hand and package (?) them
  • i also want to offer them somewhere for download later on.

what i know so far:

  • i can create ambiences by using the SDK, but for some reasons i cant use that at the moment.
  • ive seen somewhere a while ago images should 2048*2048 px but i cant find a source anymore (and the xperia 10 II already has a higher resolution than that…)
  • ambiences are installed in /usr/share/ambience/

what information im looking for

  1. where is a spec for ambiences? (what files are required/possible, filetypes, sizes etc? how does a valid .ambience file look like?) - i couldnt find anything in the sailfish wiki
  2. are there any communication channels better suited than this forum where i could inquire for help?
  3. where can i read about packaging my newly made ambience, so users could easily download and install it?

thanks for any help :slight_smile:

Maybe helpful…

https://together.jolla.com/question/16673/howto-ambiences/

1 Like

Q1 - You can take a look at source files from one of mine.

Q3 - Here is an RPM packaging guide.

OpenRepos is a nice place to release your ambiences. :wink:

2 Likes

Picture size 2048x2048 might give optimum result, but I assume any size works. My current wall paper is 1850x3264.

  1. create a build directory
  2. place all the files as they should end up on the device in there
  3. place a .spec file in there.
  4. run rpmbuild --quiet --buildroot=$PWD --build-in-place -bb --noclean foo.spec
Name:          ambience-Awesome
Version:       0.1
Release:       4
Summary:       Awesome Ambience
Group:         System/GUI/Other
BuildArch:     noarch
License:       GPL

%description
This is an awesome Ambience


%prep

%build

%install

%post
systemctl-user restart ambienced.service ||:

%postun
if [ $1 = 0 ]; then
    #Do stuff specific to uninstalls
    echo "It's an uninstall"    
else
  if [ $1 = 1 ]; then
    #Do stuff specific to upgrades
    echo "It's just an upgrade"
  fi
fi

%files
%defattr(-,root,root,-)
%dir /usr/share/ambience/Awesome
/usr/share/ambience/Awesome/*

%changelog

Shameless plug: or you can use my app ThemeColor to do it for you:

4 Likes

thanks for the answers so far.

the lack of answers regardign the actual spec of the ambience files lead me to believe there isnt actually any proper spec for it. i wonder if its possible to publish an ambience (wallpaper) that will look the same on different screen sizes (sailfish scales the image to the correct resolution for hte device) or if it will just crop the image so smaller screens will jsut not see the whole picture… in that case one would have to publish different versions of the ambinece for different devices…

thanks to @eson for your sources! at least there i can see how i can add the ringtones - and i never knew i could pack several ambiences in 1

@Levone1 the problem with the old TJC wiki is that i think its horribly outdated… especially the parts about the resolutions

thanks for everyones help… i gues ill jsut have to experiment a bit

The .ambience schema is not documented AFAIK, but it’s a JSON file that’s rather wasy to understand.
Just look at some existing ambiences.

About scaling:

Scaling isn’t an issue as such. Ambience images should be square(!) and lipstick will center/letterbox them on screen, scaled to device height.

What’s more problematic is display aspect ratio. Different devices have differently shaped displays, so the same image’s content will not always be shown in the same ‘width’.

The same applies to height in landscape mode.

I tried installing it on the Jolla Phone with Sailfish OS 5.2 and the installation fails because “python3.8dist(setuptools")” isn’t available.

Is the current version of your tool compatible with SailfishOS 5.2?

Any workaround?

Please refresh and try again. I have uploaded a new package for dconfjson which should install on 5.2.

BTW, working on a Store-compatible and largely rewritten version ATM. It will still take a bit but will go into the Store eventually.

3 Likes

Muahaha… ‘the confusion’

Sorry… couldn’t help myself. :wink:

1 Like

Yeaaa… if you really want to do it manually, you could take a look at my GitLab repo. It is strait forward.

Wow! Thank you so much for the quick answer. Install went fine - now I have to understand everything :slight_smile:

Updated instructions “For Dummies” leaving nothing undefined:

Assuming the name of your ambience is “Awesome”:

  1. create a build directory
  2. place the source files in there:
    • an image file called wallpaper.jpg
    • an .ambience JSON file called Awesome.ambience
    • a .spec file called ambience-Awesome.spec
      So you directory would look like this:
./builddir
./builddir/ambience-Awesome.spec
./builddir/Awesome.ambience
./builddir/wallpaper.jpg
  1. install rpmbuild: devel-su pkcon install rpm-build
  2. go into your build dir, and run rpmbuild:
cd ./builddir
rpmbuild --quiet -bb --define "_topdir /tmp/rpmbuild" --define "_rpmdir $PWD/RPMS/" --build-in-place ambience-Awesome.spec`
  1. rpmbuild will not tell you which RPM file it created, unless you remove the --quiet switch. It will be in ./builddir//RPMS/noarch/awesome-Ambience-0.1.0-1.noarch.rpm

ambience-Awesome.spec

%global ambiencename Awesome

Name:          ambience-%{ambiencename}
Version:       0.1.0
Release:       1
Summary:       My Awesome Ambience
Group:         System/GUI/Other
BuildArch:     noarch
License:       CC-BY-SA-4.0

%description
This is an awesome Ambience


%prep

%build

%install
install -d %{buildroot}/usr/share/ambience/%{ambiencename}/images
install -Dpm644 wallpaper.jpg    %{buildroot}/usr/share/ambience/%{ambiencename}/images/
install -Dpm644 Awesome.ambience %{buildroot}/usr/share/ambience/%{ambiencename}/


%post
systemctl-user restart ambienced.service ||:

%files
%dir /usr/share/ambience/%{ambiencename}
/usr/share/ambience/%{ambiencename}/*

%changelog

Awesome.ambience


{
    "displayName"               : "Awesome Ambience",
    "wallpaper"                 : "wallpaper.jpg",
    "highlightColor"            : "#ffc999ff",
    "secondaryHighlightColor"   : "#ff9b76c5",
    "primaryColor"              : "#ffffffff",
    "secondaryColor"            : "#ffbababa",
    "favorite"                  : true,
    "colorScheme"               : "lightondark",
    "version"                   : 3
}

You can leave out the highlightColor and secondaryHighlightColor, in which case Lipstick will magically determine a colour from the wallpaper image.

You can also do this yourself and run this:

 /usr/libexec/ambience-wallpaper-tool --analyze --color-scheme "light-on-dark" wallpaper.jpg

which will produce something like the following, and you can use the code as the highlightColor:

{
    "dominant": "#f5c170"
}
2 Likes

Is it possible to modify or update an existing ambience with a new picture and highlight color for something like a daily new picture of the day?

You don’t need to edit an ambience for that.

You can just write the dconf keys:

[desktop/jolla/theme]
active_ambience='/usr/share/ambience/ambience-PixelZelda/PixelZelda.ambience'
color_scheme=0

[desktop/jolla/theme/color]
highlight='#ff80ffec'
highlightBackground='#744300'
highlightDimmer='#177339'
primary='#ffffffff'
secondary='#ffbababa'
secondaryHighlight='#ff62c5b6'

[desktop/jolla/background/portrait]
app_picture_filename='/home/nemo/.cache/ambienced/com/jolla/components/bgimages/d10b79e3ap.jpg'
home_picture_filename='/usr/share/ambience/ambience-PixelZelda/images/PixelZelda.jpg'
1 Like