Skip to content

Commit

Permalink
deploy: 099eddb
Browse files Browse the repository at this point in the history
  • Loading branch information
linkfrg committed Jul 28, 2024
0 parents commit fa6e9b4
Show file tree
Hide file tree
Showing 274 changed files with 43,731 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .buildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 8e492319c245cbc4f605c899814aa655
tags: 645f666f9bcd5a90fca523b33c5a78b7
Empty file added .nojekyll
Empty file.
5 changes: 5 additions & 0 deletions _sources/app.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Application
-------------

.. autoclass:: ignis.app.IgnisApp
:members:
68 changes: 68 additions & 0 deletions _sources/dynamic_content.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
Dynamic content
================

Signals
------------
In GObject, we have a concept called "signals".

Signals are system for registering callbacks for specific events.
For example, when a user clicks a button, the program can perform a specific action.
Similarly, when a property of an object changes, the program can respond accordingly.

To connect to signals, use ``.connect()`` method on GObject that has the signal you need.
Pass a callback function that will be called when the signal is emitted.
Signals always pass the GObject they belong to as the first argument to the callback.
Services also have their own signals, which are listed on their respective documentation pages.
Additionally, signals can have custom arguments.
In example below, ``"player_added"`` signal passes an instance of :class:`~ignis.services.mpris.MprisPlayer` as the second argument to the callback.

Here, we will use the :class:`~ignis.services.mpris.MprisService` as an example.

.. code-block:: python
from ignis.service import Service
mpris = Service.get("mpris")
mpris.connect("player_added", lambda x, player: print(player.desktop_entry, player.title))
Now, try opening any media player (for example, video on youtube or music in spotify).
Magic! The player name and title will be printed.

To emit (call) signal manually, use the ``.emit()`` method and pass the signal name to it.

``notify`` signal
------------------
The ``notify`` is a special signal that emits when a property changes.
To connect to it, use the following syntax: ``"notify::PROPERTY-NAME"``.

.. danger::

Use ``-`` instead of ``_``. Otherwise, signal callback will never be called.

.. code-block:: python
mpris.connect("notify::players", lambda x, y: print(x.players))
Binding
---------------

You can call the ``.bind()`` method on widgets, services, or utils and pass a property name.
This method returns a :class:`~ignis.gobject.Binding`, which you can use to set a property value for a widget.

.. code-block:: python
from ignis.services import Service
from ignis.widgets import Widget
audio = Service.get("audio")
Widget.Label(label=audio.speaker.bind("volume", transform=lambda value: str(value)))
This code creates a binding.
Now, the label of ``Widget.Label`` will depend on the speaker's volume.
The ``label`` property accepts a ``str``, but ``speaker.volume`` is an ``int``.
So, we provide a transform function to ``.bind()``,
which converts the speaker volume to a string.
96 changes: 96 additions & 0 deletions _sources/getting_started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
Getting started
===============

First widgets
-----------------

First of all, let's create a config file in the default location.
The default config file is located at ``~/.config/ignis/config.py``.
You can create it using your file manager or the terminal with the command below.

.. code-block:: bash
touch ~/.config/ignis/config.py
Open this file with your code editor.

Now, let's create the first window and display some text on it.

.. code-block:: python
from ignis.widgets import Widget
Widget.Window(
namespace="some-window",
child=Widget.Label(
label="Hello world!"
),
)
A list of all parameters is provided here: :class:`~ignis.widgets.Widget.Window`.
Feel free to experiment with them.

In this example, we used the ``Widget`` class, which provides access to all other widgets.

What is widget?
------------------
Widget - is a graphical component, an element we see on screen. Buttons, text, switches, icons, sliders, etc.

A window is a top-level widget that contains all other widgets.

Some common widgets
---------------------

:class:`~ignis.widgets.Widget.Label`
--------------------------------------
A widget that displays text.

.. code-block:: python
Widget.Label(label="some text")
:class:`~ignis.widgets.Widget.Box`
-----------------------------------
A layout container that can contain multiple child widgets and arrange them either vertically or horizontally.
By default, it places children horizontally. To place them vertically, set ``vertical`` to ``True``.

.. code-block:: python
Widget.Box(
vertical=False, # or True
spacing=10,
child=[Widget.Label(label="first label"), Widget.Label(label="second label")]
)
:class:`~ignis.widgets.Widget.Button`
-----------------------------------------
I think from the name it's clear what kind of widget this is.
You can set a label for the button or use a custom child.

.. code-block:: python
Widget.Button(
label="click me",
on_click=lambda x: print("clicked!")
)
.. code-block:: python
Widget.Button(
child=Widget.Label(label="test"),
on_click=lambda x: print("clicked22!")
)
:class:`~ignis.widgets.Widget.Icon`
-----------------------------------------
In GTK, there are built-in icons that you can access by name, so you probably won't need icons from nerd fonts.
To find out the names of the icons, you can use ``gtk4-icon-browser`` (you need to install ``gtk4-demos`` package).

.. code-block:: python
Widget.Icon(
image="audio-volume-high-symbolic"
)
8 changes: 8 additions & 0 deletions _sources/gobject.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
GObject
-------------

.. autoclass:: ignis.gobject.IgnisGObject
:members:

.. autoclass:: ignis.gobject.Binding
:members:
20 changes: 20 additions & 0 deletions _sources/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Ignis
===============================
Full-featured Python framework for building desktop shells using GTK4.

Documentation
-------------

.. toctree::
:maxdepth: 1

installation
getting_started
styling
properties
dynamic_content
gobject
app
widgets/index
services/index
utils/index
32 changes: 32 additions & 0 deletions _sources/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
Installation
============

Arch linux
-----------

.. code-block:: bash
paru -S ignis
Building from source
---------------------

**Dependencies:**

- git
- ninja
- meson
- gtk4
- gtk4-layer-shell
- pygobject
- pycairo

.. code-block:: bash
git clone https://github.com/linkfrg/ignis.git
cd ignis
meson setup build
meson compile -C build
meson install -C build
24 changes: 24 additions & 0 deletions _sources/properties.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Properties
===============

Most classes in Ignis have properties.
These properties can have specific types (int, str, float), can be read-write or read-only, and can be optional or mandatory.

In PyGObject, you typically use the special props attribute to access GObject properties.
However, in Ignis, you don't need to use this attribute.
Instead, you can access GObject properties using the standard Python approach.

.. code-block:: python
widget = Widget.Label(label="Hello world!")
print(widget.label) # prints: "Hello world!"
To set a property, you can use the assignment operator ``=`` or a method that starts with ``set_``.

.. code-block:: python
widget.label = "test"
print(widget.label) # prints: "test"
widget.set_label("ignis") # this also works
print(widget.label) # prints: "ignis"
5 changes: 5 additions & 0 deletions _sources/services/generated/applications.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Applications
------------

.. automodule:: ignis.services.applications
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/audio.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Audio
-----

.. automodule:: ignis.services.audio
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/fetch.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Fetch
-----

.. automodule:: ignis.services.fetch
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/hyprland.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Hyprland
--------

.. automodule:: ignis.services.hyprland
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/mpris.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Mpris
-----

.. automodule:: ignis.services.mpris
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/network.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Network
-------

.. automodule:: ignis.services.network
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/notifications.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Notifications
-------------

.. automodule:: ignis.services.notifications
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/options.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Options
-------

.. automodule:: ignis.services.options
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/recorder.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Recorder
--------

.. automodule:: ignis.services.recorder
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/system_tray.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Systemtray
-----------

.. automodule:: ignis.services.system_tray
:members:
5 changes: 5 additions & 0 deletions _sources/services/generated/wallpaper.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Wallpaper
---------

.. automodule:: ignis.services.wallpaper
:members:
24 changes: 24 additions & 0 deletions _sources/services/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Services
==========
There is a list of built-in services that provide additional functionality to build various components of your desktop.

To access a service, use the universal ``Service`` class:

.. code-block:: python
from ignis.services import Service
service_name = Service.get("service_name")
.. warning::
You don't need to initialize services manually. They will be automatically initialized when imported.

.. danger::
Some services have additional dependencies, which are listed on the service page.
Without these dependencies, the service will crash Ignis when you try to import it.

.. toctree::
:glob:
:maxdepth: 1

generated/*
Loading

0 comments on commit fa6e9b4

Please sign in to comment.