ags: sync

This commit is contained in:
end-4
2024-01-02 15:54:55 +07:00
parent fae6cf50c1
commit 577550642f
14 changed files with 251 additions and 168 deletions
@@ -1,6 +1,6 @@
const { Gdk, Gtk } = imports.gi; const { Gdk, Gtk } = imports.gi;
import { App, SCREEN_WIDTH, SCREEN_HEIGHT, Service, Utils, Variable, Widget } from '../imports.js'; import { App, SCREEN_WIDTH, SCREEN_HEIGHT, Service, Utils, Variable, Widget } from '../imports.js';
const { Box, Button, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget; const { Box, Button, EventBox, Label, Overlay, Revealer, Scrollable, Stack } = Widget;
export const MarginRevealer = ({ export const MarginRevealer = ({
transition = 'slide_down', transition = 'slide_down',
@@ -13,46 +13,41 @@ export const MarginRevealer = ({
}) => { }) => {
const widget = Scrollable({ const widget = Scrollable({
...rest, ...rest,
css: `min-height: 0px;`,
properties: [ properties: [
['revealChild', true], // It'll be set to false after init if it's supposed to hide ['revealChild', true], // It'll be set to false after init if it's supposed to hide
['transition', transition], ['transition', transition],
['show', (self) => { ['show', () => {
if (self._revealChild) return; if (widget._revealChild) return;
self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER); widget.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
child.toggleClassName(hideClass, false); child.toggleClassName(hideClass, false);
child.toggleClassName(showClass, true); child.toggleClassName(showClass, true);
self._revealChild = true; widget._revealChild = true;
child.css = 'margin: 0px;'; child.css = 'margin: 0px;';
}], }],
['hide', (self) => { ['hide', () => {
if (!self._revealChild) return; if (!widget._revealChild) return;
child.toggleClassName(hideClass, true); child.toggleClassName(hideClass, true);
child.toggleClassName(showClass, false); child.toggleClassName(showClass, false);
self._revealChild = false; widget._revealChild = false;
if (self._transition == 'slide_left') if (widget._transition == 'slide_left')
child.css = `margin-right: -${child.get_allocated_width()}px;`; child.css = `margin-right: -${child.get_allocated_width()}px;`;
else if (self._transition == 'slide_right') else if (widget._transition == 'slide_right')
child.css = `margin-left: -${child.get_allocated_width()}px;`; child.css = `margin-left: -${child.get_allocated_width()}px;`;
else if (self._transition == 'slide_up') else if (widget._transition == 'slide_up')
child.css = `margin-bottom: -${child.get_allocated_height()}px;`; child.css = `margin-bottom: -${child.get_allocated_height()}px;`;
else if (self._transition == 'slide_down') else if (widget._transition == 'slide_down')
child.css = `margin-top: -${child.get_allocated_height()}px;`; child.css = `margin-top: -${child.get_allocated_height()}px;`;
}], }],
['toggle', (self) => { ['toggle', () => {
console.log('toggle'); console.log('toggle');
if (self._revealChild) self._hide(self); if (widget._revealChild) widget._hide();
else self._show(self); else widget._show();
}], }],
...extraProperties, ...extraProperties,
], ],
setup: (self) => { child: child,
if (!revealChild) hscroll: (revealChild ? 'never' : 'always'),
self.set_policy(Gtk.PolicyType.ALWAYS, Gtk.PolicyType.ALWAYS); vscroll: (revealChild ? 'never' : 'always'),
else
self.set_policy(Gtk.PolicyType.NEVER, Gtk.PolicyType.NEVER);
self.child = child;
},
}); });
child.toggleClassName(`${revealChild ? showClass : hideClass}`, true); child.toggleClassName(`${revealChild ? showClass : hideClass}`, true);
return widget; return widget;
-1
View File
@@ -7,7 +7,6 @@ const { Box, EventBox, Icon, Overlay, Label, Button, Revealer } = Widget;
import { MaterialIcon } from "./materialicon.js"; import { MaterialIcon } from "./materialicon.js";
import { setupCursorHover } from "./cursorhover.js"; import { setupCursorHover } from "./cursorhover.js";
import { AnimatedCircProg } from "./animatedcircularprogress.js"; import { AnimatedCircProg } from "./animatedcircularprogress.js";
import { MarginRevealer } from './advancedrevealers.js';
function guessMessageType(summary) { function guessMessageType(summary) {
if (summary.includes('recording')) return 'screen_record'; if (summary.includes('recording')) return 'screen_record';
+1 -1
View File
@@ -68,7 +68,7 @@ menu>menuitem:focus {
} }
.separator-line { .separator-line {
background-color: $surfaceVariant; background-color: $outline;
min-width: 0.068rem; min-width: 0.068rem;
min-height: 0.068rem; min-height: 0.068rem;
} }
+9 -4
View File
@@ -490,19 +490,24 @@
.menu-decel { .menu-decel {
@include menu_decel; @include menu_decel;
} }
.element-show { .element-show {
@include element_easeInOut; @include element_easeInOut;
} }
.element-hide { .element-hide {
@include element_easeInOut; @include element_easeInOut;
} }
.element-move {
@include element_easeInOut;
}
.element-decel { .element-decel {
@include element_decel; @include element_decel;
} }
.element-bounceout {
@include element_bounceOut;
}
.element-accel { .element-accel {
@include element_accel; @include element_accel;
} }
.page-move {
@include page_move;
}
+17 -32
View File
@@ -30,56 +30,38 @@ $rounding_large: 1.705rem;
@mixin titlefont { @mixin titlefont {
// Geometric sans-serif // Geometric sans-serif
font-family: font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
'Gabarito',
'Poppins',
'Lexend',
sans-serif;
} }
@mixin mainfont { @mixin mainfont {
// Other clean sans-serif // Other clean sans-serif
font-family: font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter",
'Rubik', "Roboto", "Ubuntu", "Noto Sans", sans-serif;
'Geist',
'AR One Sans',
'Reddit Sans',
'Inter',
'Roboto',
'Ubuntu',
'Noto Sans',
sans-serif;
// font-weight: 500; // font-weight: 500;
} }
@mixin icon-material { @mixin icon-material {
// Material Design Icons // Material Design Icons
font-family: font-family: "Material Symbols Rounded", "Material Symbols Outlined",
'Material Symbols Rounded', "Material Symbols Sharp";
'Material Symbols Outlined',
'Material Symbols Sharp';
} }
@mixin icon-nerd { @mixin icon-nerd {
// Nerd Fonts // Nerd Fonts
font-family: font-family: "SpaceMono NF", "SpaceMono Nerd Font", "JetBrains Mono NF",
'SpaceMono NF', 'SpaceMono Nerd Font', "JetBrains Mono Nerd Font", monospace;
'JetBrains Mono NF', 'JetBrains Mono Nerd Font',
monospace;
} }
@mixin techfont { @mixin techfont {
// Monospace for sys info n stuff. Doesn't have to be a nerd font, but it's cool. // Monospace for sys info n stuff. Doesn't have to be a nerd font, but it's cool.
font-family: 'JetBrains Mono NF', 'JetBrains Mono Nerd Font', 'JetBrains Mono NL', 'SpaceMono NF', 'SpaceMono Nerd Font', monospace; font-family: "JetBrains Mono NF", "JetBrains Mono Nerd Font",
"JetBrains Mono NL", "SpaceMono NF", "SpaceMono Nerd Font", monospace;
} }
@mixin readingfont { @mixin readingfont {
// The most readable fonts, for a comfortable reading experience // The most readable fonts, for a comfortable reading experience
// in stuff like ChatGPT widget // in stuff like ChatGPT widget
font-family: font-family: "Lexend", "Noto Sans", sans-serif;
'Lexend',
'Noto Sans',
sans-serif;
// font-weight: 500; // font-weight: 500;
} }
@@ -91,7 +73,6 @@ $rounding_large: 1.705rem;
color: $actiontext; color: $actiontext;
} }
$elevation_margin: 0.476rem; $elevation_margin: 0.476rem;
@mixin elevation-safe { @mixin elevation-safe {
@@ -164,13 +145,17 @@ $elevation_margin: 0.476rem;
@mixin element_decel { @mixin element_decel {
transition: 300ms cubic-bezier(0, 0.55, 0.45, 1); transition: 300ms cubic-bezier(0, 0.55, 0.45, 1);
} }
@mixin element_bounceOut {
transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
@mixin element_accel { @mixin element_accel {
transition: 300ms cubic-bezier(0.55, 0, 1, 0.45); transition: 300ms cubic-bezier(0.55, 0, 1, 0.45);
} }
@mixin element_easeInOut { @mixin element_easeInOut {
transition: 300ms cubic-bezier(0.85, 0, 0.15, 1); transition: 300ms cubic-bezier(0, 0.55, 0.45, 1);
}
@mixin page_move {
transition: 2000ms cubic-bezier(0, 0.55, 0.45, 1);
} }
@function tint($color, $percentage) { @function tint($color, $percentage) {
+22 -2
View File
@@ -720,6 +720,21 @@ $onChatgpt: $onPrimary;
border: 0.068rem solid $sidebar_chat_textboxareaColor; border: 0.068rem solid $sidebar_chat_textboxareaColor;
} }
.sidebar-chat-chip-toggle {
@include menu_decel;
@include small-rounding;
padding: 0.341rem 0.477rem;
background-color: $surfaceVariant;
color: $onSurfaceVariant;
}
.sidebar-chat-chip-toggle:focus,
.sidebar-chat-chip-toggle:hover {
background-color: mix($surfaceVariant, $onSurfaceVariant, 83%);
}
.sidebar-chat-chip-toggle:active {
background-color: mix($surfaceVariant, $onSurfaceVariant, 67%);
}
.sidebar-pin { .sidebar-pin {
@include small-rounding; @include small-rounding;
@include menu_decel; @include menu_decel;
@@ -779,9 +794,14 @@ $onChatgpt: $onPrimary;
$waifu_image_overlay_transparency: 0.7; $waifu_image_overlay_transparency: 0.7;
.sidebar-waifu-image-action { .sidebar-waifu-image-action {
@include full-rounding; @include full-rounding;
min-width: 1.875rem; min-width: 1.875rem;
min-height: 1.875rem; min-height: 1.875rem;
background-color: rgba(0, 0, 0, $waifu_image_overlay_transparency); // Fixed cuz on image background-color: rgba(
0,
0,
0,
$waifu_image_overlay_transparency
); // Fixed cuz on image
color: rgba(255, 255, 255, $waifu_image_overlay_transparency); color: rgba(255, 255, 255, $waifu_image_overlay_transparency);
} }
.sidebar-waifu-image-action:hover, .sidebar-waifu-image-action:hover,
+19 -4
View File
@@ -5,10 +5,10 @@ import Service from 'resource:///com/github/Aylur/ags/service.js';
// Usage from my python waifu fetcher, for reference // Usage from my python waifu fetcher, for reference
// Usage: waifu-get.py [OPTION]... [TAG]... // Usage: waifu-get.py [OPTION]... [TAG]...
// Options: // Options:
// --segs\tForce NSFW images
// --im\tUse waifu.im API. You can use many tags // --im\tUse waifu.im API. You can use many tags
// --pics\tUse waifu.pics API. Use 1 tag only. // --pics\tUse waifu.pics API. Use 1 tag only.
// --nekos\tUse nekos.life (old) API. No tags. // --nekos\tUse nekos.life (old) API. No tags.
// --segs\tForce NSFW images
// Tags: // Tags:
// waifu.im (type): // waifu.im (type):
@@ -82,11 +82,25 @@ class WaifuService extends Service {
get responses() { return this._responses } get responses() { return this._responses }
fetch(msg) { fetch(msg) {
// Init
const newMessageId = this._responses.length; const newMessageId = this._responses.length;
const taglist = msg.split(' '); const userArgs = msg.split(' ');
let taglist = [];
this._nsfw = false;
// Construct body/headers
for (let i = 0; i < userArgs.length; i++) {
const thisArg = userArgs[i];
if (thisArg == '--im') this._mode = 'im';
else if (thisArg == '--nekos') this._mode = 'nekos';
else if (thisArg.includes('pics')) this._mode = 'pics';
else if (thisArg.includes('segs') || thisArg.includes('sex') || thisArg.includes('lewd')) this._nsfw = true;
else {
taglist.push(thisArg);
if(['ecchi', 'hentai', 'ero', 'ass', 'paizuri', 'oral', 'milf'].includes(thisArg)) this._nsfw = true;
}
}
this._queries.push(taglist); this._queries.push(taglist);
this.emit('newResponse', newMessageId); this.emit('newResponse', newMessageId);
// Construct body/headers
const params = { const params = {
'included_tags': taglist, 'included_tags': taglist,
'height': `>=${this._minHeight}`, 'height': `>=${this._minHeight}`,
@@ -94,12 +108,13 @@ class WaifuService extends Service {
}; };
const paramString = paramStringFromObj(params); const paramString = paramStringFromObj(params);
// Fetch // Fetch
// Note: body isn't included since passing directly to url is more reliable
const options = { const options = {
method: 'GET', method: 'GET',
headers: this._headers[this._mode], headers: this._headers[this._mode],
}; };
var status = 0; var status = 0;
Utils.fetch(`${this._baseUrl}?${paramString}`, options) Utils.fetch(`${this._endpoints[this._mode]}?${paramString}`, options)
.then(result => { .then(result => {
status = result.status; status = result.status;
return result.text(); return result.text();
+84 -60
View File
@@ -24,18 +24,18 @@
min-width: 3rem; } min-width: 3rem; }
.txt-title { .txt-title {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
font-size: 2.045rem; } font-size: 2.045rem; }
.txt-title-small { .txt-title-small {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
font-size: 1.364rem; } font-size: 1.364rem; }
.techfont { .techfont {
font-family: 'JetBrains Mono NF', 'JetBrains Mono Nerd Font', 'JetBrains Mono NL', 'SpaceMono NF', 'SpaceMono Nerd Font', monospace; } font-family: "JetBrains Mono NF", "JetBrains Mono Nerd Font", "JetBrains Mono NL", "SpaceMono NF", "SpaceMono Nerd Font", monospace; }
.txt-reading { .txt-reading {
font-family: 'Lexend', 'Noto Sans', sans-serif; } font-family: "Lexend", "Noto Sans", sans-serif; }
.no-anim { .no-anim {
transition: 0ms; } transition: 0ms; }
@@ -57,47 +57,47 @@
margin: 10px; } margin: 10px; }
.txt-badonkers { .txt-badonkers {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 3rem; } font-size: 3rem; }
.txt-tiddies { .txt-tiddies {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 2.7273rem; } font-size: 2.7273rem; }
.txt-hugerass { .txt-hugerass {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 2.045rem; } font-size: 2.045rem; }
.txt-hugeass { .txt-hugeass {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 1.8182rem; } font-size: 1.8182rem; }
.txt-larger { .txt-larger {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 1.6363rem; } font-size: 1.6363rem; }
.txt-large { .txt-large {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 1.4545rem; } font-size: 1.4545rem; }
.txt-norm { .txt-norm {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 1.2727rem; } font-size: 1.2727rem; }
.txt-small { .txt-small {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 1.0909rem; } font-size: 1.0909rem; }
.txt-smallie { .txt-smallie {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 1rem; } font-size: 1rem; }
.txt-smaller { .txt-smaller {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 0.9091rem; } font-size: 0.9091rem; }
.txt-tiny { .txt-tiny {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 0.7273rem; } font-size: 0.7273rem; }
.txt-poof { .txt-poof {
@@ -119,16 +119,16 @@
font-style: italic; } font-style: italic; }
.titlefont { .titlefont {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; } font-family: "Gabarito", "Poppins", "Lexend", sans-serif; }
.mainfont { .mainfont {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; } font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif; }
.icon-material { .icon-material {
font-family: 'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp'; } font-family: "Material Symbols Rounded", "Material Symbols Outlined", "Material Symbols Sharp"; }
.icon-nerd { .icon-nerd {
font-family: 'SpaceMono NF', 'SpaceMono Nerd Font', 'JetBrains Mono NF', 'JetBrains Mono Nerd Font', monospace; } font-family: "SpaceMono NF", "SpaceMono Nerd Font", "JetBrains Mono NF", "JetBrains Mono Nerd Font", monospace; }
.separator-circle { .separator-circle {
border-radius: 9999px; border-radius: 9999px;
@@ -370,17 +370,26 @@
transition: 300ms cubic-bezier(0.1, 1, 0, 1); } transition: 300ms cubic-bezier(0.1, 1, 0, 1); }
.element-show { .element-show {
transition: 300ms cubic-bezier(0.85, 0, 0.15, 1); } transition: 300ms cubic-bezier(0, 0.55, 0.45, 1); }
.element-hide { .element-hide {
transition: 300ms cubic-bezier(0.85, 0, 0.15, 1); } transition: 300ms cubic-bezier(0, 0.55, 0.45, 1); }
.element-move {
transition: 300ms cubic-bezier(0, 0.55, 0.45, 1); }
.element-decel { .element-decel {
transition: 300ms cubic-bezier(0, 0.55, 0.45, 1); } transition: 300ms cubic-bezier(0, 0.55, 0.45, 1); }
.element-bounceout {
transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1); }
.element-accel { .element-accel {
transition: 300ms cubic-bezier(0.55, 0, 1, 0.45); } transition: 300ms cubic-bezier(0.55, 0, 1, 0.45); }
.page-move {
transition: 2000ms cubic-bezier(0, 0.55, 0.45, 1); }
* { * {
caret-color: #ffc4f5; } caret-color: #ffc4f5; }
* selection { * selection {
@@ -432,7 +441,7 @@ menu > menuitem:focus {
background-color: #4a4147; } background-color: #4a4147; }
.separator-line { .separator-line {
background-color: #3b3338; background-color: #9a8d95;
min-width: 0.068rem; min-width: 0.068rem;
min-height: 0.068rem; } min-height: 0.068rem; }
@@ -634,11 +643,11 @@ tooltip {
margin: 0rem 0.682rem; } margin: 0rem 0.682rem; }
.bar-clock { .bar-clock {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
font-size: 1.2727rem; } font-size: 1.2727rem; }
.bar-date { .bar-date {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
font-size: 1rem; font-size: 1rem;
color: #eae0e4; } color: #eae0e4; }
@@ -710,7 +719,7 @@ tooltip {
.bar-music-playstate-txt { .bar-music-playstate-txt {
transition: 100ms cubic-bezier(0.05, 0.7, 0.1, 1); transition: 100ms cubic-bezier(0.05, 0.7, 0.1, 1);
font-family: 'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp'; } font-family: "Material Symbols Rounded", "Material Symbols Outlined", "Material Symbols Sharp"; }
.bar-music-cover { .bar-music-cover {
background-position: center; background-position: center;
@@ -887,7 +896,7 @@ tooltip {
padding: 1.364rem; } padding: 1.364rem; }
.cheatsheet-key { .cheatsheet-key {
font-family: 'JetBrains Mono NF', 'JetBrains Mono Nerd Font', 'JetBrains Mono NL', 'SpaceMono NF', 'SpaceMono Nerd Font', monospace; font-family: "JetBrains Mono NF", "JetBrains Mono Nerd Font", "JetBrains Mono NL", "SpaceMono NF", "SpaceMono Nerd Font", monospace;
min-height: 1.364rem; min-height: 1.364rem;
min-width: 1.364rem; min-width: 1.364rem;
margin: 0.17rem; margin: 0.17rem;
@@ -920,7 +929,7 @@ tooltip {
background-color: #685e64; } background-color: #685e64; }
.cheatsheet-category-title { .cheatsheet-category-title {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
font-size: 1.705rem; } font-size: 1.705rem; }
.bg-time-box { .bg-time-box {
@@ -961,11 +970,11 @@ tooltip {
border: 0.682rem solid; } border: 0.682rem solid; }
.bg-quicklaunch-title { .bg-quicklaunch-title {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
color: #d1c2cb; } color: #d1c2cb; }
.bg-quicklaunch-btn { .bg-quicklaunch-btn {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
border-radius: 9999px; border-radius: 9999px;
-gtk-outline-radius: 9999px; -gtk-outline-radius: 9999px;
background-color: #3b3338; background-color: #3b3338;
@@ -1067,7 +1076,7 @@ tooltip {
margin-top: 0.341rem; } margin-top: 0.341rem; }
.osd-value-txt { .osd-value-txt {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
font-size: 1.688rem; font-size: 1.688rem;
font-weight: 500; font-weight: 500;
color: #eae0e4; } color: #eae0e4; }
@@ -1209,7 +1218,7 @@ tooltip {
.overview-search-results-txt-cmd { .overview-search-results-txt-cmd {
margin-right: 0.682rem; margin-right: 0.682rem;
font-family: 'JetBrains Mono NF', 'JetBrains Mono Nerd Font', 'JetBrains Mono NL', 'SpaceMono NF', 'SpaceMono Nerd Font', monospace; font-family: "JetBrains Mono NF", "JetBrains Mono Nerd Font", "JetBrains Mono NL", "SpaceMono NF", "SpaceMono Nerd Font", monospace;
font-size: 1.227rem; } font-size: 1.227rem; }
.overview-search-result-btn { .overview-search-result-btn {
@@ -1247,7 +1256,7 @@ tooltip {
background-color: rgba(54, 47, 51, 0.1147); } background-color: rgba(54, 47, 51, 0.1147); }
.overview-tasks-workspace-number { .overview-tasks-workspace-number {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
color: rgba(220, 210, 214, 0.31); } color: rgba(220, 210, 214, 0.31); }
.overview-tasks-window { .overview-tasks-window {
@@ -1781,7 +1790,7 @@ tooltip {
.sidebar-module-btn-arrow { .sidebar-module-btn-arrow {
border-radius: 9999px; border-radius: 9999px;
-gtk-outline-radius: 9999px; -gtk-outline-radius: 9999px;
font-family: 'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp'; font-family: "Material Symbols Rounded", "Material Symbols Outlined", "Material Symbols Sharp";
background-color: rgba(59, 51, 56, 0.31); background-color: rgba(59, 51, 56, 0.31);
min-width: 1.705rem; min-width: 1.705rem;
min-height: 1.705rem; } min-height: 1.705rem; }
@@ -1864,7 +1873,7 @@ tooltip {
background-color: #dbbed2; } background-color: #dbbed2; }
.sidebar-chat-name { .sidebar-chat-name {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
padding: 0.341rem; padding: 0.341rem;
margin-left: -0.136rem; margin-left: -0.136rem;
padding-left: 0.818rem; } padding-left: 0.818rem; }
@@ -1875,7 +1884,7 @@ tooltip {
padding-left: 0.818rem; } padding-left: 0.818rem; }
.sidebar-chat-txt { .sidebar-chat-txt {
font-family: 'Lexend', 'Noto Sans', sans-serif; } font-family: "Lexend", "Noto Sans", sans-serif; }
.sidebar-chat-codeblock { .sidebar-chat-codeblock {
border-radius: 1.159rem; border-radius: 1.159rem;
@@ -1886,7 +1895,7 @@ tooltip {
border: 0.068rem solid rgba(248, 218, 238, 0.07); } border: 0.068rem solid rgba(248, 218, 238, 0.07); }
.sidebar-chat-codeblock-topbar { .sidebar-chat-codeblock-topbar {
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
margin: 0.273rem; margin: 0.273rem;
margin-bottom: 0rem; margin-bottom: 0rem;
background-color: #554050; background-color: #554050;
@@ -1915,7 +1924,7 @@ tooltip {
background-color: #967e8f; } background-color: #967e8f; }
.sidebar-chat-codeblock-code { .sidebar-chat-codeblock-code {
font-family: 'JetBrains Mono NF', 'JetBrains Mono Nerd Font', 'JetBrains Mono NL', 'SpaceMono NF', 'SpaceMono Nerd Font', monospace; font-family: "JetBrains Mono NF", "JetBrains Mono Nerd Font", "JetBrains Mono NL", "SpaceMono NF", "SpaceMono Nerd Font", monospace;
padding: 0.682rem; } padding: 0.682rem; }
.sidebar-chat-divider { .sidebar-chat-divider {
@@ -1965,6 +1974,21 @@ tooltip {
color: #776c73; color: #776c73;
border: 0.068rem solid #776c73; } border: 0.068rem solid #776c73; }
.sidebar-chat-chip-toggle {
transition: 300ms cubic-bezier(0.1, 1, 0, 1);
border-radius: 0.818rem;
-gtk-outline-radius: 0.818rem;
padding: 0.341rem 0.477rem;
background-color: #3b3338;
color: #d1c2cb; }
.sidebar-chat-chip-toggle:focus,
.sidebar-chat-chip-toggle:hover {
background-color: #554b51; }
.sidebar-chat-chip-toggle:active {
background-color: #6d6269; }
.sidebar-pin { .sidebar-pin {
border-radius: 0.818rem; border-radius: 0.818rem;
-gtk-outline-radius: 0.818rem; -gtk-outline-radius: 0.818rem;
@@ -1993,7 +2017,7 @@ tooltip {
background-color: #dda0d4; } background-color: #dda0d4; }
.sidebar-waifu-heading { .sidebar-waifu-heading {
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
padding: 0.341rem; padding: 0.341rem;
margin-left: -0.136rem; margin-left: -0.136rem;
padding-left: 0.818rem; } padding-left: 0.818rem; }
@@ -2002,7 +2026,7 @@ tooltip {
margin-left: 0.682rem; } margin-left: 0.682rem; }
.sidebar-waifu-txt { .sidebar-waifu-txt {
font-family: 'Lexend', 'Noto Sans', sans-serif; font-family: "Lexend", "Noto Sans", sans-serif;
margin-left: 0.682rem; } margin-left: 0.682rem; }
.sidebar-waifu-image { .sidebar-waifu-image {
@@ -2247,9 +2271,9 @@ tooltip {
border-radius: 1.159rem; border-radius: 1.159rem;
-gtk-outline-radius: 1.159rem; -gtk-outline-radius: 1.159rem;
min-width: 29.659rem; min-width: 29.659rem;
background-color: #dae8ed; background-color: #100d10;
padding: 0rem 1.023rem; padding: 0rem 1.023rem;
background: linear-gradient(127deg, rgba(131, 159, 170, 0.7), rgba(131, 159, 170, 0.55) 70.71%), linear-gradient(217deg, rgba(102, 105, 105, 0.7), rgba(102, 105, 105, 0.55) 70.71%), radial-gradient(circle at 0% 100%, #86776E 13%, rgba(0, 0, 0, 0) 100%), linear-gradient(336deg, rgba(144, 134, 123, 0.7), rgba(144, 134, 123, 0.55) 70.71%), linear-gradient(#dae8ed, #dae8ed); } background: linear-gradient(127deg, rgba(47, 41, 46, 0.7), rgba(47, 41, 46, 0.55) 70.71%), linear-gradient(217deg, rgba(78, 68, 75, 0.7), rgba(78, 68, 75, 0.55) 70.71%), radial-gradient(circle at 0% 100%, #554050 13%, rgba(0, 0, 0, 0) 100%), linear-gradient(336deg, rgba(85, 64, 80, 0.7), rgba(85, 64, 80, 0.55) 70.71%), linear-gradient(#100d10, #100d10); }
.osd-music-cover-fallback { .osd-music-cover-fallback {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
@@ -2257,8 +2281,8 @@ tooltip {
-gtk-outline-radius: 0.818rem; -gtk-outline-radius: 0.818rem;
min-width: 7.5rem; min-width: 7.5rem;
min-height: 7.5rem; min-height: 7.5rem;
background-color: rgba(233, 241, 247, 0.3); background-color: rgba(33, 27, 31, 0.31);
color: #0a0b0f; } color: #dad0d5; }
.osd-music-cover { .osd-music-cover {
border-radius: 0.818rem; border-radius: 0.818rem;
@@ -2282,35 +2306,35 @@ tooltip {
.osd-music-title { .osd-music-title {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
font-size: 1.364rem; font-size: 1.364rem;
color: #0a0b0f; } color: #dad0d5; }
.osd-music-artists { .osd-music-artists {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
font-family: 'Rubik', 'Geist', 'AR One Sans', 'Reddit Sans', 'Inter', 'Roboto', 'Ubuntu', 'Noto Sans', sans-serif; font-family: "Rubik", "Geist", "AR One Sans", "Reddit Sans", "Inter", "Roboto", "Ubuntu", "Noto Sans", sans-serif;
font-size: 0.955rem; font-size: 0.955rem;
color: rgba(20, 22, 26, 0.9); } color: rgba(205, 196, 201, 0.9); }
.osd-music-pill { .osd-music-pill {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
border-radius: 9999px; border-radius: 9999px;
-gtk-outline-radius: 9999px; -gtk-outline-radius: 9999px;
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
min-width: 1.833rem; min-width: 1.833rem;
padding: 0.273rem 0.682rem; padding: 0.273rem 0.682rem;
background-color: rgba(139, 149, 154, 0.5); background-color: rgba(55, 46, 53, 0.5);
color: #0a0b0f; } color: #dad0d5; }
.osd-music-controls { .osd-music-controls {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
border-radius: 9999px; border-radius: 9999px;
-gtk-outline-radius: 9999px; -gtk-outline-radius: 9999px;
font-family: 'Gabarito', 'Poppins', 'Lexend', sans-serif; font-family: "Gabarito", "Poppins", "Lexend", sans-serif;
min-width: 1.833rem; min-width: 1.833rem;
padding: 0.205rem; padding: 0.205rem;
background-color: rgba(139, 149, 154, 0.5); background-color: rgba(55, 46, 53, 0.5);
color: #0a0b0f; } color: #dad0d5; }
.osd-music-controlbtn { .osd-music-controlbtn {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
@@ -2321,15 +2345,15 @@ tooltip {
.osd-music-controlbtn:hover, .osd-music-controlbtn:hover,
.osd-music-controlbtn:focus { .osd-music-controlbtn:focus {
background-color: rgba(107, 115, 119, 0.55); } background-color: rgba(96, 87, 93, 0.55); }
.osd-music-controlbtn:active { .osd-music-controlbtn:active {
background-color: rgba(94, 101, 106, 0.575); } background-color: rgba(111, 102, 108, 0.575); }
.osd-music-controlbtn-txt { .osd-music-controlbtn-txt {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
transition: 100ms cubic-bezier(0.05, 0.7, 0.1, 1); transition: 100ms cubic-bezier(0.05, 0.7, 0.1, 1);
font-family: 'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp'; font-family: "Material Symbols Rounded", "Material Symbols Outlined", "Material Symbols Sharp";
font-size: 1.364rem; font-size: 1.364rem;
margin: -0.1rem 0rem; } margin: -0.1rem 0rem; }
@@ -2338,19 +2362,19 @@ tooltip {
min-width: 0.409rem; min-width: 0.409rem;
min-height: 3.068rem; min-height: 3.068rem;
padding: 0.273rem; padding: 0.273rem;
color: #0a0b0f; } color: #dad0d5; }
.osd-music-playstate { .osd-music-playstate {
transition: 300ms cubic-bezier(0.1, 1, 0, 1); transition: 300ms cubic-bezier(0.1, 1, 0, 1);
min-height: 3.068rem; min-height: 3.068rem;
min-width: 3.068rem; min-width: 3.068rem;
border-radius: 10rem; border-radius: 10rem;
background-color: rgba(139, 149, 154, 0.5); background-color: rgba(55, 46, 53, 0.5);
color: #0a0b0f; } color: #dad0d5; }
.osd-music-playstate-btn > label { .osd-music-playstate-btn > label {
transition: 50ms cubic-bezier(0.05, 0.7, 0.1, 1); transition: 50ms cubic-bezier(0.05, 0.7, 0.1, 1);
font-family: 'Material Symbols Rounded', 'Material Symbols Outlined', 'Material Symbols Sharp'; font-family: "Material Symbols Rounded", "Material Symbols Outlined", "Material Symbols Sharp";
font-size: 1.364rem; font-size: 1.364rem;
margin: -0.1rem 0rem; } margin: -0.1rem 0rem; }
+8 -1
View File
@@ -5,6 +5,13 @@ const { execAsync, exec } = Utils;
import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js"; import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
import { showMusicControls } from '../../variables.js'; import { showMusicControls } from '../../variables.js';
function trimTrackTitle(title) {
// Removes stuff like【C93】 at beginning
var pattern = /【[^】]*】/;
var cleanedTitle = title.replace(pattern, '');
return cleanedTitle.trim();
}
const TrackProgress = () => { const TrackProgress = () => {
const _updateProgress = (circprog) => { const _updateProgress = (circprog) => {
const mpris = Mpris.getPlayer(''); const mpris = Mpris.getPlayer('');
@@ -69,7 +76,7 @@ export const ModuleMusic = () => Widget.EventBox({
connections: [[Mpris, label => { connections: [[Mpris, label => {
const mpris = Mpris.getPlayer(''); const mpris = Mpris.getPlayer('');
if (mpris) if (mpris)
label.label = `${mpris.trackTitle}${mpris.trackArtists.join(', ')}`; label.label = `${trimTrackTitle(mpris.trackTitle)}${mpris.trackArtists.join(', ')}`;
else else
label.label = 'No media'; label.label = 'No media';
}]], }]],
@@ -3,7 +3,7 @@ const { GLib, Gtk } = imports.gi;
import { App, Service, Utils, Widget } from '../../imports.js'; import { App, Service, Utils, Widget } from '../../imports.js';
import Audio from 'resource:///com/github/Aylur/ags/service/audio.js'; import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
const { Box, Label, ProgressBar, Revealer } = Widget; const { Box, Label, ProgressBar, Revealer } = Widget;
import { MarginRevealer } from '../../lib/advancedrevealers.js'; import { MarginRevealer } from '../../lib/advancedwidgets.js';
import Brightness from '../../services/brightness.js'; import Brightness from '../../services/brightness.js';
import Indicator from '../../services/indicator.js'; import Indicator from '../../services/indicator.js';
@@ -63,8 +63,8 @@ export default () => MarginRevealer({
hideClass: 'osd-hide', hideClass: 'osd-hide',
connections: [ connections: [
[Indicator, (revealer, value) => { [Indicator, (revealer, value) => {
if(value > -1) revealer._show(revealer); if(value > -1) revealer._show();
else revealer._hide(revealer); else revealer._hide();
}, 'popup'], }, 'popup'],
], ],
child: Box({ child: Box({
@@ -4,7 +4,7 @@ const { exec, execAsync } = Utils;
import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js'; import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
const { Box, EventBox, Icon, Scrollable, Label, Button, Revealer } = Widget; const { Box, EventBox, Icon, Scrollable, Label, Button, Revealer } = Widget;
import { MarginRevealer } from '../../lib/advancedrevealers.js'; import { MarginRevealer } from '../../lib/advancedwidgets.js';
import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js"; import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
import { MaterialIcon } from '../../lib/materialicon.js'; import { MaterialIcon } from '../../lib/materialicon.js';
import { showMusicControls } from '../../variables.js'; import { showMusicControls } from '../../variables.js';
@@ -74,6 +74,12 @@ function getTrackfont(player) {
if (title.includes('東方')) return 'Crimson Text, serif'; // Serif for Touhou stuff if (title.includes('東方')) return 'Crimson Text, serif'; // Serif for Touhou stuff
return DEFAULT_MUSIC_FONT; return DEFAULT_MUSIC_FONT;
} }
function trimTrackTitle(title) {
// Removes stuff like【C93】 at beginning
var pattern = /【[^】]*】/;
var cleanedTitle = title.replace(pattern, '');
return cleanedTitle.trim();
}
const TrackProgress = ({ player, ...rest }) => { const TrackProgress = ({ player, ...rest }) => {
const _updateProgress = (circprog) => { const _updateProgress = (circprog) => {
@@ -102,7 +108,7 @@ const TrackTitle = ({ player, ...rest }) => Label({
className: 'osd-music-title', className: 'osd-music-title',
connections: [[player, (self) => { connections: [[player, (self) => {
// Player name // Player name
self.label = player.trackTitle.length > 0 ? player.trackTitle : 'No media'; self.label = player.trackTitle.length > 0 ? trimTrackTitle(player.trackTitle) : 'No media';
// Font based on track/artist // Font based on track/artist
const fontForThisTrack = getTrackfont(player); const fontForThisTrack = getTrackfont(player);
self.css = `font-family: ${fontForThisTrack}, ${DEFAULT_MUSIC_FONT};`; self.css = `font-family: ${fontForThisTrack}, ${DEFAULT_MUSIC_FONT};`;
@@ -374,8 +380,8 @@ export default () => MarginRevealer({
}), }),
connections: [ connections: [
[showMusicControls, (revealer) => { [showMusicControls, (revealer) => {
if(showMusicControls.value) revealer._show(revealer); if(showMusicControls.value) revealer._show();
else revealer._hide(revealer); else revealer._hide();
}], }],
], ],
}) })
+1 -1
View File
@@ -4,7 +4,7 @@ import Applications from 'resource:///com/github/Aylur/ags/service/applications.
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js'; import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
const { execAsync, exec } = Utils; const { execAsync, exec } = Utils;
import { setupCursorHover, setupCursorHoverGrab } from "../../lib/cursorhover.js"; import { setupCursorHover, setupCursorHoverGrab } from "../../lib/cursorhover.js";
import { DoubleRevealer } from "../../lib/advancedrevealers.js"; import { DoubleRevealer } from "../../lib/advancedwidgets.js";
import { execAndClose, expandTilde, hasUnterminatedBackslash, startsWithNumber, launchCustomCommand, ls } from './miscfunctions.js'; import { execAndClose, expandTilde, hasUnterminatedBackslash, startsWithNumber, launchCustomCommand, ls } from './miscfunctions.js';
import { import {
CalculationResultButton, CustomCommandButton, DirectoryButton, CalculationResultButton, CustomCommandButton, DirectoryButton,
+3 -3
View File
@@ -8,7 +8,7 @@ import { setupCursorHover, setupCursorHoverInfo } from "../../../lib/cursorhover
import { SystemMessage, ChatMessage } from "./chatgpt_chatmessage.js"; import { SystemMessage, ChatMessage } from "./chatgpt_chatmessage.js";
import { ConfigToggle, ConfigSegmentedSelection, ConfigGap } from '../../../lib/configwidgets.js'; import { ConfigToggle, ConfigSegmentedSelection, ConfigGap } from '../../../lib/configwidgets.js';
import { markdownTest } from '../../../lib/md2pango.js'; import { markdownTest } from '../../../lib/md2pango.js';
import { MarginRevealer } from '../../../lib/advancedrevealers.js'; import { MarginRevealer } from '../../../lib/advancedwidgets.js';
export const chatGPTTabIcon = Box({ export const chatGPTTabIcon = Box({
hpack: 'center', hpack: 'center',
@@ -66,10 +66,10 @@ export const chatGPTSettings = MarginRevealer({
revealChild: true, revealChild: true,
connections: [ connections: [
[ChatGPT, (self) => Utils.timeout(200, () => { [ChatGPT, (self) => Utils.timeout(200, () => {
self._hide(self); self._hide();
}), 'newMsg'], }), 'newMsg'],
[ChatGPT, (self) => Utils.timeout(200, () => { [ChatGPT, (self) => Utils.timeout(200, () => {
self._show(self); self._show();
}), 'clear'], }), 'clear'],
], ],
child: Box({ child: Box({
+54 -27
View File
@@ -3,10 +3,12 @@ import { App, Utils, Widget } from '../../../imports.js';
const { Box, Button, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget; const { Box, Button, Entry, EventBox, Icon, Label, Revealer, Scrollable, Stack } = Widget;
const { execAsync, exec } = Utils; const { execAsync, exec } = Utils;
import { MaterialIcon } from "../../../lib/materialicon.js"; import { MaterialIcon } from "../../../lib/materialicon.js";
import { MarginRevealer } from '../../../lib/advancedrevealers.js'; import { MarginRevealer } from '../../../lib/advancedwidgets.js';
import { setupCursorHover, setupCursorHoverInfo } from "../../../lib/cursorhover.js"; import { setupCursorHover, setupCursorHoverInfo } from "../../../lib/cursorhover.js";
import WaifuService from '../../../services/waifus.js'; import WaifuService from '../../../services/waifus.js';
const IMAGE_REVEAL_DELAY = 13; // Some wait for inits n other weird stuff
// Create cache folder and clear pics from previous session // Create cache folder and clear pics from previous session
Utils.exec(`bash -c 'mkdir -p ${GLib.get_user_cache_dir()}/ags/media/waifus'`); Utils.exec(`bash -c 'mkdir -p ${GLib.get_user_cache_dir()}/ags/media/waifus'`);
Utils.exec(`bash -c 'rm ${GLib.get_user_cache_dir()}/ags/media/waifus/*'`); Utils.exec(`bash -c 'rm ${GLib.get_user_cache_dir()}/ags/media/waifus/*'`);
@@ -125,7 +127,7 @@ const WaifuImage = (taglist) => {
const thisBlock = Box({ const thisBlock = Box({
className: 'sidebar-chat-message', className: 'sidebar-chat-message',
properties: [ properties: [
['update', (imageData) => { ['update', (imageData, force = false) => {
blockImageData = imageData; blockImageData = imageData;
const { status, signature, url, source, dominant_color, is_nsfw, width, height, tags } = blockImageData; const { status, signature, url, source, dominant_color, is_nsfw, width, height, tags } = blockImageData;
if (status != 200) { if (status != 200) {
@@ -141,13 +143,15 @@ const WaifuImage = (taglist) => {
const showImage = () => { const showImage = () => {
downloadState.shown = 'done'; downloadState.shown = 'done';
blockImage.css = `background-image:url('${imagePath}');`; blockImage.css = `background-image:url('${imagePath}');`;
blockImageRevealer.revealChild = true; Utils.timeout(IMAGE_REVEAL_DELAY, () => {
Utils.timeout(blockImageRevealer.transitionDuration, blockImageRevealer.revealChild = true;
})
Utils.timeout(IMAGE_REVEAL_DELAY + blockImageRevealer.transitionDuration,
() => blockImage.get_children()[0].revealChild = true () => blockImage.get_children()[0].revealChild = true
); );
downloadIndicator._hide(downloadIndicator); downloadIndicator._hide();
} }
if (Gio.File.new_for_path(imagePath).query_exists(null)) showImage(); if (!force && Gio.File.new_for_path(imagePath).query_exists(null)) showImage();
else Utils.execAsync(['bash', '-c', `wget -O '${imagePath}' '${url}'`]) else Utils.execAsync(['bash', '-c', `wget -O '${imagePath}' '${url}'`])
.then(showImage) .then(showImage)
.catch(print); .catch(print);
@@ -224,27 +228,50 @@ export const waifuView = Scrollable({
} }
}); });
// const waifuTags = Box({ const waifuTags = Revealer({
// className: 'spacing-h-5', revealChild: false,
// children: [ transition: 'crossfade',
// Box({ hexpand: true }), transitionDuration: 150,
// CommandButton('waifu'), child: Box({
// CommandButton('maid'), className: 'spacing-h-5',
// CommandButton('uniform'), children: [
// CommandButton('oppai'), Scrollable({
// CommandButton('selfies'), vscroll: 'never',
// CommandButton('marin-kitagawa'), hscroll: 'automatic',
// CommandButton('raiden-shogun'), hexpand: true,
// CommandButton('mori-calliope'), child: Box({
// ] className: 'spacing-h-5',
// }); children: [
CommandButton('waifu'),
CommandButton('maid'),
CommandButton('uniform'),
CommandButton('oppai'),
CommandButton('selfies'),
CommandButton('marin-kitagawa'),
CommandButton('raiden-shogun'),
CommandButton('mori-calliope'),
]
})
}),
Box({ className: 'separator-line' }),
]
})
});
export const waifuCommands = Box({ export const waifuCommands = Box({
className: 'spacing-h-5', className: 'spacing-h-5',
children: [ setup: (self) => {
Box({ hexpand: true }), self.pack_end(CommandButton('/clear'), false, false, 0);
CommandButton('/clear'), self.pack_start(Button({
] className: 'sidebar-chat-chip-toggle',
setup: setupCursorHover,
label: 'Tags →',
onClicked: () => {
waifuTags.revealChild = !waifuTags.revealChild;
}
}), false, false, 0);
self.pack_start(waifuTags, true, true, 0);
}
}); });
export const sendMessage = (text) => { export const sendMessage = (text) => {
@@ -253,7 +280,7 @@ export const sendMessage = (text) => {
if (text.startsWith('/')) { if (text.startsWith('/')) {
if (text.startsWith('/clear')) { if (text.startsWith('/clear')) {
const kids = waifuContent.get_children(); const kids = waifuContent.get_children();
for (let i = 0; i < kids.length; i++) { for (let i = kids.length - 1; i >= 0; i--) {
const child = kids[i]; const child = kids[i];
child.destroy(); child.destroy();
} }
@@ -261,7 +288,7 @@ export const sendMessage = (text) => {
else if (text.startsWith('/test')) { else if (text.startsWith('/test')) {
const newImage = WaifuImage(['/test']); const newImage = WaifuImage(['/test']);
waifuContent.add(newImage); waifuContent.add(newImage);
Utils.timeout(13, () => newImage._update({ // Needs timeout or inits won't make it Utils.timeout(IMAGE_REVEAL_DELAY, () => newImage._update({ // Needs timeout or inits won't make it
// This is an image uploaded to my github repo // This is an image uploaded to my github repo
status: 200, status: 200,
url: 'https://picsum.photos/400/600', url: 'https://picsum.photos/400/600',
@@ -272,7 +299,7 @@ export const sendMessage = (text) => {
width: 300, width: 300,
height: 200, height: 200,
tags: ['/test'], tags: ['/test'],
})); }, true));
} }
} }
else WaifuService.fetch(text); else WaifuService.fetch(text);