diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index e6ca28bc..63abe526 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,8 +1,10 @@ -- [ ] 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. +Replace this text with a description of your changes, and why these changes are important. Read and acknowledge the list below. PRs without a completed checkbox will be closed. +--- + +- I have not included any LLM (also known as AI) generated content in this PR, including code, comments, and descriptions. +- 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. +- [ ] I have read and followed all of the above requirements. For more information, see our [contributor guide](https://github.com/pop-os/pop/blob/master/CONTRIBUTING.md). diff --git a/.github/workflows/require-checklist.yml b/.github/workflows/require-checklist.yml new file mode 100644 index 00000000..fd4ca8c6 --- /dev/null +++ b/.github/workflows/require-checklist.yml @@ -0,0 +1,14 @@ +# From https://github.com/mheap/require-checklist-action, license MIT +name: Require Checklist + +on: + pull_request: + types: [opened, edited, synchronize] + +jobs: + job1: + runs-on: ubuntu-latest + steps: + - uses: mheap/require-checklist-action@v2 + with: + requireChecklist: true diff --git a/i18n/zh-Hant/libcosmic_yoda.ftl b/i18n/zh-Hant/libcosmic_yoda.ftl index 8c9b201c..ac99245e 100644 --- a/i18n/zh-Hant/libcosmic_yoda.ftl +++ b/i18n/zh-Hant/libcosmic_yoda.ftl @@ -12,13 +12,13 @@ thursday = 星期四 friday = 星期五 saturday = 星期六 sunday = 星期日 -mon = 週一 -tue = 週二 -wed = 週三 -thu = 週四 -fri = 週五 -sat = 週六 -sun = 週日 +mon = 星期一 +tue = 星期二 +wed = 星期三 +thu = 星期四 +fri = 星期五 +sat = 星期六 +sun = 星期日 license = 授權 links = 連結 february = { $year } 年 2 月 diff --git a/iced b/iced index 24da1dc0..f8ac890b 160000 --- a/iced +++ b/iced @@ -1 +1 @@ -Subproject commit 24da1dc0e4e5c1b7f803bf8584d10939fe5acdec +Subproject commit f8ac890b9c0d52842a6434f4674e603ed7e67687 diff --git a/src/desktop.rs b/src/desktop.rs index 7d2e90c5..93f908ae 100644 --- a/src/desktop.rs +++ b/src/desktop.rs @@ -1,6 +1,8 @@ #[cfg(not(windows))] pub use freedesktop_desktop_entry as fde; #[cfg(not(windows))] +pub mod gpu; +#[cfg(not(windows))] pub use mime::Mime; use std::path::{Path, PathBuf}; #[cfg(not(windows))] diff --git a/src/desktop/gpu.rs b/src/desktop/gpu.rs new file mode 100644 index 00000000..e6a911fb --- /dev/null +++ b/src/desktop/gpu.rs @@ -0,0 +1,56 @@ +// Copyright 2026 System76 +// SPDX-License-Identifier: MPL-2.0 + +use std::collections::HashMap; + +/// An available GPU that can be selected by a launcher. +#[derive(Debug, Clone)] +pub struct Descriptor { + pub name: String, + pub environment: HashMap, + pub default: bool, + pub discrete: bool, +} + +/// A preference to use when choosing a GPU to launch with. +#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)] +pub enum Preference { + #[default] + Default, + NonDefault, +} + +impl Preference { + /// Find the preferred default GPU for this preference. + pub fn preferred(self, gpus: &[Descriptor]) -> Option { + let default_idx = gpus.iter().position(|gpu| gpu.default); + if matches!(self, Preference::Default) { + return default_idx; + } + + let default_discrete = gpus.iter().position(|gpu| gpu.default && gpu.discrete); + if default_discrete.is_some() { + return default_discrete; + } + + let non_default_discrete = gpus.iter().position(|gpu| gpu.discrete); + let non_default = || gpus.iter().position(|gpu| !gpu.default); + non_default_discrete.or_else(non_default).or(default_idx) + } + + /// Select the GPU override to launch with. + pub fn select(self, gpus: &[Descriptor]) -> Option { + if matches!(self, Preference::Default) { + return None; + } + + let default_discrete = gpus.iter().position(|gpu| gpu.default && gpu.discrete); + if default_discrete.is_some() { + return None; + } + + let non_default_discrete = gpus.iter().position(|gpu| gpu.discrete); + let non_default = || gpus.iter().position(|gpu| !gpu.default); + non_default_discrete.or_else(non_default) + } +} diff --git a/src/theme/style/button.rs b/src/theme/style/button.rs index f361512d..b46b22d7 100644 --- a/src/theme/style/button.rs +++ b/src/theme/style/button.rs @@ -38,6 +38,10 @@ pub enum Button { Transparent, } +fn menu_item_background(component: &Component, background: Color) -> Option { + (background != Color::from(component.base)).then_some(Background::Color(background)) +} + pub fn appearance( theme: &crate::Theme, focused: bool, @@ -149,7 +153,7 @@ pub fn appearance( // Menu folders cannot be disabled, ignore customized icon and text color let component = &cosmic.background(theme.transparent).component; let (background, _, _) = color(component); - appearance.background = Some(Background::Color(background)); + appearance.background = menu_item_background(component, background); appearance.icon_color = Some(component.on.into()); appearance.text_color = Some(component.on.into()); corner_radii = &cosmic.corner_radii.radius_s; @@ -171,8 +175,9 @@ pub fn appearance( } } Button::MenuItem => { - let (background, text, icon) = color(&cosmic.background(theme.transparent).component); - appearance.background = Some(Background::Color(background)); + let component = &cosmic.background(theme.transparent).component; + let (background, text, icon) = color(component); + appearance.background = menu_item_background(component, background); appearance.icon_color = icon; appearance.text_color = text; corner_radii = &cosmic.corner_radii.radius_s;