Remove global service declarations and change to declarations upon usage. (#761)
* Remove global service declarations and change to declarations upon usage. * Only load cava service if cava is enabled.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { audioService } from 'src/lib/constants/services';
|
||||
import { SliderItem } from '../sliderItem/SliderItem';
|
||||
import { ActiveDeviceMenu } from '..';
|
||||
import AstalWp from 'gi://AstalWp?version=0.1';
|
||||
|
||||
const wireplumber = AstalWp.get_default() as AstalWp.Wp;
|
||||
const audioService = wireplumber.audio;
|
||||
|
||||
const ActiveDeviceContainer = ({ children }: ActiveDeviceContainerProps): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { bind } from 'astal';
|
||||
import { audioService } from 'src/lib/constants/services';
|
||||
import { SliderItem } from '../sliderItem/SliderItem';
|
||||
import { ActiveDeviceMenu } from '..';
|
||||
import AstalWp from 'gi://AstalWp?version=0.1';
|
||||
|
||||
const wireplumber = AstalWp.get_default() as AstalWp.Wp;
|
||||
const audioService = wireplumber.audio;
|
||||
|
||||
const NoStreams = (): JSX.Element => {
|
||||
return <label className={'no-playbacks dim'} label={'No active playbacks found.'} expand />;
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { audioService } from 'src/lib/constants/services.js';
|
||||
import { bind } from 'astal';
|
||||
import { AudioDevice } from './Device';
|
||||
import { NotFoundButton } from './NotFoundButton';
|
||||
import AstalWp from 'gi://AstalWp?version=0.1';
|
||||
|
||||
const wireplumber = AstalWp.get_default() as AstalWp.Wp;
|
||||
const audioService = wireplumber.audio;
|
||||
|
||||
export const InputDevices = (): JSX.Element => {
|
||||
const inputDevices = bind(audioService, 'microphones');
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
import { audioService } from 'src/lib/constants/services.js';
|
||||
import { bind } from 'astal';
|
||||
import { AudioDevice } from './Device';
|
||||
import { NotFoundButton } from './NotFoundButton';
|
||||
import AstalWp from 'gi://AstalWp?version=0.1';
|
||||
|
||||
const wireplumber = AstalWp.get_default() as AstalWp.Wp;
|
||||
const audioService = wireplumber.audio;
|
||||
|
||||
export const PlaybackDevices = (): JSX.Element => {
|
||||
const playbackDevices = bind(audioService, 'speakers');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { execAsync } from 'astal';
|
||||
import AstalBluetooth from 'gi://AstalBluetooth?version=0.1';
|
||||
import { bluetoothService } from 'src/lib/constants/services';
|
||||
|
||||
const bluetoothService = AstalBluetooth.get_default();
|
||||
|
||||
/**
|
||||
* Retrieves the list of available Bluetooth devices.
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import { bluetoothService } from 'src/lib/constants/services.js';
|
||||
import { getAvailableBluetoothDevices, getConnectedBluetoothDevices } from './helpers.js';
|
||||
import { NoBluetoothDevices } from './NoBluetoothDevices.js';
|
||||
import { BluetoothDisabled } from './BluetoothDisabled.js';
|
||||
import { DeviceListItem } from './DeviceListItem.js';
|
||||
import AstalBluetooth from 'gi://AstalBluetooth?version=0.1';
|
||||
|
||||
const bluetoothService = AstalBluetooth.get_default();
|
||||
|
||||
export const BluetoothDevices = (): JSX.Element => {
|
||||
const deviceListBinding = Variable.derive(
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { bluetoothService } from 'src/lib/constants/services';
|
||||
import { isPrimaryClick } from 'src/lib/utils';
|
||||
import { bind, timeout } from 'astal';
|
||||
import { isDiscovering } from './helper';
|
||||
import AstalBluetooth from 'gi://AstalBluetooth?version=0.1';
|
||||
|
||||
const bluetoothService = AstalBluetooth.get_default();
|
||||
|
||||
export const DiscoverButton = (): JSX.Element => (
|
||||
<button
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { bluetoothService } from 'src/lib/constants/services';
|
||||
import AstalBluetooth from 'gi://AstalBluetooth?version=0.1';
|
||||
|
||||
const bluetoothService = AstalBluetooth.get_default();
|
||||
|
||||
const isPowered = Variable(false);
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import { bluetoothService } from 'src/lib/constants/services';
|
||||
import AstalBluetooth from 'gi://AstalBluetooth?version=0.1';
|
||||
|
||||
const bluetoothService = AstalBluetooth.get_default();
|
||||
|
||||
export const isDiscovering: Variable<boolean> = Variable(false);
|
||||
let discoveringBinding: Variable<void> | undefined;
|
||||
|
||||
@@ -1,10 +1,19 @@
|
||||
import { bind } from 'astal';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import { bluetoothService } from 'src/lib/constants/services';
|
||||
import { notifdService } from 'src/lib/constants/services';
|
||||
import { audioService } from 'src/lib/constants/services';
|
||||
import { isPrimaryClick } from 'src/lib/utils';
|
||||
import { isWifiEnabled } from './helpers';
|
||||
import AstalNotifd from 'gi://AstalNotifd?version=0.1';
|
||||
import AstalBluetooth from 'gi://AstalBluetooth?version=0.1';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
import AstalWp from 'gi://AstalWp?version=0.1';
|
||||
|
||||
const wireplumber = AstalWp.get_default() as AstalWp.Wp;
|
||||
const audioService = wireplumber.audio;
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
const bluetoothService = AstalBluetooth.get_default();
|
||||
|
||||
const notifdService = AstalNotifd.get_default();
|
||||
|
||||
export const WifiButton = (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export const isWifiEnabled: Variable<boolean> = Variable(false);
|
||||
let wifiEnabledBinding: Variable<void> | undefined;
|
||||
|
||||
@@ -2,10 +2,11 @@ import { bind, execAsync, Variable } from 'astal';
|
||||
import { App, Gdk, Gtk } from 'astal/gtk3';
|
||||
import Menu from 'src/components/shared/Menu';
|
||||
import MenuItem from 'src/components/shared/MenuItem';
|
||||
import { hyprlandService } from 'src/lib/constants/services';
|
||||
import { isRecording } from '../helpers';
|
||||
import AstalHyprland from 'gi://AstalHyprland?version=0.1';
|
||||
|
||||
const hyprlandService = AstalHyprland.get_default();
|
||||
|
||||
const MonitorListDropdown = (): JSX.Element => {
|
||||
const monitorList: Variable<AstalHyprland.Monitor[]> = Variable([]);
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { bind } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { brightnessService } from 'src/lib/constants/services';
|
||||
import Brightness from 'src/services/Brightness';
|
||||
|
||||
const brightnessService = Brightness.get_default();
|
||||
|
||||
export const BrightnessPercentage = (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { bind } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { brightnessService } from 'src/lib/constants/services';
|
||||
import Brightness from 'src/services/Brightness';
|
||||
|
||||
const brightnessService = Brightness.get_default();
|
||||
|
||||
export const BrightnessSlider = (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
import { bind } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import AstalPowerProfiles from 'gi://AstalPowerProfiles?version=0.1';
|
||||
import { powerProfilesService } from 'src/lib/constants/services';
|
||||
import icons from 'src/lib/icons/icons';
|
||||
import { ProfileType } from 'src/lib/types/powerprofiles';
|
||||
import { isPrimaryClick } from 'src/lib/utils';
|
||||
|
||||
const powerProfilesService = AstalPowerProfiles.get_default();
|
||||
|
||||
export const PowerProfiles = (): JSX.Element => {
|
||||
const powerProfiles = powerProfilesService.get_profiles();
|
||||
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { bind } from 'astal';
|
||||
import { Astal, Gtk, Widget } from 'astal/gtk3';
|
||||
import { mprisService } from 'src/lib/constants/services';
|
||||
import { isPrimaryClick } from 'src/lib/utils';
|
||||
import { getNextPlayer, getPreviousPlayer } from './helpers';
|
||||
import AstalMpris from 'gi://AstalMpris?version=0.1';
|
||||
|
||||
const mprisService = AstalMpris.get_default();
|
||||
|
||||
export const PreviousPlayer = (): JSX.Element => {
|
||||
const className = bind(mprisService, 'players').as((players) => {
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import AstalMpris from 'gi://AstalMpris?version=0.1';
|
||||
import { activePlayer } from 'src/globals/media';
|
||||
import { mprisService } from 'src/lib/constants/services';
|
||||
import icons2 from 'src/lib/icons/icons2';
|
||||
import { PlaybackIconMap } from 'src/lib/types/mpris';
|
||||
|
||||
const mprisService = AstalMpris.get_default();
|
||||
|
||||
/**
|
||||
* Determines if the loop status is active.
|
||||
*
|
||||
|
||||
@@ -2,9 +2,9 @@ import { Binding } from 'astal';
|
||||
import { bind, Variable } from 'astal';
|
||||
import AstalMpris from 'gi://AstalMpris?version=0.1';
|
||||
import { mediaArtUrl } from 'src/globals/media';
|
||||
import { mprisService } from 'src/lib/constants/services';
|
||||
import options from 'src/options';
|
||||
|
||||
const mprisService = AstalMpris.get_default();
|
||||
const { tint, color } = options.theme.bar.menus.menu.media.card;
|
||||
|
||||
const curPlayer = Variable('');
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
/*******************************************
|
||||
* Values *
|
||||
|
||||
@@ -3,9 +3,11 @@ import { Ethernet } from './ethernet/index.js';
|
||||
import { Wifi } from './wifi/index.js';
|
||||
import options from 'src/options.js';
|
||||
import { bind } from 'astal';
|
||||
import { networkService } from 'src/lib/constants/services.js';
|
||||
import { NoWifi } from './wifi/WirelessAPs/NoWifi.js';
|
||||
import { RevealerTransitionMap } from 'src/lib/constants/options.js';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export default (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { bind } from 'astal/binding';
|
||||
import { Variable } from 'astal';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import { AccessPoint } from './AccessPoint';
|
||||
import { PasswordInput } from './PasswordInput';
|
||||
import { connecting, staging } from '../WirelessAPs/helpers';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export const APStaging = (): JSX.Element => {
|
||||
const stagingBinding = Variable.derive([bind(networkService, 'wifi'), bind(staging)], () => {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import { bind } from 'astal';
|
||||
import { isPrimaryClick } from 'src/lib/utils';
|
||||
import { isScanning } from './helpers';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export const RefreshButton = (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export const WifiSwitch = (): JSX.Element => (
|
||||
<switch
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export const isScanning: Variable<boolean> = Variable(false);
|
||||
let scanningBinding: Variable<void> | undefined;
|
||||
|
||||
@@ -3,9 +3,10 @@ import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
import { getWifiIcon } from '../../utils';
|
||||
import { connectToAP, getWifiStatus, isDisconnecting, isApEnabled, isApActive } from './helpers';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import Spinner from 'src/components/shared/Spinner';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export const AccessPoint = ({ connecting, accessPoint }: AccessPointProps): JSX.Element => {
|
||||
const ConnectionIcon = (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -2,9 +2,10 @@ import { bind, execAsync, Variable } from 'astal';
|
||||
import { Astal } from 'astal/gtk3';
|
||||
import AstalNetwork from 'gi://AstalNetwork?version=0.1';
|
||||
import { DEVICE_STATES } from 'src/lib/constants/network';
|
||||
import { networkService } from 'src/lib/constants/services';
|
||||
import { isPrimaryClick, Notify } from 'src/lib/utils';
|
||||
|
||||
const networkService = AstalNetwork.get_default();
|
||||
|
||||
export const isWifiEnabled: Variable<boolean> = Variable(false);
|
||||
export const wifiAccessPoints: Variable<AstalNetwork.AccessPoint[]> = Variable([]);
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
import { bind } from 'astal';
|
||||
import AstalNotifd from 'gi://AstalNotifd?version=0.1';
|
||||
import { clearNotifications } from 'src/globals/notification';
|
||||
import { notifdService } from 'src/lib/constants/services';
|
||||
import { isPrimaryClick } from 'src/lib/utils';
|
||||
import options from 'src/options';
|
||||
|
||||
const notifdService = AstalNotifd.get_default();
|
||||
|
||||
const { clearDelay } = options.notifications;
|
||||
|
||||
export const ClearNotificationsButton = (): JSX.Element => {
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { bind } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { notifdService } from 'src/lib/constants/services';
|
||||
import AstalNotifd from 'gi://AstalNotifd?version=0.1';
|
||||
|
||||
const notifdService = AstalNotifd.get_default();
|
||||
|
||||
export const DndSwitch = (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import AstalNotifd from 'gi://AstalNotifd?version=0.1';
|
||||
import { notifdService } from 'src/lib/constants/services';
|
||||
const { displayedTotal } = options.notifications;
|
||||
|
||||
const notifdService = AstalNotifd.get_default();
|
||||
|
||||
/**
|
||||
* Handles page boundaries for notifications.
|
||||
*
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { bind } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { notifdService } from 'src/lib/constants/services';
|
||||
import AstalNotifd from 'gi://AstalNotifd?version=0.1';
|
||||
|
||||
const notifdService = AstalNotifd.get_default();
|
||||
|
||||
export const Placeholder = (): JSX.Element => {
|
||||
return (
|
||||
|
||||
@@ -3,10 +3,11 @@ import { filterNotifications } from 'src/lib/shared/notifications.js';
|
||||
import AstalNotifd from 'gi://AstalNotifd?version=0.1';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import { bind, Variable } from 'astal';
|
||||
import { notifdService } from 'src/lib/constants/services.js';
|
||||
import { NotificationCard } from 'src/components/notifications/Notification.js';
|
||||
import { Placeholder } from './Placeholder';
|
||||
|
||||
const notifdService = AstalNotifd.get_default();
|
||||
|
||||
const { displayedTotal, ignore, showActionsOnHover } = options.notifications;
|
||||
|
||||
export const NotificationsContainer = ({ curPage }: NotificationsContainerProps): JSX.Element => {
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
import { bind, Variable } from 'astal';
|
||||
import { Gtk } from 'astal/gtk3';
|
||||
import AstalNotifd from 'gi://AstalNotifd?version=0.1';
|
||||
import { notifdService } from 'src/lib/constants/services';
|
||||
import options from 'src/options';
|
||||
import { FirstPageButton, LastPageButton, NextPageButton, PreviousPageButton } from './Buttons';
|
||||
|
||||
const notifdService = AstalNotifd.get_default();
|
||||
|
||||
const { displayedTotal } = options.notifications;
|
||||
const { show: showPager } = options.theme.bar.menus.menu.notifications.pager;
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@ import options from 'src/options';
|
||||
import { globalEventBoxes } from 'src/globals/dropdown';
|
||||
import { GLib } from 'astal';
|
||||
import { EventBox } from 'astal/gtk3/widget';
|
||||
import { hyprlandService } from 'src/lib/constants/services';
|
||||
import AstalHyprland from 'gi://AstalHyprland?version=0.1';
|
||||
|
||||
const hyprlandService = AstalHyprland.get_default();
|
||||
const { location } = options.theme.bar;
|
||||
const { scalingPriority } = options;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user