Skip to content

Commit

Permalink
fix: Bundle Icons For macOS (#50)
Browse files Browse the repository at this point in the history
* macOS platform does not use XDG icons (or cosmic-icons), as a
  workaround for the time being, we will ship icons as part of the
  application bundle.
* Update cargo dependencies.
* Updated README.
  • Loading branch information
vkhitrin authored Dec 30, 2024
1 parent d71e696 commit b7f7d4f
Show file tree
Hide file tree
Showing 26 changed files with 335 additions and 100 deletions.
132 changes: 77 additions & 55 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ Dependencies (Linux)
- `libxkbcommon-dev`
- `libcosmic`
- `libsqlite3-dev`
- `cosmic-icons`

Dependencies (macOS)

Expand Down
3 changes: 2 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ build-release-macos *args:
lipo "target/aarch64-apple-darwin/release/{{name}}" -create -output "{{app-binary}}"

mkdir -p "{{app-binary-dir}}"
mkdir -p "{{app-extras-dir}}"
mkdir -p "{{app-extras-dir}}/icons/"
cp -fRp "{{app-template}}" "{{app-dir}}"
cp -fp "{{app-binary}}" "{{app-binary-dir}}"
cp ./res/icons/* "{{app-extras-dir}}/icons/"
touch -r "{{app-binary}}" "{{app-dir}}/{{app-name}}"
echo "Created '{{app-name}}' in '{{app-dir}}'"
git stash -- {{app-template-plist}}
Expand Down
12 changes: 12 additions & 0 deletions res/icons/accessories-clock-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions res/icons/contact-new-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/icons/dialog-information-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/icons/dialog-warning-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions res/icons/emblem-shared-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/icons/emblem-synchronizing-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 12 additions & 0 deletions res/icons/insert-text-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions res/icons/mail-archive-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions res/icons/mail-mark-important-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions res/icons/network-server-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions res/icons/system-lock-screen-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/icons/text-x-generic-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/icons/user-available-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions res/icons/web-browser-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/icons/x-office-document-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/icons/x-office-spreadsheet-symbolic.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 3 additions & 2 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use crate::pages::accounts::{add_account, edit_account, AppAccountsMessage, Page
use crate::pages::bookmarks::{
edit_bookmark, new_bookmark, view_notes, AppBookmarksMessage, PageBookmarksView,
};
use crate::utils::icons::load_icon;
use cosmic::app::{Core, Task};
use cosmic::cosmic_config::{self, CosmicConfigEntry, Update};
use cosmic::cosmic_theme::{self, ThemeMode};
Expand Down Expand Up @@ -255,7 +256,7 @@ impl Application for Cosmicding {
let dialog = match dialog_page {
DialogPage::RemoveAccount(account) => {
widget::dialog(fl!("remove") + " " + { &account.display_name })
.icon(icon::from_name("dialog-warning-symbolic").size(58).icon())
.icon(icon::icon(load_icon("dialog-warning-symbolic")).size(58))
.body(fl!("remove-account-confirm"))
.primary_action(
widget::button::destructive(fl!("yes")).on_press_maybe(Some(
Expand All @@ -268,7 +269,7 @@ impl Application for Cosmicding {
}
DialogPage::RemoveBookmark(account, bookmark) => {
widget::dialog(fl!("remove") + " " + { &bookmark.title })
.icon(icon::from_name("dialog-warning-symbolic").size(58).icon())
.icon(icon::icon(load_icon("dialog-warning-symbolic")).size(58))
.body(fl!("remove-bookmark-confirm"))
.primary_action(widget::button::destructive(fl!("yes")).on_press_maybe(Some(
Message::CompleteRemoveDialog(account.clone(), Some(bookmark.clone())),
Expand Down
1 change: 1 addition & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ mod models;
mod nav;
mod pages;
mod style;
mod utils;

use crate::config::{Config, CONFIG_VERSION};
use app::{Flags, APPID};
Expand Down
5 changes: 3 additions & 2 deletions src/nav.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use crate::utils::icons::load_icon;
use cosmic::{widget::icon, Element};

use crate::{app, fl};
Expand All @@ -24,8 +25,8 @@ impl AppNavPage {
}
pub fn icon(self) -> cosmic::widget::Icon {
match self {
Self::BookmarksView => icon::from_name("web-browser-symbolic").icon(),
Self::AccountsView => icon::from_name("contact-new-symbolic").icon(),
Self::BookmarksView => icon::icon(load_icon("web-browser-symbolic")),
Self::AccountsView => icon::icon(load_icon("contact-new-symbolic")),
}
}

Expand Down
Loading

0 comments on commit b7f7d4f

Please sign in to comment.