forked from Shinonome/dots-hyprland
ags: sync
This commit is contained in:
@@ -17,6 +17,6 @@ if [[ "$(pidof wf-recorder)" == "" ]]; then
|
|||||||
wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$(slurp)" & disown
|
wf-recorder --pixel-format yuv420p -f './recording_'"$(getdate)"'.mp4' -t --geometry "$(slurp)" & disown
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
/usr/bin/kill --signal SIGINT wf-recorder
|
kill --signal SIGINT wf-recorder
|
||||||
notify-send "Recording Stopped" "Stopped" -a 'record-script.sh'
|
notify-send "Recording Stopped" "Stopped" -a 'record-script.sh'
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,10 +4,7 @@
|
|||||||
$black: black;
|
$black: black;
|
||||||
$white: white;
|
$white: white;
|
||||||
$bar_ws_width: 1.774rem;
|
$bar_ws_width: 1.774rem;
|
||||||
$bar_subgroup_bg: mix($surfaceVariant, $primary, 89%);
|
$bar_subgroup_bg: $surfaceVariant;
|
||||||
@if $darkmode ==true {
|
|
||||||
$bar_subgroup_bg: $surfaceVariant;
|
|
||||||
}
|
|
||||||
|
|
||||||
@mixin bar-group-rounding {
|
@mixin bar-group-rounding {
|
||||||
@include small-rounding;
|
@include small-rounding;
|
||||||
|
|||||||
@@ -15,12 +15,12 @@ const dummyOccupiedWs = Box({ className: 'bar-ws bar-ws-occupied' }); // Not sho
|
|||||||
// Font size = workspace id
|
// Font size = workspace id
|
||||||
const WorkspaceContents = (count = 10) => {
|
const WorkspaceContents = (count = 10) => {
|
||||||
return DrawingArea({
|
return DrawingArea({
|
||||||
|
css: `transition: 90ms cubic-bezier(0.1, 1, 0, 1);`,
|
||||||
properties: [
|
properties: [
|
||||||
['initialized', false],
|
['initialized', false],
|
||||||
['workspaceMask', 0],
|
['workspaceMask', 0],
|
||||||
['updateMask', (self) => {
|
['updateMask', (self) => {
|
||||||
if(self._initialized) return; // We only need this to run once
|
if (self._initialized) return; // We only need this to run once
|
||||||
console.log('update dayo')
|
|
||||||
const workspaces = Hyprland.workspaces;
|
const workspaces = Hyprland.workspaces;
|
||||||
let workspaceMask = 0;
|
let workspaceMask = 0;
|
||||||
for (let i = 0; i < workspaces.length; i++) {
|
for (let i = 0; i < workspaces.length; i++) {
|
||||||
@@ -39,102 +39,100 @@ const WorkspaceContents = (count = 10) => {
|
|||||||
else self._workspaceMask &= ~(1 << parseInt(name));
|
else self._workspaceMask &= ~(1 << parseInt(name));
|
||||||
}]
|
}]
|
||||||
],
|
],
|
||||||
css: `transition: 90ms cubic-bezier(0.1, 1, 0, 1);`,
|
setup: (area) => area
|
||||||
setup: (area) => {
|
.hook(Hyprland.active.workspace, (area) =>
|
||||||
area
|
area.setCss(`font-size: ${Hyprland.active.workspace.id}px;`)
|
||||||
.hook(Hyprland.active.workspace, (area) =>
|
)
|
||||||
area.setCss(`font-size: ${Hyprland.active.workspace.id}px;`)
|
.hook(Hyprland, (self) => self._updateMask(self), 'notify::workspaces')
|
||||||
)
|
.hook(Hyprland, (self, name) => self._toggleMask(self, true, name), 'workspace-added')
|
||||||
.hook(Hyprland, (self) => self._updateMask(self), 'notify::workspaces')
|
.hook(Hyprland, (self, name) => self._toggleMask(self, false, name), 'workspace-removed')
|
||||||
.hook(Hyprland, (self, name) => self._toggleMask(self, true, name), 'workspace-added')
|
.on('draw', Lang.bind(area, (area, cr) => {
|
||||||
.hook(Hyprland, (self, name) => self._toggleMask(self, false, name), 'workspace-removed')
|
const allocation = area.get_allocation();
|
||||||
.on('draw', Lang.bind(area, (area, cr) => {
|
const { width, height } = allocation;
|
||||||
const allocation = area.get_allocation();
|
|
||||||
const { width, height } = allocation;
|
|
||||||
|
|
||||||
const workspaceStyleContext = dummyWs.get_style_context();
|
const workspaceStyleContext = dummyWs.get_style_context();
|
||||||
const workspaceDiameter = workspaceStyleContext.get_property('min-width', Gtk.StateFlags.NORMAL);
|
const workspaceDiameter = workspaceStyleContext.get_property('min-width', Gtk.StateFlags.NORMAL);
|
||||||
const workspaceRadius = workspaceDiameter / 2;
|
const workspaceRadius = workspaceDiameter / 2;
|
||||||
const workspaceFontSize = workspaceStyleContext.get_property('font-size', Gtk.StateFlags.NORMAL) / 4 * 3;
|
const workspaceFontSize = workspaceStyleContext.get_property('font-size', Gtk.StateFlags.NORMAL) / 4 * 3;
|
||||||
const workspaceFontFamily = workspaceStyleContext.get_property('font-family', Gtk.StateFlags.NORMAL);
|
const workspaceFontFamily = workspaceStyleContext.get_property('font-family', Gtk.StateFlags.NORMAL);
|
||||||
const wsbg = workspaceStyleContext.get_property('background-color', Gtk.StateFlags.NORMAL);
|
const wsbg = workspaceStyleContext.get_property('background-color', Gtk.StateFlags.NORMAL);
|
||||||
const wsfg = workspaceStyleContext.get_property('color', Gtk.StateFlags.NORMAL);
|
const wsfg = workspaceStyleContext.get_property('color', Gtk.StateFlags.NORMAL);
|
||||||
|
|
||||||
const occupiedWorkspaceStyleContext = dummyOccupiedWs.get_style_context();
|
const occupiedWorkspaceStyleContext = dummyOccupiedWs.get_style_context();
|
||||||
const occupiedbg = occupiedWorkspaceStyleContext.get_property('background-color', Gtk.StateFlags.NORMAL);
|
const occupiedbg = occupiedWorkspaceStyleContext.get_property('background-color', Gtk.StateFlags.NORMAL);
|
||||||
const occupiedfg = occupiedWorkspaceStyleContext.get_property('color', Gtk.StateFlags.NORMAL);
|
const occupiedfg = occupiedWorkspaceStyleContext.get_property('color', Gtk.StateFlags.NORMAL);
|
||||||
|
|
||||||
const activeWorkspaceStyleContext = dummyActiveWs.get_style_context();
|
const activeWorkspaceStyleContext = dummyActiveWs.get_style_context();
|
||||||
const activebg = activeWorkspaceStyleContext.get_property('background-color', Gtk.StateFlags.NORMAL);
|
const activebg = activeWorkspaceStyleContext.get_property('background-color', Gtk.StateFlags.NORMAL);
|
||||||
const activefg = activeWorkspaceStyleContext.get_property('color', Gtk.StateFlags.NORMAL);
|
const activefg = activeWorkspaceStyleContext.get_property('color', Gtk.StateFlags.NORMAL);
|
||||||
area.set_size_request(workspaceDiameter * count, -1);
|
area.set_size_request(workspaceDiameter * count, -1);
|
||||||
const widgetStyleContext = area.get_style_context();
|
const widgetStyleContext = area.get_style_context();
|
||||||
const activeWs = widgetStyleContext.get_property('font-size', Gtk.StateFlags.NORMAL);
|
const activeWs = widgetStyleContext.get_property('font-size', Gtk.StateFlags.NORMAL);
|
||||||
|
|
||||||
const activeWsCenterX = -(workspaceDiameter / 2) + (workspaceDiameter * activeWs);
|
const activeWsCenterX = -(workspaceDiameter / 2) + (workspaceDiameter * activeWs);
|
||||||
const activeWsCenterY = height / 2;
|
const activeWsCenterY = height / 2;
|
||||||
|
|
||||||
// Font
|
// Font
|
||||||
const layout = PangoCairo.create_layout(cr);
|
const layout = PangoCairo.create_layout(cr);
|
||||||
const fontDesc = Pango.font_description_from_string(`${workspaceFontFamily[0]} ${workspaceFontSize}`);
|
const fontDesc = Pango.font_description_from_string(`${workspaceFontFamily[0]} ${workspaceFontSize}`);
|
||||||
layout.set_font_description(fontDesc);
|
layout.set_font_description(fontDesc);
|
||||||
cr.setAntialias(Cairo.Antialias.BEST);
|
cr.setAntialias(Cairo.Antialias.BEST);
|
||||||
// Get kinda min radius for number indicators
|
// Get kinda min radius for number indicators
|
||||||
layout.set_text("0".repeat(count.toString().length), -1);
|
layout.set_text("0".repeat(count.toString().length), -1);
|
||||||
const [layoutWidth, layoutHeight] = layout.get_pixel_size();
|
const [layoutWidth, layoutHeight] = layout.get_pixel_size();
|
||||||
const indicatorRadius = Math.max(layoutWidth, layoutHeight) / 2 * 1.2; // a bit smaller than sqrt(2)*radius
|
const indicatorRadius = Math.max(layoutWidth, layoutHeight) / 2 * 1.2; // a bit smaller than sqrt(2)*radius
|
||||||
const indicatorGap = workspaceRadius - indicatorRadius;
|
const indicatorGap = workspaceRadius - indicatorRadius;
|
||||||
|
|
||||||
// Draw workspace numbers
|
// Draw workspace numbers
|
||||||
for (let i = 1; i <= count; i++) {
|
for (let i = 1; i <= count; i++) {
|
||||||
if (area._workspaceMask & (1 << i)) {
|
if (area._workspaceMask & (1 << i)) {
|
||||||
// Draw bg highlight
|
// Draw bg highlight
|
||||||
cr.setSourceRGBA(occupiedbg.red, occupiedbg.green, occupiedbg.blue, occupiedbg.alpha);
|
cr.setSourceRGBA(occupiedbg.red, occupiedbg.green, occupiedbg.blue, occupiedbg.alpha);
|
||||||
const wsCenterX = -(workspaceRadius) + (workspaceDiameter * i);
|
const wsCenterX = -(workspaceRadius) + (workspaceDiameter * i);
|
||||||
const wsCenterY = height / 2;
|
const wsCenterY = height / 2;
|
||||||
if (!(area._workspaceMask & (1 << (i - 1)))) { // Left
|
if (!(area._workspaceMask & (1 << (i - 1)))) { // Left
|
||||||
cr.arc(wsCenterX, wsCenterY, workspaceRadius, 0.5 * Math.PI, 1.5 * Math.PI);
|
cr.arc(wsCenterX, wsCenterY, workspaceRadius, 0.5 * Math.PI, 1.5 * Math.PI);
|
||||||
cr.fill();
|
cr.fill();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cr.rectangle(wsCenterX - workspaceRadius, wsCenterY - workspaceRadius, workspaceRadius, workspaceRadius * 2)
|
cr.rectangle(wsCenterX - workspaceRadius, wsCenterY - workspaceRadius, workspaceRadius, workspaceRadius * 2)
|
||||||
cr.fill();
|
cr.fill();
|
||||||
}
|
}
|
||||||
if (!(area._workspaceMask & (1 << (i + 1)))) { // Right
|
if (!(area._workspaceMask & (1 << (i + 1)))) { // Right
|
||||||
cr.arc(wsCenterX, wsCenterY, workspaceRadius, -0.5 * Math.PI, 0.5 * Math.PI);
|
cr.arc(wsCenterX, wsCenterY, workspaceRadius, -0.5 * Math.PI, 0.5 * Math.PI);
|
||||||
cr.fill();
|
cr.fill();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
cr.rectangle(wsCenterX, wsCenterY - workspaceRadius, workspaceRadius, workspaceRadius * 2)
|
cr.rectangle(wsCenterX, wsCenterY - workspaceRadius, workspaceRadius, workspaceRadius * 2)
|
||||||
cr.fill();
|
cr.fill();
|
||||||
}
|
|
||||||
|
|
||||||
// Set color for text
|
|
||||||
cr.setSourceRGBA(occupiedfg.red, occupiedfg.green, occupiedfg.blue, occupiedfg.alpha);
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
cr.setSourceRGBA(wsfg.red, wsfg.green, wsfg.blue, wsfg.alpha);
|
|
||||||
layout.set_text(`${i}`, -1);
|
|
||||||
const [layoutWidth, layoutHeight] = layout.get_pixel_size();
|
|
||||||
const x = -workspaceRadius + (workspaceDiameter * i) - (layoutWidth / 2);
|
|
||||||
const y = (height - layoutHeight) / 2;
|
|
||||||
cr.moveTo(x, y);
|
|
||||||
// cr.showText(text);
|
|
||||||
PangoCairo.show_layout(cr, layout);
|
|
||||||
cr.stroke();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Draw active ws
|
// Set color for text
|
||||||
// base
|
cr.setSourceRGBA(occupiedfg.red, occupiedfg.green, occupiedfg.blue, occupiedfg.alpha);
|
||||||
cr.setSourceRGBA(activebg.red, activebg.green, activebg.blue, activebg.alpha);
|
}
|
||||||
cr.arc(activeWsCenterX, activeWsCenterY, indicatorRadius, 0, 2 * Math.PI);
|
else
|
||||||
cr.fill();
|
cr.setSourceRGBA(wsfg.red, wsfg.green, wsfg.blue, wsfg.alpha);
|
||||||
// inner decor
|
layout.set_text(`${i}`, -1);
|
||||||
cr.setSourceRGBA(activefg.red, activefg.green, activefg.blue, activefg.alpha);
|
const [layoutWidth, layoutHeight] = layout.get_pixel_size();
|
||||||
cr.arc(activeWsCenterX, activeWsCenterY, indicatorRadius * 0.2, 0, 2 * Math.PI);
|
const x = -workspaceRadius + (workspaceDiameter * i) - (layoutWidth / 2);
|
||||||
cr.fill();
|
const y = (height - layoutHeight) / 2;
|
||||||
}));
|
cr.moveTo(x, y);
|
||||||
},
|
// cr.showText(text);
|
||||||
|
PangoCairo.show_layout(cr, layout);
|
||||||
|
cr.stroke();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Draw active ws
|
||||||
|
// base
|
||||||
|
cr.setSourceRGBA(activebg.red, activebg.green, activebg.blue, activebg.alpha);
|
||||||
|
cr.arc(activeWsCenterX, activeWsCenterY, indicatorRadius, 0, 2 * Math.PI);
|
||||||
|
cr.fill();
|
||||||
|
// inner decor
|
||||||
|
cr.setSourceRGBA(activefg.red, activefg.green, activefg.blue, activefg.alpha);
|
||||||
|
cr.arc(activeWsCenterX, activeWsCenterY, indicatorRadius * 0.2, 0, 2 * Math.PI);
|
||||||
|
cr.fill();
|
||||||
|
}))
|
||||||
|
,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user