mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-25 14:05:41 -05:00
Fix embedded _NET_WM_ICON on X11
Previously the _NET_WM_ICON would use the .ico which was also used for the Windows icon. This icon used the dimensions 256x256, but the maximum supported image size is 192x192, so a new image with the dimensions 64x64 has been added. Since we know the image format anyways, the `image` dependency could also be easily replaced with `png`, which cuts out a few extra unused dependencies.
This commit is contained in:
parent
f016a209b4
commit
37a3198d88
6 changed files with 22 additions and 78 deletions
69
Cargo.lock
generated
69
Cargo.lock
generated
|
@ -35,12 +35,12 @@ dependencies = [
|
||||||
"fnv",
|
"fnv",
|
||||||
"gl_generator",
|
"gl_generator",
|
||||||
"glutin",
|
"glutin",
|
||||||
"image",
|
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
"notify",
|
"notify",
|
||||||
"objc",
|
"objc",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
|
"png",
|
||||||
"serde",
|
"serde",
|
||||||
"serde_json",
|
"serde_json",
|
||||||
"serde_yaml",
|
"serde_yaml",
|
||||||
|
@ -196,12 +196,6 @@ version = "0.1.6"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "bytemuck"
|
|
||||||
version = "1.4.1"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "41aa2ec95ca3b5c54cf73c91acf06d24f4495d5f1b1c12506ae3483d646177ac"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "byteorder"
|
name = "byteorder"
|
||||||
version = "1.3.4"
|
version = "1.3.4"
|
||||||
|
@ -564,16 +558,6 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "deflate"
|
|
||||||
version = "0.8.6"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "73770f8e1fe7d64df17ca66ad28994a0a623ea497fa69486e14984e715c5d174"
|
|
||||||
dependencies = [
|
|
||||||
"adler32",
|
|
||||||
"byteorder",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derivative"
|
name = "derivative"
|
||||||
version = "2.1.1"
|
version = "2.1.1"
|
||||||
|
@ -952,20 +936,6 @@ version = "1.0.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "image"
|
|
||||||
version = "0.23.10"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "985fc06b1304d19c28d5c562ed78ef5316183f2b0053b46763a0b94862373c34"
|
|
||||||
dependencies = [
|
|
||||||
"bytemuck",
|
|
||||||
"byteorder",
|
|
||||||
"num-iter",
|
|
||||||
"num-rational",
|
|
||||||
"num-traits",
|
|
||||||
"png",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "inotify"
|
name = "inotify"
|
||||||
version = "0.7.1"
|
version = "0.7.1"
|
||||||
|
@ -1340,38 +1310,6 @@ dependencies = [
|
||||||
"winapi 0.3.9",
|
"winapi 0.3.9",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-integer"
|
|
||||||
version = "0.1.43"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-iter"
|
|
||||||
version = "0.1.41"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "7a6e6b7c748f995c4c29c5f5ae0248536e04a5739927c74ec0fa564805094b9f"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "num-rational"
|
|
||||||
version = "0.3.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "a5b4d7360f362cfb50dde8143501e6940b22f644be75a4cc90b2d81968908138"
|
|
||||||
dependencies = [
|
|
||||||
"autocfg",
|
|
||||||
"num-integer",
|
|
||||||
"num-traits",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "num-traits"
|
name = "num-traits"
|
||||||
version = "0.2.12"
|
version = "0.2.12"
|
||||||
|
@ -1573,13 +1511,12 @@ checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "png"
|
name = "png"
|
||||||
version = "0.16.7"
|
version = "0.16.8"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "dfe7f9f1c730833200b134370e1d5098964231af8450bce9b78ee3ab5278b970"
|
checksum = "3c3287920cb847dee3de33d301c463fba14dda99db24214ddf93f83d3021f4c6"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bitflags",
|
"bitflags",
|
||||||
"crc32fast",
|
"crc32fast",
|
||||||
"deflate",
|
|
||||||
"miniz_oxide",
|
"miniz_oxide",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ gl_generator = "0.14.0"
|
||||||
xdg = "2"
|
xdg = "2"
|
||||||
|
|
||||||
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
[target.'cfg(not(target_os = "macos"))'.dependencies]
|
||||||
image = { version = "0.23.3", default-features = false, features = ["ico"], optional = true }
|
png = { version = "0.16.8", default-features = false, optional = true }
|
||||||
|
|
||||||
[target.'cfg(target_os = "macos")'.dependencies]
|
[target.'cfg(target_os = "macos")'.dependencies]
|
||||||
objc = "0.2.2"
|
objc = "0.2.2"
|
||||||
|
@ -56,7 +56,7 @@ embed-resource = "1.3"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["wayland", "x11"]
|
default = ["wayland", "x11"]
|
||||||
x11 = ["copypasta/x11", "glutin/x11", "x11-dl", "image"]
|
x11 = ["copypasta/x11", "glutin/x11", "x11-dl", "png"]
|
||||||
wayland = ["copypasta/wayland", "glutin/wayland", "wayland-client"]
|
wayland = ["copypasta/wayland", "glutin/wayland", "wayland-client"]
|
||||||
winpty = ["alacritty_terminal/winpty"]
|
winpty = ["alacritty_terminal/winpty"]
|
||||||
nightly = []
|
nightly = []
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
../extra/windows/alacritty.ico
|
|
1
alacritty/alacritty.png
Symbolic link
1
alacritty/alacritty.png
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../extra/logo/compat/alacritty-term.png
|
|
@ -19,8 +19,15 @@ use {
|
||||||
crate::wayland_theme::AlacrittyWaylandTheme,
|
crate::wayland_theme::AlacrittyWaylandTheme,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#[rustfmt::skip]
|
||||||
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
||||||
use x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib};
|
use {
|
||||||
|
std::io::Cursor,
|
||||||
|
|
||||||
|
x11_dl::xlib::{Display as XDisplay, PropModeReplace, XErrorEvent, Xlib},
|
||||||
|
glutin::window::Icon,
|
||||||
|
png::Decoder,
|
||||||
|
};
|
||||||
|
|
||||||
use std::fmt::{self, Display, Formatter};
|
use std::fmt::{self, Display, Formatter};
|
||||||
|
|
||||||
|
@ -44,11 +51,11 @@ use crate::config::window::{Decorations, WindowConfig};
|
||||||
use crate::config::Config;
|
use crate::config::Config;
|
||||||
use crate::gl;
|
use crate::gl;
|
||||||
|
|
||||||
// It's required to be in this directory due to the `windows.rc` file.
|
/// Window icon for `_NET_WM_ICON` property.
|
||||||
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
#[cfg(all(feature = "x11", not(any(target_os = "macos", windows))))]
|
||||||
static WINDOW_ICON: &[u8] = include_bytes!("../alacritty.ico");
|
static WINDOW_ICON: &[u8] = include_bytes!("../alacritty.png");
|
||||||
|
|
||||||
// This should match the definition of IDI_ICON from `windows.rc`.
|
/// This should match the definition of IDI_ICON from `windows.rc`.
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
const IDI_ICON: WORD = 0x101;
|
const IDI_ICON: WORD = 0x101;
|
||||||
|
|
||||||
|
@ -257,11 +264,11 @@ impl Window {
|
||||||
pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder {
|
pub fn get_platform_window(title: &str, window_config: &WindowConfig) -> WindowBuilder {
|
||||||
#[cfg(feature = "x11")]
|
#[cfg(feature = "x11")]
|
||||||
let icon = {
|
let icon = {
|
||||||
let image = image::load_from_memory_with_format(WINDOW_ICON, image::ImageFormat::Ico)
|
let decoder = Decoder::new(Cursor::new(WINDOW_ICON));
|
||||||
.expect("loading icon")
|
let (info, mut reader) = decoder.read_info().expect("invalid embedded icon");
|
||||||
.to_rgba();
|
let mut buf = vec![0; info.buffer_size()];
|
||||||
let (width, height) = image.dimensions();
|
let _ = reader.next_frame(&mut buf);
|
||||||
glutin::window::Icon::from_rgba(image.into_raw(), width, height)
|
Icon::from_rgba(buf, info.width, info.height)
|
||||||
};
|
};
|
||||||
|
|
||||||
let class = &window_config.class;
|
let class = &window_config.class;
|
||||||
|
|
BIN
extra/logo/compat/alacritty-term.png
Normal file
BIN
extra/logo/compat/alacritty-term.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.5 KiB |
Loading…
Reference in a new issue