forked from Shinonome/dots-hyprland
Merge branch 'main' of https://github.com/end-4/dots-hyprland
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user