feat(ags osk): don't drag when a button is pressed
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
81737fd0ac
commit
c779a161b3
3 changed files with 21 additions and 5 deletions
|
@ -39,11 +39,12 @@
|
||||||
transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
transition: background-color 0.2s ease-in-out, border-color 0.2s ease-in-out;
|
||||||
|
|
||||||
box-shadow: 2px 1px 2px gray;
|
box-shadow: 2px 1px 2px gray;
|
||||||
margin: 4px 10px 4px 10px;
|
|
||||||
|
margin: 4px 4px 4px 4px;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
box-shadow: 0 0 0 white;
|
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%);
|
background-color: color.adjust(colors.$window_bg_color, $lightness: -3%);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,17 +5,18 @@ import Tablet from '../../services/tablet';
|
||||||
import { hyprMessage } from '../../lib';
|
import { hyprMessage } from '../../lib';
|
||||||
|
|
||||||
import OskWindow from './osk-window';
|
import OskWindow from './osk-window';
|
||||||
|
import { Keys } from './keys';
|
||||||
|
|
||||||
|
|
||||||
const KEY_N = 249;
|
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 ANIM_DURATION = 700;
|
||||||
|
|
||||||
const releaseAllKeys = () => {
|
const releaseAllKeys = () => {
|
||||||
execAsync([
|
execAsync([
|
||||||
'ydotool', 'key',
|
'ydotool', 'key',
|
||||||
...KEYCODES.map((keycode) => `${keycode}:0`),
|
...KEYCODES,
|
||||||
]).catch(print);
|
]).catch(print);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -136,6 +137,8 @@ export default (window: OskWindow) => {
|
||||||
margin-bottom: -${calculatedHeight}px;
|
margin-bottom: -${calculatedHeight}px;
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.startY = null;
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
@ -148,7 +151,11 @@ export default (window: OskWindow) => {
|
||||||
signals.push(
|
signals.push(
|
||||||
gesture.connect('drag-begin', () => {
|
gesture.connect('drag-begin', () => {
|
||||||
hyprMessage('j/cursorpos').then((out) => {
|
hyprMessage('j/cursorpos').then((out) => {
|
||||||
window.startY = JSON.parse(out).y;
|
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;
|
margin-bottom: 0px;
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
window.startY = null;
|
||||||
});
|
});
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
|
@ -25,6 +25,8 @@ const LSHIFT_CODE = 42;
|
||||||
const LALT_CODE = 56;
|
const LALT_CODE = 56;
|
||||||
const LCTRL_CODE = 29;
|
const LCTRL_CODE = 29;
|
||||||
|
|
||||||
|
export const Keys = Variable<Variable<boolean>[]>([]);
|
||||||
|
|
||||||
// Keep track of modifier statuses
|
// Keep track of modifier statuses
|
||||||
const Super = Variable(false);
|
const Super = Variable(false);
|
||||||
const LAlt = Variable(false);
|
const LAlt = Variable(false);
|
||||||
|
@ -84,6 +86,8 @@ const ModKey = (key: Key) => {
|
||||||
Mod = RCtrl;
|
Mod = RCtrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.set([...Keys.get(), Mod!]);
|
||||||
|
|
||||||
const label = (
|
const label = (
|
||||||
<label
|
<label
|
||||||
className={`mod ${key.label}`}
|
className={`mod ${key.label}`}
|
||||||
|
@ -119,6 +123,8 @@ const RegularKey = (key: Key) => {
|
||||||
const IsActive = Variable(false);
|
const IsActive = Variable(false);
|
||||||
const IsLongPressing = Variable(false);
|
const IsLongPressing = Variable(false);
|
||||||
|
|
||||||
|
Keys.set([...Keys.get(), IsActive]);
|
||||||
|
|
||||||
const widget = (
|
const widget = (
|
||||||
<eventbox
|
<eventbox
|
||||||
className="key"
|
className="key"
|
||||||
|
|
Loading…
Reference in a new issue