Compare commits

..

No commits in common. "7393ce1ff1d231172846f1299c3f145f8169b79e" and "240bb058a9625e44acfa3e84b8460ee11e6b13e9" have entirely different histories.

41 changed files with 692 additions and 499 deletions

View file

@ -1,15 +0,0 @@
{
"format_on_save": "on",
"lsp": {
"rust-analyzer": {
"initialization_options": {
"check": {
"command": "clippy",
},
"rustfmt": {
"extraArgs": ["+nightly"],
},
},
},
},
}

590
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -1,18 +1,17 @@
[package] [package]
name = "cosmic-workspaces" name = "cosmic-workspaces"
version = "1.0.12" version = "1.0.0"
edition = "2024" edition = "2024"
rust-version = "1.93"
[dependencies] [dependencies]
anyhow = "1.0.102" anyhow = "1.0.102"
calloop = { version = "0.14.4", features = ["executor"] } calloop = { version = "0.14.4", features = ["executor"] }
clap = { version = "4", features = ["derive"] } clap = { version = "4", features = ["derive"] }
cosmic-bg-config = { path = "../cosmic-bg/config" } cosmic-bg-config = { git = "https://github.com/pop-os/cosmic-bg" }
cosmic-comp-config = { git = "https://github.com/pop-os/cosmic-comp" } cosmic-comp-config = { git = "https://github.com/pop-os/cosmic-comp" }
env_logger = "0.11.9" env_logger = "0.11.9"
gbm = "0.18.0" gbm = "0.18.0"
cosmic = { package = "libcosmic-yoda", path = "../libcosmic", default-features = false, features = [ libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false, features = [
"tokio", "tokio",
"wayland", "wayland",
"single-instance", "single-instance",
@ -20,7 +19,7 @@ cosmic = { package = "libcosmic-yoda", path = "../libcosmic", default-features =
"multi-window", "multi-window",
"winit", "winit",
] } ] }
cosmic-config = { path = "../libcosmic/cosmic-config" } cosmic-config = { git = "https://github.com/pop-os/libcosmic" }
freedesktop-icons = { package = "cosmic-freedesktop-icons", git = "https://github.com/pop-os/freedesktop-icons" } freedesktop-icons = { package = "cosmic-freedesktop-icons", git = "https://github.com/pop-os/freedesktop-icons" }
memmap2 = "0.9.10" memmap2 = "0.9.10"
@ -38,7 +37,7 @@ zbus = "5.13.2"
tokio-stream = { version = "0.1.18", features = ["sync"] } tokio-stream = { version = "0.1.18", features = ["sync"] }
ash = { version = "0.38.0", features = ["loaded"] } ash = { version = "0.38.0", features = ["loaded"] }
bytemuck = "1.25.0" bytemuck = "1.25.0"
cosmic-panel-config = { path = "../cosmic-panel/cosmic-panel-config" } cosmic-panel-config = { git = "https://github.com/pop-os/cosmic-panel" }
[dependencies.i18n-embed] [dependencies.i18n-embed]
version = "0.16" version = "0.16"
@ -46,49 +45,12 @@ features = ["fluent-system", "desktop-requester"]
[features] [features]
default = ["wgpu"] default = ["wgpu"]
wgpu = ["cosmic/wgpu"] wgpu = ["libcosmic/wgpu"]
# Debugging features # Debugging features
force-shm-screencopy = [] force-shm-screencopy = []
no-subsurfaces = ["force-shm-screencopy"] no-subsurfaces = ["force-shm-screencopy"]
mock-backend = [] mock-backend = []
[patch.'https://github.com/pop-os/libcosmic']
cosmic-config = { path = "../libcosmic/cosmic-config" }
cosmic-theme = { path = "../libcosmic/cosmic-theme" }
iced = { path = "../libcosmic/iced" }
iced_accessibility = { path = "../libcosmic/iced/accessibility" }
iced_core = { path = "../libcosmic/iced/core" }
iced_futures = { path = "../libcosmic/iced/futures" }
iced_graphics = { path = "../libcosmic/iced/graphics" }
iced_renderer = { path = "../libcosmic/iced/renderer" }
iced_runtime = { path = "../libcosmic/iced/runtime" }
iced_tiny_skia = { path = "../libcosmic/iced/tiny_skia" }
iced_wgpu = { path = "../libcosmic/iced/wgpu" }
iced_widget = { path = "../libcosmic/iced/widget" }
iced_winit = { path = "../libcosmic/iced/winit" }
[patch.'https://github.com/pop-os/cosmic-protocols']
cosmic-protocols = { path = "../cosmic-protocols" }
cosmic-client-toolkit = { path = "../cosmic-protocols/client-toolkit" }
[patch.'https://github.com/pop-os/cosmic-text.git']
cosmic-text = { git = "https://forge.aditua.com/leyoda/cosmic-text.git", branch = "local/pr-503" }
[patch.'https://github.com/pop-os/cosmic-bg']
cosmic-bg-config = { path = "../cosmic-bg/config" }
[patch.'https://github.com/pop-os/cosmic-panel']
cosmic-panel-config = { path = "../cosmic-panel/cosmic-panel-config" }
xdg-shell-wrapper-config = { path = "../cosmic-panel/xdg-shell-wrapper-config" }
[patch.'https://github.com/pop-os/cosmic-settings-daemon']
cosmic-settings-config = { path = "../cosmic-settings-daemon/config" }
[patch.'https://forge.aditua.com/leyoda/window_clipboard.git']
window_clipboard = { path = "../window_clipboard" }
dnd = { path = "../window_clipboard/dnd" }
mime = { path = "../window_clipboard/mime" }
[profile.dev] [profile.dev]
# Not usable at opt-level 0, at least with software renderer # Not usable at opt-level 0, at least with software renderer
opt-level = 1 opt-level = 1

