Plymouth theming guide (part 4)

This the final part of the theming guide. As I mentioned in the last post, you already know everything you need to write your themes. In this post I will show a couple themes I wrote to explore the system and some fancy high level aspects of the scripting language. You don’t need to know these, they are just a cute method to solve a problem that others may find useful.

Themes

To install these themes, extract them to /usr/share/plymouth/themes and run the appropriate plymouth-set-default-theme line.

Vizta

A very simple theme matching what the Vista theme does. It has just 30 lines of custom code.

http://brej.org/blog/wp-content/uploads/2009/12/vizta

source

Dandelion

This theme has the target of stressing the system. A couple months ago it was running at about 3 fps, now my machine hits 30 fps and spends some time idle.

http://brej.org/blog/wp-content/uploads/2009/12/dandelion

source

Inheritance

When I first proposed doing a scripting system Ray said “If you do this, I guess I’d recommend you keep it very simple”. I agreed, so what I aimed to do was to implement all the features with the minimum space. The solution I came up was to kill several birds with one stone. The stone being an inheritance system.

The important operation for inheritance is the single bar (“|“), inherit operator. Think of it as a very lazy OR function. As an example take the statement:

A = B | C;

This creates a new object (A) which is an inheritance of B and C. A now gains all the properties of B and, as a fall-back, C. There are three ways of using inheritance objects.

Direct

Consider the following statement:

A = "Seven" | 7;
B = String(A).CharAt(2);
C = 80 + A;

So A is an inheritance of the string “Seven” and the number 7. This means when in situations where a string is preferred, it will act as a string, and when the a number is preferred, it will act as a number. The value in B will be the third character in the string (“v”), and the value in C will be the number 87.

This kind of inheritance is used to allow native C objects (images, sprites etc.) to be able to be used as hashes to find appropriate functions to call. An object is created which inherits from the native object and the object template hash (which holds all the functions). The constructor function is also connected to the template using an inheritance. Thus you can treat it as a function, or as a hash of functions and it will adopt the appropriate behaviour.

text_image = Image.Text("string"); # Treat Image as a hash
png_image = Image("filename.png"); # Treat Image as a function

Hashed

Hashes are the main containers in the system. When an object inherits from two hashes, accessing the inner elements will trigger a crawl through all hashes for that element.

A.a = "a";
A.b = "b";   # A: a="a", b="b"
B.b = "B";
B.c = "C";   # B: b="B", c="c"
C = A | B;   # C: a="a", b="b", c="c"

When accessing the elements within C, the system looks within A, then B (also within any object they inherit from). Thus, elements within B can be overridden by A. This is very much like the __proto__ in Mozilla JavaScript.

Functional

Just like hashes, when functions are inherited, the system goes through them in the inheritance sequence, executing each one and moving onto the next if it has failed.

Fib = fun (v) {if (v <= 2) return 1; else fail;}
    | fun (v) {if (FibCache[v]) return FibCache[v]; else fail;}
    | fun (v) {return FibCache[v] = Fib(v-1) + Fib(v-2);};

If you have ever programmed the ML languages, you will already be somewhat familiar with this. In those, you can put constants in the function variable decelerations and functions which do not match these to the passed parameters, fail. Here, at any point in the function, you can choose to fail. The system then tries to execute the next function in the inheritance.

  1. No comments yet.

  1. November 20th, 2024
    Trackback from : BITCOIN
  2. November 21st, 2024
    Trackback from : APE
  3. November 22nd, 2024
    Trackback from : CTSI/USDT
  4. November 23rd, 2024
    Trackback from : GRT/USDT
  5. November 23rd, 2024
  6. November 23rd, 2024
    Trackback from : Coin SIGNAL
  7. November 27th, 2024
    Trackback from : XAU
  8. November 27th, 2024
    Trackback from : SIGNAL
  9. November 28th, 2024
    Trackback from : KAVA/USDT
  10. November 29th, 2024
    Trackback from : Ada
  11. November 29th, 2024
  12. November 29th, 2024
    Trackback from : TRX/USDT
  13. November 30th, 2024
    Trackback from : Cryptosignal
  14. December 2nd, 2024
    Trackback from : sui
  15. December 2nd, 2024
    Trackback from : GRT
  16. December 3rd, 2024
    Trackback from : Bitcoin news
  17. December 4th, 2024
    Trackback from : shib
  18. December 15th, 2024
    Trackback from : BTC Price Analysis
  19. December 16th, 2024
    Trackback from : URL
  20. December 19th, 2024
  21. December 21st, 2024
    Trackback from : nổ hũ
  22. December 22nd, 2024
    Trackback from : Crypto signal telegram
  23. December 23rd, 2024
    Trackback from : Crypto signals free
  24. December 23rd, 2024
    Trackback from : cryptosignalhi
  25. December 27th, 2024
  26. January 3rd, 2025
    Trackback from : entrümpelung angebot
  27. January 3rd, 2025
  28. January 3rd, 2025
  29. January 4th, 2025
    Trackback from : lost mary vape near me
  30. January 5th, 2025
  31. January 8th, 2025
  32. January 8th, 2025
    Trackback from : natural mounjaro
  33. January 13th, 2025
    Trackback from : is weed legal krakow
  34. January 14th, 2025
  35. January 16th, 2025
    Trackback from : herbal tea
  36. January 16th, 2025
    Trackback from : https://megamoolah.com.in/
  37. January 16th, 2025
    Trackback from : تطبيق كازينو 888