some tweaks to making hyprland work betterer

This commit is contained in:
Chris Cochrun 2024-07-01 16:33:47 -05:00
parent 64a0004f5c
commit 01f5aeeab8
4 changed files with 14 additions and 9 deletions

View file

@ -6,6 +6,9 @@ const audio = await Service.import('audio')
import { NotificationPopups } from "./notifications.js" import { NotificationPopups } from "./notifications.js"
const laptop = Utils.exec(`hostname`) === "syl";
console.log(laptop ? "Running on syl" : "Running on kaladin");
function map_workspaces(id) { function map_workspaces(id) {
switch (id) { switch (id) {
case 1: case 1:
@ -138,10 +141,11 @@ function Bar(monitor = 0) {
return Widget.Window({ return Widget.Window({
monitor, monitor,
name: `bar${monitor}`, // this name has to be unique name: `bar${monitor}`, // this name has to be unique
anchor: ['bottom', 'left', 'right'], anchor: [laptop ? 'bottom' : 'top', 'left', 'right'],
exclusivity: "exclusive", exclusivity: "exclusive",
margins: [0, 20, 8, 20], margins: [0, 20, 0, 20],
child: Widget.CenterBox({ child: Widget.CenterBox({
css: laptop ? "margin-bottom: 1em; margin-top: 0.4em" : "margin-bottom: 1em; margin-top: 1em;",
class_name: "windowbox", class_name: "windowbox",
startWidget: Widget.Box({ startWidget: Widget.Box({
spacing: 0, spacing: 0,
@ -158,7 +162,7 @@ function Bar(monitor = 0) {
expander, expander,
volume_indicator, volume_indicator,
system_tray(), system_tray(),
battery_function(), laptop ? battery_function() : null
], ],
}), }),
}), }),
@ -168,7 +172,7 @@ function Bar(monitor = 0) {
App.config({ App.config({
style: css, style: css,
windows: [ windows: [
Bar(0), // can be instantiated for each monitor Bar(laptop ? 0 : 0), // can be instantiated for each monitor
NotificationPopups(), NotificationPopups(),
], ],
}) })

View file

@ -1,4 +1,5 @@
const notifications = await Service.import("notifications") const notifications = await Service.import("notifications")
const laptop = Utils.exec(`hostname`) === "syl";
/** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */ /** @param {import('resource:///com/github/Aylur/ags/service/notifications.js').Notification} n */
function NotificationIcon({ app_entry, app_icon, image }) { 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({ const list = Widget.Box({
vertical: true, vertical: true,
spacing: 4, spacing: 4,
@ -116,7 +117,7 @@ export function NotificationPopups(monitor = 0) {
monitor, monitor,
name: `notifications${monitor}`, name: `notifications${monitor}`,
class_name: "notification-popups", class_name: "notification-popups",
anchor: ["bottom", "right"], anchor: [laptop ? "bottom" : "top", "right"],
child: Widget.Box({ child: Widget.Box({
// css: "min-width: 2px; min-height: 2px;", // css: "min-width: 2px; min-height: 2px;",
class_name: "notifications", class_name: "notifications",

View file

@ -25,9 +25,9 @@ window {
background-color: @backtransparent; background-color: @backtransparent;
border-radius: 20px; border-radius: 20px;
box-shadow: 5px 5px 4px 4px #202020; box-shadow: 5px 5px 4px 4px #202020;
margin-bottom: 1em; /* margin-bottom: 1em; */
margin-right: 20px; margin-right: 20px;
margin-top: 0.4em; /* margin-top: 0.4em; */
margin-left: 20px; margin-left: 20px;
min-height: 30px; min-height: 30px;
border-color: @base08; border-color: @base08;

View file

@ -296,7 +296,7 @@ in
"SUPERALT,a,movetoworkspace,special:agenda" "SUPERALT,a,movetoworkspace,special:agenda"
"SUPER,g,togglespecialworkspace,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" "SUPERALT,n,exec,eww update rightside=true"
]; ];