forked from Shinonome/dots-hyprland
osd: hide on mouse movement
works for left side but not right side... oh well, still better than nothing
This commit is contained in:
@@ -2,6 +2,9 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
|
||||
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
|
||||
import Brightness from '../../../services/brightness.js';
|
||||
import Indicator from '../../../services/indicator.js';
|
||||
import { distance } from '../../.miscutils/mathfuncs.js';
|
||||
|
||||
const OSD_DISMISS_DISTANCE = 10;
|
||||
|
||||
const WindowTitle = async () => {
|
||||
try {
|
||||
@@ -41,18 +44,28 @@ const WindowTitle = async () => {
|
||||
|
||||
export default async (monitor = 0) => {
|
||||
const optionalWindowTitleInstance = await WindowTitle();
|
||||
let scrollCursorX, scrollCursorY;
|
||||
return Widget.EventBox({
|
||||
onScrollUp: () => {
|
||||
onScrollUp: (self, event) => {
|
||||
let _;
|
||||
[_, scrollCursorX, scrollCursorY] = event.get_coords();
|
||||
Indicator.popup(1); // Since the brightness and speaker are both on the same window
|
||||
Brightness[monitor].screen_value += 0.05;
|
||||
},
|
||||
onScrollDown: () => {
|
||||
onScrollDown: (self, event) => {
|
||||
let _;
|
||||
[_, scrollCursorX, scrollCursorY] = event.get_coords();
|
||||
Indicator.popup(1); // Since the brightness and speaker are both on the same window
|
||||
Brightness[monitor].screen_value -= 0.05;
|
||||
},
|
||||
onPrimaryClick: () => {
|
||||
App.toggleWindow('sideleft');
|
||||
},
|
||||
setup: (self) => self.on('motion-notify-event', (self, event) => {
|
||||
const [_, cursorX, cursorY] = event.get_coords();
|
||||
if (distance(cursorX, cursorY, scrollCursorX, scrollCursorY) >= OSD_DISMISS_DISTANCE)
|
||||
Indicator.popup(-1);
|
||||
}),
|
||||
child: Widget.Box({
|
||||
homogeneous: false,
|
||||
children: [
|
||||
|
||||
Reference in New Issue
Block a user