Bluetooth works now and some style adjustments

This commit is contained in:
2025-02-02 13:58:45 -08:00
parent 06c01af45f
commit d3977958ed
5 changed files with 47 additions and 15 deletions

2
app.ts
View File

@@ -7,7 +7,7 @@ const hyprland = Hyprland.get_default()
App.start({ App.start({
css: style, css: style,
icons: "/home/protoshark/.config/astal/assets/", icons: "/home/protoshark/.config/ags/assets/",
main() { main() {
hyprland.monitors.map((monitor) => Bar(monitor)) hyprland.monitors.map((monitor) => Bar(monitor))
}, },

View File

@@ -4,7 +4,7 @@ window {
background: $background-1; background: $background-1;
color: $text-2; color: $text-2;
font-family: comfortaa; font-family: comfortaa;
font-weight: bolder; font-weight: 900;
font-size: 14px; font-size: 14px;
> centerbox { > centerbox {
@@ -154,6 +154,18 @@ button {
} }
.toggleButton { .toggleButton {
&.bt {
icon {
margin-right: 8px;
}
box {
background: none;
}
label {
margin-top: 2px;
margin-right: 60px;
}
}
&:hover .toggleIndicator { &:hover .toggleIndicator {
box-shadow: 0 0 6px 0px $highlight-3; box-shadow: 0 0 6px 0px $highlight-3;
} }
@@ -229,6 +241,7 @@ button {
@keyframes upIn { @keyframes upIn {
from {margin-top: -50px; opacity: 0;} from {margin-top: -50px; opacity: 0;}
to {opacity: 100;} to {opacity: 100;}
} }
.clientLabel { .clientLabel {

View File

@@ -44,7 +44,7 @@ function BattWindow() {
<box <box
className="popupBattery" className="popupBattery"
vertical={true} vertical={true}
spacing={8}> spacing={12}>
<box spacing={10}> <box spacing={10}>
<overlay overlay={new Widget.Label({ <overlay overlay={new Widget.Label({
halign: Gtk.Align.CENTER, halign: Gtk.Align.CENTER,
@@ -107,7 +107,8 @@ function BattWindow() {
</box> </box>
</box> </box>
<box <box
vertical={true}> vertical={true}
spacing={4}>
{profileButton("Power Saver", "power-saver")} {profileButton("Power Saver", "power-saver")}
{profileButton("Balanced", "balanced")} {profileButton("Balanced", "balanced")}
{profileButton("Performance", "performance")} {profileButton("Performance", "performance")}

View File

@@ -1,4 +1,4 @@
import { bind } from "astal" import { bind, execAsync } from "astal"
import Bluetooth from "gi://AstalBluetooth" import Bluetooth from "gi://AstalBluetooth"
import { popup } from "./popup" import { popup } from "./popup"
import { Astal, Gtk, Widget } from "astal/gtk3" import { Astal, Gtk, Widget } from "astal/gtk3"
@@ -8,15 +8,21 @@ const { TOP, LEFT } = Astal.WindowAnchor
const bluetooth = Bluetooth.get_default() const bluetooth = Bluetooth.get_default()
function bluetoothItem(device: Bluetooth.Device) { function bluetoothItem(device: Bluetooth.Device) {
return <button className="toggleButton"> return <button
className="bt toggleButton"
onClicked={() => {
execAsync(["bluetoothctl", device.connected ? "disconnect" : "connect", device.address]).then(out => console.log(out)).catch(out => console.log(out))
}}>
<overlay overlay={new Widget.Box({ <overlay overlay={new Widget.Box({
className: "toggleIndicator", className: bind(device, "connected").as(c =>
"toggleIndicator ".concat(c ? "active" : "inactive")
),
halign: Gtk.Align.END, halign: Gtk.Align.END,
valign: Gtk.Align.CENTER, valign: Gtk.Align.CENTER,
})}> })}>
<box> <box>
<icon icon={device.icon} css="font-size: 32px;" /> <icon icon={device.icon} css="font-size: 32px;" />
<label>{device.alias ?? device.name}</label> <label valign={Gtk.Align.CENTER}>{device.alias ?? device.name}</label>
</box> </box>
</overlay> </overlay>
</button> </button>
@@ -25,10 +31,10 @@ function bluetoothItem(device: Bluetooth.Device) {
function bluetoothWindow() { function bluetoothWindow() {
return <window return <window
anchor={ TOP | LEFT } anchor={ TOP | LEFT }
marginLeft={170} marginLeft={140}
namespace="lazerpopup" namespace="lazerpopup"
className="popupWindow"> className="popupWindow">
<box vertical={true}> <box vertical={true} css="margin-left: 40px">
{bluetooth.devices.map(dev => bluetoothItem(dev))} {bluetooth.devices.map(dev => bluetoothItem(dev))}
</box> </box>
</window> </window>

View File

@@ -4,18 +4,30 @@ import Apps from "gi://AstalApps"
import { Gtk, Widget } from "astal/gtk3" import { Gtk, Widget } from "astal/gtk3"
import { Overlay } from "astal/gtk3/widget" import { Overlay } from "astal/gtk3/widget"
const hyprland = Hyprland.get_default() const hyprland = Hyprland.get_default()
const apps = new Apps.Apps() const apps = new Apps.Apps({
entryMultiplier: 2,
categories_multiplier: 0,
description_multiplier: 0,
executable_multiplier: 0,
name_multiplier: 0,
keywordsMultiplier: 0,
})
function NewClient(client: Hyprland.Client) { function NewClient(client: Hyprland.Client) {
apps.entryMultiplier = 10 let appsClass = null
let hyprClass = (client) ? apps.exact_query(client.class)[0] : null if (client) {
if (client.class == "soffice") {
client.class = ""
}
appsClass = apps.exact_query(client.class)[0]
}
let b = <box halign={Gtk.Align.END} className="clientLabel" visible={true}> let b = <box halign={Gtk.Align.END} className="clientLabel" visible={true}>
<icon <icon
icon={(client) ? hyprClass?.iconName : "archlinux"} icon={(appsClass) ? appsClass.iconName : "archlinux"}
css="font-size: 24px; margin-right: 4px;" css="font-size: 24px; margin-right: 4px;"
/> />
<label css="font-family: comfortaa; font-size: 14px;">{ <label css="font-family: comfortaa; font-size: 14px;">{
(client) ? hyprClass?.name : "Hummingbird" (appsClass) ? appsClass.name : "Hummingbird"
}</label> }</label>
</box> </box>
return b return b