new emoji picker
This commit is contained in:
1 parent
1d69e6c2ce
commit
ad3a167c47
14 files changed
+2434
-7454
No files matched your search
@@ -0,0 +1,253 @@
|
||||
import { RegularWindow } from "apps/window";
|
||||
import { MaterialIcon } from "icons";
|
||||
import Gtk from "gi://Gtk?version=3.0"
|
||||
import { Binding } from "types/service";
|
||||
import { Variable as VType } from "types/variable";
|
||||
import Window from '../../types/widgets/window';
|
||||
|
||||
const jsonData = Utils.readFile(`${App.configDir}/assets/emoji.json`)
|
||||
const hyprland = await Service.import("hyprland")
|
||||
let current_window;
|
||||
|
||||
const emojiData = JSON.parse(jsonData);
|
||||
|
||||
function extractEmojis(data) {
|
||||
const emojis = {};
|
||||
|
||||
Object.values(data).forEach(subgroup => {
|
||||
// @ts-ignore
|
||||
Object.values(subgroup).forEach(emojiGroup => {
|
||||
// @ts-ignore
|
||||
Object.entries(emojiGroup).forEach(([key, value]) => {
|
||||
emojis[key] = value;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
return emojis;
|
||||
}
|
||||
|
||||
const CATEGORY_ICONS = {
|
||||
"smileys-emotion": "mood",
|
||||
"people-body": "emoji_people",
|
||||
"animals-nature": "pets",
|
||||
"food-drink": "emoji_food_beverage",
|
||||
"travel-places": "emoji_transportation",
|
||||
"activities": "sports_soccer",
|
||||
"objects": "emoji_objects",
|
||||
"symbols": "emoji_symbols",
|
||||
"flags": "flag"
|
||||
}
|
||||
|
||||
export async function OpenEmojiPicker() {
|
||||
if (current_window) {
|
||||
const _current_workspace = hyprland.active.workspace.id;
|
||||
const _client = hyprland.clients.find(client => {
|
||||
return (client.class == "com.github.Aylur.ags" && client.title == "Emoji Picker")
|
||||
})
|
||||
if (_client && _current_workspace != _client.workspace.id) {
|
||||
current_window.hide()
|
||||
current_window.show()
|
||||
}
|
||||
else
|
||||
current_window.show()
|
||||
}
|
||||
else
|
||||
EmojisWindow();
|
||||
}
|
||||
|
||||
globalThis.OpenEmojiPicker = OpenEmojiPicker;
|
||||
|
||||
function searchString(str: string, keywords: string) {
|
||||
const searchTerms = keywords.split(' ');
|
||||
|
||||
for (let term of searchTerms) {
|
||||
if (!str.toLowerCase().includes(term.toLowerCase())) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
function SearchPage(search: VType<string>) {
|
||||
const emojiList = extractEmojis(emojiData);
|
||||
const box = Widget.Box({
|
||||
vertical: true,
|
||||
vexpand: true,
|
||||
vpack: "start"
|
||||
});
|
||||
box.hook(search, (self) => {
|
||||
Utils.idle(() => {
|
||||
if (search.value.length == 0)
|
||||
return
|
||||
const flow = Widget.FlowBox();
|
||||
for (const emojiKey in emojiList) {
|
||||
let emoji = emojiList[emojiKey];
|
||||
flow.set_min_children_per_line(5);
|
||||
flow.set_max_children_per_line(25);
|
||||
if (searchString(emojiKey, search.value))
|
||||
flow.add(Widget.Button({
|
||||
class_name: "standard_icon_button emoji",
|
||||
label: emoji,
|
||||
attribute: { emoji: emoji },
|
||||
on_clicked: (self) => {
|
||||
Utils.execAsync(`wl-copy ${self.attribute.emoji}`).catch(print)
|
||||
current_window.hide()
|
||||
},
|
||||
tooltipText: emojiKey.replace(/^e\d+-\d+/, '').replaceAll("-", " ").trim()
|
||||
}))
|
||||
}
|
||||
box.child = flow;
|
||||
})
|
||||
})
|
||||
|
||||
return Widget.Scrollable({
|
||||
child: box,
|
||||
hscroll: "never",
|
||||
vexpand: true
|
||||
});
|
||||
}
|
||||
|
||||
function Page(category) {
|
||||
const box = Widget.Box({
|
||||
vertical: true,
|
||||
vexpand: true,
|
||||
vpack: "start"
|
||||
});
|
||||
for (let subcategoryKey in category) {
|
||||
box.pack_start(
|
||||
Widget.Label({
|
||||
label:
|
||||
subcategoryKey.charAt(0).toUpperCase()
|
||||
+ subcategoryKey.replaceAll("-", " ").slice(1) + ":",
|
||||
class_name: "title",
|
||||
vpack: "start",
|
||||
hpack: "start",
|
||||
}), false, false, 0
|
||||
)
|
||||
const flow = Widget.FlowBox();
|
||||
let emojis = category[subcategoryKey];
|
||||
for (let emojiKey in emojis) {
|
||||
let emoji = emojis[emojiKey];
|
||||
flow.set_min_children_per_line(5);
|
||||
flow.set_max_children_per_line(25);
|
||||
flow.add(Widget.Button({
|
||||
class_name: "standard_icon_button emoji",
|
||||
label: emoji,
|
||||
attribute: { emoji: emoji },
|
||||
on_clicked: (self) => {
|
||||
Utils.execAsync(`wl-copy ${self.attribute.emoji}`).catch(print)
|
||||
current_window.hide()
|
||||
},
|
||||
tooltipText: emojiKey.replace(/^e\d+-\d+/, '').replaceAll("-", " ").trim()
|
||||
}))
|
||||
}
|
||||
box.pack_start(flow, false, false, 0)
|
||||
}
|
||||
return Widget.Scrollable({
|
||||
child: box,
|
||||
hscroll: "never",
|
||||
vexpand: true
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function EmojiList() {
|
||||
const search = Variable("");
|
||||
const current_page = Variable("smileys-emotion");
|
||||
const Button = (icon: string, name: string) => Widget.Button({
|
||||
class_name: "emoji_category standard_icon_button",
|
||||
child: MaterialIcon(icon),
|
||||
setup: (self) => {
|
||||
self.hook(current_page, () => {
|
||||
self.toggleClassName("active", current_page.value == name)
|
||||
})
|
||||
},
|
||||
on_clicked: () => {
|
||||
current_page.setValue(name)
|
||||
}
|
||||
})
|
||||
|
||||
let categories_pages = {
|
||||
"search": SearchPage(search)
|
||||
};
|
||||
let categories_buttons: Gtk.Widget[] = [];
|
||||
for (const name in emojiData) {
|
||||
categories_buttons = [...categories_buttons, Button(CATEGORY_ICONS[name]!, name)];
|
||||
categories_pages[name] = Page(emojiData[name]);
|
||||
}
|
||||
|
||||
const stack = Widget.Stack({
|
||||
children: categories_pages,
|
||||
setup: (self) => {
|
||||
self.hook(current_page, () => {
|
||||
if (self.shown == "search") {
|
||||
entry.text = "";
|
||||
}
|
||||
// @ts-ignore
|
||||
self.shown = current_page.value;
|
||||
});
|
||||
self.hook(search, () => {
|
||||
if (self.shown != "search" && search.value.length > 0) {
|
||||
self.shown = "search";
|
||||
} else if (search.value.length == 0) {
|
||||
// @ts-ignore
|
||||
self.shown = current_page.value;
|
||||
}
|
||||
});
|
||||
},
|
||||
transition: "crossfade"
|
||||
})
|
||||
const entry = Widget.Entry({
|
||||
placeholder_text: "Search",
|
||||
class_name: "search",
|
||||
on_change: (self) => {
|
||||
search.setValue(entry.text!)
|
||||
}
|
||||
})
|
||||
|
||||
return Widget.Box({
|
||||
class_name: "emoji_list",
|
||||
vertical: true,
|
||||
children: [
|
||||
Widget.Scrollable({
|
||||
vscroll: "never",
|
||||
hscroll: "always",
|
||||
child: Widget.Box({
|
||||
class_name: "top_bar",
|
||||
children: [
|
||||
entry,
|
||||
...categories_buttons
|
||||
]
|
||||
})
|
||||
}),
|
||||
stack
|
||||
]
|
||||
})
|
||||
}
|
||||
|
||||
export const EmojisWindow = () => {
|
||||
let window = RegularWindow({
|
||||
title: "Emoji Picker",
|
||||
default_height: 600,
|
||||
default_width: 700,
|
||||
class_name: "emojis",
|
||||
child: EmojiList(),
|
||||
setup(win: any) {
|
||||
current_window = win;
|
||||
win.keybind("Escape", () => {
|
||||
win.close()
|
||||
})
|
||||
},
|
||||
visible: true,
|
||||
});
|
||||
// @ts-ignore
|
||||
window.on("delete-event", () => {
|
||||
// @ts-ignore
|
||||
window.hide()
|
||||
return true
|
||||
})
|
||||
return window
|
||||
}
|
||||
@@ -19,9 +19,13 @@ export async function OpenSettings(cur_tab: string = "network") {
|
||||
return (client.class == "com.github.Aylur.ags" && client.title == "Settings")
|
||||
})
|
||||
if (_client && _current_workspace != _client.workspace.id) {
|
||||
current_window.destroy();
|
||||
current_window = undefined;
|
||||
SettingsWindow(cur_tab);
|
||||
current_tab.setValue(cur_tab)
|
||||
print("a")
|
||||
current_window.hide()
|
||||
current_window.show()
|
||||
// current_window.destroy();
|
||||
// current_window = undefined;
|
||||
// SettingsWindow(cur_tab);
|
||||
}
|
||||
else
|
||||
current_tab.setValue(cur_tab)
|
||||
@@ -124,8 +128,11 @@ export const SettingsWindow = (cur_tab: string) => {
|
||||
default_width: 850,
|
||||
class_name: "settings",
|
||||
child: Settings(cur_tab),
|
||||
setup(win) {
|
||||
setup(win: any) {
|
||||
current_window = win;
|
||||
win.keybind("Escape", () => {
|
||||
win.close()
|
||||
})
|
||||
},
|
||||
visible: true,
|
||||
});
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
File diff suppressed because it is too large.
Load diff
+4
-5
@@ -2,13 +2,13 @@
|
||||
// Import
|
||||
import Gdk from 'gi://Gdk';
|
||||
// widgets
|
||||
//import { Bar, BarCornerTopLeft, BarCornerTopRight } from './modules/bar.ts';
|
||||
import { Bar, BarCornerTopLeft, BarCornerTopRight } from './modules/bar.ts';
|
||||
import { Bar } from './modules/bar.ts';
|
||||
import { Notifications } from "./modules/notificationPopups.ts"
|
||||
import { applauncher } from "./modules/applauncher.js"
|
||||
import { media } from "./modules/media.ts"
|
||||
import { cliphist } from "./modules/cliphist.ts"
|
||||
import { emoji } from "./modules/emoji.ts"
|
||||
import {} from 'apps/emoji/main.ts';
|
||||
import { sidebar } from "./modules/sidebar/main.ts"
|
||||
import { cheatsheet } from './modules/cheatsheet.ts';
|
||||
import {} from 'apps/settings/main.ts';
|
||||
@@ -28,13 +28,12 @@ function forMonitorsAsync(widget: (index: number) => Promise<Window<any, any>>)
|
||||
|
||||
const Windows = () => [
|
||||
forMonitors(Notifications),
|
||||
//forMonitors(BarCornerTopLeft),
|
||||
//forMonitors(BarCornerTopRight),
|
||||
forMonitors(BarCornerTopLeft),
|
||||
forMonitors(BarCornerTopRight),
|
||||
media,
|
||||
applauncher,
|
||||
cliphist,
|
||||
cheatsheet,
|
||||
emoji,
|
||||
sidebar,
|
||||
];
|
||||
|
||||
|
||||
@@ -372,7 +372,6 @@ function OpenSideBar() {
|
||||
class_name: "filled_tonal_button awesome_icon",
|
||||
on_primary_click: () => {
|
||||
App.toggleWindow("sidebar")
|
||||
// Utils.execAsync(["ags", "-t", "sidebar"])
|
||||
},
|
||||
|
||||
on_secondary_click: () => {
|
||||
@@ -404,6 +403,9 @@ function TaskBar() {
|
||||
if (item.initialTitle == "Settings") {
|
||||
icon = "emblem-system-symbolic"
|
||||
}
|
||||
else if (item.initialTitle == "Emoji Picker") {
|
||||
icon = "face-smile-symbolic"
|
||||
}
|
||||
}
|
||||
else
|
||||
icon = getIconNameFromClass(item.class)
|
||||
@@ -537,10 +539,12 @@ export const BarCornerTopLeft = (monitor = 0) => Widget.Window({
|
||||
name: `bar_corner_tl${monitor}`,
|
||||
class_name: "transparent",
|
||||
layer: 'top',
|
||||
anchor: ['top', 'left'],
|
||||
//anchor: ['top', 'left'],
|
||||
anchor: ['bottom', 'left'],
|
||||
exclusivity: 'normal',
|
||||
visible: true,
|
||||
child: RoundedCorner('top_left', { className: 'corner', }),
|
||||
//child: RoundedCorner('top_left', { className: 'corner', }),
|
||||
child: RoundedCorner('bottom_left', { className: 'corner', }),
|
||||
setup: enableClickThrough,
|
||||
});
|
||||
|
||||
@@ -549,10 +553,12 @@ export const BarCornerTopRight = (monitor = 0) => Widget.Window({
|
||||
name: `bar_corner_tr${monitor}`,
|
||||
class_name: "transparent",
|
||||
layer: 'top',
|
||||
anchor: ['top', 'right'],
|
||||
//anchor: ['top', 'right'],
|
||||
anchor: ['bottom', 'right'],
|
||||
exclusivity: 'normal',
|
||||
visible: true,
|
||||
child: RoundedCorner('top_right', { className: 'corner', }),
|
||||
//child: RoundedCorner('top_right', { className: 'corner', }),
|
||||
child: RoundedCorner('bottom_right', { className: 'corner', }),
|
||||
setup: enableClickThrough,
|
||||
});
|
||||
|
||||
@@ -208,3 +208,58 @@
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* Emojis
|
||||
* ----------------------------------------------------- */
|
||||
|
||||
.emojis {
|
||||
background-color: @background;
|
||||
}
|
||||
|
||||
.emojis .emoji_category {
|
||||
font-weight: 300;
|
||||
min-height: 35px;
|
||||
min-width: 35px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.emojis .emoji_category.active {
|
||||
background-color: @secondaryContainer;
|
||||
color: @onSecondaryContainer;
|
||||
}
|
||||
|
||||
.emojis .emoji_category.active .icon {
|
||||
color: @onSecondaryContainer;
|
||||
}
|
||||
|
||||
.emojis .top_bar {
|
||||
background: @surfaceContainer;
|
||||
padding-left: 10px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
}
|
||||
|
||||
.emojis scrollbar {
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
.emojis scrollbar:hover {
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
.emojis .emoji {
|
||||
font-weight: 300;
|
||||
min-height: 35px;
|
||||
min-width: 35px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
.emojis .title {
|
||||
padding-left: 16px;
|
||||
color: @onSurfaceVariant;
|
||||
}
|
||||
|
||||
.emojis button:focus {
|
||||
background-color: transparent;
|
||||
}
|
||||
+11
-27
@@ -401,28 +401,6 @@ window.notification-popups box.notifications {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* Emoji
|
||||
* -----------------------------------------------------*/
|
||||
|
||||
.emoji_box {
|
||||
border-radius: 24px;
|
||||
background-color: @background;
|
||||
border: 2px solid;
|
||||
border-color: @outlineVariant;
|
||||
padding: 11px;
|
||||
}
|
||||
|
||||
.emoji_entry {
|
||||
background-color: @surfaceContainerHigh;
|
||||
color: @onSurface;
|
||||
border: none;
|
||||
outline: none;
|
||||
border-radius: 100px;
|
||||
margin-bottom: 16px;
|
||||
padding: 5px;
|
||||
padding-left: 25px;
|
||||
}
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* Media player
|
||||
@@ -537,9 +515,6 @@ window.notification-popups box.notifications {
|
||||
font-family: "Font Awesome 6 Free";
|
||||
}
|
||||
|
||||
.material_icon {
|
||||
font-family: "Material Symbols Outlined", "Material Symbols Sharp";
|
||||
}
|
||||
|
||||
.battery {
|
||||
background-color: @surfaceContainer;
|
||||
@@ -840,8 +815,7 @@ window.notification-popups box.notifications {
|
||||
background-color: @secondaryContainer;
|
||||
color: @onSecondaryContainer;
|
||||
border-radius: 100px;
|
||||
padding: 0px;
|
||||
padding-left: 6px;
|
||||
min-width: 35px;
|
||||
padding-right: 6px;
|
||||
}
|
||||
|
||||
@@ -1145,3 +1119,13 @@ switch:checked:hover slider, switch:checked:active slider {
|
||||
.cheatsheet .category .awesome_icon.key {
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
|
||||
/* -----------------------------------------------------
|
||||
* Material
|
||||
* ----------------------------------------------------- */
|
||||
|
||||
.material_icon {
|
||||
all: unset;
|
||||
font-family: "Material Symbols Outlined", "Material Symbols Sharp";
|
||||
}
|
||||
@@ -3,9 +3,6 @@
|
||||
# These configs are mostly for laptops. This is addemdum to Keybinds.conf
|
||||
|
||||
$mainMod = SUPER
|
||||
$scriptsDir = $HOME/dotfiles/hypr/scripts
|
||||
$RunCMD = $scriptsDir/RunCMD.sh
|
||||
$UserConfigs = $HOME/dotfiles/hypr/UserConfigs
|
||||
|
||||
#VolumeControl
|
||||
bind = ,XF86MonBrightnessUp, exec, brightnessctl set +5%
|
||||
|
||||
@@ -5,7 +5,7 @@ $wallDIR=$HOME/Pictures/wallpapers
|
||||
|
||||
$RunCMD = $scriptsDir/RunCMD.sh
|
||||
$SwwwRandom = $RunCMD auto_wall
|
||||
$lock = $RunCMD lockscreen
|
||||
|
||||
|
||||
# wallpaper stuff / More wallpaper options below
|
||||
exec-once = swww query || swww-daemon --format xrgb
|
||||
@@ -32,8 +32,7 @@ exec-once = nm-applet --indicator &
|
||||
exec-once = hypridle &
|
||||
exec-once = udiskie &
|
||||
exec-once = pypr &
|
||||
#exec-once = blueman-applet &
|
||||
exec-once = bluetoothctl power off &
|
||||
exec-once = blueman-applet &
|
||||
exec-once = hyprctl setcursor Bibata-Original-Classic 6
|
||||
|
||||
# clipboard manager
|
||||
|
||||
@@ -49,7 +49,7 @@ bind = ALT, COMMA, exec, pypr zoom +1 #! @description: "Increase Zoom"
|
||||
bind = $mainMod, D, exec, ags -t applauncher #! @description: "App Launcher"; @apps;
|
||||
bind = $mainMod_SHIFT, Z, exec, ags -t media #! @description: "Players"; @actions;
|
||||
bind = $mainMod, R, exec, ags -t sidebar #! @description: "Sidebar"; @actions;
|
||||
bind = $mainMod, PERIOD, exec, ags -t emoji #! @description: "Emoji picker"; @apps;
|
||||
bind = $mainMod, PERIOD, exec, ags -r 'OpenEmojiPicker()' #! @description: "Emoji Picker"; @actions;
|
||||
bind = SHIFT_ALT, C, exec, ags -t cliphist #! @description: "Clipboard history"; @actions;
|
||||
bind = $mainMod, W, exec, ags -r "OpenSettings('wallpaper')" #! @description: "Change wallpaper"; @actions;
|
||||
bind = $mainMod_SHIFT, S, exec, ags -r 'OpenSettings()' #! @description: "Setting"; @actions;
|
||||
|
||||
@@ -13,15 +13,18 @@ dwindle {
|
||||
|
||||
master {
|
||||
new_status = master
|
||||
new_on_top=1
|
||||
# new_on_top=1
|
||||
mfact = 0.5
|
||||
smart_resizing = true
|
||||
new_on_active = true
|
||||
drop_at_cursor = true
|
||||
}
|
||||
|
||||
general {
|
||||
sensitivity = 1.00
|
||||
apply_sens_to_raw = 1
|
||||
gaps_in = 2
|
||||
gaps_out = 1
|
||||
gaps_in = 5
|
||||
gaps_out = 14
|
||||
border_size = 0
|
||||
resize_on_border = true
|
||||
|
||||
@@ -32,7 +35,7 @@ general {
|
||||
}
|
||||
|
||||
decoration {
|
||||
rounding = 6
|
||||
rounding = 24
|
||||
|
||||
active_opacity = 1
|
||||
inactive_opacity = 0.9
|
||||
|
||||
@@ -18,6 +18,7 @@ windowrulev2 = noblur,class:^(xwaylandvideobridge)$
|
||||
# Workspace Rules
|
||||
windowrule = workspace 5, ^(.*vlc*)$
|
||||
|
||||
windowrule = stayfocused, ^(com.github.Aylur.ags)$
|
||||
windowrule = float, ^(com.github.Aylur.ags)$
|
||||
|
||||
# MPV
|
||||
|
||||
Reference in new issue
Block a user