From 6809acf2aee0c1eee808888f2b8e6533ae75bc2e Mon Sep 17 00:00:00 2001 From: Nikolaos Karaolidis Date: Tue, 2 Jul 2024 16:43:50 +0300 Subject: [PATCH] Add ags launcher Signed-off-by: Nikolaos Karaolidis --- .../configs/ags/config/src/widgets/bar/bar.ts | 6 +- .../ags/config/src/widgets/bar/date/date.ts | 7 +- .../ags/config/src/widgets/bar/gap/gap.ts | 3 + .../src/widgets/bar/launcher/launcher.ts | 10 +++ users/configs/ags/default.nix | 3 + users/configs/ags/theme.sass | 78 +++++++++++++------ users/configs/gtk/default.nix | 2 + 7 files changed, 84 insertions(+), 25 deletions(-) create mode 100644 users/configs/ags/config/src/widgets/bar/gap/gap.ts create mode 100644 users/configs/ags/config/src/widgets/bar/launcher/launcher.ts diff --git a/users/configs/ags/config/src/widgets/bar/bar.ts b/users/configs/ags/config/src/widgets/bar/bar.ts index b98c096..eddc721 100644 --- a/users/configs/ags/config/src/widgets/bar/bar.ts +++ b/users/configs/ags/config/src/widgets/bar/bar.ts @@ -1,4 +1,6 @@ +import gap from './gap/gap'; import date from './date/date'; +import launcher from './launcher/launcher'; import workspace from './workspace/workspace'; export default (monitor: number) => Widget.Window({ @@ -8,11 +10,13 @@ export default (monitor: number) => Widget.Window({ exclusivity: 'exclusive', anchor: ['top', 'right', 'left'], child: Widget.CenterBox({ - css: 'min-width: 2px; min-height: 2px; padding-top: 2px; padding-bottom: 2px;', + class_name: 'widgets', // eslint-disable-next-line @typescript-eslint/naming-convention startWidget: Widget.Box({ hexpand: true, children: [ + launcher(), + gap(), workspace(), ], }), diff --git a/users/configs/ags/config/src/widgets/bar/date/date.ts b/users/configs/ags/config/src/widgets/bar/date/date.ts index 7aadb0e..3e21496 100644 --- a/users/configs/ags/config/src/widgets/bar/date/date.ts +++ b/users/configs/ags/config/src/widgets/bar/date/date.ts @@ -6,8 +6,13 @@ const clock = Variable(glib.DateTime.new_now_local(), { const time = Utils.derive([clock], (c) => c.format('%H:%M - %A, %d %B %Y') || ''); -export default () => Widget.Label({ +const label = () => Widget.Label({ class_name: 'label', justification: 'center', label: time.bind(), }); + +export default () => Widget.EventBox({ + class_name: 'date', + child: label(), +}); diff --git a/users/configs/ags/config/src/widgets/bar/gap/gap.ts b/users/configs/ags/config/src/widgets/bar/gap/gap.ts new file mode 100644 index 0000000..d394f33 --- /dev/null +++ b/users/configs/ags/config/src/widgets/bar/gap/gap.ts @@ -0,0 +1,3 @@ +export default () => Widget.Box({ + class_name: 'gap', +}); diff --git a/users/configs/ags/config/src/widgets/bar/launcher/launcher.ts b/users/configs/ags/config/src/widgets/bar/launcher/launcher.ts new file mode 100644 index 0000000..59fc627 --- /dev/null +++ b/users/configs/ags/config/src/widgets/bar/launcher/launcher.ts @@ -0,0 +1,10 @@ +const icon = () => Widget.Icon({ + class_name: 'icon', + icon: "nix-snowflake-symbolic", +}); + +export default () => Widget.EventBox({ + class_name: 'launcher', + on_primary_click: () => Utils.execAsync('bash -c "rofi -cache-dir $XDG_CACHE_HOME/rofi -show drun"'), + child: icon(), +}); diff --git a/users/configs/ags/default.nix b/users/configs/ags/default.nix index 6c0f703..cb00a8f 100644 --- a/users/configs/ags/default.nix +++ b/users/configs/ags/default.nix @@ -23,6 +23,9 @@ in runtimeInputs = with pkgs; [ ags sassc + hyprland + nixos-icons + rofi-wayland ]; text = '' ags &> /tmp/ags.log diff --git a/users/configs/ags/theme.sass b/users/configs/ags/theme.sass index 42491d9..b9dc605 100644 --- a/users/configs/ags/theme.sass +++ b/users/configs/ags/theme.sass @@ -1,30 +1,62 @@ .bar background-color: {{colors.surface.default.hex}} -.label - color: {{colors.on_surface.default.hex}} - font-size: {{custom.font_size}}pt; + @mixin interactive + min-height: {{custom.font_size}}pt + border-radius: .5 * {{custom.font_size}}pt + transition: .25s -.workspace - min-height: {{custom.font_size}}pt; + &:hover + background-color: {{colors.surface_container_high.default.hex}} - .button - font-size: 0; - transition: .5s; - margin: 0 .3 * {{custom.padding}}pt; - background-color: {{colors.surface_variant.default.hex}}; - min-width: .4 * {{custom.font_size}}pt; - min-height: .4 * {{custom.font_size}}pt; - border-radius: .5 * {{custom.font_size}}pt; + &:active + background-color: {{colors.surface_container_highest.default.hex}} - &.occupied - background-color: {{colors.on_surface.default.hex}} - min-width: .6 * {{custom.font_size}}pt; - min-height: .6 * {{custom.font_size}}pt; - border-radius: .5 * {{custom.font_size}}pt; + .widgets + padding: .2 * {{custom.padding}}pt - &.active - background-color: {{colors.primary.default.hex}} - min-width: 1.67 * {{custom.font_size}}pt; - min-height: {{custom.font_size}}pt; - border-radius: .4 * {{custom.font_size}}pt; + .gap + min-height: {{custom.font_size}}pt + min-width: .5 * {{custom.padding}}pt + + .launcher + @include interactive + + min-width: {{custom.font_size}}pt + + .icon + font-size: {{custom.font_size}}pt + padding: 0 .3 * {{custom.padding}}pt + color: {{colors.primary.default.hex}} + + .workspace + @include interactive + + .button + font-size: 0 + transition: .5s + margin: 0 .3 * {{custom.padding}}pt + background-color: {{colors.outline_variant.default.hex}} + min-width: .4 * {{custom.font_size}}pt + min-height: .4 * {{custom.font_size}}pt + border-radius: .5 * {{custom.font_size}}pt + + &.occupied + background-color: {{colors.on_surface.default.hex}} + min-width: .6 * {{custom.font_size}}pt + min-height: .6 * {{custom.font_size}}pt + border-radius: .5 * {{custom.font_size}}pt + + &.active + background-color: {{colors.primary.default.hex}} + min-width: 1.67 * {{custom.font_size}}pt + min-height: {{custom.font_size}}pt + border-radius: .4 * {{custom.font_size}}pt + + .date + @include interactive + + .label + color: {{colors.on_surface.default.hex}} + font-size: {{custom.font_size}}pt + margin: 0 .5 * {{custom.padding}}pt diff --git a/users/configs/gtk/default.nix b/users/configs/gtk/default.nix index b6696ef..94346de 100644 --- a/users/configs/gtk/default.nix +++ b/users/configs/gtk/default.nix @@ -18,6 +18,8 @@ in gtk4.extraCss = "@import './theme.css';"; }; + home.packages = with pkgs; [ nixos-icons ]; + programs.matugen.settings.templates = { gtk3 = { input_path = ./theme.css;