remove unecessary click2close

This commit is contained in:
end-4
2024-05-18 19:45:36 +07:00
parent ef8109cd10
commit e9c40a9588
3 changed files with 2 additions and 54 deletions
-2
View File
@@ -20,7 +20,6 @@ import Overview from './modules/overview/main.js';
import Session from './modules/session/main.js';
import SideLeft from './modules/sideleft/main.js';
import SideRight from './modules/sideright/main.js';
import Click2Close from './modules/click2close/main.js';
const COMPILED_STYLE_DIR = `${GLib.get_user_cache_dir()}/ags/user/generated`
const range = (length, start = 1) => Array.from({ length }, (_, i) => i + start);
@@ -64,7 +63,6 @@ const Windows = () => [
forMonitors((id) => Corner(id, 'bottom right', userOptions.appearance.fakeScreenRounding)),
forMonitors(BarCornerTopleft),
forMonitors(BarCornerTopright),
forMonitors(Click2Close),
];
const CLOSE_ANIM_TIME = 210; // Longer than actual anim time to make sure widgets animate fully
@@ -7,10 +7,10 @@ export const clickCloseRegion = ({ name, multimonitor = true, monitor = 0, expan
return EventBox({
child: Box({
expand: expand,
css: fillMonitor ? `
css: `
min-width: ${fillMonitor.includes('h') ? monitors[monitor].width : 0}px;
min-height: ${fillMonitor.includes('v') ? monitors[monitor].height : 0}px;
` : null,
`,
}),
setup: (self) => self.on('button-press-event', (self, event) => { // Any mouse button
if (multimonitor) closeWindowOnAllMonitors(name);
-50
View File
@@ -1,50 +0,0 @@
const { Gdk } = imports.gi;
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import PopupWindow from '../.widgethacks/popupwindow.js';
import { monitors } from '../.miscutils/hyprlanddata.js';
const WINDOWS_NEED_CLICK2CLOSE = [];
const range = (length, start = 1) => Array.from({ length }, (_, i) => i + start);
export default (monitor = 0) => PopupWindow({
monitor,
name: `click2close${monitor}`,
layer: 'top',
anchor: ['top', 'bottom', 'left', 'right'],
exclusivity: 'ignore',
keymode: 'none',
child: Widget.EventBox({
attribute: {
checkWindowRelevance: (currentName) => {
let relevant = false;
// use regex to check if name matches one of windows need click2close with a *
for (let i = 0; i < WINDOWS_NEED_CLICK2CLOSE.length; i++) {
const testRegex = RegExp(`^${WINDOWS_NEED_CLICK2CLOSE[i]}\\d*$`);
if (testRegex.test(currentName)) {
relevant = true;
break;
}
}
return relevant;
}
},
onPrimaryClick: () => closeEverything(),
onSecondaryClick: () => closeEverything(),
onMiddleClick: () => closeEverything(),
setup: (self) => self.hook(App, (self, currentName, visible) => {
if(!self.attribute.checkWindowRelevance(currentName)) return;
range(Gdk.Display.get_default()?.get_n_monitors() || 1, 0).forEach(id => {
if(visible) App.openWindow(`click2close${id}`);
else App.closeWindow(`click2close${id}`);
});
}),
child: Widget.Box({
css: `
${userOptions.appearance.layerSmoke ? 'background-color: rgba(0,0,0,' + String(userOptions.appearance.layerSmokeStrength) + ');' : ''}
min-height: ${monitors[monitor].height}px;
min-width: ${monitors[monitor].width}px;
`
}),
})
});