Skip to content

Commit

Permalink
Merge pull request #3 from leb-kuchen/improv
Browse files Browse the repository at this point in the history
add copy explanation and show_unicde
  • Loading branch information
leb-kuchen authored May 11, 2024
2 parents f5fec3d + adf27fc commit 14e3a10
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 7 deletions.
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ sudo just install
# Emoji font
`Noto Color Emoji` is the default emoji font and is required by default.
The default can be changed in `~/.config/cosmic/dev.dominiccgeh.CosmicAppletEmojiSelector/v1/font_family`.
A font which supports Unicode 15.1 is generally recommended.
A font which supports Unicode 15.1 is generally recommended.

# Copying emojis
To copy emojis, `data_control` has to be enabled. This can be done in `/etc/cosmic-comp/config.ron`.
Note this grants windowless applications access to your clipboard.
In case this does not meet your security requirements, you can enter the unicode code points manually.
To do so, enable `show_tooltip` and `show_unicode` in `~/.config/cosmic/dev.dominiccgeh.CosmicAppletEmojiSelector/v1/show_tooltip`
`~/.config/cosmic/dev.dominiccgeh.CosmicAppletEmojiSelector/v1/show_unicode` respectivly.
Now press `Shift` + `Ctrl` + `U`, then enter the first code, e.g. `1F1E9`, finally press `Shift` + `Ctrl` to enter the code point.
After that repeat this step for the remaining code points, in this example `1F1EA` and it will output 🇩🇪.
3 changes: 3 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ pub struct Config {
pub last_used: Vec<String>,
#[serde(default)]
pub font_family: String,
#[serde(default)]
pub show_unicode: bool,
}

impl Default for Config {
Expand All @@ -22,6 +24,7 @@ impl Default for Config {
last_used: Vec::new(),
last_used_limit: 20,
font_family: "Noto Color Emoji".into(),
show_unicode: false,
}
}
}
23 changes: 17 additions & 6 deletions src/window.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,22 @@ impl cosmic::Application for Window {
.apply(Element::from);

if self.config.show_tooltip {
let emoji_tooltip = widget::tooltip(
emoji_btn,
emoji.name().to_string(),
widget::tooltip::Position::Top,
);
let tooltip = if !self.config.show_unicode {
emoji.name().to_string()
} else {
format!(
"{} - {}",
emoji.name(),
emoji
.as_str()
.chars()
.map(|c| format!("U+{:X}", c as u32))
.collect::<Vec<_>>()
.join(" ")
)
};
let emoji_tooltip =
widget::tooltip(emoji_btn, tooltip, widget::tooltip::Position::Top);
emoji_btn = emoji_tooltip.into()
}
row = row.push(emoji_btn)
Expand Down Expand Up @@ -319,7 +330,7 @@ impl cosmic::Application for Window {
Some(group) => Box::from(group.emojis()),
None => Box::from(emojis::iter()),
};
// switch back to grid?
// switch back to grid or just flex?
for emojis in chunks(emoji_iter.filter(|emoji| search_filter(emoji, search_regex.as_ref())))
{
grid = grid.push(emoji_row(emojis));
Expand Down

0 comments on commit 14e3a10

Please sign in to comment.