Skip to content

Commit 8715e5a

Browse files
committed
Fix the screen size for the slider
1 parent 8ff9135 commit 8715e5a

3 files changed

Lines changed: 13 additions & 12 deletions

File tree

frontend/src/lib/components/slider/WallpaperSlider.svelte

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,9 @@
195195
document.documentElement.classList.add('transparent-widget');
196196
197197
try {
198-
const {WindowShow, WindowSetSize, WindowSetPosition, ScreenGetAll} =
199-
await import('../../../../wailsjs/runtime/runtime');
200-
const screens = await ScreenGetAll();
201-
const current =
202-
screens.find(s => s.isCurrent) ??
203-
screens.find(s => s.isPrimary) ??
204-
screens[0];
205-
if (current) {
206-
WindowSetSize(current.width, current.height);
207-
WindowSetPosition(0, 0);
208-
}
198+
const {WindowShow} = await import(
199+
'../../../../wailsjs/runtime/runtime'
200+
);
209201
WindowShow();
210202
requestAnimationFrame(() => {
211203
ready = true;

internal/platform/exec.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,15 @@ func SetupOverlayWindow(appClass string) {
7575
exec.Command("hyprctl", "--batch", strings.Join(batch, " ; ")).Run()
7676
}
7777

78+
// MonitorSize returns the effective (scaled) pixel dimensions of the focused
79+
// monitor. On Hyprland it queries hyprctl; elsewhere it falls back to 1920x1080.
80+
func MonitorSize() (int, int) {
81+
if os.Getenv("HYPRLAND_INSTANCE_SIGNATURE") == "" {
82+
return 1920, 1080
83+
}
84+
return hyprlandMonitorSize()
85+
}
86+
7887
// hyprlandMonitorSize returns the effective (scaled) pixel dimensions of the
7988
// focused monitor via hyprctl.
8089
func hyprlandMonitorSize() (int, int) {

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func main() {
7878
title = "Aether Slider"
7979
frameless = true
8080
alwaysOnTop = true
81-
width, height = 0, 0
81+
width, height = platform.MonitorSize()
8282
}
8383

8484
isSliderMode := sliderWidget || themesSlider

0 commit comments

Comments
 (0)