6
debian/changelog vendored
View file

@ -1,9 +1,3 @@
cosmic-workspaces (1.0.12) noble; urgency=medium
* Version bump
-- Michael Murphy <michael@mmurphy.dev> Wed, 29 Apr 2026 17:48:17 +0200
cosmic-workspaces (0.1.0) jammy; urgency=medium cosmic-workspaces (0.1.0) jammy; urgency=medium
* Initial release. * Initial release.

View file

@ -1,2 +0,0 @@
workspace = Χώρος εργασίας { $number }
new-workspace = Νέος χώρος εργασίας

View file

@ -1,2 +0,0 @@
workspace = Tallunt n umahil { $number }
new-workspace = Tallunt n umahil tamaynut

View file

@ -1,2 +1,2 @@
workspace = Espaço de trabalho { $number } workspace = Área de trabalho { $number }
new-workspace = Novo espaço de trabalho new-workspace = Nova área de trabalho

View file

@ -1,2 +1,2 @@
new-workspace = Nova área de trabalho new-workspace = Nova área de trabalho
workspace = Área de trabalho { $number } workspace = Área de trabalho{ $number }

View file

@ -1,2 +0,0 @@
workspace = Радни простор { $number }
new-workspace = Нови радни простор

View file

@ -1,2 +1,2 @@
workspace = 工作區 { $number } workspace = 工作區 { $number }
new-workspace = 新建工作區 new-workspace = 新工作區

View file

@ -1,3 +0,0 @@
[toolchain]
channel = "1.93.0"
components = ["clippy", "rustfmt"]

View file

@ -1 +1 @@
imports_granularity = "Module" imports_granularity = "Crate"

View file

@ -1,23 +1,37 @@
// Copyright 2024 System76 <info@system76.com> // Copyright 2024 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
use cosmic::cctk::cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1; use cosmic::{
use cosmic::cctk::cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1; cctk::{
use cosmic::cctk::cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2; cosmic_protocols::{
use cosmic::cctk::wayland_client::protocol::{wl_output, wl_shm}; toplevel_info::v1::client::zcosmic_toplevel_handle_v1,
use cosmic::cctk::wayland_client::{Connection, WEnum}; toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
use cosmic::cctk::wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1; workspace::v2::client::zcosmic_workspace_handle_v2,
use cosmic::iced::futures::executor::block_on; },
use cosmic::iced::futures::{FutureExt, SinkExt}; wayland_client::{
use cosmic::iced::{self}; Connection, WEnum,
use cosmic::iced_winit::platform_specific::wayland::subsurface_widget::{Shmbuf, SubsurfaceBuffer}; protocol::{wl_output, wl_shm},
},
wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1,
},
iced::{
self,
futures::{FutureExt, SinkExt, executor::block_on},
},
iced_winit::platform_specific::wayland::subsurface_widget::{Shmbuf, SubsurfaceBuffer},
};
use futures_channel::mpsc; use futures_channel::mpsc;
use std::collections::HashSet; use std::{
use std::io::{self, Write}; collections::HashSet,
use std::sync::Arc; fs,
use std::sync::atomic::{AtomicU32, Ordering}; io::{self, Write},
use std::{fs, thread}; sync::{
Arc,
atomic::{AtomicU32, Ordering},
},
thread,
};
use super::{CaptureImage, Cmd, Event}; use super::{CaptureImage, Cmd, Event};
use crate::utils; use crate::utils;

View file

@ -7,9 +7,13 @@
//! There are two backends: one that uses cosmic-comp protocols, and a mock //! There are two backends: one that uses cosmic-comp protocols, and a mock
//! backend for testing without any special protocols. //! backend for testing without any special protocols.
use cosmic::cctk::cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1; use cosmic::{
use cosmic::cctk::wayland_client::protocol::wl_output; cctk::{
use cosmic::iced::platform_specific::shell::subsurface_widget::SubsurfaceBuffer; cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
wayland_client::protocol::wl_output,
},
iced::platform_specific::shell::subsurface_widget::SubsurfaceBuffer,
};
use std::collections::HashSet; use std::collections::HashSet;
// Wayland backend using cosmic-comp specific protocols // Wayland backend using cosmic-comp specific protocols
@ -94,7 +98,6 @@ pub enum Cmd {
wl_output::WlOutput, wl_output::WlOutput,
), ),
MoveWorkspaceBefore(ExtWorkspaceHandleV1, ExtWorkspaceHandleV1), MoveWorkspaceBefore(ExtWorkspaceHandleV1, ExtWorkspaceHandleV1),
#[allow(dead_code)]
MoveWorkspaceAfter(ExtWorkspaceHandleV1, ExtWorkspaceHandleV1), MoveWorkspaceAfter(ExtWorkspaceHandleV1, ExtWorkspaceHandleV1),
ActivateWorkspace(ExtWorkspaceHandleV1), ActivateWorkspace(ExtWorkspaceHandleV1),
SetWorkspacePinned(ExtWorkspaceHandleV1, bool), SetWorkspacePinned(ExtWorkspaceHandleV1, bool),

View file

@ -1,12 +1,15 @@
use cctk::screencopy::{Formats, Rect}; use cctk::{
use cctk::wayland_client::protocol::{wl_buffer, wl_shm, wl_shm_pool}; screencopy::{Formats, Rect},
use cctk::wayland_client::{Connection, Dispatch, QueueHandle}; wayland_client::{
use cosmic::cctk; Connection, Dispatch, QueueHandle,
use cosmic::iced::platform_specific::shell::subsurface_widget::{ protocol::{wl_buffer, wl_shm, wl_shm_pool},
BufferSource, Dmabuf, Plane, Shmbuf, },
}; };
use std::os::fd::AsFd; use cosmic::{
use std::sync::Arc; cctk,
iced::platform_specific::shell::subsurface_widget::{BufferSource, Dmabuf, Plane, Shmbuf},
};
use std::{os::fd::AsFd, sync::Arc};
use wayland_protocols::wp::linux_dmabuf::zv1::client::zwp_linux_buffer_params_v1; use wayland_protocols::wp::linux_dmabuf::zv1::client::zwp_linux_buffer_params_v1;
use super::AppData; use super::AppData;

View file

@ -1,5 +1,7 @@
use cctk::screencopy::{CaptureSession, CaptureSource, ScreencopyState}; use cctk::{
use cctk::wayland_client::QueueHandle; screencopy::{CaptureSession, CaptureSource, ScreencopyState},
wayland_client::QueueHandle,
};
use cosmic::cctk; use cosmic::cctk;
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};

View file

@ -1,11 +1,16 @@
use cctk::sctk::dmabuf::{DmabufFeedback, DmabufHandler, DmabufState}; use cctk::{
use cctk::sctk::{self}; sctk::{
use cctk::wayland_client::protocol::wl_buffer; self,
use cctk::wayland_client::{Connection, QueueHandle}; dmabuf::{DmabufFeedback, DmabufHandler, DmabufState},
},
wayland_client::{Connection, QueueHandle, protocol::wl_buffer},
};
use cosmic::cctk; use cosmic::cctk;
use wayland_protocols::wp::linux_dmabuf::zv1::client::zwp_linux_buffer_params_v1::ZwpLinuxBufferParamsV1; use wayland_protocols::wp::linux_dmabuf::zv1::client::{
use wayland_protocols::wp::linux_dmabuf::zv1::client::zwp_linux_dmabuf_feedback_v1::ZwpLinuxDmabufFeedbackV1; zwp_linux_buffer_params_v1::ZwpLinuxBufferParamsV1,
zwp_linux_dmabuf_feedback_v1::ZwpLinuxDmabufFeedbackV1,
};
use super::AppData; use super::AppData;

View file

@ -1,7 +1,9 @@
use std::collections::hash_map::{self, HashMap}; use std::{
use std::os::unix::fs::MetadataExt; collections::hash_map::{self, HashMap},
use std::path::{Path, PathBuf}; fs, io,
use std::{fs, io}; os::unix::fs::MetadataExt,
path::{Path, PathBuf},
};
// TODO Purge gbm devices that are no longer needed/valid? // TODO Purge gbm devices that are no longer needed/valid?
#[derive(Default)] #[derive(Default)]

View file

@ -2,29 +2,35 @@
// subscription. // subscription.
use calloop_wayland_source::WaylandSource; use calloop_wayland_source::WaylandSource;
use cctk::cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2; use cctk::{
use cctk::screencopy::{CaptureSource, ScreencopyState}; cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2,
use cctk::sctk::dmabuf::{DmabufFeedback, DmabufState}; screencopy::{CaptureSource, ScreencopyState},
use cctk::sctk::registry::{ProvidesRegistryState, RegistryState}; sctk::{
use cctk::sctk::seat::{SeatHandler, SeatState}; self,
use cctk::sctk::shm::{Shm, ShmHandler}; dmabuf::{DmabufFeedback, DmabufState},
use cctk::sctk::{self}; registry::{ProvidesRegistryState, RegistryState},
use cctk::toplevel_info::ToplevelInfoState; seat::{SeatHandler, SeatState},
use cctk::toplevel_management::ToplevelManagerState; shm::{Shm, ShmHandler},
use cctk::wayland_client::globals::registry_queue_init; },
use cctk::wayland_client::protocol::wl_seat; toplevel_info::ToplevelInfoState,
use cctk::wayland_client::{Connection, Proxy, QueueHandle}; toplevel_management::ToplevelManagerState,
use cctk::workspace::WorkspaceState; wayland_client::{
use cosmic::cctk; Connection, Proxy, QueueHandle, globals::registry_queue_init, protocol::wl_seat,
use cosmic::iced::futures::channel::mpsc; },
use cosmic::iced::futures::executor::{ThreadPool, block_on}; workspace::WorkspaceState,
use cosmic::iced::futures::{FutureExt, SinkExt}; };
use cosmic::iced::{self}; use cosmic::{
use std::cell::RefCell; cctk,
use std::collections::HashMap; iced::{
use std::hash::Hash; self,
use std::sync::Arc; futures::{
use std::thread; FutureExt, SinkExt,
channel::mpsc,
executor::{ThreadPool, block_on},
},
},
};
use std::{cell::RefCell, collections::HashMap, hash::Hash, sync::Arc, thread};
mod buffer; mod buffer;
use buffer::Buffer; use buffer::Buffer;

View file

@ -1,15 +1,21 @@
use cosmic::cctk::screencopy::{ use cosmic::{
CaptureFrame, CaptureOptions, CaptureSession, CaptureSource, FailureReason, Formats, Frame, cctk::{
ScreencopyFrameData, ScreencopyFrameDataExt, ScreencopyHandler, ScreencopySessionData, self,
ScreencopySessionDataExt, ScreencopyState, screencopy::{
}; CaptureFrame, CaptureOptions, CaptureSession, CaptureSource, FailureReason, Formats,
use cosmic::cctk::wayland_client::{Connection, QueueHandle, WEnum}; Frame, ScreencopyFrameData, ScreencopyFrameDataExt, ScreencopyHandler,
use cosmic::cctk::{self}; ScreencopySessionData, ScreencopySessionDataExt, ScreencopyState,
use cosmic::iced::platform_specific::shell::subsurface_widget::{ },
wayland_client::{Connection, QueueHandle, WEnum},
},
iced::platform_specific::shell::subsurface_widget::{
SubsurfaceBuffer, SubsurfaceBufferRelease, SubsurfaceBuffer, SubsurfaceBufferRelease,
},
};
use std::{
array,
sync::{Arc, Weak},
}; };
use std::array;
use std::sync::{Arc, Weak};
use super::{AppData, Buffer, Capture, CaptureImage, Event}; use super::{AppData, Buffer, Capture, CaptureImage, Event};

View file

@ -1,7 +1,9 @@
use cctk::cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1; use cctk::{
use cctk::toplevel_info::{ToplevelInfoHandler, ToplevelInfoState}; cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
use cctk::toplevel_management::{ToplevelManagerHandler, ToplevelManagerState}; toplevel_info::{ToplevelInfoHandler, ToplevelInfoState},
use cctk::wayland_client::{Connection, QueueHandle, WEnum}; toplevel_management::{ToplevelManagerHandler, ToplevelManagerState},
wayland_client::{Connection, QueueHandle, WEnum},
};
use cosmic::cctk; use cosmic::cctk;
use wayland_protocols::ext::foreign_toplevel_list::v1::client::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1; use wayland_protocols::ext::foreign_toplevel_list::v1::client::ext_foreign_toplevel_handle_v1::ExtForeignToplevelHandleV1;

View file

@ -1,7 +1,5 @@
use ash::prelude::VkResult; use ash::{prelude::VkResult, vk};
use ash::vk; use std::{collections::HashMap, ffi::CStr};
use std::collections::HashMap;
use std::ffi::CStr;
pub struct Vulkan { pub struct Vulkan {
instance: ash::Instance, instance: ash::Instance,

View file

@ -1,7 +1,5 @@
use cosmic::iced::futures::StreamExt; use cosmic::iced::{self, futures::StreamExt};
use cosmic::iced::{self}; use std::{any::TypeId, hash::Hash};
use std::any::TypeId;
use std::hash::Hash;
use tokio::sync::broadcast; use tokio::sync::broadcast;
use tokio_stream::wrappers::BroadcastStream; use tokio_stream::wrappers::BroadcastStream;

View file

@ -1,10 +1,10 @@
//! Types related to drag-and-drop //! Types related to drag-and-drop
use cosmic::cctk::wayland_client::Proxy; use cosmic::{
use cosmic::cctk::wayland_client::protocol::wl_output; cctk::wayland_client::{Proxy, protocol::wl_output},
use cosmic::iced::clipboard::mime::AsMimeTypes; iced::clipboard::mime::AsMimeTypes,
use std::borrow::Cow; };
use std::sync::LazyLock; use std::{borrow::Cow, sync::LazyLock};
use crate::backend::{ExtForeignToplevelHandleV1, ExtWorkspaceHandleV1}; use crate::backend::{ExtForeignToplevelHandleV1, ExtWorkspaceHandleV1};

View file

@ -1,8 +1,10 @@
// Copyright 2023 System76 <info@system76.com> // Copyright 2023 System76 <info@system76.com>
// SPDX-License-Identifier: GPL-3.0-only // SPDX-License-Identifier: GPL-3.0-only
use i18n_embed::fluent::{FluentLanguageLoader, fluent_language_loader}; use i18n_embed::{
use i18n_embed::{DefaultLocalizer, LanguageLoader, Localizer}; DefaultLocalizer, LanguageLoader, Localizer,
fluent::{FluentLanguageLoader, fluent_language_loader},
};
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::sync::LazyLock; use std::sync::LazyLock;

View file

@ -3,38 +3,47 @@
#![allow(clippy::single_match)] #![allow(clippy::single_match)]
use cctk::cosmic_protocols::toplevel_management::v1::client::zcosmic_toplevel_manager_v1; use cctk::{
use cctk::cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2; cosmic_protocols::{
use cctk::sctk::shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer}; toplevel_management::v1::client::zcosmic_toplevel_manager_v1,
use cctk::wayland_client::protocol::wl_output; workspace::v2::client::zcosmic_workspace_handle_v2,
use cctk::wayland_client::{Connection, Proxy}; },
use cctk::wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1; sctk::shell::wlr_layer::{Anchor, KeyboardInteractivity, Layer},
wayland_client::{Connection, Proxy, protocol::wl_output},
wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1,
};
use clap::Parser; use clap::Parser;
use cosmic::app::{Application, CosmicFlags}; use cosmic::{
use cosmic::iced::clipboard::dnd::{DndEvent, SourceEvent}; app::{Application, CosmicFlags},
use cosmic::iced::event::wayland::{Event as WaylandEvent, LayerEvent, OutputEvent}; cctk, dbus_activation,
use cosmic::iced::keyboard::key::{Key, Named}; iced::platform_specific::shell::commands::layer_surface::{
use cosmic::iced::mouse::ScrollDelta;
use cosmic::iced::platform_specific::shell::commands::layer_surface::{
destroy_layer_surface, get_layer_surface, destroy_layer_surface, get_layer_surface,
}; },
use cosmic::iced::runtime::platform_specific::wayland::layer_surface::{ iced::runtime::platform_specific::wayland::layer_surface::{
IcedOutput, SctkLayerSurfaceSettings, IcedOutput, SctkLayerSurfaceSettings,
},
iced::window::Id as SurfaceId,
iced::{
self, Size, Subscription, Task,
clipboard::dnd::{DndEvent, SourceEvent},
event::wayland::{Event as WaylandEvent, LayerEvent, OutputEvent},
keyboard::key::{Key, Named},
mouse::ScrollDelta,
},
scroll::DiscreteScrollState,
}; };
use cosmic::iced::window::Id as SurfaceId;
use cosmic::iced::{self, Size, Subscription, Task};
use cosmic::scroll::DiscreteScrollState;
use cosmic::{cctk, dbus_activation};
use cosmic_comp_config::CosmicCompConfig; use cosmic_comp_config::CosmicCompConfig;
use cosmic_config::CosmicConfigEntry; use cosmic_config::{CosmicConfigEntry, cosmic_config_derive::CosmicConfigEntry};
use cosmic_config::cosmic_config_derive::CosmicConfigEntry;
use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfigEntry, PanelAnchor}; use cosmic_panel_config::{CosmicPanelConfig, CosmicPanelContainerConfigEntry, PanelAnchor};
use i18n_embed::DesktopLanguageRequester; use i18n_embed::DesktopLanguageRequester;
use std::collections::{HashMap, HashSet}; use std::{
use std::path::PathBuf; collections::{HashMap, HashSet},
use std::process::Command; mem,
use std::time::Duration; path::PathBuf,
use std::{mem, str}; process::Command,
str,
time::Duration,
};
mod dbus; mod dbus;
mod desktop_info; mod desktop_info;

View file

