Compare commits

..

No commits in common. "5a0f40a2b2a1217cdae1eefd4d36e23306fd8507" and "7f06a60027f4d1e9f4474c93c651bfa12b632dbc" have entirely different histories.

2 changed files with 28 additions and 46 deletions

View file

@ -1,5 +1,5 @@
import { Hyprland, Utils, Widget } from '../../imports.js'; import { Hyprland, Utils, Widget } from '../../imports.js';
const { Box, Overlay, Revealer } = Widget; const { Box, Revealer } = Widget;
const { execAsync } = Utils; const { execAsync } = Utils;
import EventBox from '../misc/cursorbox.js'; import EventBox from '../misc/cursorbox.js';
@ -17,10 +17,10 @@ const Workspace = ({ i } = {}) =>
.catch(print); .catch(print);
}, },
child: Box({ child: Box({
valign: 'center',
className: 'button', className: 'button',
connections: [[Hyprland, self => { connections: [[Hyprland, self => {
const occupied = Hyprland.getWorkspace(i)?.windows > 0; const occupied = Hyprland.getWorkspace(i)?.windows > 0;
self.toggleClassName('active', Hyprland.active.workspace.id === i);
self.toggleClassName('occupied', occupied); self.toggleClassName('occupied', occupied);
self.toggleClassName('empty', !occupied); self.toggleClassName('empty', !occupied);
}]], }]],
@ -28,28 +28,10 @@ const Workspace = ({ i } = {}) =>
}), }),
}); });
export default () => Overlay({ export default () => Box({
setup: self => {
self.set_overlay_pass_through(
self.get_children()[1],
true,
);
},
overlays: [Box({
valign: 'center',
halign: 'start',
className: 'button active',
connections: [[Hyprland.active.workspace, self => {
const currentId = Hyprland.active.workspace.id;
const indicators = self.get_parent().get_children()[0].child.children;
const currentIndex = indicators.findIndex(w => w._id == currentId);
self.setStyle(`margin-left: ${16 + currentIndex * 30}px`);
}]],
})],
child: EventBox({
child: Box({
className: 'workspaces', className: 'workspaces',
children: [EventBox({
child: Box({
properties: [ properties: [
['workspaces'], ['workspaces'],
@ -60,7 +42,7 @@ export default () => Overlay({
}); });
}], }],
['updateWorkspaces', self => { ['updateWs', self => {
Hyprland.workspaces.forEach(ws => { Hyprland.workspaces.forEach(ws => {
const currentWs = self.children.find(ch => ch._id == ws.id); const currentWs = self.children.find(ch => ch._id == ws.id);
if (!currentWs && ws.id > 0) if (!currentWs && ws.id > 0)
@ -79,9 +61,9 @@ export default () => Overlay({
return Hyprland.workspaces.find(ws => ws.id == ch._id); return Hyprland.workspaces.find(ws => ws.id == ch._id);
}).sort((a, b) => a._id - b._id); }).sort((a, b) => a._id - b._id);
self._updateWorkspaces(self); self._updateWs(self);
self._refresh(self); self._refresh(self);
}]], }]],
}), }),
}), })],
}); });

View file

@ -3,17 +3,16 @@
border-radius: 80px; border-radius: 80px;
border: 2px solid $bg-secondary; border: 2px solid $bg-secondary;
padding: 3px 12px; padding: 3px 12px;
}
.button { .button {
margin: 0 2.5px; margin: 2px;
min-height: 22px; min-width: 20px;
min-width: 22px;
border-radius: 100%; border-radius: 100%;
* {color: transparent;}
} }
.empty { .empty {
border: 2px solid transparent; border: none;
transition: border-color 0.25s linear; transition: border-color 0.25s linear;
} }
@ -25,5 +24,6 @@
.active { .active {
border: 2px solid #50fa7b; border: 2px solid #50fa7b;
transition: margin-left 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); transition: border-color 0.25s linear;
}
} }