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,
vertical: true,
children: [
Widget.Icon({
Widget.Box({
hpack: "center",
class_name: "profile-picture",
icon: image.bind("value").as(i => {
css: image.bind("value").as(i => {
try {
GdkPixbuf.Pixbuf.new_from_file(i);
return i;
return `background-image: url("${i}")`
} 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),
},
profile: {
name: opt(colors.pink)
name: opt(colors.pink),
size: opt("8.5em"),
radius: opt("0.4em"),
},
powermenu: {
shutdown: opt(colors.red),

View File

@@ -26,7 +26,12 @@
margin-bottom: 0.65em;
.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 {

View File

@@ -16,6 +16,8 @@ export const DashboardMenuSettings = () => {
Header('Power Menu'),
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.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.shutdown, title: 'Shutdown Command', type: 'string' }),