Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
X11:Liri:git
liri-session
_service:obs_scm:liri-session-20220208+git.f26b...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:obs_scm:liri-session-20220208+git.f26b173.obscpio of Package liri-session
07070100000000000081A40000000000000000000000016202D085000000D1000000000000000000000000000000000000003100000000liri-session-20220208+git.f26b173/.gitattributes.tag export-subst .gitignore export-ignore .gitattributes export-ignore .gitmodules export-ignore .github export-ignore .travis export-ignore .travis.yml export-ignore .tx export-ignore .mailmap export-ignore 07070100000001000041ED0000000000000000000000036202D08500000000000000000000000000000000000000000000002A00000000liri-session-20220208+git.f26b173/.github07070100000002000041ED0000000000000000000000036202D08500000000000000000000000000000000000000000000003400000000liri-session-20220208+git.f26b173/.github/workflows07070100000003000081A40000000000000000000000016202D0850000067F000000000000000000000000000000000000003E00000000liri-session-20220208+git.f26b173/.github/workflows/build.ymlname: CI on: push: branches: - master - develop pull_request: branches: - master - develop env: CLAZY_CHECKS: "level1" jobs: build: if: "!contains(github.event.head_commit.message, 'ci skip')" strategy: matrix: compiler: - gcc - clang container: - suse-qt515 runs-on: ubuntu-latest container: image: liridev/${{ matrix.container }} steps: - name: Extract branch name id: extract_branch shell: bash run: | if [ -n "${{ github.base_ref }}" ]; then echo "##[set-output name=branch;]${{ github.base_ref }}" else github_ref=${{ github.ref }} echo "##[set-output name=branch;]${github_ref##*/}" fi - name: Qt version identifier id: qt_version shell: bash run: | qtverid=`echo "${{ matrix.container }}" | sed -e 's,suse-qt,,g'` echo "##[set-output name=id;]${qtverid}" - uses: actions/checkout@v2 - name: Build dependencies run: | set -x ./.github/workflows/scripts/build-deps ${{ steps.extract_branch.outputs.branch }} - name: Build run: | set -x mkdir -p build cd build if [ "${{ matrix.compiler }}" == "clang" ]; then export CC=clang export CXX=clang++ cmake .. -DLIRI_ENABLE_CLAZY:BOOL=ON -DCMAKE_INSTALL_PREFIX=/usr else cmake .. -DCMAKE_INSTALL_PREFIX=/usr fi make -j $(getconf _NPROCESSORS_ONLN) sudo make install 07070100000004000081A40000000000000000000000016202D085000002FA000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/.github/workflows/checks.ymlname: Checks on: push: branches: - master - develop tags: - v* pull_request: types: - opened - synchronize - reopened - edited env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: wip: if: "!contains(github.event.head_commit.message, 'ci skip') && github.event_name == 'pull_request'" runs-on: ubuntu-latest steps: - name: Work in progress uses: wip/action@master xdg: if: "!contains(github.event.head_commit.message, 'ci skip')" runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 with: fetch-depth: 1 - name: Validate XDG files uses: liri-infra/xdg-validator-action@master with: strict: false 07070100000005000081A40000000000000000000000016202D08500000140000000000000000000000000000000000000003D00000000liri-session-20220208+git.f26b173/.github/workflows/copr.ymlname: COPR on: push: branches: - develop jobs: copr: if: "!contains(github.event.head_commit.message, 'ci skip') && !contains(github.event.head_commit.message, 'copr skip')" runs-on: ubuntu-latest steps: - name: Rebuild package run: curl -X POST ${{ secrets.COPR_WEBHOOK_URL }} 07070100000006000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003C00000000liri-session-20220208+git.f26b173/.github/workflows/scripts07070100000007000081ED0000000000000000000000016202D085000001D2000000000000000000000000000000000000004700000000liri-session-20220208+git.f26b173/.github/workflows/scripts/build-deps#!/bin/bash # SPDX-FileCopyrightText: 2021 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> # # SPDX-License-Identifier: BSD-3-Clause set -e branch=$1 if [ -z "$branch" ]; then echo "Usage: $0 [branch]" exit 1 fi curdir=$(dirname `readlink -f $0`) mkdir -p /tmp/build-deps pushd /tmp/build-deps git clone git://github.com/liri-infra/ci-scripts for repo in cmake-shared qtgsettings qtudev libliri; do ./ci-scripts/build-liri $repo $branch done popd 07070100000008000081A40000000000000000000000016202D0850000022F000000000000000000000000000000000000004200000000liri-session-20220208+git.f26b173/.github/workflows/transifex.ymlname: Translations Sync on: schedule: - cron: '0 0 * * *' repository_dispatch: types: - transifex jobs: update-translations: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2 - name: Update translations uses: liri-infra/translation-action@master env: TX_TOKEN: ${{ secrets.TX_TOKEN }} with: ssh_key: ${{ secrets.CI_SSH_KEY }} committer_name: Liri CI committer_email: ci@liri.io translations_folder: translations 07070100000009000081A40000000000000000000000016202D0850000001B000000000000000000000000000000000000002D00000000liri-session-20220208+git.f26b173/.gitignorebuild/ *.user *.qmlc *.jsc 0707010000000A000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000002900000000liri-session-20220208+git.f26b173/.reuse0707010000000B000081A40000000000000000000000016202D085000000D5000000000000000000000000000000000000002E00000000liri-session-20220208+git.f26b173/.reuse/dep5Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: Session Source: https://github.com/lirios/session Files: translations/* Copyright: 2020 Liri Translators License: CC0-1.0 0707010000000C000081A40000000000000000000000016202D0850000000C000000000000000000000000000000000000002700000000liri-session-20220208+git.f26b173/.tag$Format:%H$ 0707010000000D000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000002600000000liri-session-20220208+git.f26b173/.tx0707010000000E000081A40000000000000000000000016202D085000000C5000000000000000000000000000000000000002D00000000liri-session-20220208+git.f26b173/.tx/config[main] host = https://www.transifex.com [liri-session.session-entry] type = PO source_lang = en source_file = translations/manager/desktop.pot file_filter = translations/manager/desktop_<lang>.po 0707010000000F000081A40000000000000000000000016202D085000000F8000000000000000000000000000000000000003300000000liri-session-20220208+git.f26b173/.tx/sources.json[ { "type": "desktop", "source_file": "src/manager/liri.desktop.in.in", "dest_file": "src/manager/liri.desktop.in", "file_filter": "translations/manager/liri_<lang>.po", "output_path": "translations/manager/desktop.pot" } ] 07070100000010000081A40000000000000000000000016202D085000000CA000000000000000000000000000000000000002D00000000liri-session-20220208+git.f26b173/AUTHORS.mdSession ======= # Core Developers * Pier Luigi Fiorini # Contributors You can see the list of contributors to this code base, and the number of their commits with: ```sh git shortlog -s -e -n ``` 07070100000011000081A40000000000000000000000016202D085000007DE000000000000000000000000000000000000003100000000liri-session-20220208+git.f26b173/CMakeLists.txtcmake_minimum_required(VERSION 3.10.0) project("Session" VERSION "0.1.0" DESCRIPTION "Session manager" LANGUAGES CXX C ) ## Shared macros and functions: if(NOT LIRI_LOCAL_ECM) find_package(LiriCMakeShared "2.0.0" REQUIRED NO_MODULE) list(APPEND CMAKE_MODULE_PATH "${LCS_MODULE_PATH}") endif() ## Set minimum versions required: set(QT_MIN_VERSION "5.10.0") ## Liri specific setup common for all modules: include(LiriSetup) ## Only build on the appropriate platforms. if(NOT UNIX OR ANDROID) message(NOTICE "Skipping the build as the condition \"UNIX OR ANDROID\" is not met.") return() endif() ## Features: option(LIRI_SESSION_DEVELOPMENT_BUILD "Development build" OFF) add_feature_info("Session::DevelopmentBuild" LIRI_SESSION_DEVELOPMENT_BUILD "Build for development") option(LIRI_ENABLE_SYSTEMD "Enable systemd support" ON) add_feature_info("Liri::Systemd" LIRI_ENABLE_SYSTEMD "Enable systemd support") ## Variables: if(LIRI_ENABLE_SYSTEMD) set(INSTALL_SYSTEMDUSERUNITDIR "${INSTALL_LIBDIR}/systemd/user" CACHE PATH "systemd user unit directory [PREFIX/lib/systemd/user]") set(INSTALL_SYSTEMDUSERGENERATORSDIR "${INSTALL_LIBDIR}/systemd/user-generators" CACHE PATH "systemd user generators directory [PREFIX/lib/systemd/user-generators]") endif() ## Find Qt 5: find_package(Qt5 "${QT_MIN_VERSION}" CONFIG REQUIRED COMPONENTS Core DBus Xml Gui LinguistTools ) ## Add subdirectories: add_subdirectory(data/menu) add_subdirectory(data/settings) add_subdirectory(src/daemon) add_subdirectory(src/imports/session) add_subdirectory(src/manager) add_subdirectory(src/libdaemon) add_subdirectory(src/libsession) add_subdirectory(src/libsigwatch) add_subdirectory(src/plugins/daemon/locale) add_subdirectory(src/plugins/session/autostart) add_subdirectory(src/plugins/session/services) add_subdirectory(src/plugins/session/shell) if(LIRI_ENABLE_SYSTEMD) add_subdirectory(data/systemd) add_subdirectory(data/systemd/autostart) endif() 07070100000012000081A40000000000000000000000016202D0850000894B000000000000000000000000000000000000003000000000liri-session-20220208+git.f26b173/LICENSE.GPLv3 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The GNU General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. The precise terms and conditions for copying, distribution and modification follow. TERMS AND CONDITIONS 0. Definitions. "This License" refers to version 3 of the GNU General Public License. "Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. "The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. A "covered work" means either the unmodified Program or a work based on the Program. To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. 1. Source Code. The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those subprograms and other parts of the work. The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. The Corresponding Source for a work in source code form is that same work. 2. Basic Permissions. All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. 3. Protecting Users' Legal Rights From Anti-Circumvention Law. No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. 4. Conveying Verbatim Copies. You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. 5. Conveying Modified Source Versions. You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: a) The work must carry prominent notices stating that you modified it, and giving a relevant date. b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. 6. Conveying Non-Source Forms. You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. "Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. 7. Additional Terms. "Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or d) Limiting the use for publicity purposes of names of licensors or authors of the material; or e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. 8. Termination. You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. 9. Acceptance Not Required for Having Copies. You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. 10. Automatic Licensing of Downstream Recipients. Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. 11. Patents. A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. 12. No Surrender of Others' Freedom. If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. 13. Use with the GNU Affero General Public License. Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU Affero General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU General Public License, you may choose any version ever published by the Free Software Foundation. If the Program specifies that a proxy can decide which future versions of the GNU General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. 15. Disclaimer of Warranty. THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. Limitation of Liability. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. 17. Interpretation of Sections 15 and 16. If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. <one line to give the program's name and a brief idea of what it does.> Copyright (C) <year> <name of author> 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 <http://www.gnu.org/licenses/>. Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: <program> Copyright (C) <year> <name of author> This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU GPL, see <http://www.gnu.org/licenses/>. The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read <http://www.gnu.org/philosophy/why-not-lgpl.html>. 07070100000013000081A40000000000000000000000016202D08500001DE3000000000000000000000000000000000000003100000000liri-session-20220208+git.f26b173/LICENSE.LGPLv3 GNU LESSER GENERAL PUBLIC LICENSE Version 3, 29 June 2007 Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. This version of the GNU Lesser General Public License incorporates the terms and conditions of version 3 of the GNU General Public License, supplemented by the additional permissions listed below. 0. Additional Definitions. As used herein, "this License" refers to version 3 of the GNU Lesser General Public License, and the "GNU GPL" refers to version 3 of the GNU General Public License. "The Library" refers to a covered work governed by this License, other than an Application or a Combined Work as defined below. An "Application" is any work that makes use of an interface provided by the Library, but which is not otherwise based on the Library. Defining a subclass of a class defined by the Library is deemed a mode of using an interface provided by the Library. A "Combined Work" is a work produced by combining or linking an Application with the Library. The particular version of the Library with which the Combined Work was made is also called the "Linked Version". The "Minimal Corresponding Source" for a Combined Work means the Corresponding Source for the Combined Work, excluding any source code for portions of the Combined Work that, considered in isolation, are based on the Application, and not on the Linked Version. The "Corresponding Application Code" for a Combined Work means the object code and/or source code for the Application, including any data and utility programs needed for reproducing the Combined Work from the Application, but excluding the System Libraries of the Combined Work. 1. Exception to Section 3 of the GNU GPL. You may convey a covered work under sections 3 and 4 of this License without being bound by section 3 of the GNU GPL. 2. Conveying Modified Versions. If you modify a copy of the Library, and, in your modifications, a facility refers to a function or data to be supplied by an Application that uses the facility (other than as an argument passed when the facility is invoked), then you may convey a copy of the modified version: a) under this License, provided that you make a good faith effort to ensure that, in the event an Application does not supply the function or data, the facility still operates, and performs whatever part of its purpose remains meaningful, or b) under the GNU GPL, with none of the additional permissions of this License applicable to that copy. 3. Object Code Incorporating Material from Library Header Files. The object code form of an Application may incorporate material from a header file that is part of the Library. You may convey such object code under terms of your choice, provided that, if the incorporated material is not limited to numerical parameters, data structure layouts and accessors, or small macros, inline functions and templates (ten or fewer lines in length), you do both of the following: a) Give prominent notice with each copy of the object code that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the object code with a copy of the GNU GPL and this license document. 4. Combined Works. You may convey a Combined Work under terms of your choice that, taken together, effectively do not restrict modification of the portions of the Library contained in the Combined Work and reverse engineering for debugging such modifications, if you also do each of the following: a) Give prominent notice with each copy of the Combined Work that the Library is used in it and that the Library and its use are covered by this License. b) Accompany the Combined Work with a copy of the GNU GPL and this license document. c) For a Combined Work that displays copyright notices during execution, include the copyright notice for the Library among these notices, as well as a reference directing the user to the copies of the GNU GPL and this license document. d) Do one of the following: 0) Convey the Minimal Corresponding Source under the terms of this License, and the Corresponding Application Code in a form suitable for, and under terms that permit, the user to recombine or relink the Application with a modified version of the Linked Version to produce a modified Combined Work, in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source. 1) Use a suitable shared library mechanism for linking with the Library. A suitable mechanism is one that (a) uses at run time a copy of the Library already present on the user's computer system, and (b) will operate properly with a modified version of the Library that is interface-compatible with the Linked Version. e) Provide Installation Information, but only if you would otherwise be required to provide such information under section 6 of the GNU GPL, and only to the extent that such information is necessary to install and execute a modified version of the Combined Work produced by recombining or relinking the Application with a modified version of the Linked Version. (If you use option 4d0, the Installation Information must accompany the Minimal Corresponding Source and Corresponding Application Code. If you use option 4d1, you must provide the Installation Information in the manner specified by section 6 of the GNU GPL for conveying Corresponding Source.) 5. Combined Libraries. You may place library facilities that are a work based on the Library side by side in a single library together with other library facilities that are not Applications and are not covered by this License, and convey such a combined library under terms of your choice, if you do both of the following: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities, conveyed under the terms of this License. b) Give prominent notice with the combined library that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 6. Revised Versions of the GNU Lesser General Public License. The Free Software Foundation may publish revised and/or new versions of the GNU Lesser General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library as you received it specifies that a certain numbered version of the GNU Lesser General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that published version or of any later version published by the Free Software Foundation. If the Library as you received it does not specify a version number of the GNU Lesser General Public License, you may choose any version of the GNU Lesser General Public License ever published by the Free Software Foundation. If the Library as you received it specifies that a proxy can decide whether future versions of the GNU Lesser General Public License shall apply, that proxy's public statement of acceptance of any version is permanent authorization for you to choose that version for the Library. 07070100000014000081A40000000000000000000000016202D08500000FCB000000000000000000000000000000000000002C00000000liri-session-20220208+git.f26b173/README.mdSession ======= [![License](https://img.shields.io/badge/license-GPLv3.0-blue.svg)](https://www.gnu.org/licenses/gpl-3.0.html) [![GitHub release](https://img.shields.io/github/release/lirios/session.svg)](https://github.com/lirios/session) [![GitHub issues](https://img.shields.io/github/issues/lirios/session.svg)](https://github.com/lirios/session/issues) [![CI](https://github.com/lirios/session/workflows/CI/badge.svg?branch=develop)](https://github.com/lirios/session/actions?query=workflow%3ACI) The session is responsible for bootstrapping the initial environment and launching critical desktop services, including the shell, as well as XDG autostart applications. ## Dependencies Qt >= 5.10.0 with at least the following modules is required: * [qtbase](http://code.qt.io/cgit/qt/qtbase.git) The following modules and their dependencies are required: * [cmake](https://gitlab.kitware.com/cmake/cmake) >= 3.10.0 * [cmake-shared](https://github.com/lirios/cmake-shared.git) >= 1.0.0 * [qtgsettings](https://github.com/lirios/qtgsettings) >= 1.1.0 * [libliri](https://github.com/lirios/libliri) ## Installation ```sh mkdir build cd build cmake -DCMAKE_INSTALL_PREFIX=/path/to/prefix .. make make install # use sudo if necessary ``` Replace `/path/to/prefix` to your installation prefix. Default is `/usr/local`. You can also append the following options to the `cmake` command: * `-DLIRI_SESSION_DEVELOPMENT_BUILD:BOOL=ON`: Remove restrictions that gets in your way during development, such as ptrace being forbidden. * `-DLIRI_ENABLE_SYSTEMD:BOOL=OFF`: Disable systemd support. * `-DINSTALL_SYSTEMDUSERUNITDIR=/path/to/systemd/user`: Path to install systemd user units (default: `/usr/local/lib/systemd/user`). * `-DINSTALL_SYSTEMDUSERGENERATORSDIR=/path/to/systemd/user-generators`: Path to install systemd user generators (default: `/usr/local/lib/systemd/user-generators`). ## Licensing Licensed under the terms of the GNU General Public License version 3 or, at your option, any later version. ## Notes ### Logging categories Qt 5.2 introduced logging categories and Liri Shell takes advantage of them to make debugging easier. Please refer to the [Qt](http://doc.qt.io/qt-5/qloggingcategory.html) documentation to learn how to enable them. ### Available categories * Compositor: * **liri.session:** Session manager. ## Components *liri-session* Brings up the D-Bus session if $DBUS_SESSION_BUS_ADDRESS is not set, starts the shell, runs autostart programs and launches apps. It's extended by the following session modules: * **autostart:** Runs autostart programs. * **locale:** Sets locale environment variables based on settings. * **shell:** Starts the shell and waits for io.liri.Shell to be available. You can disable some session modules, for example if you don't want to set locale and run the autostart programs: ```sh liri-session --disable-modules=autostart,locale ``` ## Running on another window system The platform plugin to use is automatically detected based on the environment, it can be one of the following: * wayland: Run inside another Wayland compositor * xcb: Run inside a X11 session * liri: Uses DRM/KMS or a device specific EGL integration You can override the automatic detection, if it doesn't work as intended. ### X11 To run windowed inside a X11 session: ```sh liri-session -- -platform xcb ``` ### Wayland To run windowed inside a Wayland session: ```sh liri-session -- -platform wayland ``` Some compositors, such as Weston, support the fullscreen-shell protocol that allows a compositor to be nested into another compositor. Let's take Weston as an example. First you need to run it with the fullscreen-shell protocol enabled: ```sh weston --shell=fullscreen-shell.so ``` Then you need to run `liri-session` like this: ```sh QT_WAYLAND_SHELL_INTEGRATION=fullscreen-shell liri-session -- -platform wayland ``` ### DRM/KMS To make sure the Liri session runs without another window system type: ```sh liri-session -- -platform liri ``` 07070100000015000041ED0000000000000000000000056202D08500000000000000000000000000000000000000000000002700000000liri-session-20220208+git.f26b173/data07070100000016000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000002C00000000liri-session-20220208+git.f26b173/data/menu07070100000017000081A40000000000000000000000016202D08500000160000000000000000000000000000000000000003B00000000liri-session-20220208+git.f26b173/data/menu/CMakeLists.txtinstall( FILES liri-entertainment.directory liri-internet.directory liri-main.directory liri-system.directory liri-work.directory DESTINATION "${INSTALL_DATADIR}/desktop-directories" ) install( FILES liri-applications.menu DESTINATION "${INSTALL_SYSCONFDIR}/xdg/menus" ) 07070100000018000081A40000000000000000000000016202D08500000B48000000000000000000000000000000000000004300000000liri-session-20220208+git.f26b173/data/menu/liri-applications.menu<?xml version="1.0"?> <!DOCTYPE Menu PUBLIC "-//freedesktop//DTD Menu 1.0//EN" "http://www.freedesktop.org/standards/menu-spec/1.0/menu.dtd"> <Menu> <Name>Applications</Name> <Directory>liri-main.directory</Directory> <!-- Search the default locations --> <KDELegacyDirs/> <DefaultAppDirs/> <DefaultDirectoryDirs/> <!-- Merge third-party submenus and customized menus --> <DefaultMergeDirs/> <MergeFile>applications-kmenuedit.menu</MergeFile> <!-- Menus --> <Menu> <Name>Work</Name> <Directory>liri-work.directory</Directory> <Include> <Category>Development</Category> <Category>WebDevelopment</Category> <Category>Translation</Category> <Category>X-KDE-KDevelopIDE</Category> <Category>Astronomy</Category> <Category>Biology</Category> <Category>Chemistry</Category> <Category>Geology</Category> <Category>MedicalSoftware</Category> <Category>Physics</Category> <Category>Math</Category> <Category>Science</Category> <Category>Teaching</Category> <Category>Education</Category> <Category>Languages</Category> <Category>X-KDE-Edu-Language</Category> <Category>X-KDE-Edu-Teaching</Category> <Category>Graphics</Category> <Category>Audio</Category> <Category>Video</Category> <Category>AudioVideo</Category> <Category>Office</Category> </Include> </Menu> <Menu> <Name>Internet</Name> <Directory>liri-internet.directory</Directory> <Include> <Category>Network</Category> </Include> <Exclude> <Filename>knetattach.desktop</Filename> </Exclude> </Menu> <Menu> <Name>Entertainment</Name> <Directory>liri-entertainment.directory</Directory> <Include> <Category>Game</Category> <Category>ArcadeGame</Category> <Category>BoardGame</Category> <Category>CardGame</Category> <Category>X-KDE-KidsGame</Category> <Category>KidsGame</Category> <Category>StrategyGame</Category> <Category>LogicGame</Category> <Category>Amusement</Category> </Include> </Menu> <Menu> <Name>System</Name> <Directory>liri-system.directory</Directory> <Include> <Category>System</Category> <Category>Utility</Category> <Category>TextEditor</Category> <Category>Accessibility</Category> <Category>X-KDE-Utilities-Desktop</Category> <Category>X-KDE-Utilities-File</Category> <Category>X-KDE-Utilities-Peripherals</Category> <Category>X-KDE-Utilities-PIM</Category> <Category>KDE</Category> <Category>Core</Category> </Include> <Exclude> <Filename>kfind.desktop</Filename> <Filename>knetattach.desktop</Filename> </Exclude> </Menu> <Exclude> <Filename>kfind.desktop</Filename> <Filename>knetattach.desktop</Filename> </Exclude> <!-- Layout --> <Layout> <Merge type="all"/> <Menuname>Work</Menuname> <Menuname>Internet</Menuname> <Menuname>Entertainment</Menuname> <Menuname>System</Menuname> </Layout> </Menu> 07070100000019000081A40000000000000000000000016202D0850000004A000000000000000000000000000000000000004900000000liri-session-20220208+git.f26b173/data/menu/liri-entertainment.directory[Desktop Entry] Type=Directory Name=Entertainment Icon=applications-games 0707010000001A000081A40000000000000000000000016202D08500000048000000000000000000000000000000000000004400000000liri-session-20220208+git.f26b173/data/menu/liri-internet.directory[Desktop Entry] Type=Directory Name=Internet Icon=applications-internet 0707010000001B000081A40000000000000000000000016202D08500000049000000000000000000000000000000000000004000000000liri-session-20220208+git.f26b173/data/menu/liri-main.directory[Desktop Entry] Type=Directory Name=Liri OS Menu Icon=applications-other 0707010000001C000081A40000000000000000000000016202D08500000044000000000000000000000000000000000000004200000000liri-session-20220208+git.f26b173/data/menu/liri-system.directory[Desktop Entry] Type=Directory Name=System Icon=applications-system 0707010000001D000081A40000000000000000000000016202D08500000042000000000000000000000000000000000000004000000000liri-session-20220208+git.f26b173/data/menu/liri-work.directory[Desktop Entry] Type=Directory Name=Work Icon=applications-office 0707010000001E000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003000000000liri-session-20220208+git.f26b173/data/settings0707010000001F000081A40000000000000000000000016202D085000000A2000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/data/settings/CMakeLists.txtinstall( FILES io.liri.session.gschema.xml io.liri.session.locale.gschema.xml DESTINATION "${INSTALL_DATADIR}/glib-2.0/schemas" ) 07070100000020000081A40000000000000000000000016202D08500000320000000000000000000000000000000000000004C00000000liri-session-20220208+git.f26b173/data/settings/io.liri.session.gschema.xml<?xml version="1.0" encoding="UTF-8"?> <!-- This file is part of Liri. Copyright (C) 2015-2016 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. --> <schemalist gettext-domain="liri"> <schema id="io.liri.session" path="/io/liri/session/"> <key name="idle-delay" type="u"> <default>300</default> <summary>Time before the session is considered idle</summary> <description> The number of seconds of inactivity before the session is considered idle. </description> </key> </schema> </schemalist> 07070100000021000081A40000000000000000000000016202D08500000409000000000000000000000000000000000000005300000000liri-session-20220208+git.f26b173/data/settings/io.liri.session.locale.gschema.xml<?xml version="1.0" encoding="UTF-8"?> <!-- This file is part of Liri. Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. --> <schemalist gettext-domain="liri"> <schema id="io.liri.session.locale" path="/io/liri/session/locale/"> <key name="language" type="s"> <default>''</default> <summary>The locale used for messages</summary> <description> Specify the locale to be used for displaying messages. </description> </key> <key name="region" type="s"> <default>''</default> <summary>The locale used for dates and number formats</summary> <description> Specify the locale to be used for displaying dates, times and number formats. </description> </key> </schema> </schemalist> 07070100000022000041ED0000000000000000000000036202D08500000000000000000000000000000000000000000000002F00000000liri-session-20220208+git.f26b173/data/systemd07070100000023000081A40000000000000000000000016202D085000003A6000000000000000000000000000000000000003E00000000liri-session-20220208+git.f26b173/data/systemd/CMakeLists.txtif(IS_ABSOLUTE "${INSTALL_BINDIR}") set(ABSOLUTE_BINDIR "${INSTALL_BINDIR}") else() set(ABSOLUTE_BINDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}") endif() if(IS_ABSOLUTE "${INSTALL_LIBEXECDIR}") set(ABSOLUTE_LIBEXECDIR "${INSTALL_LIBEXECDIR}") else() set(ABSOLUTE_LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}") endif() configure_file( "liri-daemon-locale.service.in" "${CMAKE_CURRENT_BINARY_DIR}/liri-daemon-locale.service" @ONLY ) configure_file( "liri-session-shutdown.service.in" "${CMAKE_CURRENT_BINARY_DIR}/liri-session-shutdown.service" @ONLY ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/liri-daemon-locale.service" liri-daemons.target liri-services.target liri-session-pre.target "${CMAKE_CURRENT_BINARY_DIR}/liri-session-shutdown.service" liri-session.target DESTINATION "${INSTALL_SYSTEMDUSERUNITDIR}" ) 07070100000024000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003900000000liri-session-20220208+git.f26b173/data/systemd/autostart07070100000025000081A40000000000000000000000016202D08500000081000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/data/systemd/autostart/CMakeLists.txtinstall( FILES pulseaudio.desktop DESTINATION "${INSTALL_DATADIR}/liri-session/systemd-user/autostart" ) 07070100000026000081A40000000000000000000000016202D0850000001C000000000000000000000000000000000000004C00000000liri-session-20220208+git.f26b173/data/systemd/autostart/pulseaudio.desktop[Desktop Entry] Hidden=true 07070100000027000081A40000000000000000000000016202D085000000EE000000000000000000000000000000000000004D00000000liri-session-20220208+git.f26b173/data/systemd/liri-daemon-locale.service.in[Unit] Description=Change locale environment variables from the settings PartOf=liri-daemons.target [Service] Type=dbus ExecStart=@ABSOLUTE_LIBEXECDIR@/liri-daemon --module=locale BusName=io.liri.Daemon.Modules.Locale Restart=on-failure 07070100000028000081A40000000000000000000000016202D0850000011E000000000000000000000000000000000000004300000000liri-session-20220208+git.f26b173/data/systemd/liri-daemons.target[Unit] Description=Daemons that perform automated tasks or configure the graphical Liri session BindsTo=liri-daemon-locale.service After=liri-daemon-locale.service After=liri-services.target StopWhenUnneeded=yes # Never manually start or stop RefuseManualStart=yes RefuseManualStop=yes 07070100000029000081A40000000000000000000000016202D085000000A3000000000000000000000000000000000000004400000000liri-session-20220208+git.f26b173/data/systemd/liri-services.target[Unit] Description=Services used by the Liri graphical user session StopWhenUnneeded=yes # Never manually start or stop RefuseManualStart=yes RefuseManualStop=yes 0707010000002A000081A40000000000000000000000016202D08500000159000000000000000000000000000000000000004700000000liri-session-20220208+git.f26b173/data/systemd/liri-session-pre.target[Unit] Description=Session services to run before the Liri graphical user session starts StopWhenUnneeded=yes PartOf=liri-session.target BindsTo=graphical-session-pre.target Requires=liri-services.target liri-daemons.target After=liri-services.target liri-daemons.target # Never manually start or stop RefuseManualStart=yes RefuseManualStop=yes 0707010000002B000081A40000000000000000000000016202D085000000A3000000000000000000000000000000000000005000000000liri-session-20220208+git.f26b173/data/systemd/liri-session-shutdown.service.in[Unit] Description=Trigger shutdown of a Liri session CollectMode=inactive-or-failed [Service] Type=oneshot ExecStart=@ABSOLUTE_BINDIR@/liri-session-ctl --logout 0707010000002C000081A40000000000000000000000016202D085000000E5000000000000000000000000000000000000004300000000liri-session-20220208+git.f26b173/data/systemd/liri-session.target[Unit] Description=Liri graphical user session BindsTo=graphical-session.target Requires=liri-session-pre.target liri-shell.target liri-shell-helper.target After=liri-session-pre.target liri-shell.target liri-shell-helper.target 0707010000002D000041ED0000000000000000000000096202D08500000000000000000000000000000000000000000000002600000000liri-session-20220208+git.f26b173/src0707010000002E000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000002D00000000liri-session-20220208+git.f26b173/src/daemon0707010000002F000081A40000000000000000000000016202D08500000416000000000000000000000000000000000000003C00000000liri-session-20220208+git.f26b173/src/daemon/CMakeLists.txt# Defines set(DEFINES "") if(LIRI_SESSION_DEVELOPMENT_BUILD) list(APPEND DEFINES "DEVELOPMENT_BUILD") endif() # Absolute paths if(IS_ABSOLUTE "${INSTALL_PLUGINSDIR}") set(PLUGINSDIR "${INSTALL_PLUGINSDIR}") else() set(PLUGINSDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINSDIR}") endif() if(LIRI_ENABLE_SYSTEMD) list(APPEND DEFINES "ENABLE_SYSTEMD") endif() liri_add_executable(LiriDaemon OUTPUT_NAME "liri-daemon" SOURCES daemon.cpp daemon.h daemoninterface.cpp daemoninterface.h main.cpp pluginregistry.cpp pluginregistry.h DBUS_ADAPTOR_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/io.liri.Daemon.xml" DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH LIRI_DAEMON_VERSION="${PROJECT_VERSION}" ${DEFINES} PLUGINSDIR="${PLUGINSDIR}" INSTALL_DIRECTORY "${INSTALL_LIBEXECDIR}" LIBRARIES Qt5::Core Qt5::DBus Sigwatch Liri::Daemon ) liri_finalize_executable(LiriDaemon) 07070100000030000081A40000000000000000000000016202D08500001A5E000000000000000000000000000000000000003800000000liri-session-20220208+git.f26b173/src/daemon/daemon.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QCoreApplication> #include <QDBusConnection> #include <QDBusMessage> #include <libsigwatch/sigwatch.h> #include "daemon.h" #include "daemoninterface.h" #include "pluginregistry.h" Q_LOGGING_CATEGORY(lcDaemon, "liri.daemon", QtInfoMsg) Q_GLOBAL_STATIC(Daemon, s_daemon) Daemon::Daemon(QObject *parent) : QObject(parent) , m_pluginRegistry(new PluginRegistry(this)) { // Unix signals watcher UnixSignalWatcher *sigwatch = new UnixSignalWatcher(this); sigwatch->watchForSignal(SIGINT); sigwatch->watchForSignal(SIGTERM); // Quit when the process is killed connect(sigwatch, &UnixSignalWatcher::unixSignal, this, &Daemon::shutdown); } bool Daemon::isSystemdEnabled() const { return m_systemdEnabled; } void Daemon::setSystemdEnabled(bool value) { if (m_systemdEnabled && !value) { qCWarning(lcDaemon, "Systemd support cannot be disabled once the program has started"); return; } m_systemdEnabled = value; } bool Daemon::isShuttingDown() const { return !m_running; } void Daemon::disableModule(const QString &name) { m_disabledModules.append(name); } bool Daemon::initialize() { // Create D-Bus service if (!isSystemdEnabled()) m_interface = new DaemonInterface(this); // Register D-Bus objects if (m_interface && !m_interface->registerWithDBus()) return false; // Discover plugins m_pluginRegistry->discover(); // Add modules to the list PluginsMap plugins = m_pluginRegistry->plugins(); PluginsMap::iterator it; for (it = plugins.begin(); it != plugins.end(); ++it) { auto name = it.key(); auto instance = it.value(); auto module = dynamic_cast<Liri::DaemonModule *>(instance); if (!module) { qCWarning(lcDaemon, "Plugin \"%s\" is not a daemon module", qPrintable(name)); continue; } // Remove the module when it is deleted connect(module, &Liri::DaemonModule::moduleDeleted, this, [this, module] { m_loadedModules.removeOne(module); m_modules.removeOne(module); m_modulesOnDemand.removeOne(module); }); auto metaData = m_pluginRegistry->getMetaData(name); if (metaData.value(QStringLiteral("X-Liri-DaemonModule-AutoLoad"), true).toBool()) m_modules.append(module); else m_modulesOnDemand.append(module); } return true; } void Daemon::start() { // This is needed only in normal mode if (isSystemdEnabled()) return; // Start all modules for (auto *module : qAsConst(m_modules)) { auto name = m_pluginRegistry->getNameForInstance(module); if (!module) { qCWarning(lcDaemon, "Ignoring invalid session module \"%s\"", qPrintable(name)); continue; } // Skip disabled modules if (m_disabledModules.contains(name)) continue; // Start qCInfo(lcDaemon, "==> Starting module \"%s\"", qPrintable(name)); module->start(); m_loadedModules.append(module); qCInfo(lcDaemon, "Module \"%s\" started", qPrintable(name)); } } void Daemon::shutdown() { m_running = false; qCInfo(lcDaemon, "Stopping..."); // Stop modules std::reverse(m_loadedModules.begin(), m_loadedModules.end()); for (auto *module : qAsConst(m_loadedModules)) { auto *instance = dynamic_cast<QObject *>(module); const auto name = m_pluginRegistry->getNameForInstance(instance); // Stop unloadModule(name); } qCInfo(lcDaemon, "Bye"); QCoreApplication::quit(); } void Daemon::loadModule(const QString &name) { // Skip disabled modules if (m_disabledModules.contains(name)) return; // Find module auto *instance = m_pluginRegistry->getInstance(name); auto *module = qobject_cast<Liri::DaemonModule *>(instance); // Load module if (!m_loadedModules.contains(module)) { if (!m_modules.contains(module)) { qCWarning(lcDaemon, "Cannot find module \"%s\"", qPrintable(name)); return; } qCInfo(lcDaemon, "==> Starting module \"%s\"", qPrintable(name)); // Claim a D-Bus service name so that systemd knows it started if (isSystemdEnabled()) { auto metaData = m_pluginRegistry->getMetaData(name); auto serviceName = metaData[QStringLiteral("X-Liri-DaemonModule-ServiceName")].toString(); if (!QDBusConnection::sessionBus().registerService(serviceName)) { qCWarning(lcDaemon, "Failed to register D-Bus service %s: %s", qPrintable(serviceName), qPrintable(QDBusConnection::sessionBus().lastError().message())); return; } } module->start(); m_loadedModules.append(module); qCInfo(lcDaemon, "Module \"%s\" started", qPrintable(name)); } } void Daemon::unloadModule(const QString &name) { if (isShuttingDown()) return; // Find module auto *instance = m_pluginRegistry->getInstance(name); auto *module = qobject_cast<Liri::DaemonModule *>(instance); // Unload module if (m_loadedModules.contains(module)) { qCInfo(lcDaemon, "==> Stopping module \"%s\"", qPrintable(name)); module->stop(); m_loadedModules.removeOne(module); qCInfo(lcDaemon, "Module \"%s\" stopped", qPrintable(name)); // With systemd our sole purpose is to load a single module, quit if we are done if (isSystemdEnabled()) QCoreApplication::quit(); } } Daemon *Daemon::instance() { return s_daemon(); } 07070100000031000081A40000000000000000000000016202D085000007FB000000000000000000000000000000000000003600000000liri-session-20220208+git.f26b173/src/daemon/daemon.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef DAEMON_H #define DAEMON_H #include <QLoggingCategory> #include <QObject> #include <QProcessEnvironment> #include <QVector> #include <LiriDaemon/DaemonModule> Q_DECLARE_LOGGING_CATEGORY(lcDaemon) class DaemonInterface; class PluginRegistry; typedef QVector<Liri::DaemonModule *> ModulesList; class Daemon : public QObject { Q_OBJECT public: explicit Daemon(QObject *parent = nullptr); bool isSystemdEnabled() const; void setSystemdEnabled(bool value); bool isShuttingDown() const; void disableModule(const QString &name); bool initialize(); void start(); public Q_SLOTS: void shutdown(); public: void loadModule(const QString &name); void unloadModule(const QString &name); static Daemon *instance(); private: bool m_systemdEnabled = true; bool m_running = true; QStringList m_disabledModules; PluginRegistry *m_pluginRegistry = nullptr; ModulesList m_modules; ModulesList m_modulesOnDemand; ModulesList m_loadedModules; DaemonInterface *m_interface = nullptr; }; #endif // DAEMON_H 07070100000032000081A40000000000000000000000016202D085000008E8000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/daemon/daemoninterface.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include "daemon.h" #include "daemoninterface.h" #include "daemon_adaptor.h" #define SERVICE_NAME QStringLiteral("io.liri.Daemon") #define OBJECT_PATH QStringLiteral("/io/liri/Daemon") DaemonInterface::DaemonInterface(QObject *parent) : QObject(parent) { new DaemonAdaptor(this); } DaemonInterface::~DaemonInterface() { QDBusConnection bus = QDBusConnection::sessionBus(); bus.unregisterObject(OBJECT_PATH); bus.unregisterService(SERVICE_NAME); } bool DaemonInterface::registerWithDBus() { QDBusConnection bus = QDBusConnection::sessionBus(); if (!bus.registerService(SERVICE_NAME)) { qCWarning(lcDaemon, "Couldn't register %s D-Bus service: %s", qPrintable(SERVICE_NAME), qPrintable(bus.lastError().message())); return false; } if (!bus.registerObject(OBJECT_PATH, this)) { qCWarning(lcDaemon, "Couldn't register %s D-Bus object: %s", qPrintable(OBJECT_PATH), qPrintable(bus.lastError().message())); return false; } return true; } void DaemonInterface::LoadModule(const QString &name) { Daemon::instance()->loadModule(name); } void DaemonInterface::UnloadModule(const QString &name) { Daemon::instance()->unloadModule(name); } 07070100000033000081A40000000000000000000000016202D0850000053B000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/daemon/daemoninterface.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef DAEMONINTERFACE_H #define DAEMONINTERFACE_H #include <QObject> class DaemonInterface : public QObject { Q_OBJECT public: explicit DaemonInterface(QObject *parent = nullptr); ~DaemonInterface(); bool registerWithDBus(); public Q_SLOTS: void LoadModule(const QString &name); void UnloadModule(const QString &name); }; #endif // DAEMONINTERFACE_H 07070100000034000081A40000000000000000000000016202D0850000018F000000000000000000000000000000000000004000000000liri-session-20220208+git.f26b173/src/daemon/io.liri.Daemon.xml<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node> <interface name="io.liri.Daemon"> <method name="LoadModule"> <arg name="name" type="s" direction="in"/> </method> <method name="UnloadModule"> <arg name="name" type="s" direction="in"/> </method> </interface> </node> 07070100000035000081A40000000000000000000000016202D08500000B5D000000000000000000000000000000000000003600000000liri-session-20220208+git.f26b173/src/daemon/main.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDir> #include <QCommandLineParser> #include <QCoreApplication> #include <QSharedPointer> #include <QTimer> #include "daemon.h" #include <unistd.h> #define TR(x) QT_TRANSLATE_NOOP("Command line parser", QStringLiteral(x)) int main(int argc, char *argv[]) { #ifndef DEVELOPMENT_BUILD if (::getuid() == 0) { qWarning("Liri daemon cannot be run as root!"); return 1; } #endif // Application QCoreApplication app(argc, argv); app.setApplicationName(QStringLiteral("Daemon")); app.setApplicationVersion(QStringLiteral(LIRI_DAEMON_VERSION)); app.setOrganizationName(QStringLiteral("Liri")); app.setOrganizationDomain(QStringLiteral("liri.io")); // Command line parser QCommandLineParser parser; parser.setApplicationDescription(TR("Liri daemon")); parser.addHelpOption(); parser.addVersionOption(); #ifdef ENABLE_SYSTEMD // Module to load QCommandLineOption moduleOption( QStringLiteral("module"), TR("Module to start from a systemd unit"), TR("name")); parser.addOption(moduleOption); #endif // Parse command line parser.process(app); // Create the daemon auto *daemon = Daemon::instance(); // Arguments #ifdef ENABLE_SYSTEMD const QString module = parser.value(moduleOption).trimmed(); const bool systemdSupport = !module.isEmpty(); #else const bool systemdSupport = false; #endif // Set systemd flag daemon->setSystemdEnabled(systemdSupport); // Go QTimer::singleShot(0, &app, [=] { // Initialize daemon if (!daemon->initialize()) { QCoreApplication::exit(1); return; } // Start a specific module with systemd, or all modules #ifdef ENABLE_SYSTEMD if (systemdSupport) daemon->loadModule(module); else #endif daemon->start(); }); return app.exec(); } 07070100000036000081A40000000000000000000000016202D08500000D3A000000000000000000000000000000000000004000000000liri-session-20220208+git.f26b173/src/daemon/pluginregistry.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDir> #include <QJsonObject> #include <QPluginLoader> #include <QStaticPlugin> #include <QVector> #include "daemon.h" #include "pluginregistry.h" PluginRegistry::PluginRegistry(QObject *parent) : QObject(parent) { } PluginsMap PluginRegistry::plugins() const { return m_plugins; } bool PluginRegistry::hasPlugin(const QString &name) const { return m_plugins.contains(name); } QVariantMap PluginRegistry::getMetaData(const QString &name) const { return m_pluginsMetaData[name]; } QObject *PluginRegistry::getInstance(const QString &name) const { if (!m_plugins.contains(name)) return nullptr; return m_plugins[name]; } QString PluginRegistry::getNameForInstance(QObject *instance) const { return m_plugins.key(instance); } void PluginRegistry::discover() { // Find static plugins first const auto staticPlugins = QPluginLoader::staticPlugins(); for (QStaticPlugin staticPlugin : staticPlugins) { const auto json = staticPlugin.metaData().toVariantMap(); addPlugin(staticPlugin.instance(), json); } // Find external plugins QDir pluginsDir(QString::asprintf("%s/liri/daemon", PLUGINSDIR)); const auto entryList = pluginsDir.entryList(QDir::Files); for (const auto &fileName : entryList) { QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); addPlugin(loader.instance(), loader.metaData().toVariantMap()); } } void PluginRegistry::addPlugin(QObject *instance, const QVariantMap &json) { // Must have interface ID and metadata if (!json.contains(QStringLiteral("IID")) || !json.contains(QStringLiteral("MetaData"))) { qCWarning(lcDaemon, "Ignoring invalid plugin"); return; } // Check the interface ID, even though we only have this kind of plugins if (json[QStringLiteral("IID")] != QStringLiteral(LiriDaemonModule_iid)) return; // Add to the list const auto metaData = json[QStringLiteral("MetaData")].toMap(); const auto id = metaData.value(QStringLiteral("Id")).toString(); const auto type = metaData.value(QStringLiteral("Type")).toString(); if (type != QStringLiteral("DaemonModule")) { qCWarning(lcDaemon, "Plugin \"%s\" is of type %s instead of DaemonModule", qPrintable(id), qPrintable(type)); return; } m_plugins[id] = instance; m_pluginsMetaData[id] = metaData; } 07070100000037000081A40000000000000000000000016202D0850000067F000000000000000000000000000000000000003E00000000liri-session-20220208+git.f26b173/src/daemon/pluginregistry.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef PLUGINREGISTRY_H #define PLUGINREGISTRY_H #include <QObject> #include <QHash> typedef QHash<QString, QObject *> PluginsMap; class PluginRegistry : public QObject { Q_OBJECT public: explicit PluginRegistry(QObject *parent = nullptr); PluginsMap plugins() const; bool hasPlugin(const QString &name) const; QVariantMap getMetaData(const QString &name) const; QObject *getInstance(const QString &name) const; QString getNameForInstance(QObject *instance) const; void discover(); private: PluginsMap m_plugins; QMap<QString, QVariantMap> m_pluginsMetaData; void addPlugin(QObject *instance, const QVariantMap &json); }; #endif // PLUGINREGISTRY_H 07070100000038000041ED0000000000000000000000036202D08500000000000000000000000000000000000000000000002E00000000liri-session-20220208+git.f26b173/src/imports07070100000039000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003600000000liri-session-20220208+git.f26b173/src/imports/session0707010000003A000081A40000000000000000000000016202D085000001C9000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/src/imports/session/CMakeLists.txtliri_add_qml_plugin(SessionQmlPlugin MODULE_PATH "Liri/Session" VERSION "1.0" OUTPUT_NAME "sessionplugin" SOURCES plugin.cpp qmllauncher.cpp qmllauncher.h qmlsessionmanager.cpp qmlsessionmanager.h QML_FILES qmldir DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH PUBLIC_LIBRARIES Qt5::Core Qt5::DBus ) liri_finalize_qml_plugin(SessionQmlPlugin) 0707010000003B000081A40000000000000000000000016202D085000003C1000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/imports/session/plugin.cpp// SPDX-FileCopyrightText: 2021 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> // // SPDX-License-Identifier: LGPL-3.0-or-later #include <QtQml> #include "qmllauncher.h" #include "qmlsessionmanager.h" class SessionPlugin : public QQmlExtensionPlugin { Q_OBJECT Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QQmlExtensionInterface") public: void registerTypes(const char *uri) override { Q_ASSERT(strcmp(uri, "Liri.Session") == 0); // @uri Liri.Session qmlRegisterSingletonType<QmlLauncher>(uri, 1, 0, "Launcher", [](QQmlEngine *, QJSEngine *) -> QObject * { return new QmlLauncher(); }); qmlRegisterSingletonType<QmlSessionManager>(uri, 1, 0, "SessionManager", [](QQmlEngine *, QJSEngine *) -> QObject * { return new QmlSessionManager(); }); } }; #include "plugin.moc" 0707010000003C000081A40000000000000000000000016202D0850000005B000000000000000000000000000000000000003D00000000liri-session-20220208+git.f26b173/src/imports/session/qmldirmodule Liri.Session plugin sessionplugin classname SessionPlugin typeinfo plugins.qmltypes 0707010000003D000081A40000000000000000000000016202D08500000BD9000000000000000000000000000000000000004600000000liri-session-20220208+git.f26b173/src/imports/session/qmllauncher.cpp// SPDX-FileCopyrightText: 2021 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> // // SPDX-License-Identifier: LGPL-3.0-or-later #include <QDBusConnection> #include <QDBusError> #include <QDBusPendingCallWatcher> #include <QDBusPendingReply> #include "qmllauncher.h" Q_LOGGING_CATEGORY(lcLauncher, "liri.session.launcher", QtInfoMsg) QmlLauncher::QmlLauncher(QObject *parent) : QObject(parent) { } void QmlLauncher::launchApplication(const QString &appId) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.Launcher"), QStringLiteral("/io/liri/Launcher"), QStringLiteral("io.liri.Launcher"), QStringLiteral("LaunchApplication")); QVariantList args; args.append(appId); msg.setArguments(args); QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg); auto *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher *self) { QDBusPendingReply<> reply = *self; if (reply.isError()) qCWarning(lcLauncher, "Failed to launch application: %s", qPrintable(reply.error().message())); self->deleteLater(); }); } void QmlLauncher::launchDesktopFile(const QString &fileName) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.Launcher"), QStringLiteral("/io/liri/Launcher"), QStringLiteral("io.liri.Launcher"), QStringLiteral("LaunchDesktopFile")); QVariantList args; args.append(fileName); msg.setArguments(args); QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg); auto *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher *self) { QDBusPendingReply<> reply = *self; if (reply.isError()) qCWarning(lcLauncher, "Failed to launch application from desktop file: %s", qPrintable(reply.error().message())); self->deleteLater(); }); } void QmlLauncher::launchCommand(const QString &command) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.Launcher"), QStringLiteral("/io/liri/Launcher"), QStringLiteral("io.liri.Launcher"), QStringLiteral("LaunchCommand")); QVariantList args; args.append(command); msg.setArguments(args); QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg); auto *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher *self) { QDBusPendingReply<> reply = *self; if (reply.isError()) qCWarning(lcLauncher, "Failed to launch command: %s", qPrintable(reply.error().message())); self->deleteLater(); }); } 0707010000003E000081A40000000000000000000000016202D08500000270000000000000000000000000000000000000004400000000liri-session-20220208+git.f26b173/src/imports/session/qmllauncher.h// SPDX-FileCopyrightText: 2021 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> // // SPDX-License-Identifier: LGPL-3.0-or-later #ifndef LIRI_QML_SESSION_LAUNCHER_H #define LIRI_QML_SESSION_LAUNCHER_H #include <QObject> #include <QLoggingCategory> Q_DECLARE_LOGGING_CATEGORY(lcLauncher) class QmlLauncher : public QObject { Q_OBJECT public: QmlLauncher(QObject *parent = nullptr); Q_INVOKABLE void launchApplication(const QString &appId); Q_INVOKABLE void launchDesktopFile(const QString &fileName); Q_INVOKABLE void launchCommand(const QString &command); }; #endif // LIRI_QML_SESSION_LAUNCHER_H 0707010000003F000081A40000000000000000000000016202D08500001253000000000000000000000000000000000000004C00000000liri-session-20220208+git.f26b173/src/imports/session/qmlsessionmanager.cpp// SPDX-FileCopyrightText: 2021 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> // // SPDX-License-Identifier: LGPL-3.0-or-later #include <QDBusConnection> #include <QDBusError> #include <QDBusPendingCallWatcher> #include <QDBusPendingReply> #include "qmlsessionmanager.h" Q_LOGGING_CATEGORY(lcSession, "liri.session.manager", QtInfoMsg) /* * QmlSessionManager */ QmlSessionManager::QmlSessionManager(QObject *parent) : QObject(parent) { // Emit when the session is locked or unlocked QDBusConnection::sessionBus().connect( QStringLiteral("io.liri.SessionManager"), QStringLiteral("/io/liri/SessionManager"), QStringLiteral("io.liri.SessionManager"), QStringLiteral("Locked"), this, SIGNAL(sessionLocked())); QDBusConnection::sessionBus().connect( QStringLiteral("io.liri.SessionManager"), QStringLiteral("/io/liri/SessionManager"), QStringLiteral("io.liri.SessionManager"), QStringLiteral("Unlocked"), this, SIGNAL(sessionUnlocked())); } bool QmlSessionManager::isIdle() const { return m_idle; } void QmlSessionManager::setIdle(bool value) { if (m_idle == value) return; auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.SessionManager"), QStringLiteral("/io/liri/SessionManager"), QStringLiteral("io.liri.SessionManager"), QStringLiteral("SetIdle")); msg.setArguments(QVariantList() << value); QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg); auto *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [&](QDBusPendingCallWatcher *self) { QDBusPendingReply<> reply = *self; if (reply.isError()) { qCWarning(lcSession, "Failed to toggle idle flag: %s", qPrintable(reply.error().message())); } else { m_idle = value; emit idleChanged(m_idle); } self->deleteLater(); }); } void QmlSessionManager::lock() { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.SessionManager"), QStringLiteral("/io/liri/SessionManager"), QStringLiteral("io.liri.SessionManager"), QStringLiteral("Lock")); QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg); auto *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher *self) { QDBusPendingReply<> reply = *self; if (reply.isError()) qCWarning(lcSession, "Failed to lock session: %s", qPrintable(reply.error().message())); self->deleteLater(); }); } void QmlSessionManager::unlock() { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.SessionManager"), QStringLiteral("/io/liri/SessionManager"), QStringLiteral("io.liri.SessionManager"), QStringLiteral("Unlock")); QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg); auto *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher *self) { QDBusPendingReply<> reply = *self; if (reply.isError()) qCWarning(lcSession, "Failed to unlock the session: %s", qPrintable(reply.error().message())); self->deleteLater(); }); } void QmlSessionManager::setEnvironment(const QString &key, const QString &value) { qputenv(key.toLocal8Bit().constData(), value.toLocal8Bit()); auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.SessionManager"), QStringLiteral("/io/liri/SessionManager"), QStringLiteral("io.liri.SessionManager"), QStringLiteral("SetEnvironment")); QVariantList args; args.append(key); args.append(value); msg.setArguments(args); QDBusPendingCall call = QDBusConnection::sessionBus().asyncCall(msg); auto *watcher = new QDBusPendingCallWatcher(call, this); connect(watcher, &QDBusPendingCallWatcher::finished, this, [](QDBusPendingCallWatcher *self) { QDBusPendingReply<> reply = *self; if (reply.isError()) qCWarning(lcSession, "Failed to set environment: %s", qPrintable(reply.error().message())); self->deleteLater(); }); } 07070100000040000081A40000000000000000000000016202D085000003A7000000000000000000000000000000000000004A00000000liri-session-20220208+git.f26b173/src/imports/session/qmlsessionmanager.h// SPDX-FileCopyrightText: 2021 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> // // SPDX-License-Identifier: LGPL-3.0-or-later #ifndef LIRI_QML_SESSION_SESSIONMANAGER_H #define LIRI_QML_SESSION_SESSIONMANAGER_H #include <QObject> #include <QLoggingCategory> Q_DECLARE_LOGGING_CATEGORY(lcSession) class QmlSessionManager : public QObject { Q_OBJECT Q_PROPERTY(bool idle READ isIdle WRITE setIdle NOTIFY idleChanged) public: QmlSessionManager(QObject *parent = nullptr); bool isIdle() const; void setIdle(bool value); Q_INVOKABLE void lock(); Q_INVOKABLE void unlock(); Q_INVOKABLE void setEnvironment(const QString &key, const QString &value); Q_SIGNALS: void idleChanged(bool value); void idleInhibitRequested(); void idleUninhibitRequested(); void sessionLocked(); void sessionUnlocked(); private: bool m_idle = false; }; #endif // LIRI_QML_SESSION_SESSIONMANAGER_H 07070100000041000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003000000000liri-session-20220208+git.f26b173/src/libdaemon07070100000042000081A40000000000000000000000016202D085000001C1000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/libdaemon/CMakeLists.txt# Defines set(DEFINES "") if(LIRI_ENABLE_SYSTEMD) list(APPEND DEFINES "ENABLE_SYSTEMD") endif() liri_add_module(Daemon DESCRIPTION "Daemon" SOURCES daemonmodule.cpp daemonmodule.h DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH ${DEFINES} PUBLIC_LIBRARIES Qt5::Core Qt5::DBus PKGCONFIG_DEPENDENCIES Qt5Core Qt5DBus ) liri_finalize_module(Daemon) 07070100000043000081A40000000000000000000000016202D08500000516000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/libdaemon/daemonmodule.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:LGPLv3+$ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include "daemonmodule.h" namespace Liri { class DaemonModulePrivate { public: DaemonModulePrivate() {} }; DaemonModule::DaemonModule(QObject *parent) : QObject(parent) , d_ptr(new DaemonModulePrivate) { } DaemonModule::~DaemonModule() { emit moduleDeleted(); delete d_ptr; } } // namespace Liri 07070100000044000081A40000000000000000000000016202D08500000694000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/libdaemon/daemonmodule.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:LGPLv3+$ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef LIRI_DAEMONMODULE_H #define LIRI_DAEMONMODULE_H #include <QtPlugin> #include <QObject> #include <LiriDaemon/liridaemonglobal.h> #define LiriDaemonModule_iid "io.liri.Daemon.Module/1.0" namespace Liri { class DaemonModulePrivate; class LIRIDAEMON_EXPORT DaemonModule : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(DaemonModule) public: explicit DaemonModule(QObject *parent = nullptr); virtual ~DaemonModule(); virtual void start() = 0; virtual void stop() = 0; Q_SIGNALS: void moduleDeleted(); private: DaemonModulePrivate *const d_ptr; }; } // namespace Liri Q_DECLARE_INTERFACE(Liri::DaemonModule, LiriDaemonModule_iid) #endif // LIRI_DAEMONMODULE_H 07070100000045000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003100000000liri-session-20220208+git.f26b173/src/libsession07070100000046000081A40000000000000000000000016202D0850000014D000000000000000000000000000000000000004000000000liri-session-20220208+git.f26b173/src/libsession/CMakeLists.txtliri_add_module(Session DESCRIPTION "Session manager" SOURCES sessionmodule.cpp sessionmodule.h sessionmodule_p.h DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH PUBLIC_LIBRARIES Qt5::Core PKGCONFIG_DEPENDENCIES Qt5Core ) liri_finalize_module(Session) 07070100000047000081A40000000000000000000000016202D0850000069C000000000000000000000000000000000000004300000000liri-session-20220208+git.f26b173/src/libsession/sessionmodule.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:LGPLv3+$ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QMap> #include "sessionmodule.h" #include "sessionmodule_p.h" namespace Liri { // SessionModulePrivate SessionModulePrivate::SessionModulePrivate(SessionModule *self) : q_ptr(self) { } void SessionModulePrivate::setSystemdEnabled(bool enabled) { Q_Q(SessionModule); if (systemd == enabled) return; systemd = enabled; emit q->systemdEnabledChanged(); } // SessionModule SessionModule::SessionModule(QObject *parent) : QObject(parent) , d_ptr(new SessionModulePrivate(this)) { } SessionModule::~SessionModule() { delete d_ptr; } bool SessionModule::isSystemdEnabled() const { Q_D(const SessionModule); return d->systemd; } } // namespace Liri 07070100000048000081A40000000000000000000000016202D0850000089A000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/libsession/sessionmodule.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:LGPLv3+$ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef LIRI_SESSIONMODULE_H #define LIRI_SESSIONMODULE_H #include <QtPlugin> #include <QObject> #include <LiriSession/lirisessionglobal.h> #define LiriSessionModule_iid "io.liri.Session.Module/1.0" namespace Liri { class SessionModulePrivate; class LIRISESSION_EXPORT SessionModule : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(SessionModule) Q_PROPERTY(bool systemdEnabled READ isSystemdEnabled NOTIFY systemdEnabledChanged) public: enum StartupPhase { EarlyInitialization, Initialization, WindowManager, Daemons, Applications }; Q_ENUM(StartupPhase) explicit SessionModule(QObject *parent = nullptr); virtual ~SessionModule(); virtual StartupPhase startupPhase() const = 0; bool isSystemdEnabled() const; virtual bool start(const QStringList &args = QStringList()) = 0; virtual bool stop() = 0; Q_SIGNALS: void systemdEnabledChanged(); void environmentChangeRequested(const QString &key, const QString &value); void shutdownRequested(); private: SessionModulePrivate *const d_ptr; }; } // namespace Liri Q_DECLARE_INTERFACE(Liri::SessionModule, LiriSessionModule_iid) #endif // LIRI_SESSIONMODULE_H 07070100000049000081A40000000000000000000000016202D085000005E1000000000000000000000000000000000000004300000000liri-session-20220208+git.f26b173/src/libsession/sessionmodule_p.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:LGPLv3+$ * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef LIRI_SESSIONMODULE_P_H #define LIRI_SESSIONMODULE_P_H #include <LiriSession/SessionModule> namespace Liri { class LIRISESSION_EXPORT SessionModulePrivate { Q_DECLARE_PUBLIC(SessionModule) public: SessionModulePrivate(SessionModule *self); void setSystemdEnabled(bool enabled); static SessionModulePrivate *get(SessionModule *module) { return module->d_func(); } bool systemd = false; protected: SessionModule *q_ptr = nullptr; }; } // namespace Liri #endif // LIRI_SESSIONMODULE_P_H 0707010000004A000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003200000000liri-session-20220208+git.f26b173/src/libsigwatch0707010000004B000081A40000000000000000000000016202D085000000F5000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/libsigwatch/CMakeLists.txtset(SOURCES sigwatch.cpp sigwatch.h sigwatch_p.h ) add_library(Sigwatch STATIC ${SOURCES}) target_link_libraries(Sigwatch Qt5::Core) target_include_directories(Sigwatch PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..> ) 0707010000004C000081A40000000000000000000000016202D0850000043D000000000000000000000000000000000000003A00000000liri-session-20220208+git.f26b173/src/libsigwatch/LICENSEUnix signal watcher for Qt. Copyright (C) 2014 Simon Knopp Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 0707010000004D000081A40000000000000000000000016202D085000012A7000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/libsigwatch/sigwatch.cpp/* * Unix signal watcher for Qt. * * Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * Copyright (C) 2014 Simon Knopp * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #include "sigwatch.h" #include <QDebug> #include <QMap> #include <QSocketNotifier> #include <errno.h> #include <sys/socket.h> #include <unistd.h> #include "sigwatch_p.h" int UnixSignalWatcherPrivate::sockpair[2]; UnixSignalWatcherPrivate::UnixSignalWatcherPrivate(UnixSignalWatcher *qq) : q_ptr(qq) , notifier(nullptr) { } void UnixSignalWatcherPrivate::initialize() { Q_Q(UnixSignalWatcher); // Create socket pair if (::socketpair(AF_UNIX, SOCK_STREAM, 0, sockpair)) { qDebug() << "UnixSignalWatcher: socketpair: " << ::strerror(errno); return; } // Create a notifier for the read end of the pair notifier = new QSocketNotifier(sockpair[1], QSocketNotifier::Read, q); QObject::connect(notifier, SIGNAL(activated(int)), q, SLOT(_q_handleNotify(int))); notifier->setEnabled(true); } /*! * Registers a handler for the given Unix \a signal. The handler will write to * a socket pair, the other end of which is connected to a QSocketNotifier. * This provides a way to break out of the asynchronous context from which the * signal handler is called and back into the Qt event loop. */ void UnixSignalWatcherPrivate::watchForSignal(int signal) { if (watchedSignals.contains(signal)) { qDebug() << "Already watching for signal" << signal; return; } // Register a sigaction which will write to the socket pair struct sigaction sigact; sigact.sa_handler = UnixSignalWatcherPrivate::signalHandler; ::sigemptyset(&sigact.sa_mask); sigact.sa_flags = SA_RESTART; if (::sigaction(signal, &sigact, NULL)) { qDebug() << "UnixSignalWatcher: sigaction: " << ::strerror(errno); return; } watchedSignals.append(signal); } /*! * Called when a Unix \a signal is received. Write to the socket to wake up the * QSocketNotifier. */ void UnixSignalWatcherPrivate::signalHandler(int signal) { ssize_t nBytes = ::write(sockpair[0], &signal, sizeof(signal)); Q_UNUSED(nBytes); } /*! * Called when the signal handler has written to the socket pair. Emits the Unix * signal as a Qt signal. */ void UnixSignalWatcherPrivate::_q_handleNotify(int sockfd) { Q_Q(UnixSignalWatcher); int signal; ssize_t nBytes = ::read(sockfd, &signal, sizeof(signal)); Q_UNUSED(nBytes); qDebug() << "Caught signal:" << ::strsignal(signal); emit q->unixSignal(signal); } /*! * Create a new UnixSignalWatcher as a child of the given \a parent. */ UnixSignalWatcher::UnixSignalWatcher(QObject *parent) : QObject(parent) , d_ptr(new UnixSignalWatcherPrivate(this)) { d_func()->initialize(); } /*! * Destroy the UnixSignalWatcher objects. */ UnixSignalWatcher::~UnixSignalWatcher() { delete d_ptr; } /*! * Register a signal handler for the given \a signal. * * After calling this method you can \c connect() to the unixSignal() Qt signal * to be notified when the Unix signal is received. */ void UnixSignalWatcher::watchForSignal(int signal) { Q_D(UnixSignalWatcher); d->watchForSignal(signal); } /*! * \fn void UnixSignalWatcher::unixSignal(int signal) * Emitted when the given Unix \a signal is received. * * watchForSignal() must be called for each Unix signal that you want to receive * via the unixSignal() Qt signal. If a watcher is watching multiple signals, * unixSignal() will be emitted whenever *any* of the watched Unix signals are * received, and the \a signal argument can be inspected to find out which one * was actually received. */ #include "moc_sigwatch.cpp" 0707010000004E000081A40000000000000000000000016202D0850000075F000000000000000000000000000000000000003D00000000liri-session-20220208+git.f26b173/src/libsigwatch/sigwatch.h/* * Unix signal watcher for Qt. * * Copyright (C) 2014 Simon Knopp * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef SIGWATCH_H #define SIGWATCH_H #include <QObject> #include <signal.h> class UnixSignalWatcherPrivate; /*! * \brief The UnixSignalWatcher class converts Unix signals to Qt signals. * * To watch for a given signal, e.g. \c SIGINT, call \c watchForSignal(SIGINT) * and \c connect() your handler to unixSignal(). */ class UnixSignalWatcher : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(UnixSignalWatcher) public: explicit UnixSignalWatcher(QObject *parent = nullptr); ~UnixSignalWatcher(); void watchForSignal(int signal); Q_SIGNALS: void unixSignal(int signal); private: UnixSignalWatcherPrivate *const d_ptr; Q_PRIVATE_SLOT(d_func(), void _q_handleNotify(int)) }; #endif // SIGWATCH_H 0707010000004F000081A40000000000000000000000016202D0850000028B000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/libsigwatch/sigwatch_p.h#pragma once #include "sigwatch.h" /*! * \brief The UnixSignalWatcherPrivate class implements the back-end signal * handling for the UnixSignalWatcher. * * \see http://qt-project.org/doc/qt-5.0/qtdoc/unix-signals.html */ class UnixSignalWatcherPrivate { Q_DECLARE_PUBLIC(UnixSignalWatcher) public: UnixSignalWatcherPrivate(UnixSignalWatcher *qq); void initialize(); void watchForSignal(int signal); static void signalHandler(int signal); void _q_handleNotify(int sockfd); protected: UnixSignalWatcher *q_ptr; private: static int sockpair[2]; QSocketNotifier *notifier; QList<int> watchedSignals; }; 07070100000050000041ED0000000000000000000000046202D08500000000000000000000000000000000000000000000002E00000000liri-session-20220208+git.f26b173/src/manager07070100000051000081A40000000000000000000000016202D08500000BC8000000000000000000000000000000000000003D00000000liri-session-20220208+git.f26b173/src/manager/CMakeLists.txt# Translations file(GLOB TRANSLATIONS "${CMAKE_CURRENT_SOURCE_DIR}/../../translations/*_*.ts") qt5_add_translation(QM_FILES ${TRANSLATIONS}) install(FILES ${QM_FILES} DESTINATION "${INSTALL_DATADIR}/liri-session/translations") # Defines set(DEFINES "") if(LIRI_SESSION_DEVELOPMENT_BUILD) list(APPEND DEFINES "DEVELOPMENT_BUILD") endif() # Absolute paths if(IS_ABSOLUTE "${INSTALL_DATADIR}") set(DATADIR "${INSTALL_DATADIR}") else() set(DATADIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_DATADIR}") endif() if(IS_ABSOLUTE "${INSTALL_PLUGINSDIR}") set(PLUGINSDIR "${INSTALL_PLUGINSDIR}") else() set(PLUGINSDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_PLUGINSDIR}") endif() # Git revision include(LiriCreateGitHeadRevisionFile) liri_create_git_head_revision_file("gitsha1.h") if(LIRI_ENABLE_SYSTEMD) list(APPEND DEFINES "ENABLE_SYSTEMD") endif() if(NOT TARGET Liri::Logind) find_package(Liri1Logind) endif() if(NOT TARGET Liri::Xdg) find_package(Liri1Xdg REQUIRED) endif() liri_add_executable(LiriSession OUTPUT_NAME "liri-session" SOURCES backends/fakebackend.cpp backends/fakebackend.h backends/logindbackend.cpp backends/logindbackend.h backends/sessionbackend.cpp backends/sessionbackend.h dbus/processlauncher.cpp dbus/processlauncher.h dbus/screensaver.cpp dbus/screensaver.h dbus/sessionmanager.cpp dbus/sessionmanager.h diagnostics.cpp diagnostics.h main.cpp pluginregistry.cpp pluginregistry.h session.cpp session.h systemdmanager.cpp systemdmanager.h utils.cpp utils.h ${QM_FILES} DBUS_ADAPTOR_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/dbus/io.liri.Launcher.xml" "${CMAKE_CURRENT_SOURCE_DIR}/io.liri.SessionManager.xml" DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH LIRI_SESSION_VERSION="${PROJECT_VERSION}" ${DEFINES} DATADIR="${DATADIR}" PLUGINSDIR="${PLUGINSDIR}" LIBRARIES Qt5::Core Qt5::DBus Sigwatch Liri::Session Liri::SessionPrivate Liri::Logind Liri::Xdg autostart services shell ) liri_finalize_executable(LiriSession) liri_add_executable(LiriSessionCtl OUTPUT_NAME "liri-session-ctl" SOURCES session-ctl.cpp DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH VERSION="${PROJECT_VERSION}" LIBRARIES Qt5::Core Qt5::DBus ) liri_finalize_executable(LiriSessionCtl) if(IS_ABSOLUTE "${INSTALL_BINDIR}") set(BINDIR "${INSTALL_BINDIR}") else() set(BINDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_BINDIR}") endif() configure_file( "liri.desktop.in" "${CMAKE_CURRENT_BINARY_DIR}/liri.desktop" @ONLY ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/liri.desktop" DESTINATION "${INSTALL_DATADIR}/wayland-sessions" ) 07070100000052000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003700000000liri-session-20220208+git.f26b173/src/manager/backends07070100000053000081A40000000000000000000000016202D08500000564000000000000000000000000000000000000004700000000liri-session-20220208+git.f26b173/src/manager/backends/fakebackend.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include "fakebackend.h" FakeBackend::FakeBackend() : SessionBackend() { } QString FakeBackend::name() const { return QStringLiteral("fake"); } void FakeBackend::setIdle(bool value) { Q_UNUSED(value) } void FakeBackend::lockSession() { } void FakeBackend::unlockSession() { } void FakeBackend::locked() { } void FakeBackend::unlocked() { } void FakeBackend::switchToVt(quint32 vt) { Q_UNUSED(vt) } 07070100000054000081A40000000000000000000000016202D0850000055A000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/src/manager/backends/fakebackend.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2018 Pier Luigi Fiorini * * Author(s): * Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef FAKEBACKEND_H #define FAKEBACKEND_H #include "sessionbackend.h" class FakeBackend : public SessionBackend { Q_OBJECT public: FakeBackend(); QString name() const; void setIdle(bool value); void lockSession(); void unlockSession(); void locked(); void unlocked(); void switchToVt(quint32 vt); }; #endif // FAKEBACKEND_H 07070100000055000081A40000000000000000000000016202D085000013D6000000000000000000000000000000000000004900000000liri-session-20220208+git.f26b173/src/manager/backends/logindbackend.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include <QDBusConnectionInterface> #include <LiriLogind/LiriLogind> #include "logindbackend.h" #include <unistd.h> using namespace Liri; LogindBackend::LogindBackend() : SessionBackend() { Liri::Logind *logind = Logind::instance(); connect(logind, &Logind::connectedChanged, this, &LogindBackend::handleConnectedChanged); connect(logind, &Logind::inhibited, this, &LogindBackend::handleInhibited); connect(logind, &Logind::uninhibited, this, &LogindBackend::handleUninhibited); connect(logind, &Logind::prepareForSleep, this, &LogindBackend::prepareForSleep); connect(logind, &Logind::prepareForShutdown, this, &LogindBackend::prepareForShutdown); connect(logind, &Logind::devicePaused, this, &LogindBackend::devicePaused); connect(logind, &Logind::lockSessionRequested, this, &LogindBackend::handleSessionLocked); connect(logind, &Logind::unlockSessionRequested, this, &LogindBackend::handleSessionUnlocked); setupInhibitors(); logind->inhibit( QStringLiteral("Liri/PowerButton"), QStringLiteral("Liri handles the power button itself"), Logind::InhibitPowerKey | Logind::InhibitSuspendKey | Logind::InhibitHibernateKey, Logind::Block); } LogindBackend::~LogindBackend() { if (m_powerButtonFd >= 0) ::close(m_powerButtonFd); if (m_inhibitFd >= 0) ::close(m_inhibitFd); } QString LogindBackend::name() const { return QStringLiteral("logind"); } void LogindBackend::setIdle(bool value) { Logind::instance()->setIdleHint(value); } void LogindBackend::lockSession() { Logind::instance()->lockSession(); } void LogindBackend::unlockSession() { Logind::instance()->unlockSession(); } void LogindBackend::switchToVt(quint32 vt) { Logind::instance()->switchTo(vt); } bool LogindBackend::exists() { return QDBusConnection::systemBus().interface()->isServiceRegistered(QStringLiteral("org.freedesktop.login1")); } void LogindBackend::setupInhibitors() { Liri::Logind *logind = Logind::instance(); logind->inhibit( QStringLiteral("Liri/Sleep"), QStringLiteral("Liri needs to logout before shutdown and lock the screen before sleep"), Logind::InhibitShutdown | Logind::InhibitSleep, Logind::Delay); logind->inhibit( QStringLiteral("Liri/Lid"), QStringLiteral("Liri wants to handle when the lid is closed"), Logind::InhibitLidSwitch, Logind::Block); } void LogindBackend::handleConnectedChanged(bool connected) { // Unset idle hint at startup so that the login manager // will report the flag correctly if (connected) setIdle(false); } void LogindBackend::handleInhibited(const QString &who, const QString &why, int fd) { Q_UNUSED(why) if (who == QStringLiteral("Liri/PowerButton")) m_powerButtonFd = fd; else if (who == QStringLiteral("Liri/Sleep")) m_inhibitFd = fd; } void LogindBackend::handleUninhibited(int fd) { if (m_powerButtonFd == fd) m_powerButtonFd = -1; else if (m_inhibitFd == fd) m_inhibitFd = -1; } void LogindBackend::prepareForSleep(bool arg) { // Lock immediately when the system is going to sleep if (arg) emit sessionLocked(); } void LogindBackend::prepareForShutdown(bool arg) { // Bring down the session before the system is shut down if (arg) emit shutdownRequested(); } void LogindBackend::devicePaused(quint32 devMajor, quint32 devMinor, const QString &type) { if (QString::compare(type, QStringLiteral("pause"), Qt::CaseInsensitive) == 0) Logind::instance()->pauseDeviceComplete(devMajor, devMinor); } void LogindBackend::handleSessionLocked() { if (m_inhibitFd >= 0) { ::close(m_inhibitFd); m_inhibitFd = -1; } emit sessionLocked(); } void LogindBackend::handleSessionUnlocked() { emit sessionUnlocked(); } 07070100000056000081A40000000000000000000000016202D0850000072E000000000000000000000000000000000000004700000000liri-session-20220208+git.f26b173/src/manager/backends/logindbackend.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef LOGINDBACKEND_H #define LOGINDBACKEND_H #include "sessionbackend.h" class LogindBackend : public SessionBackend { Q_OBJECT public: LogindBackend(); ~LogindBackend(); QString name() const; void setIdle(bool value); void lockSession(); void unlockSession(); void switchToVt(quint32 vt); static bool exists(); private: int m_powerButtonFd = -1; int m_inhibitFd = -1; private Q_SLOTS: void setupInhibitors(); void handleConnectedChanged(bool connected); void handleInhibited(const QString &who, const QString &why, int fd); void handleUninhibited(int fd); void prepareForSleep(bool arg); void prepareForShutdown(bool arg); void devicePaused(quint32 devMajor, quint32 devMinor, const QString &type); void handleSessionLocked(); void handleSessionUnlocked(); }; #endif // LOGINDBACKEND_H 07070100000057000081A40000000000000000000000016202D085000005E6000000000000000000000000000000000000004A00000000liri-session-20220208+git.f26b173/src/manager/backends/sessionbackend.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2018 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QMutex> #include "fakebackend.h" #include "logindbackend.h" #include "sessionbackend.h" static SessionBackend *s_backend = nullptr; SessionBackend::SessionBackend(QObject *parent) : QObject(parent) { } SessionBackend::~SessionBackend() { } SessionBackend *SessionBackend::instance() { static QMutex mutex; QMutexLocker lock(&mutex); if (s_backend) return s_backend; if (LogindBackend::exists()) s_backend = new LogindBackend(); else s_backend = new FakeBackend(); return s_backend; } 07070100000058000081A40000000000000000000000016202D08500000602000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/src/manager/backends/sessionbackend.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SESSIONBACKEND_H #define SESSIONBACKEND_H #include <QObject> class SessionBackend : public QObject { Q_OBJECT public: SessionBackend(QObject *parent = nullptr); virtual ~SessionBackend(); virtual QString name() const = 0; virtual void setIdle(bool value) = 0; virtual void lockSession() = 0; virtual void unlockSession() = 0; virtual void switchToVt(quint32 vt) = 0; static SessionBackend *instance(); Q_SIGNALS: void sessionLocked(); void sessionUnlocked(); void shutdownRequested(); }; #endif // SESSIONBACKEND_H 07070100000059000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003300000000liri-session-20220208+git.f26b173/src/manager/dbus0707010000005A000081A40000000000000000000000016202D08500000331000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/src/manager/dbus/io.liri.Launcher.xml<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node> <interface name="io.liri.Launcher"> <method name="LaunchApplication"> <arg type="b" direction="out"/> <arg name="appId" type="s" direction="in"/> </method> <method name="LaunchDesktopFile"> <arg type="b" direction="out"/> <arg name="path" type="s" direction="in"/> <arg name="urls" type="as" direction="in"/> </method> <method name="LaunchDesktopFile"> <arg type="b" direction="out"/> <arg name="path" type="s" direction="in"/> </method> <method name="LaunchCommand"> <arg type="b" direction="out"/> <arg name="command" type="s" direction="in"/> </method> </interface> </node> 0707010000005B000081A40000000000000000000000016202D08500002128000000000000000000000000000000000000004700000000liri-session-20220208+git.f26b173/src/manager/dbus/processlauncher.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include <QDBusError> #include <QFile> #include <QFileInfo> #include <QRegularExpression> #include <QStandardPaths> #include <LiriXdg/AutoStart> #include <LiriXdg/DesktopFile> #include "dbus/processlauncher.h" #include "session.h" ProcessLauncher::ProcessLauncher(QObject *parent) : QObject(parent) , m_session(qobject_cast<Session *>(parent)) { } ProcessLauncher::~ProcessLauncher() { // Unregister D-Bus object auto bus = QDBusConnection::sessionBus(); bus.unregisterObject(objectPath); bus.unregisterService(serviceName); } bool ProcessLauncher::registerWithDBus() { auto bus = QDBusConnection::sessionBus(); // Register D-Bus service if (!bus.registerService(serviceName)) { qCWarning(lcSession, "Failed to register D-Bus service \"%s\": %s", qPrintable(serviceName), qPrintable(bus.lastError().message())); return false; } // Register D-Bus object if (!bus.registerObject(objectPath, serviceName, this, QDBusConnection::ExportScriptableContents)) { qCWarning(lcSession, "Failed to register \"%s\" D-Bus interface: %s", qPrintable(serviceName), qPrintable(bus.lastError().message())); return false; } return true; } bool ProcessLauncher::LaunchApplication(const QString &appId) { if (appId.isEmpty()) return false; const QString fileName = QStandardPaths::locate( QStandardPaths::ApplicationsLocation, appId + QStringLiteral(".desktop")); if (fileName.isEmpty()) { qCWarning(lcSession) << "Cannot find" << appId << "desktop file"; return false; } auto *desktop = Liri::DesktopFileCache::getFile(fileName); if (!desktop) { qCWarning(lcSession) << "No desktop file found for" << appId; return false; } if (m_session->isSystemdEnabled() && !desktop->isDBusActivatable()) { // Run with systemd-run QStringList args = QStringList() << QStringLiteral("--user") << QStringLiteral("--scope") << QStringLiteral("--description=Application %1").arg(appId) << QStringLiteral("--property=Requisite=liri-shell.target") << QStringLiteral("--property=After=liri-shell.target") << QStringLiteral("--property=BindsTo=liri-session.target") << desktop->expandExecString().join(QLatin1Char(' ')); QProcess *process = new QProcess(this); process->setProgram(QStringLiteral("systemd-run")); process->setArguments(args); connect(process, &QProcess::readyReadStandardOutput, this, &ProcessLauncher::handleReadyReadStandardOutput); connect(process, &QProcess::readyReadStandardError, this, &ProcessLauncher::handleReadyReadStandardError); connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &ProcessLauncher::handleProcessFinished); process->start(); return process->waitForStarted(); } else { return desktop->startDetached(); } } bool ProcessLauncher::LaunchDesktopFile(const QString &path, const QStringList &urls) { if (path.isEmpty()) return false; auto *desktop = Liri::DesktopFileCache::getFile(path); if (!desktop) { qCWarning(lcSession) << "Failed to open desktop file" << path; return false; } if (m_session->isSystemdEnabled() && !desktop->isDBusActivatable()) { // Run with systemd-run const QString appId = id(path); QStringList args = QStringList() << QStringLiteral("--user") << QStringLiteral("--scope") << QStringLiteral("--description=Application %1").arg(appId) << QStringLiteral("--property=SourcePath=%1").arg(path) << QStringLiteral("--property=Requisite=liri-shell.target") << QStringLiteral("--property=After=liri-shell.target") << QStringLiteral("--property=BindsTo=liri-session.target") << desktop->expandExecString(urls).join(QLatin1Char(' ')); QProcess *process = new QProcess(this); process->setProgram(QStringLiteral("systemd-run")); process->setArguments(args); connect(process, &QProcess::readyReadStandardOutput, this, &ProcessLauncher::handleReadyReadStandardOutput); connect(process, &QProcess::readyReadStandardError, this, &ProcessLauncher::handleReadyReadStandardError); connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &ProcessLauncher::handleProcessFinished); process->start(); return process->waitForStarted(); } else { return desktop->startDetached(urls); } } bool ProcessLauncher::LaunchCommand(const QString &command) { if (command.isEmpty()) return false; if (m_session->isSystemdEnabled()) { // Run with systemd-run QStringList args = QStringList() << QStringLiteral("--user") << QStringLiteral("--scope") << QStringLiteral("--description=Run command: %1").arg(command) << QStringLiteral("--property=Requisite=liri-shell.target") << QStringLiteral("--property=After=liri-shell.target") << QStringLiteral("--property=BindsTo=liri-session.target") << command; QProcess *process = new QProcess(this); process->setProgram(QStringLiteral("systemd-run")); process->setArguments(args); connect(process, &QProcess::readyReadStandardOutput, this, &ProcessLauncher::handleReadyReadStandardOutput); connect(process, &QProcess::readyReadStandardError, this, &ProcessLauncher::handleReadyReadStandardError); connect(process, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &ProcessLauncher::handleProcessFinished); process->start(); return process->waitForStarted(); } else { QProcess *process = new QProcess(this); return process->startDetached(command); } } QString ProcessLauncher::id(const QString &fileName) const { const QFileInfo info(fileName); QRegularExpression suffixRx(QStringLiteral(".desktop$")); QLatin1Char slashChar('/'); QLatin1Char dashChar('-'); QString id = info.canonicalFilePath(); id.replace(info.canonicalPath(), QString()); if (id.startsWith(slashChar)) id.remove(0, 1); id.replace(slashChar, dashChar); id.replace(suffixRx, QString()); return id; } void ProcessLauncher::handleReadyReadStandardOutput() { auto *process = qobject_cast<QProcess *>(sender()); if (process) qCInfo(lcSession) << process->readAllStandardOutput().constData(); } void ProcessLauncher::handleReadyReadStandardError() { auto *process = qobject_cast<QProcess *>(sender()); if (process) qCWarning(lcSession) << process->readAllStandardError().constData(); } void ProcessLauncher::handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) { Q_UNUSED(exitCode) Q_UNUSED(exitStatus) auto *process = qobject_cast<QProcess *>(sender()); if (process) process->deleteLater(); } 0707010000005C000081A40000000000000000000000016202D085000007AC000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/src/manager/dbus/processlauncher.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef PROCESSLAUNCHER_H #define PROCESSLAUNCHER_H #include <QObject> #include <QProcess> class Session; class ProcessLauncher : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "io.liri.Launcher") public: explicit ProcessLauncher(QObject *parent = nullptr); ~ProcessLauncher(); bool registerWithDBus(); Q_SCRIPTABLE bool LaunchApplication(const QString &appId); Q_SCRIPTABLE bool LaunchDesktopFile(const QString &path, const QStringList &urls = QStringList()); Q_SCRIPTABLE bool LaunchCommand(const QString &command); const QString serviceName = QStringLiteral("io.liri.Launcher"); const QString objectPath = QStringLiteral("/io/liri/Launcher"); private: Session *m_session = nullptr; QString id(const QString &fileName) const; private Q_SLOTS: void handleReadyReadStandardOutput(); void handleReadyReadStandardError(); void handleProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); }; #endif // PROCESSLAUNCHER_H 0707010000005D000081A40000000000000000000000016202D0850000125C000000000000000000000000000000000000004300000000liri-session-20220208+git.f26b173/src/manager/dbus/screensaver.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include <QDBusError> #include <LiriLogind/LiriLogind> #include "screensaver.h" #include "session.h" #include "backends/sessionbackend.h" ScreenSaver::ScreenSaver(QObject *parent) : QObject(parent) { connect(SessionBackend::instance(), &SessionBackend::sessionLocked, this, &ScreenSaver::handleLock); connect(SessionBackend::instance(), &SessionBackend::sessionUnlocked, this, &ScreenSaver::handleUnlock); connect(Liri::Logind::instance(), &Liri::Logind::inhibited, this, &ScreenSaver::handleInhibited); } ScreenSaver::~ScreenSaver() { // Unregister D-Bus object auto bus = QDBusConnection::sessionBus(); bus.unregisterObject(objectPath); bus.unregisterService(serviceName); } bool ScreenSaver::registerWithDBus() { auto bus = QDBusConnection::sessionBus(); // Register D-Bus service if (!bus.registerService(serviceName)) { qCWarning(lcSession, "Failed to register D-Bus service \"%s\": %s", qPrintable(serviceName), qPrintable(bus.lastError().message())); return false; } // Register D-Bus object if (!bus.registerObject(objectPath, serviceName, this, QDBusConnection::ExportScriptableContents)) { qCWarning(lcSession, "Failed to register \"%s\" D-Bus object for %s: %s", qPrintable(objectPath), qPrintable(serviceName), qPrintable(bus.lastError().message())); bus.unregisterService(serviceName); return false; } return true; } bool ScreenSaver::GetActive() { return m_active; } bool ScreenSaver::SetActive(bool state) { // SetActive activates the screensaver, hence we lock the session if (state) { Lock(); return true; } return false; } uint ScreenSaver::GetActiveTime() { if (m_elapsedTimer.isValid()) { qint64 elapsed = m_elapsedTimer.elapsed(); return elapsed > 0 ? uint(elapsed) : 0; } return 0; } uint ScreenSaver::GetSessionIdleTime() { // TODO: return 0; } void ScreenSaver::SimulateUserActivity() { // TODO: } uint ScreenSaver::Inhibit(const QString &appName, const QString &reason) { static uint cookieSeed = 0; uint newCookie = cookieSeed++; m_inhibit[newCookie] = InhibitEntry{ appName, reason }; Liri::Logind::instance()->inhibit(appName, reason, Liri::Logind::InhibitIdle, Liri::Logind::Block); return newCookie; } void ScreenSaver::UnInhibit(uint cookie) { int fd = m_inhibitFd.value(cookie, -1); if (fd != -1) { Liri::Logind::instance()->uninhibit(fd); m_inhibit.remove(cookie); m_inhibitFd.remove(cookie); } } void ScreenSaver::Lock() { SessionBackend::instance()->lockSession(); } uint ScreenSaver::Throttle(const QString &appName, const QString &reason) { // TODO: Q_UNUSED(appName) Q_UNUSED(reason) return 0; } void ScreenSaver::UnThrottle(uint cookie) { // TODO: Q_UNUSED(cookie) } void ScreenSaver::handleLock() { m_active = true; m_elapsedTimer.restart(); emit ActiveChanged(m_active); } void ScreenSaver::handleUnlock() { m_active = false; m_elapsedTimer.invalidate(); emit ActiveChanged(m_active); } void ScreenSaver::handleInhibited(const QString &who, const QString &why, int fd) { const auto keys = m_inhibit.keys(); for (auto cookie : keys) { if (m_inhibit[cookie].who == who && m_inhibit[cookie].why == why) { m_inhibitFd[cookie] = fd; break; } } } 0707010000005E000081A40000000000000000000000016202D08500000937000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/manager/dbus/screensaver.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SCREENSAVER_H #define SCREENSAVER_H #include <QElapsedTimer> #include <QObject> #include <QMap> struct InhibitEntry { QString who; QString why; }; class ScreenSaver : public QObject { Q_OBJECT Q_CLASSINFO("D-Bus Interface", "org.freedesktop.ScreenSaver") public: explicit ScreenSaver(QObject *parent = nullptr); ~ScreenSaver(); bool registerWithDBus(); Q_SCRIPTABLE bool GetActive(); Q_SCRIPTABLE bool SetActive(bool state); Q_SCRIPTABLE uint GetActiveTime(); Q_SCRIPTABLE uint GetSessionIdleTime(); Q_SCRIPTABLE void SimulateUserActivity(); Q_SCRIPTABLE uint Inhibit(const QString &appName, const QString &reason); Q_SCRIPTABLE void UnInhibit(uint cookie); Q_SCRIPTABLE void Lock(); Q_SCRIPTABLE uint Throttle(const QString &appName, const QString &reason); Q_SCRIPTABLE void UnThrottle(uint cookie); const QString serviceName = QStringLiteral("org.freedesktop.ScreenSaver"); const QString objectPath = QStringLiteral("/ScreenSaver"); Q_SIGNALS: Q_SCRIPTABLE void ActiveChanged(bool in); private: bool m_active = false; QMap<uint, InhibitEntry> m_inhibit; QMap<uint, int> m_inhibitFd; QElapsedTimer m_elapsedTimer; private Q_SLOTS: void handleLock(); void handleUnlock(); void handleInhibited(const QString &who, const QString &why, int fd); }; #endif // SCREENSAVER_H 0707010000005F000081A40000000000000000000000016202D08500000BEA000000000000000000000000000000000000004600000000liri-session-20220208+git.f26b173/src/manager/dbus/sessionmanager.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include "backends/sessionbackend.h" #include "session.h" #include "sessionmanager.h" #include "sessionmanager_adaptor.h" const QString serviceName = QStringLiteral("io.liri.SessionManager"); const QString objectPath = QStringLiteral("/io/liri/SessionManager"); SessionManager::SessionManager(QObject *parent) : QObject(parent) , m_session(qobject_cast<Session *>(parent)) { new SessionManagerAdaptor(this); connect(SessionBackend::instance(), &SessionBackend::sessionLocked, this, &SessionManager::Locked); connect(SessionBackend::instance(), &SessionBackend::sessionUnlocked, this, &SessionManager::Unlocked); } SessionManager::~SessionManager() { QDBusConnection bus = QDBusConnection::sessionBus(); bus.unregisterObject(objectPath); bus.unregisterService(serviceName); } bool SessionManager::registerWithDBus() { QDBusConnection bus = QDBusConnection::sessionBus(); if (!bus.registerService(serviceName)) { qCWarning(lcSession, "Couldn't register %s D-Bus service: %s", qPrintable(serviceName), qPrintable(bus.lastError().message())); return false; } if (!bus.registerObject(objectPath, this)) { qCWarning(lcSession, "Couldn't register %s D-Bus object: %s", qPrintable(objectPath), qPrintable(bus.lastError().message())); return false; } return true; } void SessionManager::SetEnvironment(const QString &key, const QString &value) { if (m_session) m_session->setEnvironment(key, value); } void SessionManager::UnsetEnvironment(const QString &key) { if (m_session) m_session->unsetEnvironment(key); } void SessionManager::SetIdle(bool idle) { SessionBackend::instance()->setIdle(idle); } void SessionManager::Lock() { SessionBackend::instance()->lockSession(); } void SessionManager::Unlock() { SessionBackend::instance()->unlockSession(); } void SessionManager::Logout() { if (m_session) m_session->shutdown(); } 07070100000060000081A40000000000000000000000016202D08500000629000000000000000000000000000000000000004400000000liri-session-20220208+git.f26b173/src/manager/dbus/sessionmanager.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SESSIONMANAGER_H #define SESSIONMANAGER_H #include <QObject> #include <QProcess> class Session; class SessionManager : public QObject { Q_OBJECT public: explicit SessionManager(QObject *parent = nullptr); ~SessionManager(); bool registerWithDBus(); Q_SIGNALS: void Locked(); void Unlocked(); public Q_SLOTS: void SetEnvironment(const QString &key, const QString &value); void UnsetEnvironment(const QString &key); void SetIdle(bool idle); void Lock(); void Unlock(); void Logout(); private: Session *m_session = nullptr; }; #endif // SESSIONMANAGER_H 07070100000061000081A40000000000000000000000016202D08500000596000000000000000000000000000000000000003E00000000liri-session-20220208+git.f26b173/src/manager/diagnostics.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QSysInfo> #include <QTextStream> #include "diagnostics.h" namespace Diagnostics { QString systemInformation() { QString result; QTextStream str(&result); str << "OS: " << QSysInfo::prettyProductName(); str << " [" << QSysInfo::kernelType() << " version " << QSysInfo::kernelVersion() << "]\n"; str << "Architecture: " << QSysInfo::currentCpuArchitecture() << "\n"; return result; } } // namespace Diagnostics 07070100000062000081A40000000000000000000000016202D0850000046A000000000000000000000000000000000000003C00000000liri-session-20220208+git.f26b173/src/manager/diagnostics.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef DIAGNOSTICS_H #define DIAGNOSTICS_H #include <QString> namespace Diagnostics { QString systemInformation(); } // namespace Diagnostics #endif // DIAGNOSTICS_H 07070100000063000081A40000000000000000000000016202D085000002B6000000000000000000000000000000000000004900000000liri-session-20220208+git.f26b173/src/manager/io.liri.SessionManager.xml<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> <node> <interface name="io.liri.SessionManager"> <method name="SetEnvironment"> <arg name="key" type="s" direction="in"/> <arg name="value" type="s" direction="in"/> </method> <method name="UnsetEnvironment"> <arg name="key" type="s" direction="in"/> </method> <method name="SetIdle"> <arg name="idle" type="b" direction="in"/> </method> <method name="Lock"/> <method name="Unlock"/> <method name="Logout"/> <signal name="Locked"/> <signal name="Unlocked"/> </interface> </node> 07070100000064000081A40000000000000000000000016202D08500000294000000000000000000000000000000000000003E00000000liri-session-20220208+git.f26b173/src/manager/liri.desktop.in[Desktop Entry] Name=Liri Name[da]=Liri Name[de]=Liri Name[it_IT]=Liri Name[lt]=Liri Name[pt_BR]=Liri Name[ru_RU]=Liri Name[tr]=Liri Comment=QtQuick and Wayland based desktop environment Comment[da]=QtQuick- og Wayland-baseret skrivebordsmiljø Comment[de]=QtQuick- und Wayland-basierte Desktop-Umgebung Comment[it_IT]=Desktop environment basato su QtQuick e Wayland Comment[lt]=QtQuick ir Wayland pagrįsta darbalaukio aplinka Comment[pt_BR]=Ambiente de trabalho baseado no QtQuick e Wayland Comment[tr]=QtQuick ve Wayland tabanlı masaüstü ortamı Exec=@BINDIR@/liri-session -- -platform liri TryExec=@BINDIR@/liri-session Icon=start-here Type=Application 07070100000065000081A40000000000000000000000016202D085000000BE000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/manager/liri.desktop.in.in[Desktop Entry] _Name=Liri _Comment=QtQuick and Wayland based desktop environment Exec=@BINDIR@/liri-session -- -platform liri TryExec=@BINDIR@/liri-session Icon=start-here Type=Application 07070100000066000081A40000000000000000000000016202D085000019EE000000000000000000000000000000000000003700000000liri-session-20220208+git.f26b173/src/manager/main.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDir> #include <QCommandLineParser> #include <QCoreApplication> #include <QSharedPointer> #include <QTimer> #include "session.h" #include <unistd.h> #define TR(x) QT_TRANSLATE_NOOP("Command line parser", QStringLiteral(x)) static void setupEnvironment() { // Set defaults if (qEnvironmentVariableIsEmpty("XDG_DATA_HOME")) qputenv("XDG_DATA_HOME", QDir::home().absoluteFilePath(QStringLiteral(".local/share")).toLocal8Bit()); if (qEnvironmentVariableIsEmpty("XDG_CONFIG_HOME")) qputenv("XDG_CONFIG_HOME", QDir::home().absoluteFilePath(QStringLiteral(".config")).toLocal8Bit()); if (qEnvironmentVariableIsEmpty("XDG_CACHE_HOME")) qputenv("XDG_CACHE_HOME", QDir::home().absoluteFilePath(QStringLiteral(".cache")).toLocal8Bit()); if (qEnvironmentVariableIsEmpty("XDG_DATA_DIRS")) qputenv("XDG_DATA_DIRS", "/usr/local/share/:/usr/share/"); if (qEnvironmentVariableIsEmpty("XDG_CONFIG_DIRS")) qputenv("XDG_CONFIG_DIRS", "/etc/xdg"); if (qEnvironmentVariableIsEmpty("XDG_DESKTOP_PORTAL_DIR")) qputenv("XDG_DESKTOP_PORTAL_DIR", DATADIR "/xdg-desktop-portal/portals"); // Environment qputenv("DESKTOP_SESSION", "Liri"); qputenv("XDG_MENU_PREFIX", "liri-"); qputenv("XDG_CURRENT_DESKTOP", "X-Liri"); qputenv("XDG_SESSION_DESKTOP", "liri"); // Set environment for the programs we will launch from here #if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0) qputenv("QT_QPA_PLATFORM", "wayland;xcb"); #else qputenv("QT_QPA_PLATFORM", "wayland"); #endif qputenv("QT_QPA_PLATFORMTHEME", "liri"); qputenv("QT_WAYLAND_SHELL_INTEGRATION", "xdg-shell"); qputenv("QT_QUICK_CONTROLS_1_STYLE", "Flat"); qputenv("QT_QUICK_CONTROLS_STYLE", "material"); qputenv("QT_WAYLAND_DECORATION", "material"); qputenv("QT_AUTO_SCREEN_SCALE_FACTOR", "1"); qputenv("XCURSOR_THEME", "Paper"); qunsetenv("QT_SCALE_FACTOR"); qunsetenv("QT_SCREEN_SCALE_FACTORS"); } int main(int argc, char *argv[]) { #ifndef DEVELOPMENT_BUILD if (::getuid() == 0) { qWarning("Liri session manager cannot be run as root!"); return 1; } #endif // Setup the environment setupEnvironment(); // Application QCoreApplication app(argc, argv); app.setApplicationName(QStringLiteral("Session")); app.setApplicationVersion(QStringLiteral(LIRI_SESSION_VERSION)); app.setOrganizationName(QStringLiteral("Liri")); app.setOrganizationDomain(QStringLiteral("liri.io")); // Command line parser QCommandLineParser parser; parser.setApplicationDescription(TR("Liri session manager")); parser.addHelpOption(); parser.addVersionOption(); #ifdef ENABLE_SYSTEMD // Disable systemd support QCommandLineOption noSystemdOption( QStringLiteral("no-systemd"), TR("Do not use systemd --user to bring up the session")); parser.addOption(noSystemdOption); #endif // Modules to be disabled QCommandLineOption disableModulesOption( QStringLiteral("disable-modules"), TR("Comma separated list of modules to be disabled"), TR("list")); parser.addOption(disableModulesOption); // Parse command line parser.process(app); // Create the session manager QSharedPointer<Session> session(new Session); // Arguments const QStringList disabledModulesList = parser.value(disableModulesOption).trimmed().split(QLatin1Char(',')); const QStringList shellArgs = parser.positionalArguments(); #ifdef ENABLE_SYSTEMD const bool systemdSupport = !parser.isSet(noSystemdOption); #else const bool systemdSupport = false; #endif if (systemdSupport && parser.isSet(disableModulesOption)) qWarning("The --disable-modules argument is not effective when systemd " "is used to bring up the session"); // Set systemd flag session->setSystemdEnabled(systemdSupport); // Disable incompatible modules QSet<QString> disabledModules = disabledModulesList.toSet(); if (systemdSupport) { disabledModules.insert(QStringLiteral("io.liri.SessionManager.Modules.Services")); disabledModules.insert(QStringLiteral("io.liri.SessionManager.Modules.Shell")); } else { // Set shell arguments session->setModuleArguments(QStringLiteral("io.liri.SessionManager.Modules.Shell"), shellArgs); } // Disable modules for (const auto &name : disabledModules) session->disableModule(name); // We ship autostart entries with Hidden=true into $datadir/liri-session/systemd-user/autostart // for those entries that are replaced by units, so they are not started twice if (systemdSupport) { auto newValue = QDir::home().absoluteFilePath(QStringLiteral(".local/share/liri-session/systemd-user")).toUtf8(); newValue.append(':'); newValue.append(DATADIR "/liri-session/systemd-user"); auto value = qgetenv("XDG_CONFIG_DIRS"); if (value.isEmpty()) { value = newValue; } else { value.prepend(':'); value.prepend(newValue); } qputenv("XDG_CONFIG_DIRS", value); } // Go QTimer::singleShot(0, &app, [session] { // A D-Bus session is required if (session->requireDBusSession()) return; // Initialize session manager if (!session->initialize()) { QCoreApplication::exit(1); return; } // Start all services if (!session->start()) { QCoreApplication::exit(1); return; } }); return app.exec(); } 07070100000067000081A40000000000000000000000016202D08500000CB6000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/manager/pluginregistry.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDir> #include <QJsonObject> #include <QPluginLoader> #include <QStaticPlugin> #include <QVector> #include "pluginregistry.h" #include "session.h" PluginRegistry::PluginRegistry(QObject *parent) : QObject(parent) { } PluginsMap PluginRegistry::plugins() const { return m_plugins; } bool PluginRegistry::hasPlugin(const QString &name) const { return m_plugins.contains(name); } QObject *PluginRegistry::getInstance(const QString &name) const { if (!m_plugins.contains(name)) return nullptr; return m_plugins[name]; } QString PluginRegistry::getNameForInstance(QObject *instance) const { return m_plugins.key(instance); } void PluginRegistry::discover() { // Find static plugins first const auto staticPlugins = QPluginLoader::staticPlugins(); for (QStaticPlugin staticPlugin : staticPlugins) { const auto json = staticPlugin.metaData().toVariantMap(); addPlugin(staticPlugin.instance(), json); } // Find external plugins QDir pluginsDir(QString::asprintf("%s/liri/sessionmodules", PLUGINSDIR)); const auto entryList = pluginsDir.entryList(QDir::Files); for (const auto &fileName : entryList) { QPluginLoader loader(pluginsDir.absoluteFilePath(fileName)); addPlugin(loader.instance(), loader.metaData().toVariantMap()); } } void PluginRegistry::addPlugin(QObject *instance, const QVariantMap &json) { // Must have interface ID and metadata if (!json.contains(QStringLiteral("IID")) || !json.contains(QStringLiteral("MetaData"))) { qCWarning(lcSession, "Ignoring invalid plugin"); return; } // Check the interface ID, even though we only have this kind of plugins if (json[QStringLiteral("IID")] != QStringLiteral(LiriSessionModule_iid)) return; // Add to the list const auto metaData = json[QStringLiteral("MetaData")].toMap(); const auto id = metaData.value(QStringLiteral("Id")).toString(); const auto type = metaData.value(QStringLiteral("Type")).toString(); if (type != QStringLiteral("SessionModule")) { qCWarning(lcSession, "Plugin \"%s\" is of type %s instead of SessionModule", qPrintable(id), qPrintable(type)); return; } m_plugins[id] = instance; } 07070100000068000081A40000000000000000000000016202D08500000614000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/manager/pluginregistry.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef PLUGINREGISTRY_H #define PLUGINREGISTRY_H #include <QObject> #include <QHash> typedef QHash<QString, QObject *> PluginsMap; class PluginRegistry : public QObject { Q_OBJECT public: explicit PluginRegistry(QObject *parent = nullptr); PluginsMap plugins() const; bool hasPlugin(const QString &name) const; QObject *getInstance(const QString &name) const; QString getNameForInstance(QObject *instance) const; void discover(); private: PluginsMap m_plugins; void addPlugin(QObject *instance, const QVariantMap &json); }; #endif // PLUGINREGISTRY_H 07070100000069000081A40000000000000000000000016202D08500000BE7000000000000000000000000000000000000003E00000000liri-session-20220208+git.f26b173/src/manager/session-ctl.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QCommandLineParser> #include <QCoreApplication> #include <QDBusConnection> #include <QDBusConnectionInterface> #include <QDBusMessage> #include <QDBusPendingCall> #include <QDBusReply> #include <QTimer> #define TR(x) QT_TRANSLATE_NOOP("Command line parser", QStringLiteral(x)) static bool hasService() { auto *interface = QDBusConnection::sessionBus().interface(); QDBusReply<QStringList> reply = interface->call(QStringLiteral("ListNames")); return reply.value().contains(QLatin1String("io.liri.SessionManager")); } static void doLogout() { // Return immediately if the service is not running anymore: // maybe it was already terminated if (!hasService()) return; auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.SessionManager"), QStringLiteral("/io/liri/SessionManager"), QStringLiteral("io.liri.SessionManager"), QStringLiteral("Logout")); msg.setAutoStartService(false); QDBusConnection::sessionBus().asyncCall(msg, 2500); } int main(int argc, char *argv[]) { // Application QCoreApplication app(argc, argv); app.setApplicationName(QStringLiteral("Session Control")); app.setApplicationVersion(QStringLiteral(VERSION)); app.setOrganizationName(QStringLiteral("Liri")); app.setOrganizationDomain(QStringLiteral("liri.io")); // Command line parser QCommandLineParser parser; parser.setApplicationDescription(TR("Liri session manager control")); parser.addHelpOption(); parser.addVersionOption(); // Logout QCommandLineOption logoutOption( QStringLiteral("logout"), TR("Exit the session manager")); parser.addOption(logoutOption); // Parse command line parser.process(app); // Arguments const bool logout = parser.isSet(logoutOption); // Go QTimer::singleShot(0, &app, [=] { // Shutdown the session manager if (logout) doLogout(); QCoreApplication::exit(0); }); return app.exec(); } 0707010000006A000081A40000000000000000000000016202D085000027A4000000000000000000000000000000000000003A00000000liri-session-20220208+git.f26b173/src/manager/session.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QCoreApplication> #include <QDBusConnection> #include <QDBusMessage> #include <QDBusMetaType> #include <QDBusReply> #include <QProcess> #include <libsigwatch/sigwatch.h> #include <LiriSession/private/sessionmodule_p.h> #include "dbus/processlauncher.h" #include "dbus/screensaver.h" #include "dbus/sessionmanager.h" #include "diagnostics.h" #include "gitsha1.h" #include "pluginregistry.h" #include "session.h" #include "systemdmanager.h" #include "utils.h" Q_LOGGING_CATEGORY(lcSession, "liri.session", QtInfoMsg) Q_IMPORT_PLUGIN(AutostartPlugin) Q_IMPORT_PLUGIN(ServicesPlugin) Q_IMPORT_PLUGIN(ShellPlugin) // D-Bus type to update activation environment typedef QMap<QString,QString> EnvMap; Q_DECLARE_METATYPE(EnvMap) Session::Session(QObject *parent) : QObject(parent) , m_processLauncher(new ProcessLauncher(this)) , m_screenSaver(new ScreenSaver(this)) , m_manager(new SessionManager(this)) , m_pluginRegistry(new PluginRegistry(this)) { // Register D-Bus types qDBusRegisterMetaType<EnvMap>(); // Unix signals watcher UnixSignalWatcher *sigwatch = new UnixSignalWatcher(this); sigwatch->watchForSignal(SIGINT); sigwatch->watchForSignal(SIGTERM); // Quit when the process is killed connect(sigwatch, &UnixSignalWatcher::unixSignal, this, &Session::shutdown); } Session::~Session() { qDeleteAll(m_loadedModules); } bool Session::isSystemdEnabled() const { return m_systemdEnabled; } void Session::setSystemdEnabled(bool value) { if (m_systemdEnabled && !value) { qCWarning(lcSession, "Systemd support cannot be disabled once the program has started"); return; } m_systemdEnabled = value; m_systemd = new SystemdManager(this); } bool Session::requireDBusSession() { // Don't continue if we are already in a D-Bus session if (qEnvironmentVariableIsSet("DBUS_SESSION_BUS_ADDRESS")) return false; if (m_systemdEnabled) { if (!m_systemd->isAvailable()) { qCCritical(lcSession, "Systemd D-Bus service is not available"); return false; } } else { // Avoid infinite recursion if dbus-run-session fails to set DBUS_SESSION_BUS_ADDRESS if (getParentProcessName().contains(QStringLiteral("dbus-run-session"))) return false; // Restart with dbus-run-session QCoreApplication::quit(); QStringList args = QStringList() << QStringLiteral("--"); args += QCoreApplication::arguments(); QProcess::startDetached(QStringLiteral("dbus-run-session"), args); } return true; } void Session::disableModule(const QString &name) { m_disabledModules.append(name); } void Session::setModuleArguments(const QString &name, const QStringList &args) { m_moduleArgs[name] = args; } bool Session::initialize() { // Print version information qInfo("== Liri Session ==\n" "** https://liri.io\n" "** Bug reports to: https://github.com/lirios/session/issues\n" "** Build: %s-%s", LIRI_SESSION_VERSION, GIT_REV); // Print OS information qInfo("%s", qPrintable(Diagnostics::systemInformation().trimmed())); // Register D-Bus objects m_screenSaver->registerWithDBus(); if (!m_processLauncher->registerWithDBus()) return false; if (!m_manager->registerWithDBus()) return false; // Discover plugins m_pluginRegistry->discover(); // Add modules to the list PluginsMap plugins = m_pluginRegistry->plugins(); PluginsMap::iterator it; for (it = plugins.begin(); it != plugins.end(); ++it) { auto name = it.key(); auto instance = it.value(); auto module = dynamic_cast<Liri::SessionModule *>(instance); if (!module) { qCWarning(lcSession, "Plugin \"%s\" is not a session module", qPrintable(name)); continue; } Liri::SessionModulePrivate::get(module)->setSystemdEnabled(m_systemdEnabled); m_modules[module->startupPhase()].append(module); } return true; } bool Session::start() { // Update D-Bus activation environment uploadEnvironment(); // Start systemd target if (m_systemdEnabled) { const QString targetName = QStringLiteral("liri-session.target"); if (m_systemd->loadUnit(targetName)) m_systemd->startUnit(targetName, QStringLiteral("replace")); } // Run all modules of each startup phase ModulesMap::iterator it; for (it = m_modules.begin(); it != m_modules.end(); ++it) { ModulesList list = it.value(); for (int i = 0; i < list.count(); i++) { auto module = list.at(i); auto name = m_pluginRegistry->getNameForInstance(module); if (!module) { qCWarning(lcSession, "Ignoring invalid session module \"%s\"", qPrintable(name)); continue; } // Skip disabled modules if (m_disabledModules.contains(name)) continue; // Let the module set environment variables directly connect(module, &Liri::SessionModule::environmentChangeRequested, this, &Session::setEnvironment); connect(module, &Liri::SessionModule::shutdownRequested, this, &Session::shutdown); qCInfo(lcSession, "==> Starting session module \"%s\"", qPrintable(name)); // Start if (module->start(m_moduleArgs[name])) { m_loadedModules.append(module); qCInfo(lcSession, "Session module \"%s\" started", qPrintable(name)); } else { qCWarning(lcSession, "Failed to start session module \"%s\"", qPrintable(name)); shutdown(); return false; } } } return true; } void Session::setEnvironment(const QString &key, const QString &value) { // Set environment variable qCDebug(lcSession, "Setting environment variable %s=\"%s\"", qPrintable(key), qPrintable(value)); qputenv(qPrintable(key), value.toLocal8Bit()); // Propagate environment variables to D-Bus activate services uploadEnvironment(); } void Session::unsetEnvironment(const QString &key) { // Unset environment variable qCDebug(lcSession, "Unsetting environment variable %s", qPrintable(key)); qunsetenv(qPrintable(key)); // Synchronously update systemd environment if (m_systemdEnabled) m_systemd->unsetEnvironment(key); } void Session::shutdown() { qCInfo(lcSession, "Closing session..."); // Stop modules std::reverse(m_loadedModules.begin(), m_loadedModules.end()); for (auto module : qAsConst(m_loadedModules)) { auto instance = dynamic_cast<QObject *>(module); const auto name = m_pluginRegistry->getNameForInstance(instance); qCInfo(lcSession, "==> Stopping session module \"%s\"", qPrintable(name)); if (!module->stop()) qCWarning(lcSession, "Failed to stop session module \"%s\"", qPrintable(name)); } qCInfo(lcSession, "Quit"); QCoreApplication::quit(); } void Session::uploadEnvironment() { QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); QProcessEnvironment sysEnv(env); // Copy environment variables and remove login-session specific that we // don't want to set for every session sysEnv.remove(QStringLiteral("XDG_SEAT")); sysEnv.remove(QStringLiteral("XDG_SESSION_CLASS")); sysEnv.remove(QStringLiteral("XDG_SESSION_DESKTOP")); sysEnv.remove(QStringLiteral("XDG_SESSION_ID")); sysEnv.remove(QStringLiteral("XDG_SESSION_TYPE")); sysEnv.remove(QStringLiteral("XDG_VTNR")); // Avoid shell code in environment variables const auto keys = sysEnv.keys(); for (const auto &key : keys) { if (key.startsWith(QStringLiteral("BASH_FUNC"))) sysEnv.remove(key); } // Synchronously update activation environment { EnvMap envMap; const auto keys = sysEnv.keys(); for (const auto &key : keys) envMap.insert(key, sysEnv.value(key)); auto msg = QDBusMessage::createMethodCall( QStringLiteral("org.freedesktop.DBus"), QStringLiteral("/org/freedesktop/DBus"), QStringLiteral("org.freedesktop.DBus"), QStringLiteral("UpdateActivationEnvironment")); msg.setAutoStartService(false); msg.setArguments(QVariantList({QVariant::fromValue(envMap)})); QDBusReply<void> reply = QDBusConnection::sessionBus().call(msg); if (!reply.isValid()) qCWarning(lcSession, "Failed to update activation environment: %s", qPrintable(reply.error().message())); } // Synchronously update systemd environment if (m_systemdEnabled) m_systemd->setEnvironment(sysEnv); } 0707010000006B000081A40000000000000000000000016202D085000009A6000000000000000000000000000000000000003800000000liri-session-20220208+git.f26b173/src/manager/session.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SESSION_H #define SESSION_H #include <QLoggingCategory> #include <QObject> #include <QProcessEnvironment> #include <QVector> #include <LiriSession/SessionModule> Q_DECLARE_LOGGING_CATEGORY(lcSession) class PluginRegistry; class ProcessLauncher; class ScreenSaver; class SessionManager; class SystemdManager; typedef QVector<Liri::SessionModule *> ModulesList; typedef QMap<Liri::SessionModule::StartupPhase, ModulesList> ModulesMap; class Session : public QObject { Q_OBJECT public: explicit Session(QObject *parent = nullptr); ~Session(); bool isSystemdEnabled() const; void setSystemdEnabled(bool value); bool requireDBusSession(); void disableModule(const QString &name); void setModuleArguments(const QString &name, const QStringList &args); bool initialize(); bool start(); public Q_SLOTS: void setEnvironment(const QString &key, const QString &value); void unsetEnvironment(const QString &key); void shutdown(); private: QMap<QString, QString> m_env; bool m_systemdEnabled = false; SystemdManager *m_systemd = nullptr; ProcessLauncher *m_processLauncher = nullptr; ScreenSaver *m_screenSaver = nullptr; SessionManager *m_manager = nullptr; QStringList m_disabledModules; QMap<QString, QStringList> m_moduleArgs; PluginRegistry *m_pluginRegistry = nullptr; ModulesMap m_modules; ModulesList m_loadedModules; void uploadEnvironment(); }; #endif // SESSION_H 0707010000006C000081A40000000000000000000000016202D08500001470000000000000000000000000000000000000004100000000liri-session-20220208+git.f26b173/src/manager/systemdmanager.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include <QDBusConnectionInterface> #include <QDBusReply> #include "session.h" #include "systemdmanager.h" SystemdManager::SystemdManager(QObject *parent) : QObject(parent) { // Search for systemd QDBusReply<QStringList> reply = QDBusConnection::sessionBus().interface()->call(QStringLiteral("ListNames")); m_available = reply.value().contains(QLatin1String("org.freedesktop.systemd1")); } bool SystemdManager::isAvailable() const { return m_available; } bool SystemdManager::loadUnit(const QString &name) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("org.freedesktop.systemd1"), QStringLiteral("/org/freedesktop/systemd1"), QStringLiteral("org.freedesktop.systemd1.Manager"), QStringLiteral("LoadUnit")); msg.setAutoStartService(false); msg.setArguments(QVariantList() << name); QDBusReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(msg); if (!reply.isValid()) { qCWarning(lcSession, "Unable to load unit \"%s\": %s", qPrintable(name), qPrintable(reply.error().message())); return false; } return true; } bool SystemdManager::startUnit(const QString &name, const QString &mode) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("org.freedesktop.systemd1"), QStringLiteral("/org/freedesktop/systemd1"), QStringLiteral("org.freedesktop.systemd1.Manager"), QStringLiteral("StartUnit")); msg.setAutoStartService(false); msg.setArguments(QVariantList() << name << mode); QDBusReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(msg); if (!reply.isValid()) { qCWarning(lcSession, "Unable to start unit \"%s\": %s", qPrintable(name), qPrintable(reply.error().message())); return false; } return true; } bool SystemdManager::stopUnit(const QString &name, const QString &mode) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("org.freedesktop.systemd1"), QStringLiteral("/org/freedesktop/systemd1"), QStringLiteral("org.freedesktop.systemd1.Manager"), QStringLiteral("StopUnit")); msg.setAutoStartService(false); msg.setArguments(QVariantList() << name << mode); QDBusReply<QDBusObjectPath> reply = QDBusConnection::sessionBus().call(msg); if (!reply.isValid()) { qCWarning(lcSession, "Unable to stop unit \"%s\": %s", qPrintable(name), qPrintable(reply.error().message())); return false; } return true; } bool SystemdManager::setEnvironment(const QProcessEnvironment &sysEnv) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("org.freedesktop.systemd1"), QStringLiteral("/org/freedesktop/systemd1"), QStringLiteral("org.freedesktop.systemd1.Manager"), QStringLiteral("SetEnvironment")); msg.setAutoStartService(false); msg.setArguments(QVariantList() << sysEnv.toStringList()); QDBusReply<void> reply = QDBusConnection::sessionBus().call(msg); if (!reply.isValid()) { qCWarning(lcSession, "Failed to update systemd environment: %s", qPrintable(reply.error().message())); return false; } return true; } bool SystemdManager::unsetEnvironment(const QString &key) { return unsetEnvironment(QStringList() << key); } bool SystemdManager::unsetEnvironment(const QStringList &keys) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("org.freedesktop.systemd1"), QStringLiteral("/org/freedesktop/systemd1"), QStringLiteral("org.freedesktop.systemd1.Manager"), QStringLiteral("UnsetEnvironment")); msg.setAutoStartService(false); msg.setArguments(QVariantList() << keys); QDBusReply<void> reply = QDBusConnection::sessionBus().call(msg); if (!reply.isValid()) { qCWarning(lcSession, "Failed to unset environment variables from systemd: %s", qPrintable(reply.error().message())); return false; } return true; } 0707010000006D000081A40000000000000000000000016202D08500000679000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/manager/systemdmanager.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SYSTEMDMANAGER_H #define SYSTEMDMANAGER_H #include <QObject> class QProcessEnvironment; class SystemdManager : public QObject { Q_OBJECT Q_PROPERTY(bool available READ isAvailable CONSTANT) public: explicit SystemdManager(QObject *parent = nullptr); bool isAvailable() const; bool loadUnit(const QString &name); bool startUnit(const QString &name, const QString &mode); bool stopUnit(const QString &name, const QString &mode); bool setEnvironment(const QProcessEnvironment &sysEnv); bool unsetEnvironment(const QString &key); bool unsetEnvironment(const QStringList &keys); private: bool m_available = false; }; #endif // SYSTEMDMANAGER_H 0707010000006E000081A40000000000000000000000016202D08500000542000000000000000000000000000000000000003800000000liri-session-20220208+git.f26b173/src/manager/utils.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QFile> #include "utils.h" #include <unistd.h> QString getParentProcessName() { pid_t pid = getppid(); const QString fileName = QString::asprintf("/proc/%d/cmdline", pid); QString name; QFile file(fileName); if (file.open(QFile::ReadOnly)) { name = QString::fromLocal8Bit(file.readAll()).trimmed(); file.close(); } return name; } 0707010000006F000081A40000000000000000000000016202D08500000426000000000000000000000000000000000000003600000000liri-session-20220208+git.f26b173/src/manager/utils.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef UTILS_H #define UTILS_H #include <QString> QString getParentProcessName(); #endif // UTILS_H 07070100000070000041ED0000000000000000000000046202D08500000000000000000000000000000000000000000000002E00000000liri-session-20220208+git.f26b173/src/plugins07070100000071000041ED0000000000000000000000036202D08500000000000000000000000000000000000000000000003500000000liri-session-20220208+git.f26b173/src/plugins/daemon07070100000072000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003C00000000liri-session-20220208+git.f26b173/src/plugins/daemon/locale07070100000073000081A40000000000000000000000016202D08500000155000000000000000000000000000000000000004B00000000liri-session-20220208+git.f26b173/src/plugins/daemon/locale/CMakeLists.txtif(NOT TARGET Liri::Qt5GSettings) find_package(Qt5GSettings REQUIRED) endif() liri_add_plugin(locale TYPE liri/daemon SOURCES plugin.cpp plugin.h DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH LIBRARIES Liri::Daemon Liri::Qt5GSettings ) liri_finalize_plugin(locale) 07070100000074000081A40000000000000000000000016202D0850000102B000000000000000000000000000000000000004700000000liri-session-20220208+git.f26b173/src/plugins/daemon/locale/plugin.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include <QDBusInterface> #include <Qt5GSettings/QGSettings> #include "plugin.h" const QString languageKey = QStringLiteral("language"); const QString regionKey = QStringLiteral("region"); const QString interfaceName = QStringLiteral("org.freedesktop.locale1"); const QString objectPath = QStringLiteral("/org/freedesktop/locale1"); LocalePlugin::LocalePlugin(QObject *parent) : Liri::DaemonModule(parent) { getSystemLocale(); m_settings = new QtGSettings::QGSettings( QStringLiteral("io.liri.session.locale"), QStringLiteral("/io/liri/session/locale/"), this); connect(m_settings, &QtGSettings::QGSettings::settingChanged, this, &LocalePlugin::handleSettingChanged); } void LocalePlugin::start() { handleSettingChanged(languageKey); handleSettingChanged(regionKey); } void LocalePlugin::stop() { } void LocalePlugin::setEnvironment(const QString &key, const QString &value) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.Launcher"), QStringLiteral("/io/liri/Launcher"), QStringLiteral("io.liri.Launcher"), QStringLiteral("SetEnvironment")); msg.setArguments(QVariantList() << key << value); QDBusConnection::sessionBus().send(msg); } void LocalePlugin::getSystemLocale() { auto interface = new QDBusInterface( interfaceName, objectPath, interfaceName, QDBusConnection::systemBus(), this); auto locale = qvariant_cast<QStringList>(interface->property("Locale")); for (const auto &entry : locale) { auto nameValue = entry.split(QLatin1Char('=')); if (nameValue.length() == 2) m_systemLocale[nameValue.at(0)] = nameValue.at(1); } } void LocalePlugin::handleSettingChanged(const QString &key) { if (key == languageKey) { m_language = m_settings->value(languageKey).toString(); if (m_language.isEmpty()) m_language = m_systemLocale[QStringLiteral("LANG")]; setEnvironment(QStringLiteral("LANG"), m_language); setEnvironment(QStringLiteral("LANGUAGE"), m_language); setEnvironment(QStringLiteral("LC_MESSAGES"), m_language); } else if (key == regionKey) { m_region = m_settings->value(regionKey).toString(); if (m_region.isEmpty()) m_region = m_systemLocale[QStringLiteral("LANG")]; setEnvironment(QStringLiteral("LC_CTYPE"), m_region); setEnvironment(QStringLiteral("LC_NUMERIC"), m_region); setEnvironment(QStringLiteral("LC_TIME"), m_region); setEnvironment(QStringLiteral("LC_COLLATE"), m_region); setEnvironment(QStringLiteral("LC_MONETARY"), m_region); setEnvironment(QStringLiteral("LC_PAPER"), m_region); setEnvironment(QStringLiteral("LC_NAME"), m_region); setEnvironment(QStringLiteral("LC_ADDRESS"), m_region); setEnvironment(QStringLiteral("LC_TELEPHONE"), m_region); setEnvironment(QStringLiteral("LC_MEASUREMENT"), m_region); setEnvironment(QStringLiteral("LC_IDENTIFICATION"), m_region); } } 07070100000075000081A40000000000000000000000016202D0850000070F000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/src/plugins/daemon/locale/plugin.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef LOCALEPLUGIN_H #define LOCALEPLUGIN_H #include <QMap> #include <QObject> #include <LiriDaemon/DaemonModule> namespace QtGSettings { class QGSettings; } // namespace QtGSettings class LocalePlugin : public Liri::DaemonModule { Q_OBJECT Q_PLUGIN_METADATA(IID LiriDaemonModule_iid FILE "plugin.json") Q_INTERFACES(Liri::DaemonModule) public: explicit LocalePlugin(QObject *parent = nullptr); void start() override; void stop() override; private: QtGSettings::QGSettings *m_settings = nullptr; QString m_language; QString m_region; QMap<QString, QString> m_systemLocale; QMap<QString, QString> m_env; void setEnvironment(const QString &key, const QString &value); void getSystemLocale(); private Q_SLOTS: void handleSettingChanged(const QString &key); }; #endif // LOCALEPLUGIN_H 07070100000076000081A40000000000000000000000016202D08500000153000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/src/plugins/daemon/locale/plugin.json{ "Id": "locale", "Type": "DaemonModule", "Version": "1.0.0", "Authors": [ "Pier Luigi Fiorini <pierluigi.fiorini@liri.io>" ], "License": "GPL-3.0-or-later", "Website": "https://liri.io", "X-Liri-DaemonModule-AutoLoad": true, "X-Liri-DaemonModule-ServiceName": "io.liri.Daemon.Modules.Locale" } 07070100000077000041ED0000000000000000000000056202D08500000000000000000000000000000000000000000000003600000000liri-session-20220208+git.f26b173/src/plugins/session07070100000078000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000004000000000liri-session-20220208+git.f26b173/src/plugins/session/autostart07070100000079000081A40000000000000000000000016202D0850000016B000000000000000000000000000000000000004F00000000liri-session-20220208+git.f26b173/src/plugins/session/autostart/CMakeLists.txtif(NOT TARGET Liri::Xdg) find_package(Liri1Xdg REQUIRED) endif() liri_add_plugin(autostart TYPE liri/sessionmodules SOURCES plugin.cpp plugin.h DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH LIBRARIES Qt5::DBus Liri::Session Liri::Xdg STATIC ) liri_finalize_plugin(autostart) 0707010000007A000081A40000000000000000000000016202D08500000F32000000000000000000000000000000000000004B00000000liri-session-20220208+git.f26b173/src/plugins/session/autostart/plugin.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include <QDBusMessage> #include <QDBusPendingCall> #include <LiriXdg/AutoStart> #include <LiriXdg/DesktopFile> #include "plugin.h" AutostartPlugin::AutostartPlugin(QObject *parent) : Liri::SessionModule(parent) { } Liri::SessionModule::StartupPhase AutostartPlugin::startupPhase() const { return Applications; } bool AutostartPlugin::start(const QStringList &args) { Q_UNUSED(args) const auto desktopFileList = Liri::AutoStart::desktopFileList(); for (const Liri::DesktopFile &entry : desktopFileList) { // Ignore hidden entries if (!entry.isVisible()) continue; // Ignore entries that are explicitely not meant for Liri if (!entry.isSuitable(QStringLiteral("X-Liri"))) continue; // If it's neither suitable for GNOME nor KDE then it's probably not meant // for us too, some utilities like those from XFCE have an explicit list // of desktop that are not supported instead of show them on XFCE //if (!entry.isSuitable(true, QLatin1String("GNOME")) && !entry.isSuitable(true, QLatin1String("KDE"))) //continue; // Ignore those entries hidden under systemd if (isSystemdEnabled()) { bool hidden = entry.value(QStringLiteral("X-GNOME-HiddenUnderSystemd")).toString().trimmed().compare(QStringLiteral("true"), Qt::CaseInsensitive); if (hidden) continue; } qCDebug(lcSession) << "Autostart entry:" << entry.name() << "from" << entry.fileName(); m_desktopFiles.append(entry.fileName()); launchDesktopFile(entry.fileName()); } return true; } bool AutostartPlugin::stop() { std::reverse(m_desktopFiles.begin(), m_desktopFiles.end()); for (const auto &fileName : qAsConst(m_desktopFiles)) { qCDebug(lcSession) << "Terminate autostart entry from" << fileName; terminateDesktopFile(fileName); } m_desktopFiles.clear(); return true; } void AutostartPlugin::launchDesktopFile(const QString &fileName) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.Launcher"), QStringLiteral("/io/liri/Launcher"), QStringLiteral("io.liri.Launcher"), QStringLiteral("LaunchDesktopFile")); QVariantList args; args.append(fileName); msg.setArguments(args); QDBusConnection::sessionBus().asyncCall(msg); } void AutostartPlugin::terminateDesktopFile(const QString &fileName) { auto msg = QDBusMessage::createMethodCall( QStringLiteral("io.liri.Launcher"), QStringLiteral("/io/liri/Launcher"), QStringLiteral("io.liri.Launcher"), QStringLiteral("TerminateDesktopFile")); QVariantList args; args.append(fileName); msg.setArguments(args); QDBusConnection::sessionBus().asyncCall(msg); } 0707010000007B000081A40000000000000000000000016202D085000006A3000000000000000000000000000000000000004900000000liri-session-20220208+git.f26b173/src/plugins/session/autostart/plugin.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef AUTOSTARTPLUGIN_H #define AUTOSTARTPLUGIN_H #include <QLoggingCategory> #include <QObject> #include <LiriSession/SessionModule> Q_DECLARE_LOGGING_CATEGORY(lcSession) class AutostartPlugin : public Liri::SessionModule { Q_OBJECT Q_PLUGIN_METADATA(IID LiriSessionModule_iid FILE "plugin.json") Q_INTERFACES(Liri::SessionModule) public: explicit AutostartPlugin(QObject *parent = nullptr); StartupPhase startupPhase() const override; bool start(const QStringList &args = QStringList()) override; bool stop() override; private: QStringList m_desktopFiles; void launchDesktopFile(const QString &fileName); void terminateDesktopFile(const QString &fileName); }; #endif // AUTOSTARTPLUGIN_H 0707010000007C000081A40000000000000000000000016202D08500000104000000000000000000000000000000000000004C00000000liri-session-20220208+git.f26b173/src/plugins/session/autostart/plugin.json{ "Id": "io.liri.SessionManager.Modules.Autostart", "Type": "SessionModule", "Version": "1.0.0", "Authors": [ "Pier Luigi Fiorini <pierluigi.fiorini@liri.io>" ], "License": "GPL-3.0-or-later", "Website": "https://liri.io" } 0707010000007D000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003F00000000liri-session-20220208+git.f26b173/src/plugins/session/services0707010000007E000081A40000000000000000000000016202D08500000111000000000000000000000000000000000000004E00000000liri-session-20220208+git.f26b173/src/plugins/session/services/CMakeLists.txtliri_add_plugin(services TYPE liri/sessionmodules SOURCES plugin.cpp plugin.h DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH LIBRARIES Qt5::DBus Liri::Session STATIC ) liri_finalize_plugin(services) 0707010000007F000081A40000000000000000000000016202D08500000A0F000000000000000000000000000000000000004A00000000liri-session-20220208+git.f26b173/src/plugins/session/services/plugin.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnectionInterface> #include <QDBusMessage> #include <QProcessEnvironment> #include "plugin.h" #include <sys/types.h> #include <signal.h> ServicesPlugin::ServicesPlugin(QObject *parent) : Liri::SessionModule(parent) { } Liri::SessionModule::StartupPhase ServicesPlugin::startupPhase() const { return Daemons; } bool ServicesPlugin::start(const QStringList &args) { Q_UNUSED(args) startService(QStringLiteral("io.liri.Daemon")); return true; } bool ServicesPlugin::stop() { std::reverse(m_pids.begin(), m_pids.end()); auto i = m_pids.begin(); while (i != m_pids.end()) { uint pid = (*i); ::kill(pid, SIGTERM); ::kill(pid, SIGKILL); i = m_pids.erase(i); } return true; } void ServicesPlugin::startService(const QString &name) { auto interface = QDBusConnection::sessionBus().interface(); // Check if the service is already registered auto existsReply = interface->isServiceRegistered(name); if (existsReply.isValid() && existsReply.value()) { auto pidReply = interface->servicePid(name); if (pidReply.isValid()) m_pids.append(pidReply.value()); return; } // If not, start the service auto reply = interface->startService(name); if (reply.isValid()) { auto pidReply = interface->servicePid(name); if (pidReply.isValid()) m_pids.append(pidReply.value()); } else { qCWarning(lcSession, "Failed to start \"%s\" D-Bus service: %s", qPrintable(name), qPrintable(reply.error().message())); } } 07070100000080000081A40000000000000000000000016202D08500000657000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/src/plugins/session/services/plugin.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SERVICESPLUGIN_H #define SERVICESPLUGIN_H #include <QLoggingCategory> #include <QObject> #include <LiriSession/SessionModule> Q_DECLARE_LOGGING_CATEGORY(lcSession) class ServicesPlugin : public Liri::SessionModule { Q_OBJECT Q_PLUGIN_METADATA(IID LiriSessionModule_iid FILE "plugin.json") Q_INTERFACES(Liri::SessionModule) public: explicit ServicesPlugin(QObject *parent = nullptr); StartupPhase startupPhase() const override; bool start(const QStringList &args = QStringList()) override; bool stop() override; private: QVector<uint> m_pids; void startService(const QString &name); }; #endif // SERVICESPLUGIN_H 07070100000081000081A40000000000000000000000016202D08500000103000000000000000000000000000000000000004B00000000liri-session-20220208+git.f26b173/src/plugins/session/services/plugin.json{ "Id": "io.liri.SessionManager.Modules.Services", "Type": "SessionModule", "Version": "1.0.0", "Authors": [ "Pier Luigi Fiorini <pierluigi.fiorini@liri.io>" ], "License": "GPL-3.0-or-later", "Website": "https://liri.io" } 07070100000082000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003C00000000liri-session-20220208+git.f26b173/src/plugins/session/shell07070100000083000081A40000000000000000000000016202D085000001D6000000000000000000000000000000000000004B00000000liri-session-20220208+git.f26b173/src/plugins/session/shell/CMakeLists.txtif(IS_ABSOLUTE "${INSTALL_LIBEXECDIR}") set(LIBEXECDIR "${INSTALL_LIBEXECDIR}") else() set(LIBEXECDIR "${CMAKE_INSTALL_PREFIX}/${INSTALL_LIBEXECDIR}") endif() liri_add_plugin(shell TYPE liri/sessionmodules SOURCES plugin.cpp plugin.h DEFINES QT_NO_CAST_FROM_ASCII QT_NO_FOREACH LIBEXECDIR="${LIBEXECDIR}" LIBRARIES Qt5::DBus Liri::Session STATIC ) liri_finalize_plugin(shell) 07070100000084000081A40000000000000000000000016202D08500001F53000000000000000000000000000000000000004700000000liri-session-20220208+git.f26b173/src/plugins/session/shell/plugin.cpp/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #include <QDBusConnection> #include <QDBusServiceWatcher> #include <QEventLoop> #include <QFile> #include <QTimer> #include "plugin.h" const QString shellServiceName = QStringLiteral("io.liri.Shell"); ShellPlugin::ShellPlugin(QObject *parent) : Liri::SessionModule(parent) { m_loop = new QEventLoop(this); m_serviceWatcher = new QDBusServiceWatcher(shellServiceName, QDBusConnection::sessionBus(), QDBusServiceWatcher::WatchForRegistration | QDBusServiceWatcher::WatchForUnregistration, this); connect(m_serviceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &ShellPlugin::handleServiceRegistered); connect(m_serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &ShellPlugin::handleServiceUnregistered); m_serverProcess = new QProcess(this); m_serverProcess->setProcessChannelMode(QProcess::ForwardedChannels); m_serverProcess->setProgram(QString::asprintf("%s/liri-shell", LIBEXECDIR)); connect(m_serverProcess, &QProcess::readyReadStandardOutput, this, &ShellPlugin::handleStandardOutput); connect(m_serverProcess, &QProcess::readyReadStandardError, this, &ShellPlugin::handleStandardError); connect(m_serverProcess, &QProcess::errorOccurred, this, &ShellPlugin::processCrashed); connect(m_serverProcess, QOverload<int, QProcess::ExitStatus>::of(&QProcess::finished), this, &ShellPlugin::processFinished); } Liri::SessionModule::StartupPhase ShellPlugin::startupPhase() const { return WindowManager; } bool ShellPlugin::start(const QStringList &args) { // Save the effort of running it, if the executable doesn't exist if (!QFile::exists(m_serverProcess->program())) { qCWarning(lcSession, "Couldn't find the \"%s\" executable, " "please check your installation", qPrintable(m_serverProcess->program())); return false; } // Set arguments m_serverProcess->setArguments(args); // Set environment QProcessEnvironment env = QProcessEnvironment::systemEnvironment(); env.remove(QStringLiteral("QT_QPA_PLATFORM")); env.remove(QStringLiteral("QT_WAYLAND_SHELL_INTEGRATION")); m_serverProcess->setProcessEnvironment(env); // Run with retries int retries = 5; while (retries-- > 0) { qCWarning(lcSession, "Trying to run liri-shell..."); m_serverProcess->start(); if (m_serverProcess->waitForStarted()) { // The process has started, but we can't continue until the D-Bus // service is up, that is when the shell is really up and running QTimer::singleShot(30 * 1000, m_loop, &QEventLoop::quit); m_loop->exec(); return m_serverProcess->state() == QProcess::Running; } else { if (retries == 0) qCWarning(lcSession, "Failed to start liri-shell, giving up!"); else qCWarning(lcSession, "Failed to start liri-shell, %d attempt(s) left", retries); } } return false; } bool ShellPlugin::stop() { m_stopping = true; if (m_helperProcess) { m_helperProcess->terminate(); if (!m_helperProcess->waitForFinished()) m_helperProcess->kill(); } if (m_serverProcess) { m_serverProcess->terminate(); if (!m_serverProcess->waitForFinished()) m_serverProcess->kill(); } m_stopping = false; return true; } void ShellPlugin::startShellHelper() { m_helperProcess = new QProcess(this); m_helperProcess->setProcessChannelMode(QProcess::ForwardedChannels); m_helperProcess->setProgram(QString::asprintf("%s/liri-shell-helper", LIBEXECDIR)); connect(m_helperProcess, &QProcess::readyReadStandardOutput, this, &ShellPlugin::handleStandardOutput); connect(m_helperProcess, &QProcess::readyReadStandardError, this, &ShellPlugin::handleStandardError); m_helperProcess->start(); if (!m_helperProcess->waitForStarted()) { // Can't continue without the helper qCWarning(lcSession, "Can't start liri-shell-helper"); if (m_serverProcess) { m_serverProcess->terminate(); if (!m_serverProcess->waitForFinished()) m_serverProcess->kill(); } Q_EMIT shutdownRequested(); } } void ShellPlugin::handleServiceRegistered(const QString &serviceName) { if (serviceName == shellServiceName) { // We don't need to list for this signal disconnect(m_serviceWatcher, &QDBusServiceWatcher::serviceRegistered, this, &ShellPlugin::handleServiceRegistered); // Now start the helper startShellHelper(); // The shell D-Bus service is registered, this means it's ready // and we can move on to the next session module m_loop->quit(); } } void ShellPlugin::handleServiceUnregistered(const QString &serviceName) { if (serviceName == shellServiceName) { // We don't need to list for this signal disconnect(m_serviceWatcher, &QDBusServiceWatcher::serviceUnregistered, this, &ShellPlugin::handleServiceUnregistered); // Can't continue without the display server Q_EMIT shutdownRequested(); } } void ShellPlugin::handleStandardOutput() { auto *process = qobject_cast<QProcess *>(sender()); if (process) qInfo() << process->readAllStandardOutput(); } void ShellPlugin::handleStandardError() { auto *process = qobject_cast<QProcess *>(sender()); if (process) qCritical() << process->readAllStandardError(); } void ShellPlugin::processCrashed(QProcess::ProcessError error) { switch (error) { case QProcess::FailedToStart: qCWarning(lcSession, "Failed to start \"%s\": check if liri-shell is installed correctly", qPrintable(m_serverProcess->program())); m_loop->quit(); break; case QProcess::Crashed: qCWarning(lcSession, "Program \"%s\" just crashed", qPrintable(m_serverProcess->program())); m_loop->quit(); if (m_serverProcess->state() == QProcess::NotRunning && !m_stopping) { if (m_watchDogCounter-- > 0) m_serverProcess->start(); } break; case QProcess::UnknownError: qCWarning(lcSession, "An unknown error occurred starting \"%s\"", qPrintable(m_serverProcess->program())); break; default: break; } } void ShellPlugin::processFinished(int exitCode, QProcess::ExitStatus exitStatus) { if (exitStatus == QProcess::NormalExit && exitCode != 0) qCWarning(lcSession, "\"%s\" finished with exit code %d", qPrintable(m_serverProcess->program()), exitCode); } 07070100000085000081A40000000000000000000000016202D08500000884000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/src/plugins/session/shell/plugin.h/**************************************************************************** * This file is part of Liri. * * Copyright (C) 2019 Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL3+$ * * 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 <http://www.gnu.org/licenses/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SHELLPLUGIN_H #define SHELLPLUGIN_H #include <QLoggingCategory> #include <QProcess> #include <LiriSession/SessionModule> Q_DECLARE_LOGGING_CATEGORY(lcSession) class QDBusServiceWatcher; class QEventLoop; class ShellPlugin : public Liri::SessionModule { Q_OBJECT Q_PLUGIN_METADATA(IID LiriSessionModule_iid FILE "plugin.json") Q_INTERFACES(Liri::SessionModule) public: explicit ShellPlugin(QObject *parent = nullptr); StartupPhase startupPhase() const override; bool start(const QStringList &args = QStringList()) override; bool stop() override; private: int m_watchDogCounter = 3; QEventLoop *m_loop = nullptr; QDBusServiceWatcher *m_serviceWatcher = nullptr; QProcess *m_serverProcess = nullptr; QProcess *m_helperProcess = nullptr; bool m_stopping = false; void startShellHelper(); private Q_SLOTS: void handleServiceRegistered(const QString &serviceName); void handleServiceUnregistered(const QString &serviceName); void handleStandardOutput(); void handleStandardError(); void processCrashed(QProcess::ProcessError error); void processFinished(int exitCode, QProcess::ExitStatus exitStatus); }; #endif // SHELLPLUGIN_H 07070100000086000081A40000000000000000000000016202D08500000100000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/src/plugins/session/shell/plugin.json{ "Id": "io.liri.SessionManager.Modules.Shell", "Type": "SessionModule", "Version": "1.0.0", "Authors": [ "Pier Luigi Fiorini <pierluigi.fiorini@liri.io>" ], "License": "GPL-3.0-or-later", "Website": "https://liri.io" } 07070100000087000041ED0000000000000000000000036202D08500000000000000000000000000000000000000000000002F00000000liri-session-20220208+git.f26b173/translations07070100000088000041ED0000000000000000000000026202D08500000000000000000000000000000000000000000000003700000000liri-session-20220208+git.f26b173/translations/manager07070100000089000081A40000000000000000000000016202D08500000000000000000000000000000000000000000000003B00000000liri-session-20220208+git.f26b173/translations/manager/.po0707010000008A000081A40000000000000000000000016202D08500000312000000000000000000000000000000000000004300000000liri-session-20220208+git.f26b173/translations/manager/desktop.pot# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" "Language: \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "" 0707010000008B000081A40000000000000000000000016202D08500000368000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_ca.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-16 22:07+0200\n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Language-Team: Catalan (https://www.transifex.com/lirios/teams/71982/ca/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ca\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "" 0707010000008C000081A40000000000000000000000016202D085000003BC000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_da.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # scootergrisen, 2020 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Last-Translator: scootergrisen, 2020\n" "Language-Team: Danish (https://www.transifex.com/lirios/teams/71982/da/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: da\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "Liri" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "QtQuick- og Wayland-baseret skrivebordsmiljø" 0707010000008D000081A40000000000000000000000016202D085000003F7000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_de.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # Ettore Atalan <atalanttore@googlemail.com>, 2021 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Last-Translator: Ettore Atalan <atalanttore@googlemail.com>, 2021\n" "Language-Team: German (https://www.transifex.com/lirios/teams/71982/de/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: de\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "Liri" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "QtQuick- und Wayland-basierte Desktop-Umgebung" 0707010000008E000081A40000000000000000000000016202D08500000366000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_fr.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-16 22:07+0200\n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Language-Team: French (https://www.transifex.com/lirios/teams/71982/fr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: fr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "" 0707010000008F000081A40000000000000000000000016202D085000003CD000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/translations/manager/desktop_it_IT.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # Man from Mars, 2020 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Last-Translator: Man from Mars, 2020\n" "Language-Team: Italian (Italy) (https://www.transifex.com/lirios/teams/71982/it_IT/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: it_IT\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "Liri" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "Desktop environment basato su QtQuick e Wayland" 07070100000090000081A40000000000000000000000016202D08500000432000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_lt.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # Moo, 2020 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Last-Translator: Moo, 2020\n" "Language-Team: Lithuanian (https://www.transifex.com/lirios/teams/71982/lt/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: lt\n" "Plural-Forms: nplurals=4; plural=(n % 10 == 1 && (n % 100 > 19 || n % 100 < 11) ? 0 : (n % 10 >= 2 && n % 10 <=9) && (n % 100 > 19 || n % 100 < 11) ? 1 : n % 1 != 0 ? 2: 3);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "Liri" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "QtQuick ir Wayland pagrįsta darbalaukio aplinka" 07070100000091000081A40000000000000000000000016202D085000003F9000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_pl.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-16 22:07+0200\n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Language-Team: Polish (https://www.transifex.com/lirios/teams/71982/pl/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pl\n" "Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "" 07070100000092000081A40000000000000000000000016202D08500000416000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/translations/manager/desktop_pt_BR.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # Luiz Fernando Ranghetti <elchevive68@gmail.com>, 2020 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Last-Translator: Luiz Fernando Ranghetti <elchevive68@gmail.com>, 2020\n" "Language-Team: Portuguese (Brazil) (https://www.transifex.com/lirios/teams/71982/pt_BR/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: pt_BR\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "Liri" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "Ambiente de trabalho baseado no QtQuick e Wayland" 07070100000093000081A40000000000000000000000016202D085000003F2000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_ru.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-16 22:07+0200\n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Language-Team: Russian (https://www.transifex.com/lirios/teams/71982/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "" 07070100000094000081A40000000000000000000000016202D08500000457000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/translations/manager/desktop_ru_RU.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # Irina Fedulova <istartlin@gmail.com>, 2020 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Last-Translator: Irina Fedulova <istartlin@gmail.com>, 2020\n" "Language-Team: Russian (Russia) (https://www.transifex.com/lirios/teams/71982/ru_RU/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: ru_RU\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n%100>=11 && n%100<=14)? 2 : 3);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "Liri" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "" 07070100000095000081A40000000000000000000000016202D085000003ED000000000000000000000000000000000000004500000000liri-session-20220208+git.f26b173/translations/manager/desktop_tr.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # # Translators: # Emin Tufan Çetin <etcetin@gmail.com>, 2020 # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Last-Translator: Emin Tufan Çetin <etcetin@gmail.com>, 2020\n" "Language-Team: Turkish (https://www.transifex.com/lirios/teams/71982/tr/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: tr\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "Liri" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "QtQuick ve Wayland tabanlı masaüstü ortamı" 07070100000096000081A40000000000000000000000016202D0850000036F000000000000000000000000000000000000004800000000liri-session-20220208+git.f26b173/translations/manager/desktop_zh_CN.po# SOME DESCRIPTIVE TITLE. # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER # This file is distributed under the same license as the PACKAGE package. # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. # #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2020-05-16 22:07+0200\n" "PO-Revision-Date: 2020-05-16 20:40+0000\n" "Language-Team: Chinese (China) (https://www.transifex.com/lirios/teams/71982/zh_CN/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Language: zh_CN\n" "Plural-Forms: nplurals=1; plural=0;\n" #. (desktop-to-pot) "Name" entry #: liri.desktop.in.in:2 msgctxt "Name entry" msgid "Liri" msgstr "" #. (desktop-to-pot) "Comment" entry #: liri.desktop.in.in:3 msgctxt "Comment entry" msgid "QtQuick and Wayland based desktop environment" msgstr "" 07070100000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000B00000000TRAILER!!!507 blocks
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor