This commit is contained in:
end-4
2024-05-04 22:48:13 +07:00
6 changed files with 26 additions and 19 deletions
@@ -204,16 +204,15 @@ export const NetworkIndicator = () => Widget.Stack({
const HyprlandXkbKeyboardLayout = async ({ useFlag } = {}) => { const HyprlandXkbKeyboardLayout = async ({ useFlag } = {}) => {
try { try {
const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default; const Hyprland = (await import('resource:///com/github/Aylur/ags/service/hyprland.js')).default;
var initLangs = [];
var languageStackArray = []; var languageStackArray = [];
var currentKeyboard;
const updateCurrentKeyboards = () => { const updateCurrentKeyboards = () => {
currentKeyboard = JSON.parse(Utils.exec('hyprctl -j devices')).keyboards var initLangs = [];
.find(device => device.name === 'at-translated-set-2-keyboard'); JSON.parse(Utils.exec('hyprctl -j devices')).keyboards
if (currentKeyboard) { .forEach(keyboard => {
initLangs = currentKeyboard.layout.split(',').map(lang => lang.trim()); initLangs.push(...keyboard.layout.split(',').map(lang => lang.trim()));
} });
initLangs = [...new Set(initLangs)];
languageStackArray = Array.from({ length: initLangs.length }, (_, i) => { languageStackArray = Array.from({ length: initLangs.length }, (_, i) => {
const lang = languages.find(lang => lang.layout == initLangs[i]); const lang = languages.find(lang => lang.layout == initLangs[i]);
// if (!lang) return [ // if (!lang) return [
@@ -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 // const player = Mpris.getPlayer(); // Maybe no need to re-get player.. can't remember why I had this
// Player closed // Player closed
// Note that cover path still remains, so we're checking title // 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 self.css = `background-image: none;`; // CSS image
App.applyCss(`${COMPILED_STYLE_DIR}/style.css`); App.applyCss(`${COMPILED_STYLE_DIR}/style.css`);
return; return;
+16 -7
View File
@@ -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: { attribute: {
enabled: false, enabled: false,
}, },
@@ -87,13 +87,25 @@ export const ModuleNightLight = (props = {}) => Widget.Button({ // TODO: Make th
onClicked: (self) => { onClicked: (self) => {
self.attribute.enabled = !self.attribute.enabled; self.attribute.enabled = !self.attribute.enabled;
self.toggleClassName('sidebar-button-active', self.attribute.enabled); self.toggleClassName('sidebar-button-active', self.attribute.enabled);
if (self.attribute.enabled) Utils.execAsync(['wlsunset', '-t', '4500']).catch(print) if (self.attribute.enabled) Utils.execAsync('gammastep').catch(print)
else Utils.execAsync('pkill wlsunset').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'), child: MaterialIcon('nightlight', 'norm'),
setup: (self) => { setup: (self) => {
setupCursorHover(self); setupCursorHover(self);
self.attribute.enabled = !!exec('pidof wlsunset'); self.attribute.enabled = !!exec('pidof gammastep');
self.toggleClassName('sidebar-button-active', self.attribute.enabled); self.toggleClassName('sidebar-button-active', self.attribute.enabled);
}, },
...props, ...props,
@@ -235,6 +247,3 @@ export const ModulePowerIcon = (props = {}) => Widget.Button({
setupCursorHover(button); setupCursorHover(button);
} }
}) })
+1 -1
View File
@@ -237,7 +237,7 @@ class GPTService extends Service {
send(msg) { send(msg) {
this._messages.push(new GPTMessage('user', msg, false, true)); this._messages.push(new GPTMessage('user', msg, false, true));
this.emit('newMsg', this._messages.length - 1); this.emit('newMsg', this._messages.length - 1);
const aiResponse = new GPTMessage('assistant', 'thinking...', true, false) const aiResponse = new GPTMessage('assistant', '', true, false)
const body = { const body = {
model: CHAT_MODELS[this._modelIndex], model: CHAT_MODELS[this._modelIndex],
+1 -2
View File
@@ -1,5 +1,6 @@
# Bar, wallpaper # Bar, wallpaper
exec-once = swww-daemon --format xrgb exec-once = swww-daemon --format xrgb
exec-once = /usr/lib/geoclue-2.0/demos/agent
exec-once = ags & exec-once = ags &
# Input method # Input method
@@ -19,5 +20,3 @@ exec-once = wl-paste --type image --watch cliphist store
# Cursor # Cursor
exec-once = hyprctl setcursor Bibata-Modern-Classic 24 exec-once = hyprctl setcursor Bibata-Modern-Classic 24
+1 -1
View File
@@ -26,7 +26,7 @@ pavucontrol wireplumber libdbusmenu-gtk3 playerctl swww
webp-pixbuf-loader gtk-layer-shell gtk3 gtksourceview3 gobject-introspection upower yad ydotool webp-pixbuf-loader gtk-layer-shell gtk3 gtksourceview3 gobject-introspection upower yad ydotool
### Gnome ### Gnome
polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager wlsunset gnome-bluetooth-3.0 polkit-gnome gnome-keyring gnome-control-center blueberry networkmanager gammastep gnome-bluetooth-3.0
### Backlight ### Backlight
brightnessctl ddcutil brightnessctl ddcutil