Skip to content

Commit

Permalink
style: formating
Browse files Browse the repository at this point in the history
  • Loading branch information
isabelroses committed May 11, 2024
1 parent 7d0e379 commit 17f8845
Show file tree
Hide file tree
Showing 31 changed files with 846 additions and 344 deletions.
440 changes: 439 additions & 1 deletion docs/pandoc.css

Large diffs are not rendered by default.

13 changes: 7 additions & 6 deletions home/isabel/configs/gui/bars/ags/misc/BatteryIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import Battery from "resource:///com/github/Aylur/ags/service/battery.js";
export default () =>
Widget.Icon({
class_name: "battery",
icon: Battery.bind('icon_name'),
setup: icon => icon.hook(Battery, () => {
icon.toggleClassName('charging', Battery.charging);
icon.toggleClassName('charged', Battery.charged);
icon.toggleClassName('low', Battery.percent < 30);
}),
icon: Battery.bind("icon_name"),
setup: (icon) =>
icon.hook(Battery, () => {
icon.toggleClassName("charging", Battery.charging);
icon.toggleClassName("charged", Battery.charged);
icon.toggleClassName("low", Battery.percent < 30);
}),
});
11 changes: 4 additions & 7 deletions home/isabel/configs/gui/bars/ags/misc/Clock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { clock } from '../variables.js';
import { clock } from "../variables.js";
import Widget from "resource:///com/github/Aylur/ags/widget.js";

/**
Expand All @@ -7,14 +7,11 @@ import Widget from "resource:///com/github/Aylur/ags/widget.js";
* interval?: number,
* }} o
*/
export default ({
format = "%H:%M:%S %B %e. %A",
...rest
} = {}) =>
export default ({ format = "%H:%M:%S %B %e. %A", ...rest } = {}) =>
Widget.Label({
class_name: "clock",
label: clock.bind('value').transform(time => {
return time.format(format) || 'wrong format';
label: clock.bind("value").transform((time) => {
return time.format(format) || "wrong format";
}),
...rest,
});
6 changes: 4 additions & 2 deletions home/isabel/configs/gui/bars/ags/misc/FontIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,10 @@ class FontIcon extends AgsLabel {
}

get size() {
return this.get_style_context()
.get_property("font-size", Gtk.StateFlags.NORMAL);
return this.get_style_context().get_property(
"font-size",
Gtk.StateFlags.NORMAL,
);
}

/** @returns {[number, number]} */
Expand Down
23 changes: 14 additions & 9 deletions home/isabel/configs/gui/bars/ags/misc/OSD.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ export const OnScreenIndicator = ({ height = 300, width = 48 } = {}) =>
css: "padding: 1px;",
child: Widget.Revealer({
transition: "slide_left",
setup: self => self.hook(Indicator, (_, value) => {
self.reveal_child = value > -1;
}),
setup: (self) =>
self.hook(Indicator, (_, value) => {
self.reveal_child = value > -1;
}),
child: Progress({
width,
height,
vertical: true,
setup: self => self.hook(Indicator, (_, value) => self.setValue(value)),
setup: (self) =>
self.hook(Indicator, (_, value) => self.setValue(value)),
child: Widget.Stack({
vpack: "start",
hpack: "center",
Expand All @@ -28,7 +30,8 @@ export const OnScreenIndicator = ({ height = 300, width = 48 } = {}) =>
Widget.Icon({
hpack: "center",
size: width,
setup: w => w.hook(Indicator, (_, _v, name) => w.icon = name || ''),
setup: (w) =>
w.hook(Indicator, (_, _v, name) => (w.icon = name || "")),
}),
],
[
Expand All @@ -37,13 +40,15 @@ export const OnScreenIndicator = ({ height = 300, width = 48 } = {}) =>
hpack: "center",
hexpand: true,
css: `font-size: ${width}px;`,
setup: w => w.hook(Indicator, (_, _v, name) => w.label = name || ''),
setup: (w) =>
w.hook(Indicator, (_, _v, name) => (w.label = name || "")),
}),
],
],
setup: self => self.hook(Indicator, (_, _v, name) => {
self.shown = `${!!Utils.lookUpIcon(name)}`;
}),
setup: (self) =>
self.hook(Indicator, (_, _v, name) => {
self.shown = `${!!Utils.lookUpIcon(name)}`;
}),
}),
}),
}),
Expand Down
8 changes: 4 additions & 4 deletions home/isabel/configs/gui/bars/ags/misc/PopupWindow.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ export class PopupWindow extends AgsWindow {
transition,
child,
transition_duration: options.transition.value,
setup: self => self.hook(App, (_, wname, visible) => {
if (wname === name)
this.revealer.reveal_child = visible;
}),
setup: (self) =>
self.hook(App, (_, wname, visible) => {
if (wname === name) this.revealer.reveal_child = visible;
}),
});

