sidebar: quick scripts; fix Icon condition race

This commit is contained in:
end-4
2024-02-14 21:11:34 +07:00
parent 06245d13b0
commit bb28c9089c
26 changed files with 895 additions and 128 deletions
@@ -38,12 +38,6 @@ export const DirectoryButton = ({ parentPath, name, type, icon }) => {
homogeneous: true,
child: Widget.Icon({
icon: icon,
setup: (self) => Utils.timeout(1, () => {
const styleContext = self.get_parent().get_style_context();
const width = styleContext.get_property('min-width', Gtk.StateFlags.NORMAL);
const height = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL);
self.size = Math.max(width, height, 1);
})
}),
}),
Widget.Label({
@@ -112,12 +106,6 @@ export const DesktopEntryButton = (app) => {
homogeneous: true,
child: Widget.Icon({
icon: app.iconName,
setup: (self) => Utils.timeout(1, () => {
const styleContext = self.get_parent().get_style_context();
const width = styleContext.get_property('min-width', Gtk.StateFlags.NORMAL);
const height = styleContext.get_property('min-height', Gtk.StateFlags.NORMAL);
self.size = Math.max(width, height, 1);
})
}),
}),
Widget.Label({
@@ -243,11 +243,11 @@ export const SearchAndWindows = () => {
entry.set_position(Math.max(entry.get_position() - 1, 0));
else if (keyval == Gdk.KEY_f)
entry.set_position(Math.min(entry.get_position() + 1, entry.get_text().length));
if (keyval == Gdk.KEY_n) { // simulate Down arrow
else if (keyval == Gdk.KEY_n) { // simulate Down arrow
entry.get_root_window().simulate_key_press(Gdk.KEY_Down, Gdk.ModifierType.NONE);
// entry.get_root_window().simulate_key_release(Gdk.KEY_Down, Gdk.ModifierType.NONE);
}
if (keyval == Gdk.KEY_k) { // Delete to end
else if (keyval == Gdk.KEY_k) { // Delete to end
const text = entry.get_text();
const pos = entry.get_position();
const newText = text.slice(0, pos);