From fa0dacb496a7207346d64fb9e1119af63073b388 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 14 Jan 2024 02:39:34 +0700 Subject: [PATCH] ags: sync - remove laggy keyframe on init - show volume on mute - more tree compositor compatibility --- .config/ags/scss/_bar.scss | 2 - .config/ags/scss/_lib_classes.scss | 22 ------- .config/ags/scss/_lib_mixins.scss | 22 +++++++ .../ags/widgets/desktopbackground/system.js | 11 ++-- .../ags/widgets/indicators/indicatorvalues.js | 65 +++++++++++-------- 5 files changed, 66 insertions(+), 56 deletions(-) diff --git a/.config/ags/scss/_bar.scss b/.config/ags/scss/_bar.scss index 840142d9..4f644f9e 100644 --- a/.config/ags/scss/_bar.scss +++ b/.config/ags/scss/_bar.scss @@ -32,9 +32,7 @@ $bar_subgroup_bg: $surfaceVariant; } .bar-group-pad { - // padding: 0rem 1.023rem; padding: 0.205rem; - // padding-left: 0.341rem; } .bar-group-pad-less { diff --git a/.config/ags/scss/_lib_classes.scss b/.config/ags/scss/_lib_classes.scss index e2ae2738..d946c7a0 100644 --- a/.config/ags/scss/_lib_classes.scss +++ b/.config/ags/scss/_lib_classes.scss @@ -1,25 +1,3 @@ -@keyframes flyin-top { - from { - margin-top: -2.795rem; - } - - to { - margin-top: 0rem; - } -} - -@keyframes flyin-bottom { - from { - margin-top: 4.841rem; - margin-bottom: -4.841rem; - } - - to { - margin-bottom: 0rem; - margin-top: 0rem; - } -} - .test { background-image: linear-gradient( 45deg, #f4d609 0%, #f4d609 10%, #212121 10%, #212121 20%, #f4d609 20%, #f4d609 30%, #212121 30%, diff --git a/.config/ags/scss/_lib_mixins.scss b/.config/ags/scss/_lib_mixins.scss index 54009bbd..ee9255b5 100644 --- a/.config/ags/scss/_lib_mixins.scss +++ b/.config/ags/scss/_lib_mixins.scss @@ -100,6 +100,28 @@ $elevation_margin: 0.476rem; margin: $elevation_margin; } +@keyframes flyin-top { + from { + margin-top: -2.795rem; + } + + to { + margin-top: 0rem; + } +} + +@keyframes flyin-bottom { + from { + margin-top: 4.841rem; + margin-bottom: -4.841rem; + } + + to { + margin-bottom: 0rem; + margin-top: 0rem; + } +} + @mixin menu_decel { transition: 300ms cubic-bezier(0.1, 1, 0, 1); } diff --git a/.config/ags/widgets/desktopbackground/system.js b/.config/ags/widgets/desktopbackground/system.js index f69e42c8..6d49c524 100644 --- a/.config/ags/widgets/desktopbackground/system.js +++ b/.config/ags/widgets/desktopbackground/system.js @@ -114,11 +114,14 @@ const distroAndVersion = Box({ Label({ className: 'bg-distro-name', xalign: 0, - label: '', + label: 'An environment idk', setup: (label) => { - execAsync([`bash`, `-c`, `hyprctl version | grep -oP "Tag: v\\K\\d+\\.\\d+\\.\\d+"`]).then(distro => { - label.label = `Hyprland ${distro}`; - }).catch(print); + // hyprctl will return unsuccessfully if Hyprland isn't running + execAsync([`bash`, `-c`, `hyprctl version | grep -oP "Tag: v\\K\\d+\\.\\d+\\.\\d+"`]).then(version => { + label.label = `Hyprland ${version}`; + }).catch(() => execAsync([`bash`, `-c`, `sway -v | cut -d'-' -f1 | sed 's/sway version /v/'`]).then(version => { + label.label = `Sway ${version}`; + }).catch(print)); }, }), ] diff --git a/.config/ags/widgets/indicators/indicatorvalues.js b/.config/ags/widgets/indicators/indicatorvalues.js index 11d5f147..d12d8c90 100644 --- a/.config/ags/widgets/indicators/indicatorvalues.js +++ b/.config/ags/widgets/indicators/indicatorvalues.js @@ -6,34 +6,43 @@ import { MarginRevealer } from '../../lib/advancedwidgets.js'; import Brightness from '../../services/brightness.js'; import Indicator from '../../services/indicator.js'; -const OsdValue = (name, labelSetup, progressSetup, props = {}) => Box({ // Volume - ...props, - vertical: true, - className: 'osd-bg osd-value', - hexpand: true, - children: [ - Box({ - vexpand: true, - children: [ - Label({ - xalign: 0, yalign: 0, hexpand: true, - className: 'osd-label', - label: `${name}`, - }), - Label({ - hexpand: false, className: 'osd-value-txt', - setup: labelSetup, - }), - ] - }), - ProgressBar({ - className: 'osd-progress', - hexpand: true, - vertical: false, - setup: progressSetup, - }) - ], -}); +const OsdValue = (name, labelSetup, progressSetup, props = {}) => { + const valueName = Label({ + xalign: 0, yalign: 0, hexpand: true, + className: 'osd-label', + label: `${name}`, + }); + const valueNumber =Label({ + hexpand: false, className: 'osd-value-txt', + setup: labelSetup, + }); + return Box({ // Volume + ...props, + vertical: true, + hexpand: true, + className: 'osd-bg osd-value', + attribute: { + 'disable': () => { + valueNumber.label = '󰖭'; + } + }, + children: [ + Box({ + vexpand: true, + children: [ + valueName, + valueNumber, + ] + }), + ProgressBar({ + className: 'osd-progress', + hexpand: true, + vertical: false, + setup: progressSetup, + }) + ], + }); +} const brightnessIndicator = OsdValue('Brightness', (self) => self