this.child = Widget.Box({
Expand Down
6 changes: 3 additions & 3 deletions home/isabel/configs/gui/bars/ags/misc/RegularWindow.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { subclass } from 'resource:///com/github/Aylur/ags/widget.js';
import Gtk from 'gi://Gtk';
import { subclass } from "resource:///com/github/Aylur/ags/widget.js";
import Gtk from "gi://Gtk";

export default subclass(Gtk.Window, 'RegularWindow');
export default subclass(Gtk.Window, "RegularWindow");
64 changes: 35 additions & 29 deletions home/isabel/configs/gui/bars/ags/misc/mpris.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ export const CoverArt = (player, props) =>
Widget.Box({
...props,
class_name: "cover",
css: player.bind('cover_path').transform(p =>
`background-image: url("${p}")`),
css: player
.bind("cover_path")
.transform((p) => `background-image: url("${p}")`),
});

/**
Expand All @@ -23,9 +24,15 @@ export const BlurredCoverArt = (player, props) =>
Widget.Box({
...props,
class_name: "blurred-cover",
setup: self => self.hook(player, box => blurImg(player.cover_path).then(img => {
img && box.setCss(`background-image: url("${img}")`);
}), 'notify::cover-path'),
setup: (self) =>
self.hook(
player,
(box) =>
blurImg(player.cover_path).then((img) => {
img && box.setCss(`background-image: url("${img}")`);
}),
"notify::cover-path",
),
});

/**
Expand All @@ -36,7 +43,7 @@ export const TitleLabel = (player, props) =>
Widget.Label({
...props,
class_name: "title",
label: player.bind('track_title'),
label: player.bind("track_title"),
});

/**
Expand All @@ -47,7 +54,7 @@ export const ArtistLabel = (player, props) =>
Widget.Label({
...props,
class_name: "artist",
label: player.bind('track_artists').transform(a => a.join(', ') || ''),
label: player.bind("track_artists").transform((a) => a.join(", ") || ""),
});

/**
Expand All @@ -59,12 +66,13 @@ export const PlayerIcon = (player, { symbolic = true, ...props } = {}) =>
...props,
class_name: "player-icon",
tooltip_text: player.identity || "",
setup: self => self.hook(player, icon => {
const name = `${player.entry}${symbolic ? '-symbolic' : ''}`;
Utils.lookUpIcon(name)
? icon.icon = name
: icon.icon = icons.mpris.fallback;
}),
setup: (self) =>
self.hook(player, (icon) => {
const name = `${player.entry}${symbolic ? "-symbolic" : ""}`;
Utils.lookUpIcon(name)
? (icon.icon = name)
: (icon.icon = icons.mpris.fallback);
}),
});

/**
Expand All @@ -76,18 +84,16 @@ export const PositionSlider = (player, props) =>
...props,
class_name: "position-slider",
draw_value: false,
on_change: ({ value }) => player.position = player.length * value,
setup: self => {
on_change: ({ value }) => (player.position = player.length * value),
setup: (self) => {
const update = () => {
if (self.dragging)
return;
if (self.dragging) return;

self.visible = player.length > 0;
if (player.length > 0)
self.value = player.position / player.length;
if (player.length > 0) self.value = player.position / player.length;
};
self.hook(player, update);
self.hook(player, update, 'position');
self.hook(player, update, "position");
self.poll(1000, update);
},
});
Expand All @@ -103,29 +109,29 @@ function lengthStr(length) {
/** @param {import('types/service/mpris').MprisPlayer} player */
export const PositionLabel = (player) =>
Widget.Label({
setup: self => {
setup: (self) => {
const update = (_, time) => {
player.length > 0
? self.label = lengthStr(time || player.position)
: self.visible = !!player;
? (self.label = lengthStr(time || player.position))
: (self.visible = !!player);
};
self.hook(player, update, 'position');
self.hook(player, update, "position");
self.poll(1000, update);
},
});

/** @param {import('types/service/mpris').MprisPlayer} player */
export const LengthLabel = (player) =>
Widget.Label({
label: player.bind('length').transform(l => lengthStr(l)),
visible: player.bind('length').transform(l => l > 0),
label: player.bind("length").transform((l) => lengthStr(l)),
visible: player.bind("length").transform((l) => l > 0),
});

/** @param {import('types/service/mpris').MprisPlayer} player */
export const Slash = (player) =>
Widget.Label({
label: "/",
visible: player.bind('length').transform(l => l > 0),
visible: player.bind("length").transform((l) => l > 0),
});

/**
Expand All @@ -139,9 +145,9 @@ export const Slash = (player) =>
*/
const PlayerButton = ({ player, items, onClick, prop, canProp, cantValue }) =>
Widget.Button({
child: Widget.Stack({ items }).bind('shown', player, prop, p => `${p}`),
child: Widget.Stack({ items }).bind("shown", player, prop, (p) => `${p}`),
on_clicked: () => player[onClick](),
visible: player.bind(canProp).transform(c => c === cantValue),
visible: player.bind(canProp).transform((c) => c === cantValue),
});

/** @param {import('types/service/mpris').MprisPlayer} player */
Expand Down
4 changes: 2 additions & 2 deletions home/isabel/configs/gui/bars/ags/services/colorpicker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Variable } from "resource:///com/github/Aylur/ags/variable.js";
import * as Utils from "resource:///com/github/Aylur/ags/utils.js";
import Service from "resource:///com/github/Aylur/ags/service.js";
import { dependencies } from "../utils.js";
import icons from '../icons.js';
import icons from "../icons.js";

const COLORS_CACHE = Utils.CACHE_DIR + "/colorpicker.json";

Expand Down Expand Up @@ -63,7 +63,7 @@ class Colors extends Service {
iconName: icons.ui.colorpicker,
summary: color,
actions: {
'Copy': () => this.wlCopy(color),
Copy: () => this.wlCopy(color),
},
});
this.#notifID = n.id;
Expand Down
Loading

0 comments on commit 17f8845

Please sign in to comment.