forked from Shinonome/dots-hyprland
fix parallax wall anim ws 1-2
This commit is contained in:
@@ -6,6 +6,7 @@ import { AnimatedCircProg } from "../../lib/animatedcircularprogress.js";
|
|||||||
import { showMusicControls } from '../../variables.js';
|
import { showMusicControls } from '../../variables.js';
|
||||||
|
|
||||||
function trimTrackTitle(title) {
|
function trimTrackTitle(title) {
|
||||||
|
if(!title) return '';
|
||||||
const cleanRegexes = [
|
const cleanRegexes = [
|
||||||
/【[^】]*】/, // Touhou n weeb stuff
|
/【[^】]*】/, // Touhou n weeb stuff
|
||||||
/\[FREE DOWNLOAD\]/, // F-777
|
/\[FREE DOWNLOAD\]/, // F-777
|
||||||
|
|||||||
@@ -16,13 +16,17 @@ const MAX_WORKSPACES = 10;
|
|||||||
const WALLPAPER_OFFSCREEN_X = (WALLPAPER_ZOOM_SCALE - 1) * SCREEN_WIDTH;
|
const WALLPAPER_OFFSCREEN_X = (WALLPAPER_ZOOM_SCALE - 1) * SCREEN_WIDTH;
|
||||||
const WALLPAPER_OFFSCREEN_Y = (WALLPAPER_ZOOM_SCALE - 1) * SCREEN_HEIGHT;
|
const WALLPAPER_OFFSCREEN_Y = (WALLPAPER_ZOOM_SCALE - 1) * SCREEN_HEIGHT;
|
||||||
|
|
||||||
|
function clamp(x, min, max) {
|
||||||
|
return Math.min(Math.max(x, min), max);
|
||||||
|
}
|
||||||
|
|
||||||
export default (monitor = 0) => {
|
export default (monitor = 0) => {
|
||||||
const wallpaperImage = Widget.DrawingArea({
|
const wallpaperImage = Widget.DrawingArea({
|
||||||
attribute: {
|
attribute: {
|
||||||
pixbuf: undefined,
|
pixbuf: undefined,
|
||||||
},
|
},
|
||||||
css: `transition: 2000ms cubic-bezier(0.05, 0.7, 0.1, 1); font-size: 1px;`,
|
css: `transition: 2000ms cubic-bezier(0.05, 0.7, 0.1, 1); font-size: 1px;`,
|
||||||
setup: (self) => {
|
setup: (self) => {
|
||||||
self.set_size_request(SCREEN_WIDTH, SCREEN_HEIGHT);
|
self.set_size_request(SCREEN_WIDTH, SCREEN_HEIGHT);
|
||||||
self
|
self
|
||||||
.hook(Hyprland.active.workspace, (self) =>
|
.hook(Hyprland.active.workspace, (self) =>
|
||||||
@@ -33,7 +37,7 @@ export default (monitor = 0) => {
|
|||||||
const styleContext = self.get_style_context();
|
const styleContext = self.get_style_context();
|
||||||
const workspace = styleContext.get_property('font-size', Gtk.StateFlags.NORMAL);
|
const workspace = styleContext.get_property('font-size', Gtk.StateFlags.NORMAL);
|
||||||
Gdk.cairo_set_source_pixbuf(cr, self.attribute.pixbuf,
|
Gdk.cairo_set_source_pixbuf(cr, self.attribute.pixbuf,
|
||||||
-(WALLPAPER_OFFSCREEN_X / (MAX_WORKSPACES - 1) * (workspace - 1)),
|
-(WALLPAPER_OFFSCREEN_X / (MAX_WORKSPACES - 1) * (clamp(workspace, 1, MAX_WORKSPACES) - 1)),
|
||||||
-WALLPAPER_OFFSCREEN_Y / 2);
|
-WALLPAPER_OFFSCREEN_Y / 2);
|
||||||
cr.paint();
|
cr.paint();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ function getTrackfont(player) {
|
|||||||
return DEFAULT_MUSIC_FONT;
|
return DEFAULT_MUSIC_FONT;
|
||||||
}
|
}
|
||||||
function trimTrackTitle(title) {
|
function trimTrackTitle(title) {
|
||||||
|
if(!title) return '';
|
||||||
const cleanRegexes = [
|
const cleanRegexes = [
|
||||||
/【[^】]*】/, // Touhou n weeb stuff
|
/【[^】]*】/, // Touhou n weeb stuff
|
||||||
/\[FREE DOWNLOAD\]/, // F-777
|
/\[FREE DOWNLOAD\]/, // F-777
|
||||||
|
|||||||
Reference in New Issue
Block a user