✨ ags(control-center/bluetooth): add more device management options
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
@use "./mixins";
|
@use "./mixins";
|
||||||
@use "./colors";
|
@use "./colors";
|
||||||
@use "./wal";
|
@use "./wal";
|
||||||
|
@use "./functions";
|
||||||
|
|
||||||
.bar-container {
|
.bar-container {
|
||||||
@include mixins.reset-props;
|
@include mixins.reset-props;
|
||||||
@@ -62,6 +63,10 @@
|
|||||||
background: colors.$bg-tertiary;
|
background: colors.$bg-tertiary;
|
||||||
margin: 3px 0;
|
margin: 3px 0;
|
||||||
|
|
||||||
|
&:not(.focus) {
|
||||||
|
@include mixins.hover-shadow2;
|
||||||
|
}
|
||||||
|
|
||||||
&.focus {
|
&.focus {
|
||||||
background: colors.$fg-primary;
|
background: colors.$fg-primary;
|
||||||
min-width: 31px;
|
min-width: 31px;
|
||||||
@@ -93,6 +98,10 @@
|
|||||||
&.special-workspaces {
|
&.special-workspaces {
|
||||||
& button {
|
& button {
|
||||||
background: wal.$color4;
|
background: wal.$color4;
|
||||||
|
|
||||||
|
&:hover {
|
||||||
|
background: functions.toRGB(color.adjust(wal.$color4, $lightness: -6%));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,3 +19,15 @@
|
|||||||
box-shadow: inset 0 0 0 500px rgba(colors.$fg-primary, .1);
|
box-shadow: inset 0 0 0 500px rgba(colors.$fg-primary, .1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@mixin hover-shadow2 {
|
||||||
|
&:hover {
|
||||||
|
box-shadow: inset 0 0 0 500px rgba(colors.$fg-primary, .2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@mixin hover-shadow3 {
|
||||||
|
&:hover {
|
||||||
|
box-shadow: inset 0 0 0 500px rgba(colors.$fg-primary, .3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+20
-20
@@ -1,26 +1,26 @@
|
|||||||
// SCSS Variables
|
// SCSS Variables
|
||||||
// Generated by 'wal'
|
// Generated by 'wal'
|
||||||
$wallpaper: "/home/joaov/wallpapers/Gumi Street Bike.jpg";
|
$wallpaper: "/home/joaov/wallpapers/Frieren At The Funeral.jpg";
|
||||||
|
|
||||||
// Special
|
// Special
|
||||||
$background: #0d101f;
|
$background: #181515;
|
||||||
$foreground: #c2c3c7;
|
$foreground: #c5c4c4;
|
||||||
$cursor: #c2c3c7;
|
$cursor: #c5c4c4;
|
||||||
|
|
||||||
// Colors
|
// Colors
|
||||||
$color0: #0d101f;
|
$color0: #181515;
|
||||||
$color1: #586C8C;
|
$color1: #CA778C;
|
||||||
$color2: #649D93;
|
$color2: #AA8C81;
|
||||||
$color3: #60AFB7;
|
$color3: #AA8CAA;
|
||||||
$color4: #96ABA0;
|
$color4: #DCA8AF;
|
||||||
$color5: #A3CCA4;
|
$color5: #B4ADC5;
|
||||||
$color6: #CFD8B4;
|
$color6: #D2B5C5;
|
||||||
$color7: #90929b;
|
$color7: #9b9090;
|
||||||
$color8: #5c6071;
|
$color8: #715c5c;
|
||||||
$color9: #698abf;
|
$color9: #d49ba9;
|
||||||
$color10: #79c5b9;
|
$color10: #cfa08f;
|
||||||
$color11: #85c4ca;
|
$color11: #d195d1;
|
||||||
$color12: #9bd4b4;
|
$color12: #e3bdc3;
|
||||||
$color13: #b3deb3;
|
$color13: #c0b4df;
|
||||||
$color14: #dde4c2;
|
$color14: #e4bfd3;
|
||||||
$color15: #c2c3c7;
|
$color15: #c5c4c4;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { bind } from "astal";
|
import { bind, Variable } from "astal";
|
||||||
import { Gtk, Widget } from "astal/gtk3";
|
import { Gtk, Widget } from "astal/gtk3";
|
||||||
import AstalBluetooth from "gi://AstalBluetooth";
|
import AstalBluetooth from "gi://AstalBluetooth";
|
||||||
import { Page, PageButton } from "./Page";
|
import { Page, PageButton } from "./Page";
|
||||||
@@ -97,6 +97,7 @@ export const BluetoothPage: (() => Page) = () => new Page({
|
|||||||
Separator({
|
Separator({
|
||||||
size: .2,
|
size: .2,
|
||||||
orientation: Gtk.Orientation.VERTICAL,
|
orientation: Gtk.Orientation.VERTICAL,
|
||||||
|
cssColor: "gray",
|
||||||
alpha: .2
|
alpha: .2
|
||||||
} as SeparatorProps),
|
} as SeparatorProps),
|
||||||
new Widget.Button({
|
new Widget.Button({
|
||||||
@@ -135,7 +136,11 @@ function DeviceWidget(dev: AstalBluetooth.Device): Gtk.Widget {
|
|||||||
endWidget: new Widget.Box({
|
endWidget: new Widget.Box({
|
||||||
visible: bind(dev, "batteryPercentage").as((bat: number) =>
|
visible: bind(dev, "batteryPercentage").as((bat: number) =>
|
||||||
bat <= -1 ? false : true),
|
bat <= -1 ? false : true),
|
||||||
children: [
|
children: Variable.derive([
|
||||||
|
bind(dev, "connecting"),
|
||||||
|
bind(dev, "connected")
|
||||||
|
], (connecting, connected) => {
|
||||||
|
if(connected) return [
|
||||||
new Widget.Label({
|
new Widget.Label({
|
||||||
halign: Gtk.Align.END,
|
halign: Gtk.Align.END,
|
||||||
label: bind(dev, "batteryPercentage").as((bat: number) =>
|
label: bind(dev, "batteryPercentage").as((bat: number) =>
|
||||||
@@ -145,8 +150,49 @@ function DeviceWidget(dev: AstalBluetooth.Device): Gtk.Widget {
|
|||||||
icon: "battery-symbolic",
|
icon: "battery-symbolic",
|
||||||
css: "font-size: 18px; margin-left: 6px;"
|
css: "font-size: 18px; margin-left: 6px;"
|
||||||
} as Widget.IconProps)
|
} as Widget.IconProps)
|
||||||
]
|
];
|
||||||
} as Widget.BoxProps)
|
|
||||||
|
if(connecting) {
|
||||||
|
const spinner = new Gtk.Spinner({
|
||||||
|
visible: true
|
||||||
|
} as Gtk.Spinner.ConstructorProps);
|
||||||
|
spinner.start();
|
||||||
|
|
||||||
|
return spinner;
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
})()
|
||||||
|
} as Widget.BoxProps),
|
||||||
|
extraButtons: Variable.derive([
|
||||||
|
bind(dev, "connected"),
|
||||||
|
bind(dev, "paired"),
|
||||||
|
bind(dev, "trusted")
|
||||||
|
], (connected, paired, trusted) => [
|
||||||
|
new Widget.Button({
|
||||||
|
className: "nf",
|
||||||
|
visible: paired && connected,
|
||||||
|
label: connected ? "" : "",
|
||||||
|
tooltipText: tr("disconnect"),
|
||||||
|
onClick: () => dev.disconnect_device()
|
||||||
|
} as Widget.ButtonProps),
|
||||||
|
new Widget.Button({
|
||||||
|
visible: !connected && paired,
|
||||||
|
className: "nf",
|
||||||
|
label: "",
|
||||||
|
tooltipText: tr("control_center.pages.bluetooth.unpair_device"),
|
||||||
|
onClick: () => AstalBluetooth.get_default().adapter?.remove_device(dev)
|
||||||
|
} as Widget.ButtonProps),
|
||||||
|
new Widget.Button({
|
||||||
|
className: "nf",
|
||||||
|
visible: paired,
|
||||||
|
label: trusted ? "" : "",
|
||||||
|
tooltipText: trusted ?
|
||||||
|
tr("control_center.pages.bluetooth.untrust_device")
|
||||||
|
: tr("control_center.pages.bluetooth.trust_device"),
|
||||||
|
onClick: () => trusted ? dev.set_trusted(false) : dev.set_trusted(true)
|
||||||
|
} as Widget.ButtonProps)
|
||||||
|
])()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,13 +95,13 @@ export function PageButton(props: {
|
|||||||
className?: string | Binding<string>;
|
className?: string | Binding<string>;
|
||||||
icon?: string | Binding<string>;
|
icon?: string | Binding<string>;
|
||||||
title: string | Binding<string>;
|
title: string | Binding<string>;
|
||||||
endWidget?: Gtk.Widget;
|
endWidget?: Gtk.Widget | Binding<Gtk.Widget>;
|
||||||
extraButtons?: Array<Widget.Button>;
|
extraButtons?: Array<Widget.Button> | Binding<Array<Gtk.Widget>>;
|
||||||
onClick?: (self: Widget.Button) => void;
|
onClick?: (self: Widget.Button) => void;
|
||||||
}): Gtk.Widget {
|
}): Gtk.Widget {
|
||||||
return new Widget.Box({
|
return new Widget.Box({
|
||||||
setup: (self) => {
|
children: [
|
||||||
self.add(new Widget.Button({
|
new Widget.Button({
|
||||||
onClick: props.onClick,
|
onClick: props.onClick,
|
||||||
className: props.className,
|
className: props.className,
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
@@ -109,8 +109,7 @@ export function PageButton(props: {
|
|||||||
className: "page-button",
|
className: "page-button",
|
||||||
orientation: Gtk.Orientation.HORIZONTAL,
|
orientation: Gtk.Orientation.HORIZONTAL,
|
||||||
expand: true,
|
expand: true,
|
||||||
setup: (box) => {
|
children: [
|
||||||
box.set_children([
|
|
||||||
new Widget.Icon({
|
new Widget.Icon({
|
||||||
className: "icon",
|
className: "icon",
|
||||||
icon: props.icon,
|
icon: props.icon,
|
||||||
@@ -123,18 +122,23 @@ export function PageButton(props: {
|
|||||||
hexpand: true,
|
hexpand: true,
|
||||||
truncate: true,
|
truncate: true,
|
||||||
label: props.title
|
label: props.title
|
||||||
} as Widget.LabelProps)
|
} as Widget.LabelProps),
|
||||||
]);
|
new Widget.Box({
|
||||||
|
visible: (props.endWidget instanceof Binding) ?
|
||||||
props.endWidget && box.add(props.endWidget);
|
props.endWidget.as(Boolean)
|
||||||
}
|
: props.endWidget,
|
||||||
|
child: props.endWidget
|
||||||
} as Widget.BoxProps)
|
} as Widget.BoxProps)
|
||||||
} as Widget.ButtonProps));
|
]
|
||||||
|
} as Widget.BoxProps)
|
||||||
props.extraButtons && self.add(new Widget.Box({
|
} as Widget.ButtonProps),
|
||||||
|
new Widget.Box({
|
||||||
className: "button-row extra-buttons",
|
className: "button-row extra-buttons",
|
||||||
|
visible: (props.extraButtons instanceof Binding) ?
|
||||||
|
props.extraButtons.as(extra => extra.length > 0)
|
||||||
|
: (props.extraButtons ? props.extraButtons.length > 0 : false),
|
||||||
children: props.extraButtons
|
children: props.extraButtons
|
||||||
} as Widget.BoxProps));
|
} as Widget.BoxProps)
|
||||||
}
|
]
|
||||||
} as Widget.BoxProps);
|
} as Widget.BoxProps);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user