From 8d16a5ada3d06138470729c8f614e8cc13c40ca8 Mon Sep 17 00:00:00 2001 From: Marcin Puc Date: Fri, 28 Jul 2023 16:46:56 +0200 Subject: [PATCH] New package: halloy-2023.3 --- srcpkgs/halloy/patches/add-app-id.patch | 450 ++++++++++++++++++++++++ srcpkgs/halloy/template | 21 ++ 2 files changed, 471 insertions(+) create mode 100644 srcpkgs/halloy/patches/add-app-id.patch create mode 100644 srcpkgs/halloy/template diff --git a/srcpkgs/halloy/patches/add-app-id.patch b/srcpkgs/halloy/patches/add-app-id.patch new file mode 100644 index 000000000000..74ec4eb84ccd --- /dev/null +++ b/srcpkgs/halloy/patches/add-app-id.patch @@ -0,0 +1,450 @@ +From 58146dc23caa941ca8bd406779950c77a00c8469 Mon Sep 17 00:00:00 2001 +From: Cory Forsstrom +Date: Fri, 28 Jul 2023 08:38:03 -0700 +Subject: [PATCH 1/3] Add application id to linux window + +--- + Cargo.lock | 53 +++++++++++++++++------------- + Cargo.toml | 4 +-- + data/src/environment.rs | 1 + + src/main.rs | 51 ++--------------------------- + src/widget/input.rs | 2 ++ + src/widget/selectable_text.rs | 1 + + src/window.rs | 61 +++++++++++++++++++++++++++++++++++ + 7 files changed, 101 insertions(+), 72 deletions(-) + create mode 100644 src/window.rs + +diff --git a/Cargo.lock b/Cargo.lock +index 4d175e6..5d545ee 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -70,6 +70,12 @@ version = "0.1.3" + source = "registry+https://github.com/rust-lang/crates.io-index" + checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" + ++[[package]] ++name = "allocator-api2" ++version = "0.2.16" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" ++ + [[package]] + name = "android-activity" + version = "0.4.1" +@@ -449,8 +455,9 @@ dependencies = [ + + [[package]] + name = "cosmic-text" +-version = "0.8.0" +-source = "git+https://github.com/hecrj/cosmic-text.git?rev=c3cd24dc972bb8fd55d016c81ac9fa637e0a4ada#c3cd24dc972bb8fd55d016c81ac9fa637e0a4ada" ++version = "0.9.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "b0b68966c2543609f8d92f9d33ac3b719b2a67529b0c6c0b3e025637b477eef9" + dependencies = [ + "aliasable", + "fontdb", +@@ -654,9 +661,9 @@ dependencies = [ + + [[package]] + name = "etagere" +-version = "0.2.7" ++version = "0.2.8" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "6301151a318f367f392c31395beb1cfba5ccd9abc44d1db0db3a4b27b9601c89" ++checksum = "fcf22f748754352918e082e0039335ee92454a5d62bcaf69b5e8daf5907d9644" + dependencies = [ + "euclid", + "svg_fmt", +@@ -920,8 +927,9 @@ dependencies = [ + + [[package]] + name = "glyphon" +-version = "0.2.0" +-source = "git+https://github.com/hecrj/glyphon.git?rev=8324f20158a62f8520bad4ed09f6aa5552f8f2a6#8324f20158a62f8520bad4ed09f6aa5552f8f2a6" ++version = "0.3.0" ++source = "registry+https://github.com/rust-lang/crates.io-index" ++checksum = "5e87caa7459145f5e5f167bf34db4532901404c679e62339fb712a0e3ccf722a" + dependencies = [ + "cosmic-text", + "etagere", +@@ -1032,11 +1040,12 @@ dependencies = [ + + [[package]] + name = "hashbrown" +-version = "0.13.2" ++version = "0.14.0" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" ++checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + dependencies = [ + "ahash 0.8.3", ++ "allocator-api2", + ] + + [[package]] +@@ -1107,7 +1116,7 @@ dependencies = [ + [[package]] + name = "iced" + version = "0.9.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "iced_core", + "iced_futures", +@@ -1121,7 +1130,7 @@ dependencies = [ + [[package]] + name = "iced_core" + version = "0.9.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "bitflags 1.3.2", + "instant", +@@ -1134,7 +1143,7 @@ dependencies = [ + [[package]] + name = "iced_futures" + version = "0.6.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "futures", + "iced_core", +@@ -1147,7 +1156,7 @@ dependencies = [ + [[package]] + name = "iced_graphics" + version = "0.8.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "bitflags 1.3.2", + "bytemuck", +@@ -1164,7 +1173,7 @@ dependencies = [ + [[package]] + name = "iced_renderer" + version = "0.1.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "iced_graphics", + "iced_tiny_skia", +@@ -1177,7 +1186,7 @@ dependencies = [ + [[package]] + name = "iced_runtime" + version = "0.1.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "iced_core", + "iced_futures", +@@ -1187,7 +1196,7 @@ dependencies = [ + [[package]] + name = "iced_style" + version = "0.8.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "iced_core", + "once_cell", +@@ -1197,7 +1206,7 @@ dependencies = [ + [[package]] + name = "iced_tiny_skia" + version = "0.1.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "bytemuck", + "cosmic-text", +@@ -1214,7 +1223,7 @@ dependencies = [ + [[package]] + name = "iced_wgpu" + version = "0.10.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "bitflags 1.3.2", + "bytemuck", +@@ -1234,7 +1243,7 @@ dependencies = [ + [[package]] + name = "iced_widget" + version = "0.1.0" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "iced_renderer", + "iced_runtime", +@@ -1248,7 +1257,7 @@ dependencies = [ + [[package]] + name = "iced_winit" + version = "0.9.1" +-source = "git+https://github.com/iced-rs/iced?rev=fd077918db7643530c3a7318ed5777d2f3d8761b#fd077918db7643530c3a7318ed5777d2f3d8761b" ++source = "git+https://github.com/iced-rs/iced?rev=78dc341ea82449f1e075e37e67c1ccf66b88e8d6#78dc341ea82449f1e075e37e67c1ccf66b88e8d6" + dependencies = [ + "iced_graphics", + "iced_runtime", +@@ -1506,11 +1515,11 @@ checksum = "518ef76f2f87365916b142844c16d8fefd85039bc5699050210a7778ee1cd1de" + + [[package]] + name = "lru" +-version = "0.9.0" ++version = "0.11.0" + source = "registry+https://github.com/rust-lang/crates.io-index" +-checksum = "71e7d46de488603ffdd5f30afbc64fbba2378214a2c3a2fb83abf3d33126df17" ++checksum = "eedb2bdbad7e0634f83989bf596f497b070130daaa398ab22d84c39e266deec5" + dependencies = [ +- "hashbrown 0.13.2", ++ "hashbrown 0.14.0", + ] + + [[package]] +diff --git a/Cargo.toml b/Cargo.toml +index eb82391..410a3dc 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -40,5 +40,5 @@ members = [ + ] + + [patch.crates-io] +-iced = { git = "https://github.com/iced-rs/iced", rev = "fd077918db7643530c3a7318ed5777d2f3d8761b" } +-iced_core = { git = "https://github.com/iced-rs/iced", rev = "fd077918db7643530c3a7318ed5777d2f3d8761b" } ++iced = { git = "https://github.com/iced-rs/iced", rev = "78dc341ea82449f1e075e37e67c1ccf66b88e8d6" } ++iced_core = { git = "https://github.com/iced-rs/iced", rev = "78dc341ea82449f1e075e37e67c1ccf66b88e8d6" } +diff --git a/data/src/environment.rs b/data/src/environment.rs +index 4cedf93..b1c4189 100644 +--- a/data/src/environment.rs ++++ b/data/src/environment.rs +@@ -4,6 +4,7 @@ use std::path::PathBuf; + pub const VERSION: &str = env!("VERSION"); + pub const GIT_HASH: Option<&str> = option_env!("GIT_HASH"); + pub const CONFIG_FILE_NAME: &str = "config.yaml"; ++pub const APPLICATION_ID: &str = "org.squidowl.halloy"; + + pub fn formatted_version() -> String { + let hash = GIT_HASH +diff --git a/src/main.rs b/src/main.rs +index d1fd868..05d593f 100644 +--- a/src/main.rs ++++ b/src/main.rs +@@ -10,6 +10,7 @@ mod screen; + mod stream; + mod theme; + mod widget; ++mod window; + + use std::env; + use std::time::{Duration, Instant}; +@@ -17,7 +18,7 @@ use std::time::{Duration, Instant}; + use data::config::{self, Config}; + use data::{environment, server}; + use iced::widget::container; +-use iced::{executor, window, Application, Command, Length, Subscription}; ++use iced::{executor, Application, Command, Length, Subscription}; + use screen::{dashboard, help, welcome}; + + use self::event::{events, Event}; +@@ -66,50 +67,6 @@ pub fn main() -> iced::Result { + } + } + +-#[cfg(not(any(target_os = "macos", target_os = "ios", windows)))] +-fn window_settings() -> iced::window::Settings { +- Default::default() +-} +- +-#[cfg(target_os = "macos")] +-fn window_settings() -> iced::window::Settings { +- iced::window::Settings { +- platform_specific: iced::window::PlatformSpecific { +- title_hidden: true, +- titlebar_transparent: true, +- fullsize_content_view: true, +- }, +- ..Default::default() +- } +-} +- +-#[cfg(target_os = "windows")] +-fn window_settings() -> iced::window::Settings { +- use image::EncodableLayout; +- +- let img = image::load_from_memory_with_format( +- include_bytes!("../assets/logo.png"), +- image::ImageFormat::Png, +- ); +- match img { +- Ok(img) => match img.as_rgba8() { +- Some(icon) => iced::window::Settings { +- icon: window::icon::from_rgba( +- icon.as_bytes().to_vec(), +- icon.width(), +- icon.height(), +- ) +- .ok(), +- ..Default::default() +- }, +- None => Default::default(), +- }, +- Err(_) => iced::window::Settings { +- ..Default::default() +- }, +- } +-} +- + fn settings( + config_load: Result, + ) -> iced::Settings> { +@@ -123,9 +80,7 @@ fn settings( + iced::Settings { + default_font: font::MONO.clone().into(), + default_text_size, +- window: iced::window::Settings { +- ..window_settings() +- }, ++ window: window::settings(), + exit_on_close_request: false, + flags: config_load, + id: None, +diff --git a/src/widget/input.rs b/src/widget/input.rs +index 55626e8..a28544a 100644 +--- a/src/widget/input.rs ++++ b/src/widget/input.rs +@@ -3,6 +3,7 @@ use data::{input, Buffer, Command}; + use iced::advanced::widget::{self, Operation}; + pub use iced::widget::text_input::{focus, move_cursor_to_end}; + use iced::widget::{component, container, row, text, text_input, Component}; ++use iced::Rectangle; + + use self::completion::Completion; + use super::{anchored_overlay, key_press, Element, Renderer}; +@@ -256,6 +257,7 @@ pub fn reset(id: impl Into) -> iced::Command, ++ _bounds: Rectangle, + operate_on_children: &mut dyn FnMut(&mut dyn Operation), + ) { + operate_on_children(self) +diff --git a/src/widget/selectable_text.rs b/src/widget/selectable_text.rs +index 4650a8b..1a3c57d 100644 +--- a/src/widget/selectable_text.rs ++++ b/src/widget/selectable_text.rs +@@ -478,6 +478,7 @@ pub fn selected(f: fn(Vec<(f32, String)>) -> Message) -> Comma + fn container( + &mut self, + _id: Option<&widget::Id>, ++ _bounds: Rectangle, + operate_on_children: &mut dyn FnMut(&mut dyn Operation), + ) { + operate_on_children(self) +diff --git a/src/window.rs b/src/window.rs +new file mode 100644 +index 0000000..094fa37 +--- /dev/null ++++ b/src/window.rs +@@ -0,0 +1,61 @@ ++pub use iced::window::{close, Settings}; ++ ++#[cfg(not(any(target_os = "macos", target_os = "linux", target_os = "windows")))] ++pub fn settings() -> Settings { ++ Default::default() ++} ++ ++#[cfg(target_os = "linux")] ++pub fn settings() -> Settings { ++ use data::environment; ++ use iced::window; ++ ++ Settings { ++ platform_specific: window::PlatformSpecific { ++ application_id: environment::APPLICATION_ID.to_string(), ++ }, ++ ..Default::default() ++ } ++} ++ ++#[cfg(target_os = "macos")] ++pub fn settings() -> Settings { ++ use iced::window; ++ ++ Settings { ++ platform_specific: window::PlatformSpecific { ++ title_hidden: true, ++ titlebar_transparent: true, ++ fullsize_content_view: true, ++ }, ++ ..Default::default() ++ } ++} ++ ++#[cfg(target_os = "windows")] ++pub fn settings() -> Settings { ++ use iced::window; ++ use image::EncodableLayout; ++ ++ let img = image::load_from_memory_with_format( ++ include_bytes!("../assets/logo.png"), ++ image::ImageFormat::Png, ++ ); ++ match img { ++ Ok(img) => match img.as_rgba8() { ++ Some(icon) => Settings { ++ icon: window::icon::from_rgba( ++ icon.as_bytes().to_vec(), ++ icon.width(), ++ icon.height(), ++ ) ++ .ok(), ++ ..Default::default() ++ }, ++ None => Default::default(), ++ }, ++ Err(_) => Settings { ++ ..Default::default() ++ }, ++ } ++} + +From 0bcd3f9b7cf174106831f245c20b942771857400 Mon Sep 17 00:00:00 2001 +From: Cory Forsstrom +Date: Fri, 28 Jul 2023 08:47:31 -0700 +Subject: [PATCH 2/3] Change WMClass in desktop file + +--- + assets/halloy.desktop | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/assets/halloy.desktop b/assets/halloy.desktop +index 07dbeaa..7e2cdb7 100644 +--- a/assets/halloy.desktop ++++ b/assets/halloy.desktop +@@ -6,6 +6,6 @@ Keywords=IM;Chat; + Categories=Network;IRCClient; + Exec=halloy + Icon=org.squidowl.halloy +-StartupWMClass=halloy ++StartupWMClass=org.squidowl.halloy + MimeType=x-scheme-handler/irc;x-scheme-handler/ircs; + Terminal=false + +From 0b85308efa38ff92ab1fbd04a8e581e86f31a3fd Mon Sep 17 00:00:00 2001 +From: Cory Forsstrom +Date: Fri, 28 Jul 2023 08:47:35 -0700 +Subject: [PATCH 3/3] Update CHANGELOG + +--- + CHANGELOG.md | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/CHANGELOG.md b/CHANGELOG.md +index 746f8ea..cf3fd22 100644 +--- a/CHANGELOG.md ++++ b/CHANGELOG.md +@@ -1,5 +1,9 @@ + # Unreleased + ++Fixed: ++ ++- Set the window application id on Linux to `org.squidowl.halloy` ++ + # 2023.3 (2023-07-27) + + **Message history and dashboard state will be reset due to a breaking change. We've switched to a more flexible storage format diff --git a/srcpkgs/halloy/template b/srcpkgs/halloy/template new file mode 100644 index 000000000000..a659212a870e --- /dev/null +++ b/srcpkgs/halloy/template @@ -0,0 +1,21 @@ +# Template file for 'halloy' +pkgname=halloy +version=2023.3 +revision=1 +build_style=cargo +hostmakedepends="pkg-config" +makedepends="libglvnd-devel openssl-devel wayland-devel" +short_desc="IRC application" +maintainer="Marcin Puc " +license="GPL-3.0-or-later" +homepage="https://github.com/squidowl/halloy" +changelog="https://raw.githubusercontent.com/squidowl/halloy/main/CHANGELOG.md" +distfiles="https://github.com/squidowl/halloy/archive/refs/tags/${version}.tar.gz" +checksum=1158104d70c3d4be01c591493a2629c3f03a3071239f14e790455c4ade03c02e + +post_install() { + vinstall assets/halloy.appdata.xml 644 usr/share/metainfo org.squidowl.halloy.appdata.xml + vinstall assets/halloy.desktop 644 usr/share/applications org.squidowl.halloy.desktop + vinstall assets/logo_128px.png 644 usr/share/icons/hicolor/128x128/apps org.squidowl.halloy.png + vsconf config.yaml +}