Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for vertical screens #584

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
18 changes: 14 additions & 4 deletions .config/ags/modules/.commondata/hyprlanddata.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,21 @@ async function updateStuff() {
const display = Gdk.Display.get_default();
monitors.forEach((monitor, i) => {
const gdkMonitor = display.get_monitor(i);
monitor.realWidth = monitor.width;
monitor.realHeight = monitor.height;
if (monitor.transform % 2 == 0) { //switch width and height if monitor is rotated
monitor.realWidth = monitor.width;
monitor.realHeight = monitor.height;
} else {
monitor.realWidth = monitor.height;
monitor.realHeight = monitor.width;
}
if (userOptions.monitors.scaleMethod.toLowerCase == "gdk") {
monitor.width = gdkMonitor.get_geometry().width;
monitor.height = gdkMonitor.get_geometry().height;
if (monitor.transform % 2 == 0) { //gdkMonitor also does not account for rotation
monitor.width = gdkMonitor.get_geometry().width;
monitor.height = gdkMonitor.get_geometry().height;
} else {
monitor.width = gdkMonitor.get_geometry().height;
monitor.height = gdkMonitor.get_geometry().width;
}
}
else { // == "division"
monitor.width = Math.ceil(monitor.realWidth / monitor.scale);
Expand Down
18 changes: 13 additions & 5 deletions .config/ags/modules/bar/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const { Gtk } = imports.gi;
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';

import { monitors } from '../.commondata/hyprlanddata.js';
import WindowTitle from "./normal/spaceleft.js";
import Indicators from "./normal/spaceright.js";
import Music from "./normal/music.js";
Expand Down Expand Up @@ -100,11 +101,18 @@ export const Bar = async (monitor = 0) => {
'focus': focusedBarContent,
'nothing': nothingContent,
},
setup: (self) => self.hook(currentShellMode, (self) => {
self.shown = currentShellMode.value;

})
}),
setup: (self) => self
.hook(currentShellMode, (self) => {
self.shown = currentShellMode.value;
})
.on("size-allocate", (self) => {
if (self.children[currentShellMode.value]?.get_allocated_width() > monitors[monitor].width) {
self.children[currentShellMode.value].centerWidget.children[0].visible = false;
self.children[currentShellMode.value].centerWidget.children[2].visible = false;
}
})
,
})
});
}

Expand Down