automatically set theme + sort workspace ids

This commit is contained in:
Soph :3 2024-07-21 16:17:17 +03:00
parent e881630989
commit 427b95da31
Signed by: sophie
GPG key ID: EDA5D222A0C270F2
2 changed files with 20 additions and 16 deletions

View file

@ -20,17 +20,17 @@ function Workspaces(monitor) {
const workspaces = hyprland const workspaces = hyprland
.bind("workspaces") .bind("workspaces")
.as((ws) => .as((ws) => {
ws const g = ws.filter((z) => z.monitorID == monitor);
.filter((z) => z.monitorID == monitor) g.sort((a,b) => a.id - b.id)
.map(({ id }) => return g.map(({ id }) =>
Widget.Button({ Widget.Button({
on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`), on_clicked: () => hyprland.messageAsync(`dispatch workspace ${id}`),
child: Widget.Label(`${id}`), child: Widget.Label(`${id}`),
class_name: activeId.as((i) => `${i === id ? "focused" : ""}`), class_name: activeId.as((i) => `${i === id ? "focused" : ""}`),
}) })
)
); );
});
return Widget.Box({ return Widget.Box({
class_name: "workspaces", class_name: "workspaces",
@ -54,13 +54,15 @@ function Clock() {
function Media() { function Media() {
const label = Utils.watch("", mpris, "player-changed", () => { const label = Utils.watch("", mpris, "player-changed", () => {
const player = mpris.players.find(z => z.entry == "spotify"); const player = mpris.players.find((z) => z.entry == "spotify");
if (player) { if (player) {
const ms = player.metadata["mpris:length"] / 1000; const ms = player.metadata["mpris:length"] / 1000;
const minutes = Math.floor((ms/1000)/60) const minutes = Math.floor(ms / 1000 / 60);
const seconds = Math.floor((ms/1000)%60) const seconds = Math.floor((ms / 1000) % 60);
return `${player.track_artists.join(", ")} - ${player.track_title} [${minutes}:${seconds}]`; return `${player.track_artists.join(", ")} - ${
player.track_title
} [${minutes}:${seconds}]`;
} else { } else {
return "Nothing is playing"; return "Nothing is playing";
} }

View file

@ -17,6 +17,8 @@ exec-once=~/.config/hypr/portal.sh
exec-once=swww init && swww img ~/wallpaper.jpg exec-once=swww init && swww img ~/wallpaper.jpg
exec-once=nm-applet exec-once=nm-applet
exec-once=ags exec-once=ags
exec-once=gsettings set org.gnome.desktop.interface gtk-theme 'Catppuccin-Latte-Standard-Pink-Light'
exec=~/.config/hypr/import-gsettings.sh exec=~/.config/hypr/import-gsettings.sh
env = XCURSOR_SIZE,24 env = XCURSOR_SIZE,24