From 2fc464123fde065fc09b7219a62cd8583be4f03d Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Wed, 1 May 2024 22:59:20 +0800 Subject: [PATCH 1/5] replace wlsunset with gammastep wlsunset doesn't work w/o manually passing the latitude and longitude. gammastep can retrieve geolocation from geoclue so it works out of the box for everyone. --- .config/ags/modules/sideright/quicktoggles.js | 11 ++++------- .config/hypr/hyprland/execs.conf | 3 +-- scriptdata/dependencies.conf | 2 +- 3 files changed, 6 insertions(+), 10 deletions(-) diff --git a/.config/ags/modules/sideright/quicktoggles.js b/.config/ags/modules/sideright/quicktoggles.js index 1c33c1bf2..300e5236b 100644 --- a/.config/ags/modules/sideright/quicktoggles.js +++ b/.config/ags/modules/sideright/quicktoggles.js @@ -78,7 +78,7 @@ export const HyprToggleIcon = async (icon, name, hyprlandConfigValue, props = {} } } -export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make this work +export const ModuleNightLight = (props = {}) => Widget.Button({ attribute: { enabled: false, }, @@ -87,13 +87,13 @@ export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make th onClicked: (self) => { self.attribute.enabled = !self.attribute.enabled; self.toggleClassName('sidebar-button-active', self.attribute.enabled); - if (self.attribute.enabled) Utils.execAsync(['wlsunset', '-t', '4500']).catch(print) - else Utils.execAsync('pkill wlsunset').catch(print); + if (self.attribute.enabled) Utils.execAsync('gammastep').catch(print) + else Utils.execAsync('pkill gammastep').catch(print); }, child: MaterialIcon('nightlight', 'norm'), setup: (self) => { setupCursorHover(self); - self.attribute.enabled = !!exec('pidof wlsunset'); + self.attribute.enabled = !!exec('pidof gammastep'); self.toggleClassName('sidebar-button-active', self.attribute.enabled); }, ...props, @@ -235,6 +235,3 @@ export const ModulePowerIcon = (props = {}) => Widget.Button({ setupCursorHover(button); } }) - - - diff --git a/.config/hypr/hyprland/execs.conf b/.config/hypr/hyprland/execs.conf index ef0c62baa..936429f6e 100644 --- a/.config/hypr/hyprland/execs.conf +++ b/.config/hypr/hyprland/execs.conf @@ -1,5 +1,6 @@ # Bar, wallpaper exec-once = swww-daemon --format xrgb +exec-once = /usr/lib/geoclue-2.0/demos/agent exec-once = ags & # Input method @@ -19,5 +20,3 @@ exec-once = wl-paste --type image --watch cliphist store # Cursor exec-once = hyprctl setcursor Bibata-Modern-Classic 24 - - diff --git a/scriptdata/dependencies.conf b/scriptdata/dependencies.conf index 9fe10337d..e2d770ed1 100644 --- a/scriptdata/dependencies.conf +++ b/scriptdata/dependencies.conf @@ -26,7 +26,7 @@ pavucontrol wireplumber libdbusmenu-gtk3 playerctl swww webp-pixbuf-loader gtk-layer-shell gtk3 gtksourceview3 gobject-introspection upower yad ydotool ### Gnome -polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager brightnessctl wlsunset gnome-bluetooth-3.0 +polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager brightnessctl gammastep gnome-bluetooth-3.0 ### Widgets python-pywayland python-psutil hypridle-git hyprlock-git wlogout wl-clipboard hyprpicker-git anyrun-git From d17ba79cddb4be1b951de50f0ee74e493317d3f7 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Thu, 2 May 2024 13:34:45 +0800 Subject: [PATCH 2/5] disable night light button until gammastep fully terminated --- .config/ags/modules/sideright/quicktoggles.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.config/ags/modules/sideright/quicktoggles.js b/.config/ags/modules/sideright/quicktoggles.js index 300e5236b..39b08c908 100644 --- a/.config/ags/modules/sideright/quicktoggles.js +++ b/.config/ags/modules/sideright/quicktoggles.js @@ -88,7 +88,19 @@ export const ModuleNightLight = (props = {}) => Widget.Button({ self.attribute.enabled = !self.attribute.enabled; self.toggleClassName('sidebar-button-active', self.attribute.enabled); if (self.attribute.enabled) Utils.execAsync('gammastep').catch(print) - else Utils.execAsync('pkill gammastep').catch(print); + else Utils.execAsync('pkill gammastep') + .then(() => { + // disable the button until fully terminated to avoid race + self.sensitive = false; + const source = setInterval(() => { + Utils.execAsync('pkill -0 gammastep') + .catch(() => { + self.sensitive = true; + source.destroy(); + }); + }, 500); + }) + .catch(print); }, child: MaterialIcon('nightlight', 'norm'), setup: (self) => { From e96d334426e35fd84d4bd2efb58cb663be6eb71a Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Thu, 2 May 2024 13:54:54 +0800 Subject: [PATCH 3/5] musiccontrols: skip updateCover if cover not exists --- .config/ags/modules/indicators/musiccontrols.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ags/modules/indicators/musiccontrols.js b/.config/ags/modules/indicators/musiccontrols.js index 72e3f2648..d39b49b4c 100644 --- a/.config/ags/modules/indicators/musiccontrols.js +++ b/.config/ags/modules/indicators/musiccontrols.js @@ -180,7 +180,7 @@ const CoverArt = ({ player, ...rest }) => { // const player = Mpris.getPlayer(); // Maybe no need to re-get player.. can't remember why I had this // Player closed // Note that cover path still remains, so we're checking title - if (!player || player.trackTitle == "") { + if (!player || player.trackTitle == "" || !player.coverPath) { self.css = `background-image: none;`; // CSS image App.applyCss(`${COMPILED_STYLE_DIR}/style.css`); return; From 5bded685b2bb76bcda83cec58e5ecb188a19b290 Mon Sep 17 00:00:00 2001 From: MoetaYuko Date: Thu, 2 May 2024 15:23:20 +0800 Subject: [PATCH 4/5] fix `Child name 'us' not found in GtkStack` log spam --- .config/ags/modules/.commonwidgets/statusicons.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.config/ags/modules/.commonwidgets/statusicons.js b/.config/ags/modules/.commonwidgets/statusicons.js index d74cf9979..fbfe7a861 100644 --- a/.config/ags/modules/.commonwidgets/statusicons.js +++ b/.config/ags/modules/.commonwidgets/statusicons.js @@ -204,16 +204,15 @@ export const NetworkIndicator = () => Widget.Stack({ const HyprlandXkbKeyboardLayout = async ({ useFlag } = {}) => { try { const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default; - var initLangs = []; var languageStackArray = []; - var currentKeyboard; const updateCurrentKeyboards = () => { - currentKeyboard = JSON.parse(Utils.exec('hyprctl -j devices')).keyboards - .find(device => device.name === 'at-translated-set-2-keyboard'); - if (currentKeyboard) { - initLangs = currentKeyboard.layout.split(',').map(lang => lang.trim()); - } + var initLangs = []; + JSON.parse(Utils.exec('hyprctl -j devices')).keyboards + .forEach(keyboard => { + initLangs.push(...keyboard.layout.split(',').map(lang => lang.trim())); + }); + initLangs = [...new Set(initLangs)]; languageStackArray = Array.from({ length: initLangs.length }, (_, i) => { const lang = languages.find(lang => lang.layout == initLangs[i]); // if (!lang) return [ From b8f4be276d22ff2ad5757b8c8ae82b7dcb4aa237 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janik=20Michael=20M=C3=BCller?= <45454768+H0mire@users.noreply.github.com> Date: Fri, 3 May 2024 15:33:11 +0200 Subject: [PATCH 5/5] Update gpt.js - Bugfix Since a thinking animation is implemented, the "thinking..." string is not necessary anymore. It cause problems displaying answers from chatgpt. My suggestion: Emptying string. --- .config/ags/services/gpt.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.config/ags/services/gpt.js b/.config/ags/services/gpt.js index b19d46702..eae64a32b 100644 --- a/.config/ags/services/gpt.js +++ b/.config/ags/services/gpt.js @@ -237,7 +237,7 @@ class GPTService extends Service { send(msg) { this._messages.push(new GPTMessage('user', msg, false, true)); this.emit('newMsg', this._messages.length - 1); - const aiResponse = new GPTMessage('assistant', 'thinking...', true, false) + const aiResponse = new GPTMessage('assistant', '', true, false) const body = { model: CHAT_MODELS[this._modelIndex],