diff --git a/.config/ags/modules/.commondata/hyprlanddata.js b/.config/ags/modules/.commondata/hyprlanddata.js index 7489365ec..8915e406b 100644 --- a/.config/ags/modules/.commondata/hyprlanddata.js +++ b/.config/ags/modules/.commondata/hyprlanddata.js @@ -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); diff --git a/.config/ags/modules/bar/main.js b/.config/ags/modules/bar/main.js index 952fb3fbc..2a80143ee 100644 --- a/.config/ags/modules/bar/main.js +++ b/.config/ags/modules/bar/main.js @@ -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"; @@ -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; + } + }) + , + }) }); }