feat(ags osk): don't drag when a button is pressed
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-25 22:06:02 -05:00
parent 81737fd0ac
commit c779a161b3
3 changed files with 21 additions and 5 deletions

View file

@ -39,11 +39,12 @@
transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
box-shadow: 2px 1px 2px gray;
margin: 4px 10px 4px 10px;
margin: 4px 4px 4px 4px;
&.active {
box-shadow: 0 0 0 white;
margin: 6px 10px 2px 10px;
margin: 6px 4px 2px 4px;
background-color: color.adjust(colors.$window_bg_color, $lightness: -3%);
}

View file

@ -5,17 +5,18 @@ import Tablet from '../../services/tablet';
import { hyprMessage } from '../../lib';
import OskWindow from './osk-window';
import { Keys } from './keys';
const KEY_N = 249;
const KEYCODES = Array.from(Array(KEY_N).keys());
const KEYCODES = Array.from(Array(KEY_N).keys()).map((keycode) => `${keycode}:0`);
const ANIM_DURATION = 700;
const releaseAllKeys = () => {
execAsync([
'ydotool', 'key',
...KEYCODES.map((keycode) => `${keycode}:0`),
...KEYCODES,
]).catch(print);
};
@ -136,6 +137,8 @@ export default (window: OskWindow) => {
margin-bottom: -${calculatedHeight}px;
`;
}
window.startY = null;
});
}),
);
@ -148,7 +151,11 @@ export default (window: OskWindow) => {
signals.push(
gesture.connect('drag-begin', () => {
hyprMessage('j/cursorpos').then((out) => {
const hasActiveKey = Keys.get().map((v) => v.get()).includes(true);
if (!hasActiveKey) {
window.startY = JSON.parse(out).y;
}
});
}),
);
@ -205,6 +212,8 @@ export default (window: OskWindow) => {
margin-bottom: 0px;
`;
}
window.startY = null;
});
}),
);

View file

@ -25,6 +25,8 @@ const LSHIFT_CODE = 42;
const LALT_CODE = 56;
const LCTRL_CODE = 29;
export const Keys = Variable<Variable<boolean>[]>([]);
// Keep track of modifier statuses
const Super = Variable(false);
const LAlt = Variable(false);
@ -84,6 +86,8 @@ const ModKey = (key: Key) => {
Mod = RCtrl;
}
Keys.set([...Keys.get(), Mod!]);
const label = (
<label
className={`mod ${key.label}`}
@ -119,6 +123,8 @@ const RegularKey = (key: Key) => {
const IsActive = Variable(false);
const IsLongPressing = Variable(false);
Keys.set([...Keys.get(), IsActive]);
const widget = (
<eventbox
className="key"