update
This commit is contained in:
1 parent
2a4d9f1699
commit
3e0389bcac
8 files changed
+180
-17
No files matched your search
@@ -0,0 +1,59 @@
|
||||
env:
|
||||
es2022: true
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:@typescript-eslint/recommended
|
||||
parser: "@typescript-eslint/parser"
|
||||
parserOptions:
|
||||
ecmaVersion: 2022
|
||||
sourceType: module
|
||||
project: ./tsconfig.json
|
||||
warnOnUnsupportedTypeScriptVersion: false
|
||||
root: true
|
||||
ignorePatterns:
|
||||
- types/
|
||||
plugins:
|
||||
- "@typescript-eslint"
|
||||
rules:
|
||||
"@typescript-eslint/ban-ts-comment":
|
||||
- "off"
|
||||
"@typescript-eslint/no-non-null-assertion":
|
||||
- "off"
|
||||
# "@typescript-eslint/no-explicit-any":
|
||||
# - "off"
|
||||
"@typescript-eslint/no-unused-vars":
|
||||
- error
|
||||
- varsIgnorePattern: (^unused|_$)
|
||||
argsIgnorePattern: ^(unused|_)
|
||||
"@typescript-eslint/no-empty-interface":
|
||||
- "off"
|
||||
indent:
|
||||
- error
|
||||
- 2
|
||||
- SwitchCase: 1
|
||||
linebreak-style:
|
||||
- error
|
||||
- unix
|
||||
quotes:
|
||||
- error
|
||||
- single
|
||||
- avoidEscape: true
|
||||
semi:
|
||||
- error
|
||||
- never
|
||||
no-trailing-spaces:
|
||||
- error
|
||||
globals:
|
||||
pkg: readonly
|
||||
ags: readonly
|
||||
ARGV: readonly
|
||||
imports: readonly
|
||||
print: readonly
|
||||
console: readonly
|
||||
logError: readonly
|
||||
|
||||
App: writable
|
||||
Utils: writable
|
||||
Widget: writable
|
||||
Service: writable
|
||||
Variable: writable
|
||||
@@ -79,7 +79,7 @@ const Wallpaper = (image: string, name: string) => Widget.Button({
|
||||
vpack: "center",
|
||||
class_name: "image",
|
||||
setup(self) {
|
||||
const cache_file = `${GLib.get_home_dir()}/.cache/thumbnails/wallpaper/${name}`;
|
||||
const cache_file = `${GLib.get_home_dir()}/.cache/thumbnails/wallpapers/${name}`;
|
||||
Utils.readFileAsync(cache_file)
|
||||
.catch(() => {
|
||||
Utils.execAsync(`magick ${image} -resize x32 -gravity Center -extent 1:1 ${cache_file}`)
|
||||
@@ -113,15 +113,14 @@ const Wallpaper = (image: string, name: string) => Widget.Button({
|
||||
});
|
||||
|
||||
function CacheThumbnails() {
|
||||
Utils.execAsync(`mkdir -p ${GLib.get_home_dir()}/.cache/thumbnails/wallpaper`)
|
||||
Utils.execAsync(`mkdir -p ${GLib.get_home_dir()}/.cache/thumbnails/wallpapers`)
|
||||
.catch(print)
|
||||
const link_directory = `${App.configDir}/wallpaper`;
|
||||
const original_directory = `${GLib.get_home_dir()}/wallpaper`;
|
||||
const original_directory = `${GLib.get_home_dir()}/Pictures/wallpapers`;
|
||||
const extensions = [".jpg", ".jpeg", ".png"];
|
||||
const fileList = listFilesByExtensions(link_directory, extensions);
|
||||
const fileList = listFilesByExtensions(original_directory, extensions);
|
||||
fileList.forEach((value, index) => {
|
||||
const path = `${original_directory}/${value}`
|
||||
const cache_file = `${GLib.get_home_dir()}/.cache/thumbnails/wallpaper/${value}`;
|
||||
const cache_file = `${GLib.get_home_dir()}/.cache/thumbnails/wallpapers/${value}`;
|
||||
Utils.idle(() => {
|
||||
Utils.readFileAsync(cache_file)
|
||||
.catch(() => {
|
||||
@@ -135,12 +134,11 @@ function CacheThumbnails() {
|
||||
CacheThumbnails()
|
||||
|
||||
const WallpaperList = () => {
|
||||
Utils.execAsync(`mkdir -p ${GLib.get_home_dir()}/.cache/thumbnails/wallpaper`)
|
||||
Utils.execAsync(`mkdir -p ${GLib.get_home_dir()}/.cache/thumbnails/wallpapers`)
|
||||
.then();
|
||||
const link_directory = `${App.configDir}/wallpaper`;
|
||||
const original_directory = `${GLib.get_home_dir()}/Pictures/wallpapers`;
|
||||
const extensions = [".jpg", ".jpeg", ".png"];
|
||||
let fileList = listFilesByExtensions(link_directory, extensions);
|
||||
let fileList = listFilesByExtensions(original_directory, extensions);
|
||||
let [l_fileList, r_fileList] = splitListInHalf(fileList);
|
||||
const box = Widget.Box({
|
||||
vertical: false,
|
||||
|
||||
@@ -73,11 +73,6 @@ Utils.monitorFile(
|
||||
ReloadCSS
|
||||
)
|
||||
|
||||
Utils.monitorFile(
|
||||
`${GLib.get_home_dir()}/.cache/material/colors.json`,
|
||||
ReloadCSS
|
||||
)
|
||||
|
||||
Utils.monitorFile(
|
||||
`${GLib.get_home_dir()}/.config/gtk-3.0/gtk.css`,
|
||||
ReloadGtkCSS
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
const WINDOW_NAME = "musicplayer";
|
||||
import popupwindow from './misc/popupwindow.ts';
|
||||
import Box from 'types/widgets/box.js';
|
||||
import Gtk from "gi://Gtk?version=3.0";
|
||||
import GLib from "gi://GLib?version=2.0";
|
||||
|
||||
type Track = {
|
||||
id: string;
|
||||
title: string;
|
||||
artist: string;
|
||||
url: string; // Assuming we use URLs for identification, but not playback.
|
||||
};
|
||||
|
||||
function MusicPlayerItem(track: Track) {
|
||||
let button = Widget.Button({
|
||||
class_name: "track_container",
|
||||
child: Widget.Label({
|
||||
label: `${track.title} - ${track.artist}`,
|
||||
class_name: "track_label",
|
||||
xalign: 0,
|
||||
vpack: "center",
|
||||
truncate: "end",
|
||||
})
|
||||
});
|
||||
|
||||
button.connect('clicked', () => {
|
||||
playTrack(track); // Function to handle playback
|
||||
});
|
||||
|
||||
return Widget.Box({
|
||||
orientation: Gtk.Orientation.VERTICAL,
|
||||
children: [
|
||||
button,
|
||||
Widget.Separator({
|
||||
orientation: Gtk.Orientation.HORIZONTAL
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
async function playTrack(track: Track) {
|
||||
try {
|
||||
// Placeholder for playing audio via libcanberra or other suitable GTK audio APIs
|
||||
GLib.spawn_command_line_async(`canberra-gtk-play -i audio-file-id`);
|
||||
} catch (error) {
|
||||
console.error(`Error playing track: ${error}`);
|
||||
}
|
||||
}
|
||||
|
||||
function MusicPlayerWidget({ width = 500, height = 500, spacing = 12 }) {
|
||||
let tracks: Track[] = [
|
||||
{ id: "1", title: "Track 1", artist: "Artist 1", url: "1" },
|
||||
{ id: "2", title: "Track 2", artist: "Artist 2", url: "2" },
|
||||
{ id: "3", title: "Track 3", artist: "Artist 3", url: "3" }
|
||||
// Add more tracks as needed
|
||||
];
|
||||
|
||||
let widgets: Box<any, any>[] = tracks.map(track => MusicPlayerItem(track));
|
||||
|
||||
const list = Widget.Box({
|
||||
vertical: true,
|
||||
spacing,
|
||||
children: widgets
|
||||
});
|
||||
|
||||
const entry = Widget.Entry({
|
||||
hexpand: true,
|
||||
class_name: "musicplayer_entry",
|
||||
placeholder_text: "Search",
|
||||
|
||||
on_change: ({ text }) => widgets.forEach(item => {
|
||||
item.visible = item.attribute.content.match(text ?? "")
|
||||
}),
|
||||
});
|
||||
|
||||
return Widget.Box({
|
||||
vertical: true,
|
||||
class_name: "musicplayer_box",
|
||||
margin_top: 14,
|
||||
margin_right: 14,
|
||||
children: [
|
||||
entry,
|
||||
Widget.Scrollable({
|
||||
hscroll: "never",
|
||||
css: `min-width: ${width}px;`
|
||||
+ `min-height: ${height}px;`,
|
||||
child: list,
|
||||
}),
|
||||
],
|
||||
setup: self => self.hook(App, (_, windowName, visible) => {
|
||||
if (windowName !== WINDOW_NAME)
|
||||
return;
|
||||
|
||||
if (visible) {
|
||||
entry.text = "";
|
||||
}
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
export const musicplayer = popupwindow({
|
||||
name: WINDOW_NAME,
|
||||
class_name: "musicplayer",
|
||||
visible: false,
|
||||
keymode: "exclusive",
|
||||
child: MusicPlayerWidget({
|
||||
width: 500,
|
||||
height: 500,
|
||||
spacing: 0,
|
||||
}),
|
||||
anchor: ["bottom", "right"]
|
||||
});
|
||||
@@ -708,7 +708,7 @@ window.notification-popups box.notifications {
|
||||
}
|
||||
|
||||
.system_scale.backlight slider {
|
||||
background-image: -gtk-scaled(url("svg/brightness-onPrimary.svg"));
|
||||
background-image: -gtk-scaled(url("../hypr/assets/svg/brightness-onPrimary.svg"));
|
||||
}
|
||||
|
||||
.system_scale.backlight {
|
||||
@@ -716,7 +716,7 @@ window.notification-popups box.notifications {
|
||||
}
|
||||
|
||||
.system_scale.brightness slider {
|
||||
background-image: -gtk-scaled(url("svg/dark-onPrimary.svg"));
|
||||
background-image: -gtk-scaled(url("../hypr/assets/svg/dark-onPrimary.svg"));
|
||||
}
|
||||
|
||||
.system_scale {
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
/home/sankalp/Pictures/wallpapers
|
||||
File renamed without changes.
|
Before Width: | Height: | Size: 3.0 KiB After Width: | Height: | Size: 3.0 KiB |
File renamed without changes.
|
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 793 B |
Reference in new issue
Block a user