From 01f5aeeab8c305528248bb09d860e2c11d3cbe47 Mon Sep 17 00:00:00 2001 From: Chris Cochrun Date: Mon, 1 Jul 2024 16:33:47 -0500 Subject: [PATCH] some tweaks to making hyprland work betterer --- .config/ags/config.js | 12 ++++++++---- .config/ags/notifications.js | 5 +++-- .config/ags/style.css | 4 ++-- home/modules/hyprland.nix | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/.config/ags/config.js b/.config/ags/config.js index f53d21b..72ed3d8 100644 --- a/.config/ags/config.js +++ b/.config/ags/config.js @@ -6,6 +6,9 @@ const audio = await Service.import('audio') import { NotificationPopups } from "./notifications.js" +const laptop = Utils.exec(`hostname`) === "syl"; +console.log(laptop ? "Running on syl" : "Running on kaladin"); + function map_workspaces(id) { switch (id) { case 1: @@ -138,10 +141,11 @@ function Bar(monitor = 0) { return Widget.Window({ monitor, name: `bar${monitor}`, // this name has to be unique - anchor: ['bottom', 'left', 'right'], + anchor: [laptop ? 'bottom' : 'top', 'left', 'right'], exclusivity: "exclusive", - margins: [0, 20, 8, 20], + margins: [0, 20, 0, 20], child: Widget.CenterBox({ + css: laptop ? "margin-bottom: 1em; margin-top: 0.4em" : "margin-bottom: 1em; margin-top: 1em;", class_name: "windowbox", startWidget: Widget.Box({ spacing: 0, @@ -158,7 +162,7 @@ function Bar(monitor = 0) { expander, volume_indicator, system_tray(), - battery_function(), + laptop ? battery_function() : null ], }), }), @@ -168,7 +172,7 @@ function Bar(monitor = 0) { App.config({ style: css, windows: [ - Bar(0), // can be instantiated for each monitor + Bar(laptop ? 0 : 0), // can be instantiated for each monitor NotificationPopups(), ], }) diff --git a/.config/ags/notifications.js b/.config/ags/notifications.js index e3a517c..75cd3ca 100644 --- a/.config/ags/notifications.js +++ b/.config/ags/notifications.js @@ -1,4 +1,5 @@ const notifications = await Service.import("notifications") +const laptop = Utils.exec(`hostname`) === "syl"; /** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */ function NotificationIcon({ app_entry, app_icon, image }) { @@ -92,7 +93,7 @@ function Notification(n) { ) } -export function NotificationPopups(monitor = 0) { +export function NotificationPopups(monitor = laptop ? 0 : 2) { const list = Widget.Box({ vertical: true, spacing: 4, @@ -116,7 +117,7 @@ export function NotificationPopups(monitor = 0) { monitor, name: `notifications${monitor}`, class_name: "notification-popups", - anchor: ["bottom", "right"], + anchor: [laptop ? "bottom" : "top", "right"], child: Widget.Box({ // css: "min-width: 2px; min-height: 2px;", class_name: "notifications", diff --git a/.config/ags/style.css b/.config/ags/style.css index bf807db..d19134c 100644 --- a/.config/ags/style.css +++ b/.config/ags/style.css @@ -25,9 +25,9 @@ window { background-color: @backtransparent; border-radius: 20px; box-shadow: 5px 5px 4px 4px #202020; - margin-bottom: 1em; + /* margin-bottom: 1em; */ margin-right: 20px; - margin-top: 0.4em; + /* margin-top: 0.4em; */ margin-left: 20px; min-height: 30px; border-color: @base08; diff --git a/home/modules/hyprland.nix b/home/modules/hyprland.nix index 9ad0f59..6b54710 100644 --- a/home/modules/hyprland.nix +++ b/home/modules/hyprland.nix @@ -296,7 +296,7 @@ in "SUPERALT,a,movetoworkspace,special:agenda" "SUPER,g,togglespecialworkspace,agenda" - "SUPERSHIFT,g,exec,ags --toggle-window 'bar0'" + "SUPERSHIFT,g,exec,ags --toggle-window ${if laptop then "bar0" else "bar2"}" "SUPERALT,n,exec,eww update rightside=true" ];