-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Settings > System & Accounts > Default Applications #444
Comments
I would appreciate a section for setting default applications by protocol and file extension. Instead of showing all of the available extensions and protocols to configure, I would like to start off with a blank or minimal list which the user can add to if desired through search or by scrolling a list in a dropdown. By minimal list, I mean commonly used extensions and protocols such as .PNG, .JPEG, and HTTPS://. That could make those settings less overwhelming compared to a long list of extensions and protocols that the user doesn't recognize. |
@Nyxiad I'm working on implementing this, I agree that there should be a way to edit all all registered mime types (i.e. everything in I think it should look exactly like the design above for the very common associations people would want to change, these should be very accessible, and their naming and order is important - having it empty by default will make for a very bad experience for people not familiar with computers, and slower in general because you first have to process that there is a dropdown, then look for the common types mixed with all the uncommon types (they can be first in the list but it's still more options). Then below it (potentially under an "advanced" nested page), there should be a filterable by search list with all associations (this is more for the technical reason that on a typical system you'll already have dozens of associations even if you didn't add them in the settings, check your |
To illustrate what I mean, here's most of the ui: Also is there currently a way in libcosmic to display views in the placeholder and dropdown list? Also for the actual implementation, using the xdg-mime crate is fine right? Also I'm not sure I entirely understand the separation between |
I was wondering, how the default terminal is implemented ? |
|
I think a document reader should be added to the list, as it's used frequently and since one is already in the works. The proposed approach to select default applications per mime type is a nice suggestion as well. Though I'd argue a document reader is such a common application, that it warrants a spot on the list. |
Would there be an option to add extension to a type such as ( |
@bbb651 Do you have a branch that you'd like to submit? We are ready to work on this now. |
I haven't make progress on this since only the UI is implemented (I'm posting it like this instead of making a commit because got a bit mixed with the launcher ctrl-shift-tab feature I was working on and I haven't rebased the plumbing code, it wasn't interesting anyways): default_apps.rs// Copyright 2024 bbb651 <bar.ye651@gmail.com>
// SPDX-License-Identifier: GPL-3.0-only
use cosmic::{
iced::{color, Alignment, Length},
iced_widget::row,
widget::{self, combo_box, dropdown, settings, text},
Apply, Command, Element,
};
use cosmic_settings_page::{self as page, section, Section};
use slotmap::SlotMap;
#[derive(Clone, Debug)]
pub enum Message {
None,
}
#[derive(Clone, Debug, Default)]
pub struct Page {}
impl page::AutoBind<crate::pages::Message> for Page {}
impl page::Page<crate::pages::Message> for Page {
fn content(
&self,
sections: &mut SlotMap<section::Entity, Section<crate::pages::Message>>,
) -> Option<cosmic_settings_page::Content> {
Some(vec![sections.insert(apps()), sections.insert(other())])
}
fn info(&self) -> page::Info {
page::Info::new("default-apps", "application-default-symbolic")
.title(fl!("default-apps"))
.description(fl!("default-apps", "desc"))
}
}
impl Page {
pub fn update(&mut self, message: Message) -> Command<crate::Message> {
match message {
Message::None => (),
}
Command::none()
}
}
fn apps() -> Section<crate::pages::Message> {
Section::default().view::<Page>(move |_binder, _page, section| {
settings::view_section(§ion.title)
.add(settings::flex_item(
fl!("default-apps", "web-browser"),
dropdown(&["Firefox", "Brave"], Some(0), |_| Message::None),
))
.add(settings::flex_item(
fl!("default-apps", "file-manager"),
dropdown(&["COSMIC Files", "Brave"], Some(0), |_| Message::None),
))
.add(settings::flex_item(
fl!("default-apps", "mail-client"),
dropdown(&["Thunderbird", "Brave"], Some(0), |_| Message::None),
))
.add(settings::flex_item(
fl!("default-apps", "music"),
dropdown(&["Videos", "Brave"], Some(0), |_| Message::None),
))
.add(settings::flex_item(
fl!("default-apps", "video"),
dropdown(&["Videos", "Brave"], Some(0), |_| Message::None),
))
.add(settings::flex_item(
fl!("default-apps", "photos"),
dropdown(&["Image viewer", "Brave"], Some(0), |_| Message::None),
))
.add(settings::flex_item(
fl!("default-apps", "calendar"),
dropdown(&["Thunderbird", "Brave"], Some(0), |_| Message::None),
))
.add(settings::flex_item(
fl!("default-apps", "terminal"),
dropdown(&["COSMIC Terminal", "Brave"], Some(0), |_| Message::None),
))
.apply(Element::from)
.map(crate::pages::Message::DefaultApps)
})
}
fn other() -> Section<crate::pages::Message> {
Section::default()
.title(fl!("default-apps", "other-associations"))
.view::<Page>(move |_binder, _page, section| {
let search = widget::search_input(fl!("type-to-search"), "")
.center_x(314)
.on_clear(Message::None)
.on_input(|_| Message::None)
.apply(widget::container)
.width(Length::Fill);
settings::view_section(§ion.title)
.add(settings::item_row(vec![search.into()]))
.add(settings::flex_item_row(
vec![
row![
text("PDF document"),
text("application/pdf")
.size(12.0)
.style(cosmic::style::Text::Color(color!(0xaaaaaa))),
]
.spacing(10.0)
.align_items(Alignment::Center)
.into(),
dropdown(&["Firefox", "Brave"], Some(0), |_| Message::None).into(),
]
.into(),
))
.add(settings::flex_item_row(
vec![
row![
text("RDP"),
text("x-scheme-handler/rdp")
.size(12.0)
.style(cosmic::style::Text::Color(color!(0xaaaaaa))),
]
.spacing(10.0)
.align_items(Alignment::Center)
.into(),
dropdown(&["Remmina", "Brave"], Some(0), |_| Message::None).into(),
]
.into(),
))
.apply(Element::from)
.map(crate::pages::Message::DefaultApps)
})
}
// TODO: Add actual settings to cosmic-settings-deamon, read from it to populate options and write back to it, add rest of options cosmic_settings.ftldiff --git a/i18n/en/cosmic_settings.ftl b/i18n/en/cosmic_settings.ftl
index 575ed7e..52d7ef6 100644
--- a/i18n/en/cosmic_settings.ftl
+++ b/i18n/en/cosmic_settings.ftl
@@ -751,3 +752,17 @@ firmware = Firmware
users = Users
.desc = Authentication and user accounts.
+
+## System: Default Applications
+
+default-apps = Default Applications
+ .desc = Default applications and file associations.
+ .web-browser = Web browser
+ .file-manager = File manager
+ .mail-client = Mail client
+ .music = Music
+ .video = Video
+ .photos = Photos
+ .calendar = Calendar
+ .terminal = Terminal
+ .other-associations = Other Associations Feel free to use it as a base |
Implemented in 508b051 |
Default applications panel allows people to set preferences for default web browser, file browser, music applications and others.
Figma file.
The text was updated successfully, but these errors were encountered: