about summary refs log tree commit diff stats
path: root/fungus/app.py
blob: 91883bc3ba77135366af4e40a535c9c990fffa1f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python3

import gi # type: ignore
import os

gi.require_version('Gtk', '3.0')
gi.require_version('Gdk', '3.0')
from gi.repository import Gtk, Gio # type: ignore

from fungus.dark_theme import apply_dark_theme


class FungusApp(Gtk.Application):
    def __init__(self):
        super().__init__(
            application_id="io.github.Fungus.fungus-launcher",
            flags=Gio.ApplicationFlags.HANDLES_OPEN,
        )
        self.window = None

    def do_startup(self):
        Gtk.Application.do_startup(self)
        os.environ["GTK_USE_PORTAL"] = "1"
        apply_dark_theme()

    def do_activate(self):
        if not self.window:
            from fungus.main_window import Main

            self.window = Main(self)
        self.window.present()