refactor
This commit is contained in:
1 parent
094e1351e3
commit
dddb4bce11
5 files changed
+70
-38
No files matched your search
+7
-38
@@ -1,6 +1,4 @@
|
|||||||
import { App, Astal, Gtk, Gdk } from "astal/gtk3";
|
import { App, Astal, Gtk, Gdk } from "astal/gtk3";
|
||||||
import Mpris from "gi://AstalMpris";
|
|
||||||
import { bind } from "astal";
|
|
||||||
import {
|
import {
|
||||||
PowerMenu,
|
PowerMenu,
|
||||||
Cpu,
|
Cpu,
|
||||||
@@ -8,17 +6,17 @@ import {
|
|||||||
Ram,
|
Ram,
|
||||||
Storage,
|
Storage,
|
||||||
Workspaces,
|
Workspaces,
|
||||||
FocusedClient,
|
// FocusedClient,
|
||||||
Time,
|
Time,
|
||||||
SysTray,
|
SysTray,
|
||||||
Media,
|
Media,
|
||||||
|
LauncherButton,
|
||||||
|
PowerMenuButton,
|
||||||
|
MediaPlayerButton,
|
||||||
} from "./modules/export";
|
} from "./modules/export";
|
||||||
import { close_all_menus } from "./utils/windows";
|
|
||||||
|
|
||||||
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
export default function Bar(gdkmonitor: Gdk.Monitor) {
|
||||||
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
const { TOP, LEFT, RIGHT } = Astal.WindowAnchor;
|
||||||
const mpris = Mpris.get_default();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<window
|
<window
|
||||||
@@ -31,13 +29,7 @@ export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|||||||
>
|
>
|
||||||
<centerbox>
|
<centerbox>
|
||||||
<box hexpand halign={Gtk.Align.START} className="RoudedBlock">
|
<box hexpand halign={Gtk.Align.START} className="RoudedBlock">
|
||||||
<button
|
<LauncherButton />
|
||||||
onClicked="/home/tola/dotfiles/rofi/launcher/launcher.sh"
|
|
||||||
halign={Gtk.Align.START}
|
|
||||||
className="Menubutton"
|
|
||||||
>
|
|
||||||
|
|
||||||
</button>
|
|
||||||
<Cpu />
|
<Cpu />
|
||||||
<Ram />
|
<Ram />
|
||||||
<Storage />
|
<Storage />
|
||||||
@@ -47,34 +39,11 @@ export default function Bar(gdkmonitor: Gdk.Monitor) {
|
|||||||
<Workspaces />
|
<Workspaces />
|
||||||
</box>
|
</box>
|
||||||
<box hexpand halign={Gtk.Align.END} className="RoudedBlock">
|
<box hexpand halign={Gtk.Align.END} className="RoudedBlock">
|
||||||
{bind(mpris, "players").as((ps) =>
|
<MediaPlayerButton />
|
||||||
ps[0] ? (
|
|
||||||
<button
|
|
||||||
onClicked={() => {
|
|
||||||
close_all_menus("Mediamenu");
|
|
||||||
App.toggle_window("Mediamenu");
|
|
||||||
}}
|
|
||||||
className="Menubutton"
|
|
||||||
>
|
|
||||||
|
|
||||||
</button>
|
|
||||||
) : (
|
|
||||||
<></>
|
|
||||||
),
|
|
||||||
)}
|
|
||||||
<SysTray />
|
<SysTray />
|
||||||
<BatteryLevel />
|
<BatteryLevel />
|
||||||
<Time />
|
<Time />
|
||||||
<button
|
<PowerMenuButton />
|
||||||
onClicked={() => {
|
|
||||||
close_all_menus("powermenu");
|
|
||||||
App.toggle_window("powermenu");
|
|
||||||
}}
|
|
||||||
halign={Gtk.Align.START}
|
|
||||||
className="Menubutton"
|
|
||||||
>
|
|
||||||
⏻
|
|
||||||
</button>
|
|
||||||
</box>
|
</box>
|
||||||
</centerbox>
|
</centerbox>
|
||||||
</window>
|
</window>
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import { Gtk } from "astal/gtk3";
|
||||||
|
|
||||||
|
export default function LauncherButton() {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
onClicked="/home/tola/dotfiles/rofi/launcher/launcher.sh"
|
||||||
|
halign={Gtk.Align.START}
|
||||||
|
className="Menubutton"
|
||||||
|
>
|
||||||
|
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
import Mpris from "gi://AstalMpris";
|
||||||
|
import { bind } from "astal";
|
||||||
|
import { close_all_menus } from "../utils/windows";
|
||||||
|
import { App } from "astal/gtk3";
|
||||||
|
|
||||||
|
export default function MediaPlayerButton() {
|
||||||
|
const mpris = Mpris.get_default();
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
{bind(mpris, "players").as((ps) =>
|
||||||
|
ps[0] ? (
|
||||||
|
<button
|
||||||
|
onClicked={() => {
|
||||||
|
close_all_menus("Mediamenu");
|
||||||
|
App.toggle_window("Mediamenu");
|
||||||
|
}}
|
||||||
|
className="Menubutton"
|
||||||
|
>
|
||||||
|
|
||||||
|
</button>
|
||||||
|
) : (
|
||||||
|
<></>
|
||||||
|
),
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
import { close_all_menus } from "../utils/windows";
|
||||||
|
import { App, Gtk } from "astal/gtk3";
|
||||||
|
|
||||||
|
export default function PowerMenuButton() {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
onClicked={() => {
|
||||||
|
close_all_menus("powermenu");
|
||||||
|
App.toggle_window("powermenu");
|
||||||
|
}}
|
||||||
|
halign={Gtk.Align.START}
|
||||||
|
className="Menubutton"
|
||||||
|
>
|
||||||
|
⏻
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -8,6 +8,9 @@ import SysTray from "./SysTray";
|
|||||||
import Time from "./Time";
|
import Time from "./Time";
|
||||||
import Workspaces from "./Workspaces";
|
import Workspaces from "./Workspaces";
|
||||||
import Media from "./Media/Media";
|
import Media from "./Media/Media";
|
||||||
|
import LauncherButton from "./LauncherButton";
|
||||||
|
import PowerMenuButton from "./PowerMenuButton";
|
||||||
|
import MediaPlayerButton from "./MediaPlayerButton";
|
||||||
|
|
||||||
export {
|
export {
|
||||||
BatteryLevel,
|
BatteryLevel,
|
||||||
@@ -20,4 +23,7 @@ export {
|
|||||||
Time,
|
Time,
|
||||||
Workspaces,
|
Workspaces,
|
||||||
Media,
|
Media,
|
||||||
|
LauncherButton,
|
||||||
|
PowerMenuButton,
|
||||||
|
MediaPlayerButton,
|
||||||
};
|
};
|
||||||
Reference in new issue
Block a user