allow hiding fake screen rounding when fullscreen (#579)

This commit is contained in:
end-4 2024-06-04 16:09:14 +07:00
parent 5c78446c3c
commit d3bbeaaff2
3 changed files with 27 additions and 5 deletions

View file

@ -50,12 +50,12 @@ const Windows = () => [
forMonitors(Osk),
forMonitors(Session),
...(userOptions.dock.enabled ? [forMonitors(Dock)] : []),
...(userOptions.appearance.fakeScreenRounding ? [
...(userOptions.appearance.fakeScreenRounding !== 0 ? [
forMonitors((id) => Corner(id, 'top left', true)),
forMonitors((id) => Corner(id, 'top right', true)),
] : []),
forMonitors((id) => Corner(id, 'bottom left', userOptions.appearance.fakeScreenRounding)),
forMonitors((id) => Corner(id, 'bottom right', userOptions.appearance.fakeScreenRounding)),
forMonitors((id) => Corner(id, 'bottom left', userOptions.appearance.fakeScreenRounding !== 0)),
forMonitors((id) => Corner(id, 'bottom right', userOptions.appearance.fakeScreenRounding !== 0)),
forMonitors(BarCornerTopleft),
forMonitors(BarCornerTopright),
];
@ -76,3 +76,4 @@ App.config({
// Stuff that don't need to be toggled. And they're async so ugh...
forMonitorsAsync(Bar);
// Bar().catch(print); // Use this to debug the bar. Single monitor only.

View file

@ -28,7 +28,7 @@ let configOptions = {
'keyboardUseFlag': false, // Use flag emoji instead of abbreviation letters
'layerSmoke': false,
'layerSmokeStrength': 0.2,
'fakeScreenRounding': true,
'fakeScreenRounding': 1, // 0: None | 1: Always | 2: When not fullscreen
},
'apps': {
'bluetooth': "blueberry",

View file

@ -1,7 +1,27 @@
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { enableClickthrough } from "../.widgetutils/clickthrough.js";
import { RoundedCorner } from "../.commonwidgets/cairo_roundedcorner.js";
if(userOptions.appearance.fakeScreenRounding === 2) Hyprland.connect('event', (service, name, data) => {
if (name == 'fullscreen') {
const monitor = Hyprland.active.monitor.id;
if (data == '1') {
for (const window of App.windows) {
if (window.name.startsWith("corner") && window.name.endsWith(monitor)) {
App.closeWindow(window.name);
}
}
} else {
for (const window of App.windows) {
if (window.name.startsWith("corner") && window.name.endsWith(monitor)) {
App.openWindow(window.name);
}
}
}
}
})
export default (monitor = 0, where = 'bottom left', useOverlayLayer = true) => {
const positionString = where.replace(/\s/, ""); // remove space
return Widget.Window({
@ -14,4 +34,5 @@ export default (monitor = 0, where = 'bottom left', useOverlayLayer = true) => {
child: RoundedCorner(positionString, { className: 'corner-black', }),
setup: enableClickthrough,
});
}
}