Fix resolving paths for .face.icon in dashboard and add home ('~') path support (#606)
* Fix resolving paths for .face.icon in dashboard and add home ('~') path support
* Fix ESLint issues
* Update src/lib/utils.ts
Co-authored-by: davfsa <davfsa@gmail.com>
* Update src/lib/utils.ts
* Rename `resolvePath` to `normalizePath`
* Rename missing reference
---------
Co-authored-by: Jas Singh <jaskiratpal.singh@outlook.com>
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import { bind, exec } from 'astal';
|
||||
import GdkPixbuf from 'gi://GdkPixbuf';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import options from 'src/options.js';
|
||||
import { normalizePath, isAnImage } from 'src/lib/utils.js';
|
||||
|
||||
const { image, name } = options.menus.dashboard.powermenu.avatar;
|
||||
|
||||
@@ -11,12 +11,11 @@ const ProfilePicture = (): JSX.Element => {
|
||||
className={'profile-picture'}
|
||||
halign={Gtk.Align.CENTER}
|
||||
css={bind(image).as((img) => {
|
||||
try {
|
||||
GdkPixbuf.Pixbuf.new_from_file(img);
|
||||
return `background-image: url("${img}")`;
|
||||
} catch {
|
||||
return `background-image: url("${SRC_DIR}/assets/hyprpanel.png")`;
|
||||
if (isAnImage(img)) {
|
||||
return `background-image: url("${normalizePath(img)}")`;
|
||||
}
|
||||
|
||||
return `background-image: url("${SRC_DIR}/assets/hyprpanel.png")`;
|
||||
})}
|
||||
/>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user