diff --git a/ags/style/_bar.scss b/ags/style/_bar.scss index c315568..04fce02 100644 --- a/ags/style/_bar.scss +++ b/ags/style/_bar.scss @@ -17,40 +17,41 @@ // Style widget groups & > .bar-centerbox > * { + $radius: 18px; + $color-hover: colors.$bg-primary; + $padding: 4px; + background: rgba(colors.$bg-translucent, .6); - padding: 5px; - border-radius: 18px; + border-radius: $radius; + padding: 0 $padding; + + & > eventbox { + &:hover { + & > box:not(.workspaces) { + background: $color-hover; + } + } + & > box { + border-radius: calc($radius - $padding); + margin: $padding 0; + padding: 0 6px; + } + } - // Style widgets & > button, - & > eventbox, - & > box { - margin: 0 2px; + & > box > button { + border-radius: calc($radius - $padding); + margin: $padding 0; + padding: 0 9px; - &:first-child { - margin-left: 0; - } - - &:last-child { - margin-right: 0; - } - - & > button, - & > eventbox > box { - padding: 4px 8px; - border-radius: 12px; - } - - & > button:hover, - & > eventbox:hover > box { - background: colors.$bg-primary; + &:hover { + background: $color-hover; } } } .workspaces { @include mixins.reset-props; - padding: 1px 1px; & button { border-radius: 16px; @@ -58,7 +59,7 @@ min-width: 12px; padding: 0 6px; background: colors.$bg-tertiary; - margin: 1px 2px; + margin: 3px 0; &.focus { background: colors.$fg-primary; @@ -119,7 +120,6 @@ .media-eventbox { & > .media { - border-radius: 12px; background: colors.$bg-primary; padding: 0 8px; } @@ -196,7 +196,6 @@ & > box { padding: 0 8px; - border-radius: 12px; & > * > * { margin: 0 2px; @@ -238,22 +237,19 @@ .apps { & > box { - border-radius: 12px; - transition: 100ms linear; - min-width: 28px; - padding: 0 4px; + min-width: 24px; + padding: 0 6px; & > icon { transition: 120ms linear; font-size: 14px; } } - &:hover > box, &.open > box { - background: colors.$bg-primary; + background: colors.$bg-primary; } - &:hover > box > icon { + &:hover icon { -gtk-icon-transform: scale(1.14); } } diff --git a/ags/widget/bar/Workspaces.ts b/ags/widget/bar/Workspaces.ts index 7b71e97..a4932a9 100644 --- a/ags/widget/bar/Workspaces.ts +++ b/ags/widget/bar/Workspaces.ts @@ -8,6 +8,8 @@ export const showWorkspaceNumbers = new Variable(false); export function Workspaces(): Gtk.Widget { + const workspaceSpacing = 4; + return new Widget.EventBox({ onScroll: (_, event) => event.delta_y > 0 ? hyprland.dispatch("workspace", "e-1") : hyprland.dispatch("workspace", "e+1"), @@ -15,6 +17,7 @@ export function Workspaces(): Gtk.Widget { onHoverLost: () => showWorkspaceNumbers.set(false), child: new Widget.Box({ className: "workspaces", + spacing: workspaceSpacing, children: bind(hyprland, "workspaces").as((workspaces) => { const sortedWorkspaces = workspaces.filter(ws => ws.id > 0).sort( (a: AstalHyprland.Workspace, b: AstalHyprland.Workspace) => a.get_id() - b.get_id()); diff --git a/ags/window/Bar.ts b/ags/window/Bar.ts index dd3a2f1..d10d5b9 100644 --- a/ags/window/Bar.ts +++ b/ags/window/Bar.ts @@ -8,49 +8,55 @@ import { Apps } from "../widget/bar/Apps"; import { Clock } from "../widget/bar/Clock"; import { Status } from "../widget/bar/Status"; -export const Bar = (mon: number) => new Widget.Window({ - namespace: "top-bar", - anchor: Astal.WindowAnchor.TOP | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.RIGHT, - layer: Astal.Layer.TOP, - exclusivity: Astal.Exclusivity.EXCLUSIVE, - heightRequest: 46, - monitor: mon, - visible: true, - canFocus: false, - child: new Widget.Box({ - className: "bar-container", - child: new Widget.CenterBox({ - className: "bar-centerbox", - expand: true, - homogeneous: false, - startWidget: new Widget.Box({ - className: "widgets-left", +export const Bar = (mon: number) => { + const widgetSpacing = 4; + return new Widget.Window({ + namespace: "top-bar", + anchor: Astal.WindowAnchor.TOP | Astal.WindowAnchor.LEFT | Astal.WindowAnchor.RIGHT, + layer: Astal.Layer.TOP, + exclusivity: Astal.Exclusivity.EXCLUSIVE, + heightRequest: 46, + monitor: mon, + visible: true, + canFocus: false, + child: new Widget.Box({ + className: "bar-container", + child: new Widget.CenterBox({ + className: "bar-centerbox", + expand: true, homogeneous: false, - halign: Gtk.Align.START, - children: [ - Apps(), - Workspaces(), - FocusedClient() - ] - } as Widget.BoxProps), - centerWidget: new Widget.Box({ - className: "widgets-center", - homogeneous: false, - halign: Gtk.Align.CENTER, - children: [ - Clock(), - Media() - ] - } as Widget.BoxProps), - endWidget: new Widget.Box({ - className: "widgets-right", - homogeneous: false, - halign: Gtk.Align.END, - children: [ - Tray(), - Status() - ] - } as Widget.BoxProps) - } as Widget.CenterBoxProps) - } as Widget.BoxProps) -} as Widget.WindowProps); + startWidget: new Widget.Box({ + className: "widgets-left", + homogeneous: false, + halign: Gtk.Align.START, + spacing: widgetSpacing, + children: [ + Apps(), + Workspaces(), + FocusedClient() + ] + } as Widget.BoxProps), + centerWidget: new Widget.Box({ + className: "widgets-center", + homogeneous: false, + spacing: widgetSpacing, + halign: Gtk.Align.CENTER, + children: [ + Clock(), + Media() + ] + } as Widget.BoxProps), + endWidget: new Widget.Box({ + className: "widgets-right", + homogeneous: false, + spacing: widgetSpacing, + halign: Gtk.Align.END, + children: [ + Tray(), + Status() + ] + } as Widget.BoxProps) + } as Widget.CenterBoxProps) + } as Widget.BoxProps) + } as Widget.WindowProps); +}