mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-01-22 09:32:38 +00:00
update ags
This commit is contained in:
@@ -1,75 +1,85 @@
|
||||
const { Gdk, Gtk } = imports.gi;
|
||||
import { App, Service, Utils, Widget } from '../imports.js';
|
||||
import Applications from 'resource:///com/github/Aylur/ags/service/applications.js';
|
||||
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
|
||||
const { execAsync, exec } = Utils;
|
||||
const { Box, EventBox, Button, Label, Scrollable } = Widget;
|
||||
const {Gdk, Gtk} = imports.gi
|
||||
import {App, Service, Utils, Widget} from "../imports.js"
|
||||
import Applications from "resource:///com/github/Aylur/ags/service/applications.js"
|
||||
import Hyprland from "resource:///com/github/Aylur/ags/service/hyprland.js"
|
||||
const {execAsync, exec} = Utils
|
||||
const {Box, EventBox, Button, Label, Scrollable} = Widget
|
||||
|
||||
const CLIPBOARD_SHOWN_ENTRIES = 20;
|
||||
const CLIPBOARD_SHOWN_ENTRIES = 20
|
||||
|
||||
const ClipboardItems = () => {
|
||||
return Box({
|
||||
vertical: true,
|
||||
className: 'spacing-v-5',
|
||||
connections: [
|
||||
[App, (box, name, visible) => {
|
||||
if (name != 'sideleft')
|
||||
return;
|
||||
return Box({
|
||||
vertical: true,
|
||||
className: "spacing-v-5",
|
||||
connections: [
|
||||
[
|
||||
App,
|
||||
(box, name, visible) => {
|
||||
if (name != "sideleft") return
|
||||
|
||||
let clipboardContents = exec('cliphist list'); // Output is lines like this: 1000 copied text
|
||||
clipboardContents = clipboardContents.split('\n');
|
||||
let clipboardContents = exec("cliphist list") // Output is lines like this: 1000 copied text
|
||||
clipboardContents = clipboardContents.split("\n")
|
||||
|
||||
// console.log(clipboardContents);
|
||||
// console.log(`bash -c 'echo "${clipboardContents[0]}" | sed "s/ /\\t/" | cliphist decode'`);
|
||||
// console.log(exec(`bash -c 'echo "${clipboardContents[0]}" | sed "s/ /\\t/" | cliphist decode'`));
|
||||
// console.log(clipboardContents);
|
||||
// console.log(`bash -c 'echo "${clipboardContents[0]}" | sed "s/ /\\t/" | cliphist decode'`);
|
||||
// console.log(exec(`bash -c 'echo "${clipboardContents[0]}" | sed "s/ /\\t/" | cliphist decode'`));
|
||||
|
||||
box.children = clipboardContents.map((text, i) => {
|
||||
if (i >= CLIPBOARD_SHOWN_ENTRIES) return;
|
||||
return Button({
|
||||
onClicked: () => {
|
||||
print(`bash` + `-c` + `echo "${clipboardContents[i]}" | sed "s/ /\\\t/" | cliphist decode | wl-copy`);
|
||||
execAsync(`bash`, `-c`, `echo "${clipboardContents[i]}" | sed "s/ /\\\t/" | cliphist decode | wl-copy`).catch(print);
|
||||
App.closeWindow('sideleft');
|
||||
},
|
||||
className: 'sidebar-clipboard-item',
|
||||
child: Box({
|
||||
children: [
|
||||
Label({
|
||||
label: text,
|
||||
className: 'txt-small',
|
||||
truncate: 'end',
|
||||
})
|
||||
]
|
||||
})
|
||||
})
|
||||
});
|
||||
}]
|
||||
]
|
||||
});
|
||||
box.children = clipboardContents.map((text, i) => {
|
||||
if (i >= CLIPBOARD_SHOWN_ENTRIES) return
|
||||
return Button({
|
||||
onClicked: () => {
|
||||
print(
|
||||
`bash` +
|
||||
`-c` +
|
||||
`echo "${clipboardContents[i]}" | sed "s/ /\\\t/" | cliphist decode | wl-copy`,
|
||||
)
|
||||
execAsync(
|
||||
`bash`,
|
||||
`-c`,
|
||||
`echo "${clipboardContents[i]}" | sed "s/ /\\\t/" | cliphist decode | wl-copy`,
|
||||
).catch(print)
|
||||
App.closeWindow("sideleft")
|
||||
},
|
||||
className: "sidebar-clipboard-item",
|
||||
child: Box({
|
||||
children: [
|
||||
Label({
|
||||
label: text,
|
||||
className: "txt-small",
|
||||
truncate: "end",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
})
|
||||
})
|
||||
},
|
||||
],
|
||||
],
|
||||
})
|
||||
}
|
||||
|
||||
export default () => Box({
|
||||
export default () =>
|
||||
Box({
|
||||
vertical: true,
|
||||
children: [
|
||||
EventBox({
|
||||
onPrimaryClick: () => App.closeWindow('sideleft'),
|
||||
onSecondaryClick: () => App.closeWindow('sideleft'),
|
||||
onMiddleClick: () => App.closeWindow('sideleft'),
|
||||
}),
|
||||
ClipboardItems(),
|
||||
// Box({
|
||||
// vertical: true,
|
||||
// vexpand: true,
|
||||
// className: 'sidebar-left',
|
||||
// children: [
|
||||
// Widget.Box({
|
||||
// className: 'spacing-v-5',
|
||||
// children: [
|
||||
// ClipboardItems(),
|
||||
// ]
|
||||
// })
|
||||
// ],
|
||||
// }),
|
||||
]
|
||||
});
|
||||
|
||||
EventBox({
|
||||
onPrimaryClick: () => App.closeWindow("sideleft"),
|
||||
onSecondaryClick: () => App.closeWindow("sideleft"),
|
||||
onMiddleClick: () => App.closeWindow("sideleft"),
|
||||
}),
|
||||
ClipboardItems(),
|
||||
// Box({
|
||||
// vertical: true,
|
||||
// vexpand: true,
|
||||
// className: 'sidebar-left',
|
||||
// children: [
|
||||
// Widget.Box({
|
||||
// className: 'spacing-v-5',
|
||||
// children: [
|
||||
// ClipboardItems(),
|
||||
// ]
|
||||
// })
|
||||
// ],
|
||||
// }),
|
||||
],
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user