Skip to content

Commit

Permalink
Fix service based variables.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jas-SinghFSU committed Dec 21, 2024
1 parent 4928871 commit 61f5c6e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions src/components/bar/modules/media/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const { truncation, truncation_size, show_label, show_active_only, rightClick, m
options.bar.media;

const Media = (): BarBoxChild => {
activePlayer.set(mprisService.get_players()[0]);

const isVis = Variable(!show_active_only.get());

show_active_only.subscribe(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ 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 monitorList = Variable(hyprlandService?.monitors || []);
const MonitorListDropdown = (): JSX.Element => {
const monitorList: Variable<AstalHyprland.Monitor[]> = Variable([]);

hyprlandService.connect('monitor-added', () => monitorList.set(hyprlandService.monitors));
hyprlandService.connect('monitor-removed', () => monitorList.set(hyprlandService.monitors));
const monitorBinding = Variable.derive([bind(hyprlandService, 'monitors')], () =>
monitorList.set(hyprlandService.monitors),
);

const MonitorListDropdown = (): JSX.Element => {
return (
<Menu className={'dropdown recording'} halign={Gtk.Align.FILL} hexpand>
<Menu className={'dropdown recording'} halign={Gtk.Align.FILL} onDestroy={() => monitorBinding.drop()} hexpand>
{bind(monitorList).as((monitors) => {
return monitors.map((monitor) => (
<MenuItem
Expand Down

0 comments on commit 61f5c6e

Please sign in to comment.