ags: fmt with prettier

This commit is contained in:
notohh 2024-02-01 17:48:30 -05:00
parent 3a3965b4d9
commit c65b649ff4
Signed by: notohh
GPG key ID: BD47506D475EE86D
8 changed files with 70 additions and 79 deletions

View file

@ -1,26 +1,23 @@
module.exports = { module.exports = {
"env": { env: {
"browser": true, browser: true,
"es2021": true es2021: true
}, },
"extends": "eslint:recommended", extends: "eslint:recommended",
"overrides": [ overrides: [
{ {
"env": { env: {
"node": true node: true
}, },
"files": [ files: [".eslintrc.{js,cjs}"],
".eslintrc.{js,cjs}" parserOptions: {
], sourceType: "script"
"parserOptions": { }
"sourceType": "script"
}
}
],
"parserOptions": {
"ecmaVersion": "latest",
"sourceType": "module"
},
"rules": {
} }
} ],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module"
},
rules: {}
};

View file

@ -0,0 +1,3 @@
{
"trailingComma" : "none"
}

View file

@ -7,17 +7,15 @@ const css = App.configDir + "/style.css";
Utils.exec(`sass ${scss} ${css}`); Utils.exec(`sass ${scss} ${css}`);
function reloadCss() { function reloadCss() {
console.log("scss updating"); console.log("scss updating");
Utils.exec(`sass ${scss} ${css}`); Utils.exec(`sass ${scss} ${css}`);
App.resetCss(); App.resetCss();
App.applyCss(css); App.applyCss(css);
} }
Utils.monitorFile(`${App.configDir}/scss`, reloadCss, "directory"); Utils.monitorFile(`${App.configDir}/scss`, reloadCss, "directory");
export default { export default {
style: css, style: css,
windows: [ windows: [Bar(2)]
Bar(2),
],
}; };

View file

@ -7,23 +7,16 @@ import { Workspaces } from "./widgets/hyprland.js";
const Start = () => const Start = () =>
Widget.Box({ Widget.Box({
hpack: "start", hpack: "start",
children: [ children: [nixosLogo(), Workspaces()]
nixosLogo(),
Workspaces(),
],
}); });
const Center = () => const Center = () =>
Widget.Box({ Widget.Box({
children: [ children: [Media()]
Media(),
],
}); });
const End = () => const End = () =>
Widget.Box({ Widget.Box({
hpack: "end", hpack: "end",
children: [ children: [Time()]
Time(),
],
}); });
const Bar = (monitor) => const Bar = (monitor) =>
@ -35,8 +28,8 @@ const Bar = (monitor) =>
child: Widget.CenterBox({ child: Widget.CenterBox({
startWidget: Start(), startWidget: Start(),
centerWidget: Center(), centerWidget: Center(),
endWidget: End(), endWidget: End()
}), })
}); });
export { Bar }; export { Bar };

View file

@ -8,11 +8,12 @@ const Workspaces = () =>
Widget.Button({ Widget.Button({
on_clicked: () => Hyprland.sendMessage(`dispatch workspace ${id}`), on_clicked: () => Hyprland.sendMessage(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`), child: Widget.Label(`${id}`),
class_name: Hyprland.active.workspace.bind("id") class_name: Hyprland.active.workspace
.transform((i) => `${i === id ? "focused" : ""}`), .bind("id")
.transform((i) => `${i === id ? "focused" : ""}`)
}) })
); );
}), })
}); });
export { Workspaces }; export { Workspaces };

View file

@ -3,14 +3,18 @@ import { Mpris, Widget } from "../../import.js";
const Media = () => const Media = () =>
Widget.Box({ Widget.Box({
class_name: "media", class_name: "media",
child: Widget.Label("-").hook(Mpris, (self) => { child: Widget.Label("-").hook(
if (Mpris.players[0]) { Mpris,
const { track_artists, track_title } = Mpris.players[0]; (self) => {
self.label = `${track_artists.join(", ")} - ${track_title}`; if (Mpris.players[0]) {
} else { const { track_artists, track_title } = Mpris.players[0];
self.label = "Nothing is playing"; self.label = `${track_artists.join(", ")} - ${track_title}`;
} } else {
}, "player-changed"), self.label = "Nothing is playing";
}
},
"player-changed"
)
}); });
export { Media }; export { Media };

View file

@ -3,14 +3,12 @@ import { Utils, Widget } from "../../import.js";
const Time = () => const Time = () =>
Widget.Box({ Widget.Box({
child: Widget.Label({ child: Widget.Label({
className: "date", className: "date"
}).poll( }).poll(1000, (self) =>
1000, Utils.execAsync(["date", "+%a %b %d %H:%M"]).then(
(self) => (time) => (self.label = time)
Utils.execAsync(["date", "+%a %b %d %H:%M"]).then((time) => )
self.label = time )
),
),
}); });
export { Time }; export { Time };

View file

@ -1,15 +1,12 @@
{ {
"compilerOptions": { "compilerOptions": {
"module": "ESNext", "module": "ESNext",
"moduleResolution": "Node", "moduleResolution": "Node",
"target": "ES2020", "target": "ES2020",
"jsx": "react", "jsx": "react",
"allowImportingTsExtensions": true, "allowImportingTsExtensions": true,
"strictNullChecks": true, "strictNullChecks": true,
"strictFunctionTypes": true "strictFunctionTypes": true
}, },
"exclude": [ "exclude": ["node_modules", "**/node_modules/*"]
"node_modules",
"**/node_modules/*"
]
} }