generated from cosmic-utils/cosmic-app-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 3f6802e
Showing
20 changed files
with
1,224 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Generated by Cargo | ||
# will have compiled files and executables | ||
debug/ | ||
target/ | ||
|
||
# Remove Cargo.lock from gitignore if creating an executable, leave it for libraries | ||
# More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html | ||
Cargo.lock | ||
|
||
# These are backup files generated by rustfmt | ||
**/*.rs.bk | ||
|
||
# MSVC Windows builds of rustc generate these, which store debugging information | ||
*.pdb |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
[package] | ||
name = "cosmic-app-template" | ||
version = "0.1.0" | ||
edition = "2021" | ||
license = "GPL-3.0" | ||
|
||
[dependencies] | ||
i18n-embed-fl = "0.8" | ||
once_cell = "1.19.0" | ||
open = "5.1.3" | ||
rust-embed = "8.3.0" | ||
tokio = { version = "1.37.0", features = ["full"] } | ||
|
||
[dependencies.libcosmic] | ||
git = "https://github.com/pop-os/libcosmic.git" | ||
default-features = false | ||
features = ["dbus-config", "tokio", "winit", "wgpu"] | ||
|
||
[dependencies.i18n-embed] | ||
version = "0.14" | ||
features = ["fluent-system", "desktop-requester"] | ||
|
||
# Uncomment to test a locally-cloned libcosmic | ||
# [patch.'https://github.com/pop-os/libcosmic'] | ||
# libcosmic = { path = "../libcosmic" } | ||
# cosmic-config = { path = "../libcosmic/cosmic-config" } | ||
# cosmic-theme = { path = "../libcosmic/cosmic-theme" } |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# COSMIC Application Template | ||
|
||
A template for COSMIC applications. | ||
|
||
## Getting Started | ||
|
||
To get started, click the "Use this template" button above. This will create a new repository in your account with the contents of this template. | ||
|
||
Once you have created a new repository from this template, you can clone it to your local machine and start developing your COSMIC application. | ||
|
||
## Development | ||
|
||
When you open the repository in your code editor, you will see a lot of comments in the code. These comments are there to help you get a basic understanding of what each part of the code does. | ||
|
||
Once you feel comfortable with it, refer back to the [COSMIC documentation](https://pop-os.github.io/libcosmic/cosmic/) for more information on how to build COSMIC applications. | ||
|
||
## Install | ||
|
||
To install your COSMIC application, you will need [just](https://github.com/casey/just), if you're on Pop!\_OS, you can install it with the following command: | ||
|
||
```sh | ||
sudo apt install just | ||
``` | ||
|
||
After you install it, you can run the following commands to build and install your application: | ||
|
||
```sh | ||
just build-release | ||
sudo just install | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
fallback_language = "en" | ||
|
||
[fluent] | ||
assets_dir = "i18n" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
app-title = COSMIC App Template | ||
about = About | ||
view = View | ||
welcome = Welcome to COSMIC! ✨ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
name := 'cosmic-app-template' | ||
export APPID := 'com.example.CosmicAppTemplate' | ||
|
||
rootdir := '' | ||
prefix := '/usr' | ||
flatpak-prefix := '/app' | ||
|
||
base-dir := absolute_path(clean(rootdir / prefix)) | ||
flatpak-base-dir := absolute_path(clean(rootdir / flatpak-prefix)) | ||
|
||
export INSTALL_DIR := base-dir / 'share' | ||
|
||
bin-src := 'target' / 'release' / name | ||
bin-dst := base-dir / 'bin' / name | ||
flatpak-bin-dst := flatpak-base-dir / 'bin' / name | ||
|
||
desktop := APPID + '.desktop' | ||
desktop-src := 'res' / desktop | ||
desktop-dst := clean(rootdir / prefix) / 'share' / 'applications' / desktop | ||
|
||
metainfo := APPID + '.metainfo.xml' | ||
metainfo-src := 'res' / metainfo | ||
metainfo-dst := clean(rootdir / prefix) / 'share' / 'metainfo' / metainfo | ||
|
||
icons-src := 'res' / 'icons' / 'hicolor' | ||
icons-dst := clean(rootdir / prefix) / 'share' / 'icons' / 'hicolor' | ||
|
||
# Default recipe which runs `just build-release` | ||
default: build-release | ||
|
||
# Runs `cargo clean` | ||
clean: | ||
cargo clean | ||
|
||
# Removes vendored dependencies | ||
clean-vendor: | ||
rm -rf .cargo vendor vendor.tar | ||
|
||
# `cargo clean` and removes vendored dependencies | ||
clean-dist: clean clean-vendor | ||
|
||
# Compiles with debug profile | ||
build-debug *args: | ||
cargo build {{args}} | ||
|
||
# Compiles with release profile | ||
build-release *args: (build-debug '--release' args) | ||
|
||
# Compiles release profile with vendored dependencies | ||
build-vendored *args: vendor-extract (build-release '--frozen --offline' args) | ||
|
||
# Runs a clippy check | ||
check *args: | ||
cargo clippy --all-features {{args}} -- -W clippy::pedantic | ||
|
||
# Runs a clippy check with JSON message format | ||
check-json: (check '--message-format=json') | ||
|
||
dev *args: | ||
cargo fmt | ||
just run {{args}} | ||
|
||
# Run with debug logs | ||
run *args: | ||
env RUST_LOG=cosmic_tasks=info RUST_BACKTRACE=full cargo run --release {{args}} | ||
|
||
# Installs files | ||
install: | ||
install -Dm0755 {{bin-src}} {{bin-dst}} | ||
install -Dm0644 {{desktop-src}} {{desktop-dst}} | ||
install -Dm0644 {{metainfo-src}} {{metainfo-dst}} | ||
for size in `ls {{icons-src}}`; do \ | ||
install -Dm0644 "{{icons-src}}/$size/apps/{{APPID}}.svg" "{{icons-dst}}/$size/apps/{{APPID}}.svg"; \ | ||
done | ||
|
||
# Installs files | ||
flatpak: | ||
install -Dm0755 {{bin-src}} {{flatpak-bin-dst}} | ||
install -Dm0644 {{desktop-src}} {{desktop-dst}} | ||
install -Dm0644 {{metainfo-src}} {{metainfo-dst}} | ||
for size in `ls {{icons-src}}`; do \ | ||
install -Dm0644 "{{icons-src}}/$size/apps/{{APPID}}.svg" "{{icons-dst}}/$size/apps/{{APPID}}.svg"; \ | ||
done | ||
|
||
# Uninstalls installed files | ||
uninstall: | ||
rm {{bin-dst}} | ||
|
||
# Vendor dependencies locally | ||
vendor: | ||
#!/usr/bin/env bash | ||
mkdir -p .cargo | ||
cargo vendor --sync Cargo.toml | head -n -1 > .cargo/config.toml | ||
echo 'directory = "vendor"' >> .cargo/config.toml | ||
echo >> .cargo/config.toml | ||
echo '[env]' >> .cargo/config.toml | ||
if [ -n "${SOURCE_DATE_EPOCH}" ] | ||
then | ||
source_date="$(date -d "@${SOURCE_DATE_EPOCH}" "+%Y-%m-%d")" | ||
echo "VERGEN_GIT_COMMIT_DATE = \"${source_date}\"" >> .cargo/config.toml | ||
fi | ||
if [ -n "${SOURCE_GIT_HASH}" ] | ||
then | ||
echo "VERGEN_GIT_SHA = \"${SOURCE_GIT_HASH}\"" >> .cargo/config.toml | ||
fi | ||
tar pcf vendor.tar .cargo vendor | ||
rm -rf .cargo vendor | ||
# Extracts vendored dependencies | ||
vendor-extract: | ||
rm -rf vendor | ||
tar pxf vendor.tar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Desktop Entry] | ||
Name=COSMIC App Template | ||
Exec=cosmic-app-template %F | ||
Terminal=false | ||
Type=Application | ||
StartupNotify=true | ||
Icon=com.example.CosmicAppTemplate | ||
Categories=COSMIC;Utility; | ||
Keywords=Folder;Manager; | ||
MimeType=inode/directory; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<component type="desktop-application"> | ||
<id>com.example.CosmicAppTemplate</id> | ||
<metadata_license>CC0-1.0</metadata_license> | ||
<project_license>GPL-3.0-only</project_license> | ||
<project_group>COSMIC</project_group> | ||
<developer_name>YourName</developer_name> | ||
<update_contact>[email protected]</update_contact> | ||
<url type="homepage"></url> | ||
<url type="bugtracker"></url> | ||
<name>COSMIC App Template</name> | ||
<summary>A template for COSMIC applications</summary> | ||
<description> | ||
<p>A template for COSMIC applications</p> | ||
</description> | ||
<launchable type="desktop-id">com.example.CosmicAppTemplate.desktop</launchable> | ||
<icon type="remote" height="256" width="256">https://raw.githubusercontent.com/edfloreshz/cosmic-app-template/master/res/icons/hicolor/256x256/apps/com.example.CosmicAppTemplate.svg</icon> | ||
<screenshots> | ||
</screenshots> | ||
<provides> | ||
<mimetypes> | ||
<mimetype>text/plain</mimetype> | ||
</mimetypes> | ||
<binaries> | ||
<binary>cosmic-app-template</binary> | ||
</binaries> | ||
</provides> | ||
</component> |
2 changes: 2 additions & 0 deletions
2
res/icons/hicolor/128x128/apps/com.example.CosmicAppTemplate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
res/icons/hicolor/16x16/apps/com.example.CosmicAppTemplate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
res/icons/hicolor/24x24/apps/com.example.CosmicAppTemplate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
res/icons/hicolor/256x256/apps/com.example.CosmicAppTemplate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
res/icons/hicolor/32x32/apps/com.example.CosmicAppTemplate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
res/icons/hicolor/48x48/apps/com.example.CosmicAppTemplate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions
2
res/icons/hicolor/64x64/apps/com.example.CosmicAppTemplate.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.