92 lines
3.1 KiB
TypeScript
92 lines
3.1 KiB
TypeScript
import Audio from './modules/Audio/Audio';
|
|
import {
|
|
BatteryBox
|
|
} from './modules/Battery';
|
|
import Bluetooth from './modules/Bluetooth/Bluetooth';
|
|
import Brightness from './modules/Brightness/Brightness';
|
|
import {
|
|
Gtk
|
|
} from 'astal/gtk4';
|
|
import Network from './modules/Networking/Network';
|
|
import Player from './modules/Player/Player';
|
|
import Power from './modules/Power';
|
|
import SysTray from './modules/SysTray';
|
|
import {
|
|
exec
|
|
} from 'astal';
|
|
|
|
const QuickActions = () => {
|
|
const popover = new Gtk.Popover( {
|
|
'cssClasses': [ 'quick-actions-wrapper' ]
|
|
} );
|
|
|
|
popover.set_child( renderQuickActions() );
|
|
|
|
return popover;
|
|
};
|
|
|
|
const renderQuickActions = () => {
|
|
const user = exec( '/bin/sh -c whoami' );
|
|
const profile = exec( '/bin/fish -c get-profile-picture' );
|
|
const cwd = exec( 'pwd' );
|
|
const um = Power.UserMenu();
|
|
|
|
return (
|
|
<box visible cssClasses={[
|
|
'quick-actions',
|
|
'popover-box'
|
|
]} vertical>
|
|
<centerbox
|
|
startWidget={
|
|
<button
|
|
onClicked={() => um.popup()}
|
|
cssClasses={[ 'stealthy-button' ]}
|
|
child={
|
|
<box>
|
|
{um}
|
|
<Gtk.Frame
|
|
cssClasses={[ 'avatar-icon' ]}
|
|
child={
|
|
<image
|
|
file={
|
|
profile !== ''
|
|
? profile
|
|
: cwd
|
|
+ '/no-avatar-icon.jpg'
|
|
}
|
|
></image>
|
|
}
|
|
></Gtk.Frame>
|
|
<label label={user}></label>
|
|
</box>
|
|
}
|
|
></button>
|
|
}
|
|
endWidget={
|
|
<box
|
|
hexpand={false}
|
|
>
|
|
<BatteryBox></BatteryBox>
|
|
<SysTray.SystemTray></SysTray.SystemTray>
|
|
<Power.Power></Power.Power>
|
|
</box>
|
|
}
|
|
></centerbox>
|
|
<Gtk.Separator marginTop={10} marginBottom={20}></Gtk.Separator>
|
|
<box>
|
|
<Bluetooth.BluetoothModule></Bluetooth.BluetoothModule>
|
|
<Network.Network></Network.Network>
|
|
</box>
|
|
<Gtk.Separator marginTop={10} marginBottom={10}></Gtk.Separator>
|
|
<Brightness.BrightnessModule></Brightness.BrightnessModule>
|
|
<Audio.AudioModule></Audio.AudioModule>
|
|
<Player.PlayerModule></Player.PlayerModule>
|
|
</box>
|
|
);
|
|
};
|
|
|
|
// TODO: Expose additional functions to be usable through CLI
|
|
export default {
|
|
QuickActions,
|
|
};
|