From d3bbeaaff2b9777505430e35618237538a3bfb07 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Tue, 4 Jun 2024 16:09:14 +0700 Subject: [PATCH] allow hiding fake screen rounding when fullscreen (#579) --- .config/ags/config.js | 7 +++--- .../modules/.configuration/user_options.js | 2 +- .config/ags/modules/screencorners/main.js | 23 ++++++++++++++++++- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/.config/ags/config.js b/.config/ags/config.js index f5cbf5ac..bf89b6c8 100644 --- a/.config/ags/config.js +++ b/.config/ags/config.js @@ -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. + diff --git a/.config/ags/modules/.configuration/user_options.js b/.config/ags/modules/.configuration/user_options.js index cb2f13c3..a0c228df 100644 --- a/.config/ags/modules/.configuration/user_options.js +++ b/.config/ags/modules/.configuration/user_options.js @@ -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", diff --git a/.config/ags/modules/screencorners/main.js b/.config/ags/modules/screencorners/main.js index fb5899e3..83e09c0b 100644 --- a/.config/ags/modules/screencorners/main.js +++ b/.config/ags/modules/screencorners/main.js @@ -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, }); -} \ No newline at end of file +} +