@ -1,7 +1,8 @@
use rustix::io::Errno; use rustix::{io::Errno, shm};
use rustix::shm; use std::{
use std::os::fd::OwnedFd; os::fd::OwnedFd,
use std::time::{SystemTime, UNIX_EPOCH}; time::{SystemTime, UNIX_EPOCH},
};
#[cfg(target_os = "linux")] #[cfg(target_os = "linux")]
fn create_memfd() -> rustix::io::Result<OwnedFd> { fn create_memfd() -> rustix::io::Result<OwnedFd> {

View file

@ -1,22 +1,34 @@
use cosmic::Apply; use cosmic::{
use cosmic::cctk::cosmic_protocols::toplevel_info::v1::client::zcosmic_toplevel_handle_v1; Apply,
use cosmic::cctk::cosmic_protocols::workspace::v2::client::zcosmic_workspace_handle_v2; cctk::{
use cosmic::cctk::wayland_client::protocol::wl_output; cosmic_protocols::{
use cosmic::cctk::wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1; toplevel_info::v1::client::zcosmic_toplevel_handle_v1,
use cosmic::iced::advanced::layout::flex::Axis; workspace::v2::client::zcosmic_workspace_handle_v2,
use cosmic::iced::clipboard::mime::{AllowedMimeTypes, AsMimeTypes}; },
use cosmic::iced::core::Shadow; wayland_client::protocol::wl_output,
use cosmic::iced::core::text::{Ellipsize, EllipsizeHeightLimit}; wayland_protocols::ext::workspace::v1::client::ext_workspace_handle_v1,
use cosmic::iced::platform_specific::shell::subsurface_widget::Subsurface; },
use cosmic::iced::widget::{column, row}; iced::core::{
use cosmic::iced::{self, Alignment, Border, Length}; Shadow,
use cosmic::widget::{self, Widget}; text::{Ellipsize, EllipsizeHeightLimit},
},
iced::{
self, Alignment, Border, Length,
advanced::layout::flex::Axis,
clipboard::mime::{AllowedMimeTypes, AsMimeTypes},
platform_specific::shell::subsurface_widget::Subsurface,
widget::{column, row},
},
widget::{self, Widget},
};
use cosmic_comp_config::workspace::WorkspaceLayout; use cosmic_comp_config::workspace::WorkspaceLayout;
use std::collections::HashSet; use std::collections::HashSet;
use crate::backend::{self, CaptureImage}; use crate::{
use crate::dnd::{Drag, DragSurface, DragToplevel, DragWorkspace, DropTarget}; App, LayerSurface, Msg, Toplevel, Workspace,
use crate::{App, LayerSurface, Msg, Toplevel, Workspace}; backend::{self, CaptureImage},
dnd::{Drag, DragSurface, DragToplevel, DragWorkspace, DropTarget},
};
fn dnd_source_with_drag_surface<D: AsMimeTypes + Send + Clone + 'static>( fn dnd_source_with_drag_surface<D: AsMimeTypes + Send + Clone + 'static>(
drag_content: D, drag_content: D,

View file

@ -1,15 +1,19 @@
// Renders image behind widget, and otherwise passes through all behavior // Renders image behind widget, and otherwise passes through all behavior
use cosmic::iced::advanced::layout::{self}; use cosmic::iced::{
use cosmic::iced::advanced::widget::{Operation, Tree, tree}; Length, Rectangle, Size, Vector,
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, mouse, overlay, renderer}; advanced::{
use cosmic::iced::core::Renderer; Clipboard, Layout, Shell, Widget,
use cosmic::iced::event::Event; layout::{self},
use cosmic::iced::{Length, Rectangle, Size, Vector}; mouse, overlay, renderer,
widget::{Operation, Tree, tree},
},
core::Renderer,
event::Event,
};
use std::marker::PhantomData; use std::marker::PhantomData;
#[allow(dead_code)]
pub fn image_bg<'a, Msg, T1: Into<cosmic::Element<'a, Msg>>, T2: Into<cosmic::Element<'a, Msg>>>( pub fn image_bg<'a, Msg, T1: Into<cosmic::Element<'a, Msg>>, T2: Into<cosmic::Element<'a, Msg>>>(
content: T1, content: T1,
bg: T2, bg: T2,

View file

@ -1,9 +1,13 @@
//! Show one surface, sized to match the size of another (invisible) widget //! Show one surface, sized to match the size of another (invisible) widget
use cosmic::iced::advanced::widget::{Operation, Tree}; use cosmic::iced::{
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, layout, mouse, renderer}; Length, Rectangle, Size,
use cosmic::iced::event::Event; advanced::{
use cosmic::iced::{Length, Rectangle, Size}; Clipboard, Layout, Shell, Widget, layout, mouse, renderer,
widget::{Operation, Tree},
},
event::{self, Event},
};
use std::marker::PhantomData; use std::marker::PhantomData;
pub fn match_size< pub fn match_size<

View file

@ -1,7 +1,11 @@
use cosmic::iced::advanced::widget::{Id, Operation, Tree, tree}; use cosmic::iced::{
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, layout, mouse, overlay, renderer}; Length, Rectangle, Size, Vector,
use cosmic::iced::event::Event; advanced::{
use cosmic::iced::{Length, Rectangle, Size, Vector}; Clipboard, Layout, Shell, Widget, layout, mouse, overlay, renderer,
widget::{Id, Operation, Tree, tree},
},
event::{self, Event},
};
use std::marker::PhantomData; use std::marker::PhantomData;
mod image_bg; mod image_bg;

View file

@ -1,11 +1,14 @@
use cosmic::iced::advanced::widget::{Id, Operation, Tree, tree}; use cosmic::iced::{
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, layout, mouse, overlay, renderer}; Length, Rectangle, Size, Vector,
use cosmic::iced::event::Event; advanced::{
use cosmic::iced::{Length, Rectangle, Size, Vector}; Clipboard, Layout, Shell, Widget, layout, mouse, overlay, renderer,
widget::{Id, Operation, Tree, tree},
},
event::{self, Event},
};
use std::marker::PhantomData; use std::marker::PhantomData;
#[allow(dead_code)]
pub fn mouse_interaction_wrapper<'a, Msg, T: Into<cosmic::Element<'a, Msg>>>( pub fn mouse_interaction_wrapper<'a, Msg, T: Into<cosmic::Element<'a, Msg>>>(
mouse_interaction: mouse::Interaction, mouse_interaction: mouse::Interaction,
content: T, content: T,

View file

@ -1,11 +1,15 @@
// This widget defines it's cross axis size as the `index`th child's size // This widget defines it's cross axis size as the `index`th child's size
use cosmic::iced::advanced::layout::flex::Axis; use cosmic::iced::{
use cosmic::iced::advanced::layout::{self, Limits}; Length, Point, Rectangle, Size,
use cosmic::iced::advanced::widget::{Operation, Tree}; advanced::{
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, mouse, renderer}; Clipboard, Layout, Shell, Widget,
use cosmic::iced::event::Event; layout::{self, flex::Axis},
use cosmic::iced::{Length, Point, Rectangle, Size}; mouse, renderer,
widget::{Operation, Tree},
},
event::{self, Event},
};
use std::marker::PhantomData; use std::marker::PhantomData;
// Duplicate of private methods // Duplicate of private methods
@ -74,38 +78,25 @@ impl<Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for SizeCrossNth<'_, Msg>
&mut self, &mut self,
tree: &mut Tree, tree: &mut Tree,
renderer: &cosmic::Renderer, renderer: &cosmic::Renderer,
limits: &Limits, limits: &layout::Limits,
) -> layout::Node { ) -> layout::Node {
let max_main = self.axis.main(limits.max()); let max_main = self.axis.main(limits.max());
let max_cross = self.axis.cross(limits.max()); let max_cross = self.axis.cross(limits.max());
// Lay out all non-reference children to get their total main size // XXX cleaner solution
let mut total_main = 0.0; // Get layout of main widget, to set overall cross axis size
for (i, (child, tree)) in self let (max_width, max_height) = self.axis.pack(max_main, max_cross);
.children let child_limits = layout::Limits::new(Size::ZERO, Size::new(max_width, max_height));
.iter_mut()
.zip(tree.children.iter_mut())
.enumerate()
{
if i != self.index {
let (max_width, max_height) = self.axis.pack(max_main - total_main, max_cross);
let child_limits = Limits::new(Size::ZERO, Size::new(max_width, max_height));
let layout = child.as_widget_mut().layout(tree, renderer, &child_limits);
total_main += self.axis.main(layout.size());
}
}
// Lay out reference child with remaining main to get max cross size
let (max_width, max_height) = self.axis.pack(max_main - total_main, max_cross);
let child_limits = Limits::new(Size::ZERO, Size::new(max_width, max_height));
let layout = self.children[self.index].as_widget_mut().layout( let layout = self.children[self.index].as_widget_mut().layout(
&mut tree.children[self.index], &mut tree.children[self.index],
renderer, renderer,
&child_limits, &child_limits,
); );
let max_cross = self.axis.cross(layout.size()); let max_cross = self.axis.cross(layout.size());
// Lay out all children constrained to reference cross // XXX sill allocating maximum main axis?
// - what was it doing before?
let mut total_main = 0.0; let mut total_main = 0.0;
let nodes = self let nodes = self
.children .children
@ -113,7 +104,8 @@ impl<Msg> Widget<Msg, cosmic::Theme, cosmic::Renderer> for SizeCrossNth<'_, Msg>
.zip(tree.children.iter_mut()) .zip(tree.children.iter_mut())
.map(|(child, tree)| { .map(|(child, tree)| {
let (max_width, max_height) = self.axis.pack(max_main - total_main, max_cross); let (max_width, max_height) = self.axis.pack(max_main - total_main, max_cross);
let child_limits = Limits::new(Size::ZERO, Size::new(max_width, max_height)); let child_limits =
layout::Limits::new(Size::ZERO, Size::new(max_width, max_height));
let mut layout = child.as_widget_mut().layout(tree, renderer, &child_limits); let mut layout = child.as_widget_mut().layout(tree, renderer, &child_limits);
// Center on cross axis // Center on cross axis
let cross = ((max_cross - self.axis.cross(layout.size())) / 2.).max(0.); let cross = ((max_cross - self.axis.cross(layout.size())) / 2.).max(0.);

View file

@ -1,9 +1,13 @@
use cosmic::iced::advanced::layout::flex::Axis; use cosmic::iced::{
use cosmic::iced::advanced::layout::{self}; Length, Rectangle, Size, Vector,
use cosmic::iced::advanced::widget::{Operation, Tree}; advanced::{
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, mouse, renderer}; Clipboard, Layout, Shell, Widget,
use cosmic::iced::event::Event; layout::{self, flex::Axis},
use cosmic::iced::{Length, Rectangle, Size, Vector}; mouse, renderer,
widget::{Operation, Tree},
},
event::{self, Event},
};
use std::marker::PhantomData; use std::marker::PhantomData;
mod toplevel_layout; mod toplevel_layout;

View file

@ -1,6 +1,5 @@
use aliasable::vec::AliasableVec; use aliasable::vec::AliasableVec;
use cosmic::iced::advanced::layout::flex::Axis; use cosmic::iced::{Length, Point, Rectangle, Size, advanced::layout::flex::Axis};
use cosmic::iced::{Length, Point, Rectangle, Size};
use std::marker::PhantomData; use std::marker::PhantomData;
use super::{LayoutToplevel, ToplevelLayout}; use super::{LayoutToplevel, ToplevelLayout};

View file

@ -1,8 +1,9 @@
use cosmic::iced::Length; use cosmic::iced::{Length, advanced::layout::flex::Axis};
use cosmic::iced::advanced::layout::flex::Axis;
use super::LayoutToplevel; use super::{
use super::axis_toplevel_layout::{AxisPoint, AxisRectangle, AxisSize, AxisToplevelLayout}; LayoutToplevel,
axis_toplevel_layout::{AxisPoint, AxisRectangle, AxisSize, AxisToplevelLayout},
};
pub(crate) struct RowColToplevelLayout { pub(crate) struct RowColToplevelLayout {
pub axis: Axis, pub axis: Axis,

View file

@ -1,9 +1,10 @@
use cosmic::iced::Length; use cosmic::iced::{Length, advanced::layout::flex::Axis};
use cosmic::iced::advanced::layout::flex::Axis;
use super::LayoutToplevel; use super::{
use super::axis_toplevel_layout::{AxisRectangle, AxisSize, AxisToplevelLayout}; LayoutToplevel,
use super::row_col_toplevel_layout::RowColToplevelLayout; axis_toplevel_layout::{AxisRectangle, AxisSize, AxisToplevelLayout},
row_col_toplevel_layout::RowColToplevelLayout,
};
pub(crate) struct TwoRowColToplevelLayout(RowColToplevelLayout); pub(crate) struct TwoRowColToplevelLayout(RowColToplevelLayout);

View file

@ -1,10 +1,14 @@
//! If `visible` is set to `true`, behaves exactly as wrapped widget. If `false`, //! If `visible` is set to `true`, behaves exactly as wrapped widget. If `false`,
//! takes the same space but does not draw. //! takes the same space but does not draw.
use cosmic::iced::advanced::widget::{Operation, Tree}; use cosmic::iced::{
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, layout, mouse, renderer}; Length, Rectangle, Size,
use cosmic::iced::event::Event; advanced::{
use cosmic::iced::{Length, Rectangle, Size}; Clipboard, Layout, Shell, Widget, layout, mouse, renderer,
widget::{Operation, Tree},
},
event::{self, Event},
};
use std::marker::PhantomData; use std::marker::PhantomData;
pub fn visibility_wrapper<'a, Msg, T: Into<cosmic::Element<'a, Msg>>>( pub fn visibility_wrapper<'a, Msg, T: Into<cosmic::Element<'a, Msg>>>(

View file

@ -1,13 +1,17 @@
// Custom varian of row/column // Custom varian of row/column
// Gives each child widget a maximum size on main axis of total/n // Gives each child widget a maximum size on main axis of total/n
use cosmic::iced::advanced::layout::flex::Axis; use cosmic::iced::{
use cosmic::iced::advanced::layout::{self}; Length, Point, Rectangle, Size,
use cosmic::iced::advanced::widget::{Operation, Tree}; advanced::{
use cosmic::iced::advanced::{Clipboard, Layout, Shell, Widget, mouse, renderer}; Clipboard, Layout, Shell, Widget,
use cosmic::iced::core::clipboard::DndDestinationRectangles; layout::{self, flex::Axis},
use cosmic::iced::event::Event; mouse, renderer,
use cosmic::iced::{Length, Point, Rectangle, Size}; widget::{Operation, Tree},
},
core::clipboard::DndDestinationRectangles,
event::{self, Event},
};
use std::marker::PhantomData; use std::marker::PhantomData;
// Duplicate of private methods // Duplicate of private methods