mirror of
https://github.com/outbackdingo/hyprcosmic-session.git
synced 2026-08-25 14:53:23 +00:00
Fork of pop-os/cosmic-session @ upstream
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
- [ ] I have disclosed use of any AI generated code in my commit messages.
|
||||||
|
- If you are using an LLM, and do not fully understand the changes it is making to the code base, do not create a PR.
|
||||||
|
- In our experience, AI generated code often results in overly complex code that lacks enough context for a proper fix or feature inclusion. This results in considerably longer code reviews. Due to this, AI authored or partially authored PRs may be closed without comment.
|
||||||
|
- [ ] I understand these changes in full and will be able to respond to review comments.
|
||||||
|
- [ ] My change is accurately described in the commit message.
|
||||||
|
- [ ] My contribution is tested and working as described.
|
||||||
|
- [ ] I have read the [Developer Certificate of Origin](https://developercertificate.org/) and certify my contribution under its conditions.
|
||||||
|
|
||||||
+34
@@ -0,0 +1,34 @@
|
|||||||
|
# Generated by Cargo
|
||||||
|
# will have compiled files and executables
|
||||||
|
/target/
|
||||||
|
|
||||||
|
# These are backup files generated by rustfmt
|
||||||
|
**/*.rs.bk
|
||||||
|
|
||||||
|
# Added by cargo
|
||||||
|
/target
|
||||||
|
|
||||||
|
# Added by Nix
|
||||||
|
/result
|
||||||
|
|
||||||
|
# Debian packaging stuff
|
||||||
|
.cargo
|
||||||
|
vendor/
|
||||||
|
vendor.tar
|
||||||
|
*.xz
|
||||||
|
*.deb
|
||||||
|
*.ddeb
|
||||||
|
*.dsc
|
||||||
|
*.changes
|
||||||
|
*.deb.tar.*
|
||||||
|
*.buildinfo
|
||||||
|
*.build
|
||||||
|
debian/*
|
||||||
|
!debian/*install
|
||||||
|
!debian/*postinst
|
||||||
|
!debian/*gsettings-override
|
||||||
|
!debian/changelog
|
||||||
|
!debian/control
|
||||||
|
!debian/links
|
||||||
|
!debian/rules
|
||||||
|
!debian/source
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
{
|
||||||
|
"format_on_save": "on",
|
||||||
|
"lsp": {
|
||||||
|
"rust-analyzer": {
|
||||||
|
"initialization_options": {
|
||||||
|
"check": {
|
||||||
|
"command": "clippy",
|
||||||
|
},
|
||||||
|
"rustfmt": {
|
||||||
|
"extraArgs": ["+nightly"],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
Generated
+1887
File diff suppressed because it is too large
Load Diff
+51
@@ -0,0 +1,51 @@
|
|||||||
|
[package]
|
||||||
|
name = "cosmic-session"
|
||||||
|
description = "The session manager for the COSMIC desktop environment"
|
||||||
|
version = "1.0.0"
|
||||||
|
license = "GPL-3.0-only"
|
||||||
|
edition = "2024"
|
||||||
|
rust-version = "1.93"
|
||||||
|
authors = ["Lucy <[email protected]>"]
|
||||||
|
publish = false
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
color-eyre = "0.6"
|
||||||
|
futures-util = "0.3"
|
||||||
|
cosmic-dbus-a11y = { git = "https://github.com/pop-os/dbus-settings-bindings" }
|
||||||
|
freedesktop-desktop-entry = { version = "0.8", optional = true }
|
||||||
|
shell-words = { version = "1.1.1", optional = true }
|
||||||
|
dirs = { version = "6.0.0", optional = true }
|
||||||
|
launch-pad = { git = "https://github.com/pop-os/launch-pad" }
|
||||||
|
log-panics = { version = "2", features = ["with-backtrace"] }
|
||||||
|
rustix = "1.1"
|
||||||
|
scopeguard = "1"
|
||||||
|
serde = { version = "1", features = ["derive"] }
|
||||||
|
serde_json = "1"
|
||||||
|
tokio = { version = "1", features = [
|
||||||
|
"fs",
|
||||||
|
"io-util",
|
||||||
|
"io-std",
|
||||||
|
"macros",
|
||||||
|
"net",
|
||||||
|
"parking_lot",
|
||||||
|
"process",
|
||||||
|
"rt",
|
||||||
|
"signal",
|
||||||
|
"sync",
|
||||||
|
"time",
|
||||||
|
] }
|
||||||
|
zbus_systemd = { version = "0.26000.0", optional = true, features = [
|
||||||
|
"systemd1",
|
||||||
|
] }
|
||||||
|
tokio-util = "0.7"
|
||||||
|
tracing = "0.1"
|
||||||
|
tracing-journald = { version = "0.3", optional = true }
|
||||||
|
tracing-subscriber = { version = "0.3", features = ["env-filter"] }
|
||||||
|
zbus = { version = "5.14.0", default-features = false, features = ["tokio"] }
|
||||||
|
logind-zbus = { version = "5.3.2", optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
systemd = ["dep:zbus_systemd", "dep:tracing-journald"]
|
||||||
|
logind = ["systemd", "logind-zbus"]
|
||||||
|
default = ["logind"]
|
||||||
|
autostart = ["dep:shell-words", "dep:dirs", "dep:freedesktop-desktop-entry"]
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
rootdir := ''
|
||||||
|
prefix := '/usr'
|
||||||
|
cargo-target-dir := env('CARGO_TARGET_DIR', 'target')
|
||||||
|
orca := '/usr/bin/orca'
|
||||||
|
cosmic_dconf_profile := prefix + '/share/dconf/profile/cosmic'
|
||||||
|
usrdir := absolute_path(clean(rootdir / prefix))
|
||||||
|
bindir := usrdir / 'bin'
|
||||||
|
systemddir := usrdir / 'lib' / 'systemd' / 'user'
|
||||||
|
sessiondir := usrdir / 'share' / 'wayland-sessions'
|
||||||
|
applicationdir := usrdir / 'share' / 'applications'
|
||||||
|
|
||||||
|
default: build-release
|
||||||
|
|
||||||
|
build-debug *args:
|
||||||
|
ORCA={{ orca }} cargo build {{ args }}
|
||||||
|
|
||||||
|
# Compile with release profile
|
||||||
|
build-release *args: (build-debug '--release' args)
|
||||||
|
|
||||||
|
# Compile with a vendored tarball
|
||||||
|
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
|
||||||
|
|
||||||
|
# Remove Cargo build artifacts
|
||||||
|
clean:
|
||||||
|
cargo clean
|
||||||
|
|
||||||
|
# Also remove .cargo and vendored dependencies
|
||||||
|
clean-dist: clean
|
||||||
|
rm -rf .cargo vendor vendor.tar target
|
||||||
|
|
||||||
|
# Installs files into the system
|
||||||
|
install:
|
||||||
|
echo {{ cosmic_dconf_profile }}
|
||||||
|
# main binary
|
||||||
|
install -Dm0755 {{ cargo-target-dir }}/release/cosmic-session {{ bindir }}/cosmic-session
|
||||||
|
|
||||||
|
# session start script
|
||||||
|
install -Dm0755 data/start-cosmic {{ bindir }}/start-cosmic
|
||||||
|
sed -i "s|DCONF_PROFILE=cosmic|DCONF_PROFILE={{ cosmic_dconf_profile }}|" {{ bindir }}/start-cosmic
|
||||||
|
|
||||||
|
# systemd target
|
||||||
|
install -Dm0644 data/cosmic-session.target {{ systemddir }}/cosmic-session.target
|
||||||
|
|
||||||
|
# session
|
||||||
|
install -Dm0644 data/cosmic.desktop {{ sessiondir }}/cosmic.desktop
|
||||||
|
|
||||||
|
# mimeapps
|
||||||
|
install -Dm0644 data/cosmic-mimeapps.list {{ applicationdir }}/cosmic-mimeapps.list
|
||||||
|
|
||||||
|
# dconf profile
|
||||||
|
install -Dm644 data/dconf/profile/cosmic {{ rootdir }}/{{ cosmic_dconf_profile }}
|
||||||
|
|
||||||
|
# Vendor Cargo dependencies locally
|
||||||
|
vendor:
|
||||||
|
mkdir -p .cargo
|
||||||
|
cargo vendor | head -n -1 > .cargo/config.toml
|
||||||
|
echo 'directory = "vendor"' >> .cargo/config.toml
|
||||||
|
tar pcf vendor.tar vendor
|
||||||
|
rm -rf vendor
|
||||||
|
|
||||||
|
# Extracts vendored dependencies
|
||||||
|
[private]
|
||||||
|
vendor-extract:
|
||||||
|
rm -rf vendor
|
||||||
|
tar pxf vendor.tar
|
||||||
|
|
||||||
|
# Bump cargo version, create git commit, and create tag
|
||||||
|
tag version:
|
||||||
|
find -type f -name Cargo.toml -exec sed -i '0,/^version/s/^version.*/version = "{{ version }}"/' '{}' \; -exec git add '{}' \;
|
||||||
|
cargo check
|
||||||
|
cargo clean
|
||||||
|
git add Cargo.lock
|
||||||
|
git commit -m 'release: {{ version }}'
|
||||||
|
git commit --amend
|
||||||
|
git tag -a {{ version }} -m ''
|
||||||
+595
@@ -0,0 +1,595 @@
|
|||||||
|
GNU General Public License
|
||||||
|
==========================
|
||||||
|
|
||||||
|
_Version 3, 29 June 2007_
|
||||||
|
_Copyright © 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>>.
|
||||||
@@ -0,0 +1,315 @@
|
|||||||
|
[Default Applications]
|
||||||
|
text/plain=com.system76.CosmicEdit.desktop
|
||||||
|
text/css=com.system76.CosmicEdit.desktop
|
||||||
|
text/javascript=com.system76.CosmicEdit.desktop
|
||||||
|
text/markdown=com.system76.CosmicEdit.desktop
|
||||||
|
text/mathml=com.system76.CosmicEdit.desktop
|
||||||
|
text/rust=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-c++hdr=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-c++src=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-csrc=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-chdr=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-dtd=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-java=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-javascript=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-makefile=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-moc=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-pascal=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-patch=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-perl=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-php=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-python=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-sql=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-tcl=com.system76.CosmicEdit.desktop
|
||||||
|
text/x-tex=com.system76.CosmicEdit.desktop
|
||||||
|
text/xml=com.system76.CosmicEdit.desktop
|
||||||
|
application/javascript=com.system76.CosmicEdit.desktop
|
||||||
|
application/x-cgi=com.system76.CosmicEdit.desktop
|
||||||
|
application/x-javascript=com.system76.CosmicEdit.desktop
|
||||||
|
application/x-perl=com.system76.CosmicEdit.desktop
|
||||||
|
application/x-php=com.system76.CosmicEdit.desktop
|
||||||
|
application/x-python=com.system76.CosmicEdit.desktop
|
||||||
|
application/x-shellscript=com.system76.CosmicEdit.desktop
|
||||||
|
application/xml=com.system76.CosmicEdit.desktop
|
||||||
|
application/xml-dtd=com.system76.CosmicEdit.desktop
|
||||||
|
inode/directory=com.system76.CosmicFiles.desktop
|
||||||
|
inode/mount-point=com.system76.CosmicFiles.desktop
|
||||||
|
application/mxf=com.system76.CosmicPlayer.desktop
|
||||||
|
application/ogg=com.system76.CosmicPlayer.desktop
|
||||||
|
application/ram=com.system76.CosmicPlayer.desktop
|
||||||
|
application/sdp=com.system76.CosmicPlayer.desktop
|
||||||
|
application/smil=com.system76.CosmicPlayer.desktop
|
||||||
|
application/smil+xml=com.system76.CosmicPlayer.desktop
|
||||||
|
application/vnd.ms-wpl=com.system76.CosmicPlayer.desktop
|
||||||
|
application/vnd.rn-realmedia=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-extension-m4a=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-extension-mp4=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-flac=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-flash-video=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-matroska=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-netshow-channel=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-ogg=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-quicktime-media-link=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-quicktimeplayer=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-shorten=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-smil=com.system76.CosmicPlayer.desktop
|
||||||
|
application/xspf+xml=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/3gpp=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/ac3=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/AMR=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/AMR-WB=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/basic=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/flac=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/midi=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/mp4=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/mpeg=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/mpegurl=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/ogg=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/prs.sid=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/vnd.rn-realaudio=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-ape=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-flac=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-gsm=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-it=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-m4a=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-matroska=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-mod=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-mp3=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-mpeg=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-mpegurl=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-ms-asf=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-ms-asx=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-ms-wax=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-ms-wma=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-musepack=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-pn-aiff=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-pn-au=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-pn-realaudio=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-pn-realaudio-plugin=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-pn-wav=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-pn-windows-acm=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-realaudio=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-real-audio=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-sbc=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-scpls=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-speex=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-tta=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-vorbis=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-vorbis+ogg=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-wav=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-wavpack=com.system76.CosmicPlayer.desktop
|
||||||
|
audio/x-xm=com.system76.CosmicPlayer.desktop
|
||||||
|
image/vnd.rn-realpix=com.system76.CosmicPlayer.desktop
|
||||||
|
image/x-pict=com.system76.CosmicPlayer.desktop
|
||||||
|
misc/ultravox=com.system76.CosmicPlayer.desktop
|
||||||
|
text/google-video-pointer=com.system76.CosmicPlayer.desktop
|
||||||
|
text/x-google-video-pointer=com.system76.CosmicPlayer.desktop
|
||||||
|
video/3gpp=com.system76.CosmicPlayer.desktop
|
||||||
|
video/dv=com.system76.CosmicPlayer.desktop
|
||||||
|
video/fli=com.system76.CosmicPlayer.desktop
|
||||||
|
video/flv=com.system76.CosmicPlayer.desktop
|
||||||
|
video/mp2t=com.system76.CosmicPlayer.desktop
|
||||||
|
video/mp4=com.system76.CosmicPlayer.desktop
|
||||||
|
video/mp4v-es=com.system76.CosmicPlayer.desktop
|
||||||
|
video/mpeg=com.system76.CosmicPlayer.desktop
|
||||||
|
video/msvideo=com.system76.CosmicPlayer.desktop
|
||||||
|
video/ogg=com.system76.CosmicPlayer.desktop
|
||||||
|
video/quicktime=com.system76.CosmicPlayer.desktop
|
||||||
|
video/vivo=com.system76.CosmicPlayer.desktop
|
||||||
|
video/vnd.divx=com.system76.CosmicPlayer.desktop
|
||||||
|
video/vnd.rn-realvideo=com.system76.CosmicPlayer.desktop
|
||||||
|
video/vnd.vivo=com.system76.CosmicPlayer.desktop
|
||||||
|
video/webm=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-anim=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-avi=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-flc=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-fli=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-flic=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-flv=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-m4v=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-matroska=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-mpeg=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-ms-asf=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-ms-asx=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-msvideo=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-ms-wm=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-ms-wmv=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-ms-wmx=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-ms-wvx=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-nsv=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-ogm+ogg=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-theora+ogg=com.system76.CosmicPlayer.desktop
|
||||||
|
video/x-totem-stream=com.system76.CosmicPlayer.desktop
|
||||||
|
x-content/video-dvd=com.system76.CosmicPlayer.desktop
|
||||||
|
x-content/video-vcd=com.system76.CosmicPlayer.desktop
|
||||||
|
x-content/video-svcd=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/pnm=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/mms=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/net=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/rtp=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/rtsp=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/mmsh=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/uvox=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/icy=com.system76.CosmicPlayer.desktop
|
||||||
|
x-scheme-handler/icyx=com.system76.CosmicPlayer.desktop
|
||||||
|
application/x-cd-image=com.system76.Popsicle.desktop
|
||||||
|
application/x-raw-disk-image=com.system76.Popsicle.desktop
|
||||||
|
application/x-raw-disk-image-xz-compressed=com.system76.Popsicle.desktop
|
||||||
|
application/x-debian-package=com.system76.CosmicStore.desktop
|
||||||
|
application/vnd.debian.binary-package=com.system76.CosmicStore.desktop
|
||||||
|
application/vnd.flatpak.ref=com.system76.CosmicStore.desktop
|
||||||
|
x-scheme-handler/appstream=com.system76.CosmicStore.desktop
|
||||||
|
x-scheme-handler/mime=com.system76.CosmicStore.desktop
|
||||||
|
image/bmp=org.gnome.eog.desktop
|
||||||
|
image/gif=org.gnome.eog.desktop
|
||||||
|
image/jpeg=org.gnome.eog.desktop
|
||||||
|
image/jpg=org.gnome.eog.desktop
|
||||||
|
image/pjpeg=org.gnome.eog.desktop
|
||||||
|
image/png=org.gnome.eog.desktop
|
||||||
|
image/svg+xml=org.gnome.eog.desktop
|
||||||
|
image/svg+xml-compressed=org.gnome.eog.desktop
|
||||||
|
image/x-bmp=org.gnome.eog.desktop
|
||||||
|
image/x-gray=org.gnome.eog.desktop
|
||||||
|
image/x-icb=org.gnome.eog.desktop
|
||||||
|
image/x-ico=org.gnome.eog.desktop
|
||||||
|
image/x-pcx=org.gnome.eog.desktop
|
||||||
|
image/x-png=org.gnome.eog.desktop
|
||||||
|
image/x-portable-anymap=org.gnome.eog.desktop
|
||||||
|
image/x-portable-bitmap=org.gnome.eog.desktop
|
||||||
|
image/x-portable-graymap=org.gnome.eog.desktop
|
||||||
|
image/x-portable-pixmap=org.gnome.eog.desktop
|
||||||
|
image/x-xbitmap=org.gnome.eog.desktop
|
||||||
|
image/x-xpixmap=org.gnome.eog.desktop
|
||||||
|
image/vnd.wap.wbmp=org.gnome.eog.desktop
|
||||||
|
image/g3fax=gimp.desktop
|
||||||
|
image/x-compressed-xcf=gimp.desktop
|
||||||
|
image/x-fits=gimp.desktop
|
||||||
|
image/x-icon=gimp.desktop
|
||||||
|
image/x-psd=gimp.desktop
|
||||||
|
image/x-sgi=gimp.desktop
|
||||||
|
image/x-sun-raster=gimp.desktop
|
||||||
|
image/x-tga=gimp.desktop
|
||||||
|
image/x-xcf=gimp.desktop
|
||||||
|
image/x-xwindowdump=gimp.desktop
|
||||||
|
application/pdf=org.gnome.Evince.desktop
|
||||||
|
application/x-bzpdf=org.gnome.Evince.desktop
|
||||||
|
application/x-gzpdf=org.gnome.Evince.desktop
|
||||||
|
application/postscript=org.gnome.Evince.desktop
|
||||||
|
application/x-bzpostscript=org.gnome.Evince.desktop
|
||||||
|
application/x-gzpostscript=org.gnome.Evince.desktop
|
||||||
|
image/x-eps=org.gnome.Evince.desktop
|
||||||
|
image/x-bzeps=org.gnome.Evince.desktop
|
||||||
|
image/x-gzeps=org.gnome.Evince.desktop
|
||||||
|
application/x-dvi=org.gnome.Evince.desktop
|
||||||
|
application/x-bzdvi=org.gnome.Evince.desktop
|
||||||
|
application/x-gzdvi=org.gnome.Evince.desktop
|
||||||
|
image/vnd.djvu=org.gnome.Evince.desktop
|
||||||
|
image/tiff=org.gnome.Evince.desktop
|
||||||
|
application/x-cbr=org.gnome.Evince.desktop
|
||||||
|
application/x-cbz=org.gnome.Evince.desktop
|
||||||
|
application/x-cb7=org.gnome.Evince.desktop
|
||||||
|
application/x-7z-compressed=org.gnome.FileRoller.desktop
|
||||||
|
application/x-7z-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-ace=org.gnome.FileRoller.desktop
|
||||||
|
application/x-alz=org.gnome.FileRoller.desktop
|
||||||
|
application/x-ar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-arj=org.gnome.FileRoller.desktop
|
||||||
|
application/x-bzip=org.gnome.FileRoller.desktop
|
||||||
|
application/x-bzip-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-bzip1=org.gnome.FileRoller.desktop
|
||||||
|
application/x-bzip1-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-cabinet=org.gnome.FileRoller.desktop
|
||||||
|
application/x-compress=org.gnome.FileRoller.desktop
|
||||||
|
application/x-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-cpio=org.gnome.FileRoller.desktop
|
||||||
|
application/x-deb=org.gnome.FileRoller.desktop
|
||||||
|
application/x-ear=org.gnome.FileRoller.desktop
|
||||||
|
application/x-gtar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-gzip=org.gnome.FileRoller.desktop
|
||||||
|
application/x-java-archive=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lha=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lhz=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lzip=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lzip-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lzma=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lzma-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lzop=org.gnome.FileRoller.desktop
|
||||||
|
application/x-lzop-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-rar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-rar-compressed=org.gnome.FileRoller.desktop
|
||||||
|
application/x-rpm=org.gnome.FileRoller.desktop
|
||||||
|
application/x-rzip=org.gnome.FileRoller.desktop
|
||||||
|
application/x-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-tarz=org.gnome.FileRoller.desktop
|
||||||
|
application/x-stuffit=org.gnome.FileRoller.desktop
|
||||||
|
application/x-war=org.gnome.FileRoller.desktop
|
||||||
|
application/x-xz=org.gnome.FileRoller.desktop
|
||||||
|
application/x-xz-compressed-tar=org.gnome.FileRoller.desktop
|
||||||
|
application/x-zip=org.gnome.FileRoller.desktop
|
||||||
|
application/x-zip-compressed=org.gnome.FileRoller.desktop
|
||||||
|
application/x-zoo=org.gnome.FileRoller.desktop
|
||||||
|
application/zip=org.gnome.FileRoller.desktop
|
||||||
|
multipart/x-zip=org.gnome.FileRoller.desktop
|
||||||
|
application/x-font-ttf=org.gnome.font-viewer.desktop
|
||||||
|
application/x-font-pcf=org.gnome.font-viewer.desktop
|
||||||
|
application/x-font-type1=org.gnome.font-viewer.desktop
|
||||||
|
application/x-font-otf=org.gnome.font-viewer.desktop
|
||||||
|
text/html=firefox-esr.desktop;firefox.desktop;
|
||||||
|
application/xhtml+xml=firefox-esr.desktop;firefox.desktop;
|
||||||
|
application/rss+xml=firefox-esr.desktop;firefox.desktop;
|
||||||
|
application/rdf+xml=firefox-esr.desktop;firefox.desktop;
|
||||||
|
x-scheme-handler/http=firefox-esr.desktop;firefox.desktop;
|
||||||
|
x-scheme-handler/https=firefox-esr.desktop;firefox.desktop;
|
||||||
|
application/vnd.oasis.opendocument.spreadsheet=libreoffice-calc.desktop
|
||||||
|
application/vnd.oasis.opendocument.spreadsheet-flat-xml=libreoffice-calc.desktop
|
||||||
|
application/vnd.oasis.opendocument.spreadsheet-template=libreoffice-calc.desktop
|
||||||
|
application/vnd.sun.xml.calc=libreoffice-calc.desktop
|
||||||
|
application/vnd.sun.xml.calc.template=libreoffice-calc.desktop
|
||||||
|
application/msexcel=libreoffice-calc.desktop
|
||||||
|
application/vnd.ms-excel=libreoffice-calc.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet=libreoffice-calc.desktop
|
||||||
|
application/vnd.ms-excel.sheet.macroenabled.12=libreoffice-calc.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.spreadsheetml.template=libreoffice-calc.desktop
|
||||||
|
application/vnd.ms-excel.template.macroenabled.12=libreoffice-calc.desktop
|
||||||
|
application/vnd.ms-excel.sheet.binary.macroenabled.12=libreoffice-calc.desktop
|
||||||
|
application/x-dbf=libreoffice-calc.desktop
|
||||||
|
text/spreadsheet=libreoffice-calc.desktop
|
||||||
|
application/vnd.oasis.opendocument.graphics=libreoffice-draw.desktop
|
||||||
|
application/vnd.oasis.opendocument.graphics-flat-xml=libreoffice-draw.desktop
|
||||||
|
application/vnd.oasis.opendocument.graphics-template=libreoffice-draw.desktop
|
||||||
|
application/vnd.sun.xml.draw=libreoffice-draw.desktop
|
||||||
|
application/vnd.sun.xml.draw.template=libreoffice-draw.desktop
|
||||||
|
application/vnd.visio=libreoffice-draw.desktop
|
||||||
|
application/vnd.oasis.opendocument.presentation=libreoffice-impress.desktop
|
||||||
|
application/vnd.oasis.opendocument.presentation-flat-xml=libreoffice-impress.desktop
|
||||||
|
application/vnd.oasis.opendocument.presentation-template=libreoffice-impress.desktop
|
||||||
|
application/vnd.sun.xml.impress=libreoffice-impress.desktop
|
||||||
|
application/vnd.sun.xml.impress.template=libreoffice-impress.desktop
|
||||||
|
application/mspowerpoint=libreoffice-impress.desktop
|
||||||
|
application/vnd.ms-powerpoint=libreoffice-impress.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.presentation=libreoffice-impress.desktop
|
||||||
|
application/vnd.ms-powerpoint.presentation.macroenabled.12=libreoffice-impress.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.template=libreoffice-impress.desktop
|
||||||
|
application/vnd.ms-powerpoint.template.macroenabled.12=libreoffice-impress.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.slide=libreoffice-impress.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.presentationml.slideshow=libreoffice-impress.desktop
|
||||||
|
application/vnd.oasis.opendocument.formula=libreoffice-math.desktop
|
||||||
|
application/vnd.sun.xml.math=libreoffice-math.desktop
|
||||||
|
application/vnd.oasis.opendocument.text=libreoffice-writer.desktop
|
||||||
|
application/vnd.oasis.opendocument.text-flat-xml=libreoffice-writer.desktop
|
||||||
|
application/vnd.oasis.opendocument.text-template=libreoffice-writer.desktop
|
||||||
|
application/vnd.oasis.opendocument.text-web=libreoffice-writer.desktop
|
||||||
|
application/vnd.oasis.opendocument.text-master=libreoffice-writer.desktop
|
||||||
|
application/vnd.sun.xml.writer=libreoffice-writer.desktop
|
||||||
|
application/vnd.sun.xml.writer.template=libreoffice-writer.desktop
|
||||||
|
application/vnd.sun.xml.writer.global=libreoffice-writer.desktop
|
||||||
|
eapplication/vnd.ms-word=libreoffice-writer.desktop
|
||||||
|
application/x-doc=libreoffice-writer.desktop
|
||||||
|
application/x-hwp=libreoffice-writer.desktop
|
||||||
|
application/vnd.wordperfect=libreoffice-writer.desktop
|
||||||
|
application/wordperfect=libreoffice-writer.desktop
|
||||||
|
application/vnd.lotus-wordpro=libreoffice-writer.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.document=libreoffice-writer.desktop
|
||||||
|
application/vnd.ms-word.document.macroenabled.12=libreoffice-writer.desktop
|
||||||
|
application/vnd.openxmlformats-officedocument.wordprocessingml.template=libreoffice-writer.desktop
|
||||||
|
application/vnd.ms-word.template.macroenabled.12=libreoffice-writer.desktop
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=Cosmic Session Target
|
||||||
|
Documentation=man:systemd.special(7)
|
||||||
|
|
||||||
|
BindsTo=graphical-session.target
|
||||||
|
Before=graphical-session.target
|
||||||
|
|
||||||
|
Wants=graphical-session-pre.target
|
||||||
|
After=graphical-session-pre.target
|
||||||
|
|
||||||
|
Wants=xdg-desktop-autostart.target
|
||||||
|
Before=xdg-desktop-autostart.target
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Name=COSMIC
|
||||||
|
Comment=This session logs you into the COSMIC desktop
|
||||||
|
Comment[sv]=Denna session loggar in dig till skrivbordsmiljön COSMIC
|
||||||
|
Exec=/usr/bin/start-cosmic
|
||||||
|
Type=Application
|
||||||
|
DesktopNames=COSMIC
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
user-db:cosmic
|
||||||
|
user-db:user
|
||||||
Executable
+114
@@ -0,0 +1,114 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
# From: https://people.debian.org/~mpitt/systemd.conf-2016-graphical-session.pdf
|
||||||
|
|
||||||
|
if command -v systemctl >/dev/null; then
|
||||||
|
# robustness: if the previous graphical session left some failed units,
|
||||||
|
# reset them so that they don't break this startup
|
||||||
|
for unit in $(systemctl --user --no-legend --state=failed --plain list-units | cut -f1 -d' '); do
|
||||||
|
partof="$(systemctl --user show -p PartOf --value "$unit")"
|
||||||
|
for target in cosmic-session.target graphical-session.target; do
|
||||||
|
if [ "$partof" = "$target" ]; then
|
||||||
|
systemctl --user reset-failed "$unit"
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# use the user's preferred shell to acquire environment variables
|
||||||
|
# see: https://github.com/pop-os/cosmic-session/issues/23
|
||||||
|
if [ -n "${SHELL}" ]; then
|
||||||
|
# --in-login-shell: our flag to indicate that we don't need to recurse any further
|
||||||
|
if [ "${1}" != "--in-login-shell" ]; then
|
||||||
|
# `exec -l`: like `login`, prefixes $SHELL with a hyphen to start a login shell
|
||||||
|
exec bash -c "exec -l '${SHELL}' -c '${0} --in-login-shell'"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
export XDG_CURRENT_DESKTOP="${XDG_CURRENT_DESKTOP:=COSMIC}"
|
||||||
|
export XDG_SESSION_DESKTOP="${XDG_SESSION_DESKTOP:=COSMIC}"
|
||||||
|
export XDG_SESSION_TYPE="${XDG_SESSION_TYPE:=wayland}"
|
||||||
|
export _JAVA_AWT_WM_NONREPARENTING=1
|
||||||
|
export GDK_BACKEND=wayland,x11
|
||||||
|
export MOZ_ENABLE_WAYLAND=1
|
||||||
|
export QT_QPA_PLATFORM="wayland;xcb"
|
||||||
|
export QT_AUTO_SCREEN_SCALE_FACTOR=1
|
||||||
|
export QT_ENABLE_HIGHDPI_SCALING=1
|
||||||
|
export DCONF_PROFILE=cosmic
|
||||||
|
|
||||||
|
# Set the QT platform theme to CuteCosmic. Fallback to qt6ct if CuteCosmic is not installed.
|
||||||
|
if [ -z "$QT_QPA_PLATFORMTHEME" ]; then
|
||||||
|
export QT_QPA_PLATFORMTHEME=cosmic
|
||||||
|
for QT_PLUGIN_PATH in /usr/lib{*,/*}/qt6/plugins; do
|
||||||
|
if [ -f "${QT_PLUGIN_PATH}/platformthemes/libcutecosmictheme.so" ]; then
|
||||||
|
# CuteCosmic found, no need for a fallback.
|
||||||
|
export QT_QPA_PLATFORMTHEME=cosmic
|
||||||
|
break
|
||||||
|
elif [ -f "${QT_PLUGIN_PATH}/platformthemes/libqt6ct.so" ] || [ -f "${QT_PLUGIN_PATH}/platformthemes/libqt5ct.so" ]; then
|
||||||
|
# Fallback to qt6ct, but keep looking for CuteCosmic.
|
||||||
|
# Note that "qt5ct" is compatible with both qt5ct and qt6ct.
|
||||||
|
export QT_QPA_PLATFORMTHEME=qt5ct
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Start gnome keyring components if the daemon is active
|
||||||
|
# -> check if /run/user/$UID/keyring exists
|
||||||
|
if [ -d "/run/user/$(id -u)/keyring" ]; then
|
||||||
|
|
||||||
|
# Use PATH lookup instead of hardcoding /usr/bin
|
||||||
|
if command -v gnome-keyring-daemon >/dev/null 2>&1; then
|
||||||
|
eval "$(gnome-keyring-daemon --start --components=pkcs11,secrets,ssh > /dev/null 2>&1)"
|
||||||
|
else
|
||||||
|
echo "gnome-keyring-daemon not found in PATH" >&2
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Only set SSH_AUTH_SOCK if the socket actually exists. Either
|
||||||
|
# set the correct one, or don't set one at all. Don't set the
|
||||||
|
# wrong value.
|
||||||
|
if [ -S "/run/user/$(id -u)/gcr/ssh" ]; then
|
||||||
|
export SSH_AUTH_SOCK="/run/user/$(id -u)/gcr/ssh"
|
||||||
|
elif [ -S "/run/user/$(id -u)/keyring/ssh" ]; then
|
||||||
|
export SSH_AUTH_SOCK="/run/user/$(id -u)/keyring/ssh"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
if command -v systemctl >/dev/null; then
|
||||||
|
# Import some variables that we explicitly want to have available
|
||||||
|
# in the user session.
|
||||||
|
systemctl --user import-environment XDG_SESSION_TYPE XDG_CURRENT_DESKTOP DCONF_PROFILE SSH_AUTH_SOCK
|
||||||
|
|
||||||
|
# For environment variables already imported into the user's
|
||||||
|
# session, if the value imported differs from the value in this
|
||||||
|
# environment, update it.
|
||||||
|
mapfile -t existing_env_vars < <(systemctl --user show-environment)
|
||||||
|
for env_var in "${existing_env_vars[@]}"; do
|
||||||
|
env_var_name="${env_var%%=*}"
|
||||||
|
env_var_value=${!env_var_name:-}
|
||||||
|
|
||||||
|
# Skip current iteration if the environment variable's value
|
||||||
|
# in the current envionment is unset.
|
||||||
|
if [[ -z "${env_var_value}" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
env_var_val_str_to_compare="${env_var_name}=${env_var_value}"
|
||||||
|
env_var_val_str_to_compare_ansi_c_quoted="${env_var_name}=\$'$(printf '%q' "${env_var_value}")'"
|
||||||
|
if [[ "${env_var}" == "${env_var_val_str_to_compare}" ]]; then
|
||||||
|
continue
|
||||||
|
elif [[ "${env_var}" == "${env_var_val_str_to_compare_ansi_c_quoted}" ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
systemctl --user import-environment "${env_var_name}" ||:
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Run cosmic-session
|
||||||
|
if [[ -z "${DBUS_SESSION_BUS_ADDRESS}" ]]; then
|
||||||
|
exec /usr/bin/dbus-run-session -- /usr/bin/cosmic-session
|
||||||
|
else
|
||||||
|
exec /usr/bin/cosmic-session
|
||||||
|
fi
|
||||||
Vendored
+5
@@ -0,0 +1,5 @@
|
|||||||
|
cosmic-session (1.0.0) noble; urgency=medium
|
||||||
|
|
||||||
|
* Initial release
|
||||||
|
|
||||||
|
-- Michael Murphy <[email protected]> Thu, 11 Dec 2025 13:49:55 +0100
|
||||||
Vendored
+52
@@ -0,0 +1,52 @@
|
|||||||
|
Source: cosmic-session
|
||||||
|
Section: admin
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: System76 <[email protected]>
|
||||||
|
Build-Depends:
|
||||||
|
debhelper (>= 11),
|
||||||
|
debhelper-compat (= 11),
|
||||||
|
cargo,
|
||||||
|
just
|
||||||
|
Standards-Version: 4.3.0
|
||||||
|
Homepage: https://github.com/pop-os/cosmic-session
|
||||||
|
|
||||||
|
Package: cosmic-session
|
||||||
|
Architecture: amd64 arm64
|
||||||
|
Conflicts: seatd
|
||||||
|
Depends:
|
||||||
|
${misc:Depends},
|
||||||
|
${shlibs:Depends},
|
||||||
|
cosmic-app-library,
|
||||||
|
cosmic-applets,
|
||||||
|
cosmic-bg,
|
||||||
|
cosmic-comp,
|
||||||
|
cosmic-files,
|
||||||
|
cosmic-greeter,
|
||||||
|
cosmic-icons,
|
||||||
|
cosmic-idle,
|
||||||
|
cosmic-launcher,
|
||||||
|
cosmic-notifications,
|
||||||
|
cosmic-osd,
|
||||||
|
cosmic-panel,
|
||||||
|
cosmic-randr,
|
||||||
|
cosmic-screenshot,
|
||||||
|
cosmic-settings,
|
||||||
|
cosmic-settings-daemon,
|
||||||
|
cosmic-workspaces,
|
||||||
|
fonts-open-sans,
|
||||||
|
gnome-keyring,
|
||||||
|
libsecret-1-0,
|
||||||
|
pop-fonts,
|
||||||
|
switcheroo-control,
|
||||||
|
xdg-desktop-portal-cosmic,
|
||||||
|
xwayland,
|
||||||
|
Recommends:
|
||||||
|
cosmic-edit,
|
||||||
|
cosmic-monitor,
|
||||||
|
cosmic-player,
|
||||||
|
cosmic-store,
|
||||||
|
cosmic-term,
|
||||||
|
cosmic-wallpapers,
|
||||||
|
orca,
|
||||||
|
system-config-printer,
|
||||||
|
Description: The session for the COSMIC desktop
|
||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
[org.gnome.desktop.interface:COSMIC]
|
||||||
|
color-scheme = "prefer-dark"
|
||||||
|
gtk-theme = "Pop-dark"
|
||||||
|
icon-theme = "Pop"
|
||||||
|
cursor-theme = "Pop"
|
||||||
|
font-name = "Open Sans 11"
|
||||||
|
document-font-name = "Open Sans 11"
|
||||||
|
monospace-font-name = "Noto Sans Mono 11"
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
#!/usr/bin/make -f
|
||||||
|
|
||||||
|
export DESTDIR = debian/cosmic-session
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
override_dh_auto_clean:
|
||||||
|
ischroot || just vendor
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
test -e vendor.tar && just build-vendored || just
|
||||||
|
|
||||||
|
override_dh_auto_install:
|
||||||
|
just rootdir=$(DESTDIR) install
|
||||||
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
3.0 (native)
|
||||||
Generated
+137
@@ -0,0 +1,137 @@
|
|||||||
|
{
|
||||||
|
"nodes": {
|
||||||
|
"crane": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1702141249,
|
||||||
|
"narHash": "sha256-8wDpJKbDTDqFmyJfNEJOLrHYDoEzCjCbmz+lSRoU3CI=",
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"rev": "62fc1a0cbe144c1014d956e603d56bf1ffe69c7d",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "ipetkov",
|
||||||
|
"repo": "crane",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"fenix": {
|
||||||
|
"inputs": {
|
||||||
|
"nixpkgs": [
|
||||||
|
"nixpkgs"
|
||||||
|
],
|
||||||
|
"rust-analyzer-src": "rust-analyzer-src"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1702189261,
|
||||||
|
"narHash": "sha256-TN6gE1eZddDhAoRrScV6Wji1Nk3uqMIDjGwN5ZesAZk=",
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"rev": "cae060dbaf53430bb2b549ced0affd54d40e6cee",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-community",
|
||||||
|
"repo": "fenix",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"inputs": {
|
||||||
|
"systems": "systems"
|
||||||
|
},
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1701680307,
|
||||||
|
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nix-filter": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1701697642,
|
||||||
|
"narHash": "sha256-L217WytWZHSY8GW9Gx1A64OnNctbuDbfslaTEofXXRw=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"rev": "c843418ecfd0344ecb85844b082ff5675e02c443",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "nix-filter",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"nixpkgs": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1702206697,
|
||||||
|
"narHash": "sha256-vE9oEx3Y8TO5MnWwFlmopjHd1JoEBno+EhsfUCq5iR8=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "29d6c96900b9b576c2fb89491452f283aa979819",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"ref": "nixpkgs-unstable",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"inputs": {
|
||||||
|
"crane": "crane",
|
||||||
|
"fenix": "fenix",
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nix-filter": "nix-filter",
|
||||||
|
"nixpkgs": "nixpkgs"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer-src": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1702153490,
|
||||||
|
"narHash": "sha256-F98s0+mUHtqiUk9iCApPTy23YMLmcKqTfsShpIPB40Q=",
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"rev": "9d87a23cdef6087c1a0c97980949e2310271a941",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "rust-lang",
|
||||||
|
"ref": "nightly",
|
||||||
|
"repo": "rust-analyzer",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"systems": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1681028828,
|
||||||
|
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "nix-systems",
|
||||||
|
"repo": "default",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"root": "root",
|
||||||
|
"version": 7
|
||||||
|
}
|
||||||
@@ -0,0 +1,81 @@
|
|||||||
|
{
|
||||||
|
description = "Session manager for the COSMIC desktop environment";
|
||||||
|
|
||||||
|
inputs = {
|
||||||
|
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
||||||
|
flake-utils.url = "github:numtide/flake-utils";
|
||||||
|
nix-filter.url = "github:numtide/nix-filter";
|
||||||
|
crane = {
|
||||||
|
url = "github:ipetkov/crane";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
fenix = {
|
||||||
|
url = "github:nix-community/fenix";
|
||||||
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
outputs = { self, nixpkgs, flake-utils, nix-filter, crane, fenix }:
|
||||||
|
flake-utils.lib.eachSystem [ "x86_64-linux" "aarch64-linux" ] (system:
|
||||||
|
let
|
||||||
|
pkgs = nixpkgs.legacyPackages.${system};
|
||||||
|
craneLib = crane.lib.${system}.overrideToolchain fenix.packages.${system}.stable.toolchain;
|
||||||
|
|
||||||
|
pkgDef = {
|
||||||
|
nativeBuildInputs = with pkgs; [ just pkg-config autoPatchelfHook ];
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
stdenv.cc.cc.lib
|
||||||
|
];
|
||||||
|
src = nix-filter.lib.filter {
|
||||||
|
root = ./.;
|
||||||
|
include = [
|
||||||
|
./src
|
||||||
|
./Cargo.toml
|
||||||
|
./Cargo.lock
|
||||||
|
./Justfile
|
||||||
|
./data
|
||||||
|
];
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
cargoArtifacts = craneLib.buildDepsOnly pkgDef;
|
||||||
|
cosmic-session = craneLib.buildPackage (pkgDef // {
|
||||||
|
inherit cargoArtifacts;
|
||||||
|
});
|
||||||
|
in {
|
||||||
|
checks = {
|
||||||
|
inherit cosmic-session;
|
||||||
|
};
|
||||||
|
|
||||||
|
packages.default = cosmic-session.overrideAttrs (oldAttrs: rec {
|
||||||
|
buildPhase = ''
|
||||||
|
just prefix=$out xdp_cosmic=/run/current-system/sw/bin/xdg-desktop-portal-cosmic build
|
||||||
|
'';
|
||||||
|
installPhase = ''
|
||||||
|
runHook preInstallPhase
|
||||||
|
just prefix=$out install
|
||||||
|
'';
|
||||||
|
preInstallPhase = ''
|
||||||
|
substituteInPlace data/start-cosmic --replace '#!/bin/bash' "#!${pkgs.bash}/bin/bash"
|
||||||
|
substituteInPlace data/start-cosmic --replace '/usr/bin/cosmic-session' "${placeholder "out"}/bin/cosmic-session"
|
||||||
|
substituteInPlace data/start-cosmic --replace '/usr/bin/dbus-run-session' "${pkgs.dbus}/bin/dbus-run-session"
|
||||||
|
substituteInPlace data/cosmic.desktop --replace '/usr/bin/start-cosmic' "${placeholder "out"}/bin/start-cosmic"
|
||||||
|
'';
|
||||||
|
passthru.providedSessions = [ "cosmic" ];
|
||||||
|
});
|
||||||
|
|
||||||
|
apps.default = flake-utils.lib.mkApp {
|
||||||
|
drv = cosmic-session;
|
||||||
|
};
|
||||||
|
|
||||||
|
devShells.default = pkgs.mkShell {
|
||||||
|
inputsFrom = builtins.attrValues self.checks.${system};
|
||||||
|
};
|
||||||
|
});
|
||||||
|
|
||||||
|
nixConfig = {
|
||||||
|
# Cache for the Rust toolchain in fenix
|
||||||
|
extra-substituters = [ "https://nix-community.cachix.org" ];
|
||||||
|
extra-trusted-public-keys = [ "nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs=" ];
|
||||||
|
};
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
edition = "2024"
|
||||||
|
hard_tabs = true
|
||||||
|
use_field_init_shorthand = true
|
||||||
|
# Unstable formatting options below; remove if you REALLY don't wanna use `cargo +nightly fmt`
|
||||||
|
format_code_in_doc_comments = true
|
||||||
|
format_strings = true
|
||||||
|
imports_granularity = "Module"
|
||||||
|
normalize_comments = true
|
||||||
|
reorder_impl_items = true
|
||||||
|
wrap_comments = true
|
||||||
+80
@@ -0,0 +1,80 @@
|
|||||||
|
use futures_util::StreamExt;
|
||||||
|
use launch_pad::ProcessManager;
|
||||||
|
use tokio::sync::mpsc;
|
||||||
|
use tracing::Instrument;
|
||||||
|
|
||||||
|
const ORCA: Option<&'static str> = option_env!("ORCA");
|
||||||
|
|
||||||
|
pub async fn start_a11y(
|
||||||
|
env_vars: Vec<(String, String)>,
|
||||||
|
pman: ProcessManager,
|
||||||
|
) -> color_eyre::Result<()> {
|
||||||
|
let (tx, mut rx) = mpsc::unbounded_channel();
|
||||||
|
let mut process_key = None;
|
||||||
|
let conn = zbus::Connection::session().await?;
|
||||||
|
let proxy = cosmic_dbus_a11y::StatusProxy::new(&conn).await?;
|
||||||
|
|
||||||
|
tokio::spawn(async move {
|
||||||
|
let mut watch_changes = proxy.receive_screen_reader_enabled_changed().await;
|
||||||
|
let mut enabled = false;
|
||||||
|
if let Ok(status) = proxy.screen_reader_enabled().await {
|
||||||
|
_ = tx.send(status);
|
||||||
|
|
||||||
|
enabled = status;
|
||||||
|
}
|
||||||
|
while let Some(change) = watch_changes.next().await {
|
||||||
|
let Ok(new_enabled) = change.get().await else {
|
||||||
|
tokio::time::sleep(tokio::time::Duration::from_secs(10)).await;
|
||||||
|
continue;
|
||||||
|
};
|
||||||
|
if enabled != new_enabled {
|
||||||
|
_ = tx.send(new_enabled);
|
||||||
|
enabled = new_enabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
while let Some(enabled) = rx.recv().await {
|
||||||
|
let stdout_span = info_span!(parent: None, "screen-reader");
|
||||||
|
let stderr_span = stdout_span.clone();
|
||||||
|
if enabled && process_key.is_none() {
|
||||||
|
// spawn orca
|
||||||
|
match pman
|
||||||
|
.start(
|
||||||
|
launch_pad::process::Process::new()
|
||||||
|
.with_executable(ORCA.unwrap_or("/usr/bin/orca"))
|
||||||
|
.with_env(env_vars.clone())
|
||||||
|
.with_on_stdout(move |_, _, line| {
|
||||||
|
let stdout_span = stdout_span.clone();
|
||||||
|
async move {
|
||||||
|
info!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stdout_span)
|
||||||
|
})
|
||||||
|
.with_on_stderr(move |_, _, line| {
|
||||||
|
let stderr_span = stderr_span.clone();
|
||||||
|
async move {
|
||||||
|
warn!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stderr_span)
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(key) => {
|
||||||
|
process_key = Some(key);
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
tracing::error!("Failed to start screen reader {err:?}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if !enabled && process_key.is_some() {
|
||||||
|
// kill orca
|
||||||
|
info!("Stopping screen reader");
|
||||||
|
if let Err(err) = pman.stop_process(process_key.take().unwrap()).await {
|
||||||
|
tracing::error!("Failed to stop screen reader. {err:?}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
+172
@@ -0,0 +1,172 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
use color_eyre::eyre::{Result, WrapErr};
|
||||||
|
use launch_pad::ProcessManager;
|
||||||
|
use launch_pad::process::Process;
|
||||||
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::collections::HashMap;
|
||||||
|
use std::os::unix::prelude::*;
|
||||||
|
use tokio::io::AsyncReadExt;
|
||||||
|
use tokio::net::UnixStream;
|
||||||
|
use tokio::net::unix::OwnedReadHalf;
|
||||||
|
use tokio::sync::{mpsc, oneshot};
|
||||||
|
use tokio::task::JoinHandle;
|
||||||
|
use tokio_util::sync::CancellationToken;
|
||||||
|
|
||||||
|
use crate::process::mark_as_not_cloexec;
|
||||||
|
use crate::service::SessionRequest;
|
||||||
|
|
||||||
|
#[derive(Debug, Serialize, Deserialize)]
|
||||||
|
#[serde(rename_all = "snake_case", tag = "message")]
|
||||||
|
pub enum Message {
|
||||||
|
SetEnv { variables: HashMap<String, String> },
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cancellation safe!
|
||||||
|
#[derive(Default)]
|
||||||
|
struct IpcState {
|
||||||
|
env_tx: Option<oneshot::Sender<HashMap<String, String>>>,
|
||||||
|
length: Option<u16>,
|
||||||
|
bytes_read: usize,
|
||||||
|
buf: Vec<u8>,
|
||||||
|
}
|
||||||
|
|
||||||
|
fn parse_and_handle_ipc(state: &mut IpcState) {
|
||||||
|
match serde_json::from_slice::<Message>(&state.buf) {
|
||||||
|
Ok(Message::SetEnv { variables }) => {
|
||||||
|
if let Some(env_tx) = state.env_tx.take() {
|
||||||
|
env_tx.send(variables).unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(_) => {
|
||||||
|
warn!(
|
||||||
|
"Unknown session socket message, are you using incompatible cosmic-session and \
|
||||||
|
cosmic-comp versions?"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn receive_ipc(state: &mut IpcState, rx: &mut OwnedReadHalf) -> Result<()> {
|
||||||
|
// This is kind of a doozy, but this is kinda complex so it can be
|
||||||
|
// cancellation-safe.
|
||||||
|
match state.length {
|
||||||
|
// We already got the length, and are currently reading the message body.
|
||||||
|
Some(length) => {
|
||||||
|
let index = state.bytes_read.saturating_sub(1);
|
||||||
|
// Add the amount of bytes read to our state.
|
||||||
|
// I don't think this is entirely cancellation safe, which worries me.
|
||||||
|
state.bytes_read += rx
|
||||||
|
.read_exact(&mut state.buf[index..])
|
||||||
|
.await
|
||||||
|
.wrap_err("failed to read IPC length")?;
|
||||||
|
// If we've read enough bytes, parse the message.
|
||||||
|
if state.bytes_read >= length as usize {
|
||||||
|
parse_and_handle_ipc(state);
|
||||||
|
// Set the state back to the default "waiting for a length" mode.
|
||||||
|
state.length = None;
|
||||||
|
state.bytes_read = 0;
|
||||||
|
state.buf.clear();
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
// Resize the state buffer enough to fit a u16./
|
||||||
|
state.buf.resize(2, 0);
|
||||||
|
let index = state.bytes_read.saturating_sub(1);
|
||||||
|
// Read the remaining bytes of the length.
|
||||||
|
state.bytes_read += rx
|
||||||
|
.read_exact(&mut state.buf[index..])
|
||||||
|
.await
|
||||||
|
.wrap_err("failed to read IPC length")?;
|
||||||
|
// If we've read two bytes, then parse a native-endian u16 from them.
|
||||||
|
if state.bytes_read >= 2 {
|
||||||
|
let length = u16::from_ne_bytes(
|
||||||
|
state.buf[..2]
|
||||||
|
.try_into()
|
||||||
|
.wrap_err("failed to convert IPC length to u16")?,
|
||||||
|
);
|
||||||
|
// Set the state to "reading the message body" mode, as we now have the length.
|
||||||
|
state.length = Some(length);
|
||||||
|
state.bytes_read = 0;
|
||||||
|
state.buf.resize(length as usize, 0);
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn run_compositor(
|
||||||
|
process_manager: &ProcessManager,
|
||||||
|
exec: String,
|
||||||
|
args: Vec<String>,
|
||||||
|
_token: CancellationToken,
|
||||||
|
env_tx: oneshot::Sender<HashMap<String, String>>,
|
||||||
|
session_dbus_tx: mpsc::Sender<SessionRequest>,
|
||||||
|
) -> Result<JoinHandle<Result<()>>> {
|
||||||
|
let process_manager = process_manager.clone();
|
||||||
|
// Create a pair of unix sockets - one for us (session),
|
||||||
|
// one for the compositor (comp)
|
||||||
|
let (session, comp) = UnixStream::pair().wrap_err("failed to create pair of unix sockets")?;
|
||||||
|
let (mut session_rx, _session_tx) = session.into_split();
|
||||||
|
// Convert our compositor socket to a non-blocking file descriptor.
|
||||||
|
let comp = {
|
||||||
|
let std_stream = comp
|
||||||
|
.into_std()
|
||||||
|
.wrap_err("failed to convert compositor unix stream to a standard unix stream")?;
|
||||||
|
std_stream
|
||||||
|
.set_nonblocking(false)
|
||||||
|
.wrap_err("failed to mark compositor unix stream as blocking")?;
|
||||||
|
OwnedFd::from(std_stream)
|
||||||
|
};
|
||||||
|
mark_as_not_cloexec(&comp).expect("Failed to mark fd as not cloexec");
|
||||||
|
Ok(tokio::spawn(async move {
|
||||||
|
// Create a new process handler for cosmic-comp, with our compositor socket's
|
||||||
|
// file descriptor as the `COSMIC_SESSION_SOCK` environment variable.
|
||||||
|
process_manager
|
||||||
|
.start_process(
|
||||||
|
Process::new()
|
||||||
|
.with_executable(exec)
|
||||||
|
.with_args(args)
|
||||||
|
.with_env([("COSMIC_SESSION_SOCK", comp.as_raw_fd().to_string())])
|
||||||
|
.with_on_exit(move |pman, _, err_code, _will_restart| {
|
||||||
|
let session_dbus_tx = session_dbus_tx.clone();
|
||||||
|
async move {
|
||||||
|
pman.stop();
|
||||||
|
if err_code == Some(0) {
|
||||||
|
info!("cosmic-comp exited successfully");
|
||||||
|
session_dbus_tx.send(SessionRequest::Exit).await.unwrap();
|
||||||
|
} else if let Some(err_code) = err_code {
|
||||||
|
error!("cosmic-comp exited with error code {}", err_code);
|
||||||
|
session_dbus_tx.send(SessionRequest::Restart).await.unwrap();
|
||||||
|
} else {
|
||||||
|
warn!("cosmic-comp exited by signal");
|
||||||
|
session_dbus_tx.send(SessionRequest::Restart).await.unwrap();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.expect("failed to launch compositor");
|
||||||
|
// Create a new state object for IPC purposes.
|
||||||
|
let mut ipc_state = IpcState {
|
||||||
|
env_tx: Some(env_tx),
|
||||||
|
..IpcState::default()
|
||||||
|
};
|
||||||
|
loop {
|
||||||
|
tokio::select! {
|
||||||
|
/*
|
||||||
|
exit = receive_event(&mut rx) => if exit.is_none() {
|
||||||
|
break;
|
||||||
|
},
|
||||||
|
*/
|
||||||
|
// Receive IPC messages from the process,
|
||||||
|
// exiting the loop if IPC errors.
|
||||||
|
result = receive_ipc(&mut ipc_state, &mut session_rx) => if let Err(err) = result {
|
||||||
|
error!("failed to receive IPC: {:?}", err);
|
||||||
|
break;
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Result::<()>::Ok(())
|
||||||
|
}))
|
||||||
|
}
|
||||||
+560
@@ -0,0 +1,560 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
#[macro_use]
|
||||||
|
extern crate tracing;
|
||||||
|
|
||||||
|
mod a11y;
|
||||||
|
mod comp;
|
||||||
|
mod notifications;
|
||||||
|
mod process;
|
||||||
|
mod service;
|
||||||
|
mod systemd;
|
||||||
|
|
||||||
|
use color_eyre::Result;
|
||||||
|
use color_eyre::eyre::WrapErr;
|
||||||
|
use launch_pad::ProcessManager;
|
||||||
|
use launch_pad::process::Process;
|
||||||
|
use service::SessionRequest;
|
||||||
|
use std::borrow::Cow;
|
||||||
|
#[cfg(feature = "autostart")]
|
||||||
|
use std::collections::HashSet;
|
||||||
|
use std::env;
|
||||||
|
use std::os::fd::AsRawFd;
|
||||||
|
#[cfg(feature = "autostart")]
|
||||||
|
use std::path::PathBuf;
|
||||||
|
#[cfg(feature = "autostart")]
|
||||||
|
use std::process::{Command, Stdio};
|
||||||
|
use std::sync::Arc;
|
||||||
|
#[cfg(feature = "systemd")]
|
||||||
|
use systemd::{get_systemd_env, is_systemd_used, spawn_scope};
|
||||||
|
use tokio::signal::unix::{SignalKind, signal};
|
||||||
|
use tokio::sync::mpsc::{Receiver, Sender};
|
||||||
|
use tokio::sync::{Mutex, oneshot};
|
||||||
|
use tokio::time::Duration;
|
||||||
|
use tokio_util::sync::CancellationToken;
|
||||||
|
use tracing::Instrument;
|
||||||
|
use tracing::metadata::LevelFilter;
|
||||||
|
use tracing_subscriber::prelude::*;
|
||||||
|
use tracing_subscriber::{EnvFilter, fmt};
|
||||||
|
|
||||||
|
use crate::notifications::{
|
||||||
|
DAEMON_NOTIFICATIONS_FD, PANEL_NOTIFICATIONS_FD, notifications_process,
|
||||||
|
};
|
||||||
|
#[cfg(feature = "autostart")]
|
||||||
|
const AUTOSTART_DIR: &'static str = "autostart";
|
||||||
|
#[cfg(feature = "autostart")]
|
||||||
|
const ENVIRONMENT_NAME: &'static str = "COSMIC";
|
||||||
|
|
||||||
|
#[tokio::main(flavor = "current_thread")]
|
||||||
|
async fn main() -> Result<()> {
|
||||||
|
color_eyre::install().wrap_err("failed to install color_eyre error handler")?;
|
||||||
|
|
||||||
|
let trace = tracing_subscriber::registry();
|
||||||
|
let env_filter = EnvFilter::builder()
|
||||||
|
.with_default_directive(LevelFilter::INFO.into())
|
||||||
|
.from_env_lossy();
|
||||||
|
|
||||||
|
#[cfg(feature = "systemd")]
|
||||||
|
if let Ok(journald) = tracing_journald::layer() {
|
||||||
|
trace
|
||||||
|
.with(journald)
|
||||||
|
.with(env_filter)
|
||||||
|
.try_init()
|
||||||
|
.wrap_err("failed to initialize logger")?;
|
||||||
|
} else {
|
||||||
|
trace
|
||||||
|
.with(fmt::layer())
|
||||||
|
.with(env_filter)
|
||||||
|
.try_init()
|
||||||
|
.wrap_err("failed to initialize logger")?;
|
||||||
|
warn!("failed to connect to journald")
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(feature = "systemd"))]
|
||||||
|
trace
|
||||||
|
.with(fmt::layer())
|
||||||
|
.with(env_filter)
|
||||||
|
.try_init()
|
||||||
|
.wrap_err("failed to initialize logger")?;
|
||||||
|
|
||||||
|
log_panics::init();
|
||||||
|
|
||||||
|
let (session_tx, mut session_rx) = tokio::sync::mpsc::channel(10);
|
||||||
|
let session_tx_clone = session_tx.clone();
|
||||||
|
let _conn = zbus::connection::Builder::session()?
|
||||||
|
.name("com.system76.CosmicSession")?
|
||||||
|
.serve_at(
|
||||||
|
"/com/system76/CosmicSession",
|
||||||
|
service::SessionService { session_tx },
|
||||||
|
)?
|
||||||
|
.build()
|
||||||
|
.await?;
|
||||||
|
|
||||||
|
loop {
|
||||||
|
match start(session_tx_clone.clone(), &mut session_rx).await {
|
||||||
|
Ok(Status::Exited) => {
|
||||||
|
info!("Exited cleanly");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
Ok(Status::Restarted) => {
|
||||||
|
info!("Restarting");
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
error!("Restarting after error: {:?}", error);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
// Drain the session channel.
|
||||||
|
while session_rx.try_recv().is_ok() {}
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub enum Status {
|
||||||
|
Restarted,
|
||||||
|
Exited,
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn start(
|
||||||
|
session_tx: Sender<SessionRequest>,
|
||||||
|
session_rx: &mut Receiver<SessionRequest>,
|
||||||
|
) -> Result<Status> {
|
||||||
|
info!("Starting cosmic-session");
|
||||||
|
|
||||||
|
let mut args = env::args().skip(1);
|
||||||
|
let (executable, args) = (
|
||||||
|
args.next().unwrap_or_else(|| String::from("cosmic-comp")),
|
||||||
|
args.collect::<Vec<_>>(),
|
||||||
|
);
|
||||||
|
|
||||||
|
let process_manager = ProcessManager::new().await;
|
||||||
|
_ = process_manager.set_max_restarts(usize::MAX).await;
|
||||||
|
_ = process_manager
|
||||||
|
.set_restart_mode(launch_pad::RestartMode::ExponentialBackoff(
|
||||||
|
Duration::from_millis(10),
|
||||||
|
))
|
||||||
|
.await;
|
||||||
|
let token = CancellationToken::new();
|
||||||
|
let (env_tx, env_rx) = oneshot::channel();
|
||||||
|
let compositor_handle = comp::run_compositor(
|
||||||
|
&process_manager,
|
||||||
|
executable.clone(),
|
||||||
|
args,
|
||||||
|
token.child_token(),
|
||||||
|
env_tx,
|
||||||
|
session_tx,
|
||||||
|
)
|
||||||
|
.wrap_err("failed to start compositor")?;
|
||||||
|
|
||||||
|
let mut env_vars = env_rx
|
||||||
|
.await
|
||||||
|
.expect("failed to receive environmental variables")
|
||||||
|
.into_iter()
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
info!(
|
||||||
|
"got environmental variables from cosmic-comp: {:?}",
|
||||||
|
env_vars
|
||||||
|
);
|
||||||
|
|
||||||
|
// now that cosmic-comp is ready, set XDG_SESSION_TYPE=wayland for new processes
|
||||||
|
env_vars.push(("XDG_SESSION_TYPE".to_string(), "wayland".to_string()));
|
||||||
|
systemd::set_systemd_environment("XDG_SESSION_TYPE", "wayland").await;
|
||||||
|
|
||||||
|
#[cfg(feature = "systemd")]
|
||||||
|
let _inhibit_fd = if *is_systemd_used() {
|
||||||
|
match get_systemd_env().await {
|
||||||
|
Ok(env) => {
|
||||||
|
for systemd_env in env {
|
||||||
|
// Only update the envvar if unset
|
||||||
|
if std::env::var_os(&systemd_env.key).is_none() {
|
||||||
|
// Blacklist of envvars that we shouldn't touch (taken from KDE)
|
||||||
|
if (!systemd_env.key.starts_with("XDG_")
|
||||||
|
|| systemd_env.key == "XDG_DATA_DIRS"
|
||||||
|
|| systemd_env.key == "XDG_CONFIG_DIRS")
|
||||||
|
&& systemd_env.key != "DISPLAY"
|
||||||
|
&& systemd_env.key != "XAUTHORITY"
|
||||||
|
&& systemd_env.key != "WAYLAND_DISPLAY"
|
||||||
|
&& systemd_env.key != "WAYLAND_SOCKET"
|
||||||
|
&& systemd_env.key != "_"
|
||||||
|
&& systemd_env.key != "SHELL"
|
||||||
|
&& systemd_env.key != "SHLVL"
|
||||||
|
{
|
||||||
|
env_vars.push((systemd_env.key, systemd_env.value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(err) => {
|
||||||
|
warn!("Failed to sync systemd environment {}.", err);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
#[cfg(feature = "logind")]
|
||||||
|
match zbus::Connection::system().await {
|
||||||
|
Ok(connection) => match logind_zbus::manager::ManagerProxy::new(&connection).await {
|
||||||
|
Ok(proxy) => match proxy
|
||||||
|
.inhibit(
|
||||||
|
logind_zbus::manager::InhibitType::HandlePowerKey,
|
||||||
|
"Cosmic Session",
|
||||||
|
"Show confirmation dialog.",
|
||||||
|
"block",
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
Ok(fd) => Some(fd),
|
||||||
|
Err(err) => {
|
||||||
|
error!("Failed to inhibit power key {err:?}");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(err) => {
|
||||||
|
error!("Failed to connect to logind manager {err:?}");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
},
|
||||||
|
Err(err) => {
|
||||||
|
error!("Failed to connect to system dbus {err:?}");
|
||||||
|
None
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#[cfg(not(feature = "logind"))]
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
};
|
||||||
|
|
||||||
|
let stdout_span = info_span!(parent: None, "cosmic-settings-daemon");
|
||||||
|
let stderr_span = stdout_span.clone();
|
||||||
|
let (settings_exit_tx, settings_exit_rx) = oneshot::channel();
|
||||||
|
let settings_exit_tx = Arc::new(std::sync::Mutex::new(Some(settings_exit_tx)));
|
||||||
|
let settings_daemon = process_manager
|
||||||
|
.start(
|
||||||
|
Process::new()
|
||||||
|
.with_executable("cosmic-settings-daemon")
|
||||||
|
.with_env(env_vars.iter().cloned())
|
||||||
|
.with_on_stdout(move |_, _, line| {
|
||||||
|
let stdout_span = stdout_span.clone();
|
||||||
|
async move {
|
||||||
|
info!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stdout_span)
|
||||||
|
})
|
||||||
|
.with_on_stderr(move |_, _, line| {
|
||||||
|
let stderr_span = stderr_span.clone();
|
||||||
|
async move {
|
||||||
|
warn!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stderr_span)
|
||||||
|
})
|
||||||
|
.with_on_exit(move |_, _, _, will_restart| {
|
||||||
|
if !will_restart && let Some(tx) = settings_exit_tx.lock().unwrap().take() {
|
||||||
|
_ = tx.send(());
|
||||||
|
}
|
||||||
|
async {}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.expect("failed to start settings daemon");
|
||||||
|
|
||||||
|
// notifying the user service manager that we've reached the
|
||||||
|
// graphical-session.target, which should only happen after:
|
||||||
|
// - cosmic-comp is ready
|
||||||
|
// - we've set any related variables
|
||||||
|
// - cosmic-settings-daemon is ready
|
||||||
|
systemd::start_systemd_target().await;
|
||||||
|
// Always stop the target when the process exits or panics.
|
||||||
|
scopeguard::defer! {
|
||||||
|
systemd::stop_systemd_target();
|
||||||
|
}
|
||||||
|
|
||||||
|
// start a11y if configured
|
||||||
|
tokio::spawn(a11y::start_a11y(env_vars.clone(), process_manager.clone()));
|
||||||
|
|
||||||
|
let (panel_notifications_fd, daemon_notifications_fd) =
|
||||||
|
notifications::create_socket().expect("Failed to create notification socket");
|
||||||
|
|
||||||
|
let mut daemon_env_vars = env_vars.clone();
|
||||||
|
daemon_env_vars.push((
|
||||||
|
DAEMON_NOTIFICATIONS_FD.to_string(),
|
||||||
|
daemon_notifications_fd.as_raw_fd().to_string(),
|
||||||
|
));
|
||||||
|
let mut panel_env_vars = env_vars.clone();
|
||||||
|
panel_env_vars.push((
|
||||||
|
PANEL_NOTIFICATIONS_FD.to_string(),
|
||||||
|
panel_notifications_fd.as_raw_fd().to_string(),
|
||||||
|
));
|
||||||
|
|
||||||
|
let panel_key = Arc::new(Mutex::new(None));
|
||||||
|
let notif_key = Arc::new(Mutex::new(None));
|
||||||
|
|
||||||
|
let notifications_span = info_span!(parent: None, "cosmic-notifications");
|
||||||
|
let panel_span = info_span!(parent: None, "cosmic-panel");
|
||||||
|
|
||||||
|
let mut guard = notif_key.lock().await;
|
||||||
|
*guard = Some(
|
||||||
|
process_manager
|
||||||
|
.start(notifications_process(
|
||||||
|
notifications_span.clone(),
|
||||||
|
"cosmic-notifications",
|
||||||
|
notif_key.clone(),
|
||||||
|
daemon_env_vars.clone(),
|
||||||
|
daemon_notifications_fd,
|
||||||
|
panel_span.clone(),
|
||||||
|
"cosmic-panel",
|
||||||
|
panel_key.clone(),
|
||||||
|
panel_env_vars.clone(),
|
||||||
|
))
|
||||||
|
.await
|
||||||
|
.expect("failed to start notifications daemon"),
|
||||||
|
);
|
||||||
|
drop(guard);
|
||||||
|
|
||||||
|
let mut guard = panel_key.lock().await;
|
||||||
|
*guard = Some(
|
||||||
|
process_manager
|
||||||
|
.start(notifications_process(
|
||||||
|
panel_span,
|
||||||
|
"cosmic-panel",
|
||||||
|
panel_key.clone(),
|
||||||
|
panel_env_vars,
|
||||||
|
panel_notifications_fd,
|
||||||
|
notifications_span,
|
||||||
|
"cosmic-notifications",
|
||||||
|
notif_key,
|
||||||
|
daemon_env_vars,
|
||||||
|
))
|
||||||
|
.await
|
||||||
|
.expect("failed to start panel"),
|
||||||
|
);
|
||||||
|
drop(guard);
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-app-library");
|
||||||
|
start_component("cosmic-app-library", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-launcher");
|
||||||
|
start_component("cosmic-launcher", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-workspaces");
|
||||||
|
start_component("cosmic-workspaces", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-osd");
|
||||||
|
start_component("cosmic-osd", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-bg");
|
||||||
|
start_component("cosmic-bg", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-greeter");
|
||||||
|
start_component("cosmic-greeter", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-files-applet");
|
||||||
|
start_component("cosmic-files-applet", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
let span = info_span!(parent: None, "cosmic-idle");
|
||||||
|
start_component("cosmic-idle", span, &process_manager, &env_vars).await;
|
||||||
|
|
||||||
|
#[cfg(feature = "autostart")]
|
||||||
|
if !*is_systemd_used() {
|
||||||
|
info!("looking for autostart folders");
|
||||||
|
let mut directories_to_scan = Vec::new();
|
||||||
|
|
||||||
|
// we start by taking user specific directories, so that we can deduplicate and
|
||||||
|
// ensure user overrides are respected
|
||||||
|
|
||||||
|
// user specific directories
|
||||||
|
if let Some(user_config_dir) = dirs::config_dir() {
|
||||||
|
directories_to_scan.push(user_config_dir.join(AUTOSTART_DIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
// system-wide directories
|
||||||
|
if let Some(xdg_config_dirs) = env::var_os("XDG_CONFIG_DIRS") {
|
||||||
|
let xdg_config_dirs = xdg_config_dirs
|
||||||
|
.into_string()
|
||||||
|
.expect("Invalid XDG_CONFIG_DIRS");
|
||||||
|
let dir_list = xdg_config_dirs.split(":");
|
||||||
|
|
||||||
|
for dir in dir_list {
|
||||||
|
directories_to_scan.push(PathBuf::from(dir).join(AUTOSTART_DIR));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
directories_to_scan.push(PathBuf::from("/etc/xdg/").join(AUTOSTART_DIR));
|
||||||
|
}
|
||||||
|
|
||||||
|
info!("found autostart folders: {:?}", directories_to_scan);
|
||||||
|
|
||||||
|
let mut dedupe = HashSet::new();
|
||||||
|
|
||||||
|
let iter = freedesktop_desktop_entry::Iter::new(directories_to_scan.into_iter());
|
||||||
|
let autostart_env = env_vars.clone();
|
||||||
|
for entry in iter.entries::<&str>(None) {
|
||||||
|
// we've already tried to execute this!
|
||||||
|
if dedupe.contains(&entry.appid) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// skip if we have an OnlyShowIn entry that doesn't include COSMIC
|
||||||
|
if let Some(only_show_in) = entry.only_show_in() {
|
||||||
|
if !only_show_in.contains(&ENVIRONMENT_NAME) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... OR we have a NotShowIn entry that includes COSMIC
|
||||||
|
if let Some(not_show_in) = entry.not_show_in() {
|
||||||
|
if not_show_in.contains(&ENVIRONMENT_NAME) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
info!(
|
||||||
|
"trying to start appid {} ({})",
|
||||||
|
entry.appid,
|
||||||
|
entry.path.display()
|
||||||
|
);
|
||||||
|
|
||||||
|
if let Some(exec_raw) = entry.exec() {
|
||||||
|
let mut exec_words = exec_raw.split(" ");
|
||||||
|
|
||||||
|
if let Some(program_name) = exec_words.next() {
|
||||||
|
// filter out any placeholder args, since we might not be able to deal with them
|
||||||
|
let filtered_args = exec_words
|
||||||
|
.filter(|s| !s.starts_with("%"))
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
// escape them
|
||||||
|
let escaped_args = shell_words::split(&*filtered_args.join(" "));
|
||||||
|
if let Ok(args) = escaped_args {
|
||||||
|
info!("trying to start {} {}", program_name, args.join(" "));
|
||||||
|
|
||||||
|
let mut command = Command::new(program_name);
|
||||||
|
command.args(args);
|
||||||
|
|
||||||
|
// add relevant envs
|
||||||
|
for (k, v) in &autostart_env {
|
||||||
|
command.env(k, v);
|
||||||
|
}
|
||||||
|
|
||||||
|
// detach stdin/out/err (should we?)
|
||||||
|
let child = command
|
||||||
|
.stdin(Stdio::null())
|
||||||
|
.stdout(Stdio::null())
|
||||||
|
.stderr(Stdio::null())
|
||||||
|
.spawn();
|
||||||
|
|
||||||
|
if let Ok(child) = child {
|
||||||
|
info!(
|
||||||
|
"successfully started program {} {}",
|
||||||
|
entry.appid,
|
||||||
|
child.id()
|
||||||
|
);
|
||||||
|
dedupe.insert(entry.appid);
|
||||||
|
} else {
|
||||||
|
info!("could not start program {}", entry.appid);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let why = escaped_args.unwrap_err();
|
||||||
|
error!(?why, "could not parse arguments");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info!("started {} programs", dedupe.len());
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut sigterm = signal(SignalKind::terminate()).expect("Failed to bind SIGTERM handler");
|
||||||
|
let mut sigint = signal(SignalKind::interrupt()).expect("Failed to bind SIGINT handler");
|
||||||
|
let mut status = Status::Exited;
|
||||||
|
let session_dbus_rx_next = session_rx.recv();
|
||||||
|
tokio::select! {
|
||||||
|
res = session_dbus_rx_next => {
|
||||||
|
match res {
|
||||||
|
Some(service::SessionRequest::Exit) => {
|
||||||
|
info!("EXITING: session exited by request");
|
||||||
|
}
|
||||||
|
Some(service::SessionRequest::Restart) => {
|
||||||
|
info!("RESTARTING: session restarted by request");
|
||||||
|
status = Status::Restarted;
|
||||||
|
}
|
||||||
|
None => {
|
||||||
|
warn!("exit channel dropped session");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
_ = sigterm.recv() => {
|
||||||
|
info!("EXITING: received SIGTERM request to terminate");
|
||||||
|
},
|
||||||
|
_ = sigint.recv() => {
|
||||||
|
info!("EXITING: received SIGINT request to terminate");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compositor_handle.abort();
|
||||||
|
token.cancel();
|
||||||
|
if let Err(err) = process_manager.stop_process(settings_daemon).await {
|
||||||
|
tracing::error!(?err, "Failed to gracefully stop settings daemon.");
|
||||||
|
} else {
|
||||||
|
match tokio::time::timeout(Duration::from_secs(1), settings_exit_rx).await {
|
||||||
|
Ok(Ok(_)) => {}
|
||||||
|
_ => {
|
||||||
|
tracing::error!("Settings daemon process did not respond to the request to stop.");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
|
||||||
|
Ok(status)
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn start_component(
|
||||||
|
cmd: impl Into<Cow<'static, str>>,
|
||||||
|
span: tracing::Span,
|
||||||
|
process_manager: &ProcessManager,
|
||||||
|
env_vars: &[(String, String)],
|
||||||
|
) {
|
||||||
|
let stdout_span = span.clone();
|
||||||
|
let stderr_span = span.clone();
|
||||||
|
let stderr_span_clone = stderr_span.clone();
|
||||||
|
let cmd = cmd.into();
|
||||||
|
let cmd_clone = cmd.clone();
|
||||||
|
|
||||||
|
if let Err(err) = process_manager
|
||||||
|
.start(
|
||||||
|
Process::new()
|
||||||
|
.with_executable(cmd.clone())
|
||||||
|
.with_env(env_vars.iter().cloned())
|
||||||
|
.with_on_stdout(move |_, _, line| {
|
||||||
|
let stdout_span = stdout_span.clone();
|
||||||
|
async move {
|
||||||
|
info!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stdout_span)
|
||||||
|
})
|
||||||
|
.with_on_stderr(move |_, _, line| {
|
||||||
|
let stderr_span = stderr_span.clone();
|
||||||
|
async move {
|
||||||
|
warn!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stderr_span)
|
||||||
|
})
|
||||||
|
.with_on_start(move |pman, pkey, _will_restart| async move {
|
||||||
|
#[cfg(feature = "systemd")]
|
||||||
|
if *is_systemd_used()
|
||||||
|
&& let Ok((innr_cmd, Some(pid))) = pman.get_exe_and_pid(pkey).await
|
||||||
|
&& let Err(err) = spawn_scope(innr_cmd.clone(), vec![pid]).await
|
||||||
|
{
|
||||||
|
warn!(
|
||||||
|
"Failed to spawn scope for {}. Creating transient unit failed with {}",
|
||||||
|
innr_cmd, err
|
||||||
|
);
|
||||||
|
};
|
||||||
|
})
|
||||||
|
.with_on_exit(move |mut _pman, _key, err_code, _will_restart| {
|
||||||
|
if let Some(err) = err_code {
|
||||||
|
error!("{cmd_clone} exited with error {}", err.to_string());
|
||||||
|
}
|
||||||
|
async {}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
let _enter = stderr_span_clone.enter();
|
||||||
|
error!("failed to start {}: {}", cmd, err);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,126 @@
|
|||||||
|
use color_eyre::Result;
|
||||||
|
use color_eyre::eyre::Context;
|
||||||
|
use launch_pad::ProcessKey;
|
||||||
|
use launch_pad::process::Process;
|
||||||
|
use rustix::fd::AsRawFd;
|
||||||
|
use std::os::fd::OwnedFd;
|
||||||
|
use std::os::unix::net::UnixStream;
|
||||||
|
use std::sync::Arc;
|
||||||
|
use tokio::sync::Mutex;
|
||||||
|
use tracing::Instrument;
|
||||||
|
|
||||||
|
pub const PANEL_NOTIFICATIONS_FD: &str = "PANEL_NOTIFICATIONS_FD";
|
||||||
|
pub const DAEMON_NOTIFICATIONS_FD: &str = "DAEMON_NOTIFICATIONS_FD";
|
||||||
|
|
||||||
|
pub fn create_socket() -> Result<(OwnedFd, OwnedFd)> {
|
||||||
|
// Create a new pair of unnamed Unix sockets
|
||||||
|
let (sock_1, sock_2) = UnixStream::pair().wrap_err("failed to create socket pair")?;
|
||||||
|
|
||||||
|
// Turn the sockets into non-blocking fd, which we can pass to the child
|
||||||
|
// process
|
||||||
|
sock_1
|
||||||
|
.set_nonblocking(true)
|
||||||
|
.wrap_err("failed to mark client socket as non-blocking")?;
|
||||||
|
|
||||||
|
sock_2
|
||||||
|
.set_nonblocking(true)
|
||||||
|
.wrap_err("failed to mark client socket as non-blocking")?;
|
||||||
|
|
||||||
|
Ok((OwnedFd::from(sock_1), OwnedFd::from(sock_2)))
|
||||||
|
}
|
||||||
|
|
||||||
|
#[allow(clippy::too_many_arguments)]
|
||||||
|
pub fn notifications_process(
|
||||||
|
span: tracing::Span,
|
||||||
|
cmd: &'static str,
|
||||||
|
key: Arc<Mutex<Option<ProcessKey>>>,
|
||||||
|
mut env_vars: Vec<(String, String)>,
|
||||||
|
fd: OwnedFd,
|
||||||
|
restart_span: tracing::Span,
|
||||||
|
restart_cmd: &'static str,
|
||||||
|
restart_key: Arc<Mutex<Option<ProcessKey>>>,
|
||||||
|
restart_env_vars: Vec<(String, String)>,
|
||||||
|
) -> Process {
|
||||||
|
env_vars.retain(|v| &v.0 != "WAYLAND_SOCKET");
|
||||||
|
|
||||||
|
let stdout_span = span.clone();
|
||||||
|
let stderr_span = span.clone();
|
||||||
|
let env_clone = env_vars.clone();
|
||||||
|
Process::new()
|
||||||
|
.with_executable(cmd)
|
||||||
|
.with_fds(move || vec![fd])
|
||||||
|
.with_on_stdout(move |_, _, line| {
|
||||||
|
let stdout_span = stdout_span.clone();
|
||||||
|
async move {
|
||||||
|
info!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stdout_span)
|
||||||
|
})
|
||||||
|
.with_on_stderr(move |_, _, line| {
|
||||||
|
let stderr_span = stderr_span.clone();
|
||||||
|
async move {
|
||||||
|
warn!("{}", line);
|
||||||
|
}
|
||||||
|
.instrument(stderr_span)
|
||||||
|
})
|
||||||
|
.with_on_exit(move |pman, my_key, _, will_restart| {
|
||||||
|
// force restart of notifications / panel when the other exits
|
||||||
|
// also update the environment variables to use the new socket
|
||||||
|
let (my_fd, their_fd) = create_socket().expect("Failed to create notification socket");
|
||||||
|
let mut my_env_vars = env_clone.clone();
|
||||||
|
if let Some((_k, v)) = my_env_vars
|
||||||
|
.iter_mut()
|
||||||
|
.find(|(k, _v)| k == PANEL_NOTIFICATIONS_FD || k == DAEMON_NOTIFICATIONS_FD)
|
||||||
|
{
|
||||||
|
*v = my_fd.as_raw_fd().to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
let mut their_env_vars = restart_env_vars.clone();
|
||||||
|
if let Some((_k, v)) = their_env_vars
|
||||||
|
.iter_mut()
|
||||||
|
.find(|(k, _v)| k == PANEL_NOTIFICATIONS_FD || k == DAEMON_NOTIFICATIONS_FD)
|
||||||
|
{
|
||||||
|
*v = their_fd.as_raw_fd().to_string();
|
||||||
|
}
|
||||||
|
|
||||||
|
let new_process = notifications_process(
|
||||||
|
restart_span.clone(),
|
||||||
|
restart_cmd,
|
||||||
|
restart_key.clone(),
|
||||||
|
their_env_vars.clone(),
|
||||||
|
their_fd,
|
||||||
|
span.clone(),
|
||||||
|
cmd,
|
||||||
|
key.clone(),
|
||||||
|
my_env_vars.clone(),
|
||||||
|
);
|
||||||
|
let restart_key = restart_key.clone();
|
||||||
|
|
||||||
|
let mut pman_clone = pman.clone();
|
||||||
|
async move {
|
||||||
|
if will_restart {
|
||||||
|
if let Err(why) = pman_clone.update_process_env(&my_key, my_env_vars).await {
|
||||||
|
error!(?why, "Failed to update environment variables");
|
||||||
|
}
|
||||||
|
if let Err(why) = pman_clone
|
||||||
|
.update_process_fds(&my_key, move || vec![my_fd])
|
||||||
|
.await
|
||||||
|
{
|
||||||
|
error!(?why, "Failed to update fds");
|
||||||
|
}
|
||||||
|
|
||||||
|
let Some(old) = *restart_key.lock().await else {
|
||||||
|
error!("Couldn't stop previous invocation of {}", cmd);
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
_ = pman.stop_process(old).await;
|
||||||
|
|
||||||
|
if let Ok(new) = pman.start(new_process).await {
|
||||||
|
let mut guard = restart_key.lock().await;
|
||||||
|
*guard = Some(new);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.with_env(env_vars)
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
use color_eyre::eyre::{Result, WrapErr};
|
||||||
|
use rustix::io::FdFlags;
|
||||||
|
use std::os::unix::prelude::*;
|
||||||
|
|
||||||
|
pub(crate) fn mark_as_not_cloexec(file: &impl AsFd) -> Result<()> {
|
||||||
|
let flags = rustix::io::fcntl_getfd(file).wrap_err("failed to get GETFD value of stream")?;
|
||||||
|
rustix::io::fcntl_setfd(file, flags.difference(FdFlags::CLOEXEC))
|
||||||
|
.wrap_err("failed to unset CLOEXEC on file")
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
use tokio::sync::mpsc;
|
||||||
|
use zbus::interface;
|
||||||
|
|
||||||
|
pub enum SessionRequest {
|
||||||
|
Exit,
|
||||||
|
Restart,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct SessionService {
|
||||||
|
pub session_tx: mpsc::Sender<SessionRequest>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[interface(name = "com.system76.CosmicSession")]
|
||||||
|
impl SessionService {
|
||||||
|
async fn exit(&mut self) {
|
||||||
|
warn!("exiting session");
|
||||||
|
_ = self.session_tx.send(SessionRequest::Exit).await;
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn restart(&self) {
|
||||||
|
warn!("restarting session");
|
||||||
|
_ = self.session_tx.send(SessionRequest::Restart).await;
|
||||||
|
}
|
||||||
|
}
|
||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
// SPDX-License-Identifier: GPL-3.0-only
|
||||||
|
|
||||||
|
use std::path::Path;
|
||||||
|
use std::process::{Command, Stdio};
|
||||||
|
use std::sync::OnceLock;
|
||||||
|
|
||||||
|
use zbus::Connection;
|
||||||
|
use zbus::zvariant::{Array, OwnedValue};
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
|
pub struct EnvVar {
|
||||||
|
pub key: String,
|
||||||
|
pub value: String,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<(&str, &str)> for EnvVar {
|
||||||
|
fn from(val: (&str, &str)) -> Self {
|
||||||
|
EnvVar {
|
||||||
|
key: val.0.to_owned(),
|
||||||
|
value: val.1.to_owned(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "systemd")]
|
||||||
|
use zbus_systemd::systemd1::ManagerProxy as SystemdManagerProxy;
|
||||||
|
|
||||||
|
pub async fn set_systemd_environment(key: &str, value: &str) {
|
||||||
|
run_optional_command(
|
||||||
|
"systemctl",
|
||||||
|
&["--user", "set-environment", &format!("{key}={value}")],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn start_systemd_target() {
|
||||||
|
run_optional_command(
|
||||||
|
"systemctl",
|
||||||
|
&["--user", "start", "--no-block", "cosmic-session.target"],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn stop_systemd_target() {
|
||||||
|
run_optional_command(
|
||||||
|
"systemctl",
|
||||||
|
&["--user", "stop", "--no-block", "cosmic-session.target"],
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Determine if systemd is used as the init system. This should work on all
|
||||||
|
/// linux distributions.
|
||||||
|
pub fn is_systemd_used() -> &'static bool {
|
||||||
|
static IS_SYSTEMD_USED: OnceLock<bool> = OnceLock::new();
|
||||||
|
IS_SYSTEMD_USED.get_or_init(|| Path::new("/run/systemd/system").exists())
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "systemd")]
|
||||||
|
pub async fn get_systemd_env() -> Result<Vec<EnvVar>, zbus::Error> {
|
||||||
|
let connection = Connection::session().await?;
|
||||||
|
let systemd_manager = SystemdManagerProxy::new(&connection).await?;
|
||||||
|
let systemd_env = systemd_manager.environment().await?;
|
||||||
|
|
||||||
|
let mut out: Vec<EnvVar> = Vec::new();
|
||||||
|
for i in systemd_env {
|
||||||
|
if let Some(b) = i.split_once("=") {
|
||||||
|
out.push(b.into());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Ok(out)
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "systemd")]
|
||||||
|
/// Spawn a systemd scope unit with the given name and PIDs.
|
||||||
|
pub async fn spawn_scope(mut command: String, pids: Vec<u32>) -> Result<(), zbus::Error> {
|
||||||
|
let connection = Connection::session().await?;
|
||||||
|
let systemd_manager = SystemdManagerProxy::new(&connection).await?;
|
||||||
|
let pids = OwnedValue::try_from(Array::from(pids)).unwrap();
|
||||||
|
let properties: Vec<(String, OwnedValue)> = vec![(String::from("PIDs"), pids)];
|
||||||
|
if command.starts_with('/') {
|
||||||
|
// use the last component of the path as the unit name
|
||||||
|
command = command.rsplit('/').next().unwrap().to_string();
|
||||||
|
}
|
||||||
|
let scope_name = format!("{}.scope", command);
|
||||||
|
systemd_manager
|
||||||
|
.start_transient_unit(
|
||||||
|
scope_name.to_string(),
|
||||||
|
String::from("replace"),
|
||||||
|
properties,
|
||||||
|
Vec::new(),
|
||||||
|
)
|
||||||
|
.await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
/// run a command, but log errors instead of returning them or panicking
|
||||||
|
fn run_optional_command(cmd: &str, args: &[&str]) {
|
||||||
|
match Command::new(cmd).args(args).stdin(Stdio::null()).status() {
|
||||||
|
Ok(status) => {
|
||||||
|
if !status.success() {
|
||||||
|
match status.code() {
|
||||||
|
Some(code) => warn!("{} {}: exit code {}", cmd, args.join(" "), code),
|
||||||
|
None => warn!("{} {}: terminated by signal", cmd, args.join(" ")),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Err(error) => {
|
||||||
|
warn!("unable to start {} {}: {}", cmd, args.join(" "), error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user