[Build] Start refactor
This commit is contained in:
84
configs/userland/astal/components/bar/Bar.tsx
Normal file
84
configs/userland/astal/components/bar/Bar.tsx
Normal file
@@ -0,0 +1,84 @@
|
||||
import {
|
||||
App, Astal, Gdk, Gtk
|
||||
} from 'astal/gtk4';
|
||||
import Calendar from './modules/Calendar';
|
||||
import {
|
||||
CenterBox
|
||||
} from 'astal/gtk4/widget';
|
||||
import Hyprland from './modules/Hyprland';
|
||||
import QuickView from './modules/QuickView';
|
||||
import SystemInfo from './modules/SystemInfo';
|
||||
|
||||
const Bar = ( {
|
||||
gdkmonitor, name
|
||||
}: {
|
||||
'gdkmonitor': Gdk.Monitor,
|
||||
'name': string
|
||||
} ) => {
|
||||
const {
|
||||
TOP, LEFT, RIGHT
|
||||
} = Astal.WindowAnchor;
|
||||
|
||||
return (
|
||||
<window
|
||||
gdkmonitor={gdkmonitor}
|
||||
cssClasses={[ 'Bar' ]}
|
||||
name={name}
|
||||
namespace={'bar'}
|
||||
exclusivity={Astal.Exclusivity.EXCLUSIVE}
|
||||
anchor={TOP | LEFT | RIGHT}
|
||||
visible
|
||||
application={App}
|
||||
child={
|
||||
<CenterBox
|
||||
orientation={Gtk.Orientation.HORIZONTAL}
|
||||
startWidget={
|
||||
<box
|
||||
hexpand
|
||||
halign={Gtk.Align.START}
|
||||
>
|
||||
<Hyprland.ModeStatus />
|
||||
<Calendar.Time />
|
||||
<Hyprland.Workspace />
|
||||
</box>
|
||||
}
|
||||
centerWidget={<Hyprland.ActiveWindow />}
|
||||
endWidget={
|
||||
<box
|
||||
hexpand
|
||||
halign={Gtk.Align.END}
|
||||
cssClasses={[ 'BarRight' ]}
|
||||
>
|
||||
<SystemInfo.SystemInfo />
|
||||
<QuickView.QuickView />
|
||||
</box>
|
||||
}
|
||||
></CenterBox>
|
||||
}
|
||||
></window>
|
||||
);
|
||||
};
|
||||
|
||||
const cliHandler = ( args: string[] ): string => {
|
||||
console.debug( args );
|
||||
|
||||
return 'Not implemented';
|
||||
};
|
||||
|
||||
const BarLauncher = ( monitor: Gdk.Monitor ) => {
|
||||
const windowName = `bar-${ monitor.get_connector() }`;
|
||||
|
||||
const createBar = () => {
|
||||
return <Bar gdkmonitor={monitor} name={windowName}></Bar>;
|
||||
};
|
||||
|
||||
// Actually start the bar
|
||||
createBar();
|
||||
|
||||
return windowName;
|
||||
};
|
||||
|
||||
export default {
|
||||
BarLauncher,
|
||||
cliHandler,
|
||||
};
|
||||
Reference in New Issue
Block a user