ags
This commit is contained in:
parent
157ddf12fc
commit
16ecb2818a
5 changed files with 268 additions and 13 deletions
162
flake.lock
generated
162
flake.lock
generated
|
|
@ -1,5 +1,23 @@
|
|||
{
|
||||
"nodes": {
|
||||
"ags": {
|
||||
"inputs": {
|
||||
"nixpkgs": "nixpkgs"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1715703984,
|
||||
"narHash": "sha256-0BZkMui6aCqswMCouvp0G90tAxDOxVnxTvG6TDZsDaI=",
|
||||
"owner": "Aylur",
|
||||
"repo": "ags",
|
||||
"rev": "11150225e62462bcd431d1e55185e810190a730a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "Aylur",
|
||||
"repo": "ags",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"arkenfox": {
|
||||
"inputs": {
|
||||
"flake-compat": "flake-compat",
|
||||
|
|
@ -321,7 +339,7 @@
|
|||
"inputs": {
|
||||
"crane": "crane",
|
||||
"flake-utils": "flake-utils_3",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"rust-overlay": "rust-overlay"
|
||||
},
|
||||
"locked": {
|
||||
|
|
@ -380,6 +398,28 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprlang": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"rose-pine-hyprcursor",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": "systems_4"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1709914708,
|
||||
"narHash": "sha256-bR4o3mynoTa1Wi4ZTjbnsZ6iqVcPGriXp56bZh5UFTk=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprlang",
|
||||
"rev": "a685493fdbeec01ca8ccdf1f3655c044a8ce2fe2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprlang",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"impermanence": {
|
||||
"locked": {
|
||||
"lastModified": 1717932370,
|
||||
|
|
@ -397,16 +437,16 @@
|
|||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1704842529,
|
||||
"narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=",
|
||||
"lastModified": 1708475490,
|
||||
"narHash": "sha256-g1v0TsWBQPX97ziznfJdWhgMyMGtoBFs102xSYO4syU=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5",
|
||||
"rev": "0e74ca98a74bc7270d28838369593635a5db3260",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
|
|
@ -444,6 +484,22 @@
|
|||
}
|
||||
},
|
||||
"nixpkgs_2": {
|
||||
"locked": {
|
||||
"lastModified": 1704842529,
|
||||
"narHash": "sha256-OTeQA+F8d/Evad33JMfuXC89VMetQbsU4qcaePchGr4=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "eabe8d3eface69f5bb16c18f8662a702f50c20d5",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixpkgs-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"locked": {
|
||||
"lastModified": 1709479366,
|
||||
"narHash": "sha256-n6F0n8UV6lnTZbYPl1A9q1BS0p4hduAv1mGAP17CVd0=",
|
||||
|
|
@ -459,7 +515,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_3": {
|
||||
"nixpkgs_4": {
|
||||
"locked": {
|
||||
"lastModified": 1717868076,
|
||||
"narHash": "sha256-c83Y9t815Wa34khrux81j8K8ET94ESmCuwORSKm2bQY=",
|
||||
|
|
@ -475,7 +531,23 @@
|
|||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_4": {
|
||||
"nixpkgs_5": {
|
||||
"locked": {
|
||||
"lastModified": 1710272261,
|
||||
"narHash": "sha256-g0bDwXFmTE7uGDOs9HcJsfLFhH7fOsASbAuOzDC+fhQ=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "0ad13a6833440b8e238947e47bea7f11071dc2b2",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "NixOS",
|
||||
"ref": "nixos-unstable",
|
||||
"repo": "nixpkgs",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs_6": {
|
||||
"locked": {
|
||||
"lastModified": 1714912032,
|
||||
"narHash": "sha256-clkcOIkg8G4xuJh+1onLG4HPMpbtzdLv4rHxFzgsH9c=",
|
||||
|
|
@ -496,7 +568,7 @@
|
|||
"flake-compat": "flake-compat_2",
|
||||
"flake-utils": "flake-utils",
|
||||
"gitignore": "gitignore",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"nixpkgs": "nixpkgs_2",
|
||||
"nixpkgs-stable": "nixpkgs-stable"
|
||||
},
|
||||
"locked": {
|
||||
|
|
@ -515,17 +587,39 @@
|
|||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"ags": "ags",
|
||||
"arkenfox": "arkenfox",
|
||||
"flake-utils": "flake-utils_2",
|
||||
"helix": "helix",
|
||||
"home-manager": "home-manager",
|
||||
"impermanence": "impermanence",
|
||||
"nixpkgs": "nixpkgs_3",
|
||||
"nixpkgs": "nixpkgs_4",
|
||||
"nixpkgs-stable": "nixpkgs-stable_2",
|
||||
"rose-pine-hyprcursor": "rose-pine-hyprcursor",
|
||||
"sops-nix": "sops-nix",
|
||||
"stylix": "stylix"
|
||||
}
|
||||
},
|
||||
"rose-pine-hyprcursor": {
|
||||
"inputs": {
|
||||
"hyprlang": "hyprlang",
|
||||
"nixpkgs": "nixpkgs_5",
|
||||
"utils": "utils"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1711302328,
|
||||
"narHash": "sha256-wLuFLI6S5DOretqJN05+kvrs8cbnZKfVLXrJ4hvI/Tg=",
|
||||
"owner": "ndom91",
|
||||
"repo": "rose-pine-hyprcursor",
|
||||
"rev": "7e0473876f0e6d2308813a78fe84a6c6430b112b",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "ndom91",
|
||||
"repo": "rose-pine-hyprcursor",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"rust-overlay": {
|
||||
"inputs": {
|
||||
"flake-utils": [
|
||||
|
|
@ -586,7 +680,7 @@
|
|||
"flake-compat": "flake-compat_3",
|
||||
"gnome-shell": "gnome-shell",
|
||||
"home-manager": "home-manager_2",
|
||||
"nixpkgs": "nixpkgs_4"
|
||||
"nixpkgs": "nixpkgs_6"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1717866166,
|
||||
|
|
@ -646,6 +740,54 @@
|
|||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_4": {
|
||||
"locked": {
|
||||
"lastModified": 1689347949,
|
||||
"narHash": "sha256-12tWmuL2zgBgZkdoB6qXZsgJEH9LR3oUgpaQq2RbI80=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"rev": "31732fcf5e8fea42e59c2488ad31a0e651500f68",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default-linux",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"systems_5": {
|
||||
"locked": {
|
||||
"lastModified": 1681028828,
|
||||
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "nix-systems",
|
||||
"repo": "default",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"utils": {
|
||||
"inputs": {
|
||||
"systems": "systems_5"
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1710146030,
|
||||
"narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "numtide",
|
||||
"repo": "flake-utils",
|
||||
"type": "github"
|
||||
}
|
||||
}
|
||||
},
|
||||
"root": "root",
|
||||
|
|
|
|||
108
home/ags/applauncher/applauncher.js
Normal file
108
home/ags/applauncher/applauncher.js
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
|
||||
const { query } = await Service.import("applications")
|
||||
const WINDOW_NAME = "applauncher"
|
||||
|
||||
/** @param {import('resource:///com/github/Aylur/ags/service/applications.js').Application} app */
|
||||
const AppItem = app => Widget.Button({
|
||||
on_clicked: () => {
|
||||
App.closeWindow(WINDOW_NAME)
|
||||
app.launch()
|
||||
},
|
||||
attribute: { app },
|
||||
child: Widget.Box({
|
||||
children: [
|
||||
Widget.Icon({
|
||||
icon: app.icon_name || "",
|
||||
size: 42,
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: "title",
|
||||
label: app.name,
|
||||
xalign: 0,
|
||||
vpack: "center",
|
||||
truncate: "end",
|
||||
}),
|
||||
],
|
||||
}),
|
||||
})
|
||||
|
||||
const Applauncher = ({ width = 500, height = 500, spacing = 12 }) => {
|
||||
// list of application buttons
|
||||
let applications = query("").map(AppItem)
|
||||
|
||||
// container holding the buttons
|
||||
const list = Widget.Box({
|
||||
vertical: true,
|
||||
children: applications,
|
||||
spacing,
|
||||
})
|
||||
|
||||
// repopulate the box, so the most frequent apps are on top of the list
|
||||
function repopulate() {
|
||||
applications = query("").map(AppItem)
|
||||
list.children = applications
|
||||
}
|
||||
|
||||
// search entry
|
||||
const entry = Widget.Entry({
|
||||
hexpand: true,
|
||||
css: `margin-bottom: ${spacing}px;`,
|
||||
|
||||
// to launch the first item on Enter
|
||||
on_accept: () => {
|
||||
// make sure we only consider visible (searched for) applications
|
||||
const results = applications.filter((item) => item.visible);
|
||||
if (results[0]) {
|
||||
App.toggleWindow(WINDOW_NAME)
|
||||
results[0].attribute.app.launch()
|
||||
}
|
||||
},
|
||||
|
||||
// filter out the list
|
||||
on_change: ({ text }) => applications.forEach(item => {
|
||||
item.visible = item.attribute.app.match(text ?? "")
|
||||
}),
|
||||
})
|
||||
|
||||
return Widget.Box({
|
||||
vertical: true,
|
||||
css: `margin: ${spacing * 2}px;`,
|
||||
children: [
|
||||
entry,
|
||||
|
||||
// wrap the list in a scrollable
|
||||
Widget.Scrollable({
|
||||
hscroll: "never",
|
||||
css: `min-width: ${width}px;`
|
||||
+ `min-height: ${height}px;`,
|
||||
child: list,
|
||||
}),
|
||||
],
|
||||
setup: self => self.hook(App, (_, windowName, visible) => {
|
||||
if (windowName !== WINDOW_NAME)
|
||||
return
|
||||
|
||||
// when the applauncher shows up
|
||||
if (visible) {
|
||||
repopulate()
|
||||
entry.text = ""
|
||||
entry.grab_focus()
|
||||
}
|
||||
}),
|
||||
})
|
||||
}
|
||||
|
||||
// there needs to be only one instance
|
||||
export const applauncher = Widget.Window({
|
||||
name: WINDOW_NAME,
|
||||
setup: self => self.keybind("Escape", () => {
|
||||
App.closeWindow(WINDOW_NAME)
|
||||
}),
|
||||
visible: false,
|
||||
keymode: "exclusive",
|
||||
child: Applauncher({
|
||||
width: 500,
|
||||
height: 500,
|
||||
spacing: 12,
|
||||
}),
|
||||
})
|
||||
5
home/ags/applauncher/config.js
Normal file
5
home/ags/applauncher/config.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
import { applauncher } from "./applauncher.js"
|
||||
|
||||
App.config({
|
||||
windows: [applauncher],
|
||||
})
|
||||
|
|
@ -3,6 +3,6 @@
|
|||
|
||||
programs.ags = {
|
||||
enable = true;
|
||||
configDir = ./widgets/bar;
|
||||
configDir = ./widgets/applauncher;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@
|
|||
"$mainMod, E, exec, $fileManager"
|
||||
"$mainMod, A, togglefloating,"
|
||||
"$mainMod, R, exec, rofi -show drun"
|
||||
"$mainMod, P, pseudo,"
|
||||
"$mainMod, D, pseudo,"
|
||||
"$mainMod, S, togglesplit,"
|
||||
|
||||
"$mainMod, P, togglespecialworkspace, keepass"
|
||||
|
|
@ -128,7 +128,7 @@
|
|||
|
||||
", print, exec, hyprshot -m region -o /home/lilith/sync/screenshots -z"
|
||||
"CTRL, print, exec, hyprshot -m output -o /home/lilith/sync/screenshots -z"
|
||||
|
||||
|
||||
"$mainMod, H, movefocus, l"
|
||||
"$mainMod, L, movefocus, r"
|
||||
"$mainMod, K, movefocus, u"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue