feat: use libcosmic::init
This commit is contained in:
parent
a96decd24b
commit
98813824d4
37 changed files with 396 additions and 295 deletions
|
|
@ -12,6 +12,7 @@ cosmic-panel-config = { git = "https://github.com/pop-os/cosmic-panel", features
|
|||
cascade = "1.0.0"
|
||||
gtk4 = { git = "https://github.com/gtk-rs/gtk4-rs", features = ["v4_4"] }
|
||||
adw = { git = "https://gitlab.gnome.org/World/Rust/libadwaita-rs", package = "libadwaita"}
|
||||
libcosmic = { git = "https://github.com/pop-os/libcosmic", default-features = false }
|
||||
once_cell = "1.9.0"
|
||||
pretty_env_logger = "0.4"
|
||||
anyhow = "1.0.50"
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
use std::{process::Command};
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
if let Some(output) = Command::new("git")
|
||||
|
|
|
|||
|
|
@ -1,10 +1,3 @@
|
|||
@define-color accent_color #001d6b;
|
||||
@define-color destructive_color #aa3000;
|
||||
@define-color view_bg_color #00000044;
|
||||
@define-color destructive_fg_color white;
|
||||
@define-color accent_fg_color white;
|
||||
@define-color view_fg_color white;
|
||||
|
||||
button.alert {
|
||||
border-radius: 0;
|
||||
padding: 0px;
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ use gtk4::{
|
|||
CssProvider, StyleContext,
|
||||
};
|
||||
use once_cell::sync::OnceCell;
|
||||
use utils::{WorkspaceEvent};
|
||||
use utils::WorkspaceEvent;
|
||||
use window::CosmicWorkspacesWindow;
|
||||
|
||||
mod localize;
|
||||
|
|
@ -45,9 +45,8 @@ fn load_css() {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
let _ = gtk4::init();
|
||||
adw::init();
|
||||
|
||||
let _ = libcosmic::init();
|
||||
|
||||
// Initialize logger
|
||||
pretty_env_logger::init();
|
||||
glib::set_application_name(ID);
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ use std::path::PathBuf;
|
|||
use gtk4::glib;
|
||||
use std::future::Future;
|
||||
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum WorkspaceEvent {
|
||||
Activate(String),
|
||||
|
|
|
|||
|
|
@ -1,7 +1,4 @@
|
|||
use crate::{
|
||||
utils::WorkspaceEvent,
|
||||
wayland_source::WaylandSource,
|
||||
};
|
||||
use crate::{utils::WorkspaceEvent, wayland_source::WaylandSource};
|
||||
use calloop::channel::*;
|
||||
use cosmic_panel_config::CosmicPanelOuput;
|
||||
use cosmic_protocols::workspace::v1::client::{
|
||||
|
|
@ -10,9 +7,7 @@ use cosmic_protocols::workspace::v1::client::{
|
|||
zcosmic_workspace_manager_v1::{self, ZcosmicWorkspaceManagerV1},
|
||||
};
|
||||
use gtk4::glib;
|
||||
use std::{
|
||||
env, os::unix::net::UnixStream, path::PathBuf, time::Duration,
|
||||
};
|
||||
use std::{env, os::unix::net::UnixStream, path::PathBuf, time::Duration};
|
||||
use wayland_client::{
|
||||
event_created_child,
|
||||
protocol::{
|
||||
|
|
@ -39,11 +34,14 @@ pub fn spawn_workspaces(tx: glib::Sender<State>) -> SyncSender<WorkspaceEvent> {
|
|||
.and_then(|s| s.map(|s| Connection::from_socket(s).map_err(anyhow::Error::msg)))
|
||||
{
|
||||
std::thread::spawn(move || {
|
||||
let output = std::env::var("COSMIC_PANEL_OUTPUT").ok().and_then(|size| match size.parse::<CosmicPanelOuput>() {
|
||||
Ok(CosmicPanelOuput::Name(n)) => Some(n),
|
||||
// TODO handle Active & panic if the space is still configured for All instead of being assigned a named output
|
||||
_ => Some("".to_string()),
|
||||
}).unwrap_or_default();
|
||||
let output = std::env::var("COSMIC_PANEL_OUTPUT")
|
||||
.ok()
|
||||
.and_then(|size| match size.parse::<CosmicPanelOuput>() {
|
||||
Ok(CosmicPanelOuput::Name(n)) => Some(n),
|
||||
// TODO handle Active & panic if the space is still configured for All instead of being assigned a named output
|
||||
_ => Some("".to_string()),
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let mut event_loop = calloop::EventLoop::<State>::try_new().unwrap();
|
||||
let loop_handle = event_loop.handle();
|
||||
|
|
|
|||
|
|
@ -41,7 +41,10 @@ impl WorkspaceList {
|
|||
|
||||
fn layout(&self) {
|
||||
let imp = imp::WorkspaceList::from_instance(self);
|
||||
let anchor = std::env::var("COSMIC_PANEL_ANCHOR").ok().and_then(|anchor| anchor.parse::<PanelAnchor>().ok()).unwrap_or_default();
|
||||
let anchor = std::env::var("COSMIC_PANEL_ANCHOR")
|
||||
.ok()
|
||||
.and_then(|anchor| anchor.parse::<PanelAnchor>().ok())
|
||||
.unwrap_or_default();
|
||||
|
||||
let list_view = cascade! {
|
||||
ListView::default();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue