Made the profile image avatar in the dashboard configurable (size, radius). (#212)

This commit is contained in:
Jas Singh
2024-08-31 12:48:32 -07:00
committed by GitHub
parent e050e2ff2d
commit 44fddbcc14
4 changed files with 15 additions and 6 deletions

View File

@@ -35,15 +35,15 @@ const Profile = () => {
hexpand: true, hexpand: true,
vertical: true, vertical: true,
children: [ children: [
Widget.Icon({ Widget.Box({
hpack: "center", hpack: "center",
class_name: "profile-picture", class_name: "profile-picture",
icon: image.bind("value").as(i => { css: image.bind("value").as(i => {
try { try {
GdkPixbuf.Pixbuf.new_from_file(i); GdkPixbuf.Pixbuf.new_from_file(i);
return i; return `background-image: url("${i}")`
} catch { } catch {
return "avatar-default-symbolic"; return `background-image: url("${App.configDir}/assets/hyprpanel.png")`
} }
}), }),
}), }),

View File

@@ -533,7 +533,9 @@ const options = mkOptions(OPTIONS, {
color: opt(colors.surface0), color: opt(colors.surface0),
}, },
profile: { profile: {
name: opt(colors.pink) name: opt(colors.pink),
size: opt("8.5em"),
radius: opt("0.4em"),
}, },
powermenu: { powermenu: {
shutdown: opt(colors.red), shutdown: opt(colors.red),

View File

@@ -26,7 +26,12 @@
margin-bottom: 0.65em; margin-bottom: 0.65em;
.profile-picture { .profile-picture {
font-size: 7.5em; min-width: $bar-menus-menu-dashboard-profile-size;
min-height: $bar-menus-menu-dashboard-profile-size;
border-radius: $bar-menus-menu-dashboard-profile-radius;
background-size: cover;
background-repeat: no-repeat;
background-position: center;
} }
.profile-name { .profile-name {

View File

@@ -16,6 +16,8 @@ export const DashboardMenuSettings = () => {
Header('Power Menu'), Header('Power Menu'),
Option({ opt: options.menus.dashboard.powermenu.avatar.image, title: 'Profile Image', type: 'img' }), Option({ opt: options.menus.dashboard.powermenu.avatar.image, title: 'Profile Image', type: 'img' }),
Option({ opt: options.menus.dashboard.powermenu.avatar.name, title: 'Profile Name', subtitle: 'Use \'system\' to automatically set system name', type: 'string' }), Option({ opt: options.menus.dashboard.powermenu.avatar.name, title: 'Profile Name', subtitle: 'Use \'system\' to automatically set system name', type: 'string' }),
Option({ opt: options.theme.bar.menus.menu.dashboard.profile.size, title: 'Profile Image Size', type: 'string' }),
Option({ opt: options.theme.bar.menus.menu.dashboard.profile.radius, title: 'Profile Image Radius', type: 'string' }),
Option({ opt: options.menus.dashboard.powermenu.confirmation, title: 'Show Confirmation Dialogue', type: 'boolean' }), Option({ opt: options.menus.dashboard.powermenu.confirmation, title: 'Show Confirmation Dialogue', type: 'boolean' }),
Option({ opt: options.menus.dashboard.powermenu.shutdown, title: 'Shutdown Command', type: 'string' }), Option({ opt: options.menus.dashboard.powermenu.shutdown, title: 'Shutdown Command', type: 'string' }),