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 } = {}) => {
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 [
@@ -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;
+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: {
enabled: false,
},
@@ -87,13 +87,25 @@ 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')
.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) => {
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 +247,3 @@ export const ModulePowerIcon = (props = {}) => Widget.Button({
setupCursorHover(button);
}
})
+1 -1
View File
@@ -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],
+1 -2
View File
@@ -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
+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
### 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
brightnessctl ddcutil