diff --git a/home-manager/modules/ags.nix b/home-manager/modules/ags.nix index 62c4503..0de77a0 100644 --- a/home-manager/modules/ags.nix +++ b/home-manager/modules/ags.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: { +{ config, inputs, pkgs, ... }: { imports = [ inputs.ags.homeManagerModules.default ]; programs.ags = { diff --git a/home-manager/modules/ags/app.ts b/home-manager/modules/ags/app.ts index 4b7ea48..2421411 100644 --- a/home-manager/modules/ags/app.ts +++ b/home-manager/modules/ags/app.ts @@ -4,7 +4,7 @@ import Bar from "./widget/Bar" App.start({ css: style, - instanceName: "js", + instanceName: "ags", requestHandler(request, res) { print(request) res("ok") diff --git a/home-manager/modules/ags/colors.scss b/home-manager/modules/ags/colors.scss new file mode 100644 index 0000000..69cfb5c --- /dev/null +++ b/home-manager/modules/ags/colors.scss @@ -0,0 +1,4 @@ +$bg: #1e1e2e; // base00 +$surface0: #313244; // base02 +$fg: #cdd6f4; // base05 +$accent: #a6e3a1; // base0B diff --git a/home-manager/modules/ags/style.scss b/home-manager/modules/ags/style.scss index f5f771a..990ba9e 100644 --- a/home-manager/modules/ags/style.scss +++ b/home-manager/modules/ags/style.scss @@ -1,69 +1,83 @@ @use "sass:color"; +@use "colors.scss" as *; -$bg: #212223; -$fg: #f1f1f1; -$accent: #378DF7; -$radius: 7px; +$radius: 10px; + +%item { + all: unset; + background: $bg; + border-radius: $radius; + padding: 4px; + + & + &, .item + & { margin-left: 4px; } + + label { margin: 0 8px; } +} window.Bar { border: none; box-shadow: none; - background-color: $bg; + background-color: transparent; color: $fg; font-size: 1.1em; font-weight: bold; - - label { - margin: 0 8px; + + .Container { + margin: 10px 10px 0; } .Workspaces { button { all: unset; - background-color: transparent; &:hover label { - background-color: color.adjust($fg, $alpha: -0.84); - border-color: color.adjust($accent, $alpha: -0.8); + background: $surface0; + color: $accent; } &:active label { - background-color: color.adjust($fg, $alpha: -0.8) + background: $surface0; + color: $accent; } } label { transition: 200ms; - padding: 0 8px; + padding: 0 6px; margin: 2px; border-radius: $radius; border: 1pt solid transparent; } .focused label { - color: $accent; + background: $accent; + color: $bg; border-color: $accent; } } - .SysTray { - margin-right: 8px; + .SysTray button { + all: unset; + padding: 8px; + border-radius: inherit; - button { - padding: 0 4px; + &:hover { + background: $surface0; } } - .FocusedClient { - color: $accent; - } - - .Media .Cover { - min-height: 1.2em; - min-width: 1.2em; - border-radius: $radius; - background-position: center; - background-size: contain; + .Media { + &.playing { + border: 2pt solid $accent; + } + + .Cover { + min-height: 1.2em; + min-width: 1.2em; + border-radius: $radius; + background-position: center; + background-size: contain; + } } .Battery label { @@ -71,36 +85,11 @@ window.Bar { margin-left: 0; } - .AudioSlider { - * { - all: unset; - } + .Time { padding: 0 8px; } - icon { - margin-right: .6em; - } + .AudioSlider icon { margin-left: 8px; } - & { - margin: 0 1em; - } - - trough { - background-color: color.adjust($fg, $alpha: -0.8); - border-radius: $radius; - } - - highlight { - background-color: $accent; - min-height: .8em; - border-radius: $radius; - } - - slider { - background-color: $fg; - border-radius: $radius; - min-height: 1em; - min-width: 1em; - margin: -.2em; - } + .Workspaces, .Media, .SysTray, .AudioSlider, .Time { + @extend %item; } } diff --git a/home-manager/modules/ags/widget/Bar.tsx b/home-manager/modules/ags/widget/Bar.tsx index e2b580d..4dc422b 100644 --- a/home-manager/modules/ags/widget/Bar.tsx +++ b/home-manager/modules/ags/widget/Bar.tsx @@ -18,7 +18,7 @@ export default function Bar(monitor: Gdk.Monitor) { gdkmonitor={monitor} exclusivity={Astal.Exclusivity.EXCLUSIVE} anchor={TOP | LEFT | RIGHT}> - + diff --git a/home-manager/modules/ags/widget/elements/Audio.tsx b/home-manager/modules/ags/widget/elements/Audio.tsx index 95462b3..fc7cfcd 100644 --- a/home-manager/modules/ags/widget/elements/Audio.tsx +++ b/home-manager/modules/ags/widget/elements/Audio.tsx @@ -4,12 +4,8 @@ import Wp from "gi://AstalWp" export default function Audio() { const speaker = Wp.get_default()?.audio.defaultSpeaker! - return + return - speaker.volume = value} - value={bind(speaker, "volume")} - /> + } diff --git a/home-manager/modules/ags/widget/elements/Media.tsx b/home-manager/modules/ags/widget/elements/Media.tsx index 6425b87..f4759b2 100644 --- a/home-manager/modules/ags/widget/elements/Media.tsx +++ b/home-manager/modules/ags/widget/elements/Media.tsx @@ -1,28 +1,29 @@ -import { bind } from "astal" +import { Variable, bind } from "astal" import { Gtk } from "astal/gtk3" import Mpris from "gi://AstalMpris" export default function Media() { const mpris = Mpris.get_default() + // console.log(bind(mpris, "players").as(ps => ps[0] ? `${ps[0].title} ${ps[0].artist} ${ps[0].get_playback_status()}` : "-")); - return + return {bind(mpris, "players").as(ps => ps[0] ? ( - - - `background-image: url('${cover}');` - )} - /> - - ) : ( - "Nothing Playing" - ))} + + ) : ("") )} } diff --git a/home-manager/modules/ags/widget/elements/SysTray.tsx b/home-manager/modules/ags/widget/elements/SysTray.tsx index d938ece..3bc9fea 100644 --- a/home-manager/modules/ags/widget/elements/SysTray.tsx +++ b/home-manager/modules/ags/widget/elements/SysTray.tsx @@ -4,15 +4,19 @@ import Tray from "gi://AstalTray" export default function SysTray() { const tray = Tray.get_default() - return - {bind(tray, "items").as(items => items.map(item => ( - ["dbusmenu", ag])} - menuModel={bind(item, "menu-model")}> - - - )))} + return + {bind(tray, "items").as(i => (i.length > 0) ? ( + + {bind(tray, "items").as(items => items.map(item => ( + ["dbusmenu", ag])} + menuModel={bind(item, "menu-model")}> + + + )))} + + ) : ("") )} } diff --git a/home-manager/modules/ags/widget/elements/Time.tsx b/home-manager/modules/ags/widget/elements/Time.tsx index a85c079..f4e0515 100644 --- a/home-manager/modules/ags/widget/elements/Time.tsx +++ b/home-manager/modules/ags/widget/elements/Time.tsx @@ -1,6 +1,6 @@ import { Variable, GLib } from "astal" -export default function Time({ format = "%H:%M - %A %e." }) { +export default function Time({ format = "%e %b - %H:%M %a" }) { const time = Variable("").poll(1000, () => GLib.DateTime.new_now_local().format(format)!)