feat: add desktop entries for each settings page
This commit is contained in:
parent
a40b1e9a1a
commit
1c61885428
65 changed files with 294 additions and 37 deletions
|
|
@ -1,6 +1,6 @@
|
|||
[workspace]
|
||||
members = ["app", "page", "pages/*"]
|
||||
default-members = ["app"]
|
||||
members = ["cosmic-settings", "page", "pages/*"]
|
||||
default-members = ["cosmic-settings"]
|
||||
resolver = "2"
|
||||
rust-version = "1.71.0"
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ use crate::pages::desktop::{
|
|||
},
|
||||
};
|
||||
use crate::pages::input::{self, keyboard};
|
||||
use crate::pages::{self, display, sound, system, time};
|
||||
use crate::pages::{self, display, networking, sound, system, time};
|
||||
use crate::subscription::desktop_files;
|
||||
use crate::widget::{page_title, search_header};
|
||||
use crate::PageCommands;
|
||||
|
|
@ -53,13 +53,25 @@ pub struct SettingsApp {
|
|||
impl SettingsApp {
|
||||
fn subcommand_to_page(&self, cmd: &PageCommands) -> Option<Entity> {
|
||||
match cmd {
|
||||
// PageCommands::Bluetooth => self.pages.page_id::<system::bluetooth::Page>(),
|
||||
// PageCommands::Network => self.pages.page_id::<system::network::Page>(),
|
||||
// PageCommands::Notifications => self.pages.page_id::<notifications::Page>(),
|
||||
// PageCommands::Power => self.pages.page_id::<system::power::Page>(),
|
||||
PageCommands::About => self.pages.page_id::<system::about::Page>(),
|
||||
PageCommands::Appearance => self.pages.page_id::<desktop::appearance::Page>(),
|
||||
PageCommands::Bluetooth => None,
|
||||
PageCommands::DateTime => self.pages.page_id::<time::date::Page>(),
|
||||
PageCommands::DesktopPanel => self.pages.page_id::<desktop::options::Page>(),
|
||||
PageCommands::Displays => self.pages.page_id::<display::Page>(),
|
||||
PageCommands::Firmware => self.pages.page_id::<system::firmware::Page>(),
|
||||
PageCommands::Keyboard => self.pages.page_id::<input::keyboard::Page>(),
|
||||
PageCommands::Mouse => self.pages.page_id::<input::mouse::Page>(),
|
||||
PageCommands::Network => None,
|
||||
PageCommands::Notifications => self.pages.page_id::<desktop::notifications::Page>(),
|
||||
PageCommands::Power => None,
|
||||
PageCommands::RegionLanguage => self.pages.page_id::<time::region::Page>(),
|
||||
PageCommands::Sound => self.pages.page_id::<sound::Page>(),
|
||||
PageCommands::Time => self.pages.page_id::<time::Page>(),
|
||||
_ => None,
|
||||
PageCommands::Touchpad => self.pages.page_id::<input::touchpad::Page>(),
|
||||
PageCommands::Users => self.pages.page_id::<system::users::Page>(),
|
||||
PageCommands::Wallpaper => self.pages.page_id::<desktop::wallpaper::Page>(),
|
||||
PageCommands::Workspaces => self.pages.page_id::<desktop::workspaces::Page>(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -37,18 +37,44 @@ pub struct Args {
|
|||
|
||||
#[derive(Subcommand, Debug, Serialize, Deserialize, Clone)]
|
||||
pub enum PageCommands {
|
||||
/// Open the settings bluetooth page
|
||||
/// About settings page
|
||||
About,
|
||||
/// Appearance settings page
|
||||
Appearance,
|
||||
/// Bluetooth settings page
|
||||
Bluetooth,
|
||||
/// Open the settings network page
|
||||
/// DateTime settings page
|
||||
DateTime,
|
||||
/// Desktop and panel settings page
|
||||
DesktopPanel,
|
||||
/// Displays settings page
|
||||
Displays,
|
||||
/// Firmware settings page
|
||||
Firmware,
|
||||
/// Keyboard settings page
|
||||
Keyboard,
|
||||
/// Mouse settings page
|
||||
Mouse,
|
||||
/// Network settings page
|
||||
Network,
|
||||
/// Open the settings notifications page
|
||||
/// Notifications settings page
|
||||
Notifications,
|
||||
/// Open the settings power page
|
||||
/// Power settings page
|
||||
Power,
|
||||
/// Open the settings sound page
|
||||
/// Region & Language settings page
|
||||
RegionLanguage,
|
||||
/// Sound settings page
|
||||
Sound,
|
||||
/// Open the settings time page
|
||||
/// Time settings page
|
||||
Time,
|
||||
/// Touchpad settings page
|
||||
Touchpad,
|
||||
/// Users settings page
|
||||
Users,
|
||||
/// Wallpaper settings page
|
||||
Wallpaper,
|
||||
/// Workspaces settings page
|
||||
Workspaces,
|
||||
}
|
||||
|
||||
impl FromStr for PageCommands {
|
||||
|
|
@ -480,17 +480,7 @@ impl Page {
|
|||
let _ = self.tk.write_entry(config);
|
||||
}
|
||||
|
||||
tokio::spawn(async move {
|
||||
let _res = tokio::process::Command::new("gsettings")
|
||||
.args(&[
|
||||
"set",
|
||||
"org.gnome.desktop.interface",
|
||||
"icon-theme",
|
||||
theme.as_str(),
|
||||
])
|
||||
.status()
|
||||
.await;
|
||||
});
|
||||
tokio::spawn(set_gnome_icon_theme(theme));
|
||||
}
|
||||
|
||||
Command::none()
|
||||
|
|
@ -1500,6 +1490,7 @@ pub fn color_button<'a, Message: 'a + Clone>(
|
|||
.into()
|
||||
}
|
||||
|
||||
/// Find all icon themes available on the system.
|
||||
async fn fetch_icon_themes() -> Message {
|
||||
let mut icon_themes = BTreeSet::new();
|
||||
|
||||
|
|
@ -1576,3 +1567,16 @@ async fn fetch_icon_themes() -> Message {
|
|||
|
||||
Message::Entered(icon_themes.into_iter().collect())
|
||||
}
|
||||
|
||||
/// Set the preferred icon theme for GNOME/GTK applications.
|
||||
async fn set_gnome_icon_theme(theme: String) {
|
||||
let _res = tokio::process::Command::new("gsettings")
|
||||
.args(&[
|
||||
"set",
|
||||
"org.gnome.desktop.interface",
|
||||
"icon-theme",
|
||||
theme.as_str(),
|
||||
])
|
||||
.status()
|
||||
.await;
|
||||
}
|
||||
|
|
@ -17,8 +17,8 @@ use itertools::Itertools;
|
|||
use tracing::error;
|
||||
|
||||
pub mod keyboard;
|
||||
mod mouse;
|
||||
mod touchpad;
|
||||
pub mod mouse;
|
||||
pub mod touchpad;
|
||||
|
||||
crate::cache_dynamic_lazy! {
|
||||
static ACCELERATION_DESC: String = fl!("acceleration-desc");
|
||||
62
justfile
62
justfile
|
|
@ -8,33 +8,83 @@ appid := 'com.system76.CosmicSettings'
|
|||
rootdir := ''
|
||||
prefix := '/usr'
|
||||
|
||||
appdir := clean(rootdir / prefix) / 'share' / 'applications'
|
||||
default-schema-target := clean(rootdir / prefix) / 'share' / 'cosmic'
|
||||
|
||||
bin-src := cargo-target-dir / 'release' / name
|
||||
bin-dest := clean(rootdir / prefix) / 'bin' / name
|
||||
|
||||
desktop := appid + '.desktop'
|
||||
desktop-src := 'resources' / desktop
|
||||
desktop-dest := clean(rootdir / prefix) / 'share' / 'applications' / desktop
|
||||
|
||||
iconsdir := clean(rootdir / prefix) / 'share' / 'icons' / 'hicolor'
|
||||
|
||||
metainfo := appid + '.metainfo.xml'
|
||||
metainfo-src := 'resources' / metainfo
|
||||
metainfo-dst := clean(rootdir / prefix) / 'share' / 'metainfo' / metainfo
|
||||
|
||||
# Desktop entries
|
||||
entry-settings := appid + '.desktop'
|
||||
entry-about := appid + '.About.desktop'
|
||||
entry-appear := appid + '.Appearance.desktop'
|
||||
entry-date-time := appid + '.DateTime.desktop'
|
||||
entry-desktop := appid + '.Desktop.desktop'
|
||||
entry-displays := appid + '.Displays.desktop'
|
||||
entry-firmware := appid + '.Firmware.desktop'
|
||||
entry-keyboard := appid + '.Keyboard.desktop'
|
||||
entry-mouse := appid + '.Mouse.desktop'
|
||||
entry-notifications := appid + '.Notifications.desktop'
|
||||
entry-region-language := appid + '.RegionLanguage.desktop'
|
||||
entry-sound := appid + '.Sound.desktop'
|
||||
entry-touchpad := appid + '.Touchpad.desktop'
|
||||
entry-users := appid + '.Users.desktop'
|
||||
entry-wallpaper := appid + '.Wallpaper.desktop'
|
||||
entry-workspaces := appid + '.Workspaces.desktop'
|
||||
|
||||
# Build recipes
|
||||
[private]
|
||||
default: build-release
|
||||
|
||||
[private]
|
||||
install-desktop-entries:
|
||||
install -Dm0644 'resources/{{entry-settings}}' '{{appdir}}/{{entry-settings}}'
|
||||
install -Dm0644 'resources/{{entry-about}}' '{{appdir}}/{{entry-about}}'
|
||||
install -Dm0644 'resources/{{entry-appear}}' '{{appdir}}/{{entry-appear}}'
|
||||
install -Dm0644 'resources/{{entry-date-time}}' '{{appdir}}/{{entry-date-time}}'
|
||||
install -Dm0644 'resources/{{entry-desktop}}' '{{appdir}}/{{entry-desktop}}'
|
||||
install -Dm0644 'resources/{{entry-displays}}' '{{appdir}}/{{entry-displays}}'
|
||||
install -Dm0644 'resources/{{entry-firmware}}' '{{appdir}}/{{entry-firmware}}'
|
||||
install -Dm0644 'resources/{{entry-keyboard}}' '{{appdir}}/{{entry-keyboard}}'
|
||||
install -Dm0644 'resources/{{entry-mouse}}' '{{appdir}}/{{entry-mouse}}'
|
||||
install -Dm0644 'resources/{{entry-notifications}}' '{{appdir}}/{{entry-notifications}}'
|
||||
install -Dm0644 'resources/{{entry-region-language}}' '{{appdir}}/{{entry-region-language}}'
|
||||
install -Dm0644 'resources/{{entry-sound}}' '{{appdir}}/{{entry-sound}}'
|
||||
install -Dm0644 'resources/{{entry-touchpad}}' '{{appdir}}/{{entry-touchpad}}'
|
||||
install -Dm0644 'resources/{{entry-users}}' '{{appdir}}/{{entry-users}}'
|
||||
install -Dm0644 'resources/{{entry-wallpaper}}' '{{appdir}}/{{entry-wallpaper}}'
|
||||
install -Dm0644 'resources/{{entry-workspaces}}' '{{appdir}}/{{entry-workspaces}}'
|
||||
|
||||
# Install everything
|
||||
install: (install-bin bin-src bin-dest) (install-file desktop-src desktop-dest) (install-file metainfo-src metainfo-dst)
|
||||
install: install-desktop-entries (install-bin bin-src bin-dest) (install-file metainfo-src metainfo-dst)
|
||||
find 'resources'/'default_schema' -type f -exec echo {} \; | rev | cut -d'/' -f-3 | rev | xargs -d '\n' -I {} install -Dm0644 'resources'/'default_schema'/{} {{default-schema-target}}/{}
|
||||
find 'resources'/'icons' -type f -exec echo {} \; | rev | cut -d'/' -f-3 | rev | xargs -d '\n' -I {} install -Dm0644 'resources'/'icons'/{} {{iconsdir}}/{}
|
||||
|
||||
# Uninstalls everything (requires same arguments as given to install)
|
||||
uninstall:
|
||||
rm -rf {{bin-dest}} {{desktop-dest}}
|
||||
rm -rf {{bin-dest}} \
|
||||
'{{appdir}}/{{entry-settings}}' \
|
||||
'{{appdir}}/{{entry-about}}' \
|
||||
'{{appdir}}/{{entry-appear}}' \
|
||||
'{{appdir}}/{{entry-date-time}}' \
|
||||
'{{appdir}}/{{entry-desktop}}' \
|
||||
'{{appdir}}/{{entry-displays}}' \
|
||||
'{{appdir}}/{{entry-firmware}}' \
|
||||
'{{appdir}}/{{entry-keyboard}}' \
|
||||
'{{appdir}}/{{entry-mouse}}' \
|
||||
'{{appdir}}/{{entry-notifications}}' \
|
||||
'{{appdir}}/{{entry-region-language}}' \
|
||||
'{{appdir}}/{{entry-sound}}' \
|
||||
'{{appdir}}/{{entry-touchpad}}' \
|
||||
'{{appdir}}/{{entry-users}}' \
|
||||
'{{appdir}}/{{entry-wallpaper}}' \
|
||||
'{{appdir}}/{{entry-workspaces}}'
|
||||
find 'resources'/'default_schema' -type f -exec echo {} \; | rev | cut -d'/' -f-3 | rev | xargs -d '\n' -I {} rm -rf {{default-schema-target}}/{}
|
||||
find 'resources'/'icons' -type f -exec echo {} \; | rev | cut -d'/' -f-3 | rev | xargs -d '\n' -I {} rm {{iconsdir}}/{}
|
||||
|
||||
|
|
|
|||
11
resources/com.system76.CosmicSettings.About.desktop
Normal file
11
resources/com.system76.CosmicSettings.About.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=About
|
||||
Comment=Device name, hardware information, operating system defaults.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings about
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Appearance.desktop
Normal file
11
resources/com.system76.CosmicSettings.Appearance.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Appearance
|
||||
Comment=Accent colors and COSMIC theming.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings appearance
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.DateTime.desktop
Normal file
11
resources/com.system76.CosmicSettings.DateTime.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Date & Time
|
||||
Comment=Time zone, automatic clock settings, and time formatting.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings date-time
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Desktop.desktop
Normal file
11
resources/com.system76.CosmicSettings.Desktop.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Desktop and Panel
|
||||
Comment=Super key action, hot corners, and window control options
|
||||
Type=Settings
|
||||
Exec=cosmic-settings desktop-panel
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Displays.desktop
Normal file
11
resources/com.system76.CosmicSettings.Displays.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Displays
|
||||
Comment=Display options, graphics modes, and night light.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings displays
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Firmware.desktop
Normal file
11
resources/com.system76.CosmicSettings.Firmware.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Firmware
|
||||
Comment=View and update firmware.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings firmware
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Keyboard.desktop
Normal file
11
resources/com.system76.CosmicSettings.Keyboard.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Keyboard
|
||||
Comment=Keyboard input settings.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings keyboard
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Mouse.desktop
Normal file
11
resources/com.system76.CosmicSettings.Mouse.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Mouse
|
||||
Comment=Mouse speed, acceleation, and natural scrolling.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings mouse
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Notifications.desktop
Normal file
11
resources/com.system76.CosmicSettings.Notifications.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Notifications
|
||||
Comment=Do Not Disturb, lockscreen notifications, and per-application settings.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings notifications
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.RegionLanguage.desktop
Normal file
11
resources/com.system76.CosmicSettings.RegionLanguage.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Region & Language
|
||||
Comment=Format dates, times, and numbers based on your region.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings region-language
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Sound.desktop
Normal file
11
resources/com.system76.CosmicSettings.Sound.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Sound
|
||||
Comment=Audio settings for devices, alerts, and applications.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings sound
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Touchpad.desktop
Normal file
11
resources/com.system76.CosmicSettings.Touchpad.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Touchpad
|
||||
Comment=Touchpad speed, click options, gestures.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings touchpad
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Users.desktop
Normal file
11
resources/com.system76.CosmicSettings.Users.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Users
|
||||
Comment=Authentication and login, lock screen.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings users
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Wallpaper.desktop
Normal file
11
resources/com.system76.CosmicSettings.Wallpaper.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Wallpaper
|
||||
Comment=Wallpaper images, colors, and slideshow options.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings wallpaper
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
11
resources/com.system76.CosmicSettings.Workspaces.desktop
Normal file
11
resources/com.system76.CosmicSettings.Workspaces.desktop
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
[Desktop Entry]
|
||||
Name=Workspaces
|
||||
Comment=Set workspace number, behavior, and placement.
|
||||
Type=Settings
|
||||
Exec=cosmic-settings workspaces
|
||||
Terminal=false
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
|
|
@ -1,10 +1,10 @@
|
|||
[Desktop Entry]
|
||||
Name=COSMIC Settings
|
||||
Type=Application
|
||||
Type=Settings
|
||||
Exec=cosmic-settings
|
||||
Terminal=false
|
||||
Categories=GNOME;GTK;
|
||||
Keywords=Gnome;GTK;
|
||||
OnlyShowIn=GNOME;Unity;COSMIC
|
||||
Categories=COSMIC
|
||||
Keywords=COSMIC
|
||||
OnlyShowIn=COSMIC
|
||||
Icon=com.system76.CosmicSettings
|
||||
StartupNotify=true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue