added stuff

This commit is contained in:
vali 2024-04-09 23:11:33 +02:00
commit 7d4f626b7d
907 changed files with 70990 additions and 0 deletions

View file

@ -0,0 +1,11 @@
import { Widget } from "../../imports.js";
const { Box } = Widget;
export const DesktopIcons = () =>
Box({
className: "desktopIcons",
vertical: true,
hpack: "start",
vpack: "start",
children: [],
});

View file

@ -0,0 +1,98 @@
import { Widget, Utils } from "../../imports.js";
const { Box, EventBox, Label, MenuItem, Menu } = Widget;
const { exec, execAsync } = Utils;
/**
* Creates a menu item with an icon.
* @param {string} icon - The icon to display for the menu item.
* @param {string} itemLabel - The label for the menu item.
* @param {Function} onClick - The function to be executed when the menu item is activated.
* @returns {Object} A menu item object with the specified icon, label, and click action.
*/
function ItemWithIcon(icon, itemLabel, onClick) {
return MenuItem({
className: "desktopMenuItem",
child: Box({
children: [
Label({
className: "desktopMenuItemIcon",
label: icon,
}),
Label(itemLabel),
],
}),
onActivate: onClick,
});
}
const Separator = () =>
MenuItem({
child: Box({
className: "separator",
css: `
min-height: 1px;
margin: 3px 6px;
`,
}),
});
const rioMenu = () => {
return [
ItemWithIcon("󰆍", "Terminal", () =>
exec(
'sh -c "$HOME/.config/ags/bin/open_window `slurp -d -c 999999 -w 2` foot"',
),
),
ItemWithIcon("󰘖", "Resize", () =>
exec(
'sh -c "$HOME/.config/ags/bin/move_window `slurp -d -c 999999 -w 2`"',
),
),
ItemWithIcon("󰁁", "Move", () => exec("hyprctl dispatch submap move")),
ItemWithIcon("󰅖", "Delete", () => exec("hyprctl kill")),
Separator(),
];
};
const Powermenu = () => {
return MenuItem({
className: "desktopMenuItem",
child: Box({
children: [
Label({
className: "desktopMenuItemIcon",
label: "󰐥",
}),
Label("Powermenu"),
],
}),
submenu: Menu({
className: "desktopMenu",
children: [
ItemWithIcon("󰍁", "Lock", () => Utils.exec("gtklock")),
ItemWithIcon("󰍃", "Log Out", () =>
exec("hyprctl dispatch exit"),
),
ItemWithIcon("󰖔", "Suspend", () => exec("systemctl suspend")),
ItemWithIcon("󰜉", "Reboot", () => exec("systemctl reboot")),
ItemWithIcon("󰐥", "Shutdown", () => exec("systemctl poweroff")),
],
}),
});
};
export const DesktopMenu = () =>
EventBox({
onSecondaryClick: (_, event) =>
Menu({
className: "desktopMenu",
children: [
...rioMenu(),
ItemWithIcon("󰈊", "Colorpicker", () =>
execAsync(["hyprpicker", "-a", "wl-copy"]),
),
Separator(),
Powermenu(),
],
}).popup_at_pointer(event),
});

View file

@ -0,0 +1,17 @@
import { Widget } from "../../imports.js";
const { Window } = Widget;
import { DesktopMenu } from "./desktopMenu.js";
import { DesktopIcons } from "./desktopIcons.js";
export const Desktop = ({ monitor } = {}) =>
Window({
name: "desktop",
anchor: ["top", "bottom", "left", "right"],
layer: "bottom",
monitor,
child: Widget.Overlay({
child: DesktopMenu(),
overlays: [DesktopIcons()],
}),
});