diff --git a/home/Aloria.nix b/home/Aloria.nix index e42dde2..f7dbcd2 100644 --- a/home/Aloria.nix +++ b/home/Aloria.nix @@ -37,12 +37,6 @@ ]; general.gaps_out = 1; }; - programs.waybar.settings.mainBar = { - output = "eDP-1"; - height = 28; - margin = "0 0 5 0"; - "custom/temperature".exec = "${pkgs.lm_sensors}/bin/sensors | ${pkgs.gnugrep}/bin/grep Package | cut -c17-23"; - }; programs.alacritty.settings.font.size = 13; } diff --git a/home/Kell.nix b/home/Kell.nix index 244c720..a5260ed 100644 --- a/home/Kell.nix +++ b/home/Kell.nix @@ -15,10 +15,6 @@ ]; }; }; - programs.waybar.settings.mainBar = { - output = "DP-2"; - "custom/temperature".exec = "sensors | grep Tctl | cut -c16-22"; - }; wayland.windowManager.hyprland.settings = { monitor = [ "DP-3,preferred,0x550,1" @@ -27,26 +23,130 @@ ]; input.kb_options = "compose:rctrl, caps:super, altwin:swap_alt_win"; }; - programs.waybar.style = '' - * { - font-size: 18px; - font-weight:400; + home.file."${config.xdg.configHome}/ags/settings.json".text = builtins.toJSON { + temperature-cmd = "bash -c 'sensors | grep Tctl | cut -c16-22'"; + }; + home.file."${config.xdg.configHome}/ags/style.css".text = '' + window.bar { + background-color: rgba(0, 0, 0, 0.2); + font-size: 1.3em; } - #tray { - padding: 0 14px; - margin-left:4px; - margin-right:4px; - margin-top:2px; - margin-bottom:2px; + + .systray-item { + margin-left: 0.3em; + margin-right: 0.3em; } - #workspaces { - margin: 4px 9px; + + .systray { + margin-left: 0.4em; } - #wireplumber { - background-color: #023269; + + .window-box { + margin-bottom: 0.3em; + margin-top: 0.2em; } - #tray { + + .clients box { + margin-right: 0.3em; + } + + .item, .clients box { + background: #1f2430; + padding-left: 0.7em; + padding-right: 0.7em; + border-radius: 0.3em; + } + + .app-icon { + margin-right: 0.6em; + } + + button { + background: #1f2430; + border:none; + padding: 0.2em; + border-radius: 0.3em; + } + + .focused, .clients box.focused { + background: #023269; + } + + button:hover { + background: #023269; + } + + .workspaces button { + padding-left: 0.4em; + padding-right: 0.4em; + margin-left: 0.2em; + margin-right: 0.2em; + } + + .notification { + color: yellow; + } + + .blue { + background: #023269; + } + + /* Notifications */ + window.notification-popups box.notifications { + padding: .5em; + } + + .icon { + min-width: 68px; + min-height: 68px; + margin-right: 1em; + } + + .icon image { + font-size: 58px; + /* to center the icon */ + margin: 5px; + color: @theme_fg_color; + } + + .icon box { + min-width: 68px; + min-height: 68px; + border-radius: 7px; + } + + .notification { + min-width: 350px; + border-radius: 11px; + padding: 1em; + margin: .5em; background-color: #1f2430; } + + .notification.critical { + border: 1px solid lightcoral; + } + + .title { + color: @theme_fg_color; + font-size: 1.4em; + } + + .body { + color: @theme_unfocused_fg_color; + } + + .actions .action-button { + margin: 0 .4em; + margin-top: .8em; + } + + .actions .action-button:first-child { + margin-left: 0; + } + + .actions .action-button:last-child { + margin-right: 0; + } ''; } diff --git a/home/ags/default.nix b/home/ags/default.nix index e4724be..2901aaa 100644 --- a/home/ags/default.nix +++ b/home/ags/default.nix @@ -1,4 +1,4 @@ -{ inputs, pkgs, ... }: +{ inputs, pkgs, config, ... }: { imports = [ inputs.ags.homeManagerModules.default ]; home.packages = [ @@ -7,11 +7,17 @@ ]; programs.ags = { enable = true; - configDir = ./files; extraPackages = with pkgs; [ gtksourceview webkitgtk accountsservice ]; }; + home.file."${config.xdg.configHome}/ags" = { + source = ./files; + recursive = true; + }; + home.file."${config.xdg.configHome}/ags/settings.json".text = pkgs.lib.mkDefault (builtins.toJSON { + temperature-cmd = "bash -c 'sensors | grep Tctl | cut -c16-22'"; + }); } diff --git a/home/ags/files/config.js b/home/ags/files/config.js index e93f4b5..e2de583 100644 --- a/home/ags/files/config.js +++ b/home/ags/files/config.js @@ -1,10 +1,11 @@ const hyprland = await Service.import("hyprland") const audio = await Service.import("audio") -const battery = await Service.import("battery") const systemtray = await Service.import("systemtray") import { getIconName } from "./utils.js" import { NotificationPopups } from "./notificationPopups.js" +const settings = JSON.parse(Utils.readFile(App.configDir + '/settings.json')) + const volumeIndicator = Widget.Button({ on_clicked: () => audio.speaker.is_muted = !audio.speaker.is_muted, class_name: "item blue", @@ -90,12 +91,12 @@ function SysTray() { .as(items => items.map(item => Widget.Button({ child: Widget.Icon({ icon: item.bind("icon"), - css: "margin-left: 0.3em;margin-right: 0.3em;" + class_name: "systray-item", }), on_primary_click: (_, event) => item.activate(event), on_secondary_click: (_, event) => item.openMenu(event), tooltip_markup: item.bind("tooltip_markup"), - css: "margin-left: 0.4em;", + class_name: "systray", }))) return Widget.Box({ @@ -121,6 +122,8 @@ function Center() { }) } +const divide = ([total, free]) => free / total + function Right() { return Widget.Box({ hpack: "end", @@ -131,7 +134,12 @@ function Right() { volumeIndicator, Widget.Label({ class_name: "item", - label: Variable("", { poll: [5000, 'bash -c "top -bn1 | grep \\"Cpu(s)\\" | sed \\"s/.*, *\\([0-9.]*\\)%* id.*/\\\\1/\\" | awk \'{print \\"CPU \\" 100 - \\$1 \\"%\\"}\'"'] }).bind(), + label: Variable("", { + poll: [2000, 'top -b -n 1', out => "CPU " + out.split('\n') + .find(line => line.includes('Cpu(s)')) + .split(/\s+/)[1] + .replace(',', '.').toString() + "%"], + }).bind() }), Widget.Label({ class_name: "item blue", @@ -139,11 +147,16 @@ function Right() { }), Widget.Label({ class_name: "item", - label: Variable("", { poll: [5000, 'bash -c \'free -m | awk \'\\\'\'/^Mem/ {printf "%.2f GB\\n", $3/1024}\'\\\''] }).bind(), + label: Variable("", { + poll: [2000, 'free', out => (divide(out.split('\n') + .find(line => line.includes('Mem:')) + .split(/\s+/) + .splice(1, 2)) * 100).toFixed(2) + "GB"], + }).bind(), }), Widget.Label({ class_name: "item blue", - label: Variable("", { poll: [5000, 'bash -c "sensors | grep Tctl | cut -c16-22"'] }).bind(), + label: Variable("", { poll: [5000, settings["temperature-cmd"] ] }).bind(), }), Widget.Label({ class_name: "item", diff --git a/home/ags/files/style.css b/home/ags/files/style.css deleted file mode 100644 index 16872b6..0000000 --- a/home/ags/files/style.css +++ /dev/null @@ -1,112 +0,0 @@ -window.bar { - background-color: rgba(0, 0, 0, 0.2); - font-size: 1.3em; -} - -.window-box { - margin-bottom: 0.3em; - margin-top: 0.2em; -} - -.clients box { - margin-right: 0.3em; -} - -.item, .clients box { - background: #1f2430; - padding-left: 0.7em; - padding-right: 0.7em; - border-radius: 0.3em; -} - -.app-icon { - margin-right: 0.6em; -} - -button { - background: #1f2430; - border:none; - padding: 0.2em; - border-radius: 0.3em; -} - -.focused, .clients box.focused { - background: #023269; -} - -button:hover { - background: #023269; -} - -.workspaces button { - padding-left: 0.4em; - padding-right: 0.4em; - margin-left: 0.2em; - margin-right: 0.2em; -} - -.notification { - color: yellow; -} - -.blue { - background: #023269; -} - -/* Notifications */ -window.notification-popups box.notifications { - padding: .5em; -} - -.icon { - min-width: 68px; - min-height: 68px; - margin-right: 1em; -} - -.icon image { - font-size: 58px; - /* to center the icon */ - margin: 5px; - color: @theme_fg_color; -} - -.icon box { - min-width: 68px; - min-height: 68px; - border-radius: 7px; -} - -.notification { - min-width: 350px; - border-radius: 11px; - padding: 1em; - margin: .5em; - background-color: #1f2430; -} - -.notification.critical { - border: 1px solid lightcoral; -} - -.title { - color: @theme_fg_color; - font-size: 1.4em; -} - -.body { - color: @theme_unfocused_fg_color; -} - -.actions .action-button { - margin: 0 .4em; - margin-top: .8em; -} - -.actions .action-button:first-child { - margin-left: 0; -} - -.actions .action-button:last-child { - margin-right: 0; -} diff --git a/home/utils/desktop.nix b/home/utils/desktop.nix index cc61655..3f13ed2 100644 --- a/home/utils/desktop.nix +++ b/home/utils/desktop.nix @@ -3,7 +3,7 @@ imports = [ (import ./common.nix { inherit inputs config pkgs; }) (import ../hyprland { inherit inputs pkgs; }) - (import ../ags { inherit inputs pkgs; }) + (import ../ags { inherit inputs config pkgs; }) ../rofi ../alacritty ../kitty