Merge branch 'Jas-SinghFSU:master' into master
This commit is contained in:
42
app.ts
42
app.ts
@@ -15,7 +15,7 @@ import { bash, forMonitors } from 'src/lib/utils';
|
|||||||
import options from 'src/options';
|
import options from 'src/options';
|
||||||
import OSD from 'src/components/osd/index';
|
import OSD from 'src/components/osd/index';
|
||||||
import { App } from 'astal/gtk3';
|
import { App } from 'astal/gtk3';
|
||||||
import { exec, execAsync } from 'astal';
|
import { execAsync } from 'astal';
|
||||||
import { hyprlandService } from 'src/lib/constants/services';
|
import { hyprlandService } from 'src/lib/constants/services';
|
||||||
import { handleRealization } from 'src/components/menus/shared/dropdown/helpers';
|
import { handleRealization } from 'src/components/menus/shared/dropdown/helpers';
|
||||||
import { isDropdownMenu } from 'src/lib/constants/options.js';
|
import { isDropdownMenu } from 'src/lib/constants/options.js';
|
||||||
@@ -64,44 +64,10 @@ App.start({
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to determine if the current OS is NixOS by parsing /etc/os-release.
|
|
||||||
* @returns True if NixOS, false otherwise.
|
|
||||||
*/
|
|
||||||
const isNixOS = (): boolean => {
|
|
||||||
try {
|
|
||||||
const osRelease = exec('cat /etc/os-release').toString();
|
|
||||||
const idMatch = osRelease.match(/^ID\s*=\s*"?([^"\n]+)"?/m);
|
|
||||||
|
|
||||||
if (idMatch && idMatch[1].toLowerCase() === 'nixos') {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
} catch (error) {
|
|
||||||
console.error('Error detecting OS:', error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function to generate the appropriate restart command based on the OS.
|
|
||||||
* @returns The modified or original restart command.
|
|
||||||
*/
|
|
||||||
const getRestartCommand = (): string => {
|
|
||||||
const isNix = isNixOS();
|
|
||||||
const command = options.hyprpanel.restartCommand.get();
|
|
||||||
|
|
||||||
if (isNix) {
|
|
||||||
return command.replace(/\bags\b/g, 'hyprpanel');
|
|
||||||
}
|
|
||||||
|
|
||||||
return command;
|
|
||||||
};
|
|
||||||
|
|
||||||
hyprlandService.connect('monitor-added', () => {
|
hyprlandService.connect('monitor-added', () => {
|
||||||
|
const { restartCommand } = options.hyprpanel;
|
||||||
|
|
||||||
if (options.hyprpanel.restartAgs.get()) {
|
if (options.hyprpanel.restartAgs.get()) {
|
||||||
const restartAgsCommand = getRestartCommand();
|
bash(restartCommand.get());
|
||||||
bash(restartAgsCommand);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -81,14 +81,8 @@ export default ({
|
|||||||
<revealer
|
<revealer
|
||||||
revealChild={false}
|
revealChild={false}
|
||||||
setup={(self: Revealer) => {
|
setup={(self: Revealer) => {
|
||||||
App.connect('window-toggled', (app) => {
|
App.connect('window-toggled', (_, window) => {
|
||||||
const targetWindow = app.get_window(name);
|
self.set_reveal_child(window.visible);
|
||||||
|
|
||||||
const visibility = targetWindow?.get_visible();
|
|
||||||
|
|
||||||
if (targetWindow?.name === name) {
|
|
||||||
self.set_reveal_child(visibility ?? false);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}}
|
}}
|
||||||
transitionType={transition}
|
transitionType={transition}
|
||||||
|
|||||||
Reference in New Issue
Block a user