ags: fmt with prettier
This commit is contained in:
parent
3a3965b4d9
commit
c65b649ff4
8 changed files with 70 additions and 79 deletions
|
@ -1,26 +1,23 @@
|
|||
module.exports = {
|
||||
"env": {
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"overrides": [
|
||||
{
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"files": [
|
||||
".eslintrc.{js,cjs}"
|
||||
],
|
||||
"parserOptions": {
|
||||
"sourceType": "script"
|
||||
}
|
||||
}
|
||||
],
|
||||
"parserOptions": {
|
||||
"ecmaVersion": "latest",
|
||||
"sourceType": "module"
|
||||
},
|
||||
"rules": {
|
||||
env: {
|
||||
browser: true,
|
||||
es2021: true
|
||||
},
|
||||
extends: "eslint:recommended",
|
||||
overrides: [
|
||||
{
|
||||
env: {
|
||||
node: true
|
||||
},
|
||||
files: [".eslintrc.{js,cjs}"],
|
||||
parserOptions: {
|
||||
sourceType: "script"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
parserOptions: {
|
||||
ecmaVersion: "latest",
|
||||
sourceType: "module"
|
||||
},
|
||||
rules: {}
|
||||
};
|
||||
|
|
3
home/ags/config/.prettierrc.json
Normal file
3
home/ags/config/.prettierrc.json
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"trailingComma" : "none"
|
||||
}
|
|
@ -7,17 +7,15 @@ const css = App.configDir + "/style.css";
|
|||
Utils.exec(`sass ${scss} ${css}`);
|
||||
|
||||
function reloadCss() {
|
||||
console.log("scss updating");
|
||||
Utils.exec(`sass ${scss} ${css}`);
|
||||
App.resetCss();
|
||||
App.applyCss(css);
|
||||
console.log("scss updating");
|
||||
Utils.exec(`sass ${scss} ${css}`);
|
||||
App.resetCss();
|
||||
App.applyCss(css);
|
||||
}
|
||||
|
||||
Utils.monitorFile(`${App.configDir}/scss`, reloadCss, "directory");
|
||||
|
||||
export default {
|
||||
style: css,
|
||||
windows: [
|
||||
Bar(2),
|
||||
],
|
||||
};
|
||||
style: css,
|
||||
windows: [Bar(2)]
|
||||
};
|
||||
|
|
|
@ -7,23 +7,16 @@ import { Workspaces } from "./widgets/hyprland.js";
|
|||
const Start = () =>
|
||||
Widget.Box({
|
||||
hpack: "start",
|
||||
children: [
|
||||
nixosLogo(),
|
||||
Workspaces(),
|
||||
],
|
||||
children: [nixosLogo(), Workspaces()]
|
||||
});
|
||||
const Center = () =>
|
||||
Widget.Box({
|
||||
children: [
|
||||
Media(),
|
||||
],
|
||||
children: [Media()]
|
||||
});
|
||||
const End = () =>
|
||||
Widget.Box({
|
||||
hpack: "end",
|
||||
children: [
|
||||
Time(),
|
||||
],
|
||||
children: [Time()]
|
||||
});
|
||||
|
||||
const Bar = (monitor) =>
|
||||
|
@ -35,8 +28,8 @@ const Bar = (monitor) =>
|
|||
child: Widget.CenterBox({
|
||||
startWidget: Start(),
|
||||
centerWidget: Center(),
|
||||
endWidget: End(),
|
||||
}),
|
||||
endWidget: End()
|
||||
})
|
||||
});
|
||||
|
||||
export { Bar };
|
||||
|
|
|
@ -8,11 +8,12 @@ const Workspaces = () =>
|
|||
Widget.Button({
|
||||
on_clicked: () => Hyprland.sendMessage(`dispatch workspace ${id}`),
|
||||
child: Widget.Label(`${id}`),
|
||||
class_name: Hyprland.active.workspace.bind("id")
|
||||
.transform((i) => `${i === id ? "focused" : ""}`),
|
||||
class_name: Hyprland.active.workspace
|
||||
.bind("id")
|
||||
.transform((i) => `${i === id ? "focused" : ""}`)
|
||||
})
|
||||
);
|
||||
}),
|
||||
})
|
||||
});
|
||||
|
||||
export { Workspaces };
|
||||
|
|
|
@ -3,14 +3,18 @@ import { Mpris, Widget } from "../../import.js";
|
|||
const Media = () =>
|
||||
Widget.Box({
|
||||
class_name: "media",
|
||||
child: Widget.Label("-").hook(Mpris, (self) => {
|
||||
if (Mpris.players[0]) {
|
||||
const { track_artists, track_title } = Mpris.players[0];
|
||||
self.label = `${track_artists.join(", ")} - ${track_title}`;
|
||||
} else {
|
||||
self.label = "Nothing is playing";
|
||||
}
|
||||
}, "player-changed"),
|
||||
child: Widget.Label("-").hook(
|
||||
Mpris,
|
||||
(self) => {
|
||||
if (Mpris.players[0]) {
|
||||
const { track_artists, track_title } = Mpris.players[0];
|
||||
self.label = `${track_artists.join(", ")} - ${track_title}`;
|
||||
} else {
|
||||
self.label = "Nothing is playing";
|
||||
}
|
||||
},
|
||||
"player-changed"
|
||||
)
|
||||
});
|
||||
|
||||
export { Media };
|
||||
|
|
|
@ -3,14 +3,12 @@ import { Utils, Widget } from "../../import.js";
|
|||
const Time = () =>
|
||||
Widget.Box({
|
||||
child: Widget.Label({
|
||||
className: "date",
|
||||
}).poll(
|
||||
1000,
|
||||
(self) =>
|
||||
Utils.execAsync(["date", "+%a %b %d %H:%M"]).then((time) =>
|
||||
self.label = time
|
||||
),
|
||||
),
|
||||
className: "date"
|
||||
}).poll(1000, (self) =>
|
||||
Utils.execAsync(["date", "+%a %b %d %H:%M"]).then(
|
||||
(time) => (self.label = time)
|
||||
)
|
||||
)
|
||||
});
|
||||
|
||||
export { Time };
|
||||
export { Time };
|
||||
|
|
|
@ -1,15 +1,12 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES2020",
|
||||
"jsx": "react",
|
||||
"allowImportingTsExtensions": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules",
|
||||
"**/node_modules/*"
|
||||
]
|
||||
}
|
||||
"compilerOptions": {
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Node",
|
||||
"target": "ES2020",
|
||||
"jsx": "react",
|
||||
"allowImportingTsExtensions": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true
|
||||
},
|
||||
"exclude": ["node_modules", "**/node_modules/*"]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue