This commit is contained in:
sankalp committed 2024-07-01 14:51:10 +05:45
1 parent 6b14451fe6
commit 1d69e6c2ce
17 files changed
+440 -189

No files matched your search

+78
View File
@@ -0,0 +1,78 @@
const apps_script = `python -OOO ${App.configDir}/scripts/apps.py`;
import { MaterialIcon } from "icons";
const Row = (app: string, title: string, icon: string) => Widget.EventBox({
class_name: "row",
on_primary_click: self => {
self.child.children[1]!.activate()
},
child: Widget.Box({
class_name: "row",
vpack: "start",
children: [
MaterialIcon(icon),
Widget.Box({
vertical: true,
hexpand: true,
vpack: "center",
children: [
Widget.Label({
hpack: "start",
class_name: "title",
label: title
})
]
}),
Widget.Entry({
hpack: "end",
css: "border: 2px solid; border-color: transparent;",
attribute: {
"get": (self) => {
Utils.execAsync(`${apps_script} --get ${app}`)
.then((out) => {
self.text = out;
})
.catch(print)
}
},
on_accept: self => {
Utils.execAsync(`${apps_script} --${app} ${self.text}`)
.then(() => {
self.css = "border: 2px solid; border-color: #66BB6A;"
Utils.timeout(1000, () => {
self.css = "border: 2px solid; border-color: transparent"
})
})
.catch(() => {
self.css = "border: 2px solid; border-color: @error;"
Utils.timeout(1000, () => {
self.css = "border: 2px solid; border-color: transparent"
})
self.attribute.get(self)
})
},
setup: (self) => {
self.attribute.get(self)
}
})
]
})
})
export function Apps() {
const box = Widget.Box({
vertical: true,
children: [
Row("browser", "Browser", "web"),
Row("editor", "Editor", "edit"),
Row("filemanager", "File manager", "folder"),
Row("terminal", "Terminal", "terminal")
],
})
return Widget.Scrollable({
hscroll: "never",
child: box,
vexpand: true
})
}
+11 -7
View File
@@ -3,7 +3,8 @@ import { Network } from "./network";
import { Bluetooth } from "./bluetooth";
import { Wallpapers } from "./wallpapers";
import { Info } from "./info";
import { Widget as WidgetType } from "types/widgets/widget";
import { Apps } from "./apps";
import { MaterialIcon } from "icons";
const hyprland = await Service.import("hyprland")
import Gtk from "gi://Gtk?version=3.0"
@@ -42,14 +43,15 @@ function Settings(cur_tab: string) {
"network": Page(Network(), "Network"),
"bluetooth": Page(Bluetooth(), "Bluetooth"),
"wallpaper": Page(Wallpapers(), "Wallpapers"),
"info": Page(Info(), "Info")
"info": Page(Info(), "Info"),
"apps": Page(Apps(), "Apps")
}
})
const Row = (name: string, label: string, icon: string = "image-missing") => Widget.Button({
on_clicked: () => { current_tab.setValue(name) },
child: Widget.Box({
children: [
Widget.Icon(icon),
MaterialIcon(icon),
Widget.Label(label)
]
}),
@@ -61,12 +63,14 @@ function Settings(cur_tab: string) {
class_name: "sidebar",
spacing: 2,
children: [
Row("network", "Network", "network-wireless-signal-excellent-symbolic"),
Row("bluetooth", "Bluetooth", "bluetooth-active-symbolic"),
Row("network", "Network", "signal_wifi_4_bar"),
Row("bluetooth", "Bluetooth", "bluetooth"),
Widget.Separator(),
Row("wallpaper", "Wallpapers", "folder-pictures-symbolic"),
Row("wallpaper", "Wallpapers", "image"),
Widget.Separator(),
Row("info", "Info", "dialog-information-symbolic"),
Row("apps", "Apps", "grid_view"),
Widget.Separator(),
Row("info", "Info", "info")
]
})
return Widget.Box({
+13 -4
View File
@@ -1,8 +1,17 @@
import Gtk from "gi://Gtk?version=3.0"
import { timeout } from "resource:///com/github/Aylur/ags/utils.js";
import { Variable as VariableType } from "types/variable";
import { MaterialIcon } from "icons";
const systemtray = await Service.import("systemtray")
const MATERIAL_SYMBOL_SIGNAL_STRENGTH = {
'network-wireless-signal-excellent-symbolic': "signal_wifi_4_bar",
'network-wireless-signal-good-symbolic': "network_wifi_3_bar",
'network-wireless-signal-ok-symbolic': "network_wifi_2_bar",
'network-wireless-signal-weak-symbolic': "network_wifi_1_bar",
'network-wireless-signal-none-symbolic': "signal_wifi_0_bar",
}
type AccessPoint = {
bssid: string | null;
address: string | null;
@@ -70,10 +79,10 @@ const WifiNetwork = (access_point: AccessPoint) => {
child: Widget.Box({
class_name: "wifi_network_box",
children: [
Widget.Icon({
icon: access_point.iconName,
size: 20
}),
MaterialIcon(
MATERIAL_SYMBOL_SIGNAL_STRENGTH[access_point.iconName!],
"20px"
),
// @ts-ignore
Widget.Box({
vertical: true,