breezy-desktop/ui/src/breezydesktop.in

57 lines
1.8 KiB
Python
Executable File

#!/usr/bin/env python3
# breezydesktop.in
#
# Copyright 2024 Unknown
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# SPDX-License-Identifier: GPL-3.0-or-later
import os
import sys
lib_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'lib')
sys.path.insert(0, lib_dir)
import signal
import locale
import gettext
VERSION = '@VERSION@'
xdg_data_home = os.getenv('XDG_DATA_HOME', os.path.join(os.path.expanduser('~'), '.local', 'share'))
appdir = os.getenv('APPDIR', xdg_data_home)
locale_dir = os.path.join(appdir, 'locale')
pkgdatadir = os.path.join(appdir, 'breezydesktop')
sys.path.insert(1, pkgdatadir)
signal.signal(signal.SIGINT, signal.SIG_DFL)
locale.textdomain('breezydesktop')
locale.setlocale(locale.LC_ALL, locale.getlocale())
locale.bindtextdomain('breezydesktop', locale_dir)
gettext.install('breezydesktop', locale_dir)
gettext.bindtextdomain('breezydesktop', locale_dir)
gettext.textdomain('breezydesktop')
if __name__ == '__main__':
import gi
from gi.repository import Gio
resource = Gio.Resource.load(os.path.join(pkgdatadir, 'breezydesktop.gresource'))
resource._register()
from breezydesktop import main
sys.exit(main.main(VERSION))