diff --git a/desktop/assets/graphite-icon-color.png b/desktop/assets/graphite-icon-color.png new file mode 100644 index 000000000..f4e2047ca Binary files /dev/null and b/desktop/assets/graphite-icon-color.png differ diff --git a/desktop/assets/graphite-icon-color.svg b/desktop/assets/graphite-icon-color.svg new file mode 100644 index 000000000..00166c61d --- /dev/null +++ b/desktop/assets/graphite-icon-color.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/desktop/assets/rs.graphite.GraphiteEditor.desktop b/desktop/assets/rs.graphite.GraphiteEditor.desktop new file mode 100644 index 000000000..50ee7686a --- /dev/null +++ b/desktop/assets/rs.graphite.GraphiteEditor.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Name=Graphite +GenericName=Vector & Raster Graphics Editor +Comment=Open-source vector & raster graphics editor. Featuring node based procedural nondestructive editing workflow. +Exec=graphite-editor +Terminal=false +Type=Application +Icon=graphite-icon-color +Categories=Graphics;VectorGraphics;RasterGraphics; +Keywords=graphite;editor;vector;raster;procedural;design; +StartupWMClass=rs.graphite.GraphiteEditor diff --git a/desktop/src/app.rs b/desktop/src/app.rs index 9dc16085e..0f0f65c65 100644 --- a/desktop/src/app.rs +++ b/desktop/src/app.rs @@ -1,5 +1,6 @@ use crate::CustomEvent; use crate::WindowSize; +use crate::consts::APP_NAME; use crate::dialogs::dialog_open_graphite_file; use crate::dialogs::dialog_save_graphite_file; use crate::render::GraphicsState; @@ -142,15 +143,24 @@ impl ApplicationHandler for WinitApp { } fn resumed(&mut self, event_loop: &ActiveEventLoop) { - let window = Arc::new( - event_loop - .create_window( - Window::default_attributes() - .with_title("CEF Offscreen Rendering") - .with_inner_size(winit::dpi::LogicalSize::new(1200, 800)), - ) - .unwrap(), - ); + let mut window = Window::default_attributes() + .with_title(APP_NAME) + .with_min_inner_size(winit::dpi::LogicalSize::new(400, 300)) + .with_inner_size(winit::dpi::LogicalSize::new(1200, 800)); + + #[cfg(target_family = "unix")] + { + use crate::consts::APP_ID; + use winit::platform::wayland::ActiveEventLoopExtWayland; + + window = if event_loop.is_wayland() { + winit::platform::wayland::WindowAttributesExtWayland::with_name(window, APP_ID, "") + } else { + winit::platform::x11::WindowAttributesExtX11::with_name(window, APP_ID, APP_NAME) + } + } + + let window = Arc::new(event_loop.create_window(window).unwrap()); let graphics_state = GraphicsState::new(window.clone(), self.wgpu_context.clone()); self.window = Some(window); diff --git a/desktop/src/consts.rs b/desktop/src/consts.rs new file mode 100644 index 000000000..49543588f --- /dev/null +++ b/desktop/src/consts.rs @@ -0,0 +1,3 @@ +pub(crate) static APP_NAME: &str = "Graphite"; +pub(crate) static APP_ID: &str = "rs.graphite.GraphiteEditor"; +pub(crate) static APP_DIRECTORY_NAME: &str = "graphite-editor"; diff --git a/desktop/src/dirs.rs b/desktop/src/dirs.rs index 5e3cf636b..6a964e017 100644 --- a/desktop/src/dirs.rs +++ b/desktop/src/dirs.rs @@ -1,7 +1,7 @@ use std::fs::create_dir_all; use std::path::PathBuf; -static APP_NAME: &str = "graphite-desktop"; +use crate::consts::APP_DIRECTORY_NAME; pub(crate) fn ensure_dir_exists(path: &PathBuf) { if !path.exists() { @@ -10,7 +10,7 @@ pub(crate) fn ensure_dir_exists(path: &PathBuf) { } pub(crate) fn graphite_data_dir() -> PathBuf { - let path = dirs::data_dir().expect("Failed to get data directory").join(APP_NAME); + let path = dirs::data_dir().expect("Failed to get data directory").join(APP_DIRECTORY_NAME); ensure_dir_exists(&path); path } diff --git a/desktop/src/main.rs b/desktop/src/main.rs index 41cf45ced..36fe41db8 100644 --- a/desktop/src/main.rs +++ b/desktop/src/main.rs @@ -6,6 +6,8 @@ use graphite_editor::messages::prelude::Message; use tracing_subscriber::EnvFilter; use winit::event_loop::EventLoop; +pub(crate) mod consts; + mod cef; use cef::{Setup, WindowSize};