Application#

class ignis.app.IgnisApp(*args: Any, **kwargs: Any)#

Application class.

Danger

Do not initialize this class! Instead, use the already initialized instance as shown below.

from ignis.app import IgnisApp

app = IgnisApp.get_default()
classmethod get_default() IgnisApp#

Get the default Application object for this process.

Return type:

IgnisApp

ready()#
  • Signal

Emitted when the configuration has been parsed.

Hint

To handle shutdown of the application use the shutdown signal.

property is_ready: bool#
  • read-only

Whether configuration is parsed and app is ready.

property windows: list[gi.repository.Gtk.Window]#
  • read-only

A list of windows added to this application.

property autoreload_config: bool#
  • read-write

Whether to automatically reload the configuration when it changes (only .py files).

Default: True.

property autoreload_css: bool#
  • read-write

Whether to automatically reload the CSS style when it changes (only .css/.scss/.sass files).

Default: True.

property reload_on_monitors_change: bool#
  • read-write

Whether to reload Ignis on monitors change (connect/disconnect).

Default: True.

property widgets_style_priority: Literal['application', 'fallback', 'settings', 'theme', 'user']#
  • read-write

The priority used for each widget style unless a widget specifies a custom style priority using style_priority. More info about style priorities: Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION.

Default: "application".

Warning

Changing this property won't affect already initialized widgets! If you want to set a custom global style priority for all widgets, do this at the start of the configuration.

from ignis.app import IgnisApp

app = IgnisApp.get_default()

app.widgets_style_priority = "user"

# ... rest of config goes here
apply_css(style_path: str, style_priority: Literal['application', 'fallback', 'settings', 'theme', 'user'] = 'application', compiler: Literal['sass', 'grass'] | None = None) None#

Apply a CSS/SCSS/SASS style from a path. If style_path has a .sass or .scss extension, it will be automatically compiled. Requires either dart-sass or grass-sass for SASS/SCSS compilation.

Parameters:
  • style_path (str) -- Path to the .css/.scss/.sass file.

  • style_priority (Literal['application', 'fallback', 'settings', 'theme', 'user'], default: 'application') -- A priority of the CSS style. More info about style priorities: Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION.

  • compiler (Literal['sass', 'grass'] | None, default: None) -- The desired Sass compiler.

Return type:

None

Warning

style_priority won't affect a style applied to widgets using the style property, for these purposes use widgets_style_priority or ignis.base_widget.BaseWidget.style_priority.

Raises:
remove_css(style_path: str) None#

Remove the applied CSS/SCSS/SASS style by its path.

Parameters:

style_path (str) -- Path to the applied .css/.scss/.sass file.

Raises:
Return type:

None

reset_css() None#

Reset all applied CSS/SCSS/SASS styles.

Raises:

DisplayNotFoundError --

Return type:

None

reload_css() None#

Reload all applied CSS/SCSS/SASS styles.

Raises:

DisplayNotFoundError --

Return type:

None

add_icons(path: str) None#

Add custom SVG icons from a directory.

The directory must contain hicolor/scalable/actions directory, icons must be inside actions directory.

Parameters:

path (str) -- Path to the directory.

Return type:

None

For example, place icons inside the Ignis config directory:

~/.config/ignis
├── config.py
├── icons
│   └── hicolor
│       └── scalable
│           └── actions
│               ├── aaaa-symbolic.svg
│               └── some-icon.svg

Note

To apply a CSS color to an icon, its name and filename must end with -symbolic.

then, add this to your config.py :

from ignis.utils import Utils
from ignis.app import IgnisApp

app = IgnisApp.get_default()

app.add_icons(f"{Utils.get_current_dir()}/icons")
get_window(window_name: str) gi.repository.Gtk.Window#

Get a window by name.

Parameters:

window_name (str) -- The window's namespace.

Return type:

Window

Returns:

The window object.

Raises:

WindowNotFoundError -- If a window with the given namespace does not exist.

open_window(window_name: str) None#

Open (show) a window by its name.

Parameters:

window_name (str) -- The window's namespace.

Raises:

WindowNotFoundError -- If a window with the given namespace does not exist.

Return type:

None

close_window(window_name: str) None#

Close (hide) a window by its name.

Parameters:

window_name (str) -- The window's namespace.

Raises:

WindowNotFoundError -- If a window with the given namespace does not exist.

Return type:

None

toggle_window(window_name: str) None#

Toggle (change visibility to opposite state) a window by its name.

Parameters:

window_name (str) -- The window's namespace.

Raises:

WindowNotFoundError -- If a window with the given namespace does not exist.

Return type:

None

add_window(window_name: str, window: gi.repository.Gtk.Window) None#

Add a window. You typically shouldn't use this method, as windows are added to the app automatically.

Parameters:
  • window_name (str) -- The window's namespace.

  • window (Window) -- The window instance.

Raises:

WindowAddedError -- If a window with the given namespace already exists.

Return type:

None

remove_window(window_name: str) None#

Remove a window by its name. The window will be removed from the application.

Parameters:

window_name (str) -- The window's namespace.

Raises:

WindowNotFoundError -- If a window with the given namespace does not exist.

Return type:

None

reload() None#

Reload Ignis.

Return type:

None

quit() None#

Quit Ignis.

Return type:

None

inspector() None#

Open GTK Inspector.

Return type:

None