Workspaces now show up on their appropriate monitors. (#681)

* Workspaces now show up on their appropriate monitors.

* Fixed undefined rules showing up.
This commit is contained in:
Jas Singh
2024-12-31 01:33:40 -08:00
committed by GitHub
parent d2e02f553a
commit 5f72b4f5e1
17 changed files with 576 additions and 425 deletions

View File

@@ -3,6 +3,7 @@ import { dependencies, sh } from '../lib/utils';
import options from '../options';
import { execAsync } from 'astal/process';
import { monitorFile } from 'astal/file';
import { hyprlandService } from 'src/lib/constants/services';
const WP = `${GLib.get_home_dir()}/.config/background`;
@@ -14,35 +15,34 @@ class Wallpaper extends GObject.Object {
#wallpaper(): void {
if (!dependencies('swww')) return;
sh('hyprctl cursorpos')
.then((pos) => {
const transitionCmd = [
'swww',
'img',
'--invert-y',
'--transition-type',
'grow',
'--transition-duration',
'1.5',
'--transition-fps',
'30',
'--transition-pos',
pos.replace(' ', ''),
WP,
].join(' ');
try {
const cursorPosition = hyprlandService.message('cursorpos');
const transitionCmd = [
'swww',
'img',
'--invert-y',
'--transition-type',
'grow',
'--transition-duration',
'1.5',
'--transition-fps',
'30',
'--transition-pos',
cursorPosition.replace(' ', ''),
WP,
].join(' ');
sh(transitionCmd)
.then(() => {
this.notify('wallpaper');
this.emit('changed', true);
})
.catch((err) => {
console.error('Error setting wallpaper:', err);
});
})
.catch((err) => {
console.error('Error getting cursor position:', err);
});
sh(transitionCmd)
.then(() => {
this.notify('wallpaper');
this.emit('changed', true);
})
.catch((err) => {
console.error('Error setting wallpaper:', err);
});
} catch (err) {
console.error('Error getting cursor position:', err);
}
}
async #setWallpaper(path: string): Promise<void> {