feat(ags): remove squeekboard dependency
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
9766d98542
commit
4e7904775b
11 changed files with 54 additions and 155 deletions
|
@ -1,6 +1,5 @@
|
||||||
{nixpkgs-wayland, ...} @ inputs: [
|
{nixpkgs-wayland, ...} @ inputs: [
|
||||||
(import ./dracula-theme inputs)
|
(import ./dracula-theme inputs)
|
||||||
(import ./squeekboard)
|
|
||||||
|
|
||||||
nixpkgs-wayland.overlay
|
nixpkgs-wayland.overlay
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
final: prev: {
|
|
||||||
squeekboard = prev.squeekboard.overrideAttrs (o: {
|
|
||||||
patches =
|
|
||||||
(o.patches or [])
|
|
||||||
++ [./remove-panel.patch];
|
|
||||||
});
|
|
||||||
}
|
|
|
@ -1,41 +0,0 @@
|
||||||
From 10be06ebc72ec8f516003577dabcedb60fe05982 Mon Sep 17 00:00:00 2001
|
|
||||||
From: matt1432 <matt@nelim.org>
|
|
||||||
Date: Sat, 18 Nov 2023 20:26:50 -0500
|
|
||||||
Subject: [PATCH] remove panel
|
|
||||||
|
|
||||||
---
|
|
||||||
src/panel.c | 6 +++---
|
|
||||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/src/panel.c b/src/panel.c
|
|
||||||
index a9942c8..333727e 100644
|
|
||||||
--- a/src/panel.c
|
|
||||||
+++ b/src/panel.c
|
|
||||||
@@ -75,13 +75,13 @@ panel_manager_request_widget (struct panel_manager *self, struct wl_output *outp
|
|
||||||
PHOSH_TYPE_LAYER_SURFACE,
|
|
||||||
"layer-shell", squeek_wayland->layer_shell,
|
|
||||||
"wl-output", output,
|
|
||||||
- "height", height,
|
|
||||||
+ "height", 1,
|
|
||||||
"anchor", ZWLR_LAYER_SURFACE_V1_ANCHOR_BOTTOM
|
|
||||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_LEFT
|
|
||||||
| ZWLR_LAYER_SURFACE_V1_ANCHOR_RIGHT,
|
|
||||||
"layer", ZWLR_LAYER_SHELL_V1_LAYER_TOP,
|
|
||||||
"kbd-interactivity", FALSE,
|
|
||||||
- "exclusive-zone", height,
|
|
||||||
+
|
|
||||||
"namespace", "osk",
|
|
||||||
NULL
|
|
||||||
);
|
|
||||||
@@ -100,7 +100,7 @@ panel_manager_request_widget (struct panel_manager *self, struct wl_output *outp
|
|
||||||
gtk_window_set_icon_name (GTK_WINDOW(self->window), "squeekboard");
|
|
||||||
gtk_window_set_keep_above (GTK_WINDOW(self->window), TRUE);
|
|
||||||
} else {
|
|
||||||
- panel_manager_resize(self, height);
|
|
||||||
+ panel_manager_resize(self, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!self->widget) {
|
|
||||||
--
|
|
||||||
2.42.0
|
|
||||||
|
|
|
@ -37,7 +37,5 @@ The main dependencies to try it are as follows:
|
||||||
If you're interested in my 2-1 laptop setup, you'll need:
|
If you're interested in my 2-1 laptop setup, you'll need:
|
||||||
|
|
||||||
- **ydotool** for my custom on-screen keyboard
|
- **ydotool** for my custom on-screen keyboard
|
||||||
- my [patched](https://git.nelim.org/matt1432/nixos-configs/src/branch/master/common/overlays/squeekboard/remove-panel.patch)
|
|
||||||
version of **squeekboard** to get a dbus interface for keyboard
|
|
||||||
control (I'm looking into implementing this by itself)
|
|
||||||
- **lisgd** to have touch screen gestures # TODO: switch to hyprgrass
|
- **lisgd** to have touch screen gestures # TODO: switch to hyprgrass
|
||||||
|
when it has better binds
|
||||||
|
|
9
modules/ags/config/global-types.d.ts
vendored
9
modules/ags/config/global-types.d.ts
vendored
|
@ -100,6 +100,15 @@ export type OSD = {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// For ./ts/on-screen-keyboard
|
||||||
|
export type OskWindow = Window<BoxGeneric, {
|
||||||
|
startY: null | number;
|
||||||
|
setVisible: (state: boolean) => void;
|
||||||
|
killGestureSigs: () => void;
|
||||||
|
setSlideUp: () => void;
|
||||||
|
setSlideDown: () => void;
|
||||||
|
}>;
|
||||||
|
|
||||||
// For CursorBox
|
// For CursorBox
|
||||||
import { CursorBox, CursorBoxProps } from 'ts/misc/cursorbox';
|
import { CursorBox, CursorBoxProps } from 'ts/misc/cursorbox';
|
||||||
export type CursorBox = CursorBox;
|
export type CursorBox = CursorBox;
|
||||||
|
|
|
@ -47,9 +47,9 @@ class Tablet extends Service {
|
||||||
return this.#oskState;
|
return this.#oskState;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
set oskState(value: boolean) {
|
||||||
super();
|
this.#oskState = value;
|
||||||
this.#listenOskState();
|
this.emit('osk-toggled', this.#oskState);
|
||||||
}
|
}
|
||||||
|
|
||||||
#blockInputs() {
|
#blockInputs() {
|
||||||
|
@ -76,9 +76,6 @@ class Tablet extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
setTabletMode() {
|
setTabletMode() {
|
||||||
execAsync(['gsettings', 'set', 'org.gnome.desktop.a11y.applications',
|
|
||||||
'screen-keyboard-enabled', 'true']).catch(print);
|
|
||||||
|
|
||||||
execAsync(['brightnessctl', '-d', 'tpacpi::kbd_backlight', 's', '0'])
|
execAsync(['brightnessctl', '-d', 'tpacpi::kbd_backlight', 's', '0'])
|
||||||
.catch(print);
|
.catch(print);
|
||||||
|
|
||||||
|
@ -91,9 +88,6 @@ class Tablet extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
setLaptopMode() {
|
setLaptopMode() {
|
||||||
execAsync(['gsettings', 'set', 'org.gnome.desktop.a11y.applications',
|
|
||||||
'screen-keyboard-enabled', 'false']).catch(print);
|
|
||||||
|
|
||||||
execAsync(['brightnessctl', '-d', 'tpacpi::kbd_backlight', 's', '2'])
|
execAsync(['brightnessctl', '-d', 'tpacpi::kbd_backlight', 's', '2'])
|
||||||
.catch(print);
|
.catch(print);
|
||||||
|
|
||||||
|
@ -160,43 +154,9 @@ class Tablet extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#listenOskState() {
|
|
||||||
subprocess(
|
|
||||||
['bash', '-c', 'busctl monitor --user sm.puri.OSK0'],
|
|
||||||
(output) => {
|
|
||||||
if (output.includes('BOOLEAN')) {
|
|
||||||
const match = output.match('true|false');
|
|
||||||
|
|
||||||
if (match) {
|
|
||||||
this.#oskState = match[0] === 'true';
|
|
||||||
this.emit('osk-toggled', this.#oskState);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
static openOsk() {
|
|
||||||
execAsync(['busctl', 'call', '--user',
|
|
||||||
'sm.puri.OSK0', '/sm/puri/OSK0', 'sm.puri.OSK0',
|
|
||||||
'SetVisible', 'b', 'true'])
|
|
||||||
.catch(print);
|
|
||||||
}
|
|
||||||
|
|
||||||
static closeOsk() {
|
|
||||||
execAsync(['busctl', 'call', '--user',
|
|
||||||
'sm.puri.OSK0', '/sm/puri/OSK0', 'sm.puri.OSK0',
|
|
||||||
'SetVisible', 'b', 'false'])
|
|
||||||
.catch(print);
|
|
||||||
}
|
|
||||||
|
|
||||||
toggleOsk() {
|
toggleOsk() {
|
||||||
if (this.#oskState) {
|
this.#oskState = !this.#oskState;
|
||||||
Tablet.closeOsk();
|
this.emit('osk-toggled', this.#oskState);
|
||||||
}
|
|
||||||
else {
|
|
||||||
Tablet.openOsk();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@ const HIDDEN_MARGIN = 340;
|
||||||
const ANIM_DURATION = 700;
|
const ANIM_DURATION = 700;
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { BoxGeneric } from 'global-types';
|
import { OskWindow } from 'global-types';
|
||||||
|
|
||||||
|
|
||||||
const releaseAllKeys = () => {
|
const releaseAllKeys = () => {
|
||||||
|
@ -23,11 +23,10 @@ const releaseAllKeys = () => {
|
||||||
]).catch(print);
|
]).catch(print);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (window) => {
|
export default (window: OskWindow) => {
|
||||||
const gesture = Gtk.GestureDrag.new(window);
|
const gesture = Gtk.GestureDrag.new(window);
|
||||||
const child = window.child as BoxGeneric;
|
|
||||||
|
|
||||||
child.setCss(`margin-bottom: -${HIDDEN_MARGIN}px;`);
|
window.child.setCss(`margin-bottom: -${HIDDEN_MARGIN}px;`);
|
||||||
|
|
||||||
let signals = [] as Array<number>;
|
let signals = [] as Array<number>;
|
||||||
|
|
||||||
|
@ -39,14 +38,14 @@ export default (window) => {
|
||||||
window.visible = true;
|
window.visible = true;
|
||||||
window.attribute.setSlideDown();
|
window.attribute.setSlideDown();
|
||||||
|
|
||||||
child.setCss(`
|
window.child.setCss(`
|
||||||
transition: margin-bottom 0.7s
|
transition: margin-bottom 0.7s
|
||||||
cubic-bezier(0.36, 0, 0.66, -0.56);
|
cubic-bezier(0.36, 0, 0.66, -0.56);
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
timeout(ANIM_DURATION + 10, () => {
|
timeout(ANIM_DURATION + 100 + 100, () => {
|
||||||
if (!Tablet.tabletMode) {
|
if (!Tablet.tabletMode) {
|
||||||
window.visible = false;
|
window.visible = false;
|
||||||
}
|
}
|
||||||
|
@ -54,7 +53,7 @@ export default (window) => {
|
||||||
releaseAllKeys();
|
releaseAllKeys();
|
||||||
window.attribute.setSlideUp();
|
window.attribute.setSlideUp();
|
||||||
|
|
||||||
child.setCss(`
|
window.child.setCss(`
|
||||||
transition: margin-bottom 0.7s
|
transition: margin-bottom 0.7s
|
||||||
cubic-bezier(0.36, 0, 0.66, -0.56);
|
cubic-bezier(0.36, 0, 0.66, -0.56);
|
||||||
margin-bottom: -${HIDDEN_MARGIN}px;
|
margin-bottom: -${HIDDEN_MARGIN}px;
|
||||||
|
@ -86,6 +85,10 @@ export default (window) => {
|
||||||
signals.push(
|
signals.push(
|
||||||
gesture.connect('drag-update', () => {
|
gesture.connect('drag-update', () => {
|
||||||
Hyprland.messageAsync('j/cursorpos').then((out) => {
|
Hyprland.messageAsync('j/cursorpos').then((out) => {
|
||||||
|
if (!window.attribute.startY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const currentY = JSON.parse(out).y;
|
const currentY = JSON.parse(out).y;
|
||||||
const offset = window.attribute.startY - currentY;
|
const offset = window.attribute.startY - currentY;
|
||||||
|
|
||||||
|
@ -93,7 +96,7 @@ export default (window) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(window.child as BoxGeneric).setCss(`
|
window.child.setCss(`
|
||||||
margin-bottom: ${offset - HIDDEN_MARGIN}px;
|
margin-bottom: ${offset - HIDDEN_MARGIN}px;
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
@ -103,7 +106,7 @@ export default (window) => {
|
||||||
// End drag
|
// End drag
|
||||||
signals.push(
|
signals.push(
|
||||||
gesture.connect('drag-end', () => {
|
gesture.connect('drag-end', () => {
|
||||||
(window.child as BoxGeneric).setCss(`
|
window.child.setCss(`
|
||||||
transition: margin-bottom 0.5s ease-in-out;
|
transition: margin-bottom 0.5s ease-in-out;
|
||||||
margin-bottom: -${HIDDEN_MARGIN}px;
|
margin-bottom: -${HIDDEN_MARGIN}px;
|
||||||
`);
|
`);
|
||||||
|
@ -127,6 +130,10 @@ export default (window) => {
|
||||||
signals.push(
|
signals.push(
|
||||||
gesture.connect('drag-update', () => {
|
gesture.connect('drag-update', () => {
|
||||||
Hyprland.messageAsync('j/cursorpos').then((out) => {
|
Hyprland.messageAsync('j/cursorpos').then((out) => {
|
||||||
|
if (!window.attribute.startY) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const currentY = JSON.parse(out).y;
|
const currentY = JSON.parse(out).y;
|
||||||
const offset = window.attribute.startY - currentY;
|
const offset = window.attribute.startY - currentY;
|
||||||
|
|
||||||
|
@ -134,7 +141,7 @@ export default (window) => {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
(window.child as BoxGeneric).setCss(`
|
window.child.setCss(`
|
||||||
margin-bottom: ${offset}px;
|
margin-bottom: ${offset}px;
|
||||||
`);
|
`);
|
||||||
});
|
});
|
||||||
|
@ -144,7 +151,7 @@ export default (window) => {
|
||||||
// End drag
|
// End drag
|
||||||
signals.push(
|
signals.push(
|
||||||
gesture.connect('drag-end', () => {
|
gesture.connect('drag-end', () => {
|
||||||
(window.child as BoxGeneric).setCss(`
|
window.child.setCss(`
|
||||||
transition: margin-bottom 0.5s ease-in-out;
|
transition: margin-bottom 0.5s ease-in-out;
|
||||||
margin-bottom: 0px;
|
margin-bottom: 0px;
|
||||||
`);
|
`);
|
||||||
|
|
|
@ -16,10 +16,10 @@ const COLOR = 'rgba(0, 0, 0, 0.3)';
|
||||||
const SPACING = 4;
|
const SPACING = 4;
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { BoxGeneric, WindowGeneric } from 'global-types';
|
import { BoxGeneric, OskWindow } from 'global-types';
|
||||||
|
|
||||||
|
|
||||||
export default (window: WindowGeneric) => Box({
|
export default (window: OskWindow) => Box({
|
||||||
vertical: true,
|
vertical: true,
|
||||||
children: [
|
children: [
|
||||||
CenterBox({
|
CenterBox({
|
||||||
|
|
|
@ -5,6 +5,8 @@ import Tablet from '../../services/tablet.ts';
|
||||||
import Gesture from './gesture.ts';
|
import Gesture from './gesture.ts';
|
||||||
import Keyboard from './keyboard.ts';
|
import Keyboard from './keyboard.ts';
|
||||||
|
|
||||||
|
/* Types */
|
||||||
|
import { OskWindow } from 'global-types';
|
||||||
|
|
||||||
// Start ydotool daemon
|
// Start ydotool daemon
|
||||||
execAsync('ydotoold').catch(print);
|
execAsync('ydotoold').catch(print);
|
||||||
|
@ -13,24 +15,16 @@ execAsync('ydotoold').catch(print);
|
||||||
export default () => {
|
export default () => {
|
||||||
const window = Window({
|
const window = Window({
|
||||||
name: 'osk',
|
name: 'osk',
|
||||||
visible: false,
|
|
||||||
layer: 'overlay',
|
layer: 'overlay',
|
||||||
anchor: ['left', 'bottom', 'right'],
|
anchor: ['left', 'bottom', 'right'],
|
||||||
|
})
|
||||||
|
.hook(Tablet, (self: OskWindow, state) => {
|
||||||
|
self.attribute.setVisible(state);
|
||||||
|
}, 'osk-toggled')
|
||||||
|
|
||||||
setup: (self) => {
|
.hook(Tablet, () => {
|
||||||
self
|
window.visible = !(!Tablet.tabletMode && !Tablet.oskState);
|
||||||
.hook(Tablet, (_, state) => {
|
}, 'mode-toggled');
|
||||||
// @ts-expect-error too lazy to do keyboard type
|
|
||||||
self.attribute.setVisible(state);
|
|
||||||
}, 'osk-toggled')
|
|
||||||
|
|
||||||
.hook(Tablet, () => {
|
|
||||||
if (!Tablet.tabletMode && !Tablet.oskState) {
|
|
||||||
window.visible = false;
|
|
||||||
}
|
|
||||||
}, 'mode-toggled');
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
window.child = Keyboard(window);
|
window.child = Keyboard(window);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
const Hyprland = await Service.import('hyprland');
|
|
||||||
const Bluetooth = await Service.import('bluetooth');
|
const Bluetooth = await Service.import('bluetooth');
|
||||||
|
|
||||||
import Brightness from '../services/brightness.ts';
|
import Brightness from '../services/brightness.ts';
|
||||||
|
@ -34,33 +33,17 @@ export default () => {
|
||||||
name: 'oskOn',
|
name: 'oskOn',
|
||||||
gesture: 'DU',
|
gesture: 'DU',
|
||||||
edge: 'B',
|
edge: 'B',
|
||||||
command: 'busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 ' +
|
command: () => {
|
||||||
'SetVisible b true',
|
Tablet.oskState = true;
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
TouchGestures.addGesture({
|
TouchGestures.addGesture({
|
||||||
name: 'oskOff',
|
name: 'oskOff',
|
||||||
gesture: 'UD',
|
gesture: 'UD',
|
||||||
edge: 'B',
|
edge: 'B',
|
||||||
command: 'busctl call --user sm.puri.OSK0 /sm/puri/OSK0 sm.puri.OSK0 ' +
|
command: () => {
|
||||||
'SetVisible b false',
|
Tablet.oskState = false;
|
||||||
});
|
},
|
||||||
|
|
||||||
TouchGestures.addGesture({
|
|
||||||
name: 'swipeSpotify1',
|
|
||||||
gesture: 'LR',
|
|
||||||
edge: 'L',
|
|
||||||
command: () => Hyprland.messageAsync(
|
|
||||||
'dispatch togglespecialworkspace spot',
|
|
||||||
),
|
|
||||||
});
|
|
||||||
|
|
||||||
TouchGestures.addGesture({
|
|
||||||
name: 'swipeSpotify2',
|
|
||||||
gesture: 'RL',
|
|
||||||
edge: 'L',
|
|
||||||
command: () => Hyprland.messageAsync(
|
|
||||||
'dispatch togglespecialworkspace spot',
|
|
||||||
),
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -88,7 +88,6 @@ in {
|
||||||
])
|
])
|
||||||
++ (optionals isTouchscreen (with pkgs; [
|
++ (optionals isTouchscreen (with pkgs; [
|
||||||
lisgd
|
lisgd
|
||||||
squeekboard
|
|
||||||
ydotool
|
ydotool
|
||||||
]));
|
]));
|
||||||
};
|
};
|
||||||
|
@ -100,12 +99,10 @@ in {
|
||||||
"layers, 0"
|
"layers, 0"
|
||||||
];
|
];
|
||||||
|
|
||||||
exec-once =
|
exec-once = [
|
||||||
[
|
"ags"
|
||||||
"ags"
|
"sleep 3; ags -r 'App.openWindow(\"applauncher\")'"
|
||||||
"sleep 3; ags -r 'App.openWindow(\"applauncher\")'"
|
];
|
||||||
]
|
|
||||||
++ optionals isTouchscreen ["squeekboard"];
|
|
||||||
|
|
||||||
bind = [
|
bind = [
|
||||||
"$mainMod SHIFT, E, exec, ags -t powermenu"
|
"$mainMod SHIFT, E, exec, ags -t powermenu"
|
||||||
|
|
Loading…
Reference in a new issue