cosmic-settings/cosmic-settings/build.rs
2026-02-24 15:38:38 -07:00

223 lines
6.8 KiB
Rust

use std::{env, fs, path::PathBuf};
use xdgen::{App, Context, FluentString};
fn main() {
let ctx = Context::new("../i18n", env::var("CARGO_PKG_NAME").unwrap()).unwrap();
[
(
"com.system76.CosmicSettings",
"app",
"xdg-entry-comment",
"xdg-entry-keywords",
),
(
"com.system76.CosmicSettings.About",
"xdg-entry-about",
"xdg-entry-about-comment",
"xdg-entry-about-keywords",
),
(
"com.system76.CosmicSettings.Accessibility",
"xdg-entry-ally",
"xdg-entry-a11y-comment",
"xdg-entry-a11y-keywords",
),
(
"com.system76.CosmicSettings.Appearance",
"appearance",
"xdg-entry-appearance-comment",
"xdg-entry-appearance-keywords",
),
(
"com.system76.CosmicSettings.Applications",
"xdg-entry-applications",
"xdg-entry-applications-comment",
"xdg-entry-applications-keywords",
),
(
"com.system76.CosmicSettings.Bluetooth",
"bluetooth",
"xdg-entry-bluetooth-comment",
"xdg-entry-bluetooth-keywords",
),
(
"com.system76.CosmicSettings.DateTime",
"xdg-entry-date-time",
"xdg-entry-date-time-comment",
"xdg-entry-date-time-keywords",
),
(
"com.system76.CosmicSettings.DefaultApps",
"xdg-entry-default-apps",
"xdg-entry-default-apps-comment",
"xdg-entry-default-apps-keywords",
),
(
"com.system76.CosmicSettings.Desktop",
"xdg-entry-desktop",
"xdg-entry-desktop-comment",
"xdg-entry-desktop-keywords",
),
(
"com.system76.CosmicSettings.Displays",
"xdg-entry-displays",
"xdg-entry-displays-comment",
"xdg-entry-displays-keywords",
),
(
"com.system76.CosmicSettings.Dock",
"xdg-entry-dock",
"xdg-entry-dock-comment",
"xdg-entry-dock-keywords",
),
(
"com.system76.CosmicSettings.Input",
"xdg-entry-input",
"xdg-entry-input-comment",
"xdg-entry-input-keywords",
),
(
"com.system76.CosmicSettings.Keyboard",
"xdg-entry-keyboard",
"xdg-entry-keyboard-comment",
"xdg-entry-keyboard-keywords",
),
(
"com.system76.CosmicSettings.Mouse",
"xdg-entry-mouse",
"xdg-entry-mouse-comment",
"xdg-entry-mouse-keywords",
),
(
"com.system76.CosmicSettings.Network",
"xdg-entry-network",
"xdg-entry-network-comment",
"xdg-entry-network-keywords",
),
(
"com.system76.CosmicSettings.Notifications",
"xdg-entry-notifications",
"xdg-entry-notifications-comment",
"xdg-entry-notifications-keywords",
),
(
"com.system76.CosmicSettings.Panel",
"xdg-entry-panel",
"xdg-entry-panel-comment",
"xdg-entry-panel-keywords",
),
(
"com.system76.CosmicSettings.Power",
"xdg-entry-power",
"xdg-entry-power-comment",
"xdg-entry-power-keywords",
),
(
"com.system76.CosmicSettings.RegionLanguage",
"xdg-entry-region-language",
"xdg-entry-region-language-comment",
"xdg-entry-region-language-keywords",
),
(
"com.system76.CosmicSettings.Sound",
"xdg-entry-sound",
"xdg-entry-sound-comment",
"xdg-entry-sound-keywords",
),
(
"com.system76.CosmicSettings.StartupApps",
"xdg-entry-startup-apps",
"xdg-entry-startup-apps-comment",
"xdg-entry-startup-apps-keywords",
),
(
"com.system76.CosmicSettings.System",
"xdg-entry-system",
"xdg-entry-system-comment",
"xdg-entry-system-keywords",
),
(
"com.system76.CosmicSettings.Time",
"xdg-entry-time-language",
"xdg-entry-time-language-comment",
"xdg-entry-time-language-keywords",
),
(
"com.system76.CosmicSettings.Touchpad",
"xdg-entry-touchpad",
"xdg-entry-touchpad-comment",
"xdg-entry-touchpad-keywords",
),
(
"com.system76.CosmicSettings.Users",
"xdg-entry-users",
"xdg-entry-users-comment",
"xdg-entry-users-keywords",
),
(
"com.system76.CosmicSettings.Vpn",
"vpn",
"xdg-entry-vpn-comment",
"xdg-entry-vpn-keywords",
),
(
"com.system76.CosmicSettings.Wallpaper",
"xdg-entry-wallpaper",
"xdg-entry-wallpaper-comment",
"xdg-entry-wallpaper-keywords",
),
(
"com.system76.CosmicSettings.WindowManagement",
"xdg-entry-window-management",
"xdg-entry-window-management-comment",
"xdg-entry-window-management-keywords",
),
(
"com.system76.CosmicSettings.Wired",
"xdg-entry-wired",
"xdg-entry-wired-comment",
"xdg-entry-wired-keywords",
),
(
"com.system76.CosmicSettings.Wireless",
"xdg-entry-wireless",
"xdg-entry-wireless-comment",
"xdg-entry-wireless-keywords",
),
(
"com.system76.CosmicSettings.Workspaces",
"xdg-entry-workspaces",
"xdg-entry-workspaces-comment",
"xdg-entry-workspaces-keywords",
),
(
"com.system76.CosmicSettings.LegacyApplications",
"xdg-entry-x11-applications",
"xdg-entry-x11-applications-comment",
"xdg-entry-x11-applications-keywords",
),
]
.into_iter()
.map(|(id, name, comment, keywords)| {
let app = App::new(FluentString(name))
.comment(FluentString(comment))
.keywords(FluentString(keywords));
let output = PathBuf::from("../target/xdgen");
(id, app, output)
})
.for_each(|(id, app, output)| {
fs::create_dir_all(&output).unwrap();
fs::write(
output.join(format!("{}.desktop", id)),
app.expand_desktop(
dbg!(format!("../resources/applications/{}.desktop", id)),
&ctx,
)
.unwrap(),
)
.unwrap();
});
}