Switch to SwayFX
This commit is contained in:
parent
6571feaff7
commit
c310042564
41 changed files with 1450 additions and 294 deletions
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 512 512"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="microchip-solid.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1" />
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="1.6816406"
|
||||
inkscape:cx="256"
|
||||
inkscape:cy="255.70267"
|
||||
inkscape:window-width="1274"
|
||||
inkscape:window-height="1432"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg1" />
|
||||
<!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||
<path
|
||||
d="M176 24c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40c-35.3 0-64 28.7-64 64l-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0 0 56-40 0c-13.3 0-24 10.7-24 24s10.7 24 24 24l40 0c0 35.3 28.7 64 64 64l0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40 56 0 0 40c0 13.3 10.7 24 24 24s24-10.7 24-24l0-40c35.3 0 64-28.7 64-64l40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0 0-56 40 0c13.3 0 24-10.7 24-24s-10.7-24-24-24l-40 0c0-35.3-28.7-64-64-64l0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40c0-13.3-10.7-24-24-24s-24 10.7-24 24l0 40-56 0 0-40zM160 128l192 0c17.7 0 32 14.3 32 32l0 192c0 17.7-14.3 32-32 32l-192 0c-17.7 0-32-14.3-32-32l0-192c0-17.7 14.3-32 32-32zm192 32l-192 0 0 192 192 0 0-192z"
|
||||
id="path1"
|
||||
style="fill:#ffffff" />
|
||||
</svg>
|
After Width: | Height: | Size: 2 KiB |
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 512 512"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="music-symbolic.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1" />
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="1.6816406"
|
||||
inkscape:cx="256"
|
||||
inkscape:cy="256.29733"
|
||||
inkscape:window-width="1254"
|
||||
inkscape:window-height="714"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg1" />
|
||||
<!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||
<path
|
||||
d="M499.1 6.3c8.1 6 12.9 15.6 12.9 25.7l0 72 0 264c0 44.2-43 80-96 80s-96-35.8-96-80s43-80 96-80c11.2 0 22 1.6 32 4.6L448 147 192 223.8 192 432c0 44.2-43 80-96 80s-96-35.8-96-80s43-80 96-80c11.2 0 22 1.6 32 4.6L128 200l0-72c0-14.1 9.3-26.6 22.8-30.7l320-96c9.7-2.9 20.2-1.1 28.3 5z"
|
||||
id="path1"
|
||||
style="fill:#ffffff" />
|
||||
</svg>
|
After Width: | Height: | Size: 1.5 KiB |
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg width="535" height="535" viewBox="0 0 501.56251 501.56249" id="svg2" version="1.1" inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)" sodipodi:docname="nix-snowflake-colours.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/2000/svg" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://creativecommons.org/ns#" xmlns:dc="http://purl.org/dc/elements/1.1/">
|
||||
<defs id="defs4">
|
||||
<linearGradient inkscape:collect="always" id="linearGradient5562">
|
||||
<stop style="stop-color:#699ad7;stop-opacity:1" offset="0" id="stop5564"/>
|
||||
<stop id="stop5566" offset="0.24345198" style="stop-color:#7eb1dd;stop-opacity:1"/>
|
||||
<stop style="stop-color:#7ebae4;stop-opacity:1" offset="1" id="stop5568"/>
|
||||
</linearGradient>
|
||||
<linearGradient inkscape:collect="always" id="linearGradient5053">
|
||||
<stop style="stop-color:#415e9a;stop-opacity:1" offset="0" id="stop5055"/>
|
||||
<stop id="stop5057" offset="0.23168644" style="stop-color:#4a6baf;stop-opacity:1"/>
|
||||
<stop style="stop-color:#5277c3;stop-opacity:1" offset="1" id="stop5059"/>
|
||||
</linearGradient>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5562" id="linearGradient4328" gradientUnits="userSpaceOnUse" gradientTransform="translate(70.650339,-1055.1511)" x1="200.59668" y1="351.41116" x2="290.08701" y2="506.18814"/>
|
||||
<linearGradient inkscape:collect="always" xlink:href="#linearGradient5053" id="linearGradient4330" gradientUnits="userSpaceOnUse" gradientTransform="translate(864.69589,-1491.3405)" x1="-584.19934" y1="782.33563" x2="-496.29703" y2="937.71399"/>
|
||||
</defs>
|
||||
<sodipodi:namedview id="base" pagecolor="#ffffff" bordercolor="#666666" borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2" inkscape:zoom="0.70904368" inkscape:cx="99.429699" inkscape:cy="195.33352" inkscape:document-units="px" inkscape:current-layer="layer3" showgrid="false" inkscape:window-width="1920" inkscape:window-height="1050" inkscape:window-x="1920" inkscape:window-y="30" inkscape:window-maximized="1" inkscape:snap-global="true" fit-margin-top="0" fit-margin-left="0" fit-margin-right="0" fit-margin-bottom="0" inkscape:showpageshadow="2" inkscape:pagecheckerboard="0" inkscape:deskcolor="#d1d1d1"/>
|
||||
<metadata id="metadata7">
|
||||
<rdf:RDF>
|
||||
<cc:Work rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type rdf:resource="http://purl.org/dc/dcmitype/StillImage"/>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g inkscape:groupmode="layer" id="layer3" inkscape:label="gradient-logo" style="display:inline;opacity:1" transform="translate(-156.41121,933.30685)">
|
||||
<g id="g2" transform="matrix(0.99994059,0,0,0.99994059,-0.06321798,33.188377)" style="stroke-width:1.00006">
|
||||
<path sodipodi:nodetypes="cccccccccc" inkscape:connector-curvature="0" id="path3336-6" d="m 309.54892,-710.38827 122.19683,211.67512 -56.15706,0.5268 -32.6236,-56.8692 -32.85645,56.5653 -27.90237,-0.011 -14.29086,-24.6896 46.81047,-80.4901 -33.22946,-57.8257 z" style="opacity:1;fill:url(#linearGradient4328);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.00018;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"/>
|
||||
<use height="100%" width="100%" transform="rotate(60,407.11155,-715.78724)" id="use3439-6" inkscape:transform-center-y="151.59082" inkscape:transform-center-x="124.43045" xlink:href="#path3336-6" y="0" x="0" style="stroke-width:1.00006"/>
|
||||
<use height="100%" width="100%" transform="rotate(-60,407.31177,-715.70016)" id="use3445-0" inkscape:transform-center-y="75.573958" inkscape:transform-center-x="-168.20651" xlink:href="#path3336-6" y="0" x="0" style="stroke-width:1.00006"/>
|
||||
<use height="100%" width="100%" transform="rotate(180,407.41868,-715.7565)" id="use3449-5" inkscape:transform-center-y="-139.94592" inkscape:transform-center-x="59.669705" xlink:href="#path3336-6" y="0" x="0" style="stroke-width:1.00006"/>
|
||||
<path style="color:#000000;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;opacity:1;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;fill:url(#linearGradient4330);fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:3.00018;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate" d="m 309.54892,-710.38827 122.19683,211.67512 -56.15706,0.5268 -32.6236,-56.8692 -32.85645,56.5653 -27.90237,-0.011 -14.29086,-24.6896 46.81047,-80.4901 -33.22946,-57.8256 z" id="path4260-0" inkscape:connector-curvature="0" sodipodi:nodetypes="cccccccccc"/>
|
||||
<use height="100%" width="100%" transform="rotate(120,407.33916,-716.08356)" id="use4354-5" xlink:href="#path4260-0" y="0" x="0" style="display:inline;stroke-width:1.00006"/>
|
||||
<use height="100%" width="100%" transform="rotate(-120,407.28823,-715.86995)" id="use4362-2" xlink:href="#path4260-0" y="0" x="0" style="display:inline;stroke-width:1.00006"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 5.4 KiB |
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
viewBox="0 0 576 512"
|
||||
version="1.1"
|
||||
id="svg1"
|
||||
sodipodi:docname="memory-symbolic.svg"
|
||||
inkscape:version="1.3.2 (091e20ef0f, 2023-11-25)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs1" />
|
||||
<sodipodi:namedview
|
||||
id="namedview1"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
inkscape:zoom="0.18793403"
|
||||
inkscape:cx="-106.42032"
|
||||
inkscape:cy="1069.5242"
|
||||
inkscape:window-width="1254"
|
||||
inkscape:window-height="714"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg1" />
|
||||
<!--!Font Awesome Free 6.6.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.-->
|
||||
<path
|
||||
d="M64 64C28.7 64 0 92.7 0 128l0 7.4c0 6.8 4.4 12.6 10.1 16.3C23.3 160.3 32 175.1 32 192s-8.7 31.7-21.9 40.3C4.4 236 0 241.8 0 248.6L0 320l576 0 0-71.4c0-6.8-4.4-12.6-10.1-16.3C552.7 223.7 544 208.9 544 192s8.7-31.7 21.9-40.3c5.7-3.7 10.1-9.5 10.1-16.3l0-7.4c0-35.3-28.7-64-64-64L64 64zM576 352L0 352l0 64c0 17.7 14.3 32 32 32l48 0 0-32c0-8.8 7.2-16 16-16s16 7.2 16 16l0 32 96 0 0-32c0-8.8 7.2-16 16-16s16 7.2 16 16l0 32 96 0 0-32c0-8.8 7.2-16 16-16s16 7.2 16 16l0 32 96 0 0-32c0-8.8 7.2-16 16-16s16 7.2 16 16l0 32 48 0c17.7 0 32-14.3 32-32l0-64zM192 160l0 64c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32s32 14.3 32 32zm128 0l0 64c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32s32 14.3 32 32zm128 0l0 64c0 17.7-14.3 32-32 32s-32-14.3-32-32l0-64c0-17.7 14.3-32 32-32s32 14.3 32 32z"
|
||||
id="path1"
|
||||
style="fill:#ffffff" />
|
||||
</svg>
|
After Width: | Height: | Size: 2 KiB |
270
hosts/totsugeki/home-manager/desktop/ags/config/config.js
Normal file
270
hosts/totsugeki/home-manager/desktop/ags/config/config.js
Normal file
|
@ -0,0 +1,270 @@
|
|||
import cpu from "./services/cpu.js";
|
||||
import ram from "./services/ram.js";
|
||||
import { launcher } from "./widgets/launcher/launcher.js";
|
||||
const { speaker } = await Service.import("audio");
|
||||
const mpris = await Service.import("mpris");
|
||||
const sway = await Service.import("sway");
|
||||
const players = mpris.bind("players");
|
||||
const date = Variable("", {
|
||||
poll: [1000, 'date "+%H %M %S %b %e"'],
|
||||
});
|
||||
|
||||
App.addIcons(`${App.configDir}/assets`);
|
||||
|
||||
function Workspaces() {
|
||||
return Widget.Box({
|
||||
children: Array.from({ length: 10 }, (_, i) => {
|
||||
i += 1;
|
||||
return Widget.Box({
|
||||
class_name: "workspace-button",
|
||||
children: [Widget.Label({ hexpand: true, label: i.toString() })],
|
||||
hpack: "center",
|
||||
setup: (btn) => {
|
||||
btn.hook(
|
||||
sway,
|
||||
(btn) => {
|
||||
const ws = sway.getWorkspace(`${i}`);
|
||||
btn.toggleClassName(
|
||||
"occupied",
|
||||
ws?.nodes.length + ws?.floating_nodes.length > 0,
|
||||
);
|
||||
},
|
||||
"notify::workspaces",
|
||||
);
|
||||
|
||||
btn.hook(sway.active.workspace, (btn) => {
|
||||
btn.toggleClassName("active", sway.active.workspace.name == i);
|
||||
});
|
||||
},
|
||||
});
|
||||
}),
|
||||
spacing: 4,
|
||||
vertical: true,
|
||||
});
|
||||
}
|
||||
|
||||
function ProcessorUsage() {
|
||||
return Widget.Box({
|
||||
class_name: "system-stats",
|
||||
css: cpu.bind("current-usage").as((usage) => {
|
||||
let level = (usage * 100).toFixed(0);
|
||||
return `
|
||||
background: linear-gradient(
|
||||
90deg, rgba(26, 27, 38, 0.6) ${level}%, rgba(26, 27, 38, 0.4) ${level}%
|
||||
)`;
|
||||
}),
|
||||
children: [
|
||||
Widget.Icon({
|
||||
class_names: ["system-stats-icon"],
|
||||
icon: "microchip-symbolic",
|
||||
size: 16,
|
||||
}),
|
||||
Widget.Label({
|
||||
class_names: ["system-stats-text"],
|
||||
hexpand: true,
|
||||
label: cpu.bind("current-usage").as((usage) => {
|
||||
return `${(usage * 100).toFixed(0)}%`;
|
||||
}),
|
||||
}),
|
||||
],
|
||||
vertical: true,
|
||||
});
|
||||
}
|
||||
|
||||
function MemoryUsage() {
|
||||
return Widget.Box({
|
||||
class_name: "system-stats",
|
||||
css: ram.bind("current-usage-percentage").as((usage) => {
|
||||
let level = (usage * 100).toFixed(0);
|
||||
return `
|
||||
background: linear-gradient(
|
||||
90deg, rgba(26, 27, 38, 0.6) ${level}%, rgba(26, 27, 38, 0.4) ${level}%
|
||||
)`;
|
||||
}),
|
||||
children: [
|
||||
Widget.Icon({
|
||||
class_names: ["system-stats-icon"],
|
||||
icon: "ram-custom-symbolic",
|
||||
size: 16,
|
||||
}),
|
||||
Widget.Label({
|
||||
class_names: ["system-stats-text"],
|
||||
hexpand: true,
|
||||
label: ram.bind("current-usage-percentage").as((usage) => {
|
||||
return `${(usage * 100).toFixed(0)}%`;
|
||||
}),
|
||||
}),
|
||||
],
|
||||
tooltip_text: ram.bind("current-usage").as((usage) => {
|
||||
let usageGb = (usage / 1024 ** 2).toFixed(2);
|
||||
let totalGb = (ram.total_available / 1024 ** 2).toFixed(2);
|
||||
return `${usageGb}/${totalGb}GB (${(ram.current_usage_percentage * 100).toFixed(2)}%)`;
|
||||
}),
|
||||
vertical: true,
|
||||
});
|
||||
}
|
||||
|
||||
function CurrentSong(player) {
|
||||
return Widget.Box({
|
||||
class_name: "music-indicator",
|
||||
children: [
|
||||
Widget.Box({
|
||||
class_name: "album-art",
|
||||
css: player.bind("cover_path").as((url) => {
|
||||
if (url == undefined) {
|
||||
return `
|
||||
background-color: rgba(0, 0, 0, 0.2);
|
||||
background-image: url('${App.configDir}/assets/music-symbolic.svg');
|
||||
background-size: 50% 50%;
|
||||
background-repeat: no-repeat;
|
||||
background-position: center;
|
||||
`;
|
||||
}
|
||||
return `background-image: url('${url}'); background-size: cover;`;
|
||||
}),
|
||||
}),
|
||||
Widget.Icon({
|
||||
class_name: "playback-status",
|
||||
icon: player.bind("play-back-status").as((status) => {
|
||||
if (status == "Playing") {
|
||||
return "media-playback-start";
|
||||
} else if (status == "Paused") {
|
||||
return "media-playback-pause";
|
||||
}
|
||||
return "";
|
||||
}),
|
||||
}),
|
||||
],
|
||||
// TODO: fill background based on track position
|
||||
css: player.bind("position").as((position) => {
|
||||
if (position == -1) {
|
||||
return "";
|
||||
}
|
||||
return "";
|
||||
}),
|
||||
vertical: true,
|
||||
});
|
||||
}
|
||||
|
||||
function CTest() {
|
||||
// TODO: only show active player
|
||||
return Widget.Box({
|
||||
vertical: true,
|
||||
visible: players.as((p) => p.length > 0),
|
||||
children: players.as((p) => p.map(CurrentSong)),
|
||||
});
|
||||
}
|
||||
|
||||
function ProfilePicture() {
|
||||
return Widget.Box({
|
||||
class_name: "profile-picture",
|
||||
css: "background-image: url('/home/avery/.face.icon'); background-size: cover",
|
||||
});
|
||||
}
|
||||
|
||||
function VolumeWidget() {
|
||||
return Widget.Box({
|
||||
class_name: "volume-widget",
|
||||
children: [
|
||||
Widget.Icon({
|
||||
icon: speaker.bind("volume").as((l) => {
|
||||
let level = l.toFixed(2) * 100;
|
||||
if (level == 0) {
|
||||
return "audio-volume-muted";
|
||||
} else if (level > 0 && level <= 30) {
|
||||
return "audio-volume-low";
|
||||
} else if (level > 30 && level <= 70) {
|
||||
return "audio-volume-medium";
|
||||
} else {
|
||||
return "audio-volume-high";
|
||||
}
|
||||
}),
|
||||
size: 10,
|
||||
}),
|
||||
Widget.Box({
|
||||
class_name: "volume-box",
|
||||
css: speaker.bind("volume").as((l) => {
|
||||
let level = l.toFixed(2) * 100;
|
||||
if (level >= 0 && level <= 100) {
|
||||
return `
|
||||
background: linear-gradient(
|
||||
90deg, #7aa2f7 ${level}%, #24283b ${level}%
|
||||
);
|
||||
`;
|
||||
} else if (level > 100 && level <= 200) {
|
||||
return `
|
||||
background: linear-gradient(
|
||||
90deg, #f7768e ${level - 100}%, #7aa2f7 ${level - 100}%
|
||||
);
|
||||
`;
|
||||
} else {
|
||||
return "background: #f7768e";
|
||||
}
|
||||
}),
|
||||
hpack: "fill",
|
||||
}),
|
||||
],
|
||||
});
|
||||
}
|
||||
function ClockWidget() {
|
||||
return Widget.Box({
|
||||
children: [
|
||||
Widget.Label({
|
||||
class_name: "clock-hours",
|
||||
label: date.bind().as((d) => {
|
||||
return d.split(" ")[0];
|
||||
}),
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: "clock-minutes",
|
||||
label: date.bind().as((d) => {
|
||||
return d.split(" ")[1];
|
||||
}),
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: "clock-seconds",
|
||||
label: date.bind().as((d) => {
|
||||
return d.split(" ")[2];
|
||||
}),
|
||||
}),
|
||||
],
|
||||
class_name: "clock",
|
||||
vertical: true,
|
||||
});
|
||||
}
|
||||
|
||||
const barContainer = Widget.Box({
|
||||
class_name: "bar",
|
||||
vpack: "fill",
|
||||
spacing: 6,
|
||||
vertical: true,
|
||||
children: [
|
||||
Workspaces(),
|
||||
Widget.Box({ expand: true, vpack: "fill" }), // Separator
|
||||
CTest(),
|
||||
ProcessorUsage(),
|
||||
MemoryUsage(),
|
||||
ClockWidget(),
|
||||
],
|
||||
});
|
||||
|
||||
const bar = Widget.Window({
|
||||
name: "bar",
|
||||
anchor: ["left", "top", "bottom"],
|
||||
exclusivity: "exclusive",
|
||||
child: barContainer,
|
||||
});
|
||||
|
||||
Utils.monitorFile(
|
||||
`${App.configDir}/style.css`,
|
||||
|
||||
function () {
|
||||
App.resetCss;
|
||||
App.applyCss(`${App.configDir}/style.css`);
|
||||
},
|
||||
);
|
||||
|
||||
App.config({
|
||||
style: "./style.css",
|
||||
windows: [bar, launcher],
|
||||
});
|
|
@ -0,0 +1,40 @@
|
|||
class CPUService extends Service {
|
||||
static {
|
||||
Service.register(this, {}, { "current-usage": ["float", "r"] });
|
||||
}
|
||||
|
||||
#previousIdle = 0.0;
|
||||
#previousTotal = 0.0;
|
||||
#currentUsage = 0.0;
|
||||
|
||||
get current_usage() {
|
||||
return this.#currentUsage;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.#update();
|
||||
const interval = setInterval(() => {
|
||||
this.#update();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
#update() {
|
||||
const currentValues = Utils.exec(
|
||||
"sh -c 'cat /proc/stat | grep cpu | head -n 1 | tr -s \" \"'",
|
||||
)
|
||||
.split(" ")
|
||||
.slice(1, 10)
|
||||
.map(Number);
|
||||
let idle = currentValues[3];
|
||||
let total = currentValues.reduce((a, b) => a + b, 0);
|
||||
this.#currentUsage =
|
||||
1.0 - (idle - this.#previousIdle) / (total - this.#previousTotal);
|
||||
this.#previousIdle = idle;
|
||||
this.#previousTotal = total;
|
||||
this.changed("current-usage");
|
||||
}
|
||||
}
|
||||
|
||||
const cpu = new CPUService();
|
||||
export default cpu;
|
|
@ -0,0 +1,56 @@
|
|||
class RAMService extends Service {
|
||||
static {
|
||||
Service.register(
|
||||
this,
|
||||
{},
|
||||
{
|
||||
"current-usage": ["float", "r"],
|
||||
"current-usage-percentage": ["float", "r"],
|
||||
"total-available": ["float", "r"],
|
||||
},
|
||||
);
|
||||
}
|
||||
#currentUsage = 0;
|
||||
#totalAvailable = 0;
|
||||
|
||||
get current_usage() {
|
||||
return this.#currentUsage;
|
||||
}
|
||||
|
||||
get current_usage_percentage() {
|
||||
return this.#currentUsage / this.#totalAvailable;
|
||||
}
|
||||
|
||||
get total_available() {
|
||||
return this.#totalAvailable;
|
||||
}
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
this.#totalAvailable = Number(
|
||||
Utils.exec(
|
||||
'sh -c \'cat /proc/meminfo | grep MemTotal | tr -s " " | cut -d " " -f 2\'',
|
||||
),
|
||||
);
|
||||
this.#update();
|
||||
const interval = setInterval(() => {
|
||||
this.#update();
|
||||
}, 2000);
|
||||
}
|
||||
|
||||
#update() {
|
||||
this.#currentUsage =
|
||||
this.#totalAvailable -
|
||||
Number(
|
||||
Utils.exec(
|
||||
'sh -c \'cat /proc/meminfo | grep MemAvailable | tr -s " " | cut -d " " -f 2\'',
|
||||
),
|
||||
);
|
||||
this.emit("changed");
|
||||
this.notify("current-usage");
|
||||
this.notify("current-usage-percentage");
|
||||
}
|
||||
}
|
||||
|
||||
const ram = new RAMService();
|
||||
export default ram;
|
185
hosts/totsugeki/home-manager/desktop/ags/config/style.css
Normal file
185
hosts/totsugeki/home-manager/desktop/ags/config/style.css
Normal file
|
@ -0,0 +1,185 @@
|
|||
@define-color bg rgba(26, 27, 38, 0.4);
|
||||
@define-color normal rgba(26, 27, 38, 0.6);
|
||||
@define-color hover rgba(76, 77, 88, 0.8);
|
||||
@define-color press rgba(76, 77, 88, 0.2);
|
||||
@define-color bg-noa rgb(26, 27, 38);
|
||||
|
||||
window {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.bar {
|
||||
background-color: @bg;
|
||||
border-radius: 8px;
|
||||
margin: 4px 0px 4px 4px;
|
||||
padding: 4px 4px;
|
||||
min-width: 32px;
|
||||
}
|
||||
|
||||
.volume-widget {
|
||||
margin: 4px;
|
||||
}
|
||||
|
||||
.volume-box {
|
||||
border-radius: 8px;
|
||||
margin: 4px;
|
||||
min-height: 4px;
|
||||
}
|
||||
|
||||
.clock {
|
||||
border-radius: 8px;
|
||||
background-color: @bg;
|
||||
font-weight: bold;
|
||||
font-family: "Iosevka Nerd Font";
|
||||
font-size: 1.2em;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.clock-hours {
|
||||
color: white;
|
||||
}
|
||||
|
||||
.clock-minutes {
|
||||
color: #ddd;
|
||||
}
|
||||
|
||||
.clock-seconds {
|
||||
color: #bbb;
|
||||
}
|
||||
|
||||
.music-indicator {
|
||||
background-color: @bg;
|
||||
border-radius: 8px;
|
||||
}
|
||||
|
||||
.profile-picture,
|
||||
.album-art {
|
||||
border-radius: 8px;
|
||||
min-height: 32px;
|
||||
min-width: 32px;
|
||||
}
|
||||
|
||||
.playback-status {
|
||||
margin: 3px 0;
|
||||
}
|
||||
|
||||
.system-stats {
|
||||
background-color: @bg;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
font-family: "Iosevka Nerd Font";
|
||||
font-weight: bold;
|
||||
font-size: 0.95em;
|
||||
padding: 4px 0;
|
||||
}
|
||||
|
||||
.workspace-button {
|
||||
background-color: @bg;
|
||||
border-radius: 8px;
|
||||
color: #c0caf5;
|
||||
font-family: "Iosevka Nerd Font";
|
||||
font-weight: bold;
|
||||
font-size: 1em;
|
||||
min-height: 20px;
|
||||
min-width: 20px;
|
||||
transition:
|
||||
background-color 0.3s,
|
||||
color 0.3s,
|
||||
min-width 0.2s;
|
||||
}
|
||||
|
||||
.occupied {
|
||||
border-radius: 8px;
|
||||
min-width: 24px;
|
||||
}
|
||||
|
||||
.active {
|
||||
color: @bg-noa;
|
||||
border-radius: 8px;
|
||||
min-width: 32px;
|
||||
}
|
||||
|
||||
.active:nth-child(1) {
|
||||
background-color: #f7768e;
|
||||
}
|
||||
|
||||
.active:nth-child(2) {
|
||||
background-color: #ff9e64;
|
||||
}
|
||||
|
||||
.active:nth-child(3) {
|
||||
background-color: #e0af68;
|
||||
}
|
||||
|
||||
.active:nth-child(4) {
|
||||
background-color: #9ece6a;
|
||||
}
|
||||
|
||||
.active:nth-child(5) {
|
||||
background-color: #73daca;
|
||||
}
|
||||
|
||||
.active:nth-child(6) {
|
||||
background-color: #7dcfff;
|
||||
}
|
||||
|
||||
.active:nth-child(7) {
|
||||
background-color: #2ac3de;
|
||||
}
|
||||
|
||||
.active:nth-child(8) {
|
||||
background-color: #7aa2f7;
|
||||
}
|
||||
|
||||
.active:nth-child(9) {
|
||||
background-color: #bb9af7;
|
||||
}
|
||||
|
||||
.active:nth-child(10) {
|
||||
background-color: #c0caf5;
|
||||
}
|
||||
|
||||
.launcher {
|
||||
background-color: @bg;
|
||||
border-radius: 8px;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.launcher-search {
|
||||
background-color: @normal;
|
||||
border: 2px solid transparent;
|
||||
border-radius: 8px;
|
||||
box-shadow: none;
|
||||
caret-color: white;
|
||||
color: white;
|
||||
font-weight: 500;
|
||||
font-size: 1.1em;
|
||||
}
|
||||
|
||||
.launcher-search:focus {
|
||||
border: 2px solid white;
|
||||
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.application {
|
||||
all: unset;
|
||||
background-color: @normal;
|
||||
border-radius: 8px;
|
||||
color: white;
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.application:hover,
|
||||
.application:focus {
|
||||
background-color: @hover;
|
||||
}
|
||||
|
||||
.application:active {
|
||||
background-color: @press;
|
||||
}
|
||||
|
||||
.application_name {
|
||||
font-size: 1.4em;
|
||||
font-weight: 500;
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
export const Application = (application) =>
|
||||
Widget.Button({
|
||||
class_name: "application",
|
||||
on_clicked: () => {
|
||||
App.closeWindow("launcher");
|
||||
application.launch();
|
||||
},
|
||||
attribute: { application },
|
||||
child: Widget.Box({
|
||||
children: [
|
||||
Widget.Icon({
|
||||
icon: application.icon_name || "",
|
||||
size: 32,
|
||||
}),
|
||||
Widget.Label({
|
||||
class_name: "application_name",
|
||||
label: application.name,
|
||||
xalign: 0,
|
||||
vpack: "center",
|
||||
truncate: "end",
|
||||
}),
|
||||
],
|
||||
spacing: 8,
|
||||
}),
|
||||
});
|
|
@ -0,0 +1,87 @@
|
|||
import { Application } from "./application.js";
|
||||
const { query } = await Service.import("applications");
|
||||
|
||||
const Launcher = ({ width = 500, height = 600, spacing = 4 }) => {
|
||||
let applications = query("").map(Application);
|
||||
|
||||
const list = Widget.Box({
|
||||
css: "background-color: transparent",
|
||||
vertical: true,
|
||||
spacing,
|
||||
children: applications,
|
||||
});
|
||||
|
||||
function repopulate() {
|
||||
applications = query("").map(Application);
|
||||
list.children = applications;
|
||||
}
|
||||
|
||||
const searchBox = Widget.Entry({
|
||||
class_name: "launcher-search",
|
||||
hexpand: true,
|
||||
placeholder_text: "Buscar",
|
||||
xalign: 0.5,
|
||||
on_accept: () => {
|
||||
const results = applications.filter((item) => item.visible);
|
||||
if (results[0]) {
|
||||
App.closeWindow("launcher");
|
||||
results[0].attribute.application.launch();
|
||||
}
|
||||
},
|
||||
on_change: ({ text }) => {
|
||||
text = text.toLowerCase();
|
||||
list.children = applications.sort((a, b) => {
|
||||
var firstMatches = a.attribute.application.name
|
||||
.toLowerCase()
|
||||
.match(text ?? "");
|
||||
var secondMatches = b.attribute.application.name
|
||||
.toLowerCase()
|
||||
.match(text ?? "");
|
||||
if (firstMatches && secondMatches) {
|
||||
return 0;
|
||||
} else if (firstMatches) {
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
|
||||
applications.forEach((item) => {
|
||||
item.visible = item.attribute.application.match(text ?? "");
|
||||
});
|
||||
},
|
||||
});
|
||||
|
||||
return Widget.Box({
|
||||
class_name: "launcher",
|
||||
vertical: true,
|
||||
spacing,
|
||||
children: [
|
||||
searchBox,
|
||||
Widget.Scrollable({
|
||||
hscroll: "never",
|
||||
css: `min-width: ${width}px; min-height: ${height}px;`,
|
||||
child: list,
|
||||
vexpand: true,
|
||||
}),
|
||||
],
|
||||
setup: (self) =>
|
||||
self.hook(App, (_, windowName, visible) => {
|
||||
if (windowName == "launcher" && visible) {
|
||||
repopulate();
|
||||
searchBox.text = "";
|
||||
searchBox.grab_focus();
|
||||
}
|
||||
}),
|
||||
});
|
||||
};
|
||||
|
||||
export const launcher = Widget.Window({
|
||||
name: "launcher",
|
||||
setup: (self) =>
|
||||
self.keybind("Escape", () => {
|
||||
App.closeWindow("launcher");
|
||||
}),
|
||||
visible: false,
|
||||
keymode: "exclusive",
|
||||
child: Launcher({}),
|
||||
});
|
6
hosts/totsugeki/home-manager/desktop/ags/default.nix
Normal file
6
hosts/totsugeki/home-manager/desktop/ags/default.nix
Normal file
|
@ -0,0 +1,6 @@
|
|||
{ ... }: {
|
||||
programs.ags = {
|
||||
enable = true;
|
||||
# configDir = ./widgets;
|
||||
};